Ajout et prise en compte des commandes dans le sequenceur maitre

This commit is contained in:
tzim 2013-10-12 20:09:32 +00:00
parent ab06a57225
commit a7d6aa210f
5 changed files with 94 additions and 29 deletions

View file

@ -9,7 +9,7 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("arnaud")]
[assembly: AssemblyCopyright("Emmanuel Langlois et Arnaud Houdelette")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -17,7 +17,7 @@ using System.Runtime.CompilerServices;
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

View file

@ -30,6 +30,8 @@ namespace DMX2
protected void ConstruitMatrice ()
{
var idCol = new Gtk.TreeViewColumn ();
var idCell = new Gtk.CellRendererText ();
idCol.Title = "Num";
@ -63,12 +65,20 @@ namespace DMX2
FillMatrice();
}
void DetruitMatrice ()
{
this.MatriceUI.Model = null;
if (lsMatrice != null) lsMatrice.Dispose();
foreach (var col in MatriceUI.Columns)
MatriceUI.RemoveColumn (col);
}
static object seqkey = new object();
void ConstruitMatriceSeqColumns ()
{
foreach(var c in MatriceUI.Columns)
if(c.CellRenderers[0].Data.ContainsKey(seqkey))
MatriceUI.RemoveColumn(c);
@ -93,7 +103,7 @@ namespace DMX2
void RenderMatriceNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{
if (Conduite.Courante==null) return;
string num=string.Empty;
SequenceurMaitre.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMaitre.Ligne;
if( Conduite.Courante.SequenceurMaitre.IndexLigneEnCours == Conduite.Courante.SequenceurMaitre.Lignes.IndexOf(l) )
@ -105,12 +115,14 @@ namespace DMX2
void RenderMatriceNom (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{
if (Conduite.Courante==null) return;
SequenceurMaitre.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMaitre.Ligne;
(cell as Gtk.CellRendererText).Text = l.Nom;
}
void RenderMatriceDuree (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{
if (Conduite.Courante==null) return;
SequenceurMaitre.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMaitre.Ligne;
if (l.Duree== TimeSpan.Zero) (cell as Gtk.CellRendererText).Text = string.Empty;
else (cell as Gtk.CellRendererText).Text = (l.Duree.TotalMilliseconds /100).ToString();
@ -118,6 +130,7 @@ namespace DMX2
void RenderMatriceSeqVal (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{
if (Conduite.Courante==null) return;
SequenceurMaitre.Ligne l = tree_model.GetValue (iter, 0) as SequenceurMaitre.Ligne;
Sequenceur seq = cell.Data[seqkey] as Sequenceur;
(cell as Gtk.CellRendererText).Text = l[seq];
@ -183,16 +196,11 @@ namespace DMX2
FillMatrice();
SelectionneEffet(pos);
}
void OnMatriceNumColClicked (object sender, EventArgs e)
{
throw new NotImplementedException ();
}
protected void OnBtnRetireLigneClicked (object sender, EventArgs e)
{
throw new System.NotImplementedException ();
Conduite.Courante.SequenceurMaitre.RetireLigne(IndexEffetSelectionne());
FillMatrice();
}
protected void OnBtnGoBackClicked (object sender, EventArgs e)
@ -209,6 +217,7 @@ namespace DMX2
protected void OnMatriceUICursorChanged (object sender, EventArgs e)
{
if (Conduite.Courante==null) return;
TreeViewColumn col;
TreePath path;
MatriceUI.GetCursor (out path, out col);
@ -369,12 +378,9 @@ namespace DMX2
} catch (IOException) {
}
foreach (Sequenceur s in Conduite.Courante.Sequenceurs) {
VBox newvbox = new VBox();
newvbox.PackStart(s.GetUI(),false,false,0);
onglets.Add (newvbox);
onglets.ShowAll();
}
foreach (Sequenceur s in Conduite.Courante.Sequenceurs)
AddSeqUI (s);
MajWidgets();
NextUpdateFull();
}
@ -408,7 +414,9 @@ namespace DMX2
{
VBox newvbox = new VBox();
newvbox.PackStart(s.GetUI(),false,false,0);
onglets.Add (newvbox);
Widget label = new Gtk.Label(s.Name);
//onglets.Add (newvbox);
onglets.AppendPage(newvbox,label);
onglets.ShowAll();
}
@ -417,12 +425,14 @@ namespace DMX2
foreach (var notebookvbox in onglets.Children)
notebookvbox.Destroy();
foreach (Sequenceur s in Conduite.Courante.Sequenceurs) {
foreach (Sequenceur s in Conduite.Courante.Sequenceurs)
AddSeqUI(s);
/*{
VBox newvbox = new VBox();
newvbox.PackStart(s.GetUI(),false,false,0);
onglets.Add (newvbox);
onglets.ShowAll();
}
}*/
}
@ -467,14 +477,21 @@ namespace DMX2
{
if (Conduite.Courante != null) {
//Activation / Désactivation des boutons en fonction de l'état de la counduite courante
showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = true;
btnAjoutLigne.Sensitive = btnRetireLigne.Sensitive = btnGo.Sensitive = btnGoBack.Sensitive =
showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive =
seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive =
saveAsAction.Sensitive = closeAction.Sensitive = true;
openAction.Sensitive = newAction.Sensitive = false;
this.Title = "DMX 2.0 - " + Conduite.Courante.Name;
ConstruitMatrice();
} else {
showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = false;
btnAjoutLigne.Sensitive = btnRetireLigne.Sensitive = btnGo.Sensitive = btnGoBack.Sensitive =
showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive =
seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive =
saveAsAction.Sensitive = closeAction.Sensitive = false;
openAction.Sensitive = newAction.Sensitive = true;
this.Title = "DMX 2.0";
DetruitMatrice();
}
}

View file

@ -64,7 +64,7 @@ namespace DMX2
public abstract void Save (XmlElement parent);
public abstract void Command (string command);
}

View file

@ -39,6 +39,11 @@ namespace DMX2
}
}
public Dictionary<Circuit, int> Valeurs {
get {
return _valeurs;
}
}
public void RetireCircuit (Circuit c)
{
_valeurs.Remove (c);
@ -371,7 +376,7 @@ namespace DMX2
ui = null;
}
public static SequenceurLineaire Load (Conduite conduite, System.Xml.XmlElement el)
public static new SequenceurLineaire Load (Conduite conduite, System.Xml.XmlElement el)
{
SequenceurLineaire seq = new SequenceurLineaire();
seq.LoadSeq(conduite,el);
@ -394,5 +399,25 @@ namespace DMX2
foreach (var xe in el.GetElementsByTagName("Effet"))
effets.Add(Effet.Load(conduite,xe as System.Xml.XmlElement));
}
public override void Command (string command)
{
lock (this) {
var cmd = System.Text.RegularExpressions.Regex.Match (command, @"(?<effet>\d+)(t(?<transition>\d+))?");
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));
}
}
}
}
}
}

View file

@ -75,8 +75,6 @@ namespace DMX2
}
return l;
}
}
List<Ligne> lignes = new List<Ligne>();
@ -123,6 +121,7 @@ namespace DMX2
aSuivre = null;
timeStamp = TimeSpan.Zero;
change = true;
LanceSequenceurs();
}
}
@ -136,9 +135,19 @@ namespace DMX2
aSuivre = null;
timeStamp = TimeSpan.Zero;
change = true;
LanceSequenceurs();
}
}
void LanceSequenceurs ()
{
foreach (Sequenceur s in Conduite.Courante.Sequenceurs) {
if(enCours[s].Length > 0)
s.Command(enCours[s]);
}
}
public ReadOnlyCollection<Ligne> Lignes {
get {
return lignes.AsReadOnly();
@ -158,6 +167,20 @@ namespace DMX2
}
}
public void RetireLigne (int pos)
{
lock (this) {
if(lignes[pos]== enCours)
{
enCours=null;
if(pos+1 < lignes.Count)
aSuivre = lignes[pos+1];
}
if(lignes[pos] == aSuivre)
aSuivre=null;
lignes.RemoveAt(pos);
}
}
public void Tick (TimeSpan deltaT)
{
timeStamp += deltaT;