mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Open new PDE maximized when current PDE is maximized
This commit is contained in:
@@ -53,6 +53,7 @@ public class EditorState {
|
||||
// int displayW, displayH;
|
||||
// String deviceName; // not really useful b/c it's more about bounds anyway
|
||||
Rectangle deviceBounds;
|
||||
boolean isMaximized;
|
||||
|
||||
|
||||
/**
|
||||
@@ -173,6 +174,7 @@ public class EditorState {
|
||||
synchronized (editors) {
|
||||
final int OVER = 50;
|
||||
Editor lastOpened = editors.get(editors.size() - 1);
|
||||
isMaximized = (lastOpened.getExtendedState() == Editor.MAXIMIZED_BOTH);
|
||||
editorBounds = lastOpened.getBounds();
|
||||
editorBounds.x += OVER;
|
||||
editorBounds.y += OVER;
|
||||
@@ -183,6 +185,10 @@ public class EditorState {
|
||||
editorBounds.x = deviceBounds.x + (int) (Math.random() * (deviceBounds.width - defaultWidth));
|
||||
editorBounds.y = deviceBounds.y + (int) (Math.random() * (deviceBounds.height - defaultHeight));
|
||||
}
|
||||
if (isMaximized) {
|
||||
editorBounds.width = defaultWidth;
|
||||
editorBounds.height = defaultHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,6 +210,9 @@ public class EditorState {
|
||||
if (dividerLocation != 0) {
|
||||
editor.setDividerLocation(dividerLocation);
|
||||
}
|
||||
if (isMaximized) {
|
||||
editor.setExtendedState(Editor.MAXIMIZED_BOTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user