1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Separate screen dimensions storing from recent sketches

This commit is contained in:
Martino Facchin 2017-08-07 10:44:12 +02:00 committed by Cristian Maglie
parent 60c169ce91
commit 8292989e2d

View File

@ -522,16 +522,21 @@ public class Base {
return (opened > 0); return (opened > 0);
} }
/**
* Store screen dimensions on last close
*/
protected void storeScreenDimensions() {
// Save the width and height of the screen
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
PreferencesData.setInteger("last.screen.width", screen.width);
PreferencesData.setInteger("last.screen.height", screen.height);
}
/** /**
* Store list of sketches that are currently open. * Store list of sketches that are currently open.
* Called when the application is quitting and documents are still open. * Called when the application is quitting and documents are still open.
*/ */
protected void storeSketches() { protected void storeSketches() {
// Save the width and height of the screen
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
PreferencesData.setInteger("last.screen.width", screen.width);
PreferencesData.setInteger("last.screen.height", screen.height);
// If there is only one sketch opened save his position as default // If there is only one sketch opened save his position as default
if (editors.size() == 1) { if (editors.size() == 1) {
@ -903,6 +908,7 @@ public class Base {
} }
if (editors.size() == 1) { if (editors.size() == 1) {
storeScreenDimensions();
storeSketches(); storeSketches();
// This will store the sketch count as zero // This will store the sketch count as zero
@ -949,6 +955,7 @@ public class Base {
public boolean handleQuit() { public boolean handleQuit() {
// If quit is canceled, this will be replaced anyway // If quit is canceled, this will be replaced anyway
// by a later handleQuit() that is not canceled. // by a later handleQuit() that is not canceled.
storeScreenDimensions();
storeSketches(); storeSketches();
try { try {
Editor.serialMonitor.close(); Editor.serialMonitor.close();