Changeset 2162 in josm for trunk/src/org
- Timestamp:
- 2009-09-20T09:52:57+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r2070 r2162 575 575 576 576 static public void saveGuiGeometry() { 577 // save the current window geometry 577 // save the current window geometry and the width of the toggle dialog area 578 578 String newGeometry = ""; 579 String newToggleDlgWidth = ""; 579 580 try { 580 581 if (((JFrame)parent).getExtendedState() == JFrame.NORMAL) { … … 599 600 newGeometry = width + "x" + height + "+" + x + "+" + y; 600 601 } 602 603 newToggleDlgWidth = Integer.toString(map.getToggleDlgWidth()); 604 if (newToggleDlgWidth.equals(Integer.toString(map.DEF_TOGGLE_DLG_WIDTH))) { 605 newToggleDlgWidth = ""; 606 } 601 607 } 602 608 catch (Exception e) { … … 604 610 } 605 611 pref.put("gui.geometry", newGeometry); 612 pref.put("toggleDialogs.width", newToggleDlgWidth); 606 613 } 607 614 -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r2123 r2162 6 6 import java.awt.Component; 7 7 import java.awt.Container; 8 import java.awt.Dimension; 8 9 import java.util.ArrayList; 9 10 … … 12 13 import javax.swing.BoxLayout; 13 14 import javax.swing.ButtonGroup; 15 import javax.swing.JSplitPane; 14 16 import javax.swing.JPanel; 15 17 import javax.swing.JToolBar; 18 import javax.swing.border.Border; 19 import javax.swing.plaf.basic.BasicSplitPaneUI; 20 import javax.swing.plaf.basic.BasicSplitPaneDivider; 16 21 17 22 import org.openstreetmap.josm.Main; … … 24 29 import org.openstreetmap.josm.gui.dialogs.CommandStackDialog; 25 30 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 31 import org.openstreetmap.josm.gui.dialogs.FilterDialog; 26 32 import org.openstreetmap.josm.gui.dialogs.HistoryDialog; 27 33 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; … … 29 35 import org.openstreetmap.josm.gui.dialogs.RelationListDialog; 30 36 import org.openstreetmap.josm.gui.dialogs.SelectionListDialog; 31 import org.openstreetmap.josm.gui.dialogs.FilterDialog;32 37 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 33 38 import org.openstreetmap.josm.gui.dialogs.UserListDialog; … … 74 79 75 80 public final ButtonGroup toolGroup = new ButtonGroup(); 81 82 /** 83 * Default width of the toggle dialog area. 84 */ 85 public final int DEF_TOGGLE_DLG_WIDTH = 330; 76 86 77 87 public MapFrame() { … … 79 89 setLayout(new BorderLayout()); 80 90 81 add(mapView = new MapView(), BorderLayout.CENTER);91 mapView = new MapView(); 82 92 83 93 new FileDrop(mapView); … … 96 106 toolGroup.setSelected(((AbstractButton)toolBarActions.getComponent(0)).getModel(), true); 97 107 98 add(toggleDialogs, BorderLayout.EAST); 108 JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, 109 mapView, toggleDialogs); 110 111 /** 112 * All additional space goes to the mapView 113 */ 114 splitPane.setResizeWeight(1.0); 115 116 /** 117 * Some beautifications. 118 */ 119 splitPane.setDividerSize(5); 120 splitPane.setBorder(null); 121 splitPane.setUI(new BasicSplitPaneUI() { 122 public BasicSplitPaneDivider createDefaultDivider() { 123 return new BasicSplitPaneDivider(this) { 124 public void setBorder(Border b) { 125 } 126 }; 127 } 128 }); 129 130 add(splitPane, BorderLayout.CENTER); 131 99 132 toggleDialogs.setLayout(new BoxLayout(toggleDialogs, BoxLayout.Y_AXIS)); 133 toggleDialogs.setPreferredSize(new Dimension(Main.pref.getInteger("toggleDialogs.width",DEF_TOGGLE_DLG_WIDTH), 0)); 134 135 toggleDialogs.setMinimumSize(new Dimension(24, 0)); 136 mapView.setMinimumSize(new Dimension(10,0)); 100 137 101 138 toolBarToggle.setFloatable(false); … … 268 305 return null; 269 306 } 307 308 /** 309 * Returns the current width of the (possibly resized) toggle dialog area 310 */ 311 public int getToggleDlgWidth() { 312 return toggleDialogs.getWidth(); 313 } 270 314 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r2111 r2162 97 97 private boolean isCollapsed; 98 98 99 /** the preferred width of all docked toggle dialogs */100 final private int TOGGLE_DIALOG_WIDTH = 330;101 99 /** the preferred height if the toggle dialog is expanded */ 102 100 private int preferredHeight; … … 131 129 */ 132 130 private void init(String name, String iconName, String tooltip, Shortcut shortcut, final int preferredHeight) { 133 setPreferredSize(new Dimension(TOGGLE_DIALOG_WIDTH, preferredHeight)); 131 /** Use the full width of the parent element */ 132 setPreferredSize(new Dimension(0, preferredHeight)); 133 /** Override any minimum sizes of child elements so the user can resize freely */ 134 setMinimumSize(new Dimension(0,0)); 134 135 this.preferredHeight = preferredHeight; 135 136 toggleAction = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortcut, iconName); … … 139 140 setLayout(new BorderLayout()); 140 141 141 / / show the minimize button142 /** show the minimize button */ 142 143 lblMinimized = new JLabel(ImageProvider.get("misc", "normal")); 143 144 titleBar = new TitleBar(name, iconName); … … 185 186 isCollapsed = true; 186 187 Main.pref.put(preferencePrefix+".minimized", true); 187 setPreferredSize(new Dimension( TOGGLE_DIALOG_WIDTH,20));188 setMaximumSize(new Dimension( TOGGLE_DIALOG_WIDTH,20));188 setPreferredSize(new Dimension(0,20)); 189 setMaximumSize(new Dimension(Integer.MAX_VALUE,20)); 189 190 lblMinimized.setIcon(ImageProvider.get("misc", "minimized")); 190 191 refreshToggleDialogsView(); … … 198 199 isCollapsed = false; 199 200 Main.pref.put(preferencePrefix+".minimized", false); 200 setPreferredSize(new Dimension( TOGGLE_DIALOG_WIDTH,preferredHeight));201 setMaximumSize(new Dimension( Short.MAX_VALUE, Short.MAX_VALUE));201 setPreferredSize(new Dimension(0,preferredHeight)); 202 setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); 202 203 lblMinimized.setIcon(ImageProvider.get("misc", "normal")); 203 204 refreshToggleDialogsView(); … … 522 523 */ 523 524 protected Dimension getDefaultDetachedSize() { 524 return new Dimension( TOGGLE_DIALOG_WIDTH, preferredHeight);525 return new Dimension(Main.map.DEF_TOGGLE_DLG_WIDTH, preferredHeight); 525 526 } 526 527 }
Note:
See TracChangeset
for help on using the changeset viewer.