diff --git a/DMX-2.0/MainWindow.cs b/DMX-2.0/MainWindow.cs index cbaae8b..41d2418 100644 --- a/DMX-2.0/MainWindow.cs +++ b/DMX-2.0/MainWindow.cs @@ -1,5 +1,6 @@ using System; using Gtk; +using System.Collections.Generic; namespace DMX2 @@ -94,7 +95,7 @@ namespace DMX2 void AddSeqUI (Sequenceur s) { - seqUiVbox.Add(s.GetUI()); + seqUiVbox.PackStart(s.GetUI(),false,false,0); seqUiVbox.ShowAll(); } diff --git a/DMX-2.0/SeqLinUI.cs b/DMX-2.0/SeqLinUI.cs index dd3e03f..9cbf747 100644 --- a/DMX-2.0/SeqLinUI.cs +++ b/DMX-2.0/SeqLinUI.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Gtk; namespace DMX2 @@ -6,24 +7,34 @@ namespace DMX2 [System.ComponentModel.ToolboxItem(true)] public partial class SeqLinUI : SequenceurUI { + + bool fullUpdFlag = true; + SequenceurLineaire sequenceur; + public SeqLinUI (SequenceurLineaire s ) : base (s) { this.Build (); titreLabel.Text = s.Name; + sequenceur = s; + Update(); } public override void Update () { - throw new System.NotImplementedException (); + if(fullUpdFlag) FullUpdate(); + UpdateValues(); } protected void OnCircuitsActionActivated (object sender, EventArgs e) { - var dlg = new SelSeqCircuits ((Sequenceur as SequenceurLineaire).Circuits); + var dlg = new SelSeqCircuits (sequenceur.Circuits); if ((ResponseType)dlg.Run () == ResponseType.Ok) { - (Sequenceur as SequenceurLineaire).ChangeCircuits(dlg.GetResultList()); + sequenceur.ChangeCircuits(dlg.GetResultList()); } dlg.Destroy(); + + //TODO : a retirer plus tard + FullUpdate(); } protected void OnCloseActionActivated (object sender, EventArgs e) @@ -32,15 +43,104 @@ namespace DMX2 } + Dictionary tirettes = new Dictionary(); + + static VScale NouvelleTirette () + { + VScale tirette = new VScale (null); + tirette.WidthRequest = 25; + tirette.HeightRequest = 150; + tirette.CanFocus = true; + tirette.Inverted = true; + tirette.Adjustment.Upper = 100; + tirette.Adjustment.PageIncrement = 10; + tirette.Adjustment.StepIncrement = 1; + tirette.DrawValue = true; + tirette.Digits = 0; + return tirette; + } + + static Label NouveauLabel () + { + Label l = new Label(); + l.WidthRequest = 50; + l.HeightRequest = 66; + l.Xalign = 1F; + l.Yalign = 0F; + l.UseMarkup = true; + l.Angle = 65; + return l; + } + + + int lastKnownWidth =0; + object circuitKey = new object(); + protected void FullUpdate () { + fullUpdFlag=true; // TODO : ici : Remise a plat de l'UI , Ajout/agencement des tirettes et descriptions + + + lastKnownWidth = zoneWid.Allocation.Width; + + foreach (Widget wid in new List(zoneWid.Children)) + zoneWid.Remove (wid); + + tirettes.Clear(); + + int xpos=10, ypos=0; + VScale tirette; Fixed.FixedChild fx; + Label label; + + foreach (Circuit c in sequenceur.Circuits) { + tirettes[c] = tirette = NouvelleTirette(); + zoneWid.Add(tirette); + fx = ( zoneWid[tirette] as Fixed.FixedChild); + fx.X = xpos; fx.Y = ypos; + tirette.Show(); + tirette.ValueChanged += TiretteActionee; + tirette.Data.Add(circuitKey,c); + + label = NouveauLabel(); + zoneWid.Add(label); + fx = ( zoneWid[label] as Fixed.FixedChild); + fx.X = xpos-30; + fx.Y = ypos+150; + label.LabelProp = "" + c.ShortName + ""; + label.Show(); + + xpos+=30; + if(lastKnownWidth < xpos +30) + { + xpos =10; ypos+= 215; + } + } + + fullUpdFlag=false; + } + + void TiretteActionee (object sender, EventArgs e) + { + VScale t = sender as VScale; + Circuit c = t.Data[circuitKey] as Circuit; + } protected void UpdateValues() { - // TODO : ici : maj du temps, des progressbar et des tirettes + + } + + protected void OnZoneWidSizeAllocated (object o, SizeAllocatedArgs args) + { + if (!fullUpdFlag) { + if(lastKnownWidth != args.Allocation.Width) + FullUpdate (); + } } + + } } diff --git a/DMX-2.0/SequenceurLineaire.cs b/DMX-2.0/SequenceurLineaire.cs index 2fb19e3..e4dc8c0 100644 --- a/DMX-2.0/SequenceurLineaire.cs +++ b/DMX-2.0/SequenceurLineaire.cs @@ -68,7 +68,7 @@ namespace DMX2 public void ChangeCircuits (System.Collections.Generic.List list) { - foreach (var c in circuitsSeq) { + foreach (var c in circuitsSeq.ToArray()) { if(!list.Contains(c)) RetireCircuit(c); } @@ -115,6 +115,7 @@ namespace DMX2 Dictionary valeurscourantes = new Dictionary(); Dictionary valeursinitiales = new Dictionary(); + Dictionary valeurschangees = new Dictionary(); public SequenceurLineaire () { @@ -132,23 +133,34 @@ namespace DMX2 return valeurscourantes[c]; } + public void ChangeCircuit (Circuit c, int value) + { + valeurschangees[c]=true; + valeurscourantes[c]= value; + } + + public bool EstChange (Circuit c) + { + return valeurschangees.ContainsKey(c); + } + public override void Tick (TimeSpan time) { timeStamp += time; if (enTransition) { - if(timeStamp= effetcourrant.Duree) { + int index = effets.IndexOf(effetcourrant) +1; + if (index < effets.Count) ChangeEffet(index); } } @@ -160,9 +172,10 @@ namespace DMX2 } - public void ChangeEffet(Effet effet) + public void ChangeEffet(int index) { - effetcourrant = effet; + effetcourrant = effets[index]; + valeurschangees.Clear(); valeursinitiales = new Dictionary(valeurscourantes); enTransition = true; timeStamp = TimeSpan.Zero; diff --git a/DMX-2.0/gtk-gui/gui.stetic b/DMX-2.0/gtk-gui/gui.stetic index d94cb6f..d3f6de2 100644 --- a/DMX-2.0/gtk-gui/gui.stetic +++ b/DMX-2.0/gtk-gui/gui.stetic @@ -180,9 +180,8 @@ True 583 - + - True In @@ -191,6 +190,7 @@ + True 6 @@ -208,7 +208,6 @@ False - False @@ -448,7 +447,7 @@ - + Action @@ -514,8 +513,6 @@ - 270 - False @@ -741,84 +738,17 @@ - + - 250 + 0 False - - - - 25 - 150 - True - True - 100 - 10 - 1 - 51 - True - 0 - Top - - - 15 - - - - - - 25 - 150 - True - True - 100 - 10 - 1 - 28 - True - 0 - Top - - - 45 - - - - - - 50 - 66 - 1 - 0 - <small>Ras. Rouge</small> - True - 65 - - - -20 - 150 - - - - - - 50 - 66 - 1 - 0 - <small>Face J</small> - True - 65 - - - 10 - 150 - - + 1 True + False + False