1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.actions.audio;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 | import static org.openstreetmap.josm.tools.I18n.trc;
|
---|
6 |
|
---|
7 | import java.awt.event.ActionEvent;
|
---|
8 | import java.awt.event.KeyEvent;
|
---|
9 |
|
---|
10 | import org.openstreetmap.josm.Main;
|
---|
11 | import org.openstreetmap.josm.actions.JosmAction;
|
---|
12 | import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
|
---|
13 | import org.openstreetmap.josm.tools.AudioPlayer;
|
---|
14 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Jump the audio forward 10 seconds.
|
---|
18 | * @since 547
|
---|
19 | */
|
---|
20 | public class AudioFwdAction extends JosmAction {
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Constructs a new {@code AudioFwdAction}.
|
---|
24 | */
|
---|
25 | public AudioFwdAction() {
|
---|
26 | super(trc("audio", "Forward"), "audio-fwd", trc("audio", "Jump forward"),
|
---|
27 | Shortcut.registerShortcut("audio:forward", tr("Audio: {0}", trc("audio", "Forward")), KeyEvent.VK_F7, Shortcut.DIRECT), true);
|
---|
28 | }
|
---|
29 |
|
---|
30 | public void actionPerformed(ActionEvent e) {
|
---|
31 | try {
|
---|
32 | if (AudioPlayer.playing() || AudioPlayer.paused())
|
---|
33 | AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position()
|
---|
34 | + Main.pref.getDouble("audio.forwardbackamount", 10.0));
|
---|
35 | else
|
---|
36 | MarkerLayer.playAudio();
|
---|
37 | } catch (Exception ex) {
|
---|
38 | AudioPlayer.audioMalfunction(ex);
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|