Changeset 17706 in josm for trunk


Ignore:
Timestamp:
2021-04-07T20:43:30+02:00 (4 years ago)
Author:
simon04
Message:

fix #19126 - Add display preference "Remember dialog geometries"

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java

    r17298 r17706  
    3737import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;
    3838import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
     39import org.openstreetmap.josm.gui.util.WindowGeometry;
    3940import org.openstreetmap.josm.gui.widgets.FileChooserManager;
    4041import org.openstreetmap.josm.gui.widgets.JosmComboBox;
     
    9192    private final JCheckBox dynamicButtons = new JCheckBox(tr("Dynamic buttons in side menus"));
    9293    private final JCheckBox isoDates = new JCheckBox(tr("Display ISO dates"));
     94    private final JCheckBox dialogGeometry = new JCheckBox(tr("Remember dialog geometries"));
    9395    private final JCheckBox nativeFileChoosers = new JCheckBox(tr("Use native file choosers (nicer, but do not support file filters)"));
    9496    private final JCheckBox zoomReverseWheel = new JCheckBox(tr("Reverse zoom with mouse wheel"));
     
    182184        isoDates.setSelected(DateUtils.PROP_ISO_DATES.get());
    183185        panel.add(isoDates, GBC.eop().insets(20, 0, 0, 0));
     186
     187        dialogGeometry.setSelected(WindowGeometry.GUI_GEOMETRY_ENABLED.get());
     188        panel.add(dialogGeometry, GBC.eop().insets(20, 0, 0, 0));
    184189
    185190        nativeFileChoosers.setToolTipText(
     
    234239        Config.getPref().putBoolean(ToggleDialog.PROP_DYNAMIC_BUTTONS.getKey(), dynamicButtons.isSelected());
    235240        Config.getPref().putBoolean(DateUtils.PROP_ISO_DATES.getKey(), isoDates.isSelected());
     241        WindowGeometry.GUI_GEOMETRY_ENABLED.put(dialogGeometry.isSelected());
    236242        Config.getPref().putBoolean(FileChooserManager.PROP_USE_NATIVE_FILE_DIALOG.getKey(), nativeFileChoosers.isSelected());
    237243        MapMover.PROP_ZOOM_REVERSE_WHEEL.put(zoomReverseWheel.isSelected());
  • trunk/src/org/openstreetmap/josm/gui/util/WindowGeometry.java

    r17705 r17706  
    2121import javax.swing.JComponent;
    2222
     23import org.openstreetmap.josm.data.preferences.BooleanProperty;
    2324import org.openstreetmap.josm.gui.MainApplication;
    2425import org.openstreetmap.josm.spi.preferences.Config;
     
    3940     */
    4041    public static final String PREF_KEY_GUI_GEOMETRY = "gui.geometry";
     42
     43    /**
     44     * Whether storing/restoring of geometries to/from preferences is enabled
     45     */
     46    public static final BooleanProperty GUI_GEOMETRY_ENABLED = new BooleanProperty(PREF_KEY_GUI_GEOMETRY + ".enabled", true);
    4147
    4248    /** the top left point */
     
    214220
    215221    protected final void initFromPreferences(String preferenceKey) throws WindowGeometryException {
     222        if (!GUI_GEOMETRY_ENABLED.get()) {
     223            throw new WindowGeometryException("window geometry from preferences is disabled");
     224        }
    216225        String value = Config.getPref().get(preferenceKey);
    217226        if (value.isEmpty())
Note: See TracChangeset for help on using the changeset viewer.