From 75eda2482ee068d709ca73576924c94e9ec6a41f Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 13 Dec 2005 20:13:49 +0000 Subject: [PATCH] clean up some button and text field placement issues with osx --- app/EditorButtons.java | 8 +++++--- app/EditorStatus.java | 17 +++++++++++------ app/Preferences.java | 18 +++++++++++++++--- todo.txt | 2 ++ 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/app/EditorButtons.java b/app/EditorButtons.java index 3dd9d766b..0a04913f1 100644 --- a/app/EditorButtons.java +++ b/app/EditorButtons.java @@ -41,9 +41,11 @@ public class EditorButtons extends JComponent implements MouseInputListener { }; static final int BUTTON_COUNT = title.length; - static final int BUTTON_WIDTH = 27; //Preferences.GRID_SIZE; - static final int BUTTON_HEIGHT = 32; //Preferences.GRID_SIZE; - static final int BUTTON_GAP = 15; //BUTTON_WIDTH / 2; + /// height, width of the toolbar buttons + static final int BUTTON_WIDTH = 27; + static final int BUTTON_HEIGHT = 32; + /// amount of space between groups of buttons on the toolbar + static final int BUTTON_GAP = 15; static final int RUN = 0; static final int STOP = 1; diff --git a/app/EditorStatus.java b/app/EditorStatus.java index 7ea648a12..bd0e05cc6 100644 --- a/app/EditorStatus.java +++ b/app/EditorStatus.java @@ -373,18 +373,23 @@ public class EditorStatus extends JPanel implements ActionListener { int noLeft = cancelLeft - eachButton; int yesLeft = noLeft - eachButton; - System.out.println("setting button height to " + Preferences.BUTTON_HEIGHT); yesButton.setLocation(yesLeft, top); noButton.setLocation(noLeft, top); cancelButton.setLocation(cancelLeft, top); - editField.setLocation(yesLeft - Preferences.BUTTON_WIDTH, top); okButton.setLocation(noLeft, top); - yesButton.setSize( Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); - noButton.setSize( Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); + yesButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); + noButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); cancelButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); - okButton.setSize( Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); - editField.setSize( 2*Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); + okButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); + + // edit field height is awkward, and very different between mac and pc, + // so use at least the preferred height for now. + int editWidth = 2*Preferences.BUTTON_WIDTH; + int editHeight = editField.getPreferredSize().height; + int editTop = (1 + sizeH - editHeight) / 2; // add 1 for ceil + editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop, + editWidth, editHeight); } diff --git a/app/Preferences.java b/app/Preferences.java index f8d5c18bc..a43464fd7 100644 --- a/app/Preferences.java +++ b/app/Preferences.java @@ -71,11 +71,23 @@ public class Preferences extends JComponent { static final String PROMPT_OK = "OK"; static final String PROMPT_BROWSE = "Browse"; - // mac needs it to be 70, windows needs 66, linux needs 76 + /** + * Standardized width for buttons. Mac OS X 10.3 wants 70 as its default, + * Windows XP needs 66, and Linux needs 76, so 76 seems proper. + */ static int BUTTON_WIDTH = 76; - // + /** + * Standardized button height. Mac OS X 10.3 (Java 1.4) wants 29, + * presumably because it now includes the blue border, where it didn't + * in Java 1.3. Windows XP only wants 23 (not sure what default Linux + * would be). Because of the disparity, on Mac OS X, it will be set + * inside a static block. + */ static int BUTTON_HEIGHT = 24; + static { + if (Base.isMacOS()) BUTTON_HEIGHT = 29; + } // value for the size bars, buttons, etc @@ -375,7 +387,7 @@ public class Preferences extends JComponent { pain.add(button); d2 = button.getPreferredSize(); BUTTON_HEIGHT = d2.height; - System.out.println("changing button height to " + BUTTON_HEIGHT); + //System.out.println("changing button height to " + BUTTON_HEIGHT); // smoosh up to the line before //top -= BUTTON_HEIGHT; diff --git a/todo.txt b/todo.txt index c2ed6d4c3..81c776250 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,6 @@ 0099 pde +X make buttons for editor status taller on macosx +X also fix the editor text field placement a bit _ deal with "could not delete stderr.txt" messages _ probably screwed up the temp folder stuff