Ignore:
Timestamp:
2017-08-28T14:53:38+02:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12683

Location:
applications/editors/josm/plugins/FastDraw
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FastDraw/build.xml

    r32738 r33583  
    44    <property name="commit.message" value="[josm_fastdraw] Fix incorrect settings saving-2"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    6     <property name="plugin.main.version" value="10657"/>
     6    <property name="plugin.main.version" value="12683"/>
    77   
    88    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java

    r32738 r33583  
    2222import org.openstreetmap.josm.gui.ExtendedDialog;
    2323import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
     24import org.openstreetmap.josm.gui.datatransfer.importers.TextTagPaster;
    2425import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
    2526import org.openstreetmap.josm.tools.GBC;
     
    5859            public void actionPerformed(ActionEvent e) {
    5960                String s = ClipboardUtils.getClipboardStringContent();
    60                 if (TextTagParser.getValidatedTagsFromText(s) != null) {
     61                if (TextTagParser.getValidatedTagsFromText(s, TextTagPaster::warning) != null) {
    6162                    addTags.setText(s);
    6263                }
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java

    r32938 r33583  
    3333import org.openstreetmap.josm.data.osm.Way;
    3434import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
     35import org.openstreetmap.josm.gui.MainApplication;
    3536import org.openstreetmap.josm.gui.MapFrame;
    3637import org.openstreetmap.josm.gui.MapView;
     
    4041import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    4142import org.openstreetmap.josm.gui.util.KeyPressReleaseListener;
    42 import org.openstreetmap.josm.gui.util.ModifierListener;
     43import org.openstreetmap.josm.gui.util.ModifierExListener;
    4344import org.openstreetmap.josm.tools.ImageProvider;
    4445import org.openstreetmap.josm.tools.Shortcut;
    4546import org.openstreetmap.josm.tools.TextTagParser;
    4647
    47 class FastDrawingMode extends MapMode implements MapViewPaintable, KeyPressReleaseListener, ModifierListener {
     48class FastDrawingMode extends MapMode implements MapViewPaintable, KeyPressReleaseListener, ModifierExListener {
    4849    // CHECKSTYLE.OFF: LineLength
    4950    private static final String SIMPLIFYMODE_MESSAGE =
     
    7980        super(tr("FastDrawing"), "turbopen.png", tr("Fast drawing mode"),
    8081                Shortcut.registerShortcut("mapmode:fastdraw", tr("Mode: {0}", tr("Fast drawing mode")), KeyEvent.VK_F, Shortcut.SHIFT),
    81                 mapFrame, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
     82                Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    8283        line = new DrawnPolyLine();
    8384        cursorDraw = ImageProvider.getCursor("crosshair", null);
     
    100101        settings.savePrefs();
    101102
     103        MapFrame map = MainApplication.getMap();
    102104        eps = settings.startingEps;
    103         mv = Main.map.mapView;
     105        mv = map.mapView;
    104106        line.setMv(mv);
    105107
    106108        if (getLayerManager().getEditDataSet() == null) return;
    107109
    108         Main.map.mapView.addMouseListener(this);
    109         Main.map.mapView.addMouseMotionListener(this);
    110         Main.map.mapView.addTemporaryLayer(this);
    111 
    112         Main.map.keyDetector.addKeyListener(this);
    113         Main.map.keyDetector.addModifierListener(this);
     110        map.mapView.addMouseListener(this);
     111        map.mapView.addMouseMotionListener(this);
     112        map.mapView.addTemporaryLayer(this);
     113
     114        map.keyDetector.addKeyListener(this);
     115        map.keyDetector.addModifierExListener(this);
    114116    }
    115117
     
    118120        super.exitMode();
    119121        if (line.wasSimplified() && !lineWasSaved) saveAsWay(false);
    120 
    121         Main.map.mapView.removeMouseListener(this);
    122         Main.map.mapView.removeMouseMotionListener(this);
    123 
    124         Main.map.mapView.removeTemporaryLayer(this);
    125 
    126         Main.map.keyDetector.removeKeyListener(this);
    127         Main.map.keyDetector.removeModifierListener(this);
     122        MapFrame map = MainApplication.getMap();
     123
     124        map.mapView.removeMouseListener(this);
     125        map.mapView.removeMouseMotionListener(this);
     126
     127        map.mapView.removeTemporaryLayer(this);
     128
     129        map.keyDetector.removeKeyListener(this);
     130        map.keyDetector.removeModifierExListener(this);
    128131
    129132        settings.savePrefs();
    130         Main.map.mapView.setCursor(cursorDraw);
     133        map.mapView.setCursor(cursorDraw);
    131134        repaint();
    132135    }
     
    467470                }
    468471                newDrawing(); // stop drawing
    469                 Main.map.selectSelectTool(false);
     472                MainApplication.getMap().selectSelectTool(false);
    470473            }
    471474            break;
     
    491494            e.consume();
    492495            if (!drawing) {
    493                 Point p = Main.map.mapView.getMousePosition();
     496                Point p = MainApplication.getMap().mapView.getMousePosition();
    494497                if (p != null) startDrawing(p, settings.fixedSpacebar);
    495498            }
     
    506509
    507510    @Override
    508     public void modifiersChanged(int modifiers) {
    509         updateKeyModifiers(modifiers);
     511    public void modifiersExChanged(int modifiers) {
     512        updateKeyModifiersEx(modifiers);
    510513        updateCursor();
    511514    }
     
    513516    @Override
    514517    protected void updateStatusLine() {
    515         Main.map.statusLine.setHelpText(statusText);
    516         Main.map.statusLine.repaint();
     518        MainApplication.getMap().statusLine.setHelpText(statusText);
     519        MainApplication.getMap().statusLine.repaint();
    517520    }
    518521    // </editor-fold>
     
    547550
    548551        for (LatLon p : pts) {
    549             Node nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive::isSelectable);
     552            Node nd = MainApplication.getMap().mapView.getNearestNode(line.getPoint(p), OsmPrimitive::isSelectable);
    550553            // there may be a node with the same coords!
    551554
     
    595598        Command c = new SequenceCommand(tr("Draw the way by mouse"), cmds);
    596599        if (getLayerManager().getEditLayer() == null) return;
    597         Main.main.undoRedo.add(c);
     600        MainApplication.undoRedo.add(c);
    598601        lineWasSaved = true;
    599602        newDrawing(); // stop drawing
     
    601604            // Select this way and switch drawing mode off
    602605            getLayerManager().getEditDataSet().setSelected(w);
    603             Main.map.selectSelectTool(false);
     606            MainApplication.getMap().selectSelectTool(false);
    604607        }
    605608    }
     
    676679
    677680    private void updateCursor() {
    678         if (shift) Main.map.mapView.setCursor(cursorShift); else
    679             if (line.isClosed() || (nearestPointIndex == 0)) Main.map.mapView.setCursor(cursorReady); else
    680                 if (ctrl) Main.map.mapView.setCursor(cursorCtrl); else
    681                     if (nearSomeNode && settings.snapNodes) Main.map.mapView.setCursor(cursorCtrl); else
    682                         if (drawing) Main.map.mapView.setCursor(cursorDrawing); else
    683                             Main.map.mapView.setCursor(cursorDraw);
     681        MapView mapView = MainApplication.getMap().mapView;
     682        if (shift) mapView.setCursor(cursorShift); else
     683            if (line.isClosed() || (nearestPointIndex == 0)) mapView.setCursor(cursorReady); else
     684                if (ctrl) mapView.setCursor(cursorCtrl); else
     685                    if (nearSomeNode && settings.snapNodes) mapView.setCursor(cursorCtrl); else
     686                        if (drawing) mapView.setCursor(cursorDrawing); else
     687                            mapView.setCursor(cursorDraw);
    684688    }
    685689
    686690    private void repaint() {
    687         Main.map.mapView.repaint();
     691        MainApplication.getMap().mapView.repaint();
    688692    }
    689693
    690694    private void tryToLoadWay() {
    691695        updateCursor();
    692         Collection<Way> selectedWays = Main.getLayerManager().getEditDataSet().getSelectedWays();
     696        Collection<Way> selectedWays = MainApplication.getLayerManager().getEditDataSet().getSelectedWays();
    693697        if (selectedWays != null // if there is a selection
    694698                && selectedWays.size() == 1 // and one way is selected
     
    711715
    712716    private Node getNearestNode(Point point, double maxDist) {
    713         Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive::isSelectable);
     717        Node nd = MainApplication.getMap().mapView.getNearestNode(point, OsmPrimitive::isSelectable);
    714718        if (nd != null && line.getPoint(nd.getCoor()).distance(point) <= maxDist) return nd;
    715719        else return null;
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java

    r32548 r33583  
    22package org.openstreetmap.josm.plugins.fastdraw;
    33
    4 import org.openstreetmap.josm.Main;
    54import org.openstreetmap.josm.gui.IconToggleButton;
     5import org.openstreetmap.josm.gui.MainApplication;
    66import org.openstreetmap.josm.gui.MapFrame;
    77import org.openstreetmap.josm.plugins.Plugin;
     
    1717    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    1818        if (oldFrame == null && newFrame != null) {
    19             Main.map.addMapMode(new IconToggleButton(new FastDrawingMode(Main.map)));
     19            MainApplication.getMap().addMapMode(new IconToggleButton(new FastDrawingMode(MainApplication.getMap())));
    2020        }
    2121    }
Note: See TracChangeset for help on using the changeset viewer.