Ticket #3910: lassoOnS-5449.patch
File lassoOnS-5449.patch, 4.5 KB (added by , 12 years ago) |
---|
-
src/org/openstreetmap/josm/gui/MapFrame.java
112 112 public final SelectAction mapModeSelect; 113 113 private final MapMode mapModeDraw; 114 114 private final MapMode mapModeZoom; 115 public final MapMode mapModeLassoSelect; 115 116 116 117 /** 117 118 * The panel list of all toggle dialog icons. To add new toggle dialog actions, use addToggleDialog … … 159 160 // toolbar 160 161 toolBarActions.setFloatable(false); 161 162 addMapMode(new IconToggleButton(mapModeSelect = new SelectAction(this))); 162 addMapMode(new IconToggleButton( new LassoModeAction(), true));163 addMapMode(new IconToggleButton(mapModeLassoSelect = new LassoModeAction(), true)) ; 163 164 addMapMode(new IconToggleButton(mapModeDraw = new DrawAction(this))); 164 165 addMapMode(new IconToggleButton(mapModeZoom = new ZoomAction(this))); 165 166 addMapMode(new IconToggleButton(new DeleteAction(this), true)); … … 361 362 return false; 362 363 363 364 MapMode oldMapMode = this.mapMode; 364 if (newMapMode == oldMapMode) 365 if (newMapMode == oldMapMode) { 366 newMapMode.reenterMode(); 365 367 return true; 368 } 366 369 if (oldMapMode != null) { 367 370 oldMapMode.exitMode(); 368 371 } -
src/org/openstreetmap/josm/actions/LassoModeAction.java
5 5 6 6 import org.openstreetmap.josm.Main; 7 7 import org.openstreetmap.josm.actions.mapmode.MapMode; 8 import org.openstreetmap.josm.tools.ImageProvider; 8 9 9 10 public class LassoModeAction extends MapMode { 10 11 … … 13 14 "rope", 14 15 tr("Lasso selection mode: select objects within a hand-drawn region"), 15 16 null, 16 null);17 ImageProvider.getCursor("normal", "rope")); 17 18 } 18 19 19 20 @Override … … 31 32 Main.map.mapModeSelect.exitMode(); 32 33 super.exitMode(); 33 34 } 35 36 @Override 37 public void reenterMode() { 38 if (Main.map != null && Main.map.mapModeSelect.repeatedKeySwitchLassoOption) { 39 Main.map.selectMapMode(Main.map.mapModeSelect); 40 } 41 } 34 42 } -
src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
100 100 } 101 101 102 102 private boolean lassoMode = false; 103 public boolean repeatedKeySwitchLassoOption; 103 104 104 105 // Cache previous mouse event (needed when only the modifier keys are 105 106 // pressed but the mouse isn't moved) … … 180 181 mv.addMouseMotionListener(this); 181 182 mv.setVirtualNodesEnabled(Main.pref.getInteger("mappaint.node.virtual-size", 8) != 0); 182 183 drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true); 184 repeatedKeySwitchLassoOption = Main.pref.getBoolean("mappaint.select.toggle-lasso-on-repeated-S", true); 183 185 cycleManager.init(); 184 186 virtualManager.init(); 185 187 // This is required to update the cursors when ctrl/shift/alt is pressed … … 873 875 this.lassoMode = lassoMode; 874 876 } 875 877 878 @Override 879 public void reenterMode() { 880 if (Main.map!=null && repeatedKeySwitchLassoOption) { 881 Main.map.selectMapMode(Main.map.mapModeLassoSelect); 882 } 883 } 884 876 885 CycleManager cycleManager = new CycleManager(); 877 886 VirtualManager virtualManager = new VirtualManager(); 878 887 -
src/org/openstreetmap/josm/actions/mapmode/MapMode.java
57 57 putValue("active", false); 58 58 Main.map.mapView.resetCursor(this); 59 59 } 60 /** 61 * For optionlal overloading - called when action is repeated while mapmode 62 * is already active 63 */ 64 public void reenterMode() { 65 } 60 66 61 67 protected void updateStatusLine() { 62 68 Main.map.statusLine.setHelpText(getModeHelpText());