Skip to content

Commit fb898b7

Browse files
committed
Open new PDE maximized when current PDE is maximized
1 parent 424894e commit fb898b7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/src/processing/app/EditorState.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class EditorState {
5353
// int displayW, displayH;
5454
// String deviceName; // not really useful b/c it's more about bounds anyway
5555
Rectangle deviceBounds;
56+
boolean isMaximized;
5657

5758

5859
/**
@@ -173,6 +174,7 @@ void defaultLocation(List<Editor> editors) {
173174
synchronized (editors) {
174175
final int OVER = 50;
175176
Editor lastOpened = editors.get(editors.size() - 1);
177+
isMaximized = (lastOpened.getExtendedState() == Editor.MAXIMIZED_BOTH);
176178
editorBounds = lastOpened.getBounds();
177179
editorBounds.x += OVER;
178180
editorBounds.y += OVER;
@@ -183,6 +185,10 @@ void defaultLocation(List<Editor> editors) {
183185
editorBounds.x = deviceBounds.x + (int) (Math.random() * (deviceBounds.width - defaultWidth));
184186
editorBounds.y = deviceBounds.y + (int) (Math.random() * (deviceBounds.height - defaultHeight));
185187
}
188+
if (isMaximized) {
189+
editorBounds.width = defaultWidth;
190+
editorBounds.height = defaultHeight;
191+
}
186192
}
187193
}
188194
}
@@ -204,6 +210,9 @@ void apply(Editor editor) {
204210
if (dividerLocation != 0) {
205211
editor.setDividerLocation(dividerLocation);
206212
}
213+
if (isMaximized) {
214+
editor.setExtendedState(Editor.MAXIMIZED_BOTH);
215+
}
207216
}
208217

209218

0 commit comments

Comments
 (0)