This commit is contained in:
tzim 2013-04-18 15:29:37 +00:00
parent 58337e6c23
commit cd89ce8c8b
5 changed files with 151 additions and 121 deletions

View file

@ -2,11 +2,12 @@
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
<MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/SeqLinUI.cs">
<Files>
<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/SequenceurLineaire.cs" Line="236" Column="3" />
<File FileName="DMX-2.0/SeqLinUI.cs" Line="145" Column="4" />
<File FileName="DMX-2.0/Conduite.cs" Line="130" Column="4" />
<File FileName="DMX-2.0/GestionCircuits.cs" Line="34" Column="45" />
<File FileName="DMX-2.0/MainWindow.cs" Line="137" Column="1" />
<File FileName="Désassemblage" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>

View file

@ -128,8 +128,8 @@ namespace DMX2
MainWindow.Win.ScheduleUpdate();
/*if( ts > TimeSpan.FromMilliseconds(12) )
Console.WriteLine ("{0} {1}", DateTime.Now - tickTime,ts);*/
if( ts > TimeSpan.FromMilliseconds(15) )
Console.WriteLine ("{0} {1}", DateTime.Now - tickTime,ts);
}
#region IDisposable implementation

View file

@ -48,19 +48,56 @@ namespace DMX2
effetsListe.AppendColumn(numCol);
effetsListe.AppendColumn(nomCol);
effetsListe.AppendColumn(dureeCol);
effetsListe.AppendColumn(transCol);
effetsListe.AppendColumn(dureeCol);
lsEffets = new ListStore(typeof(SequenceurLineaire.Effet));
effetsListe.Model = lsEffets;
nomCell.Editable = true;
dureeCell.Editable = true;
transCell.Editable = true;
nomCell.Edited += EditNom;
dureeCell.Edited += EditDuree;
transCell.Edited += EditTrans;
#endregion
}
void EditNom (object o, EditedArgs args)
{
Gtk.TreeIter iter;
lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path));
SequenceurLineaire.Effet e = lsEffets.GetValue(iter,0) as SequenceurLineaire.Effet;
e.Nom = args.NewText;
}
void EditDuree (object o, EditedArgs args)
{
Gtk.TreeIter iter;int d;
lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path));
SequenceurLineaire.Effet e = lsEffets.GetValue(iter,0) as SequenceurLineaire.Effet;
if(int.TryParse(args.NewText , out d))
e.Duree = TimeSpan.FromMilliseconds(d * 100);
}
void EditTrans (object o, EditedArgs args)
{
Gtk.TreeIter iter; int t;
lsEffets.GetIter (out iter, new Gtk.TreePath (args.Path));
SequenceurLineaire.Effet e = lsEffets.GetValue(iter,0) as SequenceurLineaire.Effet;
if(int.TryParse(args.NewText , out t))
e.Transition = TimeSpan.FromMilliseconds(t * 100);
}
#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 = "";
(cell as Gtk.CellRendererText).Text = (sequenceur.Effets.IndexOf(e)+1).ToString() ;
}
void RenderNom (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
@ -96,6 +133,16 @@ namespace DMX2
UpdateValues();
timeLabel.LabelProp = string.Format(@"<big>{0:0\.0}</big>", sequenceur.TimeStamp.TotalMilliseconds/100);
if(sequenceur.EffetCourrant.Duree != TimeSpan.Zero )
pbDuree.Fraction = Math.Min(1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Duree.TotalMilliseconds);
else
pbDuree.Fraction = 0.0d;
if(sequenceur.EffetCourrant.Transition != TimeSpan.Zero )
pbTrans.Fraction = Math.Min(1.0d, sequenceur.TimeStamp.TotalMilliseconds / sequenceur.EffetCourrant.Transition.TotalMilliseconds);
else
pbTrans.Fraction = 0.0d;
}
protected void OnCircuitsActionActivated (object sender, EventArgs e)
@ -221,10 +268,10 @@ 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));
//int d,t; if(!int.TryParse(dureeEntry.Text,out d) || !int.TryParse(transEntry.Text,out t)) return;
sequenceur.SauveEffet("Nouvel Effet", TimeSpan.Zero,TimeSpan.FromSeconds(5));
UpdListeEffets();
}
@ -233,6 +280,25 @@ namespace DMX2
sequenceur.IndexEffetCourrant++;
}
protected void OnGoBackActionActivated (object sender, EventArgs e)
{
sequenceur.IndexEffetCourrant--;
}
protected void OnMediaPauseActionActivated (object sender, EventArgs e)
{
sequenceur.Paused = ! sequenceur.Paused;
}
protected void OnMediaNextActionActivated (object sender, EventArgs e)
{
sequenceur.FinDeTransition();
}
}
}

View file

@ -23,6 +23,9 @@ namespace DMX2
get {
return _nom;
}
set {
_nom = value;
}
}
Dictionary<Circuit,int> _valeurs;
@ -47,15 +50,19 @@ namespace DMX2
get {
return _duree;
}
set {
_duree = value;
}
}
public TimeSpan Transition {
get {
return _transition;
}
set {
_transition = value;
}
}
}
TimeSpan timeStamp = TimeSpan.Zero;
@ -78,6 +85,8 @@ namespace DMX2
}
public TimeSpan TimeStamp {
get {
return timeStamp;
@ -154,8 +163,20 @@ namespace DMX2
return valeurschangees.ContainsKey (c);
}
bool paused=false;
public bool Paused {
get {
return paused;
}
set {
paused = value;
}
}
public override void Tick (TimeSpan time)
{
if (paused) return;
timeStamp += time;
if (enTransition) {
@ -177,11 +198,21 @@ namespace DMX2
}
}
void FinDeTransition ()
public void FinDeTransition ()
{
enTransition = false;
foreach (Circuit c in circuitsSeq)
valeurscourantes [c] = effetcourrant [c];
if(!valeurschangees.ContainsKey (c))
valeurscourantes [c] = effetcourrant [c];
}
public SequenceurLineaire.Effet EffetCourrant {
get {
return effetcourrant;
}
}
public int IndexEffetCourrant {
@ -203,15 +234,14 @@ namespace DMX2
timeStamp = TimeSpan.Zero;
}
public void SauveEffet (string nom, TimeSpan duree, TimeSpan transition)
public int SauveEffet (string nom, TimeSpan duree, TimeSpan transition)
{
lock (this) {
effets.Add (new Effet (nom, valeurscourantes, duree, transition));
return effets.Count-1;
}
}
public override System.Xml.XmlElement Save ()
{
throw new System.NotImplementedException ();

View file

@ -453,6 +453,7 @@
<property name="Type">Action</property>
<property name="Label" translatable="yes" />
<property name="StockId">gtk-go-back</property>
<signal name="Activated" handler="OnGoBackActionActivated" />
</action>
<action id="goForwardAction">
<property name="Type">Action</property>
@ -460,25 +461,28 @@
<property name="StockId">gtk-go-forward</property>
<signal name="Activated" handler="OnGoForwardActionActivated" />
</action>
<action id="revertToSavedAction">
<action id="applyAction">
<property name="Type">Action</property>
<property name="Label" translatable="yes" />
<property name="StockId">gtk-revert-to-saved</property>
<property name="StockId">gtk-apply</property>
</action>
<action id="mediaPauseAction">
<property name="Type">Action</property>
<property name="Label" translatable="yes" />
<property name="StockId">gtk-media-pause</property>
<signal name="Activated" handler="OnMediaPauseActionActivated" />
</action>
<action id="mediaNextAction">
<property name="Type">Action</property>
<property name="Label" translatable="yes" />
<property name="StockId">gtk-media-next</property>
<signal name="Activated" handler="OnMediaNextActionActivated" />
</action>
<action id="saveAction">
<property name="Type">Action</property>
<property name="Label" translatable="yes" />
<property name="StockId">gtk-save</property>
<property name="Tooltip" translatable="yes">Enregistre</property>
<signal name="Activated" handler="OnSaveActionActivated" />
</action>
<action id="saveAsAction">
@ -533,101 +537,6 @@
<widget class="Gtk.HBox" id="hbox1">
<property name="MemberName" />
<property name="Spacing">6</property>
<child>
<widget class="Gtk.VBox" id="vbox3">
<property name="MemberName" />
<property name="WidthRequest">121</property>
<property name="Spacing">2</property>
<child>
<widget class="Gtk.Fixed" id="fixed1">
<property name="MemberName" />
<property name="HasWindow">False</property>
<child>
<widget class="Gtk.Entry" id="dureeEntry">
<property name="MemberName" />
<property name="WidthRequest">45</property>
<property name="CanFocus">True</property>
<property name="IsEditable">True</property>
<property name="InvisibleChar">•</property>
</widget>
<packing>
<property name="X">4</property>
</packing>
</child>
<child>
<widget class="Gtk.Entry" id="transEntry">
<property name="MemberName" />
<property name="WidthRequest">45</property>
<property name="CanFocus">True</property>
<property name="IsEditable">True</property>
<property name="InvisibleChar">•</property>
</widget>
<packing>
<property name="X">58</property>
</packing>
</child>
<child>
<widget class="Gtk.Label" id="label1">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">&lt;small&gt;Duree&lt;/small&gt;</property>
<property name="UseMarkup">True</property>
</widget>
<packing>
<property name="X">9</property>
<property name="Y">28</property>
</packing>
</child>
<child>
<widget class="Gtk.Label" id="label3">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">&lt;small&gt;Transition&lt;/small&gt;</property>
<property name="UseMarkup">True</property>
</widget>
<packing>
<property name="X">55</property>
<property name="Y">28</property>
</packing>
</child>
</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.ProgressBar" id="progressbar1">
<property name="MemberName" />
<property name="HeightRequest">15</property>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">False</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.ProgressBar" id="progressbar2">
<property name="MemberName" />
<property name="HeightRequest">15</property>
</widget>
<packing>
<property name="Position">2</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="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.VBox" id="vbox4">
<property name="MemberName" />
@ -645,6 +554,30 @@
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.ProgressBar" id="pbTrans">
<property name="MemberName" />
<property name="HeightRequest">15</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.ProgressBar" id="pbDuree">
<property name="MemberName" />
<property name="HeightRequest">15</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.Toolbar" id="toolbar1">
<property name="MemberName" />
@ -659,7 +592,7 @@
</node>
</widget>
<packing>
<property name="Position">1</property>
<property name="Position">3</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
@ -671,14 +604,14 @@
<property name="ShowArrow">False</property>
<property name="IconSize">SmallToolbar</property>
<node name="toolbar2" type="Toolbar">
<node type="Toolitem" action="revertToSavedAction" />
<node type="Toolitem" action="saveAction" />
<node type="Toolitem" action="saveAsAction" />
<node type="Toolitem" action="applyAction" />
<node type="Toolitem" action="deleteAction" />
</node>
</widget>
<packing>
<property name="Position">2</property>
<property name="Position">4</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
@ -686,7 +619,7 @@
</child>
</widget>
<packing>
<property name="Position">1</property>
<property name="Position">0</property>
<property name="AutoSize">False</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
@ -706,7 +639,7 @@
</child>
</widget>
<packing>
<property name="Position">2</property>
<property name="Position">1</property>
<property name="AutoSize">False</property>
</packing>
</child>
@ -725,7 +658,7 @@
</node>
</widget>
<packing>
<property name="Position">3</property>
<property name="Position">2</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>