diff --git a/DMX-2.0.userprefs b/DMX-2.0.userprefs index 3d2249f..5ae35b8 100644 --- a/DMX-2.0.userprefs +++ b/DMX-2.0.userprefs @@ -2,11 +2,12 @@ - - - - + + + + + diff --git a/DMX-2.0/Conduite.cs b/DMX-2.0/Conduite.cs index 1da7e08..062d636 100644 --- a/DMX-2.0/Conduite.cs +++ b/DMX-2.0/Conduite.cs @@ -128,8 +128,8 @@ namespace DMX2 MainWindow.Win.ScheduleUpdate(); - /*if( ts > TimeSpan.FromMilliseconds(12) ) - Console.WriteLine ("{0} {1}", DateTime.Now - tickTime,ts);*/ + if( ts > TimeSpan.FromMilliseconds(15) ) + Console.WriteLine ("{0} {1}", DateTime.Now - tickTime,ts); } #region IDisposable implementation diff --git a/DMX-2.0/SeqLinUI.cs b/DMX-2.0/SeqLinUI.cs index 93b87aa..23343e9 100644 --- a/DMX-2.0/SeqLinUI.cs +++ b/DMX-2.0/SeqLinUI.cs @@ -48,19 +48,56 @@ namespace DMX2 effetsListe.AppendColumn(numCol); effetsListe.AppendColumn(nomCol); - effetsListe.AppendColumn(dureeCol); effetsListe.AppendColumn(transCol); + effetsListe.AppendColumn(dureeCol); lsEffets = new ListStore(typeof(SequenceurLineaire.Effet)); effetsListe.Model = lsEffets; + + nomCell.Editable = true; + dureeCell.Editable = true; + transCell.Editable = true; + + nomCell.Edited += EditNom; + dureeCell.Edited += EditDuree; + transCell.Edited += EditTrans; + #endregion } + + void EditNom (object o, EditedArgs args) + { + Gtk.TreeIter iter; + lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path)); + SequenceurLineaire.Effet e = lsEffets.GetValue(iter,0) as SequenceurLineaire.Effet; + e.Nom = args.NewText; + } + + void EditDuree (object o, EditedArgs args) + { + Gtk.TreeIter iter;int d; + lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path)); + SequenceurLineaire.Effet e = lsEffets.GetValue(iter,0) as SequenceurLineaire.Effet; + if(int.TryParse(args.NewText , out d)) + e.Duree = TimeSpan.FromMilliseconds(d * 100); + } + + void EditTrans (object o, EditedArgs args) + { + Gtk.TreeIter iter; int t; + lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path)); + SequenceurLineaire.Effet e = lsEffets.GetValue(iter,0) as SequenceurLineaire.Effet; + if(int.TryParse(args.NewText , out t)) + e.Transition = TimeSpan.FromMilliseconds(t * 100); + + } + #region Affichage Liste d'Effets void RenderNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { SequenceurLineaire.Effet e = tree_model.GetValue (iter, 0) as SequenceurLineaire.Effet; - (cell as Gtk.CellRendererText).Text = ""; + (cell as Gtk.CellRendererText).Text = (sequenceur.Effets.IndexOf(e)+1).ToString() ; } void RenderNom (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) @@ -96,6 +133,16 @@ namespace DMX2 UpdateValues(); timeLabel.LabelProp = string.Format(@"{0:0\.0}", sequenceur.TimeStamp.TotalMilliseconds/100); + if(sequenceur.EffetCourrant.Duree != TimeSpan.Zero ) + pbDuree.Fraction = Math.Min(1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Duree.TotalMilliseconds); + else + pbDuree.Fraction = 0.0d; + + if(sequenceur.EffetCourrant.Transition != TimeSpan.Zero ) + pbTrans.Fraction = Math.Min(1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Transition.TotalMilliseconds); + else + pbTrans.Fraction = 0.0d; + } protected void OnCircuitsActionActivated (object sender, EventArgs e) @@ -221,10 +268,10 @@ namespace DMX2 protected void OnSaveActionActivated (object sender, EventArgs e) { - int d,t; - if(!int.TryParse(dureeEntry.Text,out d) || !int.TryParse(transEntry.Text,out t)) return; - sequenceur.SauveEffet("Nom", TimeSpan.FromMilliseconds(100*d),TimeSpan.FromMilliseconds(t*100)); + //int d,t; if(!int.TryParse(dureeEntry.Text,out d) || !int.TryParse(transEntry.Text,out t)) return; + sequenceur.SauveEffet("Nouvel Effet", TimeSpan.Zero,TimeSpan.FromSeconds(5)); UpdListeEffets(); + } @@ -233,6 +280,25 @@ namespace DMX2 sequenceur.IndexEffetCourrant++; } + protected void OnGoBackActionActivated (object sender, EventArgs e) + { + sequenceur.IndexEffetCourrant--; + } + + protected void OnMediaPauseActionActivated (object sender, EventArgs e) + { + sequenceur.Paused = ! sequenceur.Paused; + } + + protected void OnMediaNextActionActivated (object sender, EventArgs e) + { + sequenceur.FinDeTransition(); + } + + + + + } } diff --git a/DMX-2.0/SequenceurLineaire.cs b/DMX-2.0/SequenceurLineaire.cs index bd7c093..e8e6664 100644 --- a/DMX-2.0/SequenceurLineaire.cs +++ b/DMX-2.0/SequenceurLineaire.cs @@ -23,6 +23,9 @@ namespace DMX2 get { return _nom; } + set { + _nom = value; + } } Dictionary _valeurs; @@ -47,15 +50,19 @@ namespace DMX2 get { return _duree; } + set { + _duree = value; + } } public TimeSpan Transition { get { return _transition; } + set { + _transition = value; + } } - - } TimeSpan timeStamp = TimeSpan.Zero; @@ -78,6 +85,8 @@ namespace DMX2 } + + public TimeSpan TimeStamp { get { return timeStamp; @@ -154,8 +163,20 @@ namespace DMX2 return valeurschangees.ContainsKey (c); } + bool paused=false; + + public bool Paused { + get { + return paused; + } + set { + paused = value; + } + } + public override void Tick (TimeSpan time) { + if (paused) return; timeStamp += time; if (enTransition) { @@ -177,11 +198,21 @@ namespace DMX2 } } - void FinDeTransition () + + + public void FinDeTransition () { enTransition = false; foreach (Circuit c in circuitsSeq) - valeurscourantes [c] = effetcourrant [c]; + if(!valeurschangees.ContainsKey (c)) + valeurscourantes [c] = effetcourrant [c]; + } + + + public SequenceurLineaire.Effet EffetCourrant { + get { + return effetcourrant; + } } public int IndexEffetCourrant { @@ -203,15 +234,14 @@ namespace DMX2 timeStamp = TimeSpan.Zero; } - public void SauveEffet (string nom, TimeSpan duree, TimeSpan transition) + public int SauveEffet (string nom, TimeSpan duree, TimeSpan transition) { lock (this) { effets.Add (new Effet (nom, valeurscourantes, duree, transition)); + return effets.Count-1; } } - - public override System.Xml.XmlElement Save () { throw new System.NotImplementedException (); diff --git a/DMX-2.0/gtk-gui/gui.stetic b/DMX-2.0/gtk-gui/gui.stetic index 2a30491..cbff1da 100644 --- a/DMX-2.0/gtk-gui/gui.stetic +++ b/DMX-2.0/gtk-gui/gui.stetic @@ -453,6 +453,7 @@ Action gtk-go-back + Action @@ -460,25 +461,28 @@ gtk-go-forward - + Action - gtk-revert-to-saved + gtk-apply Action gtk-media-pause + Action gtk-media-next + Action gtk-save + Enregistre @@ -533,101 +537,6 @@ 6 - - - - 121 - 2 - - - - False - - - - 45 - True - True - - - - 4 - - - - - - 45 - True - True - - - - 58 - - - - - - <small>Duree</small> - True - - - 9 - 28 - - - - - - <small>Transition</small> - True - - - 55 - 28 - - - - - 0 - True - False - False - - - - - - 15 - - - 1 - False - False - False - - - - - - 15 - - - 2 - False - False - False - - - - - 0 - False - False - False - - @@ -645,6 +554,30 @@ False + + + + 15 + + + 1 + True + False + False + + + + + + 15 + + + 2 + True + False + False + + @@ -659,7 +592,7 @@ - 1 + 3 True False False @@ -671,14 +604,14 @@ False SmallToolbar - + - 2 + 4 True False False @@ -686,7 +619,7 @@ - 1 + 0 False False False @@ -706,7 +639,7 @@ - 2 + 1 False @@ -725,7 +658,7 @@ - 3 + 2 True False False