Merge
authorsarias
Thu, 17 Sep 2009 18:44:33 +0200
changeset 76 5af0f0a8706d
parent 73 bda95242e600 (current diff)
parent 75 99d003723474 (diff)
child 77 e95e916eb018
Merge
src/FingersDance/FingersDance.csproj
--- a/src/FingersDance.ActionFactory/ActionGenerator.cs	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.ActionFactory/ActionGenerator.cs	Thu Sep 17 18:44:33 2009 +0200
@@ -15,12 +15,21 @@
             actionDict.Add("ActionPlayMedia", typeof(FingersDance.Actions.ActionPlayMedia));
             actionDict.Add("ActionShowMessage", typeof(FingersDance.Actions.ActionShowMessage));
             actionDict.Add("ActionOpenMedia", typeof(FingersDance.Actions.ActionOpenMedia));
-            actionDict.Add("ActionStopMedia", typeof(FingersDance.Actions.ActionStopMedia));            
+            actionDict.Add("ActionStopMedia", typeof(FingersDance.Actions.ActionStopMedia));
+
+            actionDict.Add("ActionAddAnnotation", typeof(FingersDance.Actions.ActionAddAnnotation));
         }
 
-        public ActionBase GetAction(string T, object Args)
+        public ActionBase GetAction(String T, Object Args)
         {
-            return (ActionBase)Activator.CreateInstance(actionDict[T]);
+
+            try
+            {
+                ActionBase ab = (ActionBase)Activator.CreateInstance(actionDict[T], Args);
+                return ab;
+            }
+            catch (Exception ex) { }
+            return null;
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Actions/ActionAddAnnotation.cs	Thu Sep 17 18:44:33 2009 +0200
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using FingersDance.Control.TimeLine;
+
+namespace FingersDance.Actions
+{
+    public class ActionAddAnnotation : FingersDance.Actions.ActionBase
+    {
+        private string _Text = "";
+        private UserControlTimeLine myTimeline;
+
+        public ActionAddAnnotation()
+        {
+            
+        }
+
+        public ActionAddAnnotation(string text)
+        {
+            _Text = text;
+        }
+
+        public ActionAddAnnotation(UserControlTimeLine uct)
+        {
+            myTimeline = uct;
+        }
+
+        public void Execute()
+        {
+            if (myTimeline != null)
+                myTimeline.addAnnotation();
+        }
+    }
+}
--- a/src/FingersDance.Actions/FingersDance.Actions.csproj	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Actions/FingersDance.Actions.csproj	Thu Sep 17 18:44:33 2009 +0200
@@ -60,6 +60,7 @@
     <Reference Include="Microsoft.Surface.Presentation.Generic" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ActionAddAnnotation.cs" />
     <Compile Include="ActionBase.cs" />
     <Compile Include="ActionOpenMedia.cs" />
     <Compile Include="ActionPlayMedia.cs" />
@@ -98,5 +99,11 @@
   <ItemGroup>
     <Resource Include="Resources\WindowBackground.jpg" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FingersDance.Control.TimeLine\FingersDance.Control.TimeLine.csproj">
+      <Project>{2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}</Project>
+      <Name>FingersDance.Control.TimeLine</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj	Thu Sep 17 18:44:33 2009 +0200
@@ -142,6 +142,21 @@
       <Project>{1E80D5A1-C45C-443B-8992-4A4D78D280FC}</Project>
       <Name>FingersDance.Actions</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Control.SyncSource\FingersDance.Control.SyncSource.csproj">
+      <Project>{BE5AD2E7-8BC2-414A-AB92-34E4D7357740}</Project>
+      <Name>FingersDance.Control.SyncSource</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Control.TimeLine\FingersDance.Control.TimeLine.csproj">
+      <Project>{2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}</Project>
+      <Name>FingersDance.Control.TimeLine</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Control\FingersDance.Control.csproj">
+      <Project>{4DC517DD-1601-481E-BAAC-6FE271417F46}</Project>
+      <Name>FingersDance.Control</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs	Thu Sep 17 18:44:33 2009 +0200
@@ -12,6 +12,11 @@
 using System.Xml.Serialization;
 using System.Reflection;
 
+using FingersDance.ActionFactory;
+using FingersDance.Actions;
+using FingersDance.Control.SyncSource;
+using FingersDance.Control.TimeLine;
+
 namespace FingersDance.Control.Menu
 {
 	public partial class UserControlMenu
@@ -19,9 +24,9 @@
 		public UserControlMenu()
 		{
 			this.InitializeComponent();
+
+            // Insert code required on object creation below this point.
             initChildSize();
-
-			// Insert code required on object creation below this point.
 		}
 
         //Premet de deplacer les sous menus vers la droite pour avoir un effect tree view
@@ -75,6 +80,8 @@
                  }
                  else
                  {
+                     ItemButton.ContactDown += ActionButton_ContactDown;
+                     ItemButton.Click += ActionButton_ContactDown;
                      ItemButton.Action = item.Action;
                      MItem.Children.Add(ItemButton);
                  }
@@ -86,9 +93,29 @@
              }
          }
 
+         void ActionButton_ContactDown(object sender, RoutedEventArgs e)
+         {
+             // 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[0]).Children[0];
+             // and finally the timeline
+             UserControlTimeLine tl = syncSrc.userControlTimeLine;
+
+             String actionId = ((CustomSurfaceButton)sender).Action;
+             ActionGenerator ag = new ActionGenerator();
+             ActionBase ab = ag.GetAction(actionId, tl);
+             if(ab!=null)
+                 ab.Execute();
+         }
+
          private void ButtonMenu_ContactDown(object sender, RoutedEventArgs e)
          {
              foreach (UIElement Child in ((Panel)((CustomSurfaceButton)sender).Parent).Children)
+             {
                  try
                  {
                      if (((StackPanel)Child).Name.Equals(((Microsoft.Surface.Presentation.Controls.SurfaceButton)sender).Content.ToString().Replace(' ', '_') + "Panel"))
@@ -105,6 +132,7 @@
                      }
                  }
                  catch (Exception ex) { }
+             }
          }
 
         #region Events
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Thu Sep 17 18:44:33 2009 +0200
@@ -59,7 +59,7 @@
             //DirectoryInfo info = Directory.GetParent(@".");
             FileInfo assemblyPath = new FileInfo(Assembly.GetExecutingAssembly().Location);
             DirectoryInfo info = assemblyPath.Directory;
-            MediaElementVideo.Source = new Uri(@"" + info.FullName.ToString() + "\\Resources\\Lake.wmv", UriKind.Relative);
+            MediaElementVideo.Source = new Uri(@"" + info.FullName.ToString() + "\\Resources\\oneflat.wmv", UriKind.Relative);
             MediaElementVideo.LoadedBehavior = MediaState.Manual;
             MediaElementVideo.UnloadedBehavior = MediaState.Manual;
             MediaElementVideo.ScrubbingEnabled= true;
--- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml	Thu Sep 17 18:44:33 2009 +0200
@@ -11,7 +11,7 @@
 
     <Grid x:Name="LayoutRoot" Height="{Binding Path=ActualHeight, ElementName=UserControl, Mode=Default}" Width="{Binding Path=ActualWidth, ElementName=UserControl, Mode=Default}">
         <Grid VerticalAlignment="Top" Height="100" x:Name="GridTimeLine">
-        	<FingersDance_Control_TimeLine:UserControlTimeLine Margin="40,0,8,-50" x:Name="UserControlTimeLine" DragStarted="UserControlTimeLine_DragStarted" DragCompleted="UserControlTimeLine_DragCompleted" TimerTick="UserControlTimeLine_TimerTick" d:LayoutOverrides="Height" Background="{x:Null}" />
+        	<FingersDance_Control_TimeLine:UserControlTimeLine Margin="40,0,8,0" x:Name="UCTimeLine" DragStarted="UserControlTimeLine_DragStarted" DragCompleted="UserControlTimeLine_DragCompleted" TimerTick="UserControlTimeLine_TimerTick" d:LayoutOverrides="Height" Background="{x:Null}" />
         </Grid>
         <Grid HorizontalAlignment="Stretch" Width="Auto" Height="Auto" VerticalAlignment="Stretch" x:Name="GridPlayer" Margin="0,54,0,0">
         	<FingersDance_Control_Player:UserControlPlayer PlayerOpened="UserControlPlayer_PlayerOpened" x:Name="UserControlPlayer" VerticalAlignment="Stretch" d:LayoutOverrides="GridBox" Width="{Binding Path=ActualWidth, ElementName=GridPlayer, Mode=Default}" Margin="0,0,0,0" Height="{Binding Path=ActualHeight, ElementName=GridPlayer, Mode=Default}" />
--- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Thu Sep 17 18:44:33 2009 +0200
@@ -25,11 +25,11 @@
         private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
         {
             //Initialisation du Timer
-            UserControlTimeLine.initTimer();
+            UCTimeLine.initTimer();
             //Initialisation du slider
-            UserControlTimeLine.initslider(UserControlPlayer.TotalMilliseconds);
+            UCTimeLine.initslider(UserControlPlayer.TotalMilliseconds);
             //Demarrage du Timer
-            UserControlTimeLine.timerStart();
+            UCTimeLine.timerStart();
 
         }
         #endregion
@@ -52,22 +52,27 @@
         #region SynSource pour chaque X milliseconds
         private void UserControlTimeLine_TimerTick(object sender, EventArgs e)
         {
-            if (!UserControlTimeLine.IsDragging)
+            if (!UCTimeLine.IsDragging)
             {
-                UserControlTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds;
+                UCTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds;
             }
-            if (UserControlTimeLine.FinishedDragging)
+            if (UCTimeLine.FinishedDragging)
             {
-                int SliderValue = (int)UserControlTimeLine.Slider.Value;
+                int SliderValue = (int)UCTimeLine.Slider.Value;
                 TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
 
                 UserControlPlayer.Player.Position = ts;
                 UserControlPlayer.playerPlay();
 
-                UserControlTimeLine.IsDragging = false;
-                UserControlTimeLine.FinishedDragging = false;
+                UCTimeLine.IsDragging = false;
+                UCTimeLine.FinishedDragging = false;
             }
         }
         #endregion
+
+        public UserControlTimeLine userControlTimeLine
+        {
+            get { return this.UCTimeLine; }
+        }
     }
 }
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml	Thu Sep 17 18:44:33 2009 +0200
@@ -7,10 +7,12 @@
 	x:Class="FingersDance.Control.TimeLine.UserControlTimeLine"
     xmlns:vw="clr-namespace:FingersDance.Views;assembly=FingersDance.Views"
 	x:Name="UserControl"
-	d:DesignWidth="383" xmlns:Custom="http://schemas.microsoft.com/surface/2008" Height="Auto" Background="{x:Null}" d:DesignHeight="33">
+	d:DesignWidth="383" xmlns:Custom="http://schemas.microsoft.com/surface/2008" Background="{x:Null}" d:DesignHeight="33">
 
 	<Grid x:Name="LayoutRoot" Width="Auto" Height="Auto" Background="{x:Null}">
-		<Custom:SurfaceSlider  Height="Auto" x:Name="slider" Value="0.5" Width="Auto" Thumb.DragStarted="sliderPosition_DragStarted" Thumb.DragCompleted="sliderPosition_DragCompleted" Margin="0,0,30,0" Background="#19FFFFFF" />
-        <vw:TimelineView x:Name="tv" Height="130"/>
+		<Custom:SurfaceSlider  Height="Auto" x:Name="slider" Value="0.5" Width="Auto" 
+                               Thumb.DragStarted="sliderPosition_DragStarted" Thumb.DragCompleted="sliderPosition_DragCompleted" ContactTapGesture="slider_ContactTapGesture"
+                               Margin="0,0,30,0" Background="#19FFFFFF" />
+        <vw:TimelineView x:Name="tv" Margin="0,30,0,0"/>
     </Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Thu Sep 17 18:44:33 2009 +0200
@@ -30,6 +30,11 @@
         public event EventHandler DragCompleted;
         public event EventHandler TimerTick;
 
+        private List<Annotation> annotList = new List<Annotation>();
+        private float annotWidth = 40;
+        private CuttingViewModel cutvm;
+        private int numAnnot = 1;
+
         #region Properties
 
         public SurfaceSlider Slider
@@ -85,7 +90,7 @@
 
         
 		public UserControlTimeLine()
-		{
+		{   
 			this.InitializeComponent();
 
 			// Insert code required on object creation below this point.
@@ -98,15 +103,24 @@
 
 
             // TEMP FOR DATA BINDING
-            List<Annotation> annotList = new List<Annotation>();
+            annotList = new List<Annotation>();
             annotList.Add(new Annotation(0, 10, "Axe Cam 1"));
-            annotList.Add(new Annotation(10, 20, "Mvt Cam 2"));
-            annotList.Add(new Annotation(30, 40, "Saut 3"));
+            annotList.Add(new Annotation(20 - (1 * annotWidth), 30, "Mvt Cam 2"));
+            annotList.Add(new Annotation(50 - (2 * annotWidth), 60, "Saut 3"));
+            annotList.Add(new Annotation(100 - (3 * annotWidth), 20, "Saut 4"));
+            annotList.Add(new Annotation(120 - (4 * annotWidth), 50, "Saut 5"));
             Cutting cut = new Cutting("titre de cutting", annotList);
-            CuttingViewModel cutvm = new CuttingViewModel(cut);
-            tv.DataContext = cut;
+            cutvm = new CuttingViewModel(cut);
+            tv.DataContext = cutvm;
 
-
+            numAnnot = 6;
+            slider_ContactTapGesture(this,null);
+            /*
+            cutvm.AnnotList.Add(new AnnotationViewModel(new Annotation(180 - (5 * annotWidth), 10, "6")));
+            tv.DataContext = null;
+            tv.DataContext = cutvm;
+            numAnnot = 7;
+            */
         }
 
         #region Timer
@@ -172,5 +186,18 @@
                 DragCompleted(this, new EventArgs());
         }
 
+        private void slider_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
+        {
+            addAnnotation();
+        }
+
+        public void addAnnotation()
+        {
+            cutvm.AnnotList.Add(new AnnotationViewModel(new Annotation(180 + (numAnnot - 6) * 20 - ((numAnnot - 1) * annotWidth), 10, numAnnot.ToString())));
+            tv.DataContext = null;
+            tv.DataContext = cutvm;
+            numAnnot++;
+        }
+
 	}
 }
\ No newline at end of file
--- a/src/FingersDance.Views/TimelineAnnotationView.xaml	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Views/TimelineAnnotationView.xaml	Thu Sep 17 18:44:33 2009 +0200
@@ -8,12 +8,14 @@
 	x:Class="FingersDance.Views.TimelineAnnotationView"
     xmlns:vw="clr-namespace:FingersDance.Views"
 	x:Name="UserControl"
-	d:DesignWidth="640" d:DesignHeight="480">
+	d:DesignWidth="640" d:DesignHeight="480" Width="40">
     <UserControl.Resources>
         <vw:ThicknessSingleValueConverter x:Name="myThicknessSingleValueConverter" x:Key="myThicknessSingleValueConverter"></vw:ThicknessSingleValueConverter>
     </UserControl.Resources>
     <Grid x:Name="LayoutRoot" Margin="{Binding Path=TcBegin, Converter={StaticResource myThicknessSingleValueConverter}}">
-        <Rectangle Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="20"/>
-        <TextBox Text="{Binding Path=GestureType}" Width="100" Margin="5,0,0,0"/>
+        <Ellipse Fill="Green" Margin="-2,-3,0,0" Height="6" VerticalAlignment="Top" HorizontalAlignment="Left" Width="6" />
+        <Rectangle Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Width="2" Height="20"/>
+        <Rectangle Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding Path=Dur}" Height="2" Margin="0,18,0,0"/>
+        <TextBox HorizontalAlignment="Left" Text="{Binding Path=GestureType}" Width="40" Margin="0,20,0,0"/>
     </Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Views/TimelineAnnotationView.xaml.cs	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Views/TimelineAnnotationView.xaml.cs	Thu Sep 17 18:44:33 2009 +0200
@@ -31,7 +31,8 @@
         {
             ThicknessConverter myThicknessConverter = new ThicknessConverter();
             Thickness th1 = (Thickness)myThicknessConverter.ConvertFrom(value);
-            th1.Top = th1.Top;
+            th1.Top = 0;
+            th1.Bottom = th1.Right = 0;
             return th1;
         }
         public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture)
--- a/src/FingersDance.Views/TimelineView.xaml	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance.Views/TimelineView.xaml	Thu Sep 17 18:44:33 2009 +0200
@@ -2,13 +2,10 @@
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:vw="clr-namespace:FingersDance.Views"
-    Height="300" Width="300">
+    >
     <Grid>
-        <TextBlock Text="{Binding Path=Title}" Height="27" VerticalAlignment="Top" Margin="0,0,132,0" />
-        
-        <ListView Margin="0,25,0,0" 
-                  DataContext="{Binding Path=AnnotList}"
-                  ItemsSource="{Binding}" >
+        <ListView DataContext="{Binding Path=AnnotList}"
+                  ItemsSource="{Binding}" Background="Black" BorderThickness="0" >
 
             <ListView.ItemTemplate>
                 <DataTemplate>
@@ -36,5 +33,6 @@
                 </GridView>
             </ListView.View-->
         </ListView>
+        <!--TextBlock Text="{Binding Path=Title}" Height="27" VerticalAlignment="Top" Margin="0,0,0,0" /-->
     </Grid>
 </UserControl>
--- a/src/FingersDance/FingersDance.csproj	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance/FingersDance.csproj	Thu Sep 17 18:44:33 2009 +0200
@@ -128,6 +128,9 @@
     <Content Include="Resources\Lake.wmv">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
+    <Content Include="Resources\oneflat.wmv">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <Resource Include="FingersDance.xml" />
   </ItemGroup>
   <ItemGroup>
--- a/src/FingersDance/Resources/menu.xml	Thu Sep 17 12:53:22 2009 +0200
+++ b/src/FingersDance/Resources/menu.xml	Thu Sep 17 18:44:33 2009 +0200
@@ -65,16 +65,16 @@
 					<Name>Choregraphique</Name>
 					<Items>
 						<Item>
-							<Name>ChildChore1</Name>
+							<Name>Saut 1</Name>
 							<Items/>
 							<Ressource>FingersDanceAnnotationButtonNiveau3</Ressource>
-							<Action>ChildChore1</Action>
+							<Action>ActionAddAnnotation</Action>
 						</Item>
 						<Item>
-							<Name>ChildChore2</Name>
+							<Name>Pirouette 2</Name>
 							<Items/>
 							<Ressource>FingersDanceAnnotationButtonNiveau3</Ressource>
-							<Action>ChildChore2</Action>
+							<Action>ActionAddAnnotation</Action>
 						</Item>
 					</Items>
 					<Ressource>FingersDanceAnnotationButtonNiveau2</Ressource>