From b59546eb6933944475bb3751cb7af0db3c3d9a45 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 19 May 2015 16:43:36 -0400 Subject: [PATCH] only show inspector when debugger enabled, change inspector location --- java/src/processing/mode/java/JavaEditor.java | 14 ++++++++++---- .../processing/mode/java/VariableInspector.java | 12 +++++++++--- todo.txt | 11 ++++------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index 5dbd5d4a5..fb82f790c 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -1522,6 +1522,7 @@ public class JavaEditor extends Editor { debugMenu.add(item); item.setEnabled(false); + /* inspectorItem = Toolkit.newJMenuItem(Language.text("menu.debug.show_variables"), 'Y'); inspectorItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -1530,6 +1531,7 @@ public class JavaEditor extends Editor { }); debugMenu.add(inspectorItem); inspectorItem.setEnabled(false); + */ /* item = new JMenuItem(Language.text("menu.debug.list_breakpoints")); @@ -2188,10 +2190,12 @@ public class JavaEditor extends Editor { debugItem.setText(Language.text("menu.debug.enable")); } - // Hide the variable inspector if it's currently visible - if (!debugEnabled && inspector.isVisible()) { - toggleVariableInspector(); - } +// // Hide the variable inspector if it's currently visible +// if (!debugEnabled && inspector.isVisible()) { +// toggleVariableInspector(); +// } + inspector.setVisible(debugEnabled); + /* if (enabled) { inspector.setFocusableWindowState(false); // to not get focus when set visible @@ -2209,6 +2213,7 @@ public class JavaEditor extends Editor { } + /* public void toggleVariableInspector() { if (inspector.isVisible()) { inspectorItem.setText(Language.text("menu.debug.show_variables")); @@ -2220,6 +2225,7 @@ public class JavaEditor extends Editor { // inspector.setFocusableWindowState(true); // allow to get focus again } } + */ // public void showVariableInspector() { diff --git a/java/src/processing/mode/java/VariableInspector.java b/java/src/processing/mode/java/VariableInspector.java index 8b1f9b9f1..e392e22d1 100644 --- a/java/src/processing/mode/java/VariableInspector.java +++ b/java/src/processing/mode/java/VariableInspector.java @@ -111,9 +111,15 @@ public class VariableInspector extends JDialog { getContentPane().add(box); pack(); -// setLocation(editor.getX() + editor.getWidth() + HORIZONTAL_OFFSET, -// editor.getY() + VERTICAL_OFFSET); - setLocationRelativeTo(editor); + int x = editor.getX() + editor.getWidth() + HORIZONTAL_OFFSET; + if (x + getWidth() > getToolkit().getScreenSize().width) { + // If it doesn't fit on screen, place it inside the editor window, + // per the OS rules for window placement + setLocationRelativeTo(editor); + } else { + // If it'll fit, place it to the right of the editor window + setLocation(x, editor.getY() + VERTICAL_OFFSET); + } /* bgColor = mode.getColor("buttons.bgcolor"); diff --git a/todo.txt b/todo.txt index fe90f9e3e..b4a862356 100644 --- a/todo.txt +++ b/todo.txt @@ -1,15 +1,15 @@ 0236 (3.0a9) X show screen dimensions in the Preferences window -gui +gui/pdex/debugger X implement the bottom half of the editor window X editor window draws in stages (at least on OS X) on first view X the console/bottom area stays white until an additional repaint? X fixed these issues and replaced with footer X remove EditorLineStatus (we have line numbers) - - -pdex/debugger +X automatically show the variables window when debugging, hide when not +X ctrl-y shortcut duplicated +X https://github.com/processing/processing/issues/3298 X remove "Experimental Mode: Yikes!" messages o NullPointerException in initiateToolTip() X https://github.com/processing/processing/issues/3286 @@ -52,9 +52,6 @@ _ move Library to LibraryContribution and into contrib? gui _ click a line number to toggle breakpoint -_ automatically show the variables window when debugging, hide when not -_ ctrl-y shortcut duplicated -_ https://github.com/processing/processing/issues/3298 _ need active state for the butterfly _ finish the gui _ https://github.com/processing/processing/issues/3072