Merge remote-tracking branch

'origin/GP-2840-dragonmacher-window-positioning--SQUASHED' (Closes #293,
Closes #3788)
This commit is contained in:
Ryan Kurtz 2023-09-26 13:03:16 -04:00
commit a78ef42dc9
2 changed files with 12 additions and 24 deletions

View file

@ -55,6 +55,8 @@ class RootNode extends WindowNode {
*
* @param mgr the DockingWindowsManager
* @param toolName the name of the tool to be displayed in all the top-level windows.
* @param images the frame icons
* @param isModal true if modal
* @param factory a factory for creating drop targets for this nodes windows; may be null
*/
RootNode(DockingWindowManager mgr, String toolName, List<Image> images, boolean isModal,
@ -198,7 +200,10 @@ class RootNode extends WindowNode {
void setVisible(boolean state) {
Window mainWindow = getMainWindow();
mainWindow.setVisible(state);
if (state) {
WindowUtilities.ensureOnScreen(mainWindow);
}
Iterator<DetachedWindowNode> it = detachedWindows.iterator();
while (it.hasNext()) {
@ -232,11 +237,6 @@ class RootNode extends WindowNode {
notifyWindowAdded(windowNode);
}
/**
* Adds the component to the main window.
*
* @param info the component to be added.
*/
void add(ComponentPlaceholder info, WindowPosition initialPosition) {
if (initialPosition == WindowPosition.WINDOW) {
add(info);
@ -373,9 +373,6 @@ class RootNode extends WindowNode {
node.parent = null;
}
/**
* Returns the main frame of the tool.
*/
public JFrame getFrame() {
return windowWrapper.getParentFrame();
}
@ -398,10 +395,7 @@ class RootNode extends WindowNode {
return toolName;
}
/**
* Returns list of detached windows (WindowNode objects).
*/
public List<DetachedWindowNode> getDetachedWindows() {
List<DetachedWindowNode> getDetachedWindows() {
return detachedWindows;
}
@ -475,10 +469,12 @@ class RootNode extends WindowNode {
int y = Integer.parseInt(rootNodeElement.getAttributeValue("Y_POS"));
int width = Integer.parseInt(rootNodeElement.getAttributeValue("WIDTH"));
int height = Integer.parseInt(rootNodeElement.getAttributeValue("HEIGHT"));
int extendedState = Integer.parseInt(rootNodeElement.getAttributeValue("EX_STATE"));
JFrame frame = windowWrapper.getParentFrame();
Rectangle bounds = new Rectangle(x, y, width, height);
WindowUtilities.ensureOnScreen(frame, bounds);
frame.setBounds(bounds);
frame.setExtendedState(extendedState);
List<ComponentPlaceholder> restoredPlaceholders = new ArrayList<>();
Iterator<?> elementIterator = rootNodeElement.getChildren().iterator();

View file

@ -23,7 +23,7 @@ import java.util.Objects;
import javax.swing.SwingUtilities;
import ghidra.util.SystemUtilities;
import ghidra.util.Swing;
/**
* A collection of window related utility methods
@ -455,7 +455,7 @@ public class WindowUtilities {
// WindowListener.windowActivated() callback. During this callback, it is possible that
// the focus owner is not correct, as it will be changed to the window under activation.
// If we invoke later, the the call will happen when focus has been transitioned.
SystemUtilities.runSwingLater(() -> doBringModalestDialogToFront(activeWindow));
Swing.runLater(() -> doBringModalestDialogToFront(activeWindow));
}
private static void doBringModalestDialogToFront(Window activeWindow) {
@ -464,7 +464,7 @@ public class WindowUtilities {
return;
}
SystemUtilities.runSwingLater(() -> modalestDialog.toFront());
Swing.runLater(modalestDialog::toFront);
}
/** Class that knows the screen bounds, insets and bounds without the insets */
@ -483,14 +483,6 @@ public class WindowUtilities {
this.usableBounds = new Rectangle(x, y, width, height);
}
/**
* Gets the full size of this bounds object, including the insets
* @return the full size of this bounds object, including the insets
*/
Rectangle getFullBounds() {
return fullBounds;
}
/**
* Returns the size not including the insets
* @return the size not including the insets