Changeset 33832 in osm for applications
- Timestamp:
- 2017-11-17T21:30:21+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/touchscreenhelper
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/touchscreenhelper/build.xml
r32680 r33832 4 4 <property name="commit.message" value="JOSM/touchscreenhelper: Added T shortcut, hold T to activate temporarily"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 0580"/>6 <property name="plugin.main.version" value="12630"/> 7 7 <property name="plugin.author" value="glebius@glebius.int.ru"/> 8 8 <property name="plugin.class" value="touchscreenhelper.TouchScreenHelperPlugin"/> -
applications/editors/josm/plugins/touchscreenhelper/src/touchscreenhelper/BrowseAction.java
r32550 r33832 10 10 import java.awt.event.MouseMotionListener; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.mapmode.MapMode; 14 13 import org.openstreetmap.josm.data.coor.EastNorth; 14 import org.openstreetmap.josm.gui.MainApplication; 15 15 import org.openstreetmap.josm.gui.MapFrame; 16 16 import org.openstreetmap.josm.tools.Shortcut; … … 22 22 private TimedKeyReleaseListener listener; 23 23 24 public BrowseAction( MapFrame mapFrame) {24 public BrowseAction() { 25 25 super(tr("Browse"), "browse", tr("Browse map with left button"), 26 26 Shortcut.registerShortcut("touchscreenhelper:browse", tr("Mode: {0}", tr("Browse map with left button")), 27 27 KeyEvent.VK_T, Shortcut.DIRECT), 28 mapFrame,Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));28 Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); 29 29 MapFrame.addMapModeChangeListener(this); 30 30 } … … 37 37 @Override public void enterMode() { 38 38 super.enterMode(); 39 Main .map.mapView.addMouseListener(this);40 Main .map.mapView.addMouseMotionListener(this);39 MainApplication.getMap().mapView.addMouseListener(this); 40 MainApplication.getMap().mapView.addMouseMotionListener(this); 41 41 42 42 listener = new TimedKeyReleaseListener() { … … 45 45 if (evt.getKeyCode() == getShortcut().getKeyStroke().getKeyCode()) { 46 46 if (oldMapMode != null && !(oldMapMode instanceof BrowseAction)) 47 Main .map.selectMapMode(oldMapMode);47 MainApplication.getMap().selectMapMode(oldMapMode); 48 48 } 49 49 } … … 54 54 super.exitMode(); 55 55 56 Main .map.mapView.removeMouseListener(this);57 Main .map.mapView.removeMouseMotionListener(this);56 MainApplication.getMap().mapView.removeMouseListener(this); 57 MainApplication.getMap().mapView.removeMouseMotionListener(this); 58 58 listener.stop(); 59 59 } … … 69 69 if (mousePosMove == null) 70 70 startMovement(e); 71 EastNorth center = Main .map.mapView.getCenter();72 EastNorth mouseCenter = Main .map.mapView.getEastNorth(e.getX(), e.getY());73 Main .map.mapView.zoomTo(new EastNorth(71 EastNorth center = MainApplication.getMap().mapView.getCenter(); 72 EastNorth mouseCenter = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY()); 73 MainApplication.getMap().mapView.zoomTo(new EastNorth( 74 74 mousePosMove.east() + center.east() - mouseCenter.east(), 75 75 mousePosMove.north() + center.north() - mouseCenter.north())); … … 93 93 return; 94 94 movementInPlace = true; 95 mousePosMove = Main .map.mapView.getEastNorth(e.getX(), e.getY());95 mousePosMove = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY()); 96 96 } 97 97 -
applications/editors/josm/plugins/touchscreenhelper/src/touchscreenhelper/TimedKeyReleaseListener.java
r32550 r33832 15 15 import javax.swing.Timer; 16 16 17 import org.openstreetmap.josm. Main;17 import org.openstreetmap.josm.tools.Logging; 18 18 19 19 public class TimedKeyReleaseListener implements AWTEventListener { 20 private final TreeSet<Integer> set = new TreeSet< Integer>();20 private final TreeSet<Integer> set = new TreeSet<>(); 21 21 private Timer timer; 22 22 protected KeyEvent releaseEvent; … … 37 37 AWTEvent.KEY_EVENT_MASK); 38 38 } catch (SecurityException ex) { 39 Main.error(ex);39 Logging.error(ex); 40 40 } 41 41 } … … 67 67 Toolkit.getDefaultToolkit().removeAWTEventListener(this); 68 68 } catch (SecurityException ex) { 69 Main.error(ex);69 Logging.error(ex); 70 70 } 71 71 } -
applications/editors/josm/plugins/touchscreenhelper/src/touchscreenhelper/TouchScreenHelperPlugin.java
r32550 r33832 2 2 package touchscreenhelper; 3 3 4 import org.openstreetmap.josm.Main;5 4 import org.openstreetmap.josm.gui.IconToggleButton; 6 5 import org.openstreetmap.josm.gui.MapFrame; … … 14 13 15 14 @Override 16 public void mapFrameInitialized(MapFrame oldFrame, 17 MapFrame newFrame) { 15 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 18 16 if (oldFrame == null && newFrame != null) { 19 Main.map.addMapMode(new IconToggleButton(new BrowseAction(Main.map)));17 newFrame.addMapMode(new IconToggleButton(new BrowseAction())); 20 18 } 21 19 }
Note:
See TracChangeset
for help on using the changeset viewer.