source: josm/trunk/src/org/openstreetmap/josm/actions/audio/AudioBackAction.java@ 14397

Last change on this file since 14397 was 14397, checked in by Don-vip, 6 years ago

fix #16935 - simplify/cleanup help topics of ToggleDialog/ToggleDialogAction

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.audio;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
6import static org.openstreetmap.josm.tools.I18n.trc;
7
8import java.awt.event.ActionEvent;
9import java.awt.event.KeyEvent;
10import java.io.IOException;
11
12import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
13import org.openstreetmap.josm.io.audio.AudioPlayer;
14import org.openstreetmap.josm.io.audio.AudioUtil;
15import org.openstreetmap.josm.spi.preferences.Config;
16import org.openstreetmap.josm.tools.Shortcut;
17
18/**
19 * Jump the audio backward 10 seconds and start playing if paused.
20 * @since 547
21 */
22public class AudioBackAction extends AbstractAudioAction {
23
24 /**
25 * Constructs a new {@code AudioBackAction}.
26 */
27 public AudioBackAction() {
28 super(trc("audio", "Back"), "audio-back", trc("audio", "Jump back."),
29 Shortcut.registerShortcut("audio:back", tr("Audio: {0}", trc("audio", "Back")), KeyEvent.VK_F6, Shortcut.DIRECT), true);
30 setHelpId(ht("/Action/AudioBack"));
31 }
32
33 @Override
34 public void actionPerformed(ActionEvent e) {
35 try {
36 if (AudioPlayer.playing() || AudioPlayer.paused())
37 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position()
38 - Config.getPref().getDouble("audio.forwardbackamount", 10.0));
39 else
40 MarkerLayer.playAudio();
41 } catch (IOException | InterruptedException ex) {
42 AudioUtil.audioMalfunction(ex);
43 }
44 }
45}
Note: See TracBrowser for help on using the repository browser.