From acd01db3fc42bb074b9ec7294fa4763a2f22cbe5 Mon Sep 17 00:00:00 2001 From: Tzim Date: Fri, 30 Jun 2017 11:01:30 +0200 Subject: [PATCH] Copie Seq Macro -> Seq Midi --- DMX-2.0/DMX-2.0.csproj | 5 +- DMX-2.0/SeqMidiUI.cs | 456 ++++++++++++++++++ DMX-2.0/SequenceurMidi.cs | 718 +++++++++++++++++++++++++++++ DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs | 111 +++-- DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs | 286 ++++++++++++ DMX-2.0/gtk-gui/gui.stetic | 298 ++++++++++++ 6 files changed, 1826 insertions(+), 48 deletions(-) create mode 100644 DMX-2.0/SeqMidiUI.cs create mode 100644 DMX-2.0/SequenceurMidi.cs create mode 100644 DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs diff --git a/DMX-2.0/DMX-2.0.csproj b/DMX-2.0/DMX-2.0.csproj index 8689edd..d0e28d1 100644 --- a/DMX-2.0/DMX-2.0.csproj +++ b/DMX-2.0/DMX-2.0.csproj @@ -137,6 +137,9 @@ + + + @@ -150,4 +153,4 @@ - \ No newline at end of file + diff --git a/DMX-2.0/SeqMidiUI.cs b/DMX-2.0/SeqMidiUI.cs new file mode 100644 index 0000000..dae55d8 --- /dev/null +++ b/DMX-2.0/SeqMidiUI.cs @@ -0,0 +1,456 @@ +/* + + Copyright (C) Arnaud Houdelette 2012-2014 + Copyright (C) Emmanuel Langlois 2012-2014 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using Gtk; +using System.Text; + +namespace DMX2 +{ + [System.ComponentModel.ToolboxItem(true)] + public partial class SeqMidiUI : SequenceurUI + { + bool fullUpdFlag = true; + bool updating; + SequenceurMidi 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 () + { + effetChange = true; + } + + DateTime nextMaj = DateTime.Now; + + void RenamePopup (object sender, ContextMenuEventArgs e) + { + 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)); + effetsListe.AppendColumn (idCol); + + + var nomCol = new Gtk.TreeViewColumn (); + var nomCell = new Gtk.CellRendererText (); + nomCol.Title = "Nom"; + nomCol.PackStart (nomCell, true); + nomCol.SetCellDataFunc (nomCell, new Gtk.TreeCellDataFunc (RenderMatriceNom)); + nomCol.Resizable = true; + nomCell.Editable = true; + nomCell.Edited += OnNomCellEdited; + effetsListe.AppendColumn (nomCol); + + var topCol = new Gtk.TreeViewColumn (); + var topCell = new Gtk.CellRendererText (); + topCol.Title = "Top"; + topCol.PackStart (topCell, true); + topCol.SetCellDataFunc (topCell, new Gtk.TreeCellDataFunc (RenderMatriceTop)); + topCell.Editable = true; + topCell.Edited += OnTopCellEdited; + effetsListe.AppendColumn (topCol); + + var circuitsCol = new Gtk.TreeViewColumn (); + var circuitsCell = new Gtk.CellRendererText (); + circuitsCol.Title = "Circuits"; + circuitsCol.PackStart (circuitsCell, true); + circuitsCol.SetCellDataFunc (circuitsCell, new Gtk.TreeCellDataFunc (RenderMatriceCircuits)); + circuitsCol.Resizable = true; + circuitsCell.Editable = true; + 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 (valeurCell, new Gtk.TreeCellDataFunc (RenderMatriceValeur)); + valeurCell.Editable = true; + valeurCell.Edited += OnValeurCellEdited; + effetsListe.AppendColumn (valeurCol); + + var tempsCol = new Gtk.TreeViewColumn (); + var tempsCell = new Gtk.CellRendererText (); + tempsCol.Title = "Temps"; + tempsCol.PackStart (tempsCell, true); + tempsCol.SetCellDataFunc (tempsCell, new Gtk.TreeCellDataFunc (RenderMatriceTemps)); + tempsCell.Editable = true; + tempsCell.Edited += OnTempsCellEdited; + effetsListe.AppendColumn (tempsCol); + + lsEffets = new Gtk.ListStore(typeof (SequenceurMacro.Ligne)); + this.effetsListe.Model = lsEffets; + UpdListeEffets(); + } + + void RenderMatriceNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) + { + if (Conduite.Courante==null) return; + string num=string.Empty; + SequenceurMidi.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMidi.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(); + + } + + 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; + } + + 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(); + } + + 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; + } + + 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(); + + } + + 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(); + } + + 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 SeqMidiUI (SequenceurMidi s ) : base (s) + { + this.Build (); + titreLabel.Text = s.Name; + sequenceur = s; + ConstruitMatrice (); + + + new ContextMenuHelper(seqMasterScale,MasterPopup); + new ContextMenuHelper(frame1,RenamePopup); + new ContextMenuHelper(evBBox,CompteurPopup); + + + } + + void MasterPopup (object sender, ContextMenuEventArgs e) + { + Menu m = Conduite.Courante.EventManager.GetMenu(null, + delegate(object o,string eventId){ + sequenceur.BindMasterEvent(eventId); + } + ); + m.ShowAll(); + m.Popup(); + } + + void CompteurPopup (object sender, ContextMenuEventArgs e) + { + Menu m = new Menu(); + + MenuItem item = new MenuItem("Effet Suivant"); + m.Add(item); + item.Submenu = Conduite.Courante.EventManager.GetMenu(null, + delegate(object o,string eventId){ + sequenceur.BindEffetSuivantEvent(eventId); + } + ); + + item = new MenuItem("Effet Precedent"); + m.Add(item); + item.Submenu = Conduite.Courante.EventManager.GetMenu(null, + delegate(object o,string eventId){ + sequenceur.BindEffetPrecedentEvent(eventId); + } + ); + + m.ShowAll(); + m.Popup(); + + } + + + 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 (effetChange) { + //UpdListeEffets(); + effetsListe.QueueDraw(); + SelectionneEffet (sequenceur.IndexLigneEnCours); + posLabel.Text = string.Format("n°{0}",sequenceur.IndexLigneEnCours +1 ); + } + updating = true; + seqMasterScale.Value = sequenceur.Master; + updating = false; + + if (DateTime.Now > nextMaj ) { + nextMaj = DateTime.Now.AddMilliseconds(500); + StringBuilder str = new StringBuilder (); + bool a = false; + foreach (Circuit c in sequenceur.Circuits) { + if (sequenceur.ValeurBruteCircuit (c) > 0) { + if (sequenceur.EstActif (c) != a) { + if(!a){ + str.Append (""); + a = true; + } else { + str.Append (""); + a = false; + } + } + str.Append (c.ID); str.Append (' '); + } + } + if (a) { + str.Append (""); + a = false; + } + actLabel.LabelProp = str.ToString (); + } + } + + + 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 + Window win = this.GetAncestor(Gtk.Window.GType) as Window; + var dlg = new SelSeqCircuits (sequenceur.Circuits,win); + if ((ResponseType)dlg.Run () == ResponseType.Ok) { + sequenceur.ChangeCircuits(dlg.GetResultList()); + } + dlg.Destroy(); + fullUpdFlag = true; + } + + protected void OnCloseActionActivated (object sender, EventArgs e) + { + this.Destroy(); + } + + protected void FullUpdate () + { + fullUpdFlag = true; + + 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) + { + 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 (updating)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 ); + + } + + + protected void OnHbox2SizeAllocated (object o, SizeAllocatedArgs args) + { + actLabel.SetSizeRequest ( Math.Max(50, args.Allocation.Width - posLabel.Allocation.Width - timeLabel.Allocation.Width - 50),-1); + } + + + } +} + diff --git a/DMX-2.0/SequenceurMidi.cs b/DMX-2.0/SequenceurMidi.cs new file mode 100644 index 0000000..3da5490 --- /dev/null +++ b/DMX-2.0/SequenceurMidi.cs @@ -0,0 +1,718 @@ +/* + + Copyright (C) Arnaud Houdelette 2012-2014 + Copyright (C) Emmanuel Langlois 2012-2014 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using System.Xml; +using System.Collections.ObjectModel; +using System.Threading; + +namespace DMX2 +{ + public class SequenceurMidi : Sequenceur + { + 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; + } + set { + nom = value; + } + } + + public TimeSpan Top { + get { + return top; + } + set { + top = value; + } + } + + public string Circuits { + get { + return circuits; + } + set { + circuits = value; + } + } + + public int Valeur { + get { + return valeur; + } + set { + valeur = value; + } + } + + public TimeSpan Temps { + get { + return temps; + } + set { + temps = value; + } + } + + + public void Save (XmlElement parent) + { + XmlElement el = parent.OwnerDocument.CreateElement ("Ligne"); + parent.AppendChild (el); + + 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; + } + } + + 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(); + + Ligne aSuivre = null; + Ligne enCours = null; + Ligne ligneMaitre = null; + + TimeSpan timeStamp = TimeSpan.Zero; + TimeSpan topSuivant = TimeSpan.Zero; + bool topPresent = false; + + List circuitsSeq = new List (); + + + Dictionary valeurscourantes = new Dictionary (); + Dictionary effetsEnCours = new Dictionary(); + + actionEventTargetEx masterEventTarget=null; + actionEventTarget goNextEventTarget=null; + actionEventTarget goBackEventTarget=null; + + + SeqMidiUI ui = null; + bool change = false; + int master = 100; + + public int Master { + get { + return master; + } + set { + master = value; + masterEventTarget.FeedBack (); + } + } + + bool paused=false; + + public bool Paused { + get { + return paused; + } + set { + paused = value; + } + } + + public SequenceurMidi () + { + masterEventTarget = new actionEventTargetEx ( + delegate(EventData data) { + Master = 100 * data.value / 255; + return true; + }, + delegate{ + return Master *255/100; + }, + true + ); + + goNextEventTarget = new actionEventTarget ( + delegate(EventData data) { + if(data.value==255) LigneSuivante(); + return true; + } + ); + + goBackEventTarget = new actionEventTarget ( + delegate(EventData data) { + if(data.value==255){ + if (IndexLigneEnCours > 0) { + IndexLigneaSuivre = IndexLigneEnCours - 1; + LigneSuivante (); + } + } + return true; + } + ); + } + + + public int IndexLigneEnCours + { + get { + if (enCours == null) return -1; + return lignes.IndexOf(enCours); + } + } + + + 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) { + 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 { + get { + return timeStamp; + } + } + + + public ReadOnlyCollection Lignes { + get { + return lignes.AsReadOnly(); + } + } + + + public ReadOnlyCollection Circuits { + get { + return circuitsSeq.AsReadOnly (); + } + } + + public void ChangeCircuits (System.Collections.Generic.List list) + { + foreach (var c in circuitsSeq.ToArray()) { + if (!list.Contains (c)) + lock (this) RetireCircuit (c); + } + foreach (var c in list) + if (!circuitsSeq.Contains (c)) + lock (this) AjouteCircuit (c); + circuitsSeq = list; + } + + void AjouteCircuit (Circuit c) + { + valeurscourantes [c] = 0; + } + + void RetireCircuit (Circuit c) + { + circuitsSeq.Remove (c); + valeurscourantes.Remove (c); + } + + /*public override void MajCircuitsSupprimes () + { + lock (this) { + foreach (var c in circuitsSeq.ToArray()) { + if (!Conduite.Courante.Circuits.Contains (c)) + RetireCircuit (c); + } + } + }*/ + + public override int ValeurCircuit (Circuit c) + { + if (!valeurscourantes.ContainsKey (c)) + return 0; + if(master !=100) + return valeurscourantes [c] * master /100; + return valeurscourantes [c]; + } + + public int ValeurBruteCircuit (Circuit c) + { + if (!circuitsSeq.Contains (c)) + return 0; + return valeurscourantes [c]; + } + + public bool EstActif (Circuit c) + { + lock (this) + return effetsEnCours.ContainsKey(c); + } + + public override void Tick (TimeSpan time) + { + if (paused) + return; + timeStamp += time; + + if (Monitor.TryEnter (this)) { + try { + if (effetsEnCours.Count > 0) { + 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 (); + } + } + } + + if (topPresent) { + if (timeStamp > topSuivant) { + LigneSuivante (); + } + } + } finally { + Monitor.Exit (this); + } + } + } + + public void LigneSuivante () + { + lock (this) { + 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.ToLower().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(); + } + } + + void LanceEffetsMacro (bool ecrase, TimeSpan tempsMatrice) + { + lock (this) { + 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)) + { + lock(this) + effetsEnCours[c] = new EffetMacro(temps,valeurscourantes[c],valeurCible); + } + } + } + } + + + public bool LigneChange () + { + if (change) { + change = false; + return true; + } + return false; + } + + public override void Save (System.Xml.XmlElement parent) + { + System.Xml.XmlElement el = parent.OwnerDocument.CreateElement ("SequenceurMidi"); + System.Xml.XmlElement xmlEl; + + parent.AppendChild (el); + el.SetAttribute ("id", ID.ToString ()); + el.SetAttribute ("name", Name); + //el.SetAttribute ("master", master.ToString ()); + + el.AppendChild(xmlEl = parent.OwnerDocument.CreateElement ("Master")); + xmlEl.SetAttribute("value",master.ToString()); + Conduite.Courante.EventManager.SaveBindings(xmlEl,masterEventTarget); + + xmlEl = parent.OwnerDocument.CreateElement ("EffetSuivant"); + if(Conduite.Courante.EventManager.SaveBindings(xmlEl,goNextEventTarget )) el.AppendChild(xmlEl); + + xmlEl = parent.OwnerDocument.CreateElement ("EffetPrecedent"); + if(Conduite.Courante.EventManager.SaveBindings(xmlEl,goBackEventTarget )) el.AppendChild(xmlEl); + + foreach (Circuit c in circuitsSeq) { + el.AppendChild(xmlEl = parent.OwnerDocument.CreateElement ("CircuitSeq")); + xmlEl.SetAttribute("id",c.ID.ToString()); + } + + foreach (Ligne li in lignes) { + li.Save(el); + } + + } + + + public override SequenceurUI GetUI () + { + + if (ui == null) { + ui = new SeqMidiUI (this); + ui.Destroyed += UiDestroyed; + } + + return ui; + } + + void UiDestroyed (object sender, EventArgs e) + { + ui = null; + } + + public void BindMasterEvent (string eventId) + { + if(eventId.Length==0) + { + Conduite.Courante.EventManager.Unbind(masterEventTarget); + return; + } + Conduite.Courante.EventManager.Bind(eventId,masterEventTarget); + } + + public void BindEffetSuivantEvent (string eventId) + { + if (eventId.Length == 0) { + Conduite.Courante.EventManager.Unbind (goNextEventTarget); + return; + } + Conduite.Courante.EventManager.Bind(eventId,goNextEventTarget); + } + + public void BindEffetPrecedentEvent (string eventId) + { + if (eventId.Length == 0) { + Conduite.Courante.EventManager.Unbind (goBackEventTarget); + return; + } + Conduite.Courante.EventManager.Bind(eventId,goBackEventTarget); + } + + + public static new SequenceurMidi Load (Conduite conduite, System.Xml.XmlElement el) + { + SequenceurMidi seq = new SequenceurMidi(); + seq.LoadSeq(conduite,el); + return seq; + } + + private void LoadSeq (Conduite conduite, System.Xml.XmlElement el) + { + ID = int.Parse (el.GetAttribute ("id")); + Name = el.GetAttribute ("name"); + + XmlElement xmlE; + + if ((xmlE = el["Master"]) != null) { + master = int.Parse (xmlE.TryGetAttribute("value","100")); + foreach(string id in EventManager.LoadBindings(xmlE)) + BindMasterEvent(id); + } + else master = int.Parse (el.TryGetAttribute("master","100")); + + if ((xmlE = el["EffetSuivant"])!= null) + foreach(string id in EventManager.LoadBindings(xmlE)) + BindEffetSuivantEvent(id); + + if ((xmlE = el["EffetPrecedent"])!= null) + foreach(string id in EventManager.LoadBindings(xmlE)) + BindEffetPrecedentEvent(id); + + foreach (var xc in el.GetElementsByTagName("CircuitSeq")) { + System.Xml.XmlElement xcir = xc as System.Xml.XmlElement; + Circuit c = conduite.GetCircuitByID (int.Parse (xcir.GetAttribute ("id"))); + circuitsSeq.Add (c); + AjouteCircuit (c); + } + + 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); + } + } + + static System.Text.RegularExpressions.Regex regexCommand1 = new System.Text.RegularExpressions.Regex( + @"(?\d+)(t(?\d+))?", + System.Text.RegularExpressions.RegexOptions.Compiled); + + static System.Text.RegularExpressions.Regex regexCommand2 = new System.Text.RegularExpressions.Regex( + @"(?\d+)(?(t\d+)?)?", + System.Text.RegularExpressions.RegexOptions.Compiled); + + + + public override void Command (string command) + { + lock (this) { + var cmd = regexCommand1.Match(command); + + if (cmd.Success) { + if (cmd.Groups ["effet"].Success) { + int effet = int.Parse (cmd.Groups ["effet"].Value) - 1; + int transition=-1; + + if(effet>=lignes.Count) return; + enCours = lignes[effet]; + ligneMaitre = enCours; + timeStamp = TimeSpan.Zero; + + topPresent = false; + 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(); + + } + + } + } + } + + void CommandAdd (int index) + { + lock (Conduite.Courante.SequenceurMaitre) { + string[] commands = Conduite.Courante.SequenceurMaitre.GetCommands (this); + + for (int i = 0; i < commands.Length; i++) { + var cmd = regexCommand2.Match(commands[i]); + if(cmd.Success){ + int ef = int.Parse(cmd.Groups["effet"].Value); + if (ef-1>index) { + ef++; + commands[i] = ef.ToString() + cmd.Groups["params"].Value; + } + } + } + Conduite.Courante.SequenceurMaitre.SetCommands(this,commands); + } + } + + void CommandRemove (int index) + { + lock (Conduite.Courante.SequenceurMaitre) { + string[] commands = Conduite.Courante.SequenceurMaitre.GetCommands (this); + + for (int i = 0; i < commands.Length; i++) { + var cmd = regexCommand2.Match(commands[i]); + if(cmd.Success){ + int ef = int.Parse(cmd.Groups["effet"].Value); + if (ef-1 == index) + commands[i] = string.Empty; + else if (ef-1>index) { + ef--; + commands[i] = ef.ToString() + cmd.Groups["params"].Value; + } + } + } + Conduite.Courante.SequenceurMaitre.SetCommands(this,commands); + } + } + + void CommandSwap (int index) + { + lock (Conduite.Courante.SequenceurMaitre) { + string[] commands = Conduite.Courante.SequenceurMaitre.GetCommands (this); + + // numeros a swapper + int a = index+1; + int b = index+2; + + for (int i = 0; i < commands.Length; i++) { + var cmd = regexCommand2.Match(commands[i]); + if(cmd.Success){ + int ef = int.Parse(cmd.Groups["effet"].Value); + if (ef == a) + commands[i] = b.ToString() + cmd.Groups["params"].Value; + if (ef == b) + commands[i] = a.ToString() + cmd.Groups["params"].Value; + } + } + Conduite.Courante.SequenceurMaitre.SetCommands(this,commands); + } + } + + } +} diff --git a/DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs b/DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs index 3199b2f..eaf944d 100644 --- a/DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs +++ b/DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs @@ -5,33 +5,61 @@ namespace DMX2 public partial class SeqMacroUI { private global::Gtk.UIManager UIManager; + private global::Gtk.ToggleAction closeAction; + private global::Gtk.Action circuitsAction; + private global::Gtk.Action goForwardAction; + 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; + private global::Gtk.VBox vbox2; + private global::Gtk.HBox hbox1; + private global::Gtk.VBox vbox3; + private global::Gtk.EventBox evBBox; + private global::Gtk.HBox hbox2; + private global::Gtk.Label posLabel; + private global::Gtk.Label actLabel; + private global::Gtk.Label timeLabel; + private global::Gtk.HScale seqMasterScale; + 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 effetsListe; + private global::Gtk.Label titreLabel; protected virtual void Build () @@ -135,10 +163,10 @@ namespace DMX2 this.seqMasterScale = new global::Gtk.HScale (null); this.seqMasterScale.CanFocus = true; this.seqMasterScale.Name = "seqMasterScale"; - this.seqMasterScale.Adjustment.Upper = 100; - this.seqMasterScale.Adjustment.PageIncrement = 10; - this.seqMasterScale.Adjustment.StepIncrement = 1; - this.seqMasterScale.Adjustment.Value = 100; + this.seqMasterScale.Adjustment.Upper = 100D; + this.seqMasterScale.Adjustment.PageIncrement = 10D; + this.seqMasterScale.Adjustment.StepIncrement = 1D; + this.seqMasterScale.Adjustment.Value = 100D; this.seqMasterScale.DrawValue = true; this.seqMasterScale.Digits = 0; this.seqMasterScale.ValuePos = ((global::Gtk.PositionType)(1)); @@ -165,49 +193,38 @@ namespace DMX2 this.btnCommand.CanFocus = true; this.btnCommand.Name = "btnCommand"; this.btnCommand.UseUnderline = true; - // Container child btnCommand.Gtk.Container+ContainerChild - global::Gtk.Alignment w10 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); - // Container child GtkAlignment.Gtk.Container+ContainerChild - global::Gtk.HBox w11 = new global::Gtk.HBox (); - w11.Spacing = 2; - // Container child GtkHBox.Gtk.Container+ContainerChild - global::Gtk.Image w12 = new global::Gtk.Image (); - w12.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-ok", global::Gtk.IconSize.Menu); - w11.Add (w12); - // Container child GtkHBox.Gtk.Container+ContainerChild - global::Gtk.Label w14 = new global::Gtk.Label (); - w14.LabelProp = "Ok"; - w14.UseUnderline = true; - w11.Add (w14); - w10.Add (w11); - this.btnCommand.Add (w10); + this.btnCommand.Label = "Ok"; + global::Gtk.Image w10 = new global::Gtk.Image (); + w10.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-ok", global::Gtk.IconSize.Menu); + this.btnCommand.Image = w10; this.hbox3.Add (this.btnCommand); - global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.btnCommand])); - w18.Position = 1; - w18.Expand = false; - w18.Fill = false; + global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.btnCommand])); + w11.Position = 1; + w11.Expand = false; + w11.Fill = false; this.vbox3.Add (this.hbox3); - global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox3])); - w19.Position = 2; - w19.Expand = false; - w19.Fill = false; + global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox3])); + w12.Position = 2; + w12.Expand = false; + w12.Fill = false; // Container child vbox3.Gtk.Box+BoxChild - this.UIManager.AddUiFromString (""); + this.UIManager.AddUiFromString (@""); this.toolbar = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar"))); this.toolbar.Name = "toolbar"; this.toolbar.ShowArrow = false; this.toolbar.ToolbarStyle = ((global::Gtk.ToolbarStyle)(0)); this.toolbar.IconSize = ((global::Gtk.IconSize)(2)); this.vbox3.Add (this.toolbar); - global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.toolbar])); - w20.Position = 3; - w20.Expand = false; - w20.Fill = false; + global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.toolbar])); + w13.Position = 3; + w13.Expand = false; + w13.Fill = false; this.hbox1.Add (this.vbox3); - global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox3])); - w21.Position = 0; + global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox3])); + w14.Position = 0; // Container child hbox1.Gtk.Box+BoxChild - this.UIManager.AddUiFromString (""); + this.UIManager.AddUiFromString ("<" + + "toolitem name=\'circuitsAction\' action=\'circuitsAction\'/>"); this.toolbar1 = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar1"))); this.toolbar1.Name = "toolbar1"; this.toolbar1.Orientation = ((global::Gtk.Orientation)(1)); @@ -215,16 +232,16 @@ 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 w22 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.toolbar1])); - w22.PackType = ((global::Gtk.PackType)(1)); - w22.Position = 1; - w22.Expand = false; - w22.Fill = false; + global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.toolbar1])); + w15.PackType = ((global::Gtk.PackType)(1)); + w15.Position = 1; + w15.Expand = false; + w15.Fill = false; this.vbox2.Add (this.hbox1); - global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1])); - w23.Position = 0; - w23.Expand = false; - w23.Fill = false; + global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1])); + w16.Position = 0; + w16.Expand = false; + w16.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.scrolledwindow1 = new global::Gtk.ScrolledWindow (); this.scrolledwindow1.CanFocus = true; @@ -237,8 +254,8 @@ namespace DMX2 this.effetsListe.RulesHint = true; this.scrolledwindow1.Add (this.effetsListe); this.vbox2.Add (this.scrolledwindow1); - global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow1])); - w25.Position = 1; + global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow1])); + w18.Position = 1; this.alignment1.Add (this.vbox2); this.GtkAlignment.Add (this.alignment1); this.frame1.Add (this.GtkAlignment); diff --git a/DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs b/DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs new file mode 100644 index 0000000..c105e11 --- /dev/null +++ b/DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs @@ -0,0 +1,286 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace DMX2 +{ + public partial class SeqMidiUI + { + private global::Gtk.UIManager UIManager; + + private global::Gtk.ToggleAction closeAction; + + private global::Gtk.Action circuitsAction; + + private global::Gtk.Action goForwardAction; + + 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; + + private global::Gtk.VBox vbox2; + + private global::Gtk.HBox hbox1; + + private global::Gtk.VBox vbox3; + + private global::Gtk.EventBox evBBox; + + private global::Gtk.HBox hbox2; + + private global::Gtk.Label posLabel; + + private global::Gtk.Label actLabel; + + private global::Gtk.Label timeLabel; + + private global::Gtk.HScale seqMasterScale; + + 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 effetsListe; + + private global::Gtk.Label titreLabel; + + protected virtual void Build () + { + global::Stetic.Gui.Initialize (this); + // Widget DMX2.SeqMidiUI + Stetic.BinContainer w1 = global::Stetic.BinContainer.Attach (this); + this.UIManager = new global::Gtk.UIManager (); + global::Gtk.ActionGroup w2 = new global::Gtk.ActionGroup ("Default"); + this.closeAction = new global::Gtk.ToggleAction ("closeAction", " ", null, "gtk-close"); + this.closeAction.ShortLabel = " "; + w2.Add (this.closeAction, null); + this.circuitsAction = new global::Gtk.Action ("circuitsAction", null, "Association des circuits\nau sequenceur", "circuits"); + w2.Add (this.circuitsAction, null); + this.goForwardAction = new global::Gtk.Action ("goForwardAction", null, null, "gtk-go-forward"); + w2.Add (this.goForwardAction, null); + this.goBackAction = new global::Gtk.Action ("goBackAction", null, null, "gtk-go-back"); + w2.Add (this.goBackAction, null); + this.mediaPauseAction = new global::Gtk.Action ("mediaPauseAction", null, null, "gtk-media-pause"); + 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.SeqMidiUI"; + // Container child DMX2.SeqMidiUI.Gtk.Container+ContainerChild + this.frame1 = new global::Gtk.Frame (); + this.frame1.Name = "frame1"; + this.frame1.ShadowType = ((global::Gtk.ShadowType)(1)); + // Container child frame1.Gtk.Container+ContainerChild + this.GtkAlignment = new global::Gtk.Alignment (0F, 0F, 1F, 1F); + this.GtkAlignment.Name = "GtkAlignment"; + this.GtkAlignment.LeftPadding = ((uint)(12)); + // Container child GtkAlignment.Gtk.Container+ContainerChild + this.alignment1 = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F); + this.alignment1.Name = "alignment1"; + // Container child alignment1.Gtk.Container+ContainerChild + this.vbox2 = new global::Gtk.VBox (); + this.vbox2.Name = "vbox2"; + this.vbox2.Spacing = 6; + // Container child vbox2.Gtk.Box+BoxChild + this.hbox1 = new global::Gtk.HBox (); + this.hbox1.Name = "hbox1"; + this.hbox1.Spacing = 6; + // Container child hbox1.Gtk.Box+BoxChild + this.vbox3 = new global::Gtk.VBox (); + this.vbox3.Name = "vbox3"; + // Container child vbox3.Gtk.Box+BoxChild + this.evBBox = new global::Gtk.EventBox (); + this.evBBox.Name = "evBBox"; + // Container child evBBox.Gtk.Container+ContainerChild + this.hbox2 = new global::Gtk.HBox (); + this.hbox2.WidthRequest = 300; + this.hbox2.Name = "hbox2"; + this.hbox2.Spacing = 6; + // Container child hbox2.Gtk.Box+BoxChild + this.posLabel = new global::Gtk.Label (); + this.posLabel.HeightRequest = 33; + this.posLabel.Name = "posLabel"; + this.posLabel.Xpad = 15; + this.posLabel.Xalign = 0F; + this.posLabel.LabelProp = "n° 0"; + this.posLabel.UseMarkup = true; + this.hbox2.Add (this.posLabel); + global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.posLabel])); + w3.Position = 0; + w3.Expand = false; + w3.Fill = false; + // Container child hbox2.Gtk.Box+BoxChild + this.actLabel = new global::Gtk.Label (); + this.actLabel.Name = "actLabel"; + this.actLabel.UseMarkup = true; + this.actLabel.Wrap = true; + this.hbox2.Add (this.actLabel); + global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.actLabel])); + w4.Position = 1; + w4.Fill = false; + // Container child hbox2.Gtk.Box+BoxChild + this.timeLabel = new global::Gtk.Label (); + this.timeLabel.HeightRequest = 33; + this.timeLabel.Name = "timeLabel"; + this.timeLabel.Xpad = 15; + this.timeLabel.LabelProp = "00.0"; + this.timeLabel.UseMarkup = true; + this.hbox2.Add (this.timeLabel); + global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.timeLabel])); + w5.PackType = ((global::Gtk.PackType)(1)); + w5.Position = 2; + w5.Expand = false; + w5.Fill = false; + this.evBBox.Add (this.hbox2); + this.vbox3.Add (this.evBBox); + global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.evBBox])); + w7.Position = 0; + w7.Expand = false; + w7.Fill = false; + // Container child vbox3.Gtk.Box+BoxChild + this.seqMasterScale = new global::Gtk.HScale (null); + this.seqMasterScale.CanFocus = true; + this.seqMasterScale.Name = "seqMasterScale"; + this.seqMasterScale.Adjustment.Upper = 100D; + this.seqMasterScale.Adjustment.PageIncrement = 10D; + this.seqMasterScale.Adjustment.StepIncrement = 1D; + this.seqMasterScale.Adjustment.Value = 100D; + this.seqMasterScale.DrawValue = true; + this.seqMasterScale.Digits = 0; + this.seqMasterScale.ValuePos = ((global::Gtk.PositionType)(1)); + this.vbox3.Add (this.seqMasterScale); + global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.seqMasterScale])); + w8.Position = 1; + w8.Expand = false; + w8.Fill = false; + // Container child vbox3.Gtk.Box+BoxChild + 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 w9 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.txtCommand])); + w9.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; + this.btnCommand.Label = "Ok"; + global::Gtk.Image w10 = new global::Gtk.Image (); + w10.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-ok", global::Gtk.IconSize.Menu); + this.btnCommand.Image = w10; + this.hbox3.Add (this.btnCommand); + global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.btnCommand])); + w11.Position = 1; + w11.Expand = false; + w11.Fill = false; + this.vbox3.Add (this.hbox3); + global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox3])); + w12.Position = 2; + w12.Expand = false; + w12.Fill = false; + // Container child vbox3.Gtk.Box+BoxChild + this.UIManager.AddUiFromString (@""); + this.toolbar = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar"))); + this.toolbar.Name = "toolbar"; + this.toolbar.ShowArrow = false; + this.toolbar.ToolbarStyle = ((global::Gtk.ToolbarStyle)(0)); + this.toolbar.IconSize = ((global::Gtk.IconSize)(2)); + this.vbox3.Add (this.toolbar); + global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.toolbar])); + w13.Position = 3; + w13.Expand = false; + w13.Fill = false; + this.hbox1.Add (this.vbox3); + global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox3])); + w14.Position = 0; + // Container child hbox1.Gtk.Box+BoxChild + this.UIManager.AddUiFromString ("<" + + "toolitem name=\'circuitsAction\' action=\'circuitsAction\'/>"); + this.toolbar1 = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar1"))); + this.toolbar1.Name = "toolbar1"; + this.toolbar1.Orientation = ((global::Gtk.Orientation)(1)); + this.toolbar1.ShowArrow = false; + this.toolbar1.ToolbarStyle = ((global::Gtk.ToolbarStyle)(0)); + this.toolbar1.IconSize = ((global::Gtk.IconSize)(2)); + this.hbox1.Add (this.toolbar1); + global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.toolbar1])); + w15.PackType = ((global::Gtk.PackType)(1)); + w15.Position = 1; + w15.Expand = false; + w15.Fill = false; + this.vbox2.Add (this.hbox1); + global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1])); + w16.Position = 0; + w16.Expand = false; + w16.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.effetsListe = new global::Gtk.TreeView (); + this.effetsListe.CanFocus = true; + this.effetsListe.Name = "effetsListe"; + this.effetsListe.RulesHint = true; + this.scrolledwindow1.Add (this.effetsListe); + this.vbox2.Add (this.scrolledwindow1); + global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow1])); + w18.Position = 1; + this.alignment1.Add (this.vbox2); + this.GtkAlignment.Add (this.alignment1); + this.frame1.Add (this.GtkAlignment); + this.titreLabel = new global::Gtk.Label (); + this.titreLabel.Name = "titreLabel"; + this.titreLabel.LabelProp = "Séquenceur Macro"; + this.titreLabel.UseMarkup = true; + this.frame1.LabelWidget = this.titreLabel; + this.Add (this.frame1); + if ((this.Child != null)) { + this.Child.ShowAll (); + } + w1.SetUiManager (UIManager); + 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.hbox2.SizeAllocated += new global::Gtk.SizeAllocatedHandler (this.OnHbox2SizeAllocated); + 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 1303625..47df39a 100644 --- a/DMX-2.0/gtk-gui/gui.stetic +++ b/DMX-2.0/gtk-gui/gui.stetic @@ -2011,6 +2011,304 @@ au sequenceur + + + + Toggle + + + gtk-close + False + False + + + + Action + + circuits + Association des circuits +au sequenceur + + + + Action + + gtk-go-forward + + + + Action + + gtk-go-back + + + + Action + + gtk-media-pause + + + + Action + + gtk-media-next + + + Action + + gtk-add + + + + Action + + gtk-remove + + + + + False + + + + In + + + + 0 + 0 + 12 + + + + + + + 6 + + + + 6 + + + + + + + + + + 300 + 6 + + + + + 33 + 15 + 0 + <big>n° 0</big> + True + + + 0 + True + False + False + + + + + + True + True + + + 1 + False + False + + + + + + 33 + 15 + <big>00.0</big> + True + + + End + 2 + False + False + False + + + + + + + 0 + True + False + False + + + + + + True + 100 + 10 + 1 + 100 + True + 0 + Right + + + + 1 + True + False + False + + + + + + 6 + + + + True + True + + + + 0 + True + + + + + + True + TextAndIcon + stock:gtk-ok Menu + Ok + True + + + + 1 + True + False + False + + + + + 2 + True + False + False + + + + + + False + Icons + SmallToolbar + + + + + + + + + + 3 + True + False + False + + + + + 0 + False + + + + + + Vertical + False + Icons + SmallToolbar + + + + + + + End + 1 + True + False + False + + + + + 0 + True + False + False + + + + + + True + In + + + + True + True + + + + + + 1 + True + + + + + + + + + + + + Séquenceur Macro + True + + + label_item + + + + + CenterOnParent