Ajout effacement des bindings

This commit is contained in:
manu 2016-05-31 16:57:43 +02:00
parent 417f6bb985
commit 974f1b0d57
4 changed files with 60 additions and 9 deletions

View file

@ -87,6 +87,7 @@ namespace DMX2
bool CanFeedback{ get; }
void AddFeedback(IFeedbackInfo info);
void ClearFeedBack();
}
@ -128,6 +129,8 @@ namespace DMX2
{
throw new System.NotImplementedException ();
}
void IEventTarget.ClearFeedBack(){
}
#endregion
}
@ -179,6 +182,9 @@ namespace DMX2
void IEventTarget.Bind (string id){} // Rien a faire ici
void IEventTarget.Unbind (string id){}
bool IEventTarget.CanFeedback { get { return canfeedback; } }
void IEventTarget.ClearFeedBack(){
fbInfos.Clear ();
}
void IEventTarget.AddFeedback (IFeedbackInfo info)
{
fbInfos.Add(info);
@ -314,10 +320,11 @@ namespace DMX2
var q = from bind in bindings where bind.Value.Targets.Contains(target) select bind.Key;
foreach(string id in q.ToArray())
Unbind(id,target);
target.ClearFeedBack ();
}
///<summary> Desenregistrement d'une association id => cible</summary>
public void Unbind (string eventId, IEventTarget target)
void Unbind (string eventId, IEventTarget target)
{
if (!bindings.ContainsKey (eventId)) return;
bindings [eventId].RemoveTarget (target);
@ -345,6 +352,17 @@ namespace DMX2
}
}
public void ClearAll(){
List<IEventTarget> targets = new List<IEventTarget> ();
foreach (var binding in bindings.Values)
foreach (var t in binding.Targets)
if (!targets.Contains (t))
targets.Add (t);
foreach (var t in targets) {
Unbind (t);
}
}
public bool SaveBindings (System.Xml.XmlElement xmlParent, IEventTarget target)
{
bool ret=false;

View file

@ -206,6 +206,11 @@ namespace DMX2
{
Conduite.Courante.Midi.Max14bValue = spinMax14b.ValueAsInt;
}
protected void OnBtnClearEventsClicked (object sender, EventArgs e)
{
Conduite.Courante.EventManager.ClearAll ();
}
}
}

View file

@ -36,6 +36,7 @@ namespace DMX2
private global::Gtk.Label label2;
private global::Gtk.ScrolledWindow GtkScrolledWindow1;
private global::Gtk.TreeView listKnown;
private global::Gtk.Button btnClearEvents;
private global::Gtk.Button buttonClose;
protected virtual void Build ()
@ -333,6 +334,7 @@ namespace DMX2
this.vbox2.Spacing = 6;
// Container child vbox2.Gtk.Box+BoxChild
this.label1 = new global::Gtk.Label ();
this.label1.Name = "label1";
this.label1.Xalign = 0F;
this.label1.LabelProp = "Interfaces disponibles :";
this.vbox2.Add (this.label1);
@ -400,6 +402,16 @@ namespace DMX2
w48.BorderWidth = ((uint)(5));
w48.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.btnClearEvents = new global::Gtk.Button ();
this.btnClearEvents.CanFocus = true;
this.btnClearEvents.Name = "btnClearEvents";
this.btnClearEvents.UseUnderline = true;
this.btnClearEvents.Label = "Delier tout les évenements";
this.AddActionWidget (this.btnClearEvents, 0);
global::Gtk.ButtonBox.ButtonBoxChild w49 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w48 [this.btnClearEvents]));
w49.Expand = false;
w49.Fill = false;
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonClose = new global::Gtk.Button ();
this.buttonClose.CanDefault = true;
this.buttonClose.CanFocus = true;
@ -408,9 +420,10 @@ namespace DMX2
this.buttonClose.UseUnderline = true;
this.buttonClose.Label = "gtk-close";
this.AddActionWidget (this.buttonClose, -7);
global::Gtk.ButtonBox.ButtonBoxChild w49 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w48 [this.buttonClose]));
w49.Expand = false;
w49.Fill = false;
global::Gtk.ButtonBox.ButtonBoxChild w50 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w48 [this.buttonClose]));
w50.Position = 1;
w50.Expand = false;
w50.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
@ -428,6 +441,7 @@ namespace DMX2
this.spinMax14b.ValueChanged += new global::System.EventHandler (this.OnSpinMax14bValueChanged);
this.chkPg.Toggled += new global::System.EventHandler (this.OnChkPgToggled);
this.chkFourteenBits.Toggled += new global::System.EventHandler (this.OnChkFourteenBitsToggled);
this.btnClearEvents.Clicked += new global::System.EventHandler (this.OnBtnClearEventsClicked);
this.buttonClose.Clicked += new global::System.EventHandler (this.OnButtonCloseClicked);
}
}

View file

@ -5,7 +5,7 @@
<target-gtk-version>2.12</target-gtk-version>
</configuration>
<import>
<widget-library name="../bin/Debug/DMX-2.0.exe" internal="true" />
<widget-library name="../bin/Release/DMX-2.0.exe" internal="true" />
</import>
<icon-factory>
<icon-set id="tirettes">
@ -1822,7 +1822,6 @@ au sequenceur</property>
<child>
<widget class="Gtk.Label" id="actLabel">
<property name="MemberName" />
<property name="LabelProp" translatable="yes" />
<property name="UseMarkup">True</property>
<property name="Wrap">True</property>
</widget>
@ -2119,7 +2118,6 @@ au sequenceur</property>
<child>
<widget class="Gtk.Label" id="GtkLabel2">
<property name="MemberName" />
<property name="LabelProp" translatable="yes" />
<property name="UseMarkup">True</property>
</widget>
<packing>
@ -3192,7 +3190,7 @@ trames DMX (ms)</property>
<property name="MemberName" />
<property name="Title" translatable="yes">Connexions Midi</property>
<property name="WindowPosition">CenterOnParent</property>
<property name="Buttons">1</property>
<property name="Buttons">2</property>
<property name="HelpButton">False</property>
<child internal-child="VBox">
<widget class="Gtk.VBox" id="dialog1_VBox">
@ -3759,8 +3757,23 @@ trames DMX (ms)</property>
<property name="MemberName" />
<property name="Spacing">10</property>
<property name="BorderWidth">5</property>
<property name="Size">1</property>
<property name="Size">2</property>
<property name="LayoutStyle">End</property>
<child>
<widget class="Gtk.Button" id="btnClearEvents">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
<property name="Label" translatable="yes">Delier tout les évenements</property>
<property name="UseUnderline">True</property>
<property name="ResponseId">0</property>
<signal name="Clicked" handler="OnBtnClearEventsClicked" />
</widget>
<packing>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Button" id="buttonClose">
<property name="MemberName" />
@ -3774,6 +3787,7 @@ trames DMX (ms)</property>
<property name="label">gtk-close</property>
</widget>
<packing>
<property name="Position">1</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>