Last change
on this file since 1222 was 1222, checked in by stoecker, 15 years ago |
some cleanup in preferences handling
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Line | |
---|
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 |
|
---|
6 | import java.awt.event.ActionEvent;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.actions.JosmAction;
|
---|
11 | import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
|
---|
12 | import org.openstreetmap.josm.tools.AudioPlayer;
|
---|
13 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
14 |
|
---|
15 | public class AudioFwdAction extends JosmAction {
|
---|
16 |
|
---|
17 | private double amount;
|
---|
18 |
|
---|
19 | public AudioFwdAction() {
|
---|
20 | super(tr("Forward"), "audio-fwd", tr("Jump forward"),
|
---|
21 | Shortcut.registerShortcut("audio:forward", tr("Audio: {0}", tr("Forward")), KeyEvent.VK_F7, Shortcut.GROUP_DIRECT), true);
|
---|
22 | amount = Main.pref.getDouble("audio.forwardbackamount","10.0");
|
---|
23 | }
|
---|
24 |
|
---|
25 | public void actionPerformed(ActionEvent e) {
|
---|
26 | try {
|
---|
27 | if (AudioPlayer.playing() || AudioPlayer.paused())
|
---|
28 | AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position() + amount);
|
---|
29 | else
|
---|
30 | MarkerLayer.playAudio();
|
---|
31 | } catch (Exception ex) {
|
---|
32 | AudioPlayer.audioMalfunction(ex);
|
---|
33 | }
|
---|
34 | }
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.