Changeset 7218 in josm
- Timestamp:
- 2014-06-06T10:30:46+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r7217 r7218 49 49 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 50 50 import org.openstreetmap.josm.gui.util.GuiHelper; 51 import org.openstreetmap.josm.gui.util.KeyPressReleaseListener; 51 52 import org.openstreetmap.josm.gui.util.ModifierListener; 52 53 import org.openstreetmap.josm.tools.ImageProvider; … … 65 66 * feature "selection remove" is disabled on this platform. 66 67 */ 67 public class SelectAction extends MapMode implements ModifierListener, SelectionEnded {68 public class SelectAction extends MapMode implements ModifierListener, KeyPressReleaseListener, SelectionEnded { 68 69 // "select" means the selection rectangle and "move" means either dragging 69 70 // or select if no mouse movement occurs (i.e. just clicking) … … 102 103 103 104 private boolean lassoMode = false; 105 public boolean repeatedKeySwitchLassoOption; 104 106 105 107 // Cache previous mouse event (needed when only the modifier keys are … … 182 184 initialMoveDelay = Main.pref.getInteger("edit.initial-move-delay", 200); 183 185 initialMoveThreshold = Main.pref.getInteger("edit.initial-move-threshold", 5); 186 repeatedKeySwitchLassoOption = Main.pref.getBoolean("mappaint.select.toggle-lasso-on-repeated-S", true); 184 187 cycleManager.init(); 185 188 virtualManager.init(); 186 189 // This is required to update the cursors when ctrl/shift/alt is pressed 187 190 Main.map.keyDetector.addModifierListener(this); 191 Main.map.keyDetector.addKeyListener(this); 188 192 } 189 193 … … 196 200 mv.setVirtualNodesEnabled(false); 197 201 Main.map.keyDetector.removeModifierListener(this); 202 Main.map.keyDetector.removeKeyListener(this); 198 203 removeHighlighting(); 199 204 } … … 627 632 updateKeyModifiers(e); 628 633 selectPrims(selectionManager.getSelectedObjects(alt), true, true); 634 } 635 636 @Override 637 public void doKeyPressed(KeyEvent e) { 638 if (!Main.isDisplayingMapView() || 639 !repeatedKeySwitchLassoOption || !getShortcut().isEvent(e)) return; 640 e.consume(); 641 if (!lassoMode) { 642 Main.map.selectMapMode(Main.map.mapModeSelectLasso); 643 } else { 644 Main.map.selectMapMode(Main.map.mapModeSelect); 645 } 646 } 647 648 @Override 649 public void doKeyReleased(KeyEvent e) { 629 650 } 630 651 -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r7217 r7218 135 135 // Map modes 136 136 public final SelectAction mapModeSelect; 137 public LassoModeAction mapModeSelectLasso; 138 137 139 private final Map<Layer, MapMode> lastMapMode = new HashMap<>(); 138 140 private final MapMode mapModeDraw; … … 216 218 // toolBarActions, map mode buttons 217 219 addMapMode(new IconToggleButton(mapModeSelect = new SelectAction(this))); 218 addMapMode(new IconToggleButton( new LassoModeAction(), true));220 addMapMode(new IconToggleButton(mapModeSelectLasso = new LassoModeAction(), true)); 219 221 addMapMode(new IconToggleButton(mapModeDraw = new DrawAction(this))); 220 222 addMapMode(new IconToggleButton(mapModeZoom = new ZoomAction(this)));
Note:
See TracChangeset
for help on using the changeset viewer.