Skip to content

Commit 917b132

Browse files
committed
Prepare for LRU persistency
1 parent ddd876c commit 917b132

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

app/src/processing/app/Base.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,36 @@ protected boolean restoreSketches() throws Exception {
570570
return (opened > 0);
571571
}
572572

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

0 commit comments

Comments
 (0)