Ignore:
Timestamp:
2008-10-05T17:06:27+02:00 (11 years ago)
Author:
stoecker
Message:

close bug #1622. Keyboard shortcuts and specific OS handling

Location:
trunk/src/org/openstreetmap/josm/actions/audio
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioBackAction.java

    r627 r1023  
    1111import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1212import org.openstreetmap.josm.tools.AudioPlayer;
     13import org.openstreetmap.josm.tools.ShortCut;
    1314
    1415public class AudioBackAction extends JosmAction {
    1516
    1617        private double amount; // note, normally negative, i.e. jump backwards in time
    17        
     18
    1819        public AudioBackAction() {
    19                 super(tr("Back"), "audio-back", tr("Jump back."), KeyEvent.VK_F6, 0, true);
     20                super(tr("Back"), "audio-back", tr("Jump back."),
     21                ShortCut.registerShortCut("audio:back", tr("Audio: Back"), KeyEvent.VK_F6, ShortCut.GROUP_DIRECT), true);
    2022                try {
    2123                        amount = - Double.parseDouble(Main.pref.get("audio.forwardbackamount","10.0"));
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java

    r627 r1023  
    77import org.openstreetmap.josm.actions.JosmAction;
    88import org.openstreetmap.josm.tools.AudioPlayer;
     9import org.openstreetmap.josm.tools.ShortCut;
    910
    1011abstract public class AudioFastSlowAction extends JosmAction {
    1112
    1213        private double multiplier;
    13        
     14
     15        public AudioFastSlowAction(String name, String iconName, String tooltip, ShortCut shortcut, boolean fast) {
     16                super(name, iconName, tooltip, shortcut, true);
     17                try {
     18                        multiplier = Double.parseDouble(Main.pref.get("audio.fastfwdmultiplier","1.3"));
     19                } catch (NumberFormatException e) {
     20                        multiplier = 1.3;
     21                }
     22                if (! fast)
     23                        multiplier = 1.0 / multiplier;
     24        }
     25
     26        @Deprecated
    1427        public AudioFastSlowAction(String name, String iconName, String tooltip, int shortcut, int modifier, boolean fast) {
    1528                super(name, iconName, tooltip, shortcut, modifier, true);
     
    1932                        multiplier = 1.3;
    2033                }
    21                 if (! fast) 
     34                if (! fast)
    2235                        multiplier = 1.0 / multiplier;
    2336        }
     
    2538        public void actionPerformed(ActionEvent e) {
    2639                double speed = AudioPlayer.speed();
    27                 if (speed * multiplier <= 0.1) 
     40                if (speed * multiplier <= 0.1)
    2841                        return;
    2942                try {
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioFasterAction.java

    r627 r1023  
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
     5import org.openstreetmap.josm.tools.ShortCut;
    56
    67import java.awt.event.KeyEvent;
    78
    89public class AudioFasterAction extends AudioFastSlowAction {
    9        
     10
    1011        public AudioFasterAction() {
    11                 super(tr("Faster"), "audio-faster", tr("Faster Forward"), KeyEvent.VK_F9, 0, true);
     12                super(tr("Faster"), "audio-faster", tr("Faster Forward"),
     13                ShortCut.registerShortCut("audio:faster", tr("Audio: Faster"), KeyEvent.VK_F9, ShortCut.GROUP_DIRECT), true);
    1214        }
    1315}
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java

    r627 r1023  
    1111import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1212import org.openstreetmap.josm.tools.AudioPlayer;
     13import org.openstreetmap.josm.tools.ShortCut;
    1314
    1415public class AudioFwdAction extends JosmAction {
    1516
    1617        private double amount;
    17        
     18
    1819        public AudioFwdAction() {
    19                 super(tr("Forward"), "audio-fwd", tr("Jump forward"), KeyEvent.VK_F7, 0, true);
     20                super(tr("Forward"), "audio-fwd", tr("Jump forward"),
     21                ShortCut.registerShortCut("audio:forward", tr("Audio: Forward"), KeyEvent.VK_F7, ShortCut.GROUP_DIRECT), true);
    2022                try {
    2123                        amount = Double.parseDouble(Main.pref.get("audio.forwardbackamount","10.0"));
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioNextAction.java

    r627 r1023  
    99import org.openstreetmap.josm.actions.JosmAction;
    1010import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
     11import org.openstreetmap.josm.tools.ShortCut;
    1112
    1213public class AudioNextAction extends JosmAction {
    1314
    1415        public AudioNextAction() {
    15                 super(tr("Next Marker"), "audio-next", tr("Play next marker."), KeyEvent.VK_F8, 0, true);
     16                super(tr("Next Marker"), "audio-next", tr("Play next marker."),
     17                ShortCut.registerShortCut("audio:next", tr("Audio: Next"), KeyEvent.VK_F8, ShortCut.GROUP_DIRECT), true);
    1618        }
    1719
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java

    r627 r1023  
    1111import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1212import org.openstreetmap.josm.tools.AudioPlayer;
     13import org.openstreetmap.josm.tools.ShortCut;
    1314
    1415public class AudioPlayPauseAction extends JosmAction {
    1516
    1617        public AudioPlayPauseAction() {
    17                 super(tr("Play/pause"), "audio-playpause", tr("Play/pause audio."), KeyEvent.VK_PERIOD, 0, true);
     18                super(tr("Play/pause"), "audio-playpause", tr("Play/pause audio."),
     19                ShortCut.registerShortCut("audio:pause", tr("Audio: Play/Pause"), KeyEvent.VK_PERIOD, ShortCut.GROUP_DIRECT), true);
    1820        }
    1921
     
    3537                        AudioPlayer.audioMalfunction(ex);
    3638                }
    37         }       
     39        }
    3840}
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioPrevAction.java

    r627 r1023  
    99import org.openstreetmap.josm.actions.JosmAction;
    1010import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
     11import org.openstreetmap.josm.tools.ShortCut;
    1112
    1213public class AudioPrevAction extends JosmAction {
    1314
    1415        public AudioPrevAction() {
    15                 super(tr("Previous Marker"), "audio-prev", tr("Play previous marker."), KeyEvent.VK_F5, 0, true);
     16                super(tr("Previous Marker"), "audio-prev", tr("Play previous marker."),
     17                ShortCut.registerShortCut("audio:prev", tr("Audio: Previous"), KeyEvent.VK_F5, ShortCut.GROUP_DIRECT), true);
    1618        }
    1719
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioSlowerAction.java

    r627 r1023  
    55
    66import java.awt.event.KeyEvent;
     7import org.openstreetmap.josm.tools.ShortCut;
    78
    89public class AudioSlowerAction extends AudioFastSlowAction {
    9        
     10
    1011        public AudioSlowerAction() {
    11                 super(tr("Slower"), "audio-slower", tr("Slower Forward"), KeyEvent.VK_F9, KeyEvent.SHIFT_MASK, false);
     12                super(tr("Slower"), "audio-slower", tr("Slower Forward"),
     13                ShortCut.registerShortCut("audio:slower", tr("Audio: Slower"), KeyEvent.VK_F9, ShortCut.GROUP_DIRECT), true);
    1214        }
    1315}
Note: See TracChangeset for help on using the changeset viewer.