Index: applications/editors/josm/plugins/videomapping/.classpath
===================================================================
--- applications/editors/josm/plugins/videomapping/.classpath	(revision 21540)
+++ applications/editors/josm/plugins/videomapping/.classpath	(revision 21555)
@@ -5,5 +5,5 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
-	<classpathentry kind="lib" path="C:/Dokumente und Einstellungen/g/Eigene Dateien/Workspace/vlcj/vlcj-1.1f.jar">
+	<classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/vlcj-1.1f.jar">
 		<attributes>
 			<attribute name="javadoc_location" value="jar:file:/C:/Dokumente und Einstellungen/g/Eigene Dateien/Workspace/vlcj/vlcj-1.1f-javadoc.jar!/"/>
Index: applications/editors/josm/plugins/videomapping/.project
===================================================================
--- applications/editors/josm/plugins/videomapping/.project	(revision 21540)
+++ applications/editors/josm/plugins/videomapping/.project	(revision 21555)
@@ -4,4 +4,5 @@
 	<comment></comment>
 	<projects>
+		<project>JOSM</project>
 	</projects>
 	<buildSpec>
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java	(revision 21540)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java	(revision 21555)
@@ -5,4 +5,5 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
@@ -93,31 +94,15 @@
 	{
 		Point leftP,rightP,highP,lowP;
-		boolean invalid = false;
+		boolean invalid = false; //when we leave this segment
 		Point p1 = Main.map.mapView.getPoint(getCurr().getEastNorth());
-		if(getNext()!=null) //TODO outsource certain dub routines
-		{
-			Point p2 = Main.map.mapView.getPoint(getNext().getEastNorth());
-			//determine which point is what
-			if(p1.x<p2.x)
-			{
-				leftP=p1;
-				rightP=p2;
-			}
-			else
-			{
-				leftP=p2;
-				rightP=p1;
-			}
-			if(p1.y<p2.y)
-			{
-				highP=p1;
-				lowP=p2;
-			}
-			else
-			{
-				highP=p2;
-				lowP=p1;
-			}
-			//we might switch to neighbor segment
+		Point p2 = getEndpoint();
+		//determine which point is what
+		leftP=getLeftPoint(p1, p2);
+		rightP=getRightPoint(p1,p2);
+		highP=getHighPoint(p1, p2);
+		lowP=getLowPoint(p1, p2);
+		if(getNext()!=null)
+		{
+			//we might switch to one neighbor segment
 			if(m.x<leftP.x)
 			{
@@ -138,9 +123,7 @@
 				System.out.println("entering right segment");
 			}
-			//highP = Main.map.mapView.getPoint(l.getCurr().getEastNorth());
-			//lowP = Main.map.mapView.getPoint(l.getNext().getEastNorth());
 			if(!invalid)
 			{
-				float slope=(float)(highP.y-lowP.y) / (float)(highP.x - lowP.x);
+				float slope = getSlope(highP, lowP);
 				m.y = highP.y+Math.round(slope*(m.x-highP.x));
 			}
@@ -149,30 +132,40 @@
 		{
 			//currently we are at the end
-			Point p2 = Main.map.mapView.getPoint(getPrev().getEastNorth());
-			if (p1.x>p2.x)
-			{
-				leftP=p2;
-				rightP=p1;
+			if(m.x>rightP.x)
+			{
+				m=rightP; //we can't move anywhere
 			}
 			else
 			{
-				leftP=p1;
-				rightP=p2;
-			}
-			if(m.x>rightP.x)
-			{
-				m=rightP; //we can't move anywhere
-			}
-			else
-			{
-				prev();
-			}
-			
-			
-		}
-		//System.out.println((m));
+				prev(); //walk back to the segment before
+			}			
+		}
 		return m;
 	}
 	
+	private Point getInterpolated(float percent)
+	{
+
+		int dX,dY;
+		Point p;
+		Point leftP,rightP,highP,lowP;
+		Point c = Main.map.mapView.getPoint(getCurr().getEastNorth());
+		Point p1 = Main.map.mapView.getPoint(getCurr().getEastNorth());
+		Point p2 = getEndpoint();		
+		//determine which point is what
+		leftP=getLeftPoint(p1, p2);
+		rightP=getRightPoint(p1,p2);
+		highP=getHighPoint(p1, p2);
+		lowP=getLowPoint(p1, p2);
+		//we will never go over the segment
+		percent=percent/100;
+		dX=Math.round((rightP.x-leftP.x)*percent);
+		dY=Math.round((rightP.y-leftP.y)*percent);
+		//move in the right direction
+		p=new Point(rightP.x-dX,rightP.y-dY);
+
+		return p;
+	}
+
 	//gets further infos for a point between two Waypoints
 	public WayPoint getInterpolatedWaypoint(Point m)
@@ -184,58 +177,112 @@
 		
 		Point curr =Main.map.mapView.getPoint(getCurr().getEastNorth());
-		m =getInterpolated(m);
+		m =getInterpolated(m); //get the right position
+		//get the right time
+		p2=getEndpoint();
 		if (getNext()!=null)
 		{
-			p2 =Main.map.mapView.getPoint(getNext().getEastNorth());
 			timeSeg=getNext().getTime().getTime()-getCurr().getTime().getTime();
 		}
 		else
 		{
-			p2 =Main.map.mapView.getPoint(getPrev().getEastNorth());
 			timeSeg=-(getPrev().getTime().getTime()-getCurr().getTime().getTime());
 		}
 		WayPoint w =new WayPoint(Main.map.mapView.getLatLon(m.x, m.y));
 		//calc total traversal length
+		lengthSeg = getTraversalLength(p2, curr);
+		length = getTraversalLength(p2, m);
+		length=lengthSeg-length;
+		//calc time difference
+		ratio=(float)length/(float)lengthSeg;
+		long inc=(long) (timeSeg*ratio);		
+		long old = getCurr().getTime().getTime();
+		old=old+inc;
+		Date t = new Date(old);
+		w.time = t.getTime()/1000; //TODO need better way to set time
+		SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss:S");
+		/*System.out.print(length+"px ");
+		System.out.print(ratio+"% ");
+		System.out.print(inc+"ms ");
+		System.out.println(df.format(t.getTime()));+*/
+		System.out.println(df.format(w.getTime()));
+		//TODO we have to publish the new date to the node...
+		return w;
+	}
+
+	private WayPoint getInterpolatedWaypoint(float percentage)
+	{
+		Point p = getInterpolated(percentage);
+		WayPoint w =new WayPoint(Main.map.mapView.getLatLon(p.x, p.y));
+		return w;
+	}
+	
+	public List<WayPoint> getInterpolatedLine(int interval)
+	{
+		List<WayPoint> ls;
+		Point p2;
+		float step;
+		int length;
+		
+		step=100/(float)interval;
+		ls=new LinkedList<WayPoint>();
+		for(float i=step;i<100;i+=step)
+		{
+			ls.add(getInterpolatedWaypoint(i));
+		}
+		return ls;
+	}
+	
+	private Point getLeftPoint(Point p1,Point p2)
+	{
+		if(p1.x<p2.x) return p1; else return p2;
+	}
+	
+	private Point getRightPoint(Point p1, Point p2)
+	{
+		if(p1.x>p2.x) return p1; else return p2;
+	}
+	
+	private Point getHighPoint(Point p1, Point p2)
+	{
+		if(p1.y<p2.y)return p1; else return p2;
+	}
+	
+	private Point getLowPoint(Point p1, Point p2)
+	{
+		if(p1.y>p2.y)return p1; else return p2;
+	}
+
+	private Point getEndpoint() {
+		if(getNext()!=null)
+		{
+			return Main.map.mapView.getPoint(getNext().getEastNorth());
+		}
+		else
+		{
+			return Main.map.mapView.getPoint(getPrev().getEastNorth());
+		}
+		
+	}
+
+	private float getSlope(Point highP, Point lowP) {
+		float slope=(float)(highP.y-lowP.y) / (float)(highP.x - lowP.x);
+		return slope;
+	}
+
+	private int getTraversalLength(Point p2, Point curr) {
+		int a;
+		int b;
+		int lengthSeg;
 		a=Math.abs(curr.x-p2.x);
 		b=Math.abs(curr.y-p2.y);
 		lengthSeg= (int) Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2));
-		a=Math.abs(m.x-p2.x);
-		b=Math.abs(m.y-p2.y);
-		length= (int) Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2));
-		length=lengthSeg-length;
-		ratio=(float)length/(float)lengthSeg;
-		long inc=(long) (timeSeg*ratio);
-		SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss:S");
-		long old = getCurr().getTime().getTime();
-		old=old+inc;
-		System.out.print(length+"px ");
-		System.out.print(ratio+"% ");
-		System.out.print(inc+"ms ");
-		System.out.println(df.format(old));
-		Date t = new Date(old);
-		//TODO we have to publish the new date to the node...
-		return w;
-	}
-	
-	public List<WayPoint> getInterpolatedLine(int interval)
-	{
-		Point p2;
-		Point curr =Main.map.mapView.getPoint(getCurr().getEastNorth());
-		if (getNext()!=null)
-		{
-			p2 =Main.map.mapView.getPoint(getNext().getEastNorth());
-		}
-		else
-		{
-			p2 =Main.map.mapView.getPoint(getPrev().getEastNorth());
-		}
-		int a=Math.abs(curr.x-p2.x);
-		int b=Math.abs(curr.y-p2.y);
-		int length= (int) Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2));
-		float step=length/interval;
-		//TODO here we go
-		return null;
-	}
-	
-
+		return lengthSeg;
+	}
+
+	public void pause() {
+		// TODO Auto-generated method stub
+		
+	}
+	
+	
 }
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/MoveAction.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/MoveAction.java	(revision 21540)
+++ 	(revision )
@@ -1,14 +1,0 @@
-package org.openstreetmap.josm.plugins.videomapping;
-
-import java.awt.event.ActionEvent;
-
-import org.openstreetmap.josm.actions.JosmAction;
-
-public class MoveAction extends JosmAction {
-
-	public void actionPerformed(ActionEvent e) {
-		System.out.println(e.getActionCommand());
-
-	}
-
-}
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java	(revision 21540)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java	(revision 21555)
@@ -9,4 +9,5 @@
 import java.util.Date;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
@@ -44,4 +45,5 @@
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Shortcut;
 
 public class PositionLayer extends Layer implements MouseListener,MouseMotionListener, KeyListener {
@@ -49,4 +51,5 @@
 	private GpsPlayer l;
 	private Collection<WayPoint> selected;
+	private Timer t;
 	private TimerTask ani;
 	private boolean dragIcon=false; //do we move the icon by hand?
@@ -54,4 +57,5 @@
 	private Point mouse;
 	private ImageIcon icon;
+	private SimpleDateFormat df;
 		
 	public PositionLayer(String name, final List<WayPoint> ls) {
@@ -60,39 +64,52 @@
 		l= new GpsPlayer(ls);
 		selected = new ArrayList<WayPoint>();
-		icon=ImageProvider.get("videomapping.png");		
+		icon=ImageProvider.get("videomapping.png");
+		df = new SimpleDateFormat("hh:mm:ss:S");
 		Main.map.mapView.addMouseListener(this);
 		Main.map.mapView.addMouseMotionListener(this);
-		Main.map.mapView.getRootPane().getGlassPane().addKeyListener(this);
-		//Main.panel.addKeyListener(this);
-		//Main.map.mapView.addKeyListener(this);
-		System.err.println("key :");
-
-		Action a = new AbstractAction() {
+		addKeys();								
+		
+	}
+
+	//add key bindings for navigate through the track (and if synced trough the video, too)
+	private void addKeys() {
+		Action backward = new AbstractAction() {
 			public void actionPerformed(ActionEvent e) {
-				// TODO Auto-generated method stub
-				System.err.println("!!!boom!!!");
+				if(l!=null)l.prev();
+				Main.map.mapView.repaint();
 			}};
-		Main.registerActionShortcut(a, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0));
-
-		//Main.map.mapView.addKeyListener(this);
-		//Main.contentPane.getInputMap().put(KeyStroke.getKeyStroke("SPACE"),"pressed");
-		//Main.contentPane.getActionMap().put("pressed",a);
-
-		//Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,0),a);
-		//Main.contentPane.getActionMap().put("doSomething",a);
-						
-		TimerTask ani=new TimerTask() {
 			
-			@Override
-			//some cheap animation stuff
-			public void run() {				
-				l.next();
+		Action forward = new AbstractAction() {
+			public void actionPerformed(ActionEvent e) {
+				if(l!=null)l.next();
 				Main.map.mapView.repaint();
-			}
-		};
-		Timer t= new Timer();
-		//t.schedule(ani,2000,2000);
-		//l.next();
-		
+			}};
+		Action startStop = new AbstractAction() {
+			public void actionPerformed(ActionEvent e) {
+				if (t==null)
+				{
+					//start
+					t= new Timer();
+					TimerTask ani=new TimerTask() {			
+						@Override
+						//some cheap animation stuff
+						public void run() {				
+							l.next();
+							Main.map.mapView.repaint();
+						}
+					};
+					t.schedule(ani,500,500);
+				}
+				else
+				{
+					//stop
+					t.cancel();
+					t=null;					
+				}
+			}};
+		//TODO custome Shortkey management
+		Main.registerActionShortcut(backward, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0));
+		Main.registerActionShortcut(forward, KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0));
+		//Main.registerActionShortcut(startStop, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0));
 	}
 
@@ -174,5 +191,15 @@
 			g.drawLine(p.x, p.y, p2.x, p2.y);
 		}
+		//draw interpolated points
+		g.setColor(Color.CYAN);
+		g.setBackground(Color.CYAN);
+		LinkedList<WayPoint> ipo=(LinkedList<WayPoint>) l.getInterpolatedLine(5);
+		for (WayPoint wp : ipo) {
+			p=Main.map.mapView.getPoint(wp.getEastNorth());
+			g.fillArc(p.x, p.y, 4, 4, 0, 360);
+			//g.drawOval(p.x - 2, p.y - 2, 4, 4);
+		}
 		//draw cam icon
+		g.setColor(Color.RED);
 		if(dragIcon)
 		{
@@ -180,6 +207,6 @@
 			{
 				p=Main.map.mapView.getPoint(iconPosition.getEastNorth());
-				icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);
-				g.drawString(iconPosition.getTime().toString(),p.x,p.y);
+				icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);				
+				g.drawString(df.format(iconPosition.getTime()),p.x,p.y);
 			}
 		}
@@ -188,7 +215,31 @@
 			if (l.getCurr()!=null){
 			p=Main.map.mapView.getPoint(l.getCurr().getEastNorth());
-			icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);
-			g.drawString(l.getCurr().getTime().toString(), p.x, p.y);
-			}
+			icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);			
+			g.drawString(df.format(l.getCurr().getTime()),p.x,p.y);
+			}
+		}
+	}
+	
+	public void pause()
+	{
+		if (t==null)
+		{
+			//start
+			t= new Timer();
+			TimerTask ani=new TimerTask() {			
+				@Override
+				//some cheap animation stuff
+				public void run() {				
+					l.next();
+					Main.map.mapView.repaint();
+				}
+			};
+			t.schedule(ani,500,500);
+		}
+		else
+		{
+			//stop
+			t.cancel();
+			t=null;					
 		}
 	}
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoAction.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoAction.java	(revision 21540)
+++ 	(revision )
@@ -1,60 +1,0 @@
-package org.openstreetmap.josm.plugins.videomapping;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-
-import javax.swing.JFileChooser;
-import javax.swing.KeyStroke;
-import javax.swing.filechooser.FileFilter;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.actions.JosmAction;
-import org.openstreetmap.josm.data.gpx.*;
-import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.layer.GpxLayer;
-import org.openstreetmap.josm.tools.DateUtils;
-import org.openstreetmap.josm.tools.Shortcut;
-import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
-import static org.openstreetmap.josm.tools.I18n.*;
-
-public class VideoAction extends JosmAction {
-
-	private GpxData gps;
-	private DataSet ds; //all extracted GPS points
-	private List<WayPoint> ls;
-
-	public VideoAction() {
-		super("Sync Video","videomapping","Sync a video against this GPS track",null,true);
-	}
-
-	// Choose a file
-	public void actionPerformed(ActionEvent arg0) {
-		copyGPSLayer();
-		Main.main.addLayer(new PositionLayer("test",ls));		
-
-	}
-		
-	
-	public void setGps(GpxData gps) {
-		this.gps = gps;
-	}
-	
-	//makes a private flat copy for interaction
-	private void copyGPSLayer()
-	{ 
-		ls = new LinkedList<WayPoint>();
-        for (GpxTrack trk : gps.tracks) {
-            for (GpxTrackSegment segment : trk.getSegments()) {
-                ls.addAll(segment.getWayPoints());
-            }
-        }
-        Collections.sort(ls); //sort basing upon time
-	}
-
-}
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java	(revision 21540)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java	(revision 21555)
@@ -2,4 +2,5 @@
 
 import java.awt.Component;
+import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 
@@ -10,5 +11,8 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.plugins.*;
+import org.openstreetmap.josm.plugins.videomapping.actions.StartStopAction;
+import org.openstreetmap.josm.plugins.videomapping.actions.VideoAddAction;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.gui.MainMenu;
@@ -21,8 +25,14 @@
 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
 
-  public class VideoMappingPlugin extends Plugin implements LayerChangeListener{
+  /**
+ * @author Matthias Meißer
+ * @ released under GPL
+ * This Plugin allows you to link a video against a GPS track and playback both synchronously 
+ */
+public class VideoMappingPlugin extends Plugin implements LayerChangeListener{
 	  private JMenu VMenu;
 	  private GpxData GPSTrack;
-	  private VideoAction VAction;
+	  private VideoAddAction VAdd;
+	  private StartStopAction VStart;
 	  
 
@@ -30,36 +40,59 @@
 		super(info);
 		//Register for GPS menu
-		VMenu = Main.main.menu.addMenu(" Video", KeyEvent.VK_V, Main.main.menu.defaultMenuPos,ht("/Plugin/Videomapping"));//TODO no more ugly " video" hack
-		VMenu.setEnabled(false); //enabled only on GPS Layers
-		VAction = new VideoAction();
-		VMenu.add(VAction);
+		VMenu = Main.main.menu.addMenu(" Video", KeyEvent.VK_V, Main.main.menu.defaultMenuPos,ht("/Plugin/Videomapping"));//TODO no more ugly " video" hack		 
+		addMenuItems();
 		//setup
 		MapView.addLayerChangeListener(this);
-		//plugin informations are provided by build.xml properties
-	}
-		
-	
-	//only used with GPS layers
+		//further plugin informations are provided by build.xml properties
+	}	
+			
+	//only use with GPS and own layers
 	public void activeLayerChange(Layer oldLayer, Layer newLayer) {
 		if (newLayer instanceof GpxLayer)
 		{
-			VMenu.setEnabled(true);
+			VAdd.setEnabled(true);
 			GPSTrack=((GpxLayer) newLayer).data;			
-			VAction.setGps(GPSTrack);
+			VAdd.setGps(GPSTrack);
 			//TODO append to GPS Layer menu
-			
 		}
-		else VMenu.setEnabled(false);
+		else
+		{
+			VAdd.setEnabled(false);
+			if(newLayer instanceof PositionLayer)
+			{
+				enableControlMenus(true);
+			}
+			else
+			{
+				enableControlMenus(false);
+			}
+		}
 		
 	}
 
 	public void layerAdded(Layer arg0) {
-		activeLayerChange(null,arg0);		
+		activeLayerChange(null,arg0);
 	}
 
 	public void layerRemoved(Layer arg0) {	
+	} //well ok we have a local copy of the GPS track....
+
+	private void addMenuItems() {
+		VAdd= new VideoAddAction(this);
+		VStart = new StartStopAction();
+		VMenu.add(VAdd);
+		enableControlMenus(false);
+		VMenu.add(VStart);
 	}
-
-
-
+	
+	public void setMyLayer(PositionLayer layer)
+	{		
+		VStart.setLayer(layer);
+		enableControlMenus(true);
+	}
+	
+	private void enableControlMenus(boolean enabled)
+	{
+		VStart.setEnabled(enabled);
+	}
   }
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoWindow.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoWindow.java	(revision 21540)
+++ 	(revision )
@@ -1,42 +1,0 @@
-package org.openstreetmap.josm.plugins.videomapping;
-
-import java.awt.BorderLayout;
-import java.awt.Canvas;
-import java.awt.Component;
-import java.awt.GraphicsConfiguration;
-import java.awt.HeadlessException;
-import java.io.File;
-import java.io.IOException;
-
-import javax.swing.JFrame;
-
-import org.openstreetmap.josm.Main;
-
-import uk.co.caprica.vlcj.player.*;
-
-public class VideoWindow extends JFrame {
-
-	private static final long serialVersionUID = 2099614201397118560L;
-
-	public VideoWindow(File vfile) throws HeadlessException {
-		super();
-		MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(null);
-		FullScreenStrategy fullScreenStrategy = new DefaultFullScreenStrategy(this);
-		MediaPlayer mediaPlayer = mediaPlayerFactory.newMediaPlayer(fullScreenStrategy);
-		mediaPlayer.setStandardMediaOptions(null);
-		//mediaPlayer.addMediaPlayerEventListener
-		Canvas videoSurface = new Canvas();		
-		mediaPlayer.setVideoSurface(videoSurface);
-		add(videoSurface);
-		try {
-			mediaPlayer.playMedia(vfile.getCanonicalPath(),null);
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		setVisible(true);		
-		mediaPlayer.release();
-		mediaPlayerFactory.release();
-	}
-
-}
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/actions/StartStopAction.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/actions/StartStopAction.java	(revision 21555)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/actions/StartStopAction.java	(revision 21555)
@@ -0,0 +1,37 @@
+package org.openstreetmap.josm.plugins.videomapping.actions;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+import org.openstreetmap.josm.plugins.videomapping.GpsPlayer;
+import org.openstreetmap.josm.plugins.videomapping.PositionLayer;
+import org.openstreetmap.josm.tools.Shortcut;
+
+import javax.swing.KeyStroke;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.JosmAction;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+public class StartStopAction extends JosmAction {
+	private PositionLayer layer;
+	
+	public StartStopAction() {
+		super("start/pause", "videomapping", "starts/pauses video playback",
+				Shortcut.registerShortcut("videomapping:startstop","",KeyEvent.VK_SPACE, Shortcut.GROUP_MENU), false);
+		setEnabled(false);
+	}
+
+	public void actionPerformed(ActionEvent arg0) {
+		layer.pause();
+
+	}
+
+
+	public void setLayer(PositionLayer layer) {
+		this.layer =layer;
+		
+	}
+
+}
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/actions/VideoAddAction.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/actions/VideoAddAction.java	(revision 21555)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/actions/VideoAddAction.java	(revision 21555)
@@ -0,0 +1,68 @@
+package org.openstreetmap.josm.plugins.videomapping.actions;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+
+import javax.swing.JFileChooser;
+import javax.swing.KeyStroke;
+import javax.swing.filechooser.FileFilter;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.data.gpx.*;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.layer.GpxLayer;
+import org.openstreetmap.josm.plugins.videomapping.PositionLayer;
+import org.openstreetmap.josm.plugins.videomapping.VideoMappingPlugin;
+import org.openstreetmap.josm.tools.DateUtils;
+import org.openstreetmap.josm.tools.Shortcut;
+import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
+import static org.openstreetmap.josm.tools.I18n.*;
+
+public class VideoAddAction extends JosmAction {
+	private VideoMappingPlugin plugin;
+	private GpxData gps;
+	private DataSet ds; //all extracted GPS points
+	private List<WayPoint> ls;
+
+	public VideoAddAction(VideoMappingPlugin plugin) {
+		super("Sync Video","videomapping","Sync a video against this GPS track",null,true);
+		this.plugin=plugin;
+	}
+
+	// Choose a file
+	public void actionPerformed(ActionEvent arg0) {
+		
+		copyGPSLayer();
+		PositionLayer l = new PositionLayer("test",ls);
+		Main.main.addLayer(l);
+		plugin.setMyLayer(l);
+
+	}
+		
+	
+	public void setGps(GpxData gps) {
+		this.gps = gps;
+	}
+	
+	//makes a local flat copy for interaction
+	private void copyGPSLayer()
+	{ 
+		ls = new LinkedList<WayPoint>();
+        for (GpxTrack trk : gps.tracks) {
+            for (GpxTrackSegment segment : trk.getSegments()) {
+                ls.addAll(segment.getWayPoints());
+            }
+        }
+        Collections.sort(ls); //sort basing upon time
+	}
+
+}
+
+
