diff --git a/DMX-2.0/MainWindow.cs b/DMX-2.0/MainWindow.cs
index 1b3ca14..70f56f3 100644
--- a/DMX-2.0/MainWindow.cs
+++ b/DMX-2.0/MainWindow.cs
@@ -25,43 +25,8 @@ namespace DMX2
MajWidgets();
}
- protected void MajWidgets ()
- {
- if (Conduite.Courante != null) {
- //Activation / Désactivation des boutons en fonction de l'état de la counduite courante
- showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = true;
- openAction.Sensitive = newAction.Sensitive = false;
- this.Title = "DMX 2.0 - " + Conduite.Courante.Name;
- ConstruitMatrice();
- } else {
- showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = false;
- openAction.Sensitive = newAction.Sensitive = true;
- this.Title = "DMX 2.0";
- }
- }
-
- protected void MajCircuits (bool full)
- {
- // Ajoute une ProgressBar par circuit, met a jour le texte si necessaire
- ProgressBar pb;int i = 0;
- if (full) {
- foreach (var widget in vboxCircuits.Children)
- vboxCircuits.Remove (widget);
- foreach (var circuit in Conduite.Courante.Circuits) {
- vboxCircuits.PackStart (pb=new ProgressBar (),false,false,0);
- pb.Text = (++i).ToString() + " - " + circuit.Name;
- pb.HeightRequest = 22;
- pb.Data[circuitKey] = circuit;
- }
- vboxCircuits.ShowAll ();
- }
-
- foreach (var widget in vboxCircuits.Children) {
- pb = (ProgressBar)widget;
- pb.Fraction = (double) (pb.Data[circuitKey] as Circuit).ValeurCourante / 255;
- }
- }
+#region Sequenceur Maitre
protected void ConstruitMatrice ()
{
@@ -100,6 +65,7 @@ namespace DMX2
static object seqkey = new object();
+
void ConstruitMatriceSeqColumns ()
{
@@ -196,6 +162,67 @@ namespace DMX2
SequenceurMaitre.Ligne l = lsMatrice.GetValue(iter,0) as SequenceurMaitre.Ligne;
l[seq] = args.NewText;
}
+
+ int IndexEffetSelectionne()
+ {
+ var sel = MatriceUI.Selection.GetSelectedRows();
+ if(sel.Length ==0) return -1;
+ return MatriceUI.Selection.GetSelectedRows()[0].Indices[0];
+ }
+
+ void SelectionneEffet (int index)
+ {
+ if(index <0 ) return;
+ MatriceUI.SetCursor( new TreePath( new int[1] {index }) ,null,false);
+ }
+
+ protected void OnBtnAjoutLigneClicked (object sender, EventArgs e)
+ {
+ int pos=IndexEffetSelectionne() + 1;
+ Conduite.Courante.SequenceurMaitre.AjoutLigne(pos);
+ FillMatrice();
+ SelectionneEffet(pos);
+ }
+ void OnMatriceNumColClicked (object sender, EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+
+ protected void OnBtnRetireLigneClicked (object sender, EventArgs e)
+ {
+ throw new System.NotImplementedException ();
+ }
+
+ protected void OnBtnGoBackClicked (object sender, EventArgs e)
+ {
+ Conduite.Courante.SequenceurMaitre.EffetPrecedent();
+ //FillMatrice();
+ }
+
+ protected void OnBtnGoClicked (object sender, EventArgs e)
+ {
+ Conduite.Courante.SequenceurMaitre.EffetSuivant();
+ //FillMatrice();
+ }
+
+ protected void OnMatriceUICursorChanged (object sender, EventArgs e)
+ {
+ TreeViewColumn col;
+ TreePath path;
+ MatriceUI.GetCursor (out path, out col);
+
+ if (MatriceUI.Columns [0] == col) {
+ Conduite.Courante.SequenceurMaitre.IndexLigneaSuivre = IndexEffetSelectionne();
+ }
+
+ }
+
+#endregion
+
+#region Application
+
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit ();
@@ -206,13 +233,9 @@ namespace DMX2
Application.Quit ();
}
- protected void OnCircuitsActionActivated (object sender, EventArgs e)
- {
- GestionCircuits gc= new GestionCircuits(this);
- gc.Run();
- gc.Destroy();
- NextUpdateFull();
- }
+#endregion
+
+#region Gestion de la Conduite
protected void OnNewActionActivated (object sender, EventArgs e)
{
@@ -230,8 +253,6 @@ namespace DMX2
}
-
-
protected void OnCloseActionActivated (object sender, EventArgs e)
{
Conduite.Courante.Dispose();
@@ -239,115 +260,6 @@ namespace DMX2
MajWidgets();
}
- // bonton ajout de sequenceur linéraire
- protected void OnSeqLinActionActivated (object sender, EventArgs e)
- {
- Sequenceur s = new SequenceurLineaire();
- Conduite.Courante.AjoutSequenceur(s);
- AddSeqUI(s);
- ConstruitMatriceSeqColumns();
- }
-
- void AddSeqUI (Sequenceur s)
- {
- VBox newvbox = new VBox();
- newvbox.PackStart(s.GetUI(),false,false,0);
- onglets.Add (newvbox);
- onglets.ShowAll();
- }
-
-
- bool updScheduled=false;
- bool fullUpdateFlag=false;
-
- public void NextUpdateFull ()
- {
- fullUpdateFlag=true;
- }
-
-
- public void ScheduleUpdate ()
- {
- if (updScheduled) {
- //Console.WriteLine("{0} Skip !",DateTime.Now);
- return;
- }
- updScheduled=true;
- Gtk.Application.Invoke(new EventHandler(Update));
-
- }
-
- void Update (object sender, EventArgs e)
- {
- foreach (var notebookvbox in onglets.Children) {
- foreach (var sequi in (notebookvbox as VBox).Children) {
- (sequi as SequenceurUI).Update (fullUpdateFlag);
- }
- }
- MajCircuits(fullUpdateFlag);
- fullUpdateFlag=false;
- updScheduled=false;
- if( Conduite.Courante.SequenceurMaitre.EffetChange() )MatriceUI.QueueDraw();
- }
-
- protected void OnMasterScaleValueChanged (object sender, EventArgs e)
- {
- Conduite.Courante.Master = (int)(masterScale.Value);
- }
-
-
- bool isfullscreen=false;
- protected void OnFullscreenAction1Activated (object sender, EventArgs e)
- {
- if (!isfullscreen) {
- Fullscreen ();
- isfullscreen = true;
- } else {
- Unfullscreen();
- isfullscreen = false;
- }
- }
-
- EditionUnivers uDlg = null;
- protected void OnUniversActionActivated (object sender, EventArgs e)
- {
-
- if (uDlg != null) {
- uDlg.Show();
- return;
- }
-
- uDlg = new EditionUnivers(this);
- uDlg.ShowAll();
- uDlg.Destroyed += udlgDestroyed;
-
- }
-
- void udlgDestroyed (object sender, EventArgs e)
- {
- uDlg=null;
- }
-
- protected void OnShowAllActionActivated (object sender, EventArgs e)
- {
- foreach (var notebookvbox in onglets.Children)
- notebookvbox.Destroy();
-
- foreach (Sequenceur s in Conduite.Courante.Sequenceurs) {
- VBox newvbox = new VBox();
- newvbox.PackStart(s.GetUI(),false,false,0);
- onglets.Add (newvbox);
- onglets.ShowAll();
- }
-
- }
- protected void OnConnectActionActivated (object sender, EventArgs e)
- {
-
- Conduite.Courante.Drivers.Add( new DriverBoitierV1());
-
- }
-
protected void OnSaveActionActivated (object sender, EventArgs e)
{
if(conduiteFile==null)
@@ -467,69 +379,179 @@ namespace DMX2
NextUpdateFull();
}
- int IndexEffetSelectionne()
+#endregion
+
+#region Gestion des Circuits
+
+ protected void OnCircuitsActionActivated (object sender, EventArgs e)
{
- var sel = MatriceUI.Selection.GetSelectedRows();
- if(sel.Length ==0) return -1;
- return MatriceUI.Selection.GetSelectedRows()[0].Indices[0];
+ GestionCircuits gc= new GestionCircuits(this);
+ gc.Run();
+ gc.Destroy();
+ NextUpdateFull();
}
- void SelectionneEffet (int index)
+#endregion
+
+#region Gestion des Sequenceurs
+
+ // bonton ajout de sequenceur linéraire
+ protected void OnSeqLinActionActivated (object sender, EventArgs e)
{
- if(index <0 ) return;
- MatriceUI.SetCursor( new TreePath( new int[1] {index }) ,null,false);
+ Sequenceur s = new SequenceurLineaire();
+ Conduite.Courante.AjoutSequenceur(s);
+ AddSeqUI(s);
+ ConstruitMatriceSeqColumns();
}
- protected void OnBtnAjoutLigneClicked (object sender, EventArgs e)
+ void AddSeqUI (Sequenceur s)
{
- int pos=IndexEffetSelectionne() + 1;
- Conduite.Courante.SequenceurMaitre.AjoutLigne(pos);
- FillMatrice();
- SelectionneEffet(pos);
- }
- void OnMatriceNumColClicked (object sender, EventArgs e)
- {
- throw new NotImplementedException ();
+ VBox newvbox = new VBox();
+ newvbox.PackStart(s.GetUI(),false,false,0);
+ onglets.Add (newvbox);
+ onglets.ShowAll();
}
-
-
- protected void OnBtnRetireLigneClicked (object sender, EventArgs e)
+ protected void OnShowAllActionActivated (object sender, EventArgs e)
{
- throw new System.NotImplementedException ();
- }
+ foreach (var notebookvbox in onglets.Children)
+ notebookvbox.Destroy();
- protected void OnBtnGoBackClicked (object sender, EventArgs e)
- {
- Conduite.Courante.SequenceurMaitre.EffetPrecedent();
- //FillMatrice();
- }
-
- protected void OnBtnGoClicked (object sender, EventArgs e)
- {
- Conduite.Courante.SequenceurMaitre.EffetSuivant();
- //FillMatrice();
- }
-
- protected void OnMatriceUICursorChanged (object sender, EventArgs e)
- {
- TreeViewColumn col;
- TreePath path;
- MatriceUI.GetCursor (out path, out col);
-
- if (MatriceUI.Columns [0] == col) {
- Conduite.Courante.SequenceurMaitre.IndexLigneaSuivre = IndexEffetSelectionne();
+ foreach (Sequenceur s in Conduite.Courante.Sequenceurs) {
+ VBox newvbox = new VBox();
+ newvbox.PackStart(s.GetUI(),false,false,0);
+ onglets.Add (newvbox);
+ onglets.ShowAll();
}
+ }
+
+#endregion
+
+#region Gestion de l'affichage
+
+ bool updScheduled=false;
+ bool fullUpdateFlag=false;
+
+ public void NextUpdateFull ()
+ {
+ fullUpdateFlag=true;
}
+ public void ScheduleUpdate ()
+ {
+ if (updScheduled) {
+ //Console.WriteLine("{0} Skip !",DateTime.Now);
+ return;
+ }
+ updScheduled=true;
+ Gtk.Application.Invoke(new EventHandler(Update));
+
+ }
+
+ void Update (object sender, EventArgs e)
+ {
+ foreach (var notebookvbox in onglets.Children) {
+ foreach (var sequi in (notebookvbox as VBox).Children) {
+ (sequi as SequenceurUI).Update (fullUpdateFlag);
+ }
+ }
+ MajCircuits(fullUpdateFlag);
+ fullUpdateFlag=false;
+ updScheduled=false;
+ if( Conduite.Courante.SequenceurMaitre.EffetChange() )MatriceUI.QueueDraw();
+ }
+
+ protected void MajWidgets ()
+ {
+ if (Conduite.Courante != null) {
+ //Activation / Désactivation des boutons en fonction de l'état de la counduite courante
+ showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = true;
+ openAction.Sensitive = newAction.Sensitive = false;
+ this.Title = "DMX 2.0 - " + Conduite.Courante.Name;
+ ConstruitMatrice();
+ } else {
+ showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = false;
+ openAction.Sensitive = newAction.Sensitive = true;
+ this.Title = "DMX 2.0";
+ }
+ }
+
+
+ protected void MajCircuits (bool full)
+ {
+ // Ajoute une ProgressBar par circuit, met a jour le texte si necessaire
+ ProgressBar pb;int i = 0;
+ if (full) {
+ foreach (var widget in vboxCircuits.Children)
+ vboxCircuits.Remove (widget);
+ foreach (var circuit in Conduite.Courante.Circuits) {
+ vboxCircuits.PackStart (pb=new ProgressBar (),false,false,0);
+ pb.Text = (++i).ToString() + " - " + circuit.Name;
+ pb.HeightRequest = 22;
+ pb.Data[circuitKey] = circuit;
+ }
+ vboxCircuits.ShowAll ();
+ }
+
+ foreach (var widget in vboxCircuits.Children) {
+ pb = (ProgressBar)widget;
+ pb.Fraction = (double) (pb.Data[circuitKey] as Circuit).ValeurCourante / 255;
+ }
+ }
+#endregion
+
+ protected void OnMasterScaleValueChanged (object sender, EventArgs e)
+ {
+ Conduite.Courante.Master = (int)(masterScale.Value);
+ }
+ bool isfullscreen=false;
+ protected void OnFullscreenAction1Activated (object sender, EventArgs e)
+ {
+ if (!isfullscreen) {
+ Fullscreen ();
+ isfullscreen = true;
+ } else {
+ Unfullscreen();
+ isfullscreen = false;
+ }
+ }
+#region Boite dialogue Univers
+ EditionUnivers uDlg = null;
+ protected void OnUniversActionActivated (object sender, EventArgs e)
+ {
+
+ if (uDlg != null) {
+ uDlg.Show();
+ return;
+ }
+
+ uDlg = new EditionUnivers(this);
+ uDlg.ShowAll();
+ uDlg.Destroyed += udlgDestroyed;
+
+ }
+
+ void udlgDestroyed (object sender, EventArgs e)
+ {
+ uDlg=null;
+ }
+
+#endregion
+
+ protected void OnConnectActionActivated (object sender, EventArgs e)
+ {
+
+ Conduite.Courante.Drivers.Add( new DriverBoitierV1());
+
+ }
}
diff --git a/DMX-2.0/SeqLinUI.cs b/DMX-2.0/SeqLinUI.cs
index b98ae7d..2773dca 100644
--- a/DMX-2.0/SeqLinUI.cs
+++ b/DMX-2.0/SeqLinUI.cs
@@ -143,22 +143,25 @@ namespace DMX2
public override void Update (bool full)
{
- if(fullUpdFlag || full) FullUpdate();
- UpdateValues();
- timeLabel.LabelProp = string.Format(@"{0:0\.0}", sequenceur.TimeStamp.TotalMilliseconds/100);
+ if (fullUpdFlag || full)
+ FullUpdate ();
+ UpdateValues ();
+ timeLabel.LabelProp = string.Format (@"{0:0\.0}", sequenceur.TimeStamp.TotalMilliseconds / 100);
- if(sequenceur.EffetCourrant.Duree != TimeSpan.Zero )
- pbDuree.Fraction = Math.Min(1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Duree.TotalMilliseconds);
+ if (sequenceur.EffetCourrant.Duree != TimeSpan.Zero)
+ pbDuree.Fraction = Math.Min (1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Duree.TotalMilliseconds);
else
pbDuree.Fraction = 0.0d;
- if(sequenceur.EffetCourrant.Transition != TimeSpan.Zero )
- pbTrans.Fraction = Math.Min(1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Transition.TotalMilliseconds);
+ if (sequenceur.EffetCourrant.Transition != TimeSpan.Zero)
+ pbTrans.Fraction = Math.Min (1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Transition.TotalMilliseconds);
else
pbTrans.Fraction = 0.0d;
- if (effetChange)
- SelectionneEffet(sequenceur.IndexEffetCourrant);
+ if (effetChange) {
+ SelectionneEffet (sequenceur.IndexEffetCourrant);
+ posLabel.Text = string.Format("n°{0}",sequenceur.IndexEffetCourrant +1 );
+ }
}
void SelectionneEffet (int index)
@@ -266,6 +269,8 @@ namespace DMX2
seqMasterScale.Value = sequenceur.Master;
+ posLabel.Text = string.Format("n°{0}",sequenceur.IndexEffetCourrant +1);
+
fullUpdFlag=false;
}
diff --git a/DMX-2.0/SequenceurLineaire.cs b/DMX-2.0/SequenceurLineaire.cs
index 65995fc..a35478b 100644
--- a/DMX-2.0/SequenceurLineaire.cs
+++ b/DMX-2.0/SequenceurLineaire.cs
@@ -272,12 +272,15 @@ namespace DMX2
void ChangeEffetCourrant (int index)
{
- effetcourrant = effets [index];
- valeurschangees.Clear ();
- valeursinitiales = new Dictionary (valeurscourantes);
- enTransition = true;
- timeStamp = TimeSpan.Zero;
- if(ui!=null) ui.EffetChange();
+ lock (this) {
+ effetcourrant = effets [index];
+ valeurschangees.Clear ();
+ valeursinitiales = new Dictionary (valeurscourantes);
+ enTransition = true;
+ timeStamp = TimeSpan.Zero;
+ if (ui != null)
+ ui.EffetChange ();
+ }
}
public int SauveEffet (string nom, TimeSpan duree, TimeSpan transition)
diff --git a/DMX-2.0/SequenceurMaitre.cs b/DMX-2.0/SequenceurMaitre.cs
index 31df68a..417d02a 100644
--- a/DMX-2.0/SequenceurMaitre.cs
+++ b/DMX-2.0/SequenceurMaitre.cs
@@ -111,28 +111,32 @@ namespace DMX2
public void EffetSuivant ()
{
- if (aSuivre == null) {
- if (IndexLigneEnCours+1 < lignes.Count)
- enCours = lignes [IndexLigneEnCours + 1];
- else
- enCours = lignes [0];
- } else {
- enCours = aSuivre;
+ lock (this) {
+ if (aSuivre == null) {
+ if (IndexLigneEnCours + 1 < lignes.Count)
+ enCours = lignes [IndexLigneEnCours + 1];
+ else
+ enCours = lignes [0];
+ } else {
+ enCours = aSuivre;
+ }
+ aSuivre = null;
+ timeStamp = TimeSpan.Zero;
+ change = true;
}
- aSuivre=null;
- timeStamp = TimeSpan.Zero;
- change = true;
}
public void EffetPrecedent ()
{
- if (IndexLigneEnCours > 0)
- enCours = lignes [IndexLigneEnCours - 1];
- else
- enCours = lignes [0];
- aSuivre=null;
- timeStamp = TimeSpan.Zero;
- change = true;
+ lock (this) {
+ if (IndexLigneEnCours > 0)
+ enCours = lignes [IndexLigneEnCours - 1];
+ else
+ enCours = lignes [0];
+ aSuivre = null;
+ timeStamp = TimeSpan.Zero;
+ change = true;
+ }
}
public ReadOnlyCollection Lignes {
@@ -148,8 +152,10 @@ namespace DMX2
public int AjoutLigne (int pos)
{
- lignes.Insert(pos,new Ligne());
- return pos;
+ lock (this) {
+ lignes.Insert (pos, new Ligne ());
+ return pos;
+ }
}
public void Tick (TimeSpan deltaT)