Modif seq lin
This commit is contained in:
parent
b44dbd914d
commit
58337e6c23
7 changed files with 158 additions and 48 deletions
|
|
@ -1,13 +1,12 @@
|
|||
<Properties>
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/MainWindow.cs">
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/SeqLinUI.cs">
|
||||
<Files>
|
||||
<File FileName="DMX-2.0/SeqLinUI.cs" Line="93" Column="16" />
|
||||
<File FileName="DMX-2.0/SequenceurLineaire.cs" Line="73" Column="50" />
|
||||
<File FileName="DMX-2.0/Conduite.cs" Line="128" Column="4" />
|
||||
<File FileName="DMX-2.0/Sequenceur.cs" Line="42" Column="4" />
|
||||
<File FileName="DMX-2.0/SequenceurUI.cs" Line="20" Column="42" />
|
||||
<File FileName="DMX-2.0/MainWindow.cs" Line="130" Column="5" />
|
||||
<File FileName="DMX-2.0/SequenceurLineaire.cs" Line="152" Column="36" />
|
||||
<File FileName="DMX-2.0/Conduite.cs" Line="129" Column="4" />
|
||||
<File FileName="DMX-2.0/SeqLinUI.cs" Line="92" Column="3" />
|
||||
<File FileName="DMX-2.0/GestionCircuits.cs" Line="66" Column="49" />
|
||||
<File FileName="DMX-2.0/MainWindow.cs" Line="137" Column="1" />
|
||||
</Files>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ namespace DMX2
|
|||
TimeSpan ts = tickTime - lastTick;
|
||||
lastTick = tickTime;
|
||||
|
||||
lock (this) {
|
||||
// 'Actionne' les sequenceurs
|
||||
foreach (var seq in sequenceurs) {
|
||||
seq.Tick (ts);
|
||||
|
|
@ -122,12 +123,12 @@ namespace DMX2
|
|||
}
|
||||
c.ValeurCourante = val;
|
||||
}
|
||||
|
||||
}
|
||||
// Cette fonction retourne quasi immédiatement, même si il y'a beaucoup a faire sur l'affichage
|
||||
MainWindow.Win.ScheduleUpdate();
|
||||
|
||||
|
||||
/*if( DateTime.Now - tickTime > TimeSpan.FromMilliseconds(1) )
|
||||
/*if( ts > TimeSpan.FromMilliseconds(12) )
|
||||
Console.WriteLine ("{0} {1}", DateTime.Now - tickTime,ts);*/
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace DMX2
|
|||
var nameCell = new Gtk.CellRendererText();
|
||||
nameCol.Title = "Circuit";
|
||||
nameCol.PackStart(nameCell,true);
|
||||
nameCol.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc( new Gtk.TreeCellDataFunc(RenderCircuitName) ));
|
||||
nameCol.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc( RenderCircuitName) );
|
||||
nameCell.Editable =true;
|
||||
nameCell.Edited += OnNameCellEdited;
|
||||
this.listeCircuits.AppendColumn(nameCol);
|
||||
|
|
@ -25,7 +25,7 @@ namespace DMX2
|
|||
var snameCell = new Gtk.CellRendererText();
|
||||
snameCol.Title = "Nom Court";
|
||||
snameCol.PackStart(snameCell,true);
|
||||
snameCol.SetCellDataFunc(snameCell, new Gtk.TreeCellDataFunc( new Gtk.TreeCellDataFunc(RenderCircuitShortName) ));
|
||||
snameCol.SetCellDataFunc(snameCell, new Gtk.TreeCellDataFunc(RenderCircuitShortName) );
|
||||
snameCell.Editable =true;
|
||||
snameCell.Edited += OnShortNameCellEdited;
|
||||
this.listeCircuits.AppendColumn(snameCol);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace DMX2
|
|||
var allNameCell = new Gtk.CellRendererText();
|
||||
allnameCol.Title = "Circuits";
|
||||
allnameCol.PackStart(allNameCell,true);
|
||||
allnameCol.SetCellDataFunc(allNameCell, new Gtk.TreeCellDataFunc( new Gtk.TreeCellDataFunc(RenderCircuitName) ));
|
||||
allnameCol.SetCellDataFunc(allNameCell, new Gtk.TreeCellDataFunc( RenderCircuitName) );
|
||||
this.listeToutCircuits.AppendColumn(allnameCol);
|
||||
|
||||
lsAll = new Gtk.ListStore(typeof (Circuit));
|
||||
|
|
@ -39,7 +39,7 @@ namespace DMX2
|
|||
var selNameCell = new Gtk.CellRendererText();
|
||||
selNameCol.Title = "Circuits du Sequenceur";
|
||||
selNameCol.PackStart(selNameCell,true);
|
||||
selNameCol.SetCellDataFunc(selNameCell, new Gtk.TreeCellDataFunc( new Gtk.TreeCellDataFunc(RenderCircuitName) ));
|
||||
selNameCol.SetCellDataFunc(selNameCell, new Gtk.TreeCellDataFunc( RenderCircuitName) );
|
||||
this.listeSelCircuits.AppendColumn(selNameCol);
|
||||
|
||||
lsSel = new Gtk.ListStore(typeof (Circuit));
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace DMX2
|
|||
|
||||
bool fullUpdFlag = true;
|
||||
SequenceurLineaire sequenceur;
|
||||
ListStore lsEffets=null;
|
||||
|
||||
public SeqLinUI (SequenceurLineaire s ) : base (s)
|
||||
{
|
||||
|
|
@ -17,13 +18,84 @@ namespace DMX2
|
|||
titreLabel.Text = s.Name;
|
||||
sequenceur = s;
|
||||
Update(true);
|
||||
|
||||
#region Construction listeEffets
|
||||
// Construction de la liste d'effets
|
||||
var numCol = new TreeViewColumn();
|
||||
var nomCol = new TreeViewColumn();
|
||||
var dureeCol = new TreeViewColumn();
|
||||
var transCol = new TreeViewColumn();
|
||||
|
||||
var numCell = new CellRendererText();
|
||||
var nomCell = new CellRendererText();
|
||||
var dureeCell = new CellRendererText();
|
||||
var transCell = new CellRendererText();
|
||||
|
||||
numCol.Title = "N°";
|
||||
nomCol.Title = "Effet";
|
||||
dureeCol.Title = "Duree";
|
||||
transCol.Title = "Transition";
|
||||
|
||||
numCol.PackEnd(numCell,true);
|
||||
nomCol.PackStart(nomCell,true);
|
||||
dureeCol.PackEnd(dureeCell,true);
|
||||
transCol.PackEnd(transCell,true);
|
||||
|
||||
numCol.SetCellDataFunc(numCell, new TreeCellDataFunc(RenderNum));
|
||||
nomCol.SetCellDataFunc(nomCell, new TreeCellDataFunc(RenderNom));
|
||||
dureeCol.SetCellDataFunc(dureeCell, new TreeCellDataFunc(RenderDuree));
|
||||
transCol.SetCellDataFunc(transCell, new TreeCellDataFunc(RenderTrans));
|
||||
|
||||
effetsListe.AppendColumn(numCol);
|
||||
effetsListe.AppendColumn(nomCol);
|
||||
effetsListe.AppendColumn(dureeCol);
|
||||
effetsListe.AppendColumn(transCol);
|
||||
|
||||
lsEffets = new ListStore(typeof(SequenceurLineaire.Effet));
|
||||
effetsListe.Model = lsEffets;
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Affichage Liste d'Effets
|
||||
void RenderNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||
{
|
||||
SequenceurLineaire.Effet e = tree_model.GetValue (iter, 0) as SequenceurLineaire.Effet;
|
||||
(cell as Gtk.CellRendererText).Text = "";
|
||||
}
|
||||
|
||||
void RenderNom (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||
{
|
||||
SequenceurLineaire.Effet e = tree_model.GetValue (iter, 0) as SequenceurLineaire.Effet;
|
||||
(cell as Gtk.CellRendererText).Text = e.Nom;
|
||||
}
|
||||
|
||||
void RenderDuree (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||
{
|
||||
SequenceurLineaire.Effet e = tree_model.GetValue (iter, 0) as SequenceurLineaire.Effet;
|
||||
(cell as Gtk.CellRendererText).Text = (e.Duree.TotalMilliseconds/100).ToString();
|
||||
}
|
||||
|
||||
void RenderTrans (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||
{
|
||||
SequenceurLineaire.Effet e = tree_model.GetValue (iter, 0) as SequenceurLineaire.Effet;
|
||||
(cell as Gtk.CellRendererText).Text = (e.Transition.TotalMilliseconds/100).ToString();
|
||||
}
|
||||
|
||||
void UpdListeEffets ()
|
||||
{
|
||||
lsEffets.Clear();
|
||||
foreach (var effet in sequenceur.Effets) {
|
||||
lsEffets.AppendValues(effet);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override void Update (bool full)
|
||||
{
|
||||
if(fullUpdFlag || full) FullUpdate();
|
||||
UpdateValues();
|
||||
timeLabel.LabelProp = sequenceur.TimeStamp.ToString();
|
||||
timeLabel.LabelProp = string.Format(@"<big>{0:0\.0}</big>", sequenceur.TimeStamp.TotalMilliseconds/100);
|
||||
|
||||
}
|
||||
|
||||
protected void OnCircuitsActionActivated (object sender, EventArgs e)
|
||||
|
|
@ -120,8 +192,10 @@ namespace DMX2
|
|||
fullUpdFlag=false;
|
||||
}
|
||||
|
||||
bool updating=false;
|
||||
void TiretteActionee (object sender, EventArgs e)
|
||||
{
|
||||
if (updating)return;
|
||||
VScale t = sender as VScale;
|
||||
Circuit c = t.Data[circuitKey] as Circuit;
|
||||
sequenceur.ChangeValeur(c,(int)(t.Value));
|
||||
|
|
@ -129,9 +203,11 @@ namespace DMX2
|
|||
|
||||
protected void UpdateValues()
|
||||
{
|
||||
updating = true;
|
||||
foreach (Circuit c in tirettes.Keys) {
|
||||
tirettes[c].Value = sequenceur.ValeurCircuit(c);
|
||||
}
|
||||
updating=false;
|
||||
}
|
||||
|
||||
protected void OnZoneWidSizeAllocated (object o, SizeAllocatedArgs args)
|
||||
|
|
@ -143,6 +219,20 @@ namespace DMX2
|
|||
}
|
||||
|
||||
|
||||
protected void OnSaveActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
int d,t;
|
||||
if(!int.TryParse(dureeEntry.Text,out d) || !int.TryParse(transEntry.Text,out t)) return;
|
||||
sequenceur.SauveEffet("Nom", TimeSpan.FromMilliseconds(100*d),TimeSpan.FromMilliseconds(t*100));
|
||||
UpdListeEffets();
|
||||
}
|
||||
|
||||
|
||||
protected void OnGoForwardActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
sequenceur.IndexEffetCourrant++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ namespace DMX2
|
|||
|
||||
public void ChangeCircuits (System.Collections.Generic.List<Circuit> list)
|
||||
{
|
||||
lock (this) {
|
||||
foreach (var c in circuitsSeq.ToArray()) {
|
||||
if (!list.Contains (c))
|
||||
RetireCircuit (c);
|
||||
|
|
@ -107,6 +108,7 @@ namespace DMX2
|
|||
AjouteCircuit (c);
|
||||
circuitsSeq = list;
|
||||
}
|
||||
}
|
||||
|
||||
void AjouteCircuit (Circuit c)
|
||||
{
|
||||
|
|
@ -126,11 +128,13 @@ namespace DMX2
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
@ -153,11 +157,13 @@ namespace DMX2
|
|||
public override void Tick (TimeSpan time)
|
||||
{
|
||||
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] = (effetcourrant [c] - valeursinitiales [c]) * effetcourrant.Duree.Milliseconds / time.Milliseconds + valeursinitiales [c];
|
||||
valeurscourantes [c] = (int)(progression * (effetcourrant [c] - valeursinitiales [c]) + valeursinitiales [c]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -167,7 +173,7 @@ namespace DMX2
|
|||
if (effetcourrant.Duree != TimeSpan.Zero && timeStamp >= effetcourrant.Duree) {
|
||||
int index = effets.IndexOf (effetcourrant) + 1;
|
||||
if (index < effets.Count)
|
||||
ChangeEffet (index);
|
||||
ChangeEffetCourrant (index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +184,17 @@ namespace DMX2
|
|||
valeurscourantes [c] = effetcourrant [c];
|
||||
}
|
||||
|
||||
public void ChangeEffet (int index)
|
||||
public int IndexEffetCourrant {
|
||||
get {
|
||||
return effets.IndexOf(effetcourrant);
|
||||
}
|
||||
set {
|
||||
if(value>=0 && value < effets.Count)
|
||||
ChangeEffetCourrant(value);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeEffetCourrant (int index)
|
||||
{
|
||||
effetcourrant = effets [index];
|
||||
valeurschangees.Clear ();
|
||||
|
|
@ -189,8 +205,12 @@ namespace DMX2
|
|||
|
||||
public void SauveEffet (string nom, TimeSpan duree, TimeSpan transition)
|
||||
{
|
||||
lock (this) {
|
||||
effets.Add (new Effet (nom, valeurscourantes, duree, transition));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override System.Xml.XmlElement Save ()
|
||||
{
|
||||
|
|
@ -213,7 +233,5 @@ namespace DMX2
|
|||
{
|
||||
ui = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@
|
|||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="Gtk.Bin" id="DMX2.SeqLinUI" design-size="618 410">
|
||||
<widget class="Gtk.Bin" id="DMX2.SeqLinUI" design-size="766 410">
|
||||
<action-group name="Default">
|
||||
<action id="goBackAction">
|
||||
<property name="Type">Action</property>
|
||||
|
|
@ -458,6 +458,7 @@
|
|||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-go-forward</property>
|
||||
<signal name="Activated" handler="OnGoForwardActionActivated" />
|
||||
</action>
|
||||
<action id="revertToSavedAction">
|
||||
<property name="Type">Action</property>
|
||||
|
|
@ -478,6 +479,7 @@
|
|||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-save</property>
|
||||
<signal name="Activated" handler="OnSaveActionActivated" />
|
||||
</action>
|
||||
<action id="saveAsAction">
|
||||
<property name="Type">Action</property>
|
||||
|
|
@ -541,7 +543,7 @@
|
|||
<property name="MemberName" />
|
||||
<property name="HasWindow">False</property>
|
||||
<child>
|
||||
<widget class="Gtk.Entry" id="entry1">
|
||||
<widget class="Gtk.Entry" id="dureeEntry">
|
||||
<property name="MemberName" />
|
||||
<property name="WidthRequest">45</property>
|
||||
<property name="CanFocus">True</property>
|
||||
|
|
@ -553,7 +555,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.Entry" id="entry2">
|
||||
<widget class="Gtk.Entry" id="transEntry">
|
||||
<property name="MemberName" />
|
||||
<property name="WidthRequest">45</property>
|
||||
<property name="CanFocus">True</property>
|
||||
|
|
@ -696,7 +698,7 @@
|
|||
<property name="HscrollbarPolicy">Never</property>
|
||||
<property name="ShadowType">In</property>
|
||||
<child>
|
||||
<widget class="Gtk.TreeView" id="treeview1">
|
||||
<widget class="Gtk.TreeView" id="effetsListe">
|
||||
<property name="MemberName" />
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="ShowScrollbars">True</property>
|
||||
|
|
|
|||
Loading…
Reference in a new issue