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.Workspace ActiveConfiguration="Debug|x86" />
<MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/SeqLinUI.cs"> <MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/SeqLinUI.cs">
<Files> <Files>
<File FileName="DMX-2.0/SequenceurLineaire.cs" Line="152" Column="36" /> <File FileName="DMX-2.0/SequenceurLineaire.cs" Line="236" Column="3" />
<File FileName="DMX-2.0/Conduite.cs" Line="129" Column="4" /> <File FileName="DMX-2.0/SeqLinUI.cs" Line="145" Column="4" />
<File FileName="DMX-2.0/SeqLinUI.cs" Line="92" Column="3" /> <File FileName="DMX-2.0/Conduite.cs" Line="130" Column="4" />
<File FileName="DMX-2.0/GestionCircuits.cs" Line="66" Column="49" /> <File FileName="DMX-2.0/GestionCircuits.cs" Line="34" Column="45" />
<File FileName="DMX-2.0/MainWindow.cs" Line="137" Column="1" /> <File FileName="DMX-2.0/MainWindow.cs" Line="137" Column="1" />
<File FileName="Désassemblage" />
</Files> </Files>
</MonoDevelop.Ide.Workbench> </MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>

View file

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

View file

@ -48,19 +48,56 @@ namespace DMX2
effetsListe.AppendColumn(numCol); effetsListe.AppendColumn(numCol);
effetsListe.AppendColumn(nomCol); effetsListe.AppendColumn(nomCol);
effetsListe.AppendColumn(dureeCol);
effetsListe.AppendColumn(transCol); effetsListe.AppendColumn(transCol);
effetsListe.AppendColumn(dureeCol);
lsEffets = new ListStore(typeof(SequenceurLineaire.Effet)); lsEffets = new ListStore(typeof(SequenceurLineaire.Effet));
effetsListe.Model = lsEffets; effetsListe.Model = lsEffets;
nomCell.Editable = true;
dureeCell.Editable = true;
transCell.Editable = true;
nomCell.Edited += EditNom;
dureeCell.Edited += EditDuree;
transCell.Edited += EditTrans;
#endregion #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 #region Affichage Liste d'Effets
void RenderNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) void RenderNum (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{ {
SequenceurLineaire.Effet e = tree_model.GetValue (iter, 0) as SequenceurLineaire.Effet; 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) void RenderNom (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
@ -96,6 +133,16 @@ namespace DMX2
UpdateValues(); UpdateValues();
timeLabel.LabelProp = string.Format(@"<big>{0:0\.0}</big>", sequenceur.TimeStamp.TotalMilliseconds/100); 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) protected void OnCircuitsActionActivated (object sender, EventArgs e)
@ -221,10 +268,10 @@ namespace DMX2
protected void OnSaveActionActivated (object sender, EventArgs e) protected void OnSaveActionActivated (object sender, EventArgs e)
{ {
int d,t; //int d,t; if(!int.TryParse(dureeEntry.Text,out d) || !int.TryParse(transEntry.Text,out t)) return;
if(!int.TryParse(dureeEntry.Text,out d) || !int.TryParse(transEntry.Text,out t)) return; sequenceur.SauveEffet("Nouvel Effet", TimeSpan.Zero,TimeSpan.FromSeconds(5));
sequenceur.SauveEffet("Nom", TimeSpan.FromMilliseconds(100*d),TimeSpan.FromMilliseconds(t*100));
UpdListeEffets(); UpdListeEffets();
} }
@ -233,6 +280,25 @@ namespace DMX2
sequenceur.IndexEffetCourrant++; 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 { get {
return _nom; return _nom;
} }
set {
_nom = value;
}
} }
Dictionary<Circuit,int> _valeurs; Dictionary<Circuit,int> _valeurs;
@ -47,15 +50,19 @@ namespace DMX2
get { get {
return _duree; return _duree;
} }
set {
_duree = value;
}
} }
public TimeSpan Transition { public TimeSpan Transition {
get { get {
return _transition; return _transition;
} }
set {
_transition = value;
}
} }
} }
TimeSpan timeStamp = TimeSpan.Zero; TimeSpan timeStamp = TimeSpan.Zero;
@ -78,6 +85,8 @@ namespace DMX2
} }
public TimeSpan TimeStamp { public TimeSpan TimeStamp {
get { get {
return timeStamp; return timeStamp;
@ -154,8 +163,20 @@ namespace DMX2
return valeurschangees.ContainsKey (c); return valeurschangees.ContainsKey (c);
} }
bool paused=false;
public bool Paused {
get {
return paused;
}
set {
paused = value;
}
}
public override void Tick (TimeSpan time) public override void Tick (TimeSpan time)
{ {
if (paused) return;
timeStamp += time; timeStamp += time;
if (enTransition) { if (enTransition) {
@ -177,13 +198,23 @@ namespace DMX2
} }
} }
void FinDeTransition ()
public void FinDeTransition ()
{ {
enTransition = false; enTransition = false;
foreach (Circuit c in circuitsSeq) foreach (Circuit c in circuitsSeq)
if(!valeurschangees.ContainsKey (c))
valeurscourantes [c] = effetcourrant [c]; valeurscourantes [c] = effetcourrant [c];
} }
public SequenceurLineaire.Effet EffetCourrant {
get {
return effetcourrant;
}
}
public int IndexEffetCourrant { public int IndexEffetCourrant {
get { get {
return effets.IndexOf(effetcourrant); return effets.IndexOf(effetcourrant);
@ -203,15 +234,14 @@ namespace DMX2
timeStamp = TimeSpan.Zero; timeStamp = TimeSpan.Zero;
} }
public void SauveEffet (string nom, TimeSpan duree, TimeSpan transition) public int SauveEffet (string nom, TimeSpan duree, TimeSpan transition)
{ {
lock (this) { lock (this) {
effets.Add (new Effet (nom, valeurscourantes, duree, transition)); effets.Add (new Effet (nom, valeurscourantes, duree, transition));
return effets.Count-1;
} }
} }
public override System.Xml.XmlElement Save () public override System.Xml.XmlElement Save ()
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();

View file

@ -453,6 +453,7 @@
<property name="Type">Action</property> <property name="Type">Action</property>
<property name="Label" translatable="yes" /> <property name="Label" translatable="yes" />
<property name="StockId">gtk-go-back</property> <property name="StockId">gtk-go-back</property>
<signal name="Activated" handler="OnGoBackActionActivated" />
</action> </action>
<action id="goForwardAction"> <action id="goForwardAction">
<property name="Type">Action</property> <property name="Type">Action</property>
@ -460,25 +461,28 @@
<property name="StockId">gtk-go-forward</property> <property name="StockId">gtk-go-forward</property>
<signal name="Activated" handler="OnGoForwardActionActivated" /> <signal name="Activated" handler="OnGoForwardActionActivated" />
</action> </action>
<action id="revertToSavedAction"> <action id="applyAction">
<property name="Type">Action</property> <property name="Type">Action</property>
<property name="Label" translatable="yes" /> <property name="Label" translatable="yes" />
<property name="StockId">gtk-revert-to-saved</property> <property name="StockId">gtk-apply</property>
</action> </action>
<action id="mediaPauseAction"> <action id="mediaPauseAction">
<property name="Type">Action</property> <property name="Type">Action</property>
<property name="Label" translatable="yes" /> <property name="Label" translatable="yes" />
<property name="StockId">gtk-media-pause</property> <property name="StockId">gtk-media-pause</property>
<signal name="Activated" handler="OnMediaPauseActionActivated" />
</action> </action>
<action id="mediaNextAction"> <action id="mediaNextAction">
<property name="Type">Action</property> <property name="Type">Action</property>
<property name="Label" translatable="yes" /> <property name="Label" translatable="yes" />
<property name="StockId">gtk-media-next</property> <property name="StockId">gtk-media-next</property>
<signal name="Activated" handler="OnMediaNextActionActivated" />
</action> </action>
<action id="saveAction"> <action id="saveAction">
<property name="Type">Action</property> <property name="Type">Action</property>
<property name="Label" translatable="yes" /> <property name="Label" translatable="yes" />
<property name="StockId">gtk-save</property> <property name="StockId">gtk-save</property>
<property name="Tooltip" translatable="yes">Enregistre</property>
<signal name="Activated" handler="OnSaveActionActivated" /> <signal name="Activated" handler="OnSaveActionActivated" />
</action> </action>
<action id="saveAsAction"> <action id="saveAsAction">
@ -533,101 +537,6 @@
<widget class="Gtk.HBox" id="hbox1"> <widget class="Gtk.HBox" id="hbox1">
<property name="MemberName" /> <property name="MemberName" />
<property name="Spacing">6</property> <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> <child>
<widget class="Gtk.VBox" id="vbox4"> <widget class="Gtk.VBox" id="vbox4">
<property name="MemberName" /> <property name="MemberName" />
@ -645,6 +554,30 @@
<property name="Fill">False</property> <property name="Fill">False</property>
</packing> </packing>
</child> </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> <child>
<widget class="Gtk.Toolbar" id="toolbar1"> <widget class="Gtk.Toolbar" id="toolbar1">
<property name="MemberName" /> <property name="MemberName" />
@ -659,7 +592,7 @@
</node> </node>
</widget> </widget>
<packing> <packing>
<property name="Position">1</property> <property name="Position">3</property>
<property name="AutoSize">True</property> <property name="AutoSize">True</property>
<property name="Expand">False</property> <property name="Expand">False</property>
<property name="Fill">False</property> <property name="Fill">False</property>
@ -671,14 +604,14 @@
<property name="ShowArrow">False</property> <property name="ShowArrow">False</property>
<property name="IconSize">SmallToolbar</property> <property name="IconSize">SmallToolbar</property>
<node name="toolbar2" type="Toolbar"> <node name="toolbar2" type="Toolbar">
<node type="Toolitem" action="revertToSavedAction" />
<node type="Toolitem" action="saveAction" /> <node type="Toolitem" action="saveAction" />
<node type="Toolitem" action="saveAsAction" /> <node type="Toolitem" action="saveAsAction" />
<node type="Toolitem" action="applyAction" />
<node type="Toolitem" action="deleteAction" /> <node type="Toolitem" action="deleteAction" />
</node> </node>
</widget> </widget>
<packing> <packing>
<property name="Position">2</property> <property name="Position">4</property>
<property name="AutoSize">True</property> <property name="AutoSize">True</property>
<property name="Expand">False</property> <property name="Expand">False</property>
<property name="Fill">False</property> <property name="Fill">False</property>
@ -686,7 +619,7 @@
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="Position">1</property> <property name="Position">0</property>
<property name="AutoSize">False</property> <property name="AutoSize">False</property>
<property name="Expand">False</property> <property name="Expand">False</property>
<property name="Fill">False</property> <property name="Fill">False</property>
@ -706,7 +639,7 @@
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="Position">2</property> <property name="Position">1</property>
<property name="AutoSize">False</property> <property name="AutoSize">False</property>
</packing> </packing>
</child> </child>
@ -725,7 +658,7 @@
</node> </node>
</widget> </widget>
<packing> <packing>
<property name="Position">3</property> <property name="Position">2</property>
<property name="AutoSize">True</property> <property name="AutoSize">True</property>
<property name="Expand">False</property> <property name="Expand">False</property>
<property name="Fill">False</property> <property name="Fill">False</property>