Changeset 12347 in josm
- Timestamp:
- 2017-06-08T23:22:59+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r12267 r12347 54 54 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 55 55 import org.openstreetmap.josm.data.ViewportData; 56 import org.openstreetmap.josm.data.preferences.BooleanProperty; 57 import org.openstreetmap.josm.data.preferences.IntegerProperty; 56 58 import org.openstreetmap.josm.gui.dialogs.ChangesetDialog; 57 59 import org.openstreetmap.josm.gui.dialogs.CommandStackDialog; … … 83 85 import org.openstreetmap.josm.tools.Shortcut; 84 86 85 86 87 /** 87 88 * One Map frame with one dataset behind. This is the container gui class whose … … 91 92 */ 92 93 public class MapFrame extends JPanel implements Destroyable, ActiveLayerChangeListener, LayerChangeListener { 93 94 /** 95 * Default width of the toggle dialog area. 96 */ 97 public static final int DEF_TOGGLE_DLG_WIDTH = 330; 98 99 private final static IntegerProperty TOGGLE_DIALOGS_WIDTH = new IntegerProperty("toggleDialogs.width", DEF_TOGGLE_DLG_WIDTH); 100 /** 101 * Do not require to switch modes (potlatch style workflow) for drawing/selecting map modes. 102 * @since 12347 103 */ 104 public final static BooleanProperty MODELESS = new BooleanProperty("modeless", false); 94 105 /** 95 106 * The current mode, this frame operates. … … 177 188 178 189 /** 179 * Default width of the toggle dialog area.180 */181 public static final int DEF_TOGGLE_DLG_WIDTH = 330;182 183 /**184 190 * Constructs a new {@code MapFrame}. 185 191 * @param viewportData the initial viewport of the map. Can be null, then … … 221 227 222 228 dialogsPanel.setLayout(new BoxLayout(dialogsPanel, BoxLayout.Y_AXIS)); 223 dialogsPanel.setPreferredSize(new Dimension( Main.pref.getInteger("toggleDialogs.width", DEF_TOGGLE_DLG_WIDTH), 0));229 dialogsPanel.setPreferredSize(new Dimension(TOGGLE_DIALOGS_WIDTH.get(), 0)); 224 230 dialogsPanel.setMinimumSize(new Dimension(24, 0)); 225 231 mapView.setMinimumSize(new Dimension(10, 0)); … … 289 295 290 296 public boolean selectSelectTool(boolean onlyIfModeless) { 291 if (onlyIfModeless && !M ain.pref.getBoolean("modeless", false))297 if (onlyIfModeless && !MODELESS.get()) 292 298 return false; 293 299 … … 296 302 297 303 public boolean selectDrawTool(boolean onlyIfModeless) { 298 if (onlyIfModeless && !M ain.pref.getBoolean("modeless", false))304 if (onlyIfModeless && !MODELESS.get()) 299 305 return false; 300 306 … … 303 309 304 310 public boolean selectZoomTool(boolean onlyIfModeless) { 305 if (onlyIfModeless && !M ain.pref.getBoolean("modeless", false))311 if (onlyIfModeless && !MODELESS.get()) 306 312 return false; 307 313 … … 335 341 } 336 342 343 /** 344 * Gets the action of the default (first) map mode 345 * @return That action 346 */ 337 347 public Action getDefaultButtonAction() { 338 348 return ((AbstractButton) toolBarActions.getComponent(0)).getAction(); … … 346 356 } 347 357 358 /** 359 * Adds a new toggle dialog to the left button list. It is displayed in expert and normal mode 360 * @param dlg The dialog 361 * @return The button 362 */ 348 363 public IconToggleButton addToggleDialog(final ToggleDialog dlg) { 349 364 return addToggleDialog(dlg, false); … … 663 678 } 664 679 680 /** 681 * Shows or hides the side dialog panel 682 * @param visible The new visibility 683 */ 665 684 public void setDialogsPanelVisible(boolean visible) { 666 685 rememberToggleDialogWidth(); 667 686 dialogsPanel.setVisible(visible); 668 splitPane.setDividerLocation(visible ? splitPane.getWidth() -Main.pref.getInteger("toggleDialogs.width", DEF_TOGGLE_DLG_WIDTH) : 0);687 splitPane.setDividerLocation(visible ? splitPane.getWidth() - TOGGLE_DIALOGS_WIDTH.get() : 0); 669 688 splitPane.setDividerSize(visible ? 5 : 0); 670 689 } … … 675 694 public void rememberToggleDialogWidth() { 676 695 if (dialogsPanel.isVisible()) { 677 Main.pref.putInteger("toggleDialogs.width", splitPane.getWidth()-splitPane.getDividerLocation());696 TOGGLE_DIALOGS_WIDTH.put(splitPane.getWidth() - splitPane.getDividerLocation()); 678 697 } 679 698 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r11713 r12347 27 27 import org.openstreetmap.josm.actions.ExpertToggleAction; 28 28 import org.openstreetmap.josm.data.preferences.StringProperty; 29 import org.openstreetmap.josm.gui.MapFrame; 29 30 import org.openstreetmap.josm.gui.MapMover; 30 31 import org.openstreetmap.josm.gui.NavigatableComponent; … … 135 136 136 137 modeless.setToolTipText(tr("Do not require to switch modes (potlatch style workflow)")); 137 modeless.setSelected(Ma in.pref.getBoolean("modeless", false));138 modeless.setSelected(MapFrame.MODELESS.get()); 138 139 ExpertToggleAction.addVisibilitySwitcher(modeless); 139 140 … … 203 204 Main.pref.put("osm-primitives.showid", showID.isSelected()); 204 205 Main.pref.put("osm-primitives.localize-name", showLocalizedName.isSelected()); 205 Ma in.pref.put("modeless",modeless.isSelected());206 MapFrame.MODELESS.put(modeless.isSelected()); 206 207 Main.pref.put(ToggleDialog.PROP_DYNAMIC_BUTTONS.getKey(), dynamicButtons.isSelected()); 207 208 Main.pref.put(DateUtils.PROP_ISO_DATES.getKey(), isoDates.isSelected());
Note:
See TracChangeset
for help on using the changeset viewer.