Index: /applications/editors/josm/plugins/surveyor/build.xml
===================================================================
--- /applications/editors/josm/plugins/surveyor/build.xml	(revision 3961)
+++ /applications/editors/josm/plugins/surveyor/build.xml	(revision 3962)
@@ -10,5 +10,5 @@
 	  
 	  <!-- plugin meta data (enter new version number if anything changed!) -->
-	  <property name="plugin.version" value="1.2"/>
+	  <property name="plugin.version" value="1.3.1"/>
 	  <property name="plugin.description" value="Allow adding markers/nodes on current gps positions (V${plugin.version})."/>
 	  <property name="plugin.stage" value="60"/>
@@ -24,12 +24,9 @@
 	<target name="dist" depends="compile,site">
 		<!-- images -->
-		<copy todir="${plugin.build.dir}/images">
-			<fileset dir="src/images" />
-		</copy>
-			<!-- copy configuration xml files -->
-		<copy todir="${plugin.build.dir}">
-			<fileset dir="src"> 
+		<copy todir="${plugin.build.dir}/">
+			<fileset dir="resources">
 				<include name="*.xml"/>
-  		</fileset>
+				<include name="audio/*"/>
+		  </fileset>
 		</copy>
 		
Index: /applications/editors/josm/plugins/surveyor/changelog.txt
===================================================================
--- /applications/editors/josm/plugins/surveyor/changelog.txt	(revision 3962)
+++ /applications/editors/josm/plugins/surveyor/changelog.txt	(revision 3962)
@@ -0,0 +1,7 @@
+2007-08-05: added BeepAction. Parameter is number of beeps
+
+2007-08-02: PlayAudioAction is able to read wav files from classpath and from urls
+            
+            It also plays the audio file in the background, so the PlayAudioAction can
+            be set as the first action without delaying the setting of the waypoint/nodes
+            by a following SetWaypointAction.
Index: /applications/editors/josm/plugins/surveyor/resources/surveyor.xml
===================================================================
--- /applications/editors/josm/plugins/surveyor/resources/surveyor.xml	(revision 3962)
+++ /applications/editors/josm/plugins/surveyor/resources/surveyor.xml	(revision 3962)
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<surveyor columns="4" width="1300" height="0">
+  <!-- icons can either be absolute paths or relative paths to the .josm directory -->
+  <!-- action class: either fully qualified classnames or if not found, 
+       package at.dallermassl.josm.plugin.surveyor.action is assumed -->
+  <button label="Tunnel Start" hotkey="T" icon="tunnel">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="tunnel start"/>
+    <!--action class="ConsolePrinterAction" params="tunnel start,tunnel"/-->
+    <!--action class="SystemExecuteAction" params="mplayer,-quiet,/usr/share/apps/klettres/de/alpha/x.ogg"/-->
+  </button>
+  <button label="Bridge" hotkey="B" type="toggle">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="bridge"/>
+  </button>
+  <button label="Village/City" hotkey="V" icon="place">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="village"/>
+    <!--
+    <action class="SetNodeAction" params=""/>
+    <action class="AnnotationPresetAction" params="Places"/>
+    -->
+  </button>
+  <button label="Parking" hotkey="P" icon="parking">
+    <!--action class="SetNodeAction" params="amenity=parking"/-->
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Parking"/>
+  </button>
+  <button label="One Way" hotkey="O" icon="noentry">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="oneway=yes"/>
+  </button>
+  <button label="Church" hotkey="C" icon="church">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetNodeAction" params="amenity=place_of_worship,denomination=christian"/>
+    <action class="SetWaypointAction" params="Church"/>
+  </button>
+  <button label="Fuel Station" hotkey="F" icon="fuel">
+    <!--action class="SetNodeAction" params="amenity=fuel"/-->
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Fuel"/>
+  </button>
+  <button label="Hotel" hotkey="H" icon="bed">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Hotel"/>
+  </button>
+  <button label="Restaurant" hotkey="R" icon="restaurant">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetNodeAction" params="amenity=restaurant"/>
+    <action class="SetWaypointAction" params="Restaurant"/>
+  </button>
+  <button label="Shopping" hotkey="S" icon="shopping">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Info"/>
+  </button>
+  <button label="WC" hotkey="W" icon="toilet">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Info"/>
+  </button>
+  <button label="Camping" hotkey="Z" icon="caravan">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Camping"/>
+  </button>
+  <button label="Info" hotkey="I">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Info"/>
+  </button>
+  <button label="Exit" hotkey="E">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Exit"/>
+  </button>
+  <button label="Motorway" hotkey="1">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Motorway"/>
+  </button>
+  <button label="Primary" hotkey="2">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Primary"/>
+  </button>
+  <button label="Secondary" hotkey="3">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Secondary"/>
+  </button>
+  <button label="Unclassified" hotkey="4">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Unclassified"/>
+  </button>
+  <button label="Residential" hotkey="5">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Residential"/>
+  </button>
+  <button label="Test" hotkey="F12">
+    <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/>
+    <action class="SetWaypointAction" params="Test"/>
+  </button>
+</surveyor>
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java	(revision 3961)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java	(revision 3962)
@@ -4,6 +4,7 @@
 package at.dallermassl.josm.plugin.surveyor.action;
 
-import java.io.File;
+import java.io.BufferedInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 
@@ -19,4 +20,5 @@
 
 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent;
+import at.dallermassl.josm.plugin.surveyor.util.ResourceLoader;
 
 /**
@@ -27,5 +29,5 @@
  */
 public class PlayAudioAction extends AbstractSurveyorAction {
-    private File audioFile = null;
+    private String audioSource = null;
 
     /* (non-Javadoc)
@@ -34,55 +36,55 @@
     //@Override
     public void actionPerformed(GpsActionEvent event) {
-        try {
-            if(audioFile == null) {
-                audioFile = new File(getParameters().get(0));
-                if(!audioFile.exists()) {
-                    audioFile = new File(Main.pref.getPreferencesDir(), getParameters().get(0));
-                    if(!audioFile.exists()) {
-                        System.err.println("Audio file " + getParameters().get(0) + " not found!");
-                        return;
+        // run as a separate thread
+        Main.worker.execute(new Runnable() {
+            public void run() {
+                try {
+                    if(audioSource == null) {
+                        audioSource = getParameters().get(0);
+                        System.out.println("reading audio from " + audioSource);
                     }
+                    InputStream in = new BufferedInputStream(ResourceLoader.getInputStream(audioSource));
+                    AudioInputStream stream = AudioSystem.getAudioInputStream(in);
+
+                    // From URL
+//                  stream = AudioSystem.getAudioInputStream(new URL("http://hostname/audiofile"));
+
+                    // At present, ALAW and ULAW encodings must be converted
+                    // to PCM_SIGNED before it can be played
+                    AudioFormat format = stream.getFormat();
+                    if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
+                        format = new AudioFormat(
+                            AudioFormat.Encoding.PCM_SIGNED,
+                            format.getSampleRate(),
+                            format.getSampleSizeInBits()*2,
+                            format.getChannels(),
+                            format.getFrameSize()*2,
+                            format.getFrameRate(),
+                            true);        // big endian
+                        stream = AudioSystem.getAudioInputStream(format, stream);
+                    }
+
+                    // Create the clip
+                    DataLine.Info info = new DataLine.Info(
+                        Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize()));
+                    Clip clip = (Clip) AudioSystem.getLine(info);
+
+                    // This method does not return until the audio file is completely loaded
+                    clip.open(stream);
+
+                    // Start playing
+                    clip.start();
+                } catch (MalformedURLException e) {
+                    e.printStackTrace();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                } catch (LineUnavailableException e) {
+                    e.printStackTrace();
+                } catch (UnsupportedAudioFileException e) {
+                    e.printStackTrace();
                 }
             }
-            // From file
-            AudioInputStream stream = AudioSystem.getAudioInputStream(audioFile);
-        
-            // From URL
-//            stream = AudioSystem.getAudioInputStream(new URL("http://hostname/audiofile"));
-        
-            // At present, ALAW and ULAW encodings must be converted
-            // to PCM_SIGNED before it can be played
-            AudioFormat format = stream.getFormat();
-            if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
-                format = new AudioFormat(
-                        AudioFormat.Encoding.PCM_SIGNED,
-                        format.getSampleRate(),
-                        format.getSampleSizeInBits()*2,
-                        format.getChannels(),
-                        format.getFrameSize()*2,
-                        format.getFrameRate(),
-                        true);        // big endian
-                stream = AudioSystem.getAudioInputStream(format, stream);
-            }
-        
-            // Create the clip
-            DataLine.Info info = new DataLine.Info(
-                Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize()));
-            Clip clip = (Clip) AudioSystem.getLine(info);
-        
-            // This method does not return until the audio file is completely loaded
-            clip.open(stream);
-        
-            // Start playing
-            clip.start();
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } catch (LineUnavailableException e) {
-            e.printStackTrace();
-        } catch (UnsupportedAudioFileException e) {
-            e.printStackTrace();
-        }
+            
+        });
         
     }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/ResourceLoader.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/ResourceLoader.java	(revision 3962)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/ResourceLoader.java	(revision 3962)
@@ -0,0 +1,42 @@
+/**
+ * 
+ */
+package at.dallermassl.josm.plugin.surveyor.util;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * @author cdaller
+ *
+ */
+public class ResourceLoader {
+    
+    private ResourceLoader() {
+        
+    }
+    
+    /**
+     * Returns an inputstream from urls, files and classloaders, depending on the name.
+     * @param source the source: if starting with &quot;http://&quot;, &quot;ftp://&quot; or
+     * &quot;file://&quot; source is interpreted as an URL. If starting with &quot;resource://&quot;
+     * the classloader is used. All other sources are interpreted as filenames.
+     * @return the inputstream.
+     * @throws IOException if an error occurs on opening the url, or if the file is not found.
+     */
+    public static InputStream getInputStream(String source) throws IOException {
+        InputStream in = null;
+        if (source.startsWith("http://") || source.startsWith("ftp://") || source.startsWith("file:")) {
+            in = new URL(source).openStream();
+        } else if (source.startsWith("resource://")) {
+            in = ResourceLoader.class.getResourceAsStream(source.substring("resource:/".length()));
+        } else {
+            in = new FileInputStream(source);
+        }
+        System.out.println("stream for resource is " + in);
+        return in;
+    }
+
+}
Index: plications/editors/josm/plugins/surveyor/src/surveyor.xml
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/surveyor.xml	(revision 3961)
+++ 	(revision )
@@ -1,76 +1,0 @@
-<?xml version="1.0"?>
-<surveyor columns="4" width="0" height="0">
-  <!-- icons can either be absolute paths or relative paths to the .josm directory -->
-  <!-- action class: either fully qualified classnames or if not found, 
-       package at.dallermassl.josm.plugin.surveyor.action is assumed -->
-  <button label="Tunnel Start" hotkey="T" icon="tunnel">
-    <action class="SetWaypointAction" params="tunnel start"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-    <!--action class="ConsolePrinterAction" params="tunnel start,tunnel"/-->
-    <!--action class="SystemExecuteAction" params="mplayer,-quiet,/usr/share/apps/klettres/de/alpha/x.ogg"/-->
-  </button>
-  <button label="Bridge" hotkey="B" type="toggle">
-    <action class="SetWaypointAction" params="bridge"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Village/City" hotkey="V" icon="place">
-    <action class="SetWaypointAction" params="village"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-    <!--
-    <action class="SetNodeAction" params=""/>
-    <action class="AnnotationPresetAction" params="Places"/>
-    -->
-  </button>
-  <button label="Parking" hotkey="P" icon="parking">
-    <action class="SetNodeAction" params="amenity=parking"/>
-    <action class="SetWaypointAction" params="Parking"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="One Way" hotkey="O" icon="noentry">
-    <action class="SetWaypointAction" params="oneway=yes"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Church" hotkey="C" icon="church">
-    <action class="SetNodeAction" params="amenity=place_of_worship,denomination=christian"/>
-    <action class="SetWaypointAction" params="Church"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Fuel Station" hotkey="F" icon="fuel">
-    <action class="SetNodeAction" params="amenity=fuel"/>
-    <action class="SetWaypointAction" params="Fuel"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Hotel" hotkey="H" icon="bed">
-    <action class="SetWaypointAction" params="Hotel"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Restaurant" hotkey="R" icon="restaurant">
-    <action class="SetNodeAction" params="amenity=restaurant"/>
-    <action class="SetWaypointAction" params="Restaurant"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Exit" hotkey="E">
-    <action class="SetWaypointAction" params="Exit"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Motorway" hotkey="1">
-    <action class="SetWaypointAction" params="Motorway"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Primary" hotkey="2">
-    <action class="SetWaypointAction" params="Primary"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Secondary" hotkey="3">
-    <action class="SetWaypointAction" params="Secondary"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Unclassified" hotkey="4">
-    <action class="SetWaypointAction" params="Unclassified"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-  <button label="Residential" hotkey="5">
-    <action class="SetWaypointAction" params="Residential"/>
-    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
-  </button>
-</surveyor>
