Ignore:
Timestamp:
2010-09-15T19:01:04+02:00 (14 years ago)
Author:
stoecker
Message:

remove tabs

Location:
applications/editors/josm/plugins/touchscreenhelper/src/touchscreenhelper
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/touchscreenhelper/src/touchscreenhelper/BrowseAction.java

    r21569 r23193  
    1616    MouseMotionListener {
    1717
    18         public BrowseAction(MapFrame mapFrame) {
    19                 super(tr("Browse"), "browse", tr("Browse map with left button"),
    20                     mapFrame, Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
    21         }
     18    public BrowseAction(MapFrame mapFrame) {
     19        super(tr("Browse"), "browse", tr("Browse map with left button"),
     20            mapFrame, Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
     21    }
    2222
    23         @Override public void enterMode() {
    24                 super.enterMode();
     23    @Override public void enterMode() {
     24        super.enterMode();
    2525
    26                 Main.map.mapView.addMouseListener(this);
    27                 Main.map.mapView.addMouseMotionListener(this);
    28         }
     26        Main.map.mapView.addMouseListener(this);
     27        Main.map.mapView.addMouseMotionListener(this);
     28    }
    2929
    30         @Override public void exitMode() {
    31                 super.exitMode();
     30    @Override public void exitMode() {
     31        super.exitMode();
    3232
    33                 Main.map.mapView.removeMouseListener(this);
    34                 Main.map.mapView.removeMouseMotionListener(this);
    35         }
     33        Main.map.mapView.removeMouseListener(this);
     34        Main.map.mapView.removeMouseMotionListener(this);
     35    }
    3636
    37         public void mouseDragged(MouseEvent e) {
    38                 if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) !=
    39                     MouseEvent.BUTTON1_DOWN_MASK) {
    40                         endMovement();
    41                         return;
    42                 }
     37    public void mouseDragged(MouseEvent e) {
     38        if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) !=
     39            MouseEvent.BUTTON1_DOWN_MASK) {
     40            endMovement();
     41            return;
     42        }
    4343
    44                 if (mousePosMove == null)
    45                         startMovement(e);
    46                 EastNorth center = Main.map.mapView.getCenter();
    47                 EastNorth mouseCenter = Main.map.mapView.getEastNorth(e.getX(), e.getY());
    48                 Main.map.mapView.zoomTo(new EastNorth(
    49                     mousePosMove.east() + center.east() - mouseCenter.east(),
    50                     mousePosMove.north() + center.north() - mouseCenter.north()));
    51         }
     44        if (mousePosMove == null)
     45            startMovement(e);
     46        EastNorth center = Main.map.mapView.getCenter();
     47        EastNorth mouseCenter = Main.map.mapView.getEastNorth(e.getX(), e.getY());
     48        Main.map.mapView.zoomTo(new EastNorth(
     49            mousePosMove.east() + center.east() - mouseCenter.east(),
     50            mousePosMove.north() + center.north() - mouseCenter.north()));
     51    }
    5252
    53         @Override public void mousePressed(MouseEvent e) {
    54                 if (e.getButton() == MouseEvent.BUTTON1)
    55                         startMovement(e);
    56         }
     53    @Override public void mousePressed(MouseEvent e) {
     54        if (e.getButton() == MouseEvent.BUTTON1)
     55            startMovement(e);
     56    }
    5757
    58         @Override public void mouseReleased(MouseEvent e) {
    59                 if (e.getButton() == MouseEvent.BUTTON1)
    60                         endMovement();
    61         }
     58    @Override public void mouseReleased(MouseEvent e) {
     59        if (e.getButton() == MouseEvent.BUTTON1)
     60            endMovement();
     61    }
    6262
    63         private EastNorth mousePosMove;
    64         private boolean movementInPlace = false;
     63    private EastNorth mousePosMove;
     64    private boolean movementInPlace = false;
    6565
    66         private void startMovement(MouseEvent e) {
    67                 if (movementInPlace)
    68                         return;
    69                 movementInPlace = true;
    70                 mousePosMove = Main.map.mapView.getEastNorth(e.getX(), e.getY());
    71         }
     66    private void startMovement(MouseEvent e) {
     67        if (movementInPlace)
     68            return;
     69        movementInPlace = true;
     70        mousePosMove = Main.map.mapView.getEastNorth(e.getX(), e.getY());
     71    }
    7272
    73         private void endMovement() {
    74                 if (!movementInPlace)
    75                         return;
    76                 movementInPlace = false;
    77                 mousePosMove = null;
    78         }
     73    private void endMovement() {
     74        if (!movementInPlace)
     75            return;
     76        movementInPlace = false;
     77        mousePosMove = null;
     78    }
    7979}
  • applications/editors/josm/plugins/touchscreenhelper/src/touchscreenhelper/TouchScreenHelperPlugin.java

    r21569 r23193  
    88
    99public class TouchScreenHelperPlugin extends Plugin {
    10         public TouchScreenHelperPlugin(PluginInformation info) {
    11                 super(info);
    12         }
    13         @Override public void mapFrameInitialized(MapFrame oldFrame,
    14             MapFrame newFrame) {
    15                 if (oldFrame == null && newFrame != null) {
    16                         Main.map.addMapMode(new IconToggleButton(new BrowseAction(Main.map)));
    17                 }
    18         }
     10    public TouchScreenHelperPlugin(PluginInformation info) {
     11        super(info);
     12    }
     13    @Override public void mapFrameInitialized(MapFrame oldFrame,
     14        MapFrame newFrame) {
     15        if (oldFrame == null && newFrame != null) {
     16            Main.map.addMapMode(new IconToggleButton(new BrowseAction(Main.map)));
     17        }
     18    }
    1919}
Note: See TracChangeset for help on using the changeset viewer.