Changeset 27166 in osm for applications/editors/josm/plugins
- Timestamp:
- 2011-11-28T11:00:32+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/piclayer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/build.xml
r27152 r27166 22 22 --> 23 23 <project name="PicLayer" default="dist" basedir="."> 24 <property name="commit.message" value="PicLayer - changed shortcut to prevent conflict with Imagery menu, #7084"/>24 <property name="commit.message" value="PicLayer - removed hiding buttons from PicLayer main menu - this is in core responsibility now"/> 25 25 <property name="plugin.main.version" value="4549"/> 26 26 <!-- -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ActionVisibilityChangeMenu.java
r27122 r27166 5 5 import java.awt.event.ActionEvent; 6 6 7 import javax.swing.AbstractAction;8 7 import javax.swing.JCheckBoxMenuItem; 9 8 import javax.swing.JMenu; 10 9 11 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.actions.JosmAction; 12 12 13 13 enum PicActions {MOVE_PICTURE, MOVE_POINT, TRANSFORM_POINT, SCALEX, SCALEY, SCALEXY, SHEAR, ROTATE} … … 29 29 super(); 30 30 setSelected(Main.pref.getBoolean(button.getVisibilityKey(), button.getDefVisibility())); 31 setAction(new AbstractAction() { 32 @Override 33 public void actionPerformed(ActionEvent e) { 34 boolean val = !Main.pref.getBoolean(button.getVisibilityKey(), button.getDefVisibility()); 35 Main.pref.put(button.getVisibilityKey(), val); 36 SwitchVisibilityMenuItem.this.setSelected(val); 37 button.setVisible(val); 38 } 39 }); 40 setText(tr(button.getBtnName())); 31 setAction(new ButtonAction(button)); 32 } 33 class ButtonAction extends JosmAction { 34 private PicToggleButton button; 35 36 public ButtonAction(PicToggleButton button) { 37 super(button.getBtnName(), null, button.getBtnName(), null, false, false); 38 this.button = button; 39 } 40 41 @Override 42 public void actionPerformed(ActionEvent e) { 43 boolean val = !Main.pref.getBoolean(button.getVisibilityKey(), button.getDefVisibility()); 44 Main.pref.put(button.getVisibilityKey(), val); 45 SwitchVisibilityMenuItem.this.setSelected(val); 46 button.setVisible(val); 47 } 48 41 49 } 42 50 } -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java
r27152 r27166 23 23 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 24 24 import static org.openstreetmap.josm.tools.I18n.marktr; 25 import static org.openstreetmap.josm.tools.I18n.tr; 25 26 26 27 import java.awt.event.KeyEvent; … … 59 60 // Plugin menu 60 61 private JMenu menu = null; 61 private ActionVisibilityChangeMenu actionVisibility;62 62 63 63 /** … … 102 102 103 103 buttonList = new ArrayList<PicToggleButton>(7); 104 buttonList.add(new PicToggleButton(movePictureAction, "Move Picture", "piclayer.actionvisibility.move", true));105 buttonList.add(new PicToggleButton(movePointAction, "Move Point", "piclayer.actionvisibility.movepoint", true));106 buttonList.add(new PicToggleButton(transformPointAction, "Transform Point", "piclayer.actionvisibility.transformpoint", true));107 buttonList.add(new PicToggleButton(rotatePictureAction, "Rotate", "piclayer.actionvisibility.rotate", false));108 buttonList.add(new PicToggleButton(scaleXYPictureAction, "Scale", "piclayer.actionvisibility.scale", false));109 buttonList.add(new PicToggleButton(scaleXPictureAction, "Scale X", "piclayer.actionvisibility.scalex", false));110 buttonList.add(new PicToggleButton(scaleYPictureAction, "Scale Y", "piclayer.actionvisibility.scaley", false));111 buttonList.add(new PicToggleButton(shearPictureAction, "Shear", "piclayer.actionvisibility.shear", false));104 buttonList.add(new PicToggleButton(movePictureAction, tr("Move Picture"), "piclayer.actionvisibility.move", true)); 105 buttonList.add(new PicToggleButton(movePointAction, tr("Move Point"), "piclayer.actionvisibility.movepoint", true)); 106 buttonList.add(new PicToggleButton(transformPointAction, tr("Transform Point"), "piclayer.actionvisibility.transformpoint", true)); 107 buttonList.add(new PicToggleButton(rotatePictureAction, tr("Rotate"), "piclayer.actionvisibility.rotate", false)); 108 buttonList.add(new PicToggleButton(scaleXYPictureAction, tr("Scale"), "piclayer.actionvisibility.scale", false)); 109 buttonList.add(new PicToggleButton(scaleXPictureAction, tr("Scale X"), "piclayer.actionvisibility.scalex", false)); 110 buttonList.add(new PicToggleButton(scaleYPictureAction, tr("Scale Y"), "piclayer.actionvisibility.scaley", false)); 111 buttonList.add(new PicToggleButton(shearPictureAction, tr("Shear"), "piclayer.actionvisibility.shear", false)); 112 112 113 113 for(IconToggleButton btn : buttonList) { 114 114 newFrame.addMapMode(btn); 115 115 } 116 117 if (actionVisibility == null)118 menu.add(actionVisibility = new ActionVisibilityChangeMenu());119 116 } 120 117 } … … 129 126 // actually that should be not enough - JOSM should hide all buttons that are disabled for current layer! 130 127 if (oldPic && !newPic || oldLayer == null && !newPic) { // leave picture layer - hide all controls 131 for (PicToggleButton btn : buttonList) 128 for (PicToggleButton btn : buttonList) { 129 btn.writeVisible(); 132 130 btn.setVisible(false); 131 } 133 132 } 134 133 if (!oldPic && newPic) { // enter picture layer - reset visibility of controls -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicToggleButton.java
r27122 r27166 34 34 setVisible(Main.pref.getBoolean(getVisibilityKey(), getDefVisibility())); 35 35 } 36 public void writeVisible() { 37 Main.pref.put(getVisibilityKey(), isVisible()); 38 } 36 39 37 40 }
Note:
See TracChangeset
for help on using the changeset viewer.