Changeset 4835 in josm


Ignore:
Timestamp:
2012-01-21T14:04:36+01:00 (8 years ago)
Author:
simon04
Message:

see #7184 - hide DeleteAction, ExtrudeAction, ParallelWayAction by default for non-expert users

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/IconToggleButton.java

    r4669 r4835  
    2626    private ShowHideButtonListener listener;
    2727    private boolean hideIfDisabled=false;
     28    private boolean hiddenByDefault;
    2829
    2930    /**
     
    3132     */
    3233    public IconToggleButton(Action action) {
     34        this(action, false);
     35    }
     36
     37    /**
     38     * Construct the toggle button with the given action.
     39     */
     40    public IconToggleButton(Action action, boolean hiddenByDefault) {
    3341        super(action);
     42        this.hiddenByDefault = hiddenByDefault;
    3443        setText(null);
    3544
     
    7988    public void applyButtonHiddenPreferences() {
    8089        boolean alwaysHideDisabled = Main.pref.getBoolean("sidetoolbar.hideDisabledButtons", false);
    81         boolean hiddenFlag = Main.pref.getBoolean(getPreferenceKey(), false);
     90        boolean hiddenFlag = Main.pref.getBoolean(getPreferenceKey(), hiddenByDefault);
    8291        if (!isEnabled() && (hideIfDisabled || alwaysHideDisabled))
    8392                setVisible(false);  // hide because of disabled button
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r4669 r4835  
    145145        addMapMode(new IconToggleButton(new DrawAction(this)));
    146146        addMapMode(new IconToggleButton(new ZoomAction(this)));
    147         addMapMode(new IconToggleButton(new DeleteAction(this)));
    148         addMapMode(new IconToggleButton(new ExtrudeAction(this)));
    149         addMapMode(new IconToggleButton(new ParallelWayAction(this)));
     147        addMapMode(new IconToggleButton(new DeleteAction(this), !Main.pref.getBoolean("expert", false)));
     148        addMapMode(new IconToggleButton(new ExtrudeAction(this), !Main.pref.getBoolean("expert", false)));
     149        addMapMode(new IconToggleButton(new ParallelWayAction(this), !Main.pref.getBoolean("expert", false)));
    150150
    151151        toolGroup.setSelected(((AbstractButton)toolBarActions.getComponent(0)).getModel(), true);
Note: See TracChangeset for help on using the changeset viewer.