Changeset 6957 in josm


Ignore:
Timestamp:
2014-04-05T15:27:26+02:00 (10 years ago)
Author:
Don-vip
Message:

see #9897 - refactor OSX stuff

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r6920 r6957  
    15161516        return OSM_WEBSITE;
    15171517    }
     1518
     1519    /**
     1520     * Determines if we are currently running on OSX.
     1521     * @return {@code true} if we are currently running on OSX
     1522     * @since 6957
     1523     */
     1524    public static boolean isPlatformOsx() {
     1525        return Main.platform instanceof PlatformHookOsx;
     1526    }
    15181527}
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r6889 r6957  
    5656import org.openstreetmap.josm.tools.ImageProvider;
    5757import org.openstreetmap.josm.tools.Pair;
    58 import org.openstreetmap.josm.tools.PlatformHookOsx;
    5958import org.openstreetmap.josm.tools.Shortcut;
    6059
     
    473472    public void mouseMoved(MouseEvent e) {
    474473        // Mac OSX simulates with  ctrl + mouse 1  the second mouse button hence no dragging events get fired.
    475         if ((Main.platform instanceof PlatformHookOsx) && (mode == Mode.rotate || mode == Mode.scale)) {
     474        if (Main.isPlatformOsx() && (mode == Mode.rotate || mode == Mode.scale)) {
    476475            mouseDragged(e);
    477476            return;
  • trunk/src/org/openstreetmap/josm/gui/MapMover.java

    r6380 r6957  
    2424import org.openstreetmap.josm.data.coor.EastNorth;
    2525import org.openstreetmap.josm.tools.Destroyable;
    26 import org.openstreetmap.josm.tools.PlatformHookOsx;
    2726import org.openstreetmap.josm.tools.Shortcut;
    2827
     
    7776
    7877    /**
    79      * Create a new MapMover
     78     * COnstructs a new {@code MapMover}.
    8079     */
    8180    public MapMover(NavigatableComponent navComp, JPanel contentPane) {
     
    133132                    mousePosMove.east() + center.east() - mouseCenter.east(),
    134133                    mousePosMove.north() + center.north() - mouseCenter.north()));
    135         } else
     134        } else {
    136135            endMovement();
     136        }
    137137    }
    138138
     
    140140     * Start the movement, if it was the 3rd button (right button).
    141141     */
    142     @Override public void mousePressed(MouseEvent e) {
     142    @Override
     143    public void mousePressed(MouseEvent e) {
    143144        int offMask = MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK;
    144145        int macMouseMask = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
    145146        if (e.getButton() == MouseEvent.BUTTON3 && (e.getModifiersEx() & offMask) == 0) {
    146147            startMovement(e);
    147         } else if (isPlatformOsx() && e.getModifiersEx() == macMouseMask) {
     148        } else if (Main.isPlatformOsx() && e.getModifiersEx() == macMouseMask) {
    148149            startMovement(e);
    149150        }
     
    153154     * Change the cursor back to it's pre-move cursor.
    154155     */
    155     @Override public void mouseReleased(MouseEvent e) {
     156    @Override
     157    public void mouseReleased(MouseEvent e) {
    156158        if (e.getButton() == MouseEvent.BUTTON3) {
    157159            endMovement();
    158         } else if (isPlatformOsx() && e.getButton() == MouseEvent.BUTTON1) {
     160        } else if (Main.isPlatformOsx() && e.getButton() == MouseEvent.BUTTON1) {
    159161            endMovement();
    160162        }
     
    195197
    196198    /**
    197      * Emulates dragging on Mac OSX
     199     * Emulates dragging on Mac OSX.
    198200     */
    199201    @Override
     
    203205        // Mac OSX simulates with  ctrl + mouse 1  the second mouse button hence no dragging events get fired.
    204206        // Is only the selected mouse button pressed?
    205         if (isPlatformOsx()) {
     207        if (Main.isPlatformOsx()) {
    206208            if (e.getModifiersEx() == MouseEvent.CTRL_DOWN_MASK) {
    207209                if (mousePosMove == null) {
     
    216218            }
    217219        }
    218     }
    219 
    220     /**
    221      * Replies true if we are currently running on OSX
    222      *
    223      * @return true if we are currently running on OSX
    224      */
    225     public static boolean isPlatformOsx() {
    226         return Main.platform instanceof PlatformHookOsx;
    227220    }
    228221
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java

    r6857 r6957  
    3030import org.openstreetmap.josm.gui.widgets.JosmComboBox;
    3131import org.openstreetmap.josm.tools.GBC;
    32 import org.openstreetmap.josm.tools.PlatformHookOsx;
    3332
    3433/**
     
    6362
    6463        // let's try to load additional LookAndFeels and put them into the list
    65         if (Main.platform instanceof PlatformHookOsx) {
     64        if (Main.isPlatformOsx()) {
    6665            try {
    6766                Class<?> Cquaqua = Class.forName("ch.randelshofer.quaqua.QuaquaLookAndFeel");
Note: See TracChangeset for help on using the changeset viewer.