# HG changeset patch # User cavaliet # Date 1255532923 -7200 # Node ID 569925b65604416cf883d94fd5f11dd8a00efb50 # Parent df197df887d3679c85a421e4321853b8982ad6ea Annotations are now colored with the same color as the pivot's button diff -r df197df887d3 -r 569925b65604 src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs --- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs Wed Oct 14 17:08:43 2009 +0200 @@ -20,17 +20,17 @@ // Insert code required on object creation below this point. } - public void Load(string path) + public void Load(string path, UInt32 intColor) { this.UserControlPlayer.initPlayer(path); + //Initialisation du Timer + UCTimeLine.initTimer(intColor); this.UserControlPlayer.playerPlay(); } #region player private void UserControlPlayer_PlayerOpened(object sender, EventArgs e) { - //Initialisation du Timer - UCTimeLine.initTimer(); //Initialisation du slider UCTimeLine.initslider(UserControlPlayer.TotalMilliseconds); //Demarrage du Timer diff -r df197df887d3 -r 569925b65604 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Wed Oct 14 17:08:43 2009 +0200 @@ -41,6 +41,7 @@ private CuttingViewModel CuttingVM; private Boolean AnnotWaiting = false; private float AnnotTcBegin; + private UInt32 IntColor; private AnnotationViewModel canceledAnnotationVM; @@ -115,7 +116,7 @@ // TEMP FOR DATA BINDING AnnotList = new List(); - AnnotList.Add(new Annotation(0, 10, "Axe Cam 1")); + AnnotList.Add(new Annotation(0, 10, "Axe Cam 1", IntColor)); //AnnotList.Add(new Annotation(100 - (1 * AnnotWidth), 70, "Mvt Cam 2")); //AnnotList.Add(new Annotation(200 - (2 * AnnotWidth), 50, "Saut 3")); //AnnotList.Add(new Annotation(100 - (3 * AnnotWidth), 20, "Saut 4")); @@ -145,11 +146,13 @@ } #region Timer - public void initTimer() + public void initTimer(UInt32 intColorPar) { timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 0, 0, 100); timer.Tick += new EventHandler(timer_Tick); + + IntColor = intColorPar; } public void timerStart() @@ -267,7 +270,7 @@ // If everything's fine, we create the new one if (annotOk == true) { - AnnotList.Add(new Annotation(avm.TcBegin, avm.Dur, avm.GestureType)); + AnnotList.Add(new Annotation(avm.TcBegin, avm.Dur, avm.GestureType, avm.Color)); CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); tv.DataContext = null; tv.DataContext = CuttingVM; @@ -298,7 +301,7 @@ // if not, we mark the beginning if (annotOk == true) { - AnnotList.Add(new Annotation(AnnotTcBegin, 0, AnnotList.Count.ToString())); + AnnotList.Add(new Annotation(AnnotTcBegin, 0, AnnotList.Count.ToString(), IntColor)); CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); //Console.WriteLine("BEGIN currentTimecode = " + AnnotTcBegin + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth))); tv.DataContext = null; @@ -326,7 +329,7 @@ if (annotOk == true) { AnnotList.RemoveAt(AnnotList.Count - 1); - AnnotList.Add(new Annotation(AnnotTcBegin, currentDuration, AnnotList.Count.ToString())); + AnnotList.Add(new Annotation(AnnotTcBegin, currentDuration, AnnotList.Count.ToString(), IntColor)); CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); //Console.WriteLine("currentTimecode = " + AnnotTcBegin + ", curDur = " + currentDuration + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth))); tv.DataContext = null; diff -r df197df887d3 -r 569925b65604 src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs --- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Wed Oct 14 17:08:43 2009 +0200 @@ -29,11 +29,12 @@ // Insert code required on object creation below this point. } - public UserControlUserPanel(Project p, string path) + public UserControlUserPanel(int idPar, UInt32 intColor, Project p, string path) { this.InitializeComponent(); + id = idPar; _Project = p; - this.UserControlSyncSource.Load(path); + this.UserControlSyncSource.Load(path, intColor); } } } \ No newline at end of file diff -r df197df887d3 -r 569925b65604 src/FingersDance.Data/Annotation.cs --- a/src/FingersDance.Data/Annotation.cs Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance.Data/Annotation.cs Wed Oct 14 17:08:43 2009 +0200 @@ -8,7 +8,7 @@ public class AnnotationAddedEventArg : EventArgs { private float _tcBegin; - private float _dur; + private float _dur; private String _gestureType; public float TcBegin @@ -16,20 +16,21 @@ get { return this._tcBegin; } } public float Dur - { + { get { return this._dur; } - } + } public String GestureType - { + { get { return this._gestureType; } } - public AnnotationAddedEventArg(float tcBegin, float dur, String gestureType) { + public AnnotationAddedEventArg(float tcBegin, float dur, String gestureType) + { this._tcBegin = tcBegin; this._dur = dur; this._gestureType = gestureType; - + } } @@ -39,14 +40,16 @@ private float _tcBegin; private float _dur; private string _gestureType; + private UInt32 _color; //public event EventHandler AnnotationAdded; - public Annotation(float tcBeginPar, float durPar, string gesturePar) + public Annotation(float tcBeginPar, float durPar, string gesturePar, UInt32 colorPar) { this._tcBegin = tcBeginPar; this._dur = durPar; this._gestureType = gesturePar; + this._color = colorPar; //AnnotationAdded(this, new AnnotationAddedEventArg(_tcBegin, _dur, _gestureType)); @@ -82,7 +85,17 @@ _gestureType = value; } } - + public UInt32 Color + { + get { return _color; } + set + { + if (value == _color) + return; + _color = value; + } + } + } } diff -r df197df887d3 -r 569925b65604 src/FingersDance.ViewModel/AnnotationViewModel.cs --- a/src/FingersDance.ViewModel/AnnotationViewModel.cs Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance.ViewModel/AnnotationViewModel.cs Wed Oct 14 17:08:43 2009 +0200 @@ -12,20 +12,24 @@ private float _tcBegin; private float _dur; private String _gestureType; + private UInt32 _color; private float _marginLeft; - public AnnotationViewModel(Annotation a, float marginLeft) { + public AnnotationViewModel(Annotation a, float marginLeft) + { this._tcBegin = a.TcBegin; this._dur = a.Dur; this._gestureType = a.GestureType; + this._color = a.Color; this._marginLeft = marginLeft; } public float TcBegin { get { return _tcBegin; } - set { + set + { if (value == _tcBegin || float.IsNaN(value)) return; _tcBegin = value; @@ -54,6 +58,16 @@ base.OnPropertyChanged("GestureType"); } } + public UInt32 Color + { + get { return _color; } + set + { + if (value == _color) + return; + _color = value; + } + } public float MarginLeft { get { return _marginLeft; } diff -r df197df887d3 -r 569925b65604 src/FingersDance.Views/TimelineAnnotationView.xaml --- a/src/FingersDance.Views/TimelineAnnotationView.xaml Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance.Views/TimelineAnnotationView.xaml Wed Oct 14 17:08:43 2009 +0200 @@ -12,16 +12,17 @@ + - - - - + + + + \ No newline at end of file diff -r df197df887d3 -r 569925b65604 src/FingersDance.Views/TimelineAnnotationView.xaml.cs --- a/src/FingersDance.Views/TimelineAnnotationView.xaml.cs Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance.Views/TimelineAnnotationView.xaml.cs Wed Oct 14 17:08:43 2009 +0200 @@ -47,7 +47,7 @@ { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - Visibility v = ((float)value>0) ? Visibility.Visible : Visibility.Hidden; + Visibility v = ((float)value > 0) ? Visibility.Visible : Visibility.Hidden; return v; } public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture) @@ -55,4 +55,19 @@ return 1.0; } } + + public class ColorConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + UInt32 argb = (UInt32)value; + Color c = Color.FromArgb((Byte)((argb >> 24) & 0xFF), (Byte)((argb >> 16) & 0xFF), (Byte)((argb >> 8) & 0xFF), (Byte)(argb & 0xFF)); + SolidColorBrush scb = new SolidColorBrush(c); + return scb; + } + public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture) + { + return 1.0; + } + } } diff -r df197df887d3 -r 569925b65604 src/FingersDance.Views/TimelineView.xaml.cs --- a/src/FingersDance.Views/TimelineView.xaml.cs Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance.Views/TimelineView.xaml.cs Wed Oct 14 17:08:43 2009 +0200 @@ -23,9 +23,6 @@ public partial class TimelineView : UserControl { - private Boolean hasDragCanceledHandler = false; - - public TimelineView() { InitializeComponent(); diff -r df197df887d3 -r 569925b65604 src/FingersDance/MainSurfaceWindow.xaml.cs --- a/src/FingersDance/MainSurfaceWindow.xaml.cs Wed Oct 14 14:06:04 2009 +0200 +++ b/src/FingersDance/MainSurfaceWindow.xaml.cs Wed Oct 14 17:08:43 2009 +0200 @@ -383,25 +383,25 @@ switch (((UserControlScreen)sender).id) { case 1: - Panel1 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath); + Panel1 = new UserControlUserPanel(1, 0xFF5A0FC8, newProject, _mainviewmodel.Session.VideoPath); Panel1.Name = "UserPanel1"; //3-Rajout sur la Grid Root root.Children.Add(Panel1); break; case 2: - Panel2 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath); + Panel2 = new UserControlUserPanel(2, 0xFFC80FA0, newProject, _mainviewmodel.Session.VideoPath); Panel2.Name = "UserPanel2"; //3-Rajout sur la Grid Root root.Children.Add(Panel2); break; case 3: - Panel3 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath); + Panel3 = new UserControlUserPanel(3, 0xFFFFFF00, newProject, _mainviewmodel.Session.VideoPath); Panel3.Name = "UserPanel3"; //3-Rajout sur la Grid Root root.Children.Add(Panel3); break; case 4: - Panel4 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath); + Panel4 = new UserControlUserPanel(4, 0xFF0096FF, newProject, _mainviewmodel.Session.VideoPath); Panel4.Name = "UserPanel4"; //3-Rajout sur la Grid Root root.Children.Add(Panel4);