From 19ab3ac3595b6eed9c506bb8e56a4e6621d5567f Mon Sep 17 00:00:00 2001 From: tzim Date: Fri, 15 Nov 2013 00:16:34 +0000 Subject: [PATCH] --- DMX-2.0/Conduite.cs | 16 +++++++++++++--- DMX-2.0/MainWindow.cs | 12 ++++++------ DMX-2.0/SequenceurLineaire.cs | 12 +++++++++++- DMX-2.0/SequenceurMaitre.cs | 30 +++++++++++++++++++++++++----- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/DMX-2.0/Conduite.cs b/DMX-2.0/Conduite.cs index 122da8d..48249a3 100644 --- a/DMX-2.0/Conduite.cs +++ b/DMX-2.0/Conduite.cs @@ -28,6 +28,8 @@ namespace DMX2 MidiEventProvider midip=null; + actionEventTarget masterEventTarget; + public Conduite() { timer = new Timer(new TimerCallback(TimerTick),this, 1000,10); @@ -42,6 +44,12 @@ namespace DMX2 midip = new MidiEventProvider(eventManager); + + masterEventTarget = new actionEventTarget( + delegate(EventData data){ + Master = 100 * data.value /255; + return true; + }); } EventManager eventManager = new EventManager(); @@ -221,9 +229,11 @@ namespace DMX2 public void BindMaster (string eventId) { - - //TODO - throw new NotImplementedException (); + if (eventId.Length == 0) { + Conduite.Courante.EventManager.Unbind (masterEventTarget); + return; + } + Conduite.Courante.EventManager.Bind(eventId,masterEventTarget); } diff --git a/DMX-2.0/MainWindow.cs b/DMX-2.0/MainWindow.cs index c57db77..5f71908 100644 --- a/DMX-2.0/MainWindow.cs +++ b/DMX-2.0/MainWindow.cs @@ -498,6 +498,7 @@ namespace DMX2 if(fullUpdateFlag) ConstruitMatriceSeqColumns(); if( Conduite.Courante.SequenceurMaitre.EffetChange() )MatriceUI.QueueDraw(); fullUpdateFlag=false; + masterScale.Value = Conduite.Courante.Master; updScheduled=false; } @@ -558,9 +559,8 @@ namespace DMX2 protected void OnMasterScaleValueChanged (object sender, EventArgs e) { - Conduite.Courante.Master = (int)(masterScale.Value); - ChangeMatriceCouleur(); - + if(!updScheduled) Conduite.Courante.Master = (int)(masterScale.Value); + ChangeCouleurInfo(); } @@ -610,15 +610,15 @@ namespace DMX2 protected void OnBtnPauseToggled (object sender, EventArgs e) { Conduite.Courante.Pause = btnPause.Active; - ChangeMatriceCouleur(); + ChangeCouleurInfo(); } protected void OnBtnBlackOutToggled (object sender, EventArgs e) { Conduite.Courante.BlackOut = btnBlackOut.Active; - ChangeMatriceCouleur(); + ChangeCouleurInfo(); } - void ChangeMatriceCouleur () + void ChangeCouleurInfo () { if (Conduite.Courante.BlackOut) { diff --git a/DMX-2.0/SequenceurLineaire.cs b/DMX-2.0/SequenceurLineaire.cs index e871840..b9191f6 100644 --- a/DMX-2.0/SequenceurLineaire.cs +++ b/DMX-2.0/SequenceurLineaire.cs @@ -109,7 +109,17 @@ namespace DMX2 SequenceurLineaire seq; int max=0, signe=-2; - public bool Attache{ get; set; } + bool attache; + + public bool Attache { + get { + return attache; + } + set { + signe=-2; + attache = value; + } + } public circuitEventTarget(SequenceurLineaire _seq, Circuit _c){ seq=_seq; diff --git a/DMX-2.0/SequenceurMaitre.cs b/DMX-2.0/SequenceurMaitre.cs index 9645556..f17b95d 100644 --- a/DMX-2.0/SequenceurMaitre.cs +++ b/DMX-2.0/SequenceurMaitre.cs @@ -12,7 +12,7 @@ namespace DMX2 string nom; TimeSpan duree = TimeSpan.Zero; Dictionary data = new Dictionary(); - + public string Nom { get { return nom; @@ -82,6 +82,8 @@ namespace DMX2 Ligne enCours = null; TimeSpan timeStamp = TimeSpan.Zero; + actionEventTarget goNextEventTarget=null; + actionEventTarget goBackEventTarget=null; bool change = false; @@ -185,6 +187,18 @@ namespace DMX2 public SequenceurMaitre () { //lignes.Add(new Ligne()); + goNextEventTarget = new actionEventTarget( + delegate(EventData data){ + if(data.value!=0) EffetSuivant(); + return true; + }); + + goBackEventTarget = new actionEventTarget( + delegate(EventData data){ + if(data.value!=0) EffetPrecedent(); + return true; + }); + } public int AjoutLigne (int pos) @@ -230,14 +244,20 @@ namespace DMX2 public void BindEffetSuivant (string eventId) { - //TODO - throw new NotImplementedException (); + if (eventId.Length == 0) { + Conduite.Courante.EventManager.Unbind (goNextEventTarget); + return; + } + Conduite.Courante.EventManager.Bind(eventId,goNextEventTarget); } public void BindEffetPrecedent (string eventId) { - //TODO - throw new NotImplementedException (); + if (eventId.Length == 0) { + Conduite.Courante.EventManager.Unbind (goBackEventTarget); + return; + } + Conduite.Courante.EventManager.Bind(eventId,goBackEventTarget); } public void Save (XmlElement parent) {