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