# HG changeset patch
# User cavaliet
# Date 1258733692 -3600
# Node ID 45d2dff788f2466c95ec269b61f2b3cf724406c8
# Parent d13dbcf861d74021ce0d139ae774c1d15a9feecb
almost last step of search : menu is active and we listen to the recognised event from the player.
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance.Actions/ActionSearchAnnotation.cs
--- a/src/FingersDance.Actions/ActionSearchAnnotation.cs Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance.Actions/ActionSearchAnnotation.cs Fri Nov 20 17:14:52 2009 +0100
@@ -2,29 +2,51 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.IO;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Navigation;
+using System.Windows.Controls.Primitives;
+
+using FingersDance.Control.TimeLine;
+
namespace FingersDance.Actions
{
public class ActionSearchAnnotation : FingersDance.Actions.ActionBase
{
-
-
+ UserControlTimeLine myTimeline;
+ String GestureId;
public ActionSearchAnnotation()
{
-
+
}
public ActionSearchAnnotation(Object[] param)
{
- //myTimeline = (UserControlTimeLine)args[0];
- //myAnnotationViewModel = (AnnotationViewModel)args[1];
+ // The context param[0] is the userPanel, so we have to get the timeline's instance.
+ UserControl userPanel = (UserControl)param[0];
+ // Its content...
+ Grid o = (Grid)userPanel.Content;
+ // and the UserControlSyncSource within the grid...
+ UserControl syncSrc = (UserControl)((Grid)o.Children[1]).Children[0];
+ // and finally the timeline
+ myTimeline = (UserControlTimeLine)((Grid)((Grid)syncSrc.Content).Children[0]).Children[0];
+
+ GestureId = (String)param[1];
}
public void Execute()
{
- //if (myTimeline != null)
- // myTimeline.addAnnotation(myAnnotationViewModel);
+ Console.WriteLine("ActionSearchAnnotation Execute " + GestureId);
+ if (myTimeline != null)
+ myTimeline.sendNewGesture(GestureId);
}
}
}
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance.Control.SessionInput/UserControlAnnotationOrSearch.xaml.cs
--- a/src/FingersDance.Control.SessionInput/UserControlAnnotationOrSearch.xaml.cs Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance.Control.SessionInput/UserControlAnnotationOrSearch.xaml.cs Fri Nov 20 17:14:52 2009 +0100
@@ -66,6 +66,5 @@
ChosenMode = chosenMode;
}
-
}
}
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj
--- a/src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj Fri Nov 20 17:14:52 2009 +0100
@@ -152,6 +152,10 @@
{99A9037F-5431-44DD-BCE9-ED60670DEBC1}
GestureControl
+
+ {E81BB080-0598-43AC-90CE-54D6570C4E9E}
+ FingersDance.ViewModels
+
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
--- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs Fri Nov 20 17:14:52 2009 +0100
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Windows;
@@ -7,8 +8,10 @@
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
+
using FingersDance.Control.TimeLine;
using FingersDance.Data;
+using FingersDance.ViewModels;
using FingersDance.Factory;
using GestureControl;
@@ -17,7 +20,10 @@
public partial class UserControlSyncSource
{
#region Variables
- public event EventHandler OnSuccessAnnotation;
+ public event EventHandler OnSuccessAnnotation;
+
+ private String AnnotationOrSearchMode;
+ private Project searchedProject;
#endregion
public UserControlSyncSource()
@@ -27,17 +33,20 @@
// Insert code required on object creation below this point.
}
- public void Load(string path, Color col, Cutting cut)
+ public void Load(string path, Color col, Cutting cut, String AnnotOrSearchMode, Project searchedProj)
{
this.UserControlPlayer.initPlayer(path);
+ AnnotationOrSearchMode = AnnotOrSearchMode;
+ searchedProject = searchedProj;
//Initialisation du Timer
UCTimeLine.initTimer(col, cut);
- this.UserControlPlayer.playerPlay();
- this.userControlTimeLine.OnSuccessAnnotation += new EventHandler(userControlTimeLine_OnSuccessAnnotation);
- this.userControlTimeLine.AnnotationAdded += new EventHandler(userControlTimeLine_AnnotationAdded);
- this.userControlTimeLine.AnnotationRemoved += new EventHandler(userControlTimeLine_AnnotationRemoved);
- this.UserControlPlayer.PlayerStopOrPause += new EventHandler(UserControlPlayer_PlayerStopOrPause);
- UserControlPlayer.NewGestureRegognized += new EventHandler(UCTimeLine.UserControlPlayer_NewGestureRegognized);
+ UserControlPlayer.playerPlay();
+ userControlTimeLine.OnSuccessAnnotation += new EventHandler(userControlTimeLine_OnSuccessAnnotation);
+ userControlTimeLine.AnnotationAdded += new EventHandler(userControlTimeLine_AnnotationAdded);
+ userControlTimeLine.AnnotationRemoved += new EventHandler(userControlTimeLine_AnnotationRemoved);
+ UserControlPlayer.PlayerStopOrPause += new EventHandler(UserControlPlayer_PlayerStopOrPause);
+ UserControlPlayer.NewGestureRegognized += new EventHandler(UserControlPlayer_NewGestureRegognized);
+ UCTimeLine.NewGestureRecognized += new EventHandler(UCTimeLine_NewGestureRecognized);
}
void userControlTimeLine_AnnotationRemoved(object sender, EventArgs e)
@@ -151,5 +160,68 @@
{
UserControlPlayer.playerPause();
}
+
+
+ public void UserControlPlayer_NewGestureRegognized(object sender, EventArgs e)
+ {
+ try
+ {
+ GestureEventArg grea = (GestureEventArg)e;
+ //Console.WriteLine("Timeline NewGestureRegognized " + grea.Gesture.Name + ", " + grea.Gesture.Start + ", " + grea.Gesture.End);
+ if (AnnotationOrSearchMode == "Annotation")
+ {
+ // If the stroke has been drawed very fast, end and start can be the same, so we add a little length.
+ float dur = (float)(grea.End - grea.Start);
+ if (dur == 0) dur = (float)0.5;
+ foreach (Gesture elt in grea.Gestures)
+ UCTimeLine.addAnnotation((float)grea.Start, dur, elt.Name);
+ }
+ else
+ {
+ // We are in search mode. So we have to get all the searchedProject's annotation which have the wanted gesture
+ List searchedAnnot = new List();
+ foreach(Cutting cut in searchedProject.Cuttings)
+ {
+ foreach (Annotation annot in cut.AnnotList)
+ {
+ foreach(Gesture gest in grea.Gestures)
+ if (annot.GestureType == gest.Name)
+ {
+ // One of the gesture is enough for the annotation to be added
+ searchedAnnot.Add(annot);
+ break;
+ }
+ }
+ }
+ // The list was built. If the number of found annotations is >0, we send the list to the timeline
+ UCTimeLine.updateAnnotationList(searchedAnnot);
+ }
+ }
+ catch { }
+ }
+
+ public void searchAnnotations(String gestureName)
+ {
+ // We are in search mode. So we have to get all the searchedProject's annotation which have the wanted gesture
+ List searchedAnnot = new List();
+ foreach (Cutting cut in searchedProject.Cuttings)
+ {
+ foreach (Annotation annot in cut.AnnotList)
+ {
+ if (annot.GestureType == gestureName)
+ {
+ // One of the gesture is enough for the annotation to be added
+ searchedAnnot.Add(annot);
+ }
+ }
+ }
+ // The list was built. If the number of found annotations is >0, we send the list to the timeline
+ UCTimeLine.updateAnnotationList(searchedAnnot);
+ }
+
+ void UCTimeLine_NewGestureRecognized(object sender, NewGestureRecognizedEventArg e)
+ {
+ searchAnnotations(e.GestureName);
+ }
}
}
\ No newline at end of file
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Fri Nov 20 17:14:52 2009 +0100
@@ -36,6 +36,7 @@
public event EventHandler TimerTick;
public event EventHandler AnnotationAdded;
public event EventHandler AnnotationRemoved;
+ public event EventHandler NewGestureRecognized;
//SAR
public event EventHandler OnSuccessAnnotation;
//ENDSAR
@@ -301,6 +302,11 @@
}
+ public void addAnnotation(float start, float dur, String gestureType)
+ {
+ addAnnotation(new AnnotationViewModel(new Annotation("temp", start, dur, gestureType, CurrentColor), 0));
+ }
+
public void startOrEndAnnotation(String gestureType)
{
Boolean annotOk = true;
@@ -361,22 +367,6 @@
}
}
-
- public void UserControlPlayer_NewGestureRegognized(object sender, EventArgs e)
- {
- try
- {
- GestureEventArg grea = (GestureEventArg)e;
- //Console.WriteLine("Timeline NewGestureRegognized " + grea.Gesture.Name + ", " + grea.Gesture.Start + ", " + grea.Gesture.End);
- // If the stroke has been drawed very fast, end and start can be the same, so we add a little length.
- float dur = (float)(grea.End - grea.Start);
- if (dur == 0) dur = (float)0.5;
- foreach(Gesture elt in grea.Gestures)
- addAnnotation(new AnnotationViewModel(new Annotation("temp", (float)grea.Start, (float)(grea.End - grea.Start), elt.Name, CurrentColor), 0));
- }
- catch { }
- }
-
private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
{
FrameworkElement findSource = e.OriginalSource as FrameworkElement;
@@ -485,6 +475,42 @@
canceledAnnotationVM = null;
}
+ //
+ // Is search mode, function of the search gesture, we have to be able to update frequently the current list of annotation
+ //
+ public void updateAnnotationList(List la)
+ {
+ tv.DataContext = new CuttingViewModel(new Cutting("temp", "search", la), AnnotWidth, tv.ScaleX);
+ }
+
+ //
+ // Is search mode, we need the timeline to send the NewGestureEvent
+ //
+ public void sendNewGesture(String gestureName)
+ {
+ NewGestureRecognized(this, new NewGestureRecognizedEventArg(gestureName));
+ }
+
}
+
+
+ ///
+ /// AnnotationOrSearchEventArg
+ ///
+ public class NewGestureRecognizedEventArg : EventArgs
+ {
+ public String GestureName
+ {
+ get;
+ set;
+ }
+
+ public NewGestureRecognizedEventArg(String gestureName)
+ {
+
+ GestureName = gestureName;
+
+ }
+ }
}
\ No newline at end of file
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Fri Nov 20 17:14:52 2009 +0100
@@ -27,7 +27,6 @@
public int id = 0;
public uint idcolor = 0; //The color of the Pivot Button
private Cutting cut;
- private Project searchedProject;
//variables for TagSound Control
double baseOrientation = 0;
@@ -60,9 +59,8 @@
this.InitializeComponent();
id = idPar;
cut = cutPar;
- searchedProject = searchedProj;
// We make the syncsrc load the good video and cutting
- this.UserControlSyncSource.Load(path, col, cut);
+ this.UserControlSyncSource.Load(path, col, cut, AnnotationOrSearchMode, searchedProj);
UserControlSyncSource.OnSuccessAnnotation += new EventHandler(UserControlSyncSource_OnSuccessAnnotation);
// We make the menu load the good xml
UCMenu.MenuXmlFile = (AnnotationOrSearchMode == "Search") ? "menu_search.xml" : "menu.xml";
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance/FingersDance.csproj
--- a/src/FingersDance/FingersDance.csproj Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance/FingersDance.csproj Fri Nov 20 17:14:52 2009 +0100
@@ -143,9 +143,9 @@
Always
-
+
Always
-
+
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance/Resources/menu.xml
--- a/src/FingersDance/Resources/menu.xml Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance/Resources/menu.xml Fri Nov 20 17:14:52 2009 +0100
@@ -1,254 +1,128 @@
-
+
\ No newline at end of file
diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance/Resources/menu_search.xml
--- a/src/FingersDance/Resources/menu_search.xml Thu Nov 19 18:05:52 2009 +0100
+++ b/src/FingersDance/Resources/menu_search.xml Fri Nov 20 17:14:52 2009 +0100
@@ -22,7 +22,7 @@
-
3 DANSEURS
- 1 danceur
+ FingersDanceAnnotationButtonNiveau4
ActionSearchAnnotation
-