This commit is contained in:
parent
6ac96814fe
commit
53515afef8
3 changed files with 139 additions and 15 deletions
|
|
@ -8,6 +8,7 @@ namespace DMX2
|
||||||
public partial class SeqMacroUI : SequenceurUI
|
public partial class SeqMacroUI : SequenceurUI
|
||||||
{
|
{
|
||||||
bool fullUpdFlag = true;
|
bool fullUpdFlag = true;
|
||||||
|
bool updating;
|
||||||
SequenceurMacro sequenceur; /* pointe sur les données */
|
SequenceurMacro sequenceur; /* pointe sur les données */
|
||||||
ListStore lsEffets=null; /* liste des effets */
|
ListStore lsEffets=null; /* liste des effets */
|
||||||
//TreeViewColumn nomCol; /* inutile dans le contexte macro */
|
//TreeViewColumn nomCol; /* inutile dans le contexte macro */
|
||||||
|
|
@ -18,10 +19,7 @@ namespace DMX2
|
||||||
effetChange = true;
|
effetChange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenamePopup (object sender, ContextMenuEventArgs e)
|
||||||
void OnButtonPressedEvent (object o, ButtonPressEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Event.Button == 3) /* right click */
|
|
||||||
{
|
{
|
||||||
Menu m = new Menu();
|
Menu m = new Menu();
|
||||||
MenuItem renameItem = new MenuItem("Renommer le Sequenceur");
|
MenuItem renameItem = new MenuItem("Renommer le Sequenceur");
|
||||||
|
|
@ -30,7 +28,7 @@ namespace DMX2
|
||||||
m.ShowAll();
|
m.ShowAll();
|
||||||
m.Popup();
|
m.Popup();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void OnRenameItemButtonPressed (object o, ButtonPressEventArgs args)
|
void OnRenameItemButtonPressed (object o, ButtonPressEventArgs args)
|
||||||
{
|
{
|
||||||
|
|
@ -233,11 +231,51 @@ namespace DMX2
|
||||||
sequenceur = s;
|
sequenceur = s;
|
||||||
ConstruitMatrice ();
|
ConstruitMatrice ();
|
||||||
|
|
||||||
frame1.ButtonPressEvent += OnButtonPressedEvent;
|
|
||||||
|
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)
|
public override void Update (bool full)
|
||||||
{
|
{
|
||||||
if (fullUpdFlag || full)
|
if (fullUpdFlag || full)
|
||||||
|
|
@ -260,6 +298,10 @@ namespace DMX2
|
||||||
SelectionneEffet (sequenceur.IndexLigneEnCours);
|
SelectionneEffet (sequenceur.IndexLigneEnCours);
|
||||||
posLabel.Text = string.Format("n°{0}",sequenceur.IndexLigneEnCours +1 );
|
posLabel.Text = string.Format("n°{0}",sequenceur.IndexLigneEnCours +1 );
|
||||||
}
|
}
|
||||||
|
updating = true;
|
||||||
|
seqMasterScale.Value = sequenceur.Master;
|
||||||
|
updating = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -297,8 +339,6 @@ namespace DMX2
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
seqMasterScale.Value = sequenceur.Master;
|
|
||||||
|
|
||||||
posLabel.Text = string.Format("n°{0}",sequenceur.IndexLigneEnCours +1);
|
posLabel.Text = string.Format("n°{0}",sequenceur.IndexLigneEnCours +1);
|
||||||
|
|
||||||
fullUpdFlag=false;
|
fullUpdFlag=false;
|
||||||
|
|
@ -338,7 +378,7 @@ namespace DMX2
|
||||||
|
|
||||||
protected void OnSeqMasterScaleValueChanged (object sender, EventArgs e)
|
protected void OnSeqMasterScaleValueChanged (object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (fullUpdFlag)return;
|
if (updating)return;
|
||||||
sequenceur.Master = (int)(seqMasterScale.Value);
|
sequenceur.Master = (int)(seqMasterScale.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -599,7 +599,7 @@ namespace DMX2
|
||||||
|
|
||||||
if ((xmlE = el["EffetPrecedent"])!= null)
|
if ((xmlE = el["EffetPrecedent"])!= null)
|
||||||
foreach(string id in EventManager.LoadBindings(xmlE))
|
foreach(string id in EventManager.LoadBindings(xmlE))
|
||||||
BindEffetSuivantEvent(id);
|
BindEffetPrecedentEvent(id);
|
||||||
|
|
||||||
|
|
||||||
foreach (var xc in el.GetElementsByTagName("CircuitSeq")) {
|
foreach (var xc in el.GetElementsByTagName("CircuitSeq")) {
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,11 @@ namespace DMX2
|
||||||
Dictionary<Circuit,int> valeurscourantes = new Dictionary<Circuit, int> ();
|
Dictionary<Circuit,int> valeurscourantes = new Dictionary<Circuit, int> ();
|
||||||
Dictionary<Circuit,EffetMacro> effetsEnCours = new Dictionary<Circuit, EffetMacro>();
|
Dictionary<Circuit,EffetMacro> effetsEnCours = new Dictionary<Circuit, EffetMacro>();
|
||||||
|
|
||||||
|
actionEventTarget masterEventTarget=null;
|
||||||
|
actionEventTarget goNextEventTarget=null;
|
||||||
|
actionEventTarget goBackEventTarget=null;
|
||||||
|
|
||||||
|
|
||||||
SeqMacroUI ui = null;
|
SeqMacroUI ui = null;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
int master = 100;
|
int master = 100;
|
||||||
|
|
@ -158,7 +163,31 @@ namespace DMX2
|
||||||
|
|
||||||
public SequenceurMacro ()
|
public SequenceurMacro ()
|
||||||
{
|
{
|
||||||
|
masterEventTarget = new actionEventTarget (
|
||||||
|
delegate(EventData data) {
|
||||||
|
Master = 100 * data.value / 255;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
goNextEventTarget = new actionEventTarget (
|
||||||
|
delegate(EventData data) {
|
||||||
|
if(data.value>0) LigneSuivante();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
goBackEventTarget = new actionEventTarget (
|
||||||
|
delegate(EventData data) {
|
||||||
|
if(data.value>0){
|
||||||
|
if (IndexLigneEnCours > 0) {
|
||||||
|
IndexLigneaSuivre = IndexLigneEnCours - 1;
|
||||||
|
LigneSuivante ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -401,16 +430,26 @@ namespace DMX2
|
||||||
public override void Save (System.Xml.XmlElement parent)
|
public override void Save (System.Xml.XmlElement parent)
|
||||||
{
|
{
|
||||||
System.Xml.XmlElement el = parent.OwnerDocument.CreateElement ("SequenceurMacro");
|
System.Xml.XmlElement el = parent.OwnerDocument.CreateElement ("SequenceurMacro");
|
||||||
System.Xml.XmlElement xmlC;
|
System.Xml.XmlElement xmlEl;
|
||||||
|
|
||||||
parent.AppendChild (el);
|
parent.AppendChild (el);
|
||||||
el.SetAttribute ("id", ID.ToString ());
|
el.SetAttribute ("id", ID.ToString ());
|
||||||
el.SetAttribute ("name", Name);
|
el.SetAttribute ("name", Name);
|
||||||
el.SetAttribute ("master", master.ToString ());
|
//el.SetAttribute ("master", master.ToString ());
|
||||||
|
|
||||||
|
el.AppendChild(xmlEl = parent.OwnerDocument.CreateElement ("Master"));
|
||||||
|
xmlEl.SetAttribute("value",master.ToString());
|
||||||
|
EventManager.SaveBindings(xmlEl,masterEventTarget);
|
||||||
|
|
||||||
|
xmlEl = parent.OwnerDocument.CreateElement ("EffetSuivant");
|
||||||
|
if(EventManager.SaveBindings(xmlEl,goNextEventTarget )) el.AppendChild(xmlEl);
|
||||||
|
|
||||||
|
xmlEl = parent.OwnerDocument.CreateElement ("EffetPrecedent");
|
||||||
|
if(EventManager.SaveBindings(xmlEl,goBackEventTarget )) el.AppendChild(xmlEl);
|
||||||
|
|
||||||
foreach (Circuit c in circuitsSeq) {
|
foreach (Circuit c in circuitsSeq) {
|
||||||
el.AppendChild(xmlC = parent.OwnerDocument.CreateElement ("CircuitSeq"));
|
el.AppendChild(xmlEl = parent.OwnerDocument.CreateElement ("CircuitSeq"));
|
||||||
xmlC.SetAttribute("id",c.ID.ToString());
|
xmlEl.SetAttribute("id",c.ID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Ligne li in lignes) {
|
foreach (Ligne li in lignes) {
|
||||||
|
|
@ -436,6 +475,35 @@ namespace DMX2
|
||||||
ui = null;
|
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 SequenceurMacro Load (Conduite conduite, System.Xml.XmlElement el)
|
public static new SequenceurMacro Load (Conduite conduite, System.Xml.XmlElement el)
|
||||||
{
|
{
|
||||||
SequenceurMacro seq = new SequenceurMacro();
|
SequenceurMacro seq = new SequenceurMacro();
|
||||||
|
|
@ -447,7 +515,23 @@ namespace DMX2
|
||||||
{
|
{
|
||||||
ID = int.Parse (el.GetAttribute ("id"));
|
ID = int.Parse (el.GetAttribute ("id"));
|
||||||
Name = el.GetAttribute ("name");
|
Name = el.GetAttribute ("name");
|
||||||
master = int.Parse (el.GetAttribute ("master"));
|
|
||||||
|
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")) {
|
foreach (var xc in el.GetElementsByTagName("CircuitSeq")) {
|
||||||
System.Xml.XmlElement xcir = xc as System.Xml.XmlElement;
|
System.Xml.XmlElement xcir = xc as System.Xml.XmlElement;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue