# HG changeset patch # User cavaliet # Date 1258652246 -3600 # Node ID beebae32b1edf9be2d80afba8d1f04768b7e2027 # Parent 110067a19ec82880207a451b6145af303ea4e685 third step of search : better integration of search panel and debug from loaded search project and annotated project. diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance.ActionFactory/ActionGenerator.cs --- a/src/FingersDance.ActionFactory/ActionGenerator.cs Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance.ActionFactory/ActionGenerator.cs Thu Nov 19 18:37:26 2009 +0100 @@ -19,6 +19,7 @@ actionDict.Add("ActionStartOrEndAnnotation", typeof(FingersDance.Actions.ActionStartOrEndAnnotation)); actionDict.Add("ActionAddAnnotation", typeof(FingersDance.Actions.ActionAddAnnotation)); + actionDict.Add("ActionSearchAnnotation", typeof(FingersDance.Actions.ActionSearchAnnotation)); } public ActionBase GetAction(String T, Object Args) diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance.Actions/ActionSearchAnnotation.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Actions/ActionSearchAnnotation.cs Thu Nov 19 18:37:26 2009 +0100 @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FingersDance.Actions +{ + public class ActionSearchAnnotation : FingersDance.Actions.ActionBase + { + + + + public ActionSearchAnnotation() + { + + } + + public ActionSearchAnnotation(Object[] param) + { + //myTimeline = (UserControlTimeLine)args[0]; + //myAnnotationViewModel = (AnnotationViewModel)args[1]; + } + + public void Execute() + { + //if (myTimeline != null) + // myTimeline.addAnnotation(myAnnotationViewModel); + } + } +} diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance.Actions/ActionStartOrEndAnnotation.cs --- a/src/FingersDance.Actions/ActionStartOrEndAnnotation.cs Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance.Actions/ActionStartOrEndAnnotation.cs Thu Nov 19 18:37:26 2009 +0100 @@ -2,6 +2,16 @@ 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; @@ -25,7 +35,15 @@ public ActionStartOrEndAnnotation(Object[] param) { - myTimeline = (UserControlTimeLine)param[0]; + // 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]; + _Text = (String)param[1]; } diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance.Actions/FingersDance.Actions.csproj --- a/src/FingersDance.Actions/FingersDance.Actions.csproj Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance.Actions/FingersDance.Actions.csproj Thu Nov 19 18:37:26 2009 +0100 @@ -81,6 +81,7 @@ + diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance.Control.Menu/UserControlMenu.xaml.cs --- a/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Thu Nov 19 18:37:26 2009 +0100 @@ -116,17 +116,11 @@ // Generate action // We get the instance of the user panel UserControl userPanel = (UserControl)((Grid)((Grid)this.Parent).Parent).Parent; - // Its content... - Grid o = (Grid)userPanel.Content; - // and the UserControlSyncSource within the grid... - UserControlSyncSource syncSrc = (UserControlSyncSource)((Grid)o.Children[1]).Children[0]; - // and finally the timeline - UserControlTimeLine tl = syncSrc.userControlTimeLine; String actionId = ((CustomSurfaceButton)sender).Action; ActionGenerator ag = new ActionGenerator(); Object[] ar = new Object[2]; - ar[0] = tl; + ar[0] = userPanel; ar[1] = (String)((CustomSurfaceButton)sender).Content; ActionBase ab = ag.GetAction(actionId, ar); if(ab!=null) diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance.Control.Screen/UserControlScreen.xaml.cs --- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Thu Nov 19 18:37:26 2009 +0100 @@ -23,6 +23,7 @@ public event EventHandler UC_Screen_NewCutting; private MainViewModel _mainViewModel; public String AnnotationOrSearchMode; + public Project SearchedProject; public Cutting Cutting; private String videoName; @@ -49,7 +50,7 @@ ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(ListVideo_EH_ItemVideo_ContactDown); } else - OpenProject(); + GetAnnotationOrSearchMode(); } catch (Exception) { @@ -76,6 +77,8 @@ // 1- renseigner la video choisie au screen et créer un nouveau projet à partir de ce chemin vidéo videoName = ((UserControlListVideo)sender).VideoName; videoPath = ((UserControlListVideo)sender).path; + // We initialize it in _mainViewModel for it to remembered in every place of the application + _mainViewModel.Project.VideoPath = videoPath; // 2-Supression du UC List Video LayoutRoot.Children.Remove((UserControlListVideo)sender); // 3 - Choose between Annotation Or Search Mode @@ -103,16 +106,17 @@ LayoutRoot.Children.Remove((UserControlAnnotationOrSearch)sender); // We show the project list and send the chosen mode AnnotationOrSearchMode = e.ChosenMode; - OpenProjectList(); + if (AnnotationOrSearchMode == "Annotation" && _mainViewModel.Project.Cuttings.Count!=0) + OpenProject(); + else + OpenProjectList(); + } private void OpenProjectList() { try { - // First We create the project if we are in annotation mode - if(AnnotationOrSearchMode=="Annotation") - _mainViewModel.CreateProject(videoName, videoPath); // We get all the ldt/project files from the current directory... List existingProjects = new List(); foreach (String filename in Directory.GetFiles("./")) @@ -151,7 +155,7 @@ // ((UserControlListProject)sender).SelectedItem is the name of the selected project // Now we load the xml/ldt file to load all its datas (cuttings, annotations...) XDocument loadedLdt = XDocument.Load(((UserControlListProject)sender).SelectedItem + ".ldt"); - Project loadedProject = new Project(videoName, videoPath); + Project loadedProject = new Project(videoName, _mainViewModel.Project.VideoPath); // we use this video in the case an other panel was in search mode before annotation mode loadedProject.Name = loadedLdt.Root.Element("project").Attribute("title").Value; loadedProject.Description = loadedLdt.Root.Element("project").Attribute("abstract").Value; loadedProject.Cuttings = new List(); @@ -174,8 +178,11 @@ } loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value,cuttingNode.Element("title").Value,la)); } - // We define the loaded project as the current session's project. - _mainViewModel.Project = new ProjectViewModel(loadedProject); + // We define the loaded project as the current session's project in annotation mode or the searched project in search mode + if (AnnotationOrSearchMode == "Annotation") + _mainViewModel.Project = new ProjectViewModel(loadedProject); + else + SearchedProject = loadedProject; OpenProject(); } } @@ -243,7 +250,7 @@ LayoutRoot.Children.Remove((UserControlListCutting)sender); if (((UserControlListCutting)sender).SelectedItem.Equals("New Cutting")) { - // "New Uutting" was was selected -> we display the form + // "New Cutting" was was selected -> we display the form UserControlNewCuttingForm newCutting = new UserControlNewCuttingForm(User); newCutting.Name = "newCutting"; LayoutRoot.Children.Add(newCutting); diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs --- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Thu Nov 19 18:37:26 2009 +0100 @@ -1,17 +1,18 @@ using System; using System.IO; using System.Net; +using System.Reflection; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Navigation; -using FingersDance.Data; +using System.Globalization; using Microsoft.Surface.Presentation; -using System.Globalization; using Microsoft.Surface.Presentation.Controls; -using System.Reflection; + +using FingersDance.Data; using FingersDance.ViewModels; namespace FingersDance.Control.UserPanel @@ -26,6 +27,7 @@ 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; @@ -51,11 +53,12 @@ // Insert code required on object creation below this point. } - public UserControlUserPanel(int idPar, Color col, Cutting cutPar, String path, String AnnotationOrSearchMode) + public UserControlUserPanel(int idPar, Color col, Cutting cutPar, String path, String AnnotationOrSearchMode, Project searchedProj) { this.InitializeComponent(); id = idPar; cut = cutPar; + searchedProject = searchedProj; // We make the syncsrc load the good video and cutting this.UserControlSyncSource.Load(path, col, cut); UserControlSyncSource.OnSuccessAnnotation += new EventHandler(UserControlSyncSource_OnSuccessAnnotation); diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance.ViewModel/MainViewModel.cs --- a/src/FingersDance.ViewModel/MainViewModel.cs Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance.ViewModel/MainViewModel.cs Thu Nov 19 18:37:26 2009 +0100 @@ -13,7 +13,6 @@ #region Attributes public Dictionary Users = new Dictionary(); - //public SessionViewModel Session = new SessionViewModel(); public ProjectViewModel Project = new ProjectViewModel(); #endregion @@ -25,39 +24,6 @@ Project = new ProjectViewModel(new Project(videoName, videoPath)); } - //public Project CreateProject(User u) - //{ - // if (Users.ContainsKey(u.Email)) - // { - // if (Project.CuttingsDict.ContainsKey(u.Email)) - // return Project.CuttingsDict[u.Email]; - // else - // { - // Project p = new Project(u, new Cutting()); - // Session.Projects.Add(u.Email, p); - // return p; - // } - // } - // else - // { - // AddUser(u); - // Project p = new Project(u, new Cutting()); - // Session.Projects.Add(u.Email, p); - // return p; - // } - //} - - //public void CreateSession(string name, string path) - //{ - // Session = new SessionViewModel(new Session(name, path)); - //} - - //public void CloseSession() - //{ - // Session = null; - // Session = new SessionViewModel(); - //} - public void CloseProject() { Project = null; diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance/MainSurfaceWindow.xaml.cs --- a/src/FingersDance/MainSurfaceWindow.xaml.cs Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance/MainSurfaceWindow.xaml.cs Thu Nov 19 18:37:26 2009 +0100 @@ -292,10 +292,6 @@ private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e) { - // Si aucune video n'a été sélectionnée et qu'une grid contient un élément (listvideo), on ne fait rien - if (_mainviewmodel.Project.Name.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2)) - return; - // Traitement du contact down sur le pivot (Création d'un screen ou suppression d'un panel switch ((int)sender) { @@ -417,17 +413,21 @@ if (((UserControlScreen)sender).Cutting != null && ((UserControlScreen)sender).AnnotationOrSearchMode == "Annotation") { if (Panel1 != null) - if (Panel1.Cutting.Title==newCutting.Title) - return; + if (Panel1.Cutting != null) + if (Panel1.Cutting.Title==newCutting.Title) + return; if (Panel2 != null) - if (Panel2.Cutting.Title == newCutting.Title) - return; + if (Panel2.Cutting != null) + if (Panel2.Cutting.Title == newCutting.Title) + return; if (Panel3 != null) - if (Panel3.Cutting.Title == newCutting.Title) - return; + if (Panel3.Cutting != null) + if (Panel3.Cutting.Title == newCutting.Title) + return; if (Panel4 != null) - if (Panel4.Cutting.Title == newCutting.Title) - return; + if (Panel4.Cutting != null) + if (Panel4.Cutting.Title == newCutting.Title) + return; // We add the new cutting to the _mainviewmodel's datas IF THE CUTTING IS NEW (if not it means that it is from a loaded project) if (!_mainviewmodel.Project.CuttingsDict.ContainsKey(newCutting.Title)) @@ -444,7 +444,7 @@ { case 1: UserControlPivot.ApplyColor(1, color); - Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode); + Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject); Panel1.Name = "UserPanel1"; Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); Panel1.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); @@ -454,7 +454,7 @@ break; case 2: UserControlPivot.ApplyColor(2, color); - Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode); + Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject); Panel2.Name = "UserPanel2"; Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); Panel2.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); @@ -464,7 +464,7 @@ break; case 3: UserControlPivot.ApplyColor(3, color); - Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode); + Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject); Panel3.Name = "UserPanel3"; Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); Panel3.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); @@ -474,7 +474,7 @@ break; case 4: UserControlPivot.ApplyColor(4, color); - Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode); + Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject); Panel4.Name = "UserPanel4"; Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); Panel4.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); diff -r 110067a19ec8 -r beebae32b1ed src/FingersDance/Resources/menu_search.xml --- a/src/FingersDance/Resources/menu_search.xml Thu Nov 19 15:35:46 2009 +0100 +++ b/src/FingersDance/Resources/menu_search.xml Thu Nov 19 18:37:26 2009 +0100 @@ -1,251 +1,4 @@ -