ajout fichiers manquants
This commit is contained in:
parent
50eb428c44
commit
6cf4af9c58
3 changed files with 852 additions and 0 deletions
149
DMX-2.0/SeqMacroUI.cs
Normal file
149
DMX-2.0/SeqMacroUI.cs
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Gtk;
|
||||||
|
|
||||||
|
namespace DMX2
|
||||||
|
{
|
||||||
|
[System.ComponentModel.ToolboxItem(true)]
|
||||||
|
public partial class SeqMacroUI : SequenceurUI
|
||||||
|
{
|
||||||
|
bool fullUpdFlag = true;
|
||||||
|
SequenceurMacro sequenceur;
|
||||||
|
ListStore lsEffets=null;
|
||||||
|
TreeViewColumn nomCol;
|
||||||
|
ListStore lsMatrice = null;
|
||||||
|
|
||||||
|
bool effetChange = false;
|
||||||
|
public void EffetChange ()
|
||||||
|
{
|
||||||
|
effetChange = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeqMacroUI (SequenceurMacro s ) : base (s)
|
||||||
|
{
|
||||||
|
this.Build ();
|
||||||
|
titreLabel.Text = s.Name;
|
||||||
|
sequenceur = s;
|
||||||
|
|
||||||
|
var idCol = new Gtk.TreeViewColumn ();
|
||||||
|
var idCell = new Gtk.CellRendererText ();
|
||||||
|
idCol.Title = "Num";
|
||||||
|
idCol.PackStart (idCell, true);
|
||||||
|
idCol.SetCellDataFunc (idCell, new Gtk.TreeCellDataFunc (RenderMatriceNum));
|
||||||
|
this.MatriceUI.AppendColumn (idCol);
|
||||||
|
|
||||||
|
|
||||||
|
var nomCol = new Gtk.TreeViewColumn ();
|
||||||
|
var nomCell = new Gtk.CellRendererText ();
|
||||||
|
nomCol.Title = "Nom";
|
||||||
|
nomCol.PackStart (nomCell, true);
|
||||||
|
nomCol.SetCellDataFunc (nomCell, new Gtk.TreeCellDataFunc (RenderMatriceNom));
|
||||||
|
nomCell.Editable = true;
|
||||||
|
//nomCell.Edited += OnNomCellEdited;
|
||||||
|
this.MatriceUI.AppendColumn (nomCol);
|
||||||
|
|
||||||
|
var topCol = new Gtk.TreeViewColumn ();
|
||||||
|
var topCell = new Gtk.CellRendererText ();
|
||||||
|
topCol.Title = "Top";
|
||||||
|
topCol.PackStart (topCell, true);
|
||||||
|
topCol.SetCellDataFunc (topCell, new Gtk.TreeCellDataFunc (RenderMatriceTop));
|
||||||
|
topCell.Editable = true;
|
||||||
|
//topCell.Edited += OnTopCellEdited;
|
||||||
|
this.MatriceUI.AppendColumn (topCol);
|
||||||
|
|
||||||
|
var circuitsCol = new Gtk.TreeViewColumn ();
|
||||||
|
var circuitsCell = new Gtk.CellRendererText ();
|
||||||
|
circuitsCol.Title = "Circuits";
|
||||||
|
circuitsCol.PackStart (circuitsCell, true);
|
||||||
|
circuitsCol.SetCellDataFunc (circuitsCell, new Gtk.TreeCellDataFunc (RenderMatriceCircuits));
|
||||||
|
circuitsCell.Editable = true;
|
||||||
|
//circuitsCell.Edited += OnCircuitsCellEdited;
|
||||||
|
this.MatriceUI.AppendColumn (circuitsCol);
|
||||||
|
|
||||||
|
var valeurCol = new Gtk.TreeViewColumn ();
|
||||||
|
var valeurCell = new Gtk.CellRendererText ();
|
||||||
|
valeurCol.Title = "Valeur";
|
||||||
|
valeurCol.PackStart (valeurCell, true);
|
||||||
|
valeurCol.SetCellDataFunc (circuitsCell, new Gtk.TreeCellDataFunc (RenderMatriceValeur));
|
||||||
|
valeurCell.Editable = true;
|
||||||
|
//valeurCell.Edited += OnValeurCellEdited;
|
||||||
|
this.MatriceUI.AppendColumn (valeurCol);
|
||||||
|
|
||||||
|
var tempsCol = new Gtk.TreeViewColumn ();
|
||||||
|
var tempsCell = new Gtk.CellRendererText ();
|
||||||
|
tempsCol.Title = "Temps";
|
||||||
|
tempsCol.PackStart (tempsCell, true);
|
||||||
|
tempsCol.SetCellDataFunc (tempsCell, new Gtk.TreeCellDataFunc (RenderMatriceTemps));
|
||||||
|
tempsCell.Editable = true;
|
||||||
|
//tempsCell.Edited += OnTempsCellEdited;
|
||||||
|
this.MatriceUI.AppendColumn (tempsCol);
|
||||||
|
|
||||||
|
lsMatrice = new Gtk.ListStore(typeof (SequenceurMaitre.Ligne)); // a modifier
|
||||||
|
this.MatriceUI.Model = lsMatrice;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderMatriceNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderMatriceNom (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderMatriceTop (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderMatriceCircuits (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderMatriceValeur (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderMatriceTemps (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update (bool full)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void OnCircuitsActionActivated (object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// récupère la fenètre principale
|
||||||
|
Window win = this.GetAncestor(Gtk.Window.GType) as Window;
|
||||||
|
var dlg = new SelSeqCircuits (sequenceur.Circuits,win);
|
||||||
|
if ((ResponseType)dlg.Run () == ResponseType.Ok) {
|
||||||
|
sequenceur.ChangeCircuits(dlg.GetResultList());
|
||||||
|
}
|
||||||
|
dlg.Destroy();
|
||||||
|
fullUpdFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnCloseActionActivated (object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void OnSeqMasterScaleValueChanged (object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (fullUpdFlag)return;
|
||||||
|
sequenceur.Master = (int)(seqMasterScale.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
506
DMX-2.0/SequenceurMacro.cs
Normal file
506
DMX-2.0/SequenceurMacro.cs
Normal file
|
|
@ -0,0 +1,506 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
namespace DMX2
|
||||||
|
{
|
||||||
|
public class SequenceurMacro : Sequenceur
|
||||||
|
{
|
||||||
|
public class Effet
|
||||||
|
{
|
||||||
|
|
||||||
|
string _nom;
|
||||||
|
|
||||||
|
public Effet (string nom, Dictionary<Circuit,int> valeurs, TimeSpan duree, TimeSpan transition)
|
||||||
|
{
|
||||||
|
_nom = nom;
|
||||||
|
_valeurs = new Dictionary<Circuit, int> (valeurs);
|
||||||
|
_duree = duree;
|
||||||
|
_transition = transition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Nom {
|
||||||
|
get {
|
||||||
|
return _nom;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
_nom = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<Circuit,int> _valeurs;
|
||||||
|
|
||||||
|
public int this [Circuit index] {
|
||||||
|
get {
|
||||||
|
if (!_valeurs.ContainsKey (index))
|
||||||
|
_valeurs.Add (index, 0);
|
||||||
|
return _valeurs [index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<Circuit, int> Valeurs {
|
||||||
|
get {
|
||||||
|
return _valeurs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void RetireCircuit (Circuit c)
|
||||||
|
{
|
||||||
|
_valeurs.Remove (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeSpan _duree = TimeSpan.Zero ;
|
||||||
|
TimeSpan _transition = TimeSpan.Zero;
|
||||||
|
|
||||||
|
public TimeSpan Duree {
|
||||||
|
get {
|
||||||
|
return _duree;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
_duree = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSpan Transition {
|
||||||
|
get {
|
||||||
|
return _transition;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
_transition = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Save (System.Xml.XmlElement parent)
|
||||||
|
{
|
||||||
|
System.Xml.XmlElement el = parent.OwnerDocument.CreateElement ("Effet");
|
||||||
|
System.Xml.XmlElement xmlVal;
|
||||||
|
parent.AppendChild (el);
|
||||||
|
el.SetAttribute("nom",_nom);
|
||||||
|
el.SetAttribute ("duree", _duree.ToString ());
|
||||||
|
el.SetAttribute ("transition", _transition.ToString ());
|
||||||
|
foreach (var valeur in _valeurs) {
|
||||||
|
xmlVal = parent.OwnerDocument.CreateElement("Valeur");
|
||||||
|
el.AppendChild(xmlVal);
|
||||||
|
xmlVal.SetAttribute("circuit",valeur.Key.ID.ToString());
|
||||||
|
xmlVal.SetAttribute("valeur",valeur.Value.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Effet Load (Conduite conduite, System.Xml.XmlElement el)
|
||||||
|
{
|
||||||
|
Dictionary<Circuit, int> valeurs = new Dictionary<Circuit, int> ();
|
||||||
|
foreach (var xv in el.GetElementsByTagName("Valeur")) {
|
||||||
|
System.Xml.XmlElement xval = xv as System.Xml.XmlElement;
|
||||||
|
valeurs.Add(
|
||||||
|
conduite.GetCircuitByID(int.Parse(xval.GetAttribute("circuit"))),
|
||||||
|
int.Parse(xval.GetAttribute("valeur"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return new Effet( el.GetAttribute("nom"),valeurs,
|
||||||
|
TimeSpan.Parse(el.GetAttribute("duree")),
|
||||||
|
TimeSpan.Parse(el.GetAttribute("transition"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeSpan timeStamp = TimeSpan.Zero;
|
||||||
|
List<Circuit> circuitsSeq = new List<Circuit> ();
|
||||||
|
List<Effet> effets = new List<Effet> ();
|
||||||
|
Effet effetcourrant = null;
|
||||||
|
bool enTransition = false;
|
||||||
|
Dictionary<Circuit,int> valeurscourantes = new Dictionary<Circuit, int> ();
|
||||||
|
Dictionary<Circuit,int> valeursinitiales = new Dictionary<Circuit, int> ();
|
||||||
|
Dictionary<Circuit,bool> valeurschangees = new Dictionary<Circuit, bool> ();
|
||||||
|
SeqMacroUI ui = null;
|
||||||
|
|
||||||
|
int master = 100;
|
||||||
|
|
||||||
|
public int Master {
|
||||||
|
get {
|
||||||
|
return master;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
master = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SequenceurMacro ()
|
||||||
|
{
|
||||||
|
effetcourrant = new Effet ("",valeurscourantes , TimeSpan.Zero, TimeSpan.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSpan TimeStamp {
|
||||||
|
get {
|
||||||
|
return timeStamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReadOnlyCollection<Circuit> Circuits {
|
||||||
|
get {
|
||||||
|
return circuitsSeq.AsReadOnly ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReadOnlyCollection<Effet> Effets {
|
||||||
|
get {
|
||||||
|
return effets.AsReadOnly ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeCircuits (System.Collections.Generic.List<Circuit> list)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
foreach (var c in circuitsSeq.ToArray()) {
|
||||||
|
if (!list.Contains (c))
|
||||||
|
RetireCircuit (c);
|
||||||
|
}
|
||||||
|
foreach (var c in list)
|
||||||
|
if (!circuitsSeq.Contains (c))
|
||||||
|
AjouteCircuit (c);
|
||||||
|
circuitsSeq = list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AjouteCircuit (Circuit c)
|
||||||
|
{
|
||||||
|
valeurscourantes [c] = 0;
|
||||||
|
valeursinitiales [c] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RetireCircuit (Circuit c)
|
||||||
|
{
|
||||||
|
foreach (var ef in effets) {
|
||||||
|
ef.RetireCircuit (c);
|
||||||
|
}
|
||||||
|
circuitsSeq.Remove (c);
|
||||||
|
valeurscourantes.Remove (c);
|
||||||
|
valeursinitiales.Remove (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void MajCircuitsSupprimes ()
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
foreach (var c in circuitsSeq.ToArray()) {
|
||||||
|
if (!Conduite.Courante.Circuits.Contains (c))
|
||||||
|
RetireCircuit (c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int ValeurCircuit (Circuit c)
|
||||||
|
{
|
||||||
|
if (!circuitsSeq.Contains (c))
|
||||||
|
return 0;
|
||||||
|
if(master !=100)
|
||||||
|
return valeurscourantes [c] * master /100;
|
||||||
|
return valeurscourantes [c];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ValeurBruteCircuit (Circuit c)
|
||||||
|
{
|
||||||
|
if (!circuitsSeq.Contains (c))
|
||||||
|
return 0;
|
||||||
|
return valeurscourantes [c];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeValeur (Circuit c, int value)
|
||||||
|
{
|
||||||
|
valeurschangees [c] = true;
|
||||||
|
valeurscourantes [c] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool EstChange (Circuit c)
|
||||||
|
{
|
||||||
|
return valeurschangees.ContainsKey (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool paused=false;
|
||||||
|
|
||||||
|
public bool Paused {
|
||||||
|
get {
|
||||||
|
return paused;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
paused = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Tick (TimeSpan time)
|
||||||
|
{
|
||||||
|
if (paused) return;
|
||||||
|
timeStamp += time;
|
||||||
|
|
||||||
|
if (enTransition) {
|
||||||
|
if (timeStamp < effetcourrant.Transition) {
|
||||||
|
double progression = timeStamp.TotalMilliseconds / effetcourrant.Transition.TotalMilliseconds;
|
||||||
|
foreach (Circuit c in circuitsSeq) {
|
||||||
|
if (valeurscourantes [c] != effetcourrant [c] && !valeurschangees.ContainsKey (c)) {
|
||||||
|
valeurscourantes [c] = (int)(progression * (effetcourrant [c] - valeursinitiales [c]) + valeursinitiales [c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FinDeTransition ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (effetcourrant.Duree != TimeSpan.Zero && timeStamp >= effetcourrant.Duree) {
|
||||||
|
int index = effets.IndexOf (effetcourrant) + 1;
|
||||||
|
if (index < effets.Count)
|
||||||
|
ChangeEffetCourrant (index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void FinDeTransition ()
|
||||||
|
{
|
||||||
|
enTransition = false;
|
||||||
|
foreach (Circuit c in circuitsSeq)
|
||||||
|
if(!valeurschangees.ContainsKey (c))
|
||||||
|
valeurscourantes [c] = effetcourrant [c];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SequenceurMacro.Effet EffetCourrant {
|
||||||
|
get {
|
||||||
|
return effetcourrant;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int IndexEffetCourrant {
|
||||||
|
get {
|
||||||
|
return effets.IndexOf(effetcourrant);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if(value>=0 && value < effets.Count)
|
||||||
|
ChangeEffetCourrant(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChangeEffetCourrant (int index)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
effetcourrant = effets [index];
|
||||||
|
valeurschangees.Clear ();
|
||||||
|
valeursinitiales = new Dictionary<Circuit, int> (valeurscourantes);
|
||||||
|
enTransition = true;
|
||||||
|
timeStamp = TimeSpan.Zero;
|
||||||
|
if (ui != null)
|
||||||
|
ui.EffetChange ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SauveEffet (string nom, TimeSpan duree, TimeSpan transition)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
effets.Add (effetcourrant = new Effet (nom, valeurscourantes, duree, transition));
|
||||||
|
return effets.Count-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int InsereEffetApres (int index, string nom, TimeSpan duree, TimeSpan transition)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
int pos = index+1;
|
||||||
|
if (pos >= effets.Count) return SauveEffet(nom,duree,transition);
|
||||||
|
effets.Insert (pos,effetcourrant = new Effet (nom, valeurscourantes, duree, transition));
|
||||||
|
CommandAdd(index);
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemplaceEffet (int index)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
Effet ef = effets[index];
|
||||||
|
effets[index] = new Effet (ef.Nom, valeurscourantes, ef.Duree, ef.Transition);
|
||||||
|
effetcourrant = effets[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SupprimeEffet (int index)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
effets.RemoveAt (index);
|
||||||
|
CommandRemove(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int MonteEffet (int index)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
if (index >= effets.Count || index < 1)
|
||||||
|
return index;
|
||||||
|
Effet ef = effets [index];
|
||||||
|
effets.RemoveAt (index);
|
||||||
|
effets.Insert (index - 1, ef);
|
||||||
|
CommandSwap (index - 1);
|
||||||
|
return index - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int BaisseEffet (int index)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
if (index > effets.Count - 2 || index < 0)
|
||||||
|
return index;
|
||||||
|
Effet ef = effets [index];
|
||||||
|
effets.RemoveAt (index);
|
||||||
|
effets.Insert (index + 1, ef);
|
||||||
|
CommandSwap(index);
|
||||||
|
return index + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Save (System.Xml.XmlElement parent)
|
||||||
|
{
|
||||||
|
System.Xml.XmlElement el = parent.OwnerDocument.CreateElement ("SequenceurMacro");
|
||||||
|
System.Xml.XmlElement xmlC;
|
||||||
|
|
||||||
|
parent.AppendChild (el);
|
||||||
|
el.SetAttribute ("id", ID.ToString ());
|
||||||
|
el.SetAttribute ("name", Name);
|
||||||
|
el.SetAttribute ("master", master.ToString ());
|
||||||
|
|
||||||
|
foreach (Circuit c in circuitsSeq) {
|
||||||
|
el.AppendChild(xmlC = parent.OwnerDocument.CreateElement ("CircuitSeq"));
|
||||||
|
xmlC.SetAttribute("id",c.ID.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Effet ef in effets) {
|
||||||
|
ef.Save(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override SequenceurUI GetUI ()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ui == null) {
|
||||||
|
ui = new SeqMacroUI (this);
|
||||||
|
ui.Destroyed += UiDestroyed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UiDestroyed (object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ui = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static new SequenceurMacro Load (Conduite conduite, System.Xml.XmlElement el)
|
||||||
|
{
|
||||||
|
SequenceurMacro seq = new SequenceurMacro();
|
||||||
|
seq.LoadSeq(conduite,el);
|
||||||
|
return seq;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadSeq (Conduite conduite, System.Xml.XmlElement el)
|
||||||
|
{
|
||||||
|
ID = int.Parse (el.GetAttribute ("id"));
|
||||||
|
Name = el.GetAttribute ("name");
|
||||||
|
master = int.Parse (el.GetAttribute ("master"));
|
||||||
|
|
||||||
|
foreach (var xc in el.GetElementsByTagName("CircuitSeq")) {
|
||||||
|
System.Xml.XmlElement xcir = xc as System.Xml.XmlElement;
|
||||||
|
Circuit c = conduite.GetCircuitByID (int.Parse (xcir.GetAttribute ("id")));
|
||||||
|
circuitsSeq.Add (c);
|
||||||
|
AjouteCircuit (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var xe in el.GetElementsByTagName("Effet"))
|
||||||
|
effets.Add(Effet.Load(conduite,xe as System.Xml.XmlElement));
|
||||||
|
}
|
||||||
|
|
||||||
|
static System.Text.RegularExpressions.Regex regexCommand1 = new System.Text.RegularExpressions.Regex(
|
||||||
|
@"(?<effet>\d+)(t(?<transition>\d+))?",
|
||||||
|
System.Text.RegularExpressions.RegexOptions.Compiled);
|
||||||
|
|
||||||
|
static System.Text.RegularExpressions.Regex regexCommand2 = new System.Text.RegularExpressions.Regex(
|
||||||
|
@"(?<effet>\d+)(?<params>(t\d+)?)?",
|
||||||
|
System.Text.RegularExpressions.RegexOptions.Compiled);
|
||||||
|
|
||||||
|
public override void Command (string command)
|
||||||
|
{
|
||||||
|
lock (this) {
|
||||||
|
var cmd = regexCommand1.Match(command);
|
||||||
|
|
||||||
|
if (cmd.Success) {
|
||||||
|
if (cmd.Groups ["effet"].Success) {
|
||||||
|
int effet = int.Parse (cmd.Groups ["effet"].Value) - 1;
|
||||||
|
if (effet < effets.Count)
|
||||||
|
ChangeEffetCourrant (effet);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd.Groups ["transition"].Success) {
|
||||||
|
int transition = int.Parse (cmd.Groups ["transition"].Value);
|
||||||
|
effetcourrant = new Effet ("", effetcourrant.Valeurs, effetcourrant.Duree, TimeSpan.FromMilliseconds (transition * 100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandAdd (int index)
|
||||||
|
{
|
||||||
|
lock (Conduite.Courante.SequenceurMaitre) {
|
||||||
|
string[] commands = Conduite.Courante.SequenceurMaitre.GetCommands (this);
|
||||||
|
|
||||||
|
for (int i = 0; i < commands.Length; i++) {
|
||||||
|
var cmd = regexCommand2.Match(commands[i]);
|
||||||
|
if(cmd.Success){
|
||||||
|
int ef = int.Parse(cmd.Groups["effet"].Value);
|
||||||
|
if (ef-1>index) {
|
||||||
|
ef++;
|
||||||
|
commands[i] = ef.ToString() + cmd.Groups["params"].Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Conduite.Courante.SequenceurMaitre.SetCommands(this,commands);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandRemove (int index)
|
||||||
|
{
|
||||||
|
lock (Conduite.Courante.SequenceurMaitre) {
|
||||||
|
string[] commands = Conduite.Courante.SequenceurMaitre.GetCommands (this);
|
||||||
|
|
||||||
|
for (int i = 0; i < commands.Length; i++) {
|
||||||
|
var cmd = regexCommand2.Match(commands[i]);
|
||||||
|
if(cmd.Success){
|
||||||
|
int ef = int.Parse(cmd.Groups["effet"].Value);
|
||||||
|
if (ef-1 == index)
|
||||||
|
commands[i] = string.Empty;
|
||||||
|
else if (ef-1>index) {
|
||||||
|
ef--;
|
||||||
|
commands[i] = ef.ToString() + cmd.Groups["params"].Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Conduite.Courante.SequenceurMaitre.SetCommands(this,commands);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandSwap (int index)
|
||||||
|
{
|
||||||
|
lock (Conduite.Courante.SequenceurMaitre) {
|
||||||
|
string[] commands = Conduite.Courante.SequenceurMaitre.GetCommands (this);
|
||||||
|
|
||||||
|
// numeros a swapper
|
||||||
|
int a = index+1;
|
||||||
|
int b = index+2;
|
||||||
|
|
||||||
|
for (int i = 0; i < commands.Length; i++) {
|
||||||
|
var cmd = regexCommand2.Match(commands[i]);
|
||||||
|
if(cmd.Success){
|
||||||
|
int ef = int.Parse(cmd.Groups["effet"].Value);
|
||||||
|
if (ef == a)
|
||||||
|
commands[i] = b.ToString() + cmd.Groups["params"].Value;
|
||||||
|
if (ef == b)
|
||||||
|
commands[i] = a.ToString() + cmd.Groups["params"].Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Conduite.Courante.SequenceurMaitre.SetCommands(this,commands);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
197
DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs
Normal file
197
DMX-2.0/gtk-gui/DMX2.SeqMacroUI.cs
Normal file
|
|
@ -0,0 +1,197 @@
|
||||||
|
|
||||||
|
// This file has been generated by the GUI designer. Do not modify.
|
||||||
|
namespace DMX2
|
||||||
|
{
|
||||||
|
public partial class SeqMacroUI
|
||||||
|
{
|
||||||
|
private global::Gtk.UIManager UIManager;
|
||||||
|
private global::Gtk.ToggleAction closeAction;
|
||||||
|
private global::Gtk.Action circuitsAction;
|
||||||
|
private global::Gtk.Action goForwardAction;
|
||||||
|
private global::Gtk.Action goBackAction;
|
||||||
|
private global::Gtk.Action mediaPauseAction;
|
||||||
|
private global::Gtk.Action mediaNextAction;
|
||||||
|
private global::Gtk.Frame frame1;
|
||||||
|
private global::Gtk.Alignment GtkAlignment;
|
||||||
|
private global::Gtk.Alignment alignment1;
|
||||||
|
private global::Gtk.VBox vbox2;
|
||||||
|
private global::Gtk.HBox hbox1;
|
||||||
|
private global::Gtk.VBox vbox3;
|
||||||
|
private global::Gtk.HBox hbox2;
|
||||||
|
private global::Gtk.Label posLabel;
|
||||||
|
private global::Gtk.Label label56;
|
||||||
|
private global::Gtk.HScale seqMasterScale;
|
||||||
|
private global::Gtk.ProgressBar pbTrans;
|
||||||
|
private global::Gtk.Toolbar toolbar2;
|
||||||
|
private global::Gtk.Toolbar toolbar1;
|
||||||
|
private global::Gtk.ScrolledWindow scrolledwindow1;
|
||||||
|
private global::Gtk.TreeView MatriceUI;
|
||||||
|
private global::Gtk.Label titreLabel;
|
||||||
|
|
||||||
|
protected virtual void Build ()
|
||||||
|
{
|
||||||
|
global::Stetic.Gui.Initialize (this);
|
||||||
|
// Widget DMX2.SeqMacroUI
|
||||||
|
Stetic.BinContainer w1 = global::Stetic.BinContainer.Attach (this);
|
||||||
|
this.UIManager = new global::Gtk.UIManager ();
|
||||||
|
global::Gtk.ActionGroup w2 = new global::Gtk.ActionGroup ("Default");
|
||||||
|
this.closeAction = new global::Gtk.ToggleAction ("closeAction", global::Mono.Unix.Catalog.GetString (" "), null, "gtk-close");
|
||||||
|
this.closeAction.ShortLabel = global::Mono.Unix.Catalog.GetString (" ");
|
||||||
|
w2.Add (this.closeAction, null);
|
||||||
|
this.circuitsAction = new global::Gtk.Action ("circuitsAction", null, null, "circuits");
|
||||||
|
w2.Add (this.circuitsAction, null);
|
||||||
|
this.goForwardAction = new global::Gtk.Action ("goForwardAction", null, null, "gtk-go-forward");
|
||||||
|
w2.Add (this.goForwardAction, null);
|
||||||
|
this.goBackAction = new global::Gtk.Action ("goBackAction", null, null, "gtk-go-back");
|
||||||
|
w2.Add (this.goBackAction, null);
|
||||||
|
this.mediaPauseAction = new global::Gtk.Action ("mediaPauseAction", null, null, "gtk-media-pause");
|
||||||
|
w2.Add (this.mediaPauseAction, null);
|
||||||
|
this.mediaNextAction = new global::Gtk.Action ("mediaNextAction", null, null, "gtk-media-next");
|
||||||
|
w2.Add (this.mediaNextAction, null);
|
||||||
|
this.UIManager.InsertActionGroup (w2, 0);
|
||||||
|
this.Name = "DMX2.SeqMacroUI";
|
||||||
|
// Container child DMX2.SeqMacroUI.Gtk.Container+ContainerChild
|
||||||
|
this.frame1 = new global::Gtk.Frame ();
|
||||||
|
this.frame1.Name = "frame1";
|
||||||
|
this.frame1.ShadowType = ((global::Gtk.ShadowType)(0));
|
||||||
|
// Container child frame1.Gtk.Container+ContainerChild
|
||||||
|
this.GtkAlignment = new global::Gtk.Alignment (0F, 0F, 1F, 1F);
|
||||||
|
this.GtkAlignment.Name = "GtkAlignment";
|
||||||
|
this.GtkAlignment.LeftPadding = ((uint)(12));
|
||||||
|
// Container child GtkAlignment.Gtk.Container+ContainerChild
|
||||||
|
this.alignment1 = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F);
|
||||||
|
this.alignment1.Name = "alignment1";
|
||||||
|
// Container child alignment1.Gtk.Container+ContainerChild
|
||||||
|
this.vbox2 = new global::Gtk.VBox ();
|
||||||
|
this.vbox2.Name = "vbox2";
|
||||||
|
this.vbox2.Spacing = 6;
|
||||||
|
// Container child vbox2.Gtk.Box+BoxChild
|
||||||
|
this.hbox1 = new global::Gtk.HBox ();
|
||||||
|
this.hbox1.Name = "hbox1";
|
||||||
|
this.hbox1.Spacing = 6;
|
||||||
|
// Container child hbox1.Gtk.Box+BoxChild
|
||||||
|
this.vbox3 = new global::Gtk.VBox ();
|
||||||
|
this.vbox3.Name = "vbox3";
|
||||||
|
// Container child vbox3.Gtk.Box+BoxChild
|
||||||
|
this.hbox2 = new global::Gtk.HBox ();
|
||||||
|
this.hbox2.Name = "hbox2";
|
||||||
|
this.hbox2.Spacing = 6;
|
||||||
|
// Container child hbox2.Gtk.Box+BoxChild
|
||||||
|
this.posLabel = new global::Gtk.Label ();
|
||||||
|
this.posLabel.Name = "posLabel";
|
||||||
|
this.posLabel.Xpad = 10;
|
||||||
|
this.posLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("<big>n° 0</big>");
|
||||||
|
this.posLabel.UseMarkup = true;
|
||||||
|
this.hbox2.Add (this.posLabel);
|
||||||
|
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.posLabel]));
|
||||||
|
w3.Position = 0;
|
||||||
|
w3.Expand = false;
|
||||||
|
w3.Fill = false;
|
||||||
|
// Container child hbox2.Gtk.Box+BoxChild
|
||||||
|
this.label56 = new global::Gtk.Label ();
|
||||||
|
this.label56.Name = "label56";
|
||||||
|
this.label56.Xpad = 10;
|
||||||
|
this.label56.LabelProp = global::Mono.Unix.Catalog.GetString ("<big>00.0</big>");
|
||||||
|
this.label56.UseMarkup = true;
|
||||||
|
this.hbox2.Add (this.label56);
|
||||||
|
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.label56]));
|
||||||
|
w4.PackType = ((global::Gtk.PackType)(1));
|
||||||
|
w4.Position = 1;
|
||||||
|
w4.Expand = false;
|
||||||
|
w4.Fill = false;
|
||||||
|
this.vbox3.Add (this.hbox2);
|
||||||
|
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox2]));
|
||||||
|
w5.Position = 0;
|
||||||
|
w5.Expand = false;
|
||||||
|
w5.Fill = false;
|
||||||
|
// Container child vbox3.Gtk.Box+BoxChild
|
||||||
|
this.seqMasterScale = new global::Gtk.HScale (null);
|
||||||
|
this.seqMasterScale.CanFocus = true;
|
||||||
|
this.seqMasterScale.Name = "seqMasterScale";
|
||||||
|
this.seqMasterScale.Adjustment.Upper = 100;
|
||||||
|
this.seqMasterScale.Adjustment.PageIncrement = 10;
|
||||||
|
this.seqMasterScale.Adjustment.StepIncrement = 1;
|
||||||
|
this.seqMasterScale.Adjustment.Value = 100;
|
||||||
|
this.seqMasterScale.DrawValue = true;
|
||||||
|
this.seqMasterScale.Digits = 0;
|
||||||
|
this.seqMasterScale.ValuePos = ((global::Gtk.PositionType)(1));
|
||||||
|
this.vbox3.Add (this.seqMasterScale);
|
||||||
|
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.seqMasterScale]));
|
||||||
|
w6.Position = 1;
|
||||||
|
w6.Expand = false;
|
||||||
|
w6.Fill = false;
|
||||||
|
// Container child vbox3.Gtk.Box+BoxChild
|
||||||
|
this.pbTrans = new global::Gtk.ProgressBar ();
|
||||||
|
this.pbTrans.HeightRequest = 15;
|
||||||
|
this.pbTrans.Name = "pbTrans";
|
||||||
|
this.vbox3.Add (this.pbTrans);
|
||||||
|
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.pbTrans]));
|
||||||
|
w7.Position = 2;
|
||||||
|
w7.Expand = false;
|
||||||
|
w7.Fill = false;
|
||||||
|
// Container child vbox3.Gtk.Box+BoxChild
|
||||||
|
this.UIManager.AddUiFromString ("<ui><toolbar name='toolbar2'><toolitem name='goForwardAction' action='goForwardAction'/><toolitem name='goBackAction' action='goBackAction'/><toolitem name='mediaPauseAction' action='mediaPauseAction'/><toolitem name='mediaNextAction' action='mediaNextAction'/></toolbar></ui>");
|
||||||
|
this.toolbar2 = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar2")));
|
||||||
|
this.toolbar2.Name = "toolbar2";
|
||||||
|
this.toolbar2.ShowArrow = false;
|
||||||
|
this.vbox3.Add (this.toolbar2);
|
||||||
|
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.toolbar2]));
|
||||||
|
w8.Position = 3;
|
||||||
|
w8.Expand = false;
|
||||||
|
w8.Fill = false;
|
||||||
|
this.hbox1.Add (this.vbox3);
|
||||||
|
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox3]));
|
||||||
|
w9.Position = 0;
|
||||||
|
w9.Expand = false;
|
||||||
|
w9.Fill = false;
|
||||||
|
// Container child hbox1.Gtk.Box+BoxChild
|
||||||
|
this.UIManager.AddUiFromString ("<ui><toolbar name='toolbar1'><toolitem name='closeAction' action='closeAction'/><toolitem name='circuitsAction' action='circuitsAction'/></toolbar></ui>");
|
||||||
|
this.toolbar1 = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar1")));
|
||||||
|
this.toolbar1.Name = "toolbar1";
|
||||||
|
this.toolbar1.Orientation = ((global::Gtk.Orientation)(1));
|
||||||
|
this.toolbar1.ShowArrow = false;
|
||||||
|
this.toolbar1.ToolbarStyle = ((global::Gtk.ToolbarStyle)(0));
|
||||||
|
this.toolbar1.IconSize = ((global::Gtk.IconSize)(2));
|
||||||
|
this.hbox1.Add (this.toolbar1);
|
||||||
|
global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.toolbar1]));
|
||||||
|
w10.PackType = ((global::Gtk.PackType)(1));
|
||||||
|
w10.Position = 1;
|
||||||
|
w10.Expand = false;
|
||||||
|
w10.Fill = false;
|
||||||
|
this.vbox2.Add (this.hbox1);
|
||||||
|
global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1]));
|
||||||
|
w11.Position = 0;
|
||||||
|
w11.Expand = false;
|
||||||
|
w11.Fill = false;
|
||||||
|
// Container child vbox2.Gtk.Box+BoxChild
|
||||||
|
this.scrolledwindow1 = new global::Gtk.ScrolledWindow ();
|
||||||
|
this.scrolledwindow1.CanFocus = true;
|
||||||
|
this.scrolledwindow1.Name = "scrolledwindow1";
|
||||||
|
this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1));
|
||||||
|
// Container child scrolledwindow1.Gtk.Container+ContainerChild
|
||||||
|
this.MatriceUI = new global::Gtk.TreeView ();
|
||||||
|
this.MatriceUI.CanFocus = true;
|
||||||
|
this.MatriceUI.Name = "MatriceUI";
|
||||||
|
this.scrolledwindow1.Add (this.MatriceUI);
|
||||||
|
this.vbox2.Add (this.scrolledwindow1);
|
||||||
|
global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow1]));
|
||||||
|
w13.Position = 1;
|
||||||
|
this.alignment1.Add (this.vbox2);
|
||||||
|
this.GtkAlignment.Add (this.alignment1);
|
||||||
|
this.frame1.Add (this.GtkAlignment);
|
||||||
|
this.titreLabel = new global::Gtk.Label ();
|
||||||
|
this.titreLabel.Name = "titreLabel";
|
||||||
|
this.titreLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Séquenceur Macro");
|
||||||
|
this.titreLabel.UseMarkup = true;
|
||||||
|
this.frame1.LabelWidget = this.titreLabel;
|
||||||
|
this.Add (this.frame1);
|
||||||
|
if ((this.Child != null)) {
|
||||||
|
this.Child.ShowAll ();
|
||||||
|
}
|
||||||
|
w1.SetUiManager (UIManager);
|
||||||
|
this.Hide ();
|
||||||
|
this.closeAction.Activated += new global::System.EventHandler (this.OnCloseActionActivated);
|
||||||
|
this.circuitsAction.Activated += new global::System.EventHandler (this.OnCircuitsActionActivated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue