[chronojump/FS-TFT-Menu] Red photocells running mark, should show photocell number on Wichro



commit 0f46f3b6521e517235a5e4827838592f2e0ad548
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 13 11:44:07 2022 +0200

    Red photocells running mark, should show photocell number on Wichro

 glade/app1.glade           | 37 ++++++++++++++++++++++++++++++++++++-
 src/execute/run.cs         | 35 ++++++++++++++++++++++++++---------
 src/execute/runObjects.cs  | 15 ++++++++++++++-
 src/gui/app1/chronojump.cs |  6 ++++--
 src/gui/app1/icons.cs      |  5 +++--
 5 files changed, 83 insertions(+), 15 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 2692452b5..330a3c22c 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -6744,6 +6744,10 @@ EncoderInertialCapture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkHBox" id="hbox94">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
                                                             <widget class="GtkVBox" id="vbox76">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -6759,7 +6763,7 @@ EncoderInertialCapture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkImage" 
id="image_run_execute_photocell">
+                                                            <widget class="GtkImage" 
id="image_run_execute_photocell_icon">
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
                                                             </widget>
@@ -6773,6 +6777,37 @@ EncoderInertialCapture</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox14">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_run_execute_photocell_code">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">label</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
                                                             <property name="position">2</property>
                                                             </packing>
                                                             </child>
diff --git a/src/execute/run.cs b/src/execute/run.cs
index 1807ec8f4..65bbf0a6d 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -74,7 +74,8 @@ public class RunExecute : EventExecute
        protected RunExecuteInspector.Types runEIType;
 
        protected Gtk.Image image_run_execute_running;
-       protected Gtk.Image image_run_execute_photocell;
+       protected Gtk.Image image_run_execute_photocell_icon;
+       protected Gtk.Label label_run_execute_photocell_code;
 
        protected PhotocellWirelessCapture photocellWirelessCapture;
 
@@ -93,7 +94,9 @@ public class RunExecute : EventExecute
                        double progressbarLimit, ExecutingGraphData egd,
                        Constants.DoubleContact checkDoubleContactMode, int checkDoubleContactTime, 
                        bool speedStartArrival, bool measureReactionTime,
-                       Gtk.Image image_run_execute_running, Gtk.Image image_run_execute_photocell,
+                       Gtk.Image image_run_execute_running,
+                       Gtk.Image image_run_execute_photocell_icon,
+                       Gtk.Label label_run_execute_photocell_code,
                        int graphLimit, bool graphAllTypes, bool graphAllPersons
                        )
        {
@@ -120,7 +123,8 @@ public class RunExecute : EventExecute
                this.speedStartArrival = speedStartArrival;     
                this.measureReactionTime = measureReactionTime;
                this.image_run_execute_running = image_run_execute_running;
-               this.image_run_execute_photocell = image_run_execute_photocell;
+               this.image_run_execute_photocell_icon = image_run_execute_photocell_icon;
+               this.label_run_execute_photocell_code = label_run_execute_photocell_code;
                this.graphLimit = graphLimit;
                this.graphAllTypes = graphAllTypes;
                this.graphAllPersons = graphAllPersons;
@@ -379,6 +383,8 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                                        LogB.Information("has arrived");
                                        loggedState = States.ON;
                                        runChangeImage.Current = RunChangeImage.Types.PHOTOCELL;
+                                       if(wireless)
+                                               runChangeImage.Photocell = photocell;
 
                                        onlyInterval_NeedShowCountDownFalse();
 
@@ -581,23 +587,31 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
                if(runChangeImage.Current == RunChangeImage.Types.RUNNING)
                {
                        image_run_execute_running.Visible = true;
-                       image_run_execute_photocell.Visible = false;
+                       image_run_execute_photocell_icon.Visible = false;
+                       label_run_execute_photocell_code.Visible = false;
                }
                else if(runChangeImage.Current == RunChangeImage.Types.PHOTOCELL)
                {
                        image_run_execute_running.Visible = false;
-                       image_run_execute_photocell.Visible = true;
+                       image_run_execute_photocell_icon.Visible = true;
+                       if(runChangeImage.Photocell >= 0)
+                       {
+                               label_run_execute_photocell_code.Text = runChangeImage.Photocell.ToString();
+                               label_run_execute_photocell_code.Visible = true;
+                       }
                } else
                {
                        image_run_execute_running.Visible = false;
-                       image_run_execute_photocell.Visible = false;
+                       image_run_execute_photocell_icon.Visible = false;
+                       label_run_execute_photocell_code.Visible = false;
                }
        }
 
        protected override void runChangeImageForceHide()
        {
                image_run_execute_running.Visible = false;
-               image_run_execute_photocell.Visible = false;
+               image_run_execute_photocell_icon.Visible = false;
+               label_run_execute_photocell_code.Visible = false;
        }
 
        protected override void updateRunPhaseInfoManage()
@@ -917,7 +931,9 @@ public class RunIntervalExecute : RunExecute
                        double progressbarLimit, ExecutingGraphData egd ,
                        Constants.DoubleContact checkDoubleContactMode, int checkDoubleContactTime, 
                        bool speedStartArrival, bool measureReactionTime,
-                       Gtk.Image image_run_execute_running, Gtk.Image image_run_execute_photocell
+                       Gtk.Image image_run_execute_running,
+                       Gtk.Image image_run_execute_photocell_icon,
+                       Gtk.Label label_run_execute_photocell_code
                        )
        {
                this.personID = personID;
@@ -964,7 +980,8 @@ public class RunIntervalExecute : RunExecute
                this.speedStartArrival = speedStartArrival;     
                this.measureReactionTime = measureReactionTime;
                this.image_run_execute_running = image_run_execute_running;
-               this.image_run_execute_photocell = image_run_execute_photocell;
+               this.image_run_execute_photocell_icon = image_run_execute_photocell_icon;
+               this.label_run_execute_photocell_code = label_run_execute_photocell_code;
 
                reactionTimeMS = 0;
                reactionTimeIncludedStr = Catalog.GetString("Included on race time of first track");
diff --git a/src/execute/runObjects.cs b/src/execute/runObjects.cs
index 3f695677f..15068f0d7 100644
--- a/src/execute/runObjects.cs
+++ b/src/execute/runObjects.cs
@@ -831,18 +831,26 @@ public class RunExecuteInspector
        }
 }
 
-//TODO: clarify what this class does
+/*
+   This is written by capture thread and readed by GTK thread.
+   Manages the icon shown on running.
+   Image will be a person RUNNING or a PHOTOCELL being shown (when cross it).
+   Also on wireless, show the number of the photocell
+   */
+
 public class RunChangeImage
 {
        public enum Types { NONE, RUNNING, PHOTOCELL }
        private Types last;
        private Types current;
+       private int photocell; //0 is a valid value
 
        //constructor, don't show any image
        public RunChangeImage()
        {
                last = Types.NONE;
                current = Types.NONE;
+               photocell = -1;
        }
 
        public bool ShouldBeChanged()
@@ -860,4 +868,9 @@ public class RunChangeImage
                set { current = value; }
        }
 
+       public int Photocell {
+               get { return photocell; }
+               set { photocell = value; }
+       }
+
 }
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index d23330082..0cdddc073 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -5401,7 +5401,8 @@ public partial class ChronoJumpWindow
                                preferences.runSpeedStartArrival,
                                check_run_simple_with_reaction_time.Active,
                                image_run_execute_running,
-                               image_run_execute_photocell,
+                               image_run_execute_photocell_icon,
+                               label_run_execute_photocell_code,
                                Convert.ToInt32(spin_contacts_graph_last_limit.Value),
                                radio_contacts_graph_allTests.Active, radio_contacts_graph_allPersons.Active
                                );
@@ -5546,7 +5547,8 @@ public partial class ChronoJumpWindow
                                preferences.runSpeedStartArrival,
                                check_run_interval_with_reaction_time.Active,
                                image_run_execute_running,
-                               image_run_execute_photocell
+                               image_run_execute_photocell_icon,
+                               label_run_execute_photocell_code
                                );
 
                //suitable for limited by tracks and time
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index afe6ba011..3c9707b7a 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -127,7 +127,8 @@ public partial class ChronoJumpWindow
        //run
        [Widget] Gtk.Image image_run_simple_show_time;
        [Widget] Gtk.Image image_run_execute_running;
-       [Widget] Gtk.Image image_run_execute_photocell;
+       [Widget] Gtk.Image image_run_execute_photocell_icon;
+       [Widget] Gtk.Label label_run_execute_photocell_code;
        [Widget] Gtk.Image image_sprint_analyze_save;
        [Widget] Gtk.Image image_sprint_analyze_table_save;
        [Widget] Gtk.Image image_sprint_analyze_table_save_1;
@@ -664,7 +665,7 @@ public partial class ChronoJumpWindow
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "run_2x.png");
                image_run_execute_running.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "run_photocell.png");
-               image_run_execute_photocell.Pixbuf = pixbuf;
+               image_run_execute_photocell_icon.Pixbuf = pixbuf;
                
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + Constants.FileNamePulse);
                image_mode_pulses_small.Pixbuf = pixbuf;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]