Merge pull request #2037 from AmnonOwed/Fix#1984NewMaximizedPDE

Open new PDE maximized when current PDE is maximized
This commit is contained in:
Ben Fry
2013-09-25 09:17:58 -07:00
+9
View File
@@ -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);
}
}