Ticket #6953: SidetoolbarPreferences.patch
| File SidetoolbarPreferences.patch, 1.4 KB (added by , 14 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/IconToggleButton.java
65 65 } 66 66 } 67 67 68 String getPreferenceKey() { 69 String s = (String) getSafeActionValue("toolbar"); 70 if (s==null) { 71 if (getAction()!=null) s=getAction().getClass().getName(); 72 } 73 return "sidetoolbar.hidden."+s; 74 75 } 76 68 77 @Override 69 78 public void applyButtonHiddenPreferences() { 70 String actionName = (String) getSafeActionValue(AbstractAction.NAME); 71 boolean hiddenFlag = Main.pref.getBoolean(actionName + ".itbutton_hidden", false); 79 boolean hiddenFlag = Main.pref.getBoolean(getPreferenceKey(), false); 72 80 setVisible(!hiddenFlag); 73 81 } 74 82 75 83 @Override 76 84 public void setButtonHidden(boolean b) { 77 String actionName = (String) getSafeActionValue(AbstractAction.NAME);78 85 setVisible(!b); 79 86 if (listener!=null) { // if someone wants to know about changes of visibility 80 87 if (!b) listener.buttonShown(); else listener.buttonHidden(); 81 88 } 82 Main.pref.put( actionName + ".itbutton_hidden", b);89 Main.pref.put(getPreferenceKey(), b); 83 90 } 84 91 85 92 @Override
