| 1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
|---|
| 2 | package org.openstreetmap.josm.actions.audio;
|
|---|
| 3 |
|
|---|
| 4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
|---|
| 5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
|---|
| 6 | import static org.openstreetmap.josm.tools.I18n.trc;
|
|---|
| 7 |
|
|---|
| 8 | import java.awt.event.ActionEvent;
|
|---|
| 9 | import java.awt.event.KeyEvent;
|
|---|
| 10 |
|
|---|
| 11 | import org.openstreetmap.josm.Main;
|
|---|
| 12 | import org.openstreetmap.josm.actions.JosmAction;
|
|---|
| 13 | import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
|
|---|
| 14 | import org.openstreetmap.josm.tools.AudioPlayer;
|
|---|
| 15 | import org.openstreetmap.josm.tools.Shortcut;
|
|---|
| 16 |
|
|---|
| 17 | public class AudioBackAction extends JosmAction {
|
|---|
| 18 |
|
|---|
| 19 | public AudioBackAction() {
|
|---|
| 20 | super(trc("audio", "Back"), "audio-back", trc("audio", "Jump back."),
|
|---|
| 21 | Shortcut.registerShortcut("audio:back", tr("Audio: {0}", trc("audio", "Back")), KeyEvent.VK_F6, Shortcut.GROUP_DIRECT), true);
|
|---|
| 22 | this.putValue("help", ht("/Action/AudioBack"));
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | public void actionPerformed(ActionEvent e) {
|
|---|
| 26 | try {
|
|---|
| 27 | if (AudioPlayer.playing() || AudioPlayer.paused())
|
|---|
| 28 | AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position()
|
|---|
| 29 | - Main.pref.getDouble("audio.forwardbackamount","10.0"));
|
|---|
| 30 | else
|
|---|
| 31 | MarkerLayer.playAudio();
|
|---|
| 32 | } catch (Exception ex) {
|
|---|
| 33 | AudioPlayer.audioMalfunction(ex);
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|