Changeset 29258 in osm for applications/editors
- Timestamp:
- 2013-02-18T17:22:13+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/touchscreenhelper
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/touchscreenhelper/build.xml
r27354 r29258 30 30 <project name="touchscreenhelper" default="dist" basedir="."> 31 31 <!-- enter the SVN commit message --> 32 <property name="commit.message" value=" Commit message"/>32 <property name="commit.message" value="JOSM/touchscreenhelper: Added T shortcut, hold T to activate temporarily"/> 33 33 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 34 34 <property name="plugin.main.version" value="4394"/> … … 37 37 <property name="plugin.src.dir" value="src"/> 38 38 <property name="plugin.dist.dir" value="../../dist"/> 39 <property name="ant.build.javac.target" value="1. 5"/>39 <property name="ant.build.javac.target" value="1.6"/> 40 40 <property name="plugin.dist.dir" value="../../dist"/> 41 41 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/> -
applications/editors/josm/plugins/touchscreenhelper/src/touchscreenhelper/BrowseAction.java
r23193 r29258 4 4 5 5 import java.awt.Cursor; 6 import java.awt.event.KeyEvent; 6 7 import java.awt.event.MouseEvent; 7 8 import java.awt.event.MouseListener; … … 12 13 import org.openstreetmap.josm.gui.MapFrame; 13 14 import org.openstreetmap.josm.data.coor.EastNorth; 15 import org.openstreetmap.josm.tools.Shortcut; 16 import uitils.TimedKeyReleaseListener; 14 17 15 18 public class BrowseAction extends MapMode implements MouseListener, 16 MouseMotionListener { 19 MouseMotionListener, MapFrame.MapModeChangeListener { 20 21 private MapMode oldMapMode; 22 private TimedKeyReleaseListener listener; 17 23 18 24 public BrowseAction(MapFrame mapFrame) { 19 25 super(tr("Browse"), "browse", tr("Browse map with left button"), 26 Shortcut.registerShortcut("touchscreenhelper:browse", tr("Mode: {0}", tr("Browse map with left button")), 27 KeyEvent.VK_T, Shortcut.DIRECT), 20 28 mapFrame, Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); 29 MapFrame.addMapModeChangeListener(this); 21 30 } 22 31 32 @Override 33 public void mapModeChange(MapMode oldMapMode, MapMode newMapMode) { 34 this.oldMapMode = oldMapMode; 35 } 36 23 37 @Override public void enterMode() { 24 38 super.enterMode(); 25 26 39 Main.map.mapView.addMouseListener(this); 27 40 Main.map.mapView.addMouseMotionListener(this); 41 42 listener = new TimedKeyReleaseListener() { 43 @Override 44 protected void doKeyReleaseEvent(KeyEvent evt) { 45 if (evt.getKeyCode() == getShortcut().getKeyStroke().getKeyCode()) { 46 if (oldMapMode!=null && !(oldMapMode instanceof BrowseAction)) 47 Main.map.selectMapMode(oldMapMode); 48 } 49 } 50 }; 28 51 } 29 52 … … 33 56 Main.map.mapView.removeMouseListener(this); 34 57 Main.map.mapView.removeMouseMotionListener(this); 58 listener.stop(); 35 59 } 36 60
Note:
See TracChangeset
for help on using the changeset viewer.