From 7813cf98f74edfb753d4f9130064cf4fbfb359d5 Mon Sep 17 00:00:00 2001 From: manu Date: Sun, 3 Nov 2013 17:16:53 +0000 Subject: [PATCH] Plein de choses: Sequenceur Macro Fini Divers bugs Boutons pause, blackout ... --- DMX-2.0/Conduite.cs | 48 ++- DMX-2.0/MainWindow.cs | 42 ++- DMX-2.0/SeqMacroUI.cs | 367 +++++++++++++++++--- DMX-2.0/Sequenceur.cs | 2 + DMX-2.0/SequenceurMacro.cs | 533 +++++++++++++++++------------ DMX-2.0/SequenceurMaitre.cs | 2 + DMX-2.0/UniversDMX.cs | 26 +- DMX-2.0/gtk-gui/DMX2.MainWindow.cs | 42 +-- DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs | 143 +++++--- DMX-2.0/gtk-gui/gui.stetic | 79 ++++- 10 files changed, 905 insertions(+), 379 deletions(-) diff --git a/DMX-2.0/Conduite.cs b/DMX-2.0/Conduite.cs index bdaa460..eb11373 100644 --- a/DMX-2.0/Conduite.cs +++ b/DMX-2.0/Conduite.cs @@ -36,6 +36,8 @@ namespace DMX2 var u = new UniversDMX(); Patches.Add(u); u.Nom = "Univers par Défaut"; + + Pause = false; } @@ -89,6 +91,10 @@ namespace DMX2 } } + public bool Pause { get; set; } + + public bool BlackOut { get; set ; } + public SequenceurMaitre SequenceurMaitre { get { return seqmaitre; @@ -154,28 +160,40 @@ namespace DMX2 TimeSpan deltaT = tickTime - dernierTick; dernierTick = tickTime; - if( deltaT > TimeSpan.FromMilliseconds(15) ) - Console.WriteLine ("{0}", deltaT); + if (!Pause) { - lock (this) { + if (deltaT > TimeSpan.FromMilliseconds (15)) + Console.WriteLine ("{0}", deltaT); - seqmaitre.Tick(deltaT); + lock (this) { - // 'Actionne' les sequenceurs - foreach (var seq in sequenceurs) { - seq.Tick (deltaT); - } + seqmaitre.Tick (deltaT); + + // 'Actionne' les sequenceurs + foreach (var seq in sequenceurs) { + seq.Tick (deltaT); + } + + // Mets a jour les valeurs circuits. + if(BlackOut) + { + foreach (var c in circuits) + c.ValeurCourante = 0; + } + else + { + foreach (var c in circuits) { + int val = 0; + foreach (var seq in Sequenceurs) { + val = Math.Max (val, seq.ValeurCircuit (c)); + } + c.ValeurCourante = val * master / 100; + } - // Mets a jour les valeurs circuits. - foreach (var c in circuits) { - int val = 0; - foreach (var seq in Sequenceurs) { - val = Math.Max (val, seq.ValeurCircuit (c)); } - c.ValeurCourante = val * master /100; } + // Cette fonction retourne quasi immédiatement, même si il y'a beaucoup a faire sur l'affichage } - // Cette fonction retourne quasi immédiatement, même si il y'a beaucoup a faire sur l'affichage if(tickTime - derniereMaj > TimeSpan.FromMilliseconds(50)){ MainWindow.Win.ScheduleUpdate(); diff --git a/DMX-2.0/MainWindow.cs b/DMX-2.0/MainWindow.cs index 0226e27..e84659f 100644 --- a/DMX-2.0/MainWindow.cs +++ b/DMX-2.0/MainWindow.cs @@ -26,11 +26,14 @@ namespace DMX2 } + + #region Sequenceur Maitre protected void ConstruitMatrice () { + this.MatriceUI.EnableGridLines = TreeViewGridLines.Both; var idCol = new Gtk.TreeViewColumn (); var idCell = new Gtk.CellRendererText (); @@ -476,6 +479,7 @@ namespace DMX2 btnAjoutLigne.Sensitive = btnRetireLigne.Sensitive = btnGo.Sensitive = btnGoBack.Sensitive = showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = seqMacroAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = + btnPause.Sensitive = btnBlackOut.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = true; openAction.Sensitive = newAction.Sensitive = false; this.Title = "DMX 2.0 - " + Conduite.Courante.Name; @@ -484,6 +488,7 @@ namespace DMX2 btnAjoutLigne.Sensitive = btnRetireLigne.Sensitive = btnGo.Sensitive = btnGoBack.Sensitive = showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = seqMacroAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = + btnPause.Sensitive = btnBlackOut.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = false; openAction.Sensitive = newAction.Sensitive = true; this.Title = "DMX 2.0"; @@ -524,6 +529,8 @@ namespace DMX2 protected void OnMasterScaleValueChanged (object sender, EventArgs e) { Conduite.Courante.Master = (int)(masterScale.Value); + ChangeMatriceCouleur(); + } @@ -569,7 +576,40 @@ namespace DMX2 Conduite.Courante.Drivers.Add( new DriverBoitierV1()); } - + + protected void OnBtnPauseToggled (object sender, EventArgs e) + { + Conduite.Courante.Pause = btnPause.Active; + ChangeMatriceCouleur(); + } + protected void OnBtnBlackOutToggled (object sender, EventArgs e) + { + Conduite.Courante.BlackOut = btnBlackOut.Active; + ChangeMatriceCouleur(); + } + + void ChangeMatriceCouleur () + { + if (Conduite.Courante.BlackOut) { + + + ModifyBg (Gtk.StateType.Normal,new Gdk.Color (255, 100, 100)); + return; + } + + if (Conduite.Courante.Pause) { + ModifyBg (Gtk.StateType.Normal,new Gdk.Color (255, 255, 100)); + return; + } + + if (Conduite.Courante.Master != 100) { + ModifyBg (Gtk.StateType.Normal,new Gdk.Color (205, 205, 255)); + return; + } + + ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 255)); + + } } diff --git a/DMX-2.0/SeqMacroUI.cs b/DMX-2.0/SeqMacroUI.cs index 0778ffc..a7c25be 100644 --- a/DMX-2.0/SeqMacroUI.cs +++ b/DMX-2.0/SeqMacroUI.cs @@ -8,10 +8,9 @@ namespace DMX2 public partial class SeqMacroUI : SequenceurUI { bool fullUpdFlag = true; - SequenceurMacro sequenceur; - ListStore lsEffets=null; - TreeViewColumn nomCol; - ListStore lsMatrice = null; + SequenceurMacro sequenceur; /* pointe sur les données */ + ListStore lsEffets=null; /* liste des effets */ + //TreeViewColumn nomCol; /* inutile dans le contexte macro */ bool effetChange = false; public void EffetChange () @@ -19,14 +18,47 @@ namespace DMX2 effetChange = true; } - protected void ConstruitMatrice () + + void OnButtonPressedEvent (object o, ButtonPressEventArgs e) { + if (e.Event.Button == 3) /* right click */ + { + Menu m = new Menu(); + MenuItem renameItem = new MenuItem("Renommer le Sequenceur"); + renameItem.ButtonPressEvent += new ButtonPressEventHandler(OnRenameItemButtonPressed); + m.Add(renameItem); + m.ShowAll(); + m.Popup(); + } + } + + void OnRenameItemButtonPressed (object o, ButtonPressEventArgs args) + { + var dlg = new Dialog ("Nouveau Nom ?", GetAncestor(Gtk.Window.GType) as Gtk.Window , DialogFlags.Modal); var entry = new Entry (sequenceur.Name); + dlg.AddButton (Stock.Ok, ResponseType.Ok).GrabDefault(); dlg.AddButton (Stock.Cancel, ResponseType.Cancel); + dlg.VBox.Add (entry); dlg.VBox.ShowAll (); + entry.ActivatesDefault=true; + + if ((ResponseType)dlg.Run () == ResponseType.Ok) { + sequenceur.Name = entry.Text; + titreLabel.Text = sequenceur.Name; + } + dlg.Destroy(); + } + +#region construction et gestion de la matrice d'affichage + protected void ConstruitMatrice () /* Matrice d'affichage des effets de la macro */ + { + + effetsListe.EnableGridLines= TreeViewGridLines.Both; + var idCol = new Gtk.TreeViewColumn (); var idCell = new Gtk.CellRendererText (); + idCol.Title = "Num"; idCol.PackStart (idCell, true); idCol.SetCellDataFunc (idCell, new Gtk.TreeCellDataFunc (RenderMatriceNum)); - this.MatriceUI.AppendColumn (idCol); + effetsListe.AppendColumn (idCol); var nomCol = new Gtk.TreeViewColumn (); @@ -35,8 +67,8 @@ namespace DMX2 nomCol.PackStart (nomCell, true); nomCol.SetCellDataFunc (nomCell, new Gtk.TreeCellDataFunc (RenderMatriceNom)); nomCell.Editable = true; - //nomCell.Edited += OnNomCellEdited; - this.MatriceUI.AppendColumn (nomCol); + nomCell.Edited += OnNomCellEdited; + effetsListe.AppendColumn (nomCol); var topCol = new Gtk.TreeViewColumn (); var topCell = new Gtk.CellRendererText (); @@ -44,8 +76,8 @@ namespace DMX2 topCol.PackStart (topCell, true); topCol.SetCellDataFunc (topCell, new Gtk.TreeCellDataFunc (RenderMatriceTop)); topCell.Editable = true; - //topCell.Edited += OnTopCellEdited; - this.MatriceUI.AppendColumn (topCol); + topCell.Edited += OnTopCellEdited; + effetsListe.AppendColumn (topCol); var circuitsCol = new Gtk.TreeViewColumn (); var circuitsCell = new Gtk.CellRendererText (); @@ -53,17 +85,17 @@ namespace DMX2 circuitsCol.PackStart (circuitsCell, true); circuitsCol.SetCellDataFunc (circuitsCell, new Gtk.TreeCellDataFunc (RenderMatriceCircuits)); circuitsCell.Editable = true; - //circuitsCell.Edited += OnCircuitsCellEdited; - this.MatriceUI.AppendColumn (circuitsCol); + circuitsCell.Edited += OnCircuitsCellEdited; + effetsListe.AppendColumn (circuitsCol); var valeurCol = new Gtk.TreeViewColumn (); var valeurCell = new Gtk.CellRendererText (); valeurCol.Title = "Valeur"; valeurCol.PackStart (valeurCell, true); - valeurCol.SetCellDataFunc (circuitsCell, new Gtk.TreeCellDataFunc (RenderMatriceValeur)); + valeurCol.SetCellDataFunc (valeurCell, new Gtk.TreeCellDataFunc (RenderMatriceValeur)); valeurCell.Editable = true; - //valeurCell.Edited += OnValeurCellEdited; - this.MatriceUI.AppendColumn (valeurCol); + valeurCell.Edited += OnValeurCellEdited; + effetsListe.AppendColumn (valeurCol); var tempsCol = new Gtk.TreeViewColumn (); var tempsCell = new Gtk.CellRendererText (); @@ -71,13 +103,161 @@ namespace DMX2 tempsCol.PackStart (tempsCell, true); tempsCol.SetCellDataFunc (tempsCell, new Gtk.TreeCellDataFunc (RenderMatriceTemps)); tempsCell.Editable = true; - //tempsCell.Edited += OnTempsCellEdited; - this.MatriceUI.AppendColumn (tempsCol); + tempsCell.Edited += OnTempsCellEdited; + effetsListe.AppendColumn (tempsCol); - lsMatrice = new Gtk.ListStore(typeof (SequenceurMaitre.Ligne)); // a modifier - this.MatriceUI.Model = lsMatrice; + lsEffets = new Gtk.ListStore(typeof (SequenceurMacro.Ligne)); + this.effetsListe.Model = lsEffets; + UpdListeEffets(); } + Gdk.Color colGrey= new Gdk.Color(200,200,200); + Gdk.Color colWhite= new Gdk.Color(255,255,255); + + void RenderMatriceNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) + { + if (Conduite.Courante==null) return; + string num=string.Empty; + SequenceurMacro.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMacro.Ligne; + if( sequenceur.IndexLigneEnCours == sequenceur.Lignes.IndexOf(l) ) + num+= "->"; + if( sequenceur.IndexLigneaSuivre == sequenceur.Lignes.IndexOf(l) ) + num+= "* "; + (cell as Gtk.CellRendererText).Text = num + (sequenceur.Lignes.IndexOf(l)+1).ToString(); + + if(tree_model.GetPath (iter).Indices[0]%2 == 0) + cell.CellBackgroundGdk = colGrey; + else + cell.CellBackgroundGdk = colWhite; + + + } + + void RenderMatriceNom (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) + { + if (Conduite.Courante==null) return; + SequenceurMacro.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMacro.Ligne; + (cell as Gtk.CellRendererText).Text = l.Nom; + if(tree_model.GetPath (iter).Indices[0]%2 == 0) + cell.CellBackgroundGdk = colGrey; + else + cell.CellBackgroundGdk = colWhite; + } + + void RenderMatriceTop (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) + { + if (Conduite.Courante==null) return; + SequenceurMacro.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMacro.Ligne; + if (l.Top< TimeSpan.Zero) (cell as Gtk.CellRendererText).Text = string.Empty; + else (cell as Gtk.CellRendererText).Text = (l.Top.TotalMilliseconds /100).ToString(); + if(tree_model.GetPath (iter).Indices[0]%2 == 0) + cell.CellBackgroundGdk = colGrey; + else + cell.CellBackgroundGdk = colWhite; + + } + + void RenderMatriceCircuits (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) + { + if (Conduite.Courante==null) return; + SequenceurMacro.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMacro.Ligne; + (cell as Gtk.CellRendererText).Text = l.Circuits; + if(tree_model.GetPath (iter).Indices[0]%2 == 0) + cell.CellBackgroundGdk = colGrey; + else + cell.CellBackgroundGdk = colWhite; + + } + + void RenderMatriceValeur (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) + { + if (Conduite.Courante==null) return; + SequenceurMacro.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMacro.Ligne; + (cell as Gtk.CellRendererText).Text = (l.Valeur).ToString(); + if(tree_model.GetPath (iter).Indices[0]%2 == 0) + cell.CellBackgroundGdk = colGrey; + else + cell.CellBackgroundGdk = colWhite; + + } + + void RenderMatriceTemps (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) + { + if (Conduite.Courante==null) return; + SequenceurMacro.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMacro.Ligne; + (cell as Gtk.CellRendererText).Text = (l.Temps.TotalMilliseconds /100).ToString(); + if(tree_model.GetPath (iter).Indices[0]%2 == 0) + cell.CellBackgroundGdk = colGrey; + else + cell.CellBackgroundGdk = colWhite; + + } + + void OnNomCellEdited (object o, EditedArgs args) + { + Gtk.TreeIter iter; + lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path)); + SequenceurMacro.Ligne l = lsEffets.GetValue(iter,0) as SequenceurMacro.Ligne; + l.Nom = args.NewText; + } + + void OnTopCellEdited (object o, EditedArgs args) + { + Gtk.TreeIter iter; + lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path)); + SequenceurMacro.Ligne l = lsEffets.GetValue (iter, 0) as SequenceurMacro.Ligne; + if (args.NewText.Length == 0) + l.Top = TimeSpan.MinValue; + else { + int val; + if(int.TryParse(args.NewText, out val)) + l.Top = TimeSpan.FromMilliseconds(val *100); + } + } + + void OnCircuitsCellEdited (object o, EditedArgs args) + { + Gtk.TreeIter iter; + lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path)); + SequenceurMacro.Ligne l = lsEffets.GetValue(iter,0) as SequenceurMacro.Ligne; + l.Circuits = args.NewText; + } + + + void OnValeurCellEdited (object o, EditedArgs args) + { + Gtk.TreeIter iter; + lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path)); + SequenceurMacro.Ligne l = lsEffets.GetValue(iter,0) as SequenceurMacro.Ligne; + int val; + if(int.TryParse(args.NewText,out val)) l.Valeur = val; + } + + void OnTempsCellEdited (object o, EditedArgs args) + { + Gtk.TreeIter iter; + lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path)); + SequenceurMacro.Ligne l = lsEffets.GetValue (iter, 0) as SequenceurMacro.Ligne; + if (args.NewText.Length == 0) + l.Temps = TimeSpan.Zero; + else { + int val; + if(int.TryParse(args.NewText, out val)) + l.Temps = TimeSpan.FromMilliseconds(val *100); + } + } + + + void UpdListeEffets () + { + lsEffets.Clear(); + foreach (var ligne in sequenceur.Lignes) { + lsEffets.AppendValues(ligne); + } + } + +#endregion + public SeqMacroUI (SequenceurMacro s ) : base (s) { this.Build (); @@ -85,46 +265,43 @@ namespace DMX2 sequenceur = s; ConstruitMatrice (); + frame1.ButtonPressEvent += OnButtonPressedEvent; } - void RenderMatriceNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) - { - throw new NotImplementedException (); - } - - void RenderMatriceNom (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) - { - throw new NotImplementedException (); - } - - void RenderMatriceTop (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) - { - throw new NotImplementedException (); - } - - void RenderMatriceCircuits (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) - { - throw new NotImplementedException (); - } - - void RenderMatriceValeur (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) - { - throw new NotImplementedException (); - } - - void RenderMatriceTemps (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) - { - throw new NotImplementedException (); - } - public override void Update (bool full) { + if (fullUpdFlag || full) + FullUpdate (); + // UpdateValues (); inutil dans le contexte + 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) + pbDuree.Fraction = Math.Min (1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Transition.TotalMilliseconds); + else + pbDuree.Fraction = 0.0d;*/ + + if (effetChange) { + UpdListeEffets(); + SelectionneEffet (sequenceur.IndexLigneEnCours); + posLabel.Text = string.Format("n°{0}",sequenceur.IndexLigneEnCours +1 ); + } } + void SelectionneEffet (int index) + { + if(index <0 ) return; + effetsListe.SetCursor( new TreePath( new int[1] {index }) ,null,false); + effetChange = false; + } + protected void OnCircuitsActionActivated (object sender, EventArgs e) { // récupère la fenètre principale @@ -142,13 +319,103 @@ namespace DMX2 this.Destroy(); } + protected void FullUpdate () + { + fullUpdFlag = true; + + foreach (Circuit c in sequenceur.Circuits) { + + + } + + seqMasterScale.Value = sequenceur.Master; + + posLabel.Text = string.Format("n°{0}",sequenceur.IndexLigneEnCours +1); + + fullUpdFlag=false; + } + + int IndexEffetSelectionne() + { + var sel = effetsListe.Selection.GetSelectedRows(); + if(sel.Length ==0) return -1; + return effetsListe.Selection.GetSelectedRows()[0].Indices[0]; + } + + protected void OnGoForwardActionActivated (object sender, EventArgs e) + { + // Si l'effet courant est selectioné, on passe au suivant, sinon, on passe a celui selectionné. + /*if(sequenceur.IndexEffetCourrant == IndexEffetSelectionne()) + sequenceur.IndexEffetCourrant++; + else + sequenceur.IndexEffetCourrant = IndexEffetSelectionne();*/ + + sequenceur.LigneSuivante(); + + } + + protected void OnGoBackActionActivated (object sender, EventArgs e) + { + if (sequenceur.IndexLigneEnCours > 0) { + sequenceur.IndexLigneaSuivre = sequenceur.IndexLigneEnCours - 1; + sequenceur.LigneSuivante (); + } + } + + protected void OnMediaPauseActionActivated (object sender, EventArgs e) + { + sequenceur.Paused = ! sequenceur.Paused; + } protected void OnSeqMasterScaleValueChanged (object sender, EventArgs e) { if (fullUpdFlag)return; sequenceur.Master = (int)(seqMasterScale.Value); - } + } + + protected void OnBtnAjoutLigneActivated (object sender, EventArgs e) + { + int pos=IndexEffetSelectionne() + 1; + sequenceur.AjoutLigne(pos); + UpdListeEffets(); + effetsListe.SetCursor( new TreePath( new int[1] {pos }) , effetsListe.Columns[1] ,true); + } + + protected void OnRemoveLigneActivated (object sender, EventArgs e) + { + int pos = IndexEffetSelectionne(); + if (pos==-1) return; + sequenceur.RetireLigne(pos); + UpdListeEffets(); + } + + protected void OnEffetsListeCursorChanged (object sender, EventArgs e) + { + if(effetChange) return; + TreeViewColumn col; + TreePath path; + effetsListe.GetCursor (out path, out col); + + if (effetsListe.Columns [0] == col) { + sequenceur.IndexLigneaSuivre = IndexEffetSelectionne(); + } + } + + + + + protected void OnBtnCommandClicked (object sender, EventArgs e) + { + sequenceur.CommandDirecte(txtCommand.Text ); + + } + + + + + + } } diff --git a/DMX-2.0/Sequenceur.cs b/DMX-2.0/Sequenceur.cs index 214cd0f..f5cd9fe 100644 --- a/DMX-2.0/Sequenceur.cs +++ b/DMX-2.0/Sequenceur.cs @@ -67,6 +67,8 @@ namespace DMX2 switch (el.Name) { case "SequenceurLineaire": return SequenceurLineaire.Load(conduite, el); + case "SequenceurMacro": + return SequenceurMacro.Load(conduite,el); } return null; } diff --git a/DMX-2.0/SequenceurMacro.cs b/DMX-2.0/SequenceurMacro.cs index 7b771b1..9db53f6 100644 --- a/DMX-2.0/SequenceurMacro.cs +++ b/DMX-2.0/SequenceurMacro.cs @@ -1,116 +1,137 @@ using System; using System.Collections.Generic; +using System.Xml; using System.Collections.ObjectModel; namespace DMX2 { public class SequenceurMacro : Sequenceur { - public class Effet - { - - string _nom; - - public Effet (string nom, Dictionary valeurs, TimeSpan duree, TimeSpan transition) - { - _nom = nom; - _valeurs = new Dictionary (valeurs); - _duree = duree; - _transition = transition; - } + public class Ligne { + public Ligne(){} + string nom = string.Empty; + TimeSpan top = TimeSpan.MinValue; + string circuits = string.Empty; + int valeur; + TimeSpan temps = TimeSpan.Zero; public string Nom { get { - return _nom; + return nom; } set { - _nom = value; + nom = value; } } - Dictionary _valeurs; - - public int this [Circuit index] { + public TimeSpan Top { get { - if (!_valeurs.ContainsKey (index)) - _valeurs.Add (index, 0); - return _valeurs [index]; + return top; + } + set { + top = value; } } - public Dictionary Valeurs { + public string Circuits { get { - return _valeurs; + return circuits; + } + set { + circuits = value; } } - public void RetireCircuit (Circuit c) + + public int Valeur { + get { + return valeur; + } + set { + valeur = value; + } + } + + public TimeSpan Temps { + get { + return temps; + } + set { + temps = value; + } + } + + + public void Save (XmlElement parent) { - _valeurs.Remove (c); - } - - TimeSpan _duree = TimeSpan.Zero ; - TimeSpan _transition = TimeSpan.Zero; - - public TimeSpan Duree { - get { - return _duree; - } - set { - _duree = value; - } - } - - public TimeSpan Transition { - get { - return _transition; - } - set { - _transition = value; - } - } - public void Save (System.Xml.XmlElement parent) - { - System.Xml.XmlElement el = parent.OwnerDocument.CreateElement ("Effet"); - System.Xml.XmlElement xmlVal; + XmlElement el = parent.OwnerDocument.CreateElement ("Ligne"); parent.AppendChild (el); - el.SetAttribute("nom",_nom); - el.SetAttribute ("duree", _duree.ToString ()); - el.SetAttribute ("transition", _transition.ToString ()); - foreach (var valeur in _valeurs) { - xmlVal = parent.OwnerDocument.CreateElement("Valeur"); - el.AppendChild(xmlVal); - xmlVal.SetAttribute("circuit",valeur.Key.ID.ToString()); - xmlVal.SetAttribute("valeur",valeur.Value.ToString()); - } - } - public static Effet Load (Conduite conduite, System.Xml.XmlElement el) - { - Dictionary valeurs = new Dictionary (); - foreach (var xv in el.GetElementsByTagName("Valeur")) { - System.Xml.XmlElement xval = xv as System.Xml.XmlElement; - valeurs.Add( - conduite.GetCircuitByID(int.Parse(xval.GetAttribute("circuit"))), - int.Parse(xval.GetAttribute("valeur")) - ); - } - return new Effet( el.GetAttribute("nom"),valeurs, - TimeSpan.Parse(el.GetAttribute("duree")), - TimeSpan.Parse(el.GetAttribute("transition")) - ); - } + el.SetAttribute ("nom", nom); + el.SetAttribute ("top", top.ToString ()); + el.SetAttribute ("circuits", circuits); + el.SetAttribute ("valeur", valeur.ToString ()); + el.SetAttribute ("temps", temps.ToString ()); + + + } + + public static Ligne Load (Conduite c, XmlElement el) + { + Ligne l = new Ligne(); + l.nom = el.GetAttribute ("nom"); + l.top = TimeSpan.Parse(el.GetAttribute("top")); + l.circuits = el.GetAttribute ("circuits"); + l.valeur = int.Parse(el.GetAttribute("valeur")); + l.temps = TimeSpan.Parse(el.GetAttribute("temps")); + + return l; + } } - TimeSpan timeStamp = TimeSpan.Zero; - List circuitsSeq = new List (); - List effets = new List (); - Effet effetcourrant = null; - bool enTransition = false; - Dictionary valeurscourantes = new Dictionary (); - Dictionary valeursinitiales = new Dictionary (); - Dictionary valeurschangees = new Dictionary (); - SeqMacroUI ui = null; + public class EffetMacro + { + public EffetMacro( TimeSpan tempsTransition, int valeurInitiale, int valeurFinale) { + TempsPasse = TimeSpan.Zero; + TempsTransition = tempsTransition; + ValeurInitiale= valeurInitiale; + ValeurFinale = valeurFinale; + } + public TimeSpan TempsPasse { get; set; } + public TimeSpan TempsTransition { get; set; } + public int ValeurInitiale { get; set; } + public int ValeurFinale { get; set; } + public bool Incremente (TimeSpan delta) + { + TempsPasse += delta; + if (TempsPasse > TempsTransition) { + TempsPasse = TempsTransition; + return true; + } + return false; + } + public int ValeurCourante() + { + double progression = TempsPasse.TotalMilliseconds/TempsTransition.TotalMilliseconds; + return (int)( progression * (ValeurFinale - ValeurInitiale) + ValeurInitiale ); + } + } + List lignes = new List(); + + + + TimeSpan timeStamp = TimeSpan.Zero; + TimeSpan topSuivant = TimeSpan.Zero; + bool topPresent = false; + + List circuitsSeq = new List (); + + + Dictionary valeurscourantes = new Dictionary (); + Dictionary effetsEnCours = new Dictionary(); + + SeqMacroUI ui = null; + bool change = false; int master = 100; public int Master { @@ -124,7 +145,59 @@ namespace DMX2 public SequenceurMacro () { - effetcourrant = new Effet ("",valeurscourantes , TimeSpan.Zero, TimeSpan.Zero); + + } + + + public int IndexLigneEnCours + { + get { + if (enCours == null) return -1; + return lignes.IndexOf(enCours); + } + } + + Ligne aSuivre = null; + Ligne enCours = null; + Ligne ligneMaitre = null; + + + public int IndexLigneaSuivre + { + get { + if (aSuivre == null) + return -1; + return lignes.IndexOf (aSuivre); + } + set { + aSuivre = lignes[value]; + } + } + + public int AjoutLigne (int pos) + { + lock (this) { + lignes.Insert (pos, new Ligne ()); + CommandAdd(pos); + return pos; + } + } + + public void RetireLigne (int pos) + { + lock (this) { + lock (this) { + if (lignes [pos] == enCours) { + enCours = null; + if (pos + 1 < lignes.Count) + aSuivre = lignes [pos + 1]; + } + if (lignes [pos] == aSuivre) + aSuivre = null; + lignes.RemoveAt (pos); + CommandRemove(pos); + } + } } public TimeSpan TimeStamp { @@ -133,15 +206,17 @@ namespace DMX2 } } - public ReadOnlyCollection Circuits { + + public ReadOnlyCollection Lignes { get { - return circuitsSeq.AsReadOnly (); + return lignes.AsReadOnly(); } } - public ReadOnlyCollection Effets { + + public ReadOnlyCollection Circuits { get { - return effets.AsReadOnly (); + return circuitsSeq.AsReadOnly (); } } @@ -162,17 +237,12 @@ namespace DMX2 void AjouteCircuit (Circuit c) { valeurscourantes [c] = 0; - valeursinitiales [c] = 0; } private void RetireCircuit (Circuit c) { - foreach (var ef in effets) { - ef.RetireCircuit (c); - } circuitsSeq.Remove (c); valeurscourantes.Remove (c); - valeursinitiales.Remove (c); } public override void MajCircuitsSupprimes () @@ -201,17 +271,6 @@ namespace DMX2 return valeurscourantes [c]; } - public void ChangeValeur (Circuit c, int value) - { - valeurschangees [c] = true; - valeurscourantes [c] = value; - } - - public bool EstChange (Circuit c) - { - return valeurschangees.ContainsKey (c); - } - bool paused=false; public bool Paused { @@ -225,129 +284,129 @@ namespace DMX2 public override void Tick (TimeSpan time) { - if (paused) return; + if (paused) + return; timeStamp += time; - - if (enTransition) { - if (timeStamp < effetcourrant.Transition) { - double progression = timeStamp.TotalMilliseconds / effetcourrant.Transition.TotalMilliseconds; - foreach (Circuit c in circuitsSeq) { - if (valeurscourantes [c] != effetcourrant [c] && !valeurschangees.ContainsKey (c)) { - valeurscourantes [c] = (int)(progression * (effetcourrant [c] - valeursinitiales [c]) + valeursinitiales [c]); - } + + + lock (this) { + List circuits = new List (effetsEnCours.Keys); + + foreach (Circuit c in circuits) { + if (effetsEnCours [c].Incremente (time)) { + valeurscourantes [c] = effetsEnCours [c].ValeurFinale; + effetsEnCours.Remove (c); + } else { + valeurscourantes [c] = effetsEnCours [c].ValeurCourante (); } - } else { - FinDeTransition (); } } - if (effetcourrant.Duree != TimeSpan.Zero && timeStamp >= effetcourrant.Duree) { - int index = effets.IndexOf (effetcourrant) + 1; - if (index < effets.Count) - ChangeEffetCourrant (index); + + if (topPresent) { + if (timeStamp > topSuivant){ + LigneSuivante(); + } } } - - - public void FinDeTransition () - { - enTransition = false; - foreach (Circuit c in circuitsSeq) - if(!valeurschangees.ContainsKey (c)) - valeurscourantes [c] = effetcourrant [c]; - } - - - public SequenceurMacro.Effet EffetCourrant { - get { - return effetcourrant; - } - } - - public int IndexEffetCourrant { - get { - return effets.IndexOf(effetcourrant); - } - set { - if(value>=0 && value < effets.Count) - ChangeEffetCourrant(value); - } - } - - void ChangeEffetCourrant (int index) + public void LigneSuivante () { lock (this) { - effetcourrant = effets [index]; - valeurschangees.Clear (); - valeursinitiales = new Dictionary (valeurscourantes); - enTransition = true; - timeStamp = TimeSpan.Zero; - if (ui != null) - ui.EffetChange (); + if(lignes.Count==0) return; + int index; + change = true; topPresent = false; + if(aSuivre==null) // selection souris + { + index = IndexLigneEnCours +1; // Premier effet si aucun précédement + if(index>= lignes.Count) index = 0; // Boucle si arrivé à la fin + + enCours = lignes[index]; + + // Gestion de la Reprise + if(enCours.Circuits.Equals("R") && ligneMaitre != null) + enCours = ligneMaitre; + + if(enCours.Nom.Length!=0) + { + ligneMaitre = enCours; + timeStamp = TimeSpan.Zero; + } + } + else + { + enCours = aSuivre; + ligneMaitre = enCours; + timeStamp = TimeSpan.Zero; + + } + index = IndexLigneEnCours+1; + if(index= TimeSpan.Zero) + { + topPresent = true; + topSuivant= lignes[index].Top; + } + } + aSuivre = null; + LanceEffetsMacro(false,TimeSpan.Zero); + if(ui!=null) + ui.EffetChange(); } } - public int SauveEffet (string nom, TimeSpan duree, TimeSpan transition) + void LanceEffetsMacro (bool ecrase, TimeSpan tempsMatrice) { lock (this) { - effets.Add (effetcourrant = new Effet (nom, valeurscourantes, duree, transition)); - return effets.Count-1; + if (ecrase) + LanceEffetsMacro (enCours.Circuits, enCours.Valeur, tempsMatrice); + else + LanceEffetsMacro (enCours.Circuits, enCours.Valeur, enCours.Temps); + } + + } + + void LanceEffetsMacro (string circuits, int valeurCible, TimeSpan temps) + { + if(circuits==null)return; + string[] blocs = circuits.Split(','); + foreach (string bloc in blocs) { + string[] circ = bloc.Split('-'); + int start, end; + if(! int.TryParse(circ[0], out start)) + continue; + if(circ.Length > 1) // on a affaire a un bloc (de plusieurs) + { + if(! int.TryParse(circ[1], out end)) + continue; + } + else + end= start; + for( int i = start; i<=end; i++) + { + Circuit c = Conduite.Courante.GetCircuitByID(i); + if(circuitsSeq.Contains(c)) + { + if(effetsEnCours.ContainsKey(c)) effetsEnCours.Remove(c); + effetsEnCours.Add(c, new EffetMacro(temps,valeurscourantes[c],valeurCible)); + } + } } } - public int InsereEffetApres (int index, string nom, TimeSpan duree, TimeSpan transition) + + public bool LigneChange () { - lock (this) { - int pos = index+1; - if (pos >= effets.Count) return SauveEffet(nom,duree,transition); - effets.Insert (pos,effetcourrant = new Effet (nom, valeurscourantes, duree, transition)); - CommandAdd(index); - return pos; + if (change) { + change = false; + return true; } + return false; } - public void RemplaceEffet (int index) - { - lock (this) { - Effet ef = effets[index]; - effets[index] = new Effet (ef.Nom, valeurscourantes, ef.Duree, ef.Transition); - effetcourrant = effets[index]; - } - } - public void SupprimeEffet (int index) - { - lock (this) { - effets.RemoveAt (index); - CommandRemove(index); - } - } - public int MonteEffet (int index) - { - lock (this) { - if (index >= effets.Count || index < 1) - return index; - Effet ef = effets [index]; - effets.RemoveAt (index); - effets.Insert (index - 1, ef); - CommandSwap (index - 1); - return index - 1; - } - } - - public int BaisseEffet (int index) - { - lock (this) { - if (index > effets.Count - 2 || index < 0) - return index; - Effet ef = effets [index]; - effets.RemoveAt (index); - effets.Insert (index + 1, ef); - CommandSwap(index); - return index + 1; - } - } public override void Save (System.Xml.XmlElement parent) { @@ -364,8 +423,8 @@ namespace DMX2 xmlC.SetAttribute("id",c.ID.ToString()); } - foreach (Effet ef in effets) { - ef.Save(el); + foreach (Ligne li in lignes) { + li.Save(el); } } @@ -407,10 +466,29 @@ namespace DMX2 AjouteCircuit (c); } - foreach (var xe in el.GetElementsByTagName("Effet")) - effets.Add(Effet.Load(conduite,xe as System.Xml.XmlElement)); + foreach (var xe in el.GetElementsByTagName("Ligne")) + lignes.Add(Ligne.Load(conduite,xe as System.Xml.XmlElement)); } + static System.Text.RegularExpressions.Regex regexCommandeDirecte = new System.Text.RegularExpressions.Regex( + @"(?[\d,-]+) (?\d+) (?\d+)", + System.Text.RegularExpressions.RegexOptions.Compiled); + + + public void CommandDirecte (string text) + { + var cmd = regexCommandeDirecte.Match (text); + if (cmd.Success) { + string circuits = cmd.Groups["circuits"].Value; + + int valeur = int.Parse(cmd.Groups["valeur"].Value); + TimeSpan temps = TimeSpan.FromMilliseconds(100* int.Parse(cmd.Groups["temps"].Value)); + + LanceEffetsMacro(circuits,valeur,temps); + } + } + + // TODO : implementer commandes seqmaitre static System.Text.RegularExpressions.Regex regexCommand1 = new System.Text.RegularExpressions.Regex( @"(?\d+)(t(?\d+))?", System.Text.RegularExpressions.RegexOptions.Compiled); @@ -419,6 +497,8 @@ namespace DMX2 @"(?\d+)(?(t\d+)?)?", System.Text.RegularExpressions.RegexOptions.Compiled); + + public override void Command (string command) { lock (this) { @@ -427,14 +507,37 @@ namespace DMX2 if (cmd.Success) { if (cmd.Groups ["effet"].Success) { int effet = int.Parse (cmd.Groups ["effet"].Value) - 1; - if (effet < effets.Count) - ChangeEffetCourrant (effet); + int transition=-1; + + if(effet>=lignes.Count) return; + enCours = lignes[effet]; + ligneMaitre = enCours; + timeStamp = TimeSpan.Zero; + + + int index = IndexLigneEnCours+1; + if(index= TimeSpan.Zero) + { + topPresent = true; + topSuivant= lignes[index].Top; + } + } + aSuivre = null; + + if (cmd.Groups ["transition"].Success) { + transition = int.Parse (cmd.Groups ["transition"].Value); + LanceEffetsMacro(true, TimeSpan.FromMilliseconds(transition *100)); + } + else + LanceEffetsMacro(false,TimeSpan.Zero); + + if(ui!=null) ui.EffetChange(); + } - if (cmd.Groups ["transition"].Success) { - int transition = int.Parse (cmd.Groups ["transition"].Value); - effetcourrant = new Effet ("", effetcourrant.Valeurs, effetcourrant.Duree, TimeSpan.FromMilliseconds (transition * 100)); - } } } } diff --git a/DMX-2.0/SequenceurMaitre.cs b/DMX-2.0/SequenceurMaitre.cs index 0e90f59..66ff5a3 100644 --- a/DMX-2.0/SequenceurMaitre.cs +++ b/DMX-2.0/SequenceurMaitre.cs @@ -116,6 +116,7 @@ namespace DMX2 public void EffetSuivant () { lock (this) { + if(lignes.Count==0) return; if (aSuivre == null) { if (IndexLigneEnCours + 1 < lignes.Count) enCours = lignes [IndexLigneEnCours + 1]; @@ -134,6 +135,7 @@ namespace DMX2 public void EffetPrecedent () { lock (this) { + if(lignes.Count==0) return; if (IndexLigneEnCours > 0) enCours = lignes [IndexLigneEnCours - 1]; else diff --git a/DMX-2.0/UniversDMX.cs b/DMX-2.0/UniversDMX.cs index d0808f9..4b1d50d 100644 --- a/DMX-2.0/UniversDMX.cs +++ b/DMX-2.0/UniversDMX.cs @@ -66,21 +66,21 @@ namespace DMX2 } g= _dimmers[i]; - - switch (g.fonctionTransfert) { - case FTransfer.lineaire: - if(g.circuitAssocié !=null) + if(g.circuitAssocié !=null) { + switch (g.fonctionTransfert) { + case FTransfer.lineaire: valeurs[i+offset] = (byte)( g.circuitAssocié.ValeurCourante * g.param1 /100); - else - valeurs[i+offset] = 0; - break; - case FTransfer.log: - break; - case FTransfer.exp: - break; - default: - throw new ArgumentOutOfRangeException (); + break; + case FTransfer.log: + break; + case FTransfer.exp: + break; + default: + throw new ArgumentOutOfRangeException (); + } } + else + valeurs[i+offset] = 0; } } diff --git a/DMX-2.0/gtk-gui/DMX2.MainWindow.cs b/DMX-2.0/gtk-gui/DMX2.MainWindow.cs index b63001d..abfa0f2 100644 --- a/DMX-2.0/gtk-gui/DMX2.MainWindow.cs +++ b/DMX-2.0/gtk-gui/DMX2.MainWindow.cs @@ -29,8 +29,8 @@ namespace DMX2 private global::Gtk.Button btnGoBack; private global::Gtk.Button btnAjoutLigne; private global::Gtk.Button btnRetireLigne; - private global::Gtk.ToggleButton togglebutton2; - private global::Gtk.ToggleButton togglebutton1; + private global::Gtk.ToggleButton btnBlackOut; + private global::Gtk.ToggleButton btnPause; private global::Gtk.ToggleButton togglebutton3; private global::Gtk.Label timeLabel; private global::Gtk.VScale masterScale; @@ -220,11 +220,11 @@ namespace DMX2 w37.Expand = false; w37.Fill = false; // Container child vbox2.Gtk.Box+BoxChild - this.togglebutton2 = new global::Gtk.ToggleButton (); - this.togglebutton2.CanFocus = true; - this.togglebutton2.Name = "togglebutton2"; - this.togglebutton2.UseUnderline = true; - // Container child togglebutton2.Gtk.Container+ContainerChild + this.btnBlackOut = new global::Gtk.ToggleButton (); + this.btnBlackOut.CanFocus = true; + this.btnBlackOut.Name = "btnBlackOut"; + this.btnBlackOut.UseUnderline = true; + // Container child btnBlackOut.Gtk.Container+ContainerChild global::Gtk.Alignment w38 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); // Container child GtkAlignment.Gtk.Container+ContainerChild global::Gtk.HBox w39 = new global::Gtk.HBox (); @@ -237,18 +237,18 @@ namespace DMX2 global::Gtk.Label w42 = new global::Gtk.Label (); w39.Add (w42); w38.Add (w39); - this.togglebutton2.Add (w38); - this.vbox2.Add (this.togglebutton2); - global::Gtk.Box.BoxChild w46 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.togglebutton2])); + this.btnBlackOut.Add (w38); + this.vbox2.Add (this.btnBlackOut); + global::Gtk.Box.BoxChild w46 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.btnBlackOut])); w46.Position = 4; w46.Expand = false; w46.Fill = false; // Container child vbox2.Gtk.Box+BoxChild - this.togglebutton1 = new global::Gtk.ToggleButton (); - this.togglebutton1.CanFocus = true; - this.togglebutton1.Name = "togglebutton1"; - this.togglebutton1.UseUnderline = true; - // Container child togglebutton1.Gtk.Container+ContainerChild + this.btnPause = new global::Gtk.ToggleButton (); + this.btnPause.CanFocus = true; + this.btnPause.Name = "btnPause"; + this.btnPause.UseUnderline = true; + // Container child btnPause.Gtk.Container+ContainerChild global::Gtk.Alignment w47 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); // Container child GtkAlignment.Gtk.Container+ContainerChild global::Gtk.HBox w48 = new global::Gtk.HBox (); @@ -261,9 +261,9 @@ namespace DMX2 global::Gtk.Label w51 = new global::Gtk.Label (); w48.Add (w51); w47.Add (w48); - this.togglebutton1.Add (w47); - this.vbox2.Add (this.togglebutton1); - global::Gtk.Box.BoxChild w55 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.togglebutton1])); + this.btnPause.Add (w47); + this.vbox2.Add (this.btnPause); + global::Gtk.Box.BoxChild w55 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.btnPause])); w55.Position = 5; w55.Expand = false; w55.Fill = false; @@ -306,7 +306,7 @@ namespace DMX2 w65.Padding = ((uint)(10)); // Container child vbox2.Gtk.Box+BoxChild this.masterScale = new global::Gtk.VScale (null); - this.masterScale.HeightRequest = 150; + this.masterScale.HeightRequest = 75; this.masterScale.Name = "masterScale"; this.masterScale.Inverted = true; this.masterScale.Adjustment.Upper = 100; @@ -319,8 +319,6 @@ namespace DMX2 this.vbox2.Add (this.masterScale); global::Gtk.Box.BoxChild w66 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.masterScale])); w66.Position = 8; - w66.Expand = false; - w66.Fill = false; this.hbox1.Add (this.vbox2); global::Gtk.Box.BoxChild w67 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox2])); w67.Position = 0; @@ -460,6 +458,8 @@ namespace DMX2 this.btnGoBack.Clicked += new global::System.EventHandler (this.OnBtnGoBackClicked); this.btnAjoutLigne.Clicked += new global::System.EventHandler (this.OnBtnAjoutLigneClicked); this.btnRetireLigne.Clicked += new global::System.EventHandler (this.OnBtnRetireLigneClicked); + this.btnBlackOut.Toggled += new global::System.EventHandler (this.OnBtnBlackOutToggled); + this.btnPause.Toggled += new global::System.EventHandler (this.OnBtnPauseToggled); this.masterScale.ValueChanged += new global::System.EventHandler (this.OnMasterScaleValueChanged); this.MatriceUI.CursorChanged += new global::System.EventHandler (this.OnMatriceUICursorChanged); } diff --git a/DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs b/DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs index 03af128..81e0d5e 100644 --- a/DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs +++ b/DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs @@ -11,6 +11,8 @@ namespace DMX2 private global::Gtk.Action goBackAction; private global::Gtk.Action mediaPauseAction; private global::Gtk.Action mediaNextAction; + private global::Gtk.Action btnAjoutLigne; + private global::Gtk.Action btnRetireligne; private global::Gtk.Frame frame1; private global::Gtk.Alignment GtkAlignment; private global::Gtk.Alignment alignment1; @@ -19,13 +21,15 @@ namespace DMX2 private global::Gtk.VBox vbox3; private global::Gtk.HBox hbox2; private global::Gtk.Label posLabel; - private global::Gtk.Label label56; + private global::Gtk.Label timeLabel; private global::Gtk.HScale seqMasterScale; - private global::Gtk.ProgressBar pbTrans; - private global::Gtk.Toolbar toolbar2; + private global::Gtk.HBox hbox3; + private global::Gtk.Entry txtCommand; + private global::Gtk.Button btnCommand; + private global::Gtk.Toolbar toolbar; private global::Gtk.Toolbar toolbar1; private global::Gtk.ScrolledWindow scrolledwindow1; - private global::Gtk.TreeView MatriceUI; + private global::Gtk.TreeView effetsListe; private global::Gtk.Label titreLabel; protected virtual void Build () @@ -48,6 +52,10 @@ namespace DMX2 w2.Add (this.mediaPauseAction, null); this.mediaNextAction = new global::Gtk.Action ("mediaNextAction", null, null, "gtk-media-next"); w2.Add (this.mediaNextAction, null); + this.btnAjoutLigne = new global::Gtk.Action ("btnAjoutLigne", null, null, "gtk-add"); + w2.Add (this.btnAjoutLigne, null); + this.btnRetireligne = new global::Gtk.Action ("btnRetireligne", null, null, "gtk-remove"); + w2.Add (this.btnRetireligne, null); this.UIManager.InsertActionGroup (w2, 0); this.Name = "DMX2.SeqMacroUI"; // Container child DMX2.SeqMacroUI.Gtk.Container+ContainerChild @@ -88,13 +96,13 @@ namespace DMX2 w3.Expand = false; w3.Fill = false; // Container child hbox2.Gtk.Box+BoxChild - this.label56 = new global::Gtk.Label (); - this.label56.Name = "label56"; - this.label56.Xpad = 10; - this.label56.LabelProp = global::Mono.Unix.Catalog.GetString ("00.0"); - this.label56.UseMarkup = true; - this.hbox2.Add (this.label56); - global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.label56])); + this.timeLabel = new global::Gtk.Label (); + this.timeLabel.Name = "timeLabel"; + this.timeLabel.Xpad = 10; + this.timeLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("00.0"); + this.timeLabel.UseMarkup = true; + this.hbox2.Add (this.timeLabel); + global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.timeLabel])); w4.PackType = ((global::Gtk.PackType)(1)); w4.Position = 1; w4.Expand = false; @@ -121,29 +129,62 @@ namespace DMX2 w6.Expand = false; w6.Fill = false; // Container child vbox3.Gtk.Box+BoxChild - this.pbTrans = new global::Gtk.ProgressBar (); - this.pbTrans.HeightRequest = 15; - this.pbTrans.Name = "pbTrans"; - this.vbox3.Add (this.pbTrans); - global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.pbTrans])); - w7.Position = 2; - w7.Expand = false; - w7.Fill = false; + this.hbox3 = new global::Gtk.HBox (); + this.hbox3.Name = "hbox3"; + this.hbox3.Spacing = 6; + // Container child hbox3.Gtk.Box+BoxChild + this.txtCommand = new global::Gtk.Entry (); + this.txtCommand.CanFocus = true; + this.txtCommand.Name = "txtCommand"; + this.txtCommand.IsEditable = true; + this.txtCommand.InvisibleChar = '●'; + this.hbox3.Add (this.txtCommand); + global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.txtCommand])); + w7.Position = 0; + // Container child hbox3.Gtk.Box+BoxChild + this.btnCommand = new global::Gtk.Button (); + this.btnCommand.CanFocus = true; + this.btnCommand.Name = "btnCommand"; + this.btnCommand.UseUnderline = true; + // Container child btnCommand.Gtk.Container+ContainerChild + global::Gtk.Alignment w8 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); + // Container child GtkAlignment.Gtk.Container+ContainerChild + global::Gtk.HBox w9 = new global::Gtk.HBox (); + w9.Spacing = 2; + // Container child GtkHBox.Gtk.Container+ContainerChild + global::Gtk.Image w10 = new global::Gtk.Image (); + w10.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-ok", global::Gtk.IconSize.Menu); + w9.Add (w10); + // Container child GtkHBox.Gtk.Container+ContainerChild + global::Gtk.Label w12 = new global::Gtk.Label (); + w12.LabelProp = global::Mono.Unix.Catalog.GetString ("Ok"); + w12.UseUnderline = true; + w9.Add (w12); + w8.Add (w9); + this.btnCommand.Add (w8); + this.hbox3.Add (this.btnCommand); + global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.btnCommand])); + w16.Position = 1; + w16.Expand = false; + w16.Fill = false; + this.vbox3.Add (this.hbox3); + global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox3])); + w17.Position = 2; + w17.Expand = false; + w17.Fill = false; // Container child vbox3.Gtk.Box+BoxChild - this.UIManager.AddUiFromString (""); - this.toolbar2 = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar2"))); - this.toolbar2.Name = "toolbar2"; - this.toolbar2.ShowArrow = false; - this.vbox3.Add (this.toolbar2); - global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.toolbar2])); - w8.Position = 3; - w8.Expand = false; - w8.Fill = false; + this.UIManager.AddUiFromString (""); + this.toolbar = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar"))); + this.toolbar.Name = "toolbar"; + this.toolbar.ShowArrow = false; + this.vbox3.Add (this.toolbar); + global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.toolbar])); + w18.Position = 3; + w18.Expand = false; + w18.Fill = false; this.hbox1.Add (this.vbox3); - global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox3])); - w9.Position = 0; - w9.Expand = false; - w9.Fill = false; + global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox3])); + w19.Position = 0; // Container child hbox1.Gtk.Box+BoxChild this.UIManager.AddUiFromString (""); this.toolbar1 = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar1"))); @@ -153,29 +194,29 @@ namespace DMX2 this.toolbar1.ToolbarStyle = ((global::Gtk.ToolbarStyle)(0)); this.toolbar1.IconSize = ((global::Gtk.IconSize)(2)); this.hbox1.Add (this.toolbar1); - global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.toolbar1])); - w10.PackType = ((global::Gtk.PackType)(1)); - w10.Position = 1; - w10.Expand = false; - w10.Fill = false; + global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.toolbar1])); + w20.PackType = ((global::Gtk.PackType)(1)); + w20.Position = 1; + w20.Expand = false; + w20.Fill = false; this.vbox2.Add (this.hbox1); - global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1])); - w11.Position = 0; - w11.Expand = false; - w11.Fill = false; + global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1])); + w21.Position = 0; + w21.Expand = false; + w21.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.scrolledwindow1 = new global::Gtk.ScrolledWindow (); this.scrolledwindow1.CanFocus = true; this.scrolledwindow1.Name = "scrolledwindow1"; this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child scrolledwindow1.Gtk.Container+ContainerChild - this.MatriceUI = new global::Gtk.TreeView (); - this.MatriceUI.CanFocus = true; - this.MatriceUI.Name = "MatriceUI"; - this.scrolledwindow1.Add (this.MatriceUI); + this.effetsListe = new global::Gtk.TreeView (); + this.effetsListe.CanFocus = true; + this.effetsListe.Name = "effetsListe"; + this.scrolledwindow1.Add (this.effetsListe); this.vbox2.Add (this.scrolledwindow1); - global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow1])); - w13.Position = 1; + global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow1])); + w23.Position = 1; this.alignment1.Add (this.vbox2); this.GtkAlignment.Add (this.alignment1); this.frame1.Add (this.GtkAlignment); @@ -192,6 +233,14 @@ namespace DMX2 this.Hide (); this.closeAction.Activated += new global::System.EventHandler (this.OnCloseActionActivated); this.circuitsAction.Activated += new global::System.EventHandler (this.OnCircuitsActionActivated); + this.goForwardAction.Activated += new global::System.EventHandler (this.OnGoForwardActionActivated); + this.goBackAction.Activated += new global::System.EventHandler (this.OnGoBackActionActivated); + this.mediaPauseAction.Activated += new global::System.EventHandler (this.OnMediaPauseActionActivated); + this.btnAjoutLigne.Activated += new global::System.EventHandler (this.OnBtnAjoutLigneActivated); + this.btnRetireligne.Activated += new global::System.EventHandler (this.OnRemoveLigneActivated); + this.seqMasterScale.ValueChanged += new global::System.EventHandler (this.OnSeqMasterScaleValueChanged); + this.btnCommand.Clicked += new global::System.EventHandler (this.OnBtnCommandClicked); + this.effetsListe.CursorChanged += new global::System.EventHandler (this.OnEffetsListeCursorChanged); } } } diff --git a/DMX-2.0/gtk-gui/gui.stetic b/DMX-2.0/gtk-gui/gui.stetic index 37a6afa..08ed2ec 100644 --- a/DMX-2.0/gtk-gui/gui.stetic +++ b/DMX-2.0/gtk-gui/gui.stetic @@ -264,13 +264,14 @@ - + True TextAndIcon stock:gtk-no Dnd True + 4 @@ -280,13 +281,14 @@ - + True TextAndIcon stock:gtk-media-pause Dnd True + 5 @@ -330,7 +332,7 @@ - 150 + 75 True 100 10 @@ -344,8 +346,6 @@ 8 False - False - False @@ -1538,7 +1538,7 @@ - + Toggle @@ -1559,22 +1559,37 @@ Action gtk-go-forward + Action gtk-go-back + Action gtk-media-pause + Action gtk-media-next + + Action + + gtk-add + + + + Action + + gtk-remove + + False @@ -1621,7 +1636,7 @@ - + 10 <big>00.0</big> @@ -1654,6 +1669,7 @@ True 0 Right + 1 @@ -1663,9 +1679,38 @@ - + - 15 + 6 + + + + True + True + + + + 0 + True + + + + + + True + TextAndIcon + stock:gtk-ok Menu + Ok + True + + + + 1 + True + False + False + + 2 @@ -1675,14 +1720,15 @@ - + False - + - + + @@ -1695,9 +1741,7 @@ 0 - True - False - False + False @@ -1707,7 +1751,7 @@ False Icons SmallToolbar - + @@ -1734,9 +1778,10 @@ True In - + True +