mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-14 11:29:26 +01:00
Maximized state of IDE gets properly stored and restored. Fixes #2909
This commit is contained in:
parent
d00ca7f387
commit
f255319f91
@ -558,7 +558,7 @@ public class Base {
|
|||||||
location = nextEditorLocation();
|
location = nextEditorLocation();
|
||||||
}
|
}
|
||||||
// If file did not exist, null will be returned for the Editor
|
// If file did not exist, null will be returned for the Editor
|
||||||
if (handleOpen(new File(path), location, true, false, false) != null) {
|
if (handleOpen(new File(path), location, nextEditorLocation(), true, false, false) != null) {
|
||||||
opened++;
|
opened++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -890,10 +890,10 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Editor handleOpen(File file, int[] location, boolean showEditor, boolean untitled) throws Exception {
|
protected Editor handleOpen(File file, int[] location, boolean showEditor, boolean untitled) throws Exception {
|
||||||
return handleOpen(file, location, showEditor, true, untitled);
|
return handleOpen(file, location, location, showEditor, true, untitled);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Editor handleOpen(File file, int[] location, boolean showEditor, boolean storeOpenedSketches, boolean untitled) throws Exception {
|
protected Editor handleOpen(File file, int[] storedLocation, int[] defaultLocation, boolean showEditor, boolean storeOpenedSketches, boolean untitled) throws Exception {
|
||||||
if (!file.exists()) return null;
|
if (!file.exists()) return null;
|
||||||
|
|
||||||
// Cycle through open windows to make sure that it's not already open.
|
// Cycle through open windows to make sure that it's not already open.
|
||||||
@ -905,7 +905,7 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Editor editor = new Editor(this, file, location, BaseNoGui.getPlatform());
|
Editor editor = new Editor(this, file, storedLocation, defaultLocation, BaseNoGui.getPlatform());
|
||||||
|
|
||||||
// Make sure that the sketch actually loaded
|
// Make sure that the sketch actually loaded
|
||||||
if (editor.getSketch() == null) {
|
if (editor.getSketch() == null) {
|
||||||
|
@ -179,7 +179,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
private Runnable exportAppHandler;
|
private Runnable exportAppHandler;
|
||||||
|
|
||||||
|
|
||||||
public Editor(Base ibase, File file, int[] location, Platform platform) throws Exception {
|
public Editor(Base ibase, File file, int[] storedLocation, int[] defaultLocation, Platform platform) throws Exception {
|
||||||
super("Arduino");
|
super("Arduino");
|
||||||
this.base = ibase;
|
this.base = ibase;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
@ -326,7 +326,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
// System.out.println("t2");
|
// System.out.println("t2");
|
||||||
|
|
||||||
// Set the window bounds and the divider location before setting it visible
|
// Set the window bounds and the divider location before setting it visible
|
||||||
setPlacement(location);
|
setPlacement(storedLocation, defaultLocation);
|
||||||
|
|
||||||
|
|
||||||
// Set the minimum size for the editor window
|
// Set the minimum size for the editor window
|
||||||
@ -414,6 +414,14 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setPlacement(int[] storedLocation, int[] defaultLocation) {
|
||||||
|
if (storedLocation.length > 5 && storedLocation[5] != 0) {
|
||||||
|
setExtendedState(storedLocation[5]);
|
||||||
|
setPlacement(defaultLocation);
|
||||||
|
} else {
|
||||||
|
setPlacement(storedLocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setPlacement(int[] location) {
|
private void setPlacement(int[] location) {
|
||||||
setBounds(location[0], location[1], location[2], location[3]);
|
setBounds(location[0], location[1], location[2], location[3]);
|
||||||
@ -422,9 +430,8 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected int[] getPlacement() {
|
protected int[] getPlacement() {
|
||||||
int[] location = new int[5];
|
int[] location = new int[6];
|
||||||
|
|
||||||
// Get the dimensions of the Frame
|
// Get the dimensions of the Frame
|
||||||
Rectangle bounds = getBounds();
|
Rectangle bounds = getBounds();
|
||||||
@ -435,6 +442,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
|
|
||||||
// Get the current placement of the divider
|
// Get the current placement of the divider
|
||||||
location[4] = splitPane.getDividerLocation();
|
location[4] = splitPane.getDividerLocation();
|
||||||
|
location[5] = getExtendedState() & MAXIMIZED_BOTH;
|
||||||
|
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user