Skip to content

Commit

Permalink
Prepare for LRU persistency
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed Mar 8, 2019
1 parent b21cfa0 commit c0710e0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,36 @@ protected boolean restoreSketches() throws Exception {
return (opened > 0);
}

protected boolean restoreRecentlyUsedBoards() throws Exception {
// Iterate through all sketches that were open last time p5 was running.
// If !windowPositionValid, then ignore the coordinates found for each.

// Save the sketch path and window placement for each open sketch
int count = PreferencesData.getInteger("last.recent_boards.count");
int opened = 0;
for (int i = count - 1; i >= 0; i--) {
String fqbn = PreferencesData.get("last.recent_board" + i + ".fqbn");
if (fqbn == null) {
continue;
}
//selectTargetBoard(new TargetBoard());
}
return count != 0;
}

/**
* Store list of sketches that are currently open.
* Called when the application is quitting and documents are still open.
*/
protected void storeRecentlyUsedBoards() {
int i = 0;
for (TargetBoard board : BaseNoGui.getRecentlyUsedBoards()) {
PreferencesData.set("last.recent_board" + i + ".fqbn", board.getFQBN());
i++;
}
PreferencesData.setInteger("last.recent_boards.count", BaseNoGui.getRecentlyUsedBoards().size());
}

/**
* Store screen dimensions on last close
*/
Expand Down

0 comments on commit c0710e0

Please sign in to comment.