Changeset 12486 in osm for applications/editors


Ignore:
Timestamp:
2008-12-22T18:37:46+01:00 (16 years ago)
Author:
stoecker
Message:

updated shortcut handling

Location:
applications/editors/josm/plugins/surveyor
Files:
5 edited

Legend:

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

    r10336 r12486  
    6464    </copy>
    6565    <javac srcdir="src" destdir="${plugin.build.dir}" debug="true" source="1.5" target="1.5">
     66      <compilerarg value="-Xlint:deprecation"/>
     67      <compilerarg value="-Xlint:unchecked"/>
    6668      <classpath>
    6769        <pathelement path="${josm.build.dir}/build"/>
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveAction.java

    r6164 r12486  
    1919import at.dallermassl.josm.plugin.surveyor.action.SetWaypointAction;
    2020import org.openstreetmap.josm.actions.JosmAction;
     21import org.openstreetmap.josm.tools.Shortcut;
    2122
    2223import livegps.LiveGpsLayer;
     
    3334    private boolean autoSave = false;
    3435    private Timer gpsDataTimer;
    35    
    36    
     36
    3737    public AutoSaveAction() {
    38                 super(tr("AutoSave LiveData"), "autosave.png", tr("Save captured data to file every minute."), KeyEvent.VK_S, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK, true);
    39         // <FIXXME date="23.06.2007" author="cdaller">
    40         // TODO set accelerator key
    41         // </FIXXME>
     38        super(tr("AutoSave LiveData"), "autosave.png", tr("Save captured data to file every minute."),
     39        Shortcut.registerShortcut("surveyor:autosave", tr("Tool: {0}", tr("AutoSave LiveData")),
     40        KeyEvent.VK_S, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
    4241    }
    4342
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorComponent.java

    r6159 r12486  
    4949        hotKeys = new HashSet<String>();
    5050        setLayout(new BorderLayout());
    51         streetLabel = new JLabel("Way: ");
     51        streetLabel = new JLabel(tr("Way: "));
    5252        float fontSize = Float.parseFloat(Main.pref.get(SurveyorPlugin.PREF_KEY_STREET_NAME_FONT_SIZE, "35"));
    5353        Main.pref.put(SurveyorPlugin.PREF_KEY_STREET_NAME_FONT_SIZE, String.valueOf(fontSize));
     
    177177        if("gpsdata".equals(evt.getPropertyName())) {
    178178            gpsData = (LiveGpsData) evt.getNewValue();
    179             streetLabel.setText("Way: " + gpsData.getWayInfo());
     179            streetLabel.setText(tr("Way: ") + gpsData.getWayInfo());
    180180        }
    181181       
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java

    r11974 r12486  
    1212import javax.swing.JCheckBoxMenuItem;
    1313import javax.swing.JFrame;
     14import javax.swing.JMenu;
    1415import javax.swing.JMenuItem;
    1516import javax.swing.JOptionPane;
     
    2021
    2122import org.openstreetmap.josm.Main;
     23import org.openstreetmap.josm.gui.MainMenu;
    2224import org.openstreetmap.josm.plugins.PluginProxy;
    2325
     
    7375            }
    7476        }
    75         if(gpsPlugin == null) {
    76             throw new IllegalStateException("SurveyorPlugin needs LiveGpsPlugin, but could not find it!");
    77         }
    78         SurveyorShowAction surveyorAction = new SurveyorShowAction(gpsPlugin);
    79         JMenuItem surveyorMenuItem = new JMenuItem(surveyorAction);
    80         surveyorMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.VK_ALT));
     77        if(gpsPlugin == null)
     78            throw new IllegalStateException(tr("SurveyorPlugin needs LiveGpsPlugin, but could not find it!"));
    8179
    82         gpsPlugin.getLgpsMenu().addSeparator();
    83         gpsPlugin.getLgpsMenu().add(surveyorMenuItem);
    84        
     80        JMenu m = gpsPlugin.getLgpsMenu();
     81        m.addSeparator();
     82        MainMenu.add(m, new SurveyorShowAction(gpsPlugin));
     83
    8584        AutoSaveAction autoSaveAction = new AutoSaveAction();
    8685        JCheckBoxMenuItem autoSaveMenu = new JCheckBoxMenuItem(autoSaveAction);
    87         gpsPlugin.getLgpsMenu().add(autoSaveMenu); 
    88         autoSaveMenu.setAccelerator(autoSaveAction.shortcut);
     86        m.add(autoSaveMenu);
     87        autoSaveMenu.setAccelerator(autoSaveAction.getShortcut().getKeyStroke());
    8988    }
    9089
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java

    r5429 r12486  
    2626
    2727import org.openstreetmap.josm.Main;
     28import org.openstreetmap.josm.tools.Shortcut;
    2829import org.openstreetmap.josm.tools.XmlObjectParser;
    2930import org.openstreetmap.josm.actions.JosmAction;
     
    4344
    4445    public SurveyorShowAction(LiveGpsPlugin gpsPlugin) {
    45         super(tr("Surveyor ..."), "surveyormenu.png", tr("Open surveyor tool."), KeyEvent.VK_S, KeyEvent.CTRL_MASK, true);
     46        super(tr("Surveyor ..."), "surveyormenu.png", tr("Open surveyor tool."),
     47        Shortcut.registerShortcut("surveyor:open", tr("Tool: {0}", tr("Surveyor ...")),
     48        KeyEvent.VK_R, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT), true);
    4649        this.gpsPlugin = gpsPlugin;
    4750    }
Note: See TracChangeset for help on using the changeset viewer.