[chronojump] jumps simple graph show one type/all, and display under the bar



commit 818db80718f509d2ad862fd69c0c3503074575fd
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jun 16 20:37:57 2020 +0200

    jumps simple graph show one type/all, and display under the bar

 glade/app1.glade           |  95 ++++++++++++++++++++++++++------
 src/execute/event.cs       |   1 +
 src/execute/jump.cs        |   6 +-
 src/gui/app1/chronojump.cs |  38 ++++++++-----
 src/gui/app1/jump.cs       |   7 ++-
 src/gui/eventExecute.cs    | 134 ++++++++++++++++++++++++++++++++-------------
 src/gui/usefulObjects.cs   |   3 +
 src/sqlite/jump.cs         |   8 ++-
 8 files changed, 219 insertions(+), 73 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 76354cf1..78a8138f 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -7796,6 +7796,22 @@ EncoderInertialCapture</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">12</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="event_graph_label_graph_test">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_contacts_simple_graph_controls">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">20</property>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_contacts_graph_last_limit">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -7834,15 +7850,48 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="event_graph_label_graph_test">
+                                                            <widget class="GtkHBox" 
id="hbox_contacts_graph_test">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radio_contacts_graph_currentTest">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">False</property>
+                                                            <signal name="toggled" 
handler="on_radio_contacts_graph_test_toggled" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radio_contacts_graph_allTests">
+                                                            <property name="label" translatable="yes">All 
tests</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">False</property>
+                                                            <property 
name="group">radio_contacts_graph_currentTest</property>
+                                                            <signal name="toggled" 
handler="on_radio_contacts_graph_test_toggled" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -7884,7 +7933,6 @@ EncoderInertialCapture</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="receives_default">False</property>
                                                             <property name="tooltip">All persons</property>
-                                                            <property name="active">True</property>
                                                             <property name="draw_indicator">False</property>
                                                             <property 
name="group">radio_contacts_graph_currentPerson</property>
                                                             <signal name="toggled" 
handler="on_radio_contacts_graph_person_toggled" swapped="no"/>
@@ -7909,6 +7957,13 @@ EncoderInertialCapture</property>
                                                             <property name="position">2</property>
                                                             </packing>
                                                             </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
                                                             <child>
                                                             <widget class="GtkButton" 
id="button_inspect_last_test_run_intervallic">
                                                             <property name="visible">True</property>
@@ -7952,7 +8007,7 @@ EncoderInertialCapture</property>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="pack_type">end</property>
-                                                            <property name="position">4</property>
+                                                            <property name="position">3</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -24204,6 +24259,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -27048,6 +27106,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</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>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -27084,18 +27154,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</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>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -35016,6 +35074,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/execute/event.cs b/src/execute/event.cs
index b399c9fc..f3699649 100644
--- a/src/execute/event.cs
+++ b/src/execute/event.cs
@@ -80,6 +80,7 @@ public class EventExecute
        protected bool volumeOn;
        protected Preferences.GstreamerTypes gstreamer;
        protected int graphLimit;
+       protected bool graphAllJumps;
        protected bool graphAllPersons;
        protected double progressbarLimit;
        protected RepetitiveConditionsWindow repetitiveConditionsWin;
diff --git a/src/execute/jump.cs b/src/execute/jump.cs
index 7abea0e7..dfa7f0a6 100644
--- a/src/execute/jump.cs
+++ b/src/execute/jump.cs
@@ -60,7 +60,7 @@ public class JumpExecute : EventExecute
                        bool volumeOn, Preferences.GstreamerTypes gstreamer,
                        double progressbarLimit, ExecutingGraphData egd, string description,
                        bool avoidGraph, //on configChronojump.Exhibition do not show graph because it gets 
too slow with big database
-                       bool jumpsDjGraphHeights, int graphLimit, bool graphAllPersons
+                       bool jumpsDjGraphHeights, int graphLimit, bool graphAllJumps, bool graphAllPersons
                        )
        {
                this.personID = personID;
@@ -82,6 +82,7 @@ public class JumpExecute : EventExecute
                this.avoidGraph = avoidGraph;
                this.jumpsDjGraphHeights = jumpsDjGraphHeights;
                this.graphLimit = graphLimit;
+               this.graphAllJumps = graphAllJumps;
                this.graphAllPersons = graphAllPersons;
        
                if(TypeHasFall) {
@@ -482,6 +483,9 @@ public class JumpExecute : EventExecute
 
                if(! avoidGraph)
                {
+                       if(graphAllJumps)
+                               type = "";
+
                        PrepareEventGraphJumpSimpleObject = new PrepareEventGraphJumpSimple(
                                        tv, tc, sessionID,
                                        personID, graphAllPersons, graphLimit,
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 28a500dc..008bdcbb 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -937,8 +937,9 @@ public partial class ChronoJumpWindow
                        notebooks_change(Constants.Menuitem_modes.OTHER);
                        on_extra_window_pulses_test_changed(obj, args);
 
-                       hbox_contacts_graph_last_limit.Visible = false;
-                       hbox_contacts_graph_person.Visible = false;
+                       event_graph_label_graph_test.Visible = true;
+                       hbox_contacts_simple_graph_controls.Visible = false;
+
                        check_vbox_contacts_graph_legend.Visible = false;
                        vbox_contacts_graph_legend.Visible = false;
                }
@@ -951,8 +952,9 @@ public partial class ChronoJumpWindow
                        notebooks_change(Constants.Menuitem_modes.OTHER);
                        on_extra_window_multichronopic_test_changed(obj, args);
 
-                       hbox_contacts_graph_last_limit.Visible = false;
-                       hbox_contacts_graph_person.Visible = false;
+                       event_graph_label_graph_test.Visible = true;
+                       hbox_contacts_simple_graph_controls.Visible = false;
+
                        check_vbox_contacts_graph_legend.Visible = false;
                        vbox_contacts_graph_legend.Visible = false;
                }
@@ -2910,8 +2912,9 @@ public partial class ChronoJumpWindow
                                notebooks_change(m);
                                on_extra_window_jumps_test_changed(new object(), new EventArgs());
 
-                               hbox_contacts_graph_last_limit.Visible = true;
-                               hbox_contacts_graph_person.Visible = true;
+                               event_graph_label_graph_test.Visible = false;
+                               hbox_contacts_simple_graph_controls.Visible = true;
+
                                check_vbox_contacts_graph_legend.Visible = true;
                                //vbox_contacts_graph_legend.Visible = false;
 
@@ -2927,8 +2930,9 @@ public partial class ChronoJumpWindow
                                button_contacts_bells.Sensitive = true;
                                on_extra_window_jumps_rj_test_changed(new object(), new EventArgs());
 
-                               hbox_contacts_graph_last_limit.Visible = false;
-                               hbox_contacts_graph_person.Visible = false;
+                               event_graph_label_graph_test.Visible = true;
+                               hbox_contacts_simple_graph_controls.Visible = false;
+
                                check_vbox_contacts_graph_legend.Visible = false;
                                vbox_contacts_graph_legend.Visible = false;
 
@@ -2952,8 +2956,9 @@ public partial class ChronoJumpWindow
                                notebooks_change(m);
                                on_extra_window_runs_test_changed(new object(), new EventArgs());
 
-                               hbox_contacts_graph_last_limit.Visible = true;
-                               hbox_contacts_graph_person.Visible = true;
+                               event_graph_label_graph_test.Visible = false;
+                               hbox_contacts_simple_graph_controls.Visible = true;
+
                                check_vbox_contacts_graph_legend.Visible = true;
                                //vbox_contacts_graph_legend.Visible = false;
 
@@ -2967,8 +2972,9 @@ public partial class ChronoJumpWindow
                                button_contacts_bells.Sensitive = true;
                                on_extra_window_runs_interval_test_changed(new object(), new EventArgs());
 
-                               hbox_contacts_graph_last_limit.Visible = false;
-                               hbox_contacts_graph_person.Visible = false;
+                               event_graph_label_graph_test.Visible = true;
+                               hbox_contacts_simple_graph_controls.Visible = false;
+
                                check_vbox_contacts_graph_legend.Visible = false;
                                vbox_contacts_graph_legend.Visible = false;
 
@@ -3106,8 +3112,9 @@ public partial class ChronoJumpWindow
                        alignment_button_force_sensor_adjust.Visible = true;
                        //notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
 
-                       hbox_contacts_graph_last_limit.Visible = false;
-                       hbox_contacts_graph_person.Visible = false;
+                       event_graph_label_graph_test.Visible = true;
+                       hbox_contacts_simple_graph_controls.Visible = false;
+
                        check_vbox_contacts_graph_legend.Visible = false;
                        vbox_contacts_graph_legend.Visible = false;
 
@@ -3998,7 +4005,8 @@ public partial class ChronoJumpWindow
                                preferences.volumeOn, preferences.gstreamer,
                                progressbarLimit, egd, description, configChronojump.Exhibition,
                                preferences.jumpsDjGraphHeights,
-                               Convert.ToInt32(spin_contacts_graph_last_limit.Value), 
radio_contacts_graph_allPersons.Active);
+                               Convert.ToInt32(spin_contacts_graph_last_limit.Value),
+                               radio_contacts_graph_allTests.Active, radio_contacts_graph_allPersons.Active);
 
 
                //UtilGtk.ChronopicColors(viewport_chronopics, label_chronopics, label_connected_chronopics, 
chronopicWin.Connected);
diff --git a/src/gui/app1/jump.cs b/src/gui/app1/jump.cs
index 8423c591..35cbf370 100644
--- a/src/gui/app1/jump.cs
+++ b/src/gui/app1/jump.cs
@@ -269,10 +269,15 @@ public partial class ChronoJumpWindow
                        currentJumpType.Name 
                        );
 
+               string typeTemp = currentEventType.Name;
+               if(radio_contacts_graph_allTests.Active)
+                       typeTemp = "";
+
+
                PrepareEventGraphJumpSimple eventGraph = new PrepareEventGraphJumpSimple(
                                tv, tc, currentSession.UniqueID,
                                currentPerson.UniqueID, radio_contacts_graph_allPersons.Active, 
Convert.ToInt32(spin_contacts_graph_last_limit.Value),
-                               Constants.JumpTable, currentEventType.Name, preferences.jumpsDjGraphHeights);
+                               Constants.JumpTable, typeTemp, preferences.jumpsDjGraphHeights);
                
                if(eventGraph.personMAXAtSQLAllSessions > 0 || eventGraph.jumpsAtSQL.Count > 0)
                        PrepareJumpSimpleGraph(eventGraph, false); //don't animate
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 1c72b3c1..a83d231b 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -48,7 +48,10 @@ public partial class ChronoJumpWindow
 
        [Widget] Gtk.HBox hbox_contacts_graph_last_limit;
        [Widget] Gtk.SpinButton spin_contacts_graph_last_limit;
+       [Widget] Gtk.HBox hbox_contacts_simple_graph_controls;
        [Widget] Gtk.HBox hbox_contacts_graph_person;
+       [Widget] Gtk.RadioButton radio_contacts_graph_currentTest;
+       [Widget] Gtk.RadioButton radio_contacts_graph_allTests;
        [Widget] Gtk.RadioButton radio_contacts_graph_currentPerson;
        [Widget] Gtk.RadioButton radio_contacts_graph_allPersons;
        [Widget] Gtk.Image image_radio_contacts_graph_currentPerson;
@@ -200,6 +203,7 @@ public partial class ChronoJumpWindow
 
                event_graph_label_graph_test.Text = "<b>" + event_execute_eventType + "</b>";
                event_graph_label_graph_test.UseMarkup = true;
+               radio_contacts_graph_currentTest.Label = event_execute_eventType;
                                
                event_execute_label_message.Text = "";
 
@@ -317,8 +321,9 @@ public partial class ChronoJumpWindow
        
        private void showJumpSimpleLabels() 
        {
-               hbox_contacts_graph_last_limit.Visible = true;
-               hbox_contacts_graph_person.Visible = true;
+               event_graph_label_graph_test.Visible = false;
+               hbox_contacts_simple_graph_controls.Visible = true;
+
                check_vbox_contacts_graph_legend.Visible = true;
                //vbox_contacts_graph_legend.Visible = false;
 
@@ -328,8 +333,9 @@ public partial class ChronoJumpWindow
        
        private void showJumpReactiveLabels() 
        {
-               hbox_contacts_graph_last_limit.Visible = false;
-               hbox_contacts_graph_person.Visible = false;
+               event_graph_label_graph_test.Visible = true;
+               hbox_contacts_simple_graph_controls.Visible = false;
+
                check_vbox_contacts_graph_legend.Visible = false;
                vbox_contacts_graph_legend.Visible = false;
 
@@ -353,8 +359,9 @@ public partial class ChronoJumpWindow
        
        private void showRunSimpleLabels() 
        {
-               hbox_contacts_graph_last_limit.Visible = true;
-               hbox_contacts_graph_person.Visible = true;
+               event_graph_label_graph_test.Visible = false;
+               hbox_contacts_simple_graph_controls.Visible = true;
+
                check_vbox_contacts_graph_legend.Visible = true;
                //vbox_contacts_graph_legend.Visible = false;
 
@@ -363,8 +370,9 @@ public partial class ChronoJumpWindow
                
        private void showRunIntervalLabels() 
        {
-               hbox_contacts_graph_last_limit.Visible = false;
-               hbox_contacts_graph_person.Visible = false;
+               event_graph_label_graph_test.Visible = true;
+               hbox_contacts_simple_graph_controls.Visible = false;
+
                check_vbox_contacts_graph_legend.Visible = false;
                vbox_contacts_graph_legend.Visible = false;
 
@@ -385,8 +393,9 @@ public partial class ChronoJumpWindow
        
        private void showReactionTimeLabels() 
        {
-               hbox_contacts_graph_last_limit.Visible = true;
-               hbox_contacts_graph_person.Visible = true;
+               event_graph_label_graph_test.Visible = false;
+               hbox_contacts_simple_graph_controls.Visible = true;
+
                check_vbox_contacts_graph_legend.Visible = true;
                //vbox_contacts_graph_legend.Visible = false;
 
@@ -395,8 +404,9 @@ public partial class ChronoJumpWindow
 
        private void showPulseLabels() 
        {
-               hbox_contacts_graph_last_limit.Visible = false;
-               hbox_contacts_graph_person.Visible = false;
+               event_graph_label_graph_test.Visible = true;
+               hbox_contacts_simple_graph_controls.Visible = false;
+
                check_vbox_contacts_graph_legend.Visible = false;
                vbox_contacts_graph_legend.Visible = false;
 
@@ -1116,9 +1126,9 @@ public partial class ChronoJumpWindow
                int longestWordSize = 0;
                if (showTextOnBar)
                {
-                       longestWordSize = findLongestWordSize (eventGraph.jumpsAtSQL);
+                       longestWordSize = findLongestWordSize (eventGraph.jumpsAtSQL, eventGraph.type == ""); 
// condition for "all jumps"
                        layoutText = calculateLayoutFontForText (eventGraph.jumpsAtSQL, longestWordSize, 
layoutText, ancho);
-                       maxRowsForText = calculateMaxRowsForText (eventGraph.jumpsAtSQL, longestWordSize); 
//also adds +1 if simulated
+                       maxRowsForText = calculateMaxRowsForText (eventGraph.jumpsAtSQL, longestWordSize, 
eventGraph.type == ""); //also adds +1 if simulated
                        bottomMargin = calculateBottomMarginForText (maxRowsForText, layoutText);
                }
 
@@ -1208,9 +1218,17 @@ public partial class ChronoJumpWindow
                        if(jump.Simulated == -1)
                                plotSimulatedMessage(x + barWidth/2, alto, layout);
 
-                       if (showTextOnBar && jump.Description != "")
-                               plotTextBelowBar(x + barWidth/2, y, alto, jump.Description, layoutText,
-                                               longestWordSize, maxRowsForText);
+                       if (showTextOnBar && (eventGraph.type == "" || jump.Description != ""))
+                       {
+                               string jumpTypeRowString = "";
+                               if (eventGraph.type == "") //if "all jumps" show jump.Type
+                                       jumpTypeRowString = jump.Type;
+
+                               plotTextBelowBar(x + barWidth/2, y, alto,
+                                               jumpTypeRowString,
+                                               jump.Description, //is the name of the person
+                                               layoutText, longestWordSize, maxRowsForText);
+                       }
 
                        countToDraw --;
                }
@@ -1297,14 +1315,14 @@ public partial class ChronoJumpWindow
                                layout);
        }
 
-       private int calculateMaxRowsForText (List<Jump> jumps, int longestWordSize)
+       private int calculateMaxRowsForText (List<Jump> jumps, int longestWordSize, bool allJumps)
        {
                int maxRows = 0;
 
                foreach(Jump jump in jumps)
                {
                        int rows = 0;
-                       if(jump.Simulated == -1)
+                       if(allJumps)                    //to write the jump type (1st the jump type because 
it's only one row)
                                rows ++;
 
                        //try to pack small words if they fit in a row using wordsAccu (accumulated)
@@ -1322,7 +1340,11 @@ public partial class ChronoJumpWindow
                                        rows ++;
                                }
                        }
-                       rows ++;
+                       if(wordsAccu != "")
+                               rows ++;
+
+                       if(jump.Simulated == -1) //to write simulated at bottom
+                               rows ++;
 
                        if(rows > maxRows)
                                maxRows = rows;
@@ -1342,7 +1364,7 @@ public partial class ChronoJumpWindow
                return lHeight * maxRows;
        }
 
-       private int findLongestWordSize (List<Jump> jumps)
+       private int findLongestWordSize (List<Jump> jumps, bool allJumps)
        {
                int longestWordSize = 0;
 
@@ -1353,9 +1375,15 @@ public partial class ChronoJumpWindow
                        {
                                if(text.Length > longestWordSize)
                                        longestWordSize = text.Length;
-                               if(jump.Simulated == -1 && event_execute_label_simulated.Length > 
longestWordSize)
-                                      longestWordSize = event_execute_label_simulated.Length;
                        }
+
+                       //note jump type will be in one line
+                       //TODO: check it in local user language (Catalog)
+                       if(allJumps && jump.Type.Length > longestWordSize)
+                               longestWordSize = jump.Type.Length;
+
+                       if(jump.Simulated == -1 && event_execute_label_simulated.Length > longestWordSize)
+                               longestWordSize = event_execute_label_simulated.Length;
                }
 
                return longestWordSize;
@@ -1396,22 +1424,35 @@ public partial class ChronoJumpWindow
                return layout;
        }
 
-       //person name or test type
+       //person name or test type, or both
        //this can separate name with spaces on rows
-       private void plotTextBelowBar(int x, int y, int alto, string text, Pango.Layout layout, int 
longestWordSize, int maxRowsForText)
+       private void plotTextBelowBar(int x, int y, int alto,
+                       string jumpType,
+                       string personName,
+                       Pango.Layout layout, int longestWordSize, int maxRowsForText)
        {
                // 1) to get the height of the font
-               layout.SetMarkup(text);
+               layout.SetMarkup(personName);
                int lWidth = 1;
                int lHeight = 1;
                layout.GetPixelSize(out lWidth, out lHeight);
 
+               int row = 1;
+
+               //if have to print jump type, print it first in one row
+               if(jumpType != "")
+               {
+                       plotTextBelowBarDoRow (x,
+                                       Convert.ToInt32(alto - (maxRowsForText) * lHeight),
+                                       jumpType, layout, pen_azul);
+                       row ++;
+               }
+
                // 2) separate in rows and send it to plotTextBelowBarDoRow()
                //    packing small words if they fit in a row using wordsAccu (accumulated)
 
                string wordsAccu = "";
-               string [] words = text.Split(new char[] {' '});
-               int i = 1;
+               string [] words = personName.Split(new char[] {' '});
 
                foreach(string word in words)
                {
@@ -1421,18 +1462,18 @@ public partial class ChronoJumpWindow
                                wordsAccu += " " + word;
                        else {
                                plotTextBelowBarDoRow (x,
-                                               Convert.ToInt32(alto - (maxRowsForText -i +1) * lHeight),
-                                               wordsAccu, layout);
+                                               Convert.ToInt32(alto - (maxRowsForText -row +1) * lHeight),
+                                               wordsAccu, layout, pen_black);
 
                                wordsAccu = word;
-                               i ++;
+                               row ++;
                        }
                }
                plotTextBelowBarDoRow (x,
-                               Convert.ToInt32(alto - (maxRowsForText -i +1) * lHeight),
-                               wordsAccu, layout);
+                               Convert.ToInt32(alto - (maxRowsForText -row +1) * lHeight),
+                               wordsAccu, layout, pen_black);
        }
-       private void plotTextBelowBarDoRow (int x, int y, string text, Pango.Layout layout)
+       private void plotTextBelowBarDoRow (int x, int y, string text, Pango.Layout layout, Gdk.GC pen)
        {
                //just to get the width of every row
                layout.SetMarkup(text);
@@ -1441,7 +1482,7 @@ public partial class ChronoJumpWindow
                layout.GetPixelSize(out lWidth, out lHeight);
 
                //write text
-               event_execute_pixmap.DrawLayout (pen_black, Convert.ToInt32(x - lWidth/2), y, layout);
+               event_execute_pixmap.DrawLayout (pen, Convert.ToInt32(x - lWidth/2), y, layout);
        }
 
        private void plotResultOnBar(int x, int y, int alto, double result, Pango.Layout layout)
@@ -1473,9 +1514,13 @@ public partial class ChronoJumpWindow
                                layout);
        }
 
-       private void addUnitsToLabel(string unit) {
+       private void addUnitsToLabel(string unit)
+       {
                event_graph_label_graph_test.Text = "<b>" + event_graph_label_graph_test.Text + " </b>(" + 
unit + ")";
                event_graph_label_graph_test.UseMarkup = true;
+
+               //no because looks ugly
+               //radio_contacts_graph_currentTest.Label = radio_contacts_graph_currentTest.Label + " (" + 
unit + ")";
        }
 
        private void addLegend(Gdk.GC pen1, string text1, Gdk.GC pen2, string text2, Pango.Layout layout)
@@ -2549,22 +2594,35 @@ public partial class ChronoJumpWindow
                event_execute_pixmap.DrawLayout (pen_gris, 20, yCp2Out -20, layoutSmall);
        }
 
-       private void on_radio_contacts_graph_person_toggled (object o, EventArgs args)
+       // ---- test simple controls ----->
+
+       private void on_spin_contacts_graph_last_limit_value_changed (object o, EventArgs args)
        {
                if(current_menuitem_mode == Constants.Menuitem_modes.JUMPSSIMPLE)
                        updateGraphJumpsSimple ();
 
+
                //TODO: run simple, rt
        }
-       private void on_spin_contacts_graph_last_limit_value_changed (object o, EventArgs args)
+
+       private void on_radio_contacts_graph_test_toggled (object o, EventArgs args)
        {
                if(current_menuitem_mode == Constants.Menuitem_modes.JUMPSSIMPLE)
                        updateGraphJumpsSimple ();
 
+               //TODO: run simple, rt
+       }
+
+       private void on_radio_contacts_graph_person_toggled (object o, EventArgs args)
+       {
+               if(current_menuitem_mode == Constants.Menuitem_modes.JUMPSSIMPLE)
+                       updateGraphJumpsSimple ();
 
                //TODO: run simple, rt
        }
 
+       // <---- end of test simple controls -----
+
        private void on_event_execute_update_graph_in_progress_clicked(object o, EventArgs args)
        {
                bool animate = true;
diff --git a/src/gui/usefulObjects.cs b/src/gui/usefulObjects.cs
index 6e1475ea..f1c569b8 100644
--- a/src/gui/usefulObjects.cs
+++ b/src/gui/usefulObjects.cs
@@ -72,6 +72,7 @@ public class PrepareEventGraphJumpSimple
        //current data
        public double tv;
        public double tc;
+       public string type; //jumpType (useful to know if "all jumps" (type == "")
        public bool djShowHeights; //if djShowHeights and is a dj, graph falling height and jump height
 
                
@@ -82,6 +83,7 @@ public class PrepareEventGraphJumpSimple
 
        //allPersons is for searching the jumps of current of allpersons
        //personID we need to the personsMAX/AVG sql calls
+       //type can be "" for all jumps, then write it under bar
        public PrepareEventGraphJumpSimple(double tv, double tc, int sessionID,
                        int personID, bool allPersons, int limit,
                        string table, string type, bool djShowHeights)
@@ -121,6 +123,7 @@ public class PrepareEventGraphJumpSimple
                        
                this.tv = tv;
                this.tc = tc;
+               this.type = type;
                this.djShowHeights = djShowHeights;
                
                Sqlite.Close();
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 9cc6242d..d08e828d 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -197,6 +197,7 @@ class SqliteJump : Sqlite
         * like SelectJumpsSA above method but much better: return list of jumps
         * sID -1 means all sessions
         * pID -1 means all persons
+        * jumpType "" means all jumps
         * limit -1 means no limit
         * personNameInComment is used to be able to display names in graphs
         *   because event.PersonName makes individual SQL SELECTs
@@ -226,7 +227,12 @@ class SqliteJump : Sqlite
                  andString = " AND ";
          }
 
-         string jumpTypeString = andString + " jump.type = \"" + jumpType + "\"";
+         string jumpTypeString = "";
+         if(jumpType != "")
+         {
+                 jumpTypeString = andString + " jump.type = \"" + jumpType + "\" ";
+                 andString = " AND ";
+         }
 
          string whereString = "";
          if(sessionString != "" || personString != "" || jumpTypeString != "")


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