1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-26 20:54:22 +01:00

When closing the last sketch, the window position is saved as default

This allows the use-case with users editing one sketch at a time, that
seems to be the most common scenario:

 1. User position the editor as desired
 2. User close the IDE
 3. User opens the IDE by double clicking on another .ino file
 4. The IDE is opened again at the same position

See #4432
This commit is contained in:
Cristian Maglie 2016-01-22 17:55:27 +01:00
parent 61f11f60e1
commit 0bceb93b7c

View File

@ -327,7 +327,7 @@ public class Base {
boolean showEditor = parser.isGuiMode();
if (!parser.isForceSavePrefs())
PreferencesData.setDoSave(showEditor);
if (handleOpen(file, nextEditorLocation(), showEditor, false) == null) {
if (handleOpen(file, retrieveSketchLocation(".default"), showEditor, false) == null) {
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
// Open failure is fatal in upload/verify mode
if (parser.isVerifyOrUploadMode())
@ -528,7 +528,10 @@ public class Base {
PreferencesData.setInteger("last.screen.width", screen.width);
PreferencesData.setInteger("last.screen.height", screen.height);
String untitledPath = untitledFolder.getAbsolutePath();
// If there is only one sketch opened save his position as default
if (editors.size() == 1) {
storeSketchLocation(editors.get(0), ".default");
}
// Save the sketch path and window placement for each open sketch
String untitledPath = untitledFolder.getAbsolutePath();