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