Ajout du patch rapide
This commit is contained in:
parent
20205a607a
commit
eaf4e7a040
1 changed files with 90 additions and 1 deletions
|
|
@ -1,5 +1,8 @@
|
|||
using System;
|
||||
using Gtk;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace DMX2
|
||||
{
|
||||
public partial class EditionUnivers : Gtk.Dialog
|
||||
|
|
@ -12,6 +15,8 @@ namespace DMX2
|
|||
ConstruitCBCircuits();
|
||||
ConstruitCBFT();
|
||||
ConstruitListeDimmer();
|
||||
|
||||
ConstruitListeCircuits();
|
||||
}
|
||||
|
||||
ListStore lsCbUnivers = new ListStore(typeof(UniversDMX));
|
||||
|
|
@ -244,7 +249,9 @@ namespace DMX2
|
|||
|
||||
protected void OnTvDimmCursorChanged (object sender, EventArgs e)
|
||||
{
|
||||
spinDimmer.Value = tvDimm.Selection.GetSelectedRows()[0].Indices[0]+1;
|
||||
var rows = tvDimm.Selection.GetSelectedRows();
|
||||
if(rows.Length>0)
|
||||
spinDimmer.Value = rows[0].Indices[0]+1;
|
||||
}
|
||||
|
||||
protected void OnBtPatchDroitClicked (object sender, EventArgs e)
|
||||
|
|
@ -304,5 +311,87 @@ namespace DMX2
|
|||
MajListeDimmer ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ListStore lsCircuits = new ListStore(typeof(Circuit));
|
||||
void ConstruitListeCircuits ()
|
||||
{
|
||||
|
||||
var cirCol = new Gtk.TreeViewColumn();
|
||||
var cirCell = new Gtk.CellRendererText();
|
||||
cirCol.Title = "Circuit";
|
||||
cirCol.PackStart(cirCell,true);
|
||||
cirCol.SetCellDataFunc(cirCell, new Gtk.TreeCellDataFunc( RenderCircuitsCol) );
|
||||
tvCircuits.AppendColumn(cirCol);
|
||||
|
||||
var dimmCol = new Gtk.TreeViewColumn();
|
||||
var dimmCell = new Gtk.CellRendererText();
|
||||
dimmCol.Title = "Dimmers";
|
||||
dimmCol.PackEnd(dimmCell,true);
|
||||
dimmCol.SetCellDataFunc(dimmCell, new Gtk.TreeCellDataFunc( RenderCircuitsDimmCol) );
|
||||
dimmCell.Editable = true;
|
||||
dimmCell.Edited += OnDimmerListEdited;
|
||||
tvCircuits.AppendColumn(dimmCol);
|
||||
|
||||
tvCircuits.Model = lsCircuits;
|
||||
MajListeCircuits();
|
||||
|
||||
}
|
||||
|
||||
void MajListeCircuits()
|
||||
{
|
||||
lsCircuits.Clear();
|
||||
foreach (Circuit c in Conduite.Courante.Circuits)
|
||||
lsCircuits.AppendValues(c);
|
||||
}
|
||||
|
||||
void RenderCircuitsCol (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||
{
|
||||
|
||||
Circuit c = (Circuit)(tree_model.GetValue (iter, 0));
|
||||
(cell as Gtk.CellRendererText).Text = c.Name;
|
||||
|
||||
}
|
||||
|
||||
void RenderCircuitsDimmCol (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||
{
|
||||
Circuit c = (Circuit)(tree_model.GetValue (iter, 0));
|
||||
List<string> dimmers = new List<string>();
|
||||
|
||||
for (int i=0; i< universEdite.Dimmers.Length; i++) {
|
||||
if(universEdite.Dimmers[i].circuitAssocié == c)
|
||||
dimmers.Add(string.Format("{0} ",i +1));
|
||||
}
|
||||
|
||||
(cell as Gtk.CellRendererText).Text =
|
||||
string.Concat(dimmers);
|
||||
|
||||
}
|
||||
|
||||
void OnDimmerListEdited (object o, EditedArgs args)
|
||||
{
|
||||
Gtk.TreeIter iter;
|
||||
lsCircuits.GetIter (out iter, new Gtk.TreePath (args.Path));
|
||||
Circuit c = lsCircuits.GetValue (iter, 0) as Circuit;
|
||||
|
||||
string[] newdimlist = args.NewText.Split (' ','.');
|
||||
|
||||
int val;
|
||||
|
||||
for (int i=0; i< universEdite.Dimmers.Length; i++) {
|
||||
if(universEdite.Dimmers[i].circuitAssocié == c)
|
||||
universEdite.Dimmers[i].circuitAssocié= null;
|
||||
}
|
||||
|
||||
foreach (string dim in newdimlist) {
|
||||
if(int.TryParse(dim, out val))
|
||||
{
|
||||
val--;
|
||||
if(val>=0 && val < universEdite.Dimmers.Length)
|
||||
universEdite.Dimmers[val].circuitAssocié = c;
|
||||
}
|
||||
}
|
||||
MajListeDimmer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue