This commit is contained in:
parent
16a7a3d0d1
commit
92691d2bfa
4 changed files with 258 additions and 31 deletions
|
|
@ -13,14 +13,13 @@ namespace DMX2
|
|||
public static Conduite Courante = null;
|
||||
|
||||
Timer timer = null;
|
||||
DateTime lastTick;
|
||||
DateTime lastUpd;
|
||||
DateTime dernierTick;
|
||||
DateTime derniereMaj;
|
||||
|
||||
public Conduite()
|
||||
{
|
||||
timer = new Timer(new TimerCallback(TimerTick),this,
|
||||
10,10);
|
||||
lastUpd = lastTick=DateTime.Now;
|
||||
timer = new Timer(new TimerCallback(TimerTick),this, 1000,10);
|
||||
derniereMaj = dernierTick=DateTime.Now;
|
||||
}
|
||||
|
||||
List<Circuit> circuits = new List<Circuit>();
|
||||
|
|
@ -107,13 +106,13 @@ namespace DMX2
|
|||
void Tick ()
|
||||
{
|
||||
DateTime tickTime = DateTime.Now;
|
||||
TimeSpan ts = tickTime - lastTick;
|
||||
lastTick = tickTime;
|
||||
TimeSpan deltaT = tickTime - dernierTick;
|
||||
dernierTick = tickTime;
|
||||
|
||||
lock (this) {
|
||||
// 'Actionne' les sequenceurs
|
||||
foreach (var seq in sequenceurs) {
|
||||
seq.Tick (ts);
|
||||
seq.Tick (deltaT);
|
||||
}
|
||||
|
||||
// Mets a jour les valeurs circuits.
|
||||
|
|
@ -127,14 +126,14 @@ namespace DMX2
|
|||
}
|
||||
// Cette fonction retourne quasi immédiatement, même si il y'a beaucoup a faire sur l'affichage
|
||||
|
||||
if(tickTime - lastUpd > TimeSpan.FromMilliseconds(100)){
|
||||
if(tickTime - derniereMaj > TimeSpan.FromMilliseconds(50)){
|
||||
MainWindow.Win.ScheduleUpdate();
|
||||
lastUpd = DateTime.Now;
|
||||
derniereMaj = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
if( ts > TimeSpan.FromMilliseconds(15) )
|
||||
Console.WriteLine ("{0} {1}", DateTime.Now - tickTime,ts);
|
||||
if( deltaT > TimeSpan.FromMilliseconds(15) )
|
||||
Console.WriteLine ("{0} {1}", DateTime.Now - tickTime,deltaT);
|
||||
}
|
||||
|
||||
#region IDisposable implementation
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ namespace DMX2
|
|||
ListStore lsEffets=null;
|
||||
TreeViewColumn nomCol;
|
||||
|
||||
bool effetChange = false;
|
||||
public void EffetChange ()
|
||||
{
|
||||
effetChange = true;
|
||||
}
|
||||
|
||||
public SeqLinUI (SequenceurLineaire s ) : base (s)
|
||||
{
|
||||
this.Build ();
|
||||
|
|
@ -149,6 +155,15 @@ namespace DMX2
|
|||
else
|
||||
pbTrans.Fraction = 0.0d;
|
||||
|
||||
if (effetChange)
|
||||
SelectionneEffet(sequenceur.IndexEffetCourrant);
|
||||
}
|
||||
|
||||
void SelectionneEffet (int index)
|
||||
{
|
||||
if(index <0 ) return;
|
||||
effetsListe.SetCursor( new TreePath( new int[1] {index }) ,null,false);
|
||||
effetChange = false;
|
||||
}
|
||||
|
||||
protected void OnCircuitsActionActivated (object sender, EventArgs e)
|
||||
|
|
@ -271,21 +286,28 @@ namespace DMX2
|
|||
}
|
||||
}
|
||||
|
||||
int IndexEffetSelectionne()
|
||||
{
|
||||
var sel = effetsListe.Selection.GetSelectedRows();
|
||||
if(sel.Length ==0) return -1;
|
||||
return effetsListe.Selection.GetSelectedRows()[0].Indices[0];
|
||||
}
|
||||
|
||||
protected void OnSaveActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
//int d,t; if(!int.TryParse(dureeEntry.Text,out d) || !int.TryParse(transEntry.Text,out t)) return;
|
||||
TreeIter iter;
|
||||
int pos = sequenceur.SauveEffet("Nouvel Effet", TimeSpan.Zero,TimeSpan.FromSeconds(5));
|
||||
UpdListeEffets();
|
||||
lsEffets.IterNthChild(out iter, pos);
|
||||
effetsListe.SetCursor(lsEffets.GetPath(iter),nomCol,true);
|
||||
effetsListe.SetCursor(new TreePath( new int[1] {pos}) ,nomCol,true);
|
||||
}
|
||||
|
||||
|
||||
protected void OnGoForwardActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
sequenceur.IndexEffetCourrant++;
|
||||
if(sequenceur.IndexEffetCourrant == IndexEffetSelectionne())
|
||||
sequenceur.IndexEffetCourrant++;
|
||||
else
|
||||
sequenceur.IndexEffetCourrant = IndexEffetSelectionne();
|
||||
|
||||
}
|
||||
|
||||
protected void OnGoBackActionActivated (object sender, EventArgs e)
|
||||
|
|
@ -303,6 +325,44 @@ namespace DMX2
|
|||
sequenceur.FinDeTransition();
|
||||
}
|
||||
|
||||
protected void OnApplyActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
int pos = IndexEffetSelectionne();
|
||||
sequenceur.RemplaceEffet(pos);
|
||||
UpdListeEffets();
|
||||
effetsListe.SetCursor(new TreePath( new int[1] {pos}) ,null,false);
|
||||
}
|
||||
|
||||
protected void OnSaveAfterActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
int pos = sequenceur.InsereEffetApres(IndexEffetSelectionne(),"Nouvel Effet",TimeSpan.Zero,TimeSpan.FromSeconds(5));
|
||||
UpdListeEffets();
|
||||
effetsListe.SetCursor(new TreePath( new int[1] {pos}) ,nomCol,true);
|
||||
}
|
||||
|
||||
protected void OnDeleteActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
sequenceur.SupprimeEffet(IndexEffetSelectionne());
|
||||
UpdListeEffets();
|
||||
}
|
||||
|
||||
protected void OnMoveUpActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
int pos = IndexEffetSelectionne();
|
||||
if(pos==-1) return;
|
||||
pos = sequenceur.MonteEffet(pos);
|
||||
UpdListeEffets();
|
||||
effetsListe.SetCursor(new TreePath( new int[1] {pos}) ,null,false);
|
||||
}
|
||||
|
||||
protected void OnMoveDownActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
int pos = IndexEffetSelectionne();
|
||||
if(pos==-1) return;
|
||||
pos = sequenceur.BaisseEffet(pos);
|
||||
UpdListeEffets();
|
||||
effetsListe.SetCursor(new TreePath( new int[1] {pos}) ,null,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,16 +232,59 @@ namespace DMX2
|
|||
valeursinitiales = new Dictionary<Circuit, int> (valeurscourantes);
|
||||
enTransition = true;
|
||||
timeStamp = TimeSpan.Zero;
|
||||
if(ui!=null) ui.EffetChange();
|
||||
}
|
||||
|
||||
public int SauveEffet (string nom, TimeSpan duree, TimeSpan transition)
|
||||
{
|
||||
lock (this) {
|
||||
effets.Add (new Effet (nom, valeurscourantes, duree, transition));
|
||||
effets.Add (effetcourrant = new Effet (nom, valeurscourantes, duree, transition));
|
||||
return effets.Count-1;
|
||||
}
|
||||
}
|
||||
|
||||
public int InsereEffetApres (int index, string nom, TimeSpan duree, TimeSpan transition)
|
||||
{
|
||||
lock (this) {
|
||||
int pos = index+1;
|
||||
if (pos >= effets.Count) return SauveEffet(nom,duree,transition);
|
||||
effets.Insert (pos,effetcourrant = new Effet (nom, valeurscourantes, duree, transition));
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemplaceEffet (int index)
|
||||
{
|
||||
lock (this) {
|
||||
Effet ef = effets[index];
|
||||
effets[index] = new Effet (ef.Nom, valeurscourantes, ef.Duree, ef.Transition);
|
||||
effetcourrant = effets[index];
|
||||
}
|
||||
}
|
||||
|
||||
public void SupprimeEffet (int index)
|
||||
{
|
||||
effets.RemoveAt(index);
|
||||
}
|
||||
|
||||
public int MonteEffet (int index)
|
||||
{
|
||||
if(index>= effets.Count || index < 1 ) return index;
|
||||
Effet ef = effets[index];
|
||||
effets.RemoveAt(index);
|
||||
effets.Insert(index-1, ef);
|
||||
return index -1;
|
||||
}
|
||||
|
||||
public int BaisseEffet (int index)
|
||||
{
|
||||
if(index> effets.Count-2 || index <0) return index;
|
||||
Effet ef = effets[index];
|
||||
effets.RemoveAt(index);
|
||||
effets.Insert(index+1, ef);
|
||||
return index +1;
|
||||
}
|
||||
|
||||
public override System.Xml.XmlElement Save ()
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
|
|
|
|||
|
|
@ -132,6 +132,21 @@
|
|||
<property name="StockId">tirettes</property>
|
||||
<signal name="Activated" handler="OnSeqLinActionActivated" />
|
||||
</action>
|
||||
<action id="fullscreenAction">
|
||||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-fullscreen</property>
|
||||
</action>
|
||||
<action id="fullscreenAction1">
|
||||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-fullscreen</property>
|
||||
</action>
|
||||
<action id="ShowAllAction">
|
||||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes">ShowAll</property>
|
||||
<property name="ShortLabel" translatable="yes">ShowAll</property>
|
||||
</action>
|
||||
</action-group>
|
||||
<property name="MemberName" />
|
||||
<property name="Title" translatable="yes">MainWindow</property>
|
||||
|
|
@ -146,14 +161,113 @@
|
|||
<property name="MemberName" />
|
||||
<property name="Spacing">6</property>
|
||||
<child>
|
||||
<widget class="Gtk.Fixed" id="fixed2">
|
||||
<widget class="Gtk.VBox" id="vbox2">
|
||||
<property name="MemberName" />
|
||||
<property name="WidthRequest">50</property>
|
||||
<property name="HasWindow">False</property>
|
||||
<property name="Spacing">6</property>
|
||||
<child>
|
||||
<widget class="Gtk.Button" id="button172">
|
||||
<property name="MemberName" />
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Type">TextAndIcon</property>
|
||||
<property name="Icon">stock:gtk-goto-last Dnd</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="UseUnderline">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">0</property>
|
||||
<property name="AutoSize">True</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.Button" id="button186">
|
||||
<property name="MemberName" />
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Type">TextAndIcon</property>
|
||||
<property name="Icon">stock:gtk-goto-first Dnd</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="UseUnderline">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">1</property>
|
||||
<property name="AutoSize">True</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.ToggleButton" id="togglebutton2">
|
||||
<property name="MemberName" />
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Type">TextAndIcon</property>
|
||||
<property name="Icon">stock:gtk-no Dnd</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="UseUnderline">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">2</property>
|
||||
<property name="AutoSize">True</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.ToggleButton" id="togglebutton1">
|
||||
<property name="MemberName" />
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Type">TextAndIcon</property>
|
||||
<property name="Icon">stock:gtk-media-pause Dnd</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="UseUnderline">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">3</property>
|
||||
<property name="AutoSize">True</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.ToggleButton" id="togglebutton3">
|
||||
<property name="MemberName" />
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Type">TextAndIcon</property>
|
||||
<property name="Icon">stock:gtk-justify-fill Dnd</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="UseUnderline">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">4</property>
|
||||
<property name="AutoSize">True</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.VScale" id="vscale1">
|
||||
<property name="MemberName" />
|
||||
<property name="HeightRequest">260</property>
|
||||
<property name="Inverted">True</property>
|
||||
<property name="Upper">100</property>
|
||||
<property name="PageIncrement">10</property>
|
||||
<property name="StepIncrement">1</property>
|
||||
<property name="Value">100</property>
|
||||
<property name="DrawValue">True</property>
|
||||
<property name="Digits">0</property>
|
||||
<property name="ValuePos">Top</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">5</property>
|
||||
<property name="AutoSize">False</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">0</property>
|
||||
<property name="AutoSize">False</property>
|
||||
<property name="AutoSize">True</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
|
|
@ -173,12 +287,12 @@
|
|||
<widget class="Gtk.HPaned" id="hpaned1">
|
||||
<property name="MemberName" />
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Position">753</property>
|
||||
<property name="Position">727</property>
|
||||
<child>
|
||||
<widget class="Gtk.HPaned" id="hpaned2">
|
||||
<property name="MemberName" />
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Position">583</property>
|
||||
<property name="Position">561</property>
|
||||
<child>
|
||||
<widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow">
|
||||
<property name="MemberName" />
|
||||
|
|
@ -293,6 +407,9 @@
|
|||
<node name="toolbar7" type="Toolbar">
|
||||
<node type="Toolitem" action="circAction" />
|
||||
<node type="Toolitem" action="seqLinAction" />
|
||||
<node type="Separator" />
|
||||
<node type="Toolitem" action="ShowAllAction" />
|
||||
<node type="Toolitem" action="fullscreenAction1" />
|
||||
</node>
|
||||
</widget>
|
||||
<packing>
|
||||
|
|
@ -465,6 +582,8 @@
|
|||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-apply</property>
|
||||
<property name="Tooltip" translatable="yes">Ecrase l'effet selectionné.</property>
|
||||
<signal name="Activated" handler="OnApplyActionActivated" />
|
||||
</action>
|
||||
<action id="mediaPauseAction">
|
||||
<property name="Type">Action</property>
|
||||
|
|
@ -482,28 +601,34 @@
|
|||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-save</property>
|
||||
<property name="Tooltip" translatable="yes">Enregistre</property>
|
||||
<property name="Tooltip" translatable="yes">Enregistre l'effet à la fin.</property>
|
||||
<signal name="Activated" handler="OnSaveActionActivated" />
|
||||
</action>
|
||||
<action id="saveAsAction">
|
||||
<action id="saveAfterAction">
|
||||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-save-as</property>
|
||||
<property name="Tooltip" translatable="yes">Insère un effet sous celui selectionné.</property>
|
||||
<signal name="Activated" handler="OnSaveAfterActionActivated" />
|
||||
</action>
|
||||
<action id="deleteAction">
|
||||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-delete</property>
|
||||
<property name="Tooltip" translatable="yes">Supprime l'effet selectionné.</property>
|
||||
<signal name="Activated" handler="OnDeleteActionActivated" />
|
||||
</action>
|
||||
<action id="goUpAction">
|
||||
<action id="moveUpAction">
|
||||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-go-up</property>
|
||||
<signal name="Activated" handler="OnMoveUpActionActivated" />
|
||||
</action>
|
||||
<action id="goDownAction">
|
||||
<action id="moveDownAction">
|
||||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="StockId">gtk-go-down</property>
|
||||
<signal name="Activated" handler="OnMoveDownActionActivated" />
|
||||
</action>
|
||||
<action id="circuitsAction">
|
||||
<property name="Type">Action</property>
|
||||
|
|
@ -605,7 +730,7 @@
|
|||
<property name="IconSize">SmallToolbar</property>
|
||||
<node name="toolbar2" type="Toolbar">
|
||||
<node type="Toolitem" action="saveAction" />
|
||||
<node type="Toolitem" action="saveAsAction" />
|
||||
<node type="Toolitem" action="saveAfterAction" />
|
||||
<node type="Toolitem" action="applyAction" />
|
||||
<node type="Toolitem" action="deleteAction" />
|
||||
</node>
|
||||
|
|
@ -653,8 +778,8 @@
|
|||
<node name="toolbar3" type="Toolbar">
|
||||
<node type="Toolitem" action="closeAction" />
|
||||
<node type="Toolitem" action="circuitsAction" />
|
||||
<node type="Toolitem" action="goUpAction" />
|
||||
<node type="Toolitem" action="goDownAction" />
|
||||
<node type="Toolitem" action="moveUpAction" />
|
||||
<node type="Toolitem" action="moveDownAction" />
|
||||
</node>
|
||||
</widget>
|
||||
<packing>
|
||||
|
|
|
|||
Loading…
Reference in a new issue