Ticket #7184: 7184_hide.patch

File 7184_hide.patch, 2.7 KB (added by simon04, 8 years ago)
  • src/org/openstreetmap/josm/gui/IconToggleButton.java

    diff --git a/src/org/openstreetmap/josm/gui/IconToggleButton.java b/src/org/openstreetmap/josm/gui/IconToggleButton.java
    index 08a37ba..3b564ca 100644
    a b public class IconToggleButton extends JToggleButton implements HideableButton, P 
    2525    public boolean groupbutton;
    2626    private ShowHideButtonListener listener;
    2727    private boolean hideIfDisabled=false;
     28    private boolean hiddenByDefault;
    2829
    2930    /**
    3031     * Construct the toggle button with the given action.
    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
    3645        Object o = action.getValue(Action.SHORT_DESCRIPTION);
    public class IconToggleButton extends JToggleButton implements HideableButton, P 
    7887    @Override
    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
    8493            else
  • src/org/openstreetmap/josm/gui/MapFrame.java

    diff --git a/src/org/openstreetmap/josm/gui/MapFrame.java b/src/org/openstreetmap/josm/gui/MapFrame.java
    index b6019d2..a0de622 100644
    a b public class MapFrame extends JPanel implements Destroyable, LayerChangeListener 
    144144        addMapMode(new IconToggleButton(new SelectAction(this)));
    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);
    152152