Skip to content

Commit 86de4bf

Browse files
committed
Prepare for LRU persistency
1 parent 15b6d64 commit 86de4bf

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Diff for: app/src/processing/app/Base.java

+30
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,36 @@ protected boolean restoreSketches() throws Exception {
565565
return (opened > 0);
566566
}
567567

568+
protected boolean restoreRecentlyUsedBoards() throws Exception {
569+
// Iterate through all sketches that were open last time p5 was running.
570+
// If !windowPositionValid, then ignore the coordinates found for each.
571+
572+
// Save the sketch path and window placement for each open sketch
573+
int count = PreferencesData.getInteger("last.recent_boards.count");
574+
int opened = 0;
575+
for (int i = count - 1; i >= 0; i--) {
576+
String fqbn = PreferencesData.get("last.recent_board" + i + ".fqbn");
577+
if (fqbn == null) {
578+
continue;
579+
}
580+
//selectTargetBoard(new TargetBoard());
581+
}
582+
return count != 0;
583+
}
584+
585+
/**
586+
* Store list of sketches that are currently open.
587+
* Called when the application is quitting and documents are still open.
588+
*/
589+
protected void storeRecentlyUsedBoards() {
590+
int i = 0;
591+
for (TargetBoard board : BaseNoGui.getRecentlyUsedBoards()) {
592+
PreferencesData.set("last.recent_board" + i + ".fqbn", board.getFQBN());
593+
i++;
594+
}
595+
PreferencesData.setInteger("last.recent_boards.count", BaseNoGui.getRecentlyUsedBoards().size());
596+
}
597+
568598
/**
569599
* Store screen dimensions on last close
570600
*/

0 commit comments

Comments
 (0)