Skip to content

Commit 423b019

Browse files
committed
Prepare for LRU persistency
1 parent 10ed7df commit 423b019

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
@@ -561,6 +561,36 @@ protected boolean restoreSketches() throws Exception {
561561
return (opened > 0);
562562
}
563563

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

0 commit comments

Comments
 (0)