[chronojump/FS-TFT-Menu] RunInterval tests barchart selection will select on treeview and show on realtime graph
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/FS-TFT-Menu] RunInterval tests barchart selection will select on treeview and show on realtime graph
- Date: Wed, 27 Apr 2022 17:18:03 +0000 (UTC)
commit 6a2bd4a7daa8778561a614b66b2f34583d8131c3
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Apr 22 19:20:11 2022 +0200
RunInterval tests barchart selection will select on treeview and show on realtime graph
glade/app1.glade | 32 +++++++++++++++++++-------------
src/gui/app1/chronojump.cs | 14 +++++++-------
src/gui/cairo/bars.cs | 23 +++++++++++++++++++++++
src/gui/eventExecute.cs | 39 ++++++++++++++++++++++++++++++++++++++-
src/treeview/event.cs | 29 +++++++++++++++++++++++++++--
5 files changed, 114 insertions(+), 23 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index dfdc2d71e..7cd73ae93 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -7983,9 +7983,9 @@ EncoderInertialCapture</property>
<child>
<widget class="GtkDrawingArea"
id="event_execute_drawingarea_cairo">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">False</property>
<signal name="expose_event"
handler="on_event_execute_drawingarea_cairo_expose_event" swapped="no"/>
+ <signal name="button_press_event"
handler="on_event_execute_drawingarea_cairo_button_press_event" swapped="no"/>
</widget>
<packing>
<property name="expand">True</property>
@@ -26294,6 +26294,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -32702,6 +32705,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>
@@ -32738,18 +32753,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>
@@ -42042,6 +42045,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 13f06c111..0353e933e 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -6593,38 +6593,38 @@ LogB.Debug("mc finished 5");
//we should ensure we are deleting last jump and not the selected jump
//force selection of last jump
if(currentJump.UniqueID != myTreeViewJumps.EventSelectedID)
- myTreeViewJumps.SelectEvent(currentJump.UniqueID);
+ myTreeViewJumps.SelectEvent(currentJump.UniqueID, false);
on_delete_selected_jump_clicked(o, args);
} else {
if(currentJumpRj.UniqueID != myTreeViewJumpsRj.EventSelectedID)
- myTreeViewJumpsRj.SelectEvent(currentJumpRj.UniqueID);
+ myTreeViewJumpsRj.SelectEvent(currentJumpRj.UniqueID, false);
on_delete_selected_jump_rj_clicked(o, args);
}
break;
case EventType.Types.RUN:
if(lastRunIsSimple) {
if(currentRun.UniqueID != myTreeViewRuns.EventSelectedID)
- myTreeViewRuns.SelectEvent(currentRun.UniqueID);
+ myTreeViewRuns.SelectEvent(currentRun.UniqueID, false);
on_delete_selected_run_clicked(o, args);
} else {
if(currentRunInterval.UniqueID !=
myTreeViewRunsInterval.EventSelectedID)
-
myTreeViewRunsInterval.SelectEvent(currentRunInterval.UniqueID);
+
myTreeViewRunsInterval.SelectEvent(currentRunInterval.UniqueID, false);
on_delete_selected_run_interval_clicked(o, args);
}
break;
case EventType.Types.PULSE:
if(currentPulse.UniqueID != myTreeViewPulses.EventSelectedID)
- myTreeViewPulses.SelectEvent(currentPulse.UniqueID);
+ myTreeViewPulses.SelectEvent(currentPulse.UniqueID, false);
on_delete_selected_pulse_clicked(o, args);
break;
case EventType.Types.REACTIONTIME:
if(currentReactionTime.UniqueID != myTreeViewReactionTimes.EventSelectedID)
- myTreeViewReactionTimes.SelectEvent(currentReactionTime.UniqueID);
+ myTreeViewReactionTimes.SelectEvent(currentReactionTime.UniqueID,
false);
on_delete_selected_reaction_time_clicked(o, args);
break;
case EventType.Types.MULTICHRONOPIC:
if(currentMultiChronopic.UniqueID != myTreeViewMultiChronopic.EventSelectedID)
- myTreeViewMultiChronopic.SelectEvent(currentMultiChronopic.UniqueID);
+ myTreeViewMultiChronopic.SelectEvent(currentMultiChronopic.UniqueID,
false);
on_delete_selected_multi_chronopic_clicked(o, args);
break;
}
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index 58227875b..dfd6fbf4a 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -80,6 +80,7 @@ public abstract class CairoBars : CairoGeneric
protected Cairo.Color yellow;
protected RepetitionMouseLimits mouseLimits;
+ protected List<int> id_l; //to pass the uniqueID of some test, eg: RunInterval executions and then
find it using mouseLimits
protected List<double> lineData_l; //related to secondary variable (by default range)
protected List<CairoBarsArrow> eccOverload_l;
protected bool eccOverloadWriteValue;
@@ -362,6 +363,7 @@ public abstract class CairoBars : CairoGeneric
topMarginSet ();
mouseLimits = new RepetitionMouseLimits();
+ id_l = new List<int>();
lineData_l = new List<double>();
eccOverload_l = new List<CairoBarsArrow>();
eccOverloadWriteValue = false;
@@ -1041,6 +1043,7 @@ public abstract class CairoBars : CairoGeneric
paintGridInt (g, minX, maxX, minY, maxY, 1, gridType, textHeight -2);
}
+ //return the bar num from 0 (left bar) to the last bar
public int FindBarInPixel (double pixel)
{
LogB.Information("cairo bars FindBarInPixel 0");
@@ -1051,6 +1054,22 @@ public abstract class CairoBars : CairoGeneric
return mouseLimits.FindBarInPixel(pixel);
}
+ //return the id (uniqueID)
+ public int FindBarIdInPixel (double pixel)
+ {
+ LogB.Information("cairo bars FindBarIdInPixel 0");
+
+ int bar = FindBarInPixel (pixel);
+ if(bar == -1)
+ return -1;
+
+ if(id_l == null || bar >= id_l.Count)
+ return -1;
+
+ LogB.Information("cairo bars FindBarIdInPixel 1");
+ return id_l[bar];
+ }
+
/*
encoder title has different strings, one of them in grey, more or less on the center
we need to pass the strings here to create the title
@@ -1093,6 +1112,10 @@ public abstract class CairoBars : CairoGeneric
set { variableSerieB = value; }
}
+ public List<int> Id_l {
+ set { id_l = value; }
+ }
+
//related to secondary variable (by default range)
public List<double> LineData_l {
set { lineData_l = value; }
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index c7ac8cef4..af2224451 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -536,6 +536,8 @@ public partial class ChronoJumpWindow
//barplot of tests in session
public void on_event_execute_drawingarea_cairo_expose_event(object o, ExposeEventArgs args)
{
+ event_execute_drawingarea_cairo.AddEvents((int) Gdk.EventMask.ButtonPressMask);
+
//right now only for jumps/runs simple
if(current_mode != Constants.Modes.JUMPSSIMPLE &&
current_mode != Constants.Modes.JUMPSREACTIVE &&
@@ -574,6 +576,27 @@ public partial class ChronoJumpWindow
PrepareRunDoubleContactsGraph (false);
}
+ private void on_event_execute_drawingarea_cairo_button_press_event (object o, ButtonPressEventArgs
args)
+ {
+ LogB.Information("on_event_execute_drawingarea_cairo_button_press_event");
+ if (current_mode != Constants.Modes.RUNSINTERVALLIC)
+ return;
+
+ if(cairoPaintBarsPre == null)
+ return;
+
+ //int bar = cairoPaintBarsPre.FindBarInPixel(args.Event.X);
+ //LogB.Information("Bar: " + bar.ToString());
+ int id = cairoPaintBarsPre.FindBarIdInPixel(args.Event.X);
+ LogB.Information("id: " + id.ToString());
+ if(id >= 0 && myTreeViewRunsInterval != null)
+ {
+ myTreeViewRunsInterval.ZoomToTestsIfNeeded ();
+ myTreeViewRunsInterval.SelectEvent (id, true); //scroll
+ on_treeview_runs_interval_cursor_changed (new object (), new EventArgs ()); //in
order to update top graph
+ }
+ }
+
// simple and DJ jump
public void PrepareJumpSimpleGraph(PrepareEventGraphJumpSimple eventGraph, bool animate)
{
@@ -2512,11 +2535,20 @@ public abstract class CairoPaintBarsPre
public int FindBarInPixel (double pixel)
{
+ LogB.Information(string.Format("FindBarInPixel cb == null: {0}, pixel: {1}", (cb == null),
pixel));
if(cb == null)
return -1;
return cb.FindBarInPixel(pixel);
}
+ public int FindBarIdInPixel (double pixel)
+ {
+ LogB.Information(string.Format("FindBarIdInPixel cb == null: {0}, pixel: {1}", (cb == null),
pixel));
+ if(cb == null)
+ return -1;
+
+ return cb.FindBarIdInPixel(pixel);
+ }
}
public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
@@ -2939,7 +2971,7 @@ public class CairoPaintBarsPreRunInterval : CairoPaintBarsPre
protected override void paintSpecific()
{
- CairoBars1Series cb = new CairoBars1Series (darea, CairoBars.Type.NORMAL, false, true, true);
+ cb = new CairoBars1Series (darea, CairoBars.Type.NORMAL, true, true, true);
cb.YVariable = Catalog.GetString("Speed");
cb.YUnits = "m/s";
@@ -2981,6 +3013,7 @@ public class CairoPaintBarsPreRunInterval : CairoPaintBarsPre
List<PointF> point_l = new List<PointF>();
List<string> names_l = new List<string>();
+ List<int> id_l = new List<int>(); //the uniqueIDs for knowing them on bar selection
int countToDraw = eventGraphRunsIntervalStored.runsAtSQL.Count;
foreach(RunInterval runI in eventGraphRunsIntervalStored.runsAtSQL)
@@ -3007,8 +3040,12 @@ public class CairoPaintBarsPreRunInterval : CairoPaintBarsPre
runI.Description,
thereIsASimulated, (runI.Simulated == -1),
longestWord.Length, maxRowsForText));
+
+ id_l.Add(runI.UniqueID);
}
+ cb.Id_l = id_l;
+
cb.PassGuidesData (new CairoBarsGuideManage(
! ShowPersonNames, true, //usePersonGuides, useGroupGuides
eventGraphRunsIntervalStored.sessionMAXAtSQL,
diff --git a/src/treeview/event.cs b/src/treeview/event.cs
index 6f9b9bd2e..5ca81ef62 100644
--- a/src/treeview/event.cs
+++ b/src/treeview/event.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2020 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2022 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -235,6 +235,23 @@ public class TreeViewEvent
}
}
+ //if only shown persons, zoom to tests
+ public void ZoomToTestsIfNeeded ()
+ {
+ if(expandState == ExpandStates.MINIMIZED)
+ {
+ if(treeviewHasTwoLevels)
+ {
+ expandState = ExpandStates.OPTIMAL;
+ ExpandOptimal();
+ } else
+ {
+ expandState = ExpandStates.MAXIMIZED;
+ treeview.ExpandAll();
+ }
+ }
+ }
+
public void Add (string personName, System.Object newEvent)
{
@@ -367,7 +384,8 @@ public class TreeViewEvent
Unselect(); //if not found: unselect all
}
- public void SelectEvent(int uniqueID) {
+ public void SelectEvent (int uniqueID, bool scrollToEvent)
+ {
TreeIter iter = new TreeIter();
treeview.Model.GetIterFirst ( out iter ) ;
@@ -388,6 +406,13 @@ public class TreeViewEvent
if(iterEventID == uniqueID) {
LogB.Information("We select:" + iterEventID);
treeview.Selection.SelectIter (iter);
+
+ if(scrollToEvent) {
+ TreePath path = store.GetPath (iter);
+ LogB.Debug(path.ToString());
+ treeview.ScrollToCell (path, null, true, 0, 0);
+ }
+
found = true;
}
iterValid = iter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]