This commit is contained in:
manu 2013-09-29 19:48:16 +00:00
parent 4dc8f25bae
commit 5163fe6d82
3 changed files with 88 additions and 6 deletions

View file

@ -10,6 +10,7 @@ namespace DMX2
{ {
static MainWindow win; static MainWindow win;
static object circuitKey = new object(); static object circuitKey = new object();
ListStore ls;
public static MainWindow Win { public static MainWindow Win {
get { return 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; showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = true;
openAction.Sensitive = newAction.Sensitive = false; openAction.Sensitive = newAction.Sensitive = false;
this.Title = "DMX 2.0 - " + Conduite.Courante.Name; this.Title = "DMX 2.0 - " + Conduite.Courante.Name;
ConstruitMatrice();
} else { } else {
showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = false; showAllAction.Sensitive = universAction.Sensitive = masterScale.Sensitive = seqLinAction.Sensitive = circAction.Sensitive = saveAction.Sensitive = saveAsAction.Sensitive = closeAction.Sensitive = false;
openAction.Sensitive = newAction.Sensitive = true; 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) protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{ {
Application.Quit (); Application.Quit ();

View file

@ -330,6 +330,7 @@ namespace DMX2
protected void OnApplyActionActivated (object sender, EventArgs e) protected void OnApplyActionActivated (object sender, EventArgs e)
{ {
int pos = IndexEffetSelectionne(); int pos = IndexEffetSelectionne();
if(pos==-1) return;
sequenceur.RemplaceEffet(pos); sequenceur.RemplaceEffet(pos);
UpdListeEffets(); UpdListeEffets();
effetsListe.SetCursor(new TreePath( new int[1] {pos}) ,null,false); effetsListe.SetCursor(new TreePath( new int[1] {pos}) ,null,false);
@ -344,7 +345,9 @@ namespace DMX2
protected void OnDeleteActionActivated (object sender, EventArgs e) protected void OnDeleteActionActivated (object sender, EventArgs e)
{ {
sequenceur.SupprimeEffet(IndexEffetSelectionne()); int pos = IndexEffetSelectionne();
if(pos==-1) return;
sequenceur.SupprimeEffet(pos);
UpdListeEffets(); UpdListeEffets();
} }

View file

@ -7,11 +7,32 @@ namespace DMX2
{ {
public class Ligne { public class Ligne {
public Ligne(){} public Ligne(){}
Dictionary<Sequenceur,int> data = new Dictionary<Sequenceur, int>(); string nom;
public int this [Sequenceur index] { int duree = -1;
Dictionary<Sequenceur,string> data = new Dictionary<Sequenceur, string>();
public string Nom {
get { get {
int value; return nom;
if(!data.TryGetValue(index, out value)) return -1; }
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; return value;
} }
set { set {
@ -22,6 +43,8 @@ namespace DMX2
List<Ligne> lignes = new List<Ligne>(); List<Ligne> lignes = new List<Ligne>();
public List<Ligne> Lignes { public List<Ligne> Lignes {
get { get {
return lignes; return lignes;
@ -34,4 +57,3 @@ namespace DMX2
} }
} }
} }