From 5163fe6d82cf45ebb4235c3948d2e834c55eb95c Mon Sep 17 00:00:00 2001 From: manu Date: Sun, 29 Sep 2013 19:48:16 +0000 Subject: [PATCH] --- DMX-2.0/MainWindow.cs | 57 +++++++++++++++++++++++++++++++++++++ DMX-2.0/SeqLinUI.cs | 5 +++- DMX-2.0/SequenceurMaitre.cs | 32 +++++++++++++++++---- 3 files changed, 88 insertions(+), 6 deletions(-) diff --git a/DMX-2.0/MainWindow.cs b/DMX-2.0/MainWindow.cs index c4302d3..e7eb228 100644 --- a/DMX-2.0/MainWindow.cs +++ b/DMX-2.0/MainWindow.cs @@ -10,6 +10,7 @@ namespace DMX2 { static MainWindow win; static object circuitKey = new object(); + ListStore ls; public static MainWindow Win { get { return win; } @@ -29,6 +30,7 @@ namespace DMX2 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; openAction.Sensitive = newAction.Sensitive = true; @@ -59,6 +61,61 @@ namespace DMX2 } } + protected void ConstruitMatrice () + { + 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 dureeCol = new Gtk.TreeViewColumn(); + var dureeCell = new Gtk.CellRendererText(); + dureeCol.Title = "Durée"; + dureeCol.PackStart(dureeCell,true); + dureeCol.SetCellDataFunc(dureeCell, new Gtk.TreeCellDataFunc( RenderMatriceDuree) ); + dureeCell.Editable =true; + dureeCell.Edited += OnDureeCellEdited; + this.MatriceUI.AppendColumn(dureeCol); + + ls = new Gtk.ListStore(typeof (SequenceurMaitre.Ligne)); + this.MatriceUI.Model = ls; + } + + 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 RenderMatriceDuree (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) + { + throw new NotImplementedException (); + } + void OnNomCellEdited (object o, EditedArgs args) + { + throw new NotImplementedException (); + } + + void OnDureeCellEdited (object o, EditedArgs args) + { + throw new NotImplementedException (); + } + protected void OnDeleteEvent (object sender, DeleteEventArgs a) { Application.Quit (); diff --git a/DMX-2.0/SeqLinUI.cs b/DMX-2.0/SeqLinUI.cs index 14bcb9b..dbff8a9 100644 --- a/DMX-2.0/SeqLinUI.cs +++ b/DMX-2.0/SeqLinUI.cs @@ -330,6 +330,7 @@ namespace DMX2 protected void OnApplyActionActivated (object sender, EventArgs e) { int pos = IndexEffetSelectionne(); + if(pos==-1) return; sequenceur.RemplaceEffet(pos); UpdListeEffets(); effetsListe.SetCursor(new TreePath( new int[1] {pos}) ,null,false); @@ -344,7 +345,9 @@ namespace DMX2 protected void OnDeleteActionActivated (object sender, EventArgs e) { - sequenceur.SupprimeEffet(IndexEffetSelectionne()); + int pos = IndexEffetSelectionne(); + if(pos==-1) return; + sequenceur.SupprimeEffet(pos); UpdListeEffets(); } diff --git a/DMX-2.0/SequenceurMaitre.cs b/DMX-2.0/SequenceurMaitre.cs index 267b3a8..f681fdf 100644 --- a/DMX-2.0/SequenceurMaitre.cs +++ b/DMX-2.0/SequenceurMaitre.cs @@ -7,11 +7,32 @@ namespace DMX2 { public class Ligne { public Ligne(){} - Dictionary data = new Dictionary(); - public int this [Sequenceur index] { + string nom; + int duree = -1; + Dictionary data = new Dictionary(); + + public string Nom { get { - int value; - if(!data.TryGetValue(index, out value)) return -1; + return nom; + } + set { + nom = value; + } + } + + public int Duree { + get { + return duree; + } + set { + duree = value; + } + } + + public string this [Sequenceur index] { + get { + string value; + if(!data.TryGetValue(index, out value)) return string.Empty; return value; } set { @@ -22,6 +43,8 @@ namespace DMX2 List lignes = new List(); + + public List Lignes { get { return lignes; @@ -34,4 +57,3 @@ namespace DMX2 } } } -