Skip to content

Commit c0710e0

Browse files
committed
Prepare for LRU persistency
1 parent b21cfa0 commit c0710e0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

app/src/processing/app/Base.java

+30
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,36 @@ protected boolean restoreSketches() throws Exception {
559559
return (opened > 0);
560560
}
561561

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

0 commit comments

Comments
 (0)