# HG changeset patch # User cavaliet # Date 1253896138 -7200 # Node ID 14b058fc64fc11db1f7dd1fbaa2f532350854fec # Parent 8af72b302e0a27ad82ab6cce6e7d8c1be50c15ca Modify TimelineView's scale on resize event diff -r 8af72b302e0a -r 14b058fc64fc src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml --- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml Fri Sep 25 03:38:22 2009 +0200 +++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml Fri Sep 25 18:28:58 2009 +0200 @@ -11,7 +11,7 @@ - + diff -r 8af72b302e0a -r 14b058fc64fc src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Fri Sep 25 03:38:22 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Fri Sep 25 18:28:58 2009 +0200 @@ -30,10 +30,11 @@ public event EventHandler DragCompleted; public event EventHandler TimerTick; + private double totalmilliseconds; + private List annotList = new List(); - private float annotWidth = 40; + private float annotWidth = 40+1; private CuttingViewModel cutvm; - private int numAnnot = 1; #region Properties @@ -97,32 +98,42 @@ } - public void initslider(double totalmilliseconds) + public void initslider(double totalmillisecondsPar) { + totalmilliseconds = totalmillisecondsPar; slider.Maximum = totalmilliseconds; - + // When the timeline is resized, we catch the resize event to define TimelineView's good scale + this.SizeChanged += new SizeChangedEventHandler(UserControlTimeLine_SizeChanged); // TEMP FOR DATA BINDING annotList = new List(); annotList.Add(new Annotation(0, 10, "Axe Cam 1")); - 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")); + //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); 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; */ } + void UserControlTimeLine_SizeChanged(object sender, SizeChangedEventArgs e) + { + // When scaleX = 1, 1 second = 1 pixel. To calculate the new scale, we take the real width in account. + Double futurScale = this.ActualWidth / (totalmilliseconds / 1000); + //Double futurScale = this.ActualWidth / ((totalmilliseconds<30000) ? (totalmilliseconds/10) : (totalmilliseconds / 1000)); // TEMP + tv.RenderTransform = new ScaleTransform(futurScale,1); + Console.WriteLine("futurScale = " + futurScale); + + } + #region Timer public void initTimer() { @@ -193,10 +204,14 @@ 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++; + if (cutvm!=null) + { + float currentTimecode = (float)slider.Value / 1000; + cutvm.AnnotList.Add(new AnnotationViewModel(new Annotation(currentTimecode - (cutvm.AnnotList.Count * annotWidth), 10, cutvm.AnnotList.Count.ToString()))); + Console.WriteLine("currentTimecode = " + currentTimecode + ", nb = " + cutvm.AnnotList.Count + ", res = " + (currentTimecode - (cutvm.AnnotList.Count * annotWidth))); + tv.DataContext = null; + tv.DataContext = cutvm; + } } } diff -r 8af72b302e0a -r 14b058fc64fc src/FingersDance.Views/TimelineView.xaml --- a/src/FingersDance.Views/TimelineView.xaml Fri Sep 25 03:38:22 2009 +0200 +++ b/src/FingersDance.Views/TimelineView.xaml Fri Sep 25 18:28:58 2009 +0200 @@ -5,7 +5,7 @@ > + ItemsSource="{Binding}" Background="{x:Null}" BorderThickness="0" x:Name="listview" ScrollViewer.HorizontalScrollBarVisibility="Hidden"> diff -r 8af72b302e0a -r 14b058fc64fc src/FingersDance/FingersDance.csproj --- a/src/FingersDance/FingersDance.csproj Fri Sep 25 03:38:22 2009 +0200 +++ b/src/FingersDance/FingersDance.csproj Fri Sep 25 18:28:58 2009 +0200 @@ -134,6 +134,8 @@ Always + + Always diff -r 8af72b302e0a -r 14b058fc64fc src/FingersDance/Resources/oneflat.png Binary file src/FingersDance/Resources/oneflat.png has changed diff -r 8af72b302e0a -r 14b058fc64fc src/FingersDance/Resources/videos.xml --- a/src/FingersDance/Resources/videos.xml Fri Sep 25 03:38:22 2009 +0200 +++ b/src/FingersDance/Resources/videos.xml Fri Sep 25 18:28:58 2009 +0200 @@ -2,12 +2,17 @@ Butterfly - C:\Users\Piaf\Desktop\Développement\IRI\src\FingersDance\bin\Debug\Resources\Butterfly.wmv - C:\Users\Piaf\Desktop\Développement\IRI\src\FingersDance\bin\Debug\Resources\Butterfly.jpg + C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Butterfly.wmv + C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Butterfly.jpg Lake - C:\Users\Piaf\Desktop\Développement\IRI\src\FingersDance\bin\Debug\Resources\Lake.wmv - C:\Users\Piaf\Desktop\Développement\IRI\src\FingersDance\bin\Debug\Resources\Lake.jpg + C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Lake.wmv + C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Lake.jpg + + + One Flat Thing + C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\oneflat.wmv + C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\oneflat.png \ No newline at end of file