revision du locking
This commit is contained in:
parent
23d4639adf
commit
ad604e9af6
8 changed files with 90 additions and 105 deletions
|
|
@ -56,7 +56,7 @@ namespace DMX2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SupprimeCircuits (IEnumerable<Circuit> lc)
|
/* public void SupprimeCircuits (IEnumerable<Circuit> lc)
|
||||||
{
|
{
|
||||||
lock (this) {
|
lock (this) {
|
||||||
foreach(var c in lc)
|
foreach(var c in lc)
|
||||||
|
|
@ -64,7 +64,7 @@ namespace DMX2
|
||||||
foreach(var seq in Sequenceurs)
|
foreach(var seq in Sequenceurs)
|
||||||
seq.MajCircuitsSupprimes();
|
seq.MajCircuitsSupprimes();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public Circuit GetCircuitByID (int i)
|
public Circuit GetCircuitByID (int i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -108,11 +108,11 @@ namespace DMX2
|
||||||
}
|
}
|
||||||
dlg.Destroy ();
|
dlg.Destroy ();
|
||||||
}
|
}
|
||||||
protected void OnRemoveActionActivated (object sender, EventArgs e)
|
// protected void OnRemoveActionActivated (object sender, EventArgs e)
|
||||||
{
|
// {
|
||||||
Conduite.Courante.SupprimeCircuits (GetSelection());
|
// Conduite.Courante.SupprimeCircuits (GetSelection());
|
||||||
UpdateListeCircuits();
|
// UpdateListeCircuits();
|
||||||
}
|
// }
|
||||||
|
|
||||||
protected List<Circuit> GetSelection()
|
protected List<Circuit> GetSelection()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,9 @@ namespace DMX2
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void MajCircuitsSupprimes()
|
/*public virtual void MajCircuitsSupprimes()
|
||||||
{
|
{
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public abstract void Save (XmlElement parent);
|
public abstract void Save (XmlElement parent);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,17 +148,15 @@ namespace DMX2
|
||||||
|
|
||||||
public void ChangeCircuits (System.Collections.Generic.List<Circuit> list)
|
public void ChangeCircuits (System.Collections.Generic.List<Circuit> list)
|
||||||
{
|
{
|
||||||
lock (this) {
|
|
||||||
foreach (var c in circuitsSeq.ToArray()) {
|
foreach (var c in circuitsSeq.ToArray()) {
|
||||||
if (!list.Contains (c))
|
if (!list.Contains (c))
|
||||||
RetireCircuit (c);
|
lock(this) RetireCircuit (c);
|
||||||
}
|
}
|
||||||
foreach (var c in list)
|
foreach (var c in list)
|
||||||
if (!circuitsSeq.Contains (c))
|
if (!circuitsSeq.Contains (c))
|
||||||
AjouteCircuit (c);
|
lock(this) AjouteCircuit (c);
|
||||||
circuitsSeq = list;
|
circuitsSeq = list;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void AjouteCircuit (Circuit c)
|
void AjouteCircuit (Circuit c)
|
||||||
{
|
{
|
||||||
|
|
@ -166,7 +164,7 @@ namespace DMX2
|
||||||
valeursinitiales [c] = 0;
|
valeursinitiales [c] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RetireCircuit (Circuit c)
|
void RetireCircuit (Circuit c)
|
||||||
{
|
{
|
||||||
foreach (var ef in effets) {
|
foreach (var ef in effets) {
|
||||||
ef.RetireCircuit (c);
|
ef.RetireCircuit (c);
|
||||||
|
|
@ -176,7 +174,7 @@ namespace DMX2
|
||||||
valeursinitiales.Remove (c);
|
valeursinitiales.Remove (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void MajCircuitsSupprimes ()
|
/*public override void MajCircuitsSupprimes ()
|
||||||
{
|
{
|
||||||
lock (this) {
|
lock (this) {
|
||||||
foreach (var c in circuitsSeq.ToArray()) {
|
foreach (var c in circuitsSeq.ToArray()) {
|
||||||
|
|
@ -184,16 +182,18 @@ namespace DMX2
|
||||||
RetireCircuit (c);
|
RetireCircuit (c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public override int ValeurCircuit (Circuit c)
|
public override int ValeurCircuit (Circuit c)
|
||||||
{
|
{
|
||||||
|
lock(this) {
|
||||||
if (!circuitsSeq.Contains (c))
|
if (!circuitsSeq.Contains (c))
|
||||||
return 0;
|
return 0;
|
||||||
if(master !=100)
|
if (master != 100)
|
||||||
return valeurscourantes [c] * master /100;
|
return valeurscourantes [c] * master / 100;
|
||||||
return valeurscourantes [c];
|
return valeurscourantes [c];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int ValeurBruteCircuit (Circuit c)
|
public int ValeurBruteCircuit (Circuit c)
|
||||||
{
|
{
|
||||||
|
|
@ -228,7 +228,7 @@ namespace DMX2
|
||||||
{
|
{
|
||||||
if (paused) return;
|
if (paused) return;
|
||||||
timeStamp += time;
|
timeStamp += time;
|
||||||
|
lock(this) {
|
||||||
if (enTransition) {
|
if (enTransition) {
|
||||||
if (timeStamp < tempsTransition) {
|
if (timeStamp < tempsTransition) {
|
||||||
double progression = timeStamp.TotalMilliseconds / tempsTransition.TotalMilliseconds;
|
double progression = timeStamp.TotalMilliseconds / tempsTransition.TotalMilliseconds;
|
||||||
|
|
@ -247,16 +247,19 @@ namespace DMX2
|
||||||
ChangeEffetCourrant (index);
|
ChangeEffetCourrant (index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void FinDeTransition ()
|
public void FinDeTransition ()
|
||||||
{
|
{
|
||||||
|
lock(this) {
|
||||||
enTransition = false;
|
enTransition = false;
|
||||||
foreach (Circuit c in circuitsSeq)
|
foreach (Circuit c in circuitsSeq)
|
||||||
if(!valeurschangees.ContainsKey (c))
|
if (!valeurschangees.ContainsKey (c))
|
||||||
valeurscourantes [c] = effetcourrant [c];
|
valeurscourantes [c] = effetcourrant [c];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public SequenceurLineaire.Effet EffetCourrant {
|
public SequenceurLineaire.Effet EffetCourrant {
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,9 @@ namespace DMX2
|
||||||
|
|
||||||
List<Ligne> lignes = new List<Ligne>();
|
List<Ligne> lignes = new List<Ligne>();
|
||||||
|
|
||||||
|
Ligne aSuivre = null;
|
||||||
|
Ligne enCours = null;
|
||||||
|
Ligne ligneMaitre = null;
|
||||||
|
|
||||||
TimeSpan timeStamp = TimeSpan.Zero;
|
TimeSpan timeStamp = TimeSpan.Zero;
|
||||||
TimeSpan topSuivant = TimeSpan.Zero;
|
TimeSpan topSuivant = TimeSpan.Zero;
|
||||||
|
|
@ -143,6 +145,17 @@ namespace DMX2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool paused=false;
|
||||||
|
|
||||||
|
public bool Paused {
|
||||||
|
get {
|
||||||
|
return paused;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
paused = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SequenceurMacro ()
|
public SequenceurMacro ()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -157,10 +170,6 @@ namespace DMX2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ligne aSuivre = null;
|
|
||||||
Ligne enCours = null;
|
|
||||||
Ligne ligneMaitre = null;
|
|
||||||
|
|
||||||
|
|
||||||
public int IndexLigneaSuivre
|
public int IndexLigneaSuivre
|
||||||
{
|
{
|
||||||
|
|
@ -185,7 +194,6 @@ namespace DMX2
|
||||||
|
|
||||||
public void RetireLigne (int pos)
|
public void RetireLigne (int pos)
|
||||||
{
|
{
|
||||||
lock (this) {
|
|
||||||
lock (this) {
|
lock (this) {
|
||||||
if (lignes [pos] == enCours) {
|
if (lignes [pos] == enCours) {
|
||||||
enCours = null;
|
enCours = null;
|
||||||
|
|
@ -198,7 +206,6 @@ namespace DMX2
|
||||||
CommandRemove(pos);
|
CommandRemove(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public TimeSpan TimeStamp {
|
public TimeSpan TimeStamp {
|
||||||
get {
|
get {
|
||||||
|
|
@ -222,30 +229,28 @@ namespace DMX2
|
||||||
|
|
||||||
public void ChangeCircuits (System.Collections.Generic.List<Circuit> list)
|
public void ChangeCircuits (System.Collections.Generic.List<Circuit> list)
|
||||||
{
|
{
|
||||||
lock (this) {
|
|
||||||
foreach (var c in circuitsSeq.ToArray()) {
|
foreach (var c in circuitsSeq.ToArray()) {
|
||||||
if (!list.Contains (c))
|
if (!list.Contains (c))
|
||||||
RetireCircuit (c);
|
lock (this) RetireCircuit (c);
|
||||||
}
|
}
|
||||||
foreach (var c in list)
|
foreach (var c in list)
|
||||||
if (!circuitsSeq.Contains (c))
|
if (!circuitsSeq.Contains (c))
|
||||||
AjouteCircuit (c);
|
lock (this) AjouteCircuit (c);
|
||||||
circuitsSeq = list;
|
circuitsSeq = list;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void AjouteCircuit (Circuit c)
|
void AjouteCircuit (Circuit c)
|
||||||
{
|
{
|
||||||
valeurscourantes [c] = 0;
|
valeurscourantes [c] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RetireCircuit (Circuit c)
|
void RetireCircuit (Circuit c)
|
||||||
{
|
{
|
||||||
circuitsSeq.Remove (c);
|
circuitsSeq.Remove (c);
|
||||||
valeurscourantes.Remove (c);
|
valeurscourantes.Remove (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void MajCircuitsSupprimes ()
|
/*public override void MajCircuitsSupprimes ()
|
||||||
{
|
{
|
||||||
lock (this) {
|
lock (this) {
|
||||||
foreach (var c in circuitsSeq.ToArray()) {
|
foreach (var c in circuitsSeq.ToArray()) {
|
||||||
|
|
@ -253,7 +258,7 @@ namespace DMX2
|
||||||
RetireCircuit (c);
|
RetireCircuit (c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public override int ValeurCircuit (Circuit c)
|
public override int ValeurCircuit (Circuit c)
|
||||||
{
|
{
|
||||||
|
|
@ -271,17 +276,6 @@ namespace DMX2
|
||||||
return valeurscourantes [c];
|
return valeurscourantes [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)
|
if (paused)
|
||||||
|
|
@ -404,9 +398,6 @@ namespace DMX2
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public override void Save (System.Xml.XmlElement parent)
|
public override void Save (System.Xml.XmlElement parent)
|
||||||
{
|
{
|
||||||
System.Xml.XmlElement el = parent.OwnerDocument.CreateElement ("SequenceurMacro");
|
System.Xml.XmlElement el = parent.OwnerDocument.CreateElement ("SequenceurMacro");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ namespace DMX2
|
||||||
{
|
{
|
||||||
private global::Gtk.UIManager UIManager;
|
private global::Gtk.UIManager UIManager;
|
||||||
private global::Gtk.Action addAction;
|
private global::Gtk.Action addAction;
|
||||||
private global::Gtk.Action removeAction;
|
|
||||||
private global::Gtk.VBox vbox2;
|
private global::Gtk.VBox vbox2;
|
||||||
private global::Gtk.Toolbar toolbar1;
|
private global::Gtk.Toolbar toolbar1;
|
||||||
private global::Gtk.ScrolledWindow GtkScrolledWindow;
|
private global::Gtk.ScrolledWindow GtkScrolledWindow;
|
||||||
|
|
@ -21,8 +20,6 @@ namespace DMX2
|
||||||
global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup ("Default");
|
global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup ("Default");
|
||||||
this.addAction = new global::Gtk.Action ("addAction", null, null, "gtk-add");
|
this.addAction = new global::Gtk.Action ("addAction", null, null, "gtk-add");
|
||||||
w1.Add (this.addAction, null);
|
w1.Add (this.addAction, null);
|
||||||
this.removeAction = new global::Gtk.Action ("removeAction", null, null, "gtk-remove");
|
|
||||||
w1.Add (this.removeAction, null);
|
|
||||||
this.UIManager.InsertActionGroup (w1, 0);
|
this.UIManager.InsertActionGroup (w1, 0);
|
||||||
this.AddAccelGroup (this.UIManager.AccelGroup);
|
this.AddAccelGroup (this.UIManager.AccelGroup);
|
||||||
this.Name = "DMX2.GestionCircuits";
|
this.Name = "DMX2.GestionCircuits";
|
||||||
|
|
@ -40,7 +37,7 @@ namespace DMX2
|
||||||
this.vbox2.Name = "vbox2";
|
this.vbox2.Name = "vbox2";
|
||||||
this.vbox2.Spacing = 6;
|
this.vbox2.Spacing = 6;
|
||||||
// Container child vbox2.Gtk.Box+BoxChild
|
// Container child vbox2.Gtk.Box+BoxChild
|
||||||
this.UIManager.AddUiFromString ("<ui><toolbar name='toolbar1'><toolitem name='addAction' action='addAction'/><toolitem name='removeAction' action='removeAction'/></toolbar></ui>");
|
this.UIManager.AddUiFromString ("<ui><toolbar name='toolbar1'><toolitem name='addAction' action='addAction'/></toolbar></ui>");
|
||||||
this.toolbar1 = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar1")));
|
this.toolbar1 = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar1")));
|
||||||
this.toolbar1.Name = "toolbar1";
|
this.toolbar1.Name = "toolbar1";
|
||||||
this.toolbar1.ShowArrow = false;
|
this.toolbar1.ShowArrow = false;
|
||||||
|
|
@ -93,7 +90,6 @@ namespace DMX2
|
||||||
this.Hide ();
|
this.Hide ();
|
||||||
this.Response += new global::Gtk.ResponseHandler (this.OnResp);
|
this.Response += new global::Gtk.ResponseHandler (this.OnResp);
|
||||||
this.addAction.Activated += new global::System.EventHandler (this.OnAddActionActivated);
|
this.addAction.Activated += new global::System.EventHandler (this.OnAddActionActivated);
|
||||||
this.removeAction.Activated += new global::System.EventHandler (this.OnRemoveActionActivated);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -528,12 +528,6 @@
|
||||||
<property name="StockId">gtk-add</property>
|
<property name="StockId">gtk-add</property>
|
||||||
<signal name="Activated" handler="OnAddActionActivated" />
|
<signal name="Activated" handler="OnAddActionActivated" />
|
||||||
</action>
|
</action>
|
||||||
<action id="removeAction">
|
|
||||||
<property name="Type">Action</property>
|
|
||||||
<property name="Label" translatable="yes" />
|
|
||||||
<property name="StockId">gtk-remove</property>
|
|
||||||
<signal name="Activated" handler="OnRemoveActionActivated" />
|
|
||||||
</action>
|
|
||||||
</action-group>
|
</action-group>
|
||||||
<property name="MemberName" />
|
<property name="MemberName" />
|
||||||
<property name="Visible">False</property>
|
<property name="Visible">False</property>
|
||||||
|
|
@ -559,7 +553,6 @@
|
||||||
<property name="ShowArrow">False</property>
|
<property name="ShowArrow">False</property>
|
||||||
<node name="toolbar1" type="Toolbar">
|
<node name="toolbar1" type="Toolbar">
|
||||||
<node type="Toolitem" action="addAction" />
|
<node type="Toolitem" action="addAction" />
|
||||||
<node type="Toolitem" action="removeAction" />
|
|
||||||
</node>
|
</node>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
style "sombre"
|
style "sombre"
|
||||||
{
|
{
|
||||||
|
font_name = "Cantarell 9"
|
||||||
|
|
||||||
bg[NORMAL] = {0.4, 0.4, 0.4}
|
bg[NORMAL] = {0.4, 0.4, 0.4}
|
||||||
bg[SELECTED] = {0.44, 0.45, 0.5}
|
bg[SELECTED] = {0.44, 0.45, 0.5}
|
||||||
bg[ACTIVE] = {0.45, 0.45, 0.45}
|
bg[ACTIVE] = {0.45, 0.45, 0.45}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue