Changeset 12471 in osm for applications


Ignore:
Timestamp:
2008-12-22T14:07:28+01:00 (16 years ago)
Author:
stoecker
Message:

updated

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

Legend:

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

    r10439 r12471  
    4242        <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    4343        <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
     44        <attribute name="Plugin-Mainversion" value="1153" />
    4445      </manifest>
    4546    </jar>
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java

    r10440 r12471  
    11package org.openstreetmap.josm.plugins.measurement;
    22
     3import static org.openstreetmap.josm.tools.I18n.marktr;
    34import static org.openstreetmap.josm.tools.I18n.tr;
    45
     
    2122import org.openstreetmap.josm.data.osm.Node;
    2223import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
     24import org.openstreetmap.josm.gui.SideButton;
    2325import org.openstreetmap.josm.tools.ImageProvider;
     26import org.openstreetmap.josm.tools.Shortcut;
    2427import org.openstreetmap.josm.Main;
    2528
     
    3639     * The reset button
    3740     */
    38     private JButton resetButton;
    39    
     41    private SideButton resetButton;
     42
    4043    /**
    4144     * The measurement label for the path length
    4245     */
    4346    protected JLabel pathLengthLabel;
    44    
     47
    4548    /**
    4649     * The measurement label for the currently selected segments
    4750     */
    4851    protected JLabel selectLengthLabel;
    49    
     52
    5053    /**
    5154     * The measurement label for area of the currently selected loop
    5255     */
    5356    protected JLabel selectAreaLabel;
    54    
     57
    5558    /**
    5659     * The measurement label for the segment angle, actually updated, if 2 nodes are selected
    5760     */
    5861    protected JLabel segAngleLabel;
    59    
     62
    6063    /**
    6164     * Constructor
     
    6366    public MeasurementDialog()
    6467    {
    65         super(tr("Measured values"), "measure", tr("Open the measurement window."), KeyEvent.VK_M, KeyEvent.ALT_DOWN_MASK);
    66        
     68        super(tr("Measured values"), "measure", tr("Open the measurement window."),
     69        Shortcut.registerShortcut("subwindow:measurement", tr("Toggle: {0}", tr("Measured values")),
     70        KeyEvent.VK_M, Shortcut.GROUP_LAYER), 150);
     71
    6772        JPanel buttonPanel = new JPanel(new GridLayout(1,2));
    68        
    69                 resetButton = new JButton(tr("Reset"), ImageProvider.get("mapmode/selection/select"));
    70                 resetButton.setActionCommand("Reset");
    71                 resetButton.addActionListener(this);
    72                 resetButton.setToolTipText(tr("Reset current measurement results and delete measurement path."));
    73 //              resetButton.putClientProperty("help", "Dialog/SelectionList/Reset");
    74                
     73
     74        resetButton = new SideButton(marktr("Reset"), "select", "Measurement",
     75                tr("Reset current measurement results and delete measurement path."), this);
    7576        buttonPanel.add(resetButton);
    7677        add(buttonPanel, BorderLayout.SOUTH);
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.java

    r10379 r12471  
    4848                                return;
    4949                        }
    50                         if (MeasurementPlugin.currentLayer == null){
    51                                 Main.main.addLayer(new MeasurementLayer("Measurement"));
    52                         }
    53                         MeasurementPlugin.currentLayer.mouseClicked(e);
     50                        MeasurementPlugin.getCurrentLayer().mouseClicked(e);
    5451                }
    5552        }
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java

    r10379 r12471  
    66import org.openstreetmap.josm.gui.IconToggleButton;
    77import org.openstreetmap.josm.gui.MapFrame;
    8 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    98import org.openstreetmap.josm.gui.layer.Layer;
     9import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
    1010import org.openstreetmap.josm.plugins.Plugin;
    1111
     
    2626        @Override
    2727        public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    28                 if(newFrame != null){
     28                if(newFrame != null)
    2929                        newFrame.addToggleDialog(measurementDialog);
    30                 }
    31                 if(Main.map != null){
    32                         Main.map.toolBarActions.add(btn);
    33                         Main.map.toolGroup.add(btn);
    34                        
    35                         Main.map.mapView.addLayerChangeListener(new LayerChangeListener(){
     30                if(Main.map != null)
     31                        Main.map.addMapMode(btn);
     32        }
     33
     34        public static MeasurementLayer getCurrentLayer(){
     35                if(currentLayer == null){
     36                        currentLayer = new MeasurementLayer(tr("Measurement"));
     37                        Main.main.addLayer(currentLayer);
     38                        currentLayer.listeners.add(new LayerChangeListener(){
    3639                                public void activeLayerChange(final Layer oldLayer, final Layer newLayer) {
    3740                                        if(newLayer instanceof MeasurementLayer)
     
    4447                        });
    4548                }
    46         }
    47 
    48         public static MeasurementLayer getCurrentLayer(){
    49                 if(currentLayer == null){
    50                         currentLayer = new MeasurementLayer("Measurement");
    51                         Main.main.addLayer(currentLayer);
    52                 }
    5349                return currentLayer;
    5450        }
Note: See TracChangeset for help on using the changeset viewer.