[chronojump] Fixed RunSimpleDoubleContacts graph (still GTK) to be converted to Cairo



commit 379bda192f51d4dd1f0b353f20dcac28fd1cfbed
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Oct 18 14:27:37 2021 +0200

    Fixed RunSimpleDoubleContacts graph (still GTK) to be converted to Cairo

 src/gui/eventExecute.cs | 46 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 7c2734adf..46f7778d5 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -766,8 +766,29 @@ public partial class ChronoJumpWindow
        //standard call
        public void PrepareRunSimpleGraph(PrepareEventGraphRunSimple eventGraph, bool animate, 
RunPhaseTimeList runPTL)
        {
-               UtilGtk.ClearDrawingArea(event_execute_drawingarea_run_simple_double_contacts,
-                               event_execute_run_simple_double_contacts_pixmap);
+               double timeTotal = eventGraph.time;
+               // start of contact chunks
+               LogB.Information(string.Format("runPTL is null: {0}", (runPTL == null)));
+
+               if(runPTL != null && runPTL.UseDoubleContacts())
+               {
+                       UtilGtk.ClearDrawingArea(event_execute_drawingarea_run_simple_double_contacts,
+                                       event_execute_run_simple_double_contacts_pixmap);
+
+                       List<RunPhaseTimeListObject> runPTLInListForPainting = runPTL.InListForPainting();
+
+                       double negativePTLTime = getRunSRunINegativePTLTime(runPTLInListForPainting);
+                       double timeTotalWithExtraPTL = getRunSRunITimeTotalWithExtraPTLTime (timeTotal, 
runPTLInListForPainting, negativePTLTime);
+
+                       LogB.Information(string.Format("timeTotal: {0}, negativePTLTime: {1}, 
timeTotalWithExtraPTL: {2}",
+                                               timeTotal, negativePTLTime, timeTotalWithExtraPTL));
+
+
+                       int ancho2 = event_execute_drawingarea_run_simple_double_contacts.Allocation.Width;
+                       paintRunSRunIContactChunks(event_execute_run_simple_double_contacts_pixmap, 20, 
ancho2, 0,
+                                       runPTLInListForPainting, timeTotal, timeTotalWithExtraPTL, 
negativePTLTime, true, true);
+               }
+               // end of contact chunks
 
                // Paint cairo graph
                cairoPaintBarsPre.ShowPersonNames = radio_contacts_graph_allPersons.Active;
@@ -1479,29 +1500,31 @@ public partial class ChronoJumpWindow
                        int xEnd = event_execute_rightMargin + Convert.ToInt32((ancho - 
2*event_execute_rightMargin) *
                                        (inPTL.tcEnd + negativePTLTime) / timeTotalWithExtraPTL);
 
-                       pixmap.DrawRectangle(pen_background_shifted, true,
+                       pixmap.DrawRectangle(pen_double_contacts, true,
                                        new Rectangle (xStart, alto-bottomMargin-4, xEnd-xStart, 4));
 
                        //manage chunks indications
                        if(inPTL.phase == RunPhaseTimeListObject.Phases.START)
                        {
                                //draw the vertical start line
-                               pixmap.DrawLine(pen_background_shifted,
+                               pixmap.DrawLine(pen_double_contacts,
                                                xStart - chunkMargins, alto-bottomMargin -4,
                                                xStart - chunkMargins, alto-bottomMargin -(4 + chunkMargins));
                                lastChunkStart = xStart;
+                               LogB.Information("runPTL draw start");
                        }
                        else if(inPTL.phase == RunPhaseTimeListObject.Phases.END)
                        {
                                //draw the vertical end line
-                               pixmap.DrawLine(pen_background_shifted,
+                               pixmap.DrawLine(pen_double_contacts,
                                                xEnd + chunkMargins, alto-bottomMargin -4,
                                                xEnd + chunkMargins, alto-bottomMargin -(4 + chunkMargins));
 
                                //draw the horizontal start-end line
-                               pixmap.DrawLine(pen_background_shifted,
+                               pixmap.DrawLine(pen_double_contacts,
                                                lastChunkStart - chunkMargins, alto-bottomMargin -(4 + 
chunkMargins),
                                                xEnd + chunkMargins, alto-bottomMargin -(4 + chunkMargins));
+                               LogB.Information("runPTL draw end");
                        }
 
                }
@@ -1513,11 +1536,11 @@ public partial class ChronoJumpWindow
                        //paint start vertical line
                        int xStart2 = event_execute_rightMargin + Convert.ToInt32((ancho - 
2*event_execute_rightMargin) *
                                        (negativePTLTime) / timeTotalWithExtraPTL) -1;
-                       pixmap.DrawLine(pen_azul, xStart2 +1, 10, xStart2 +1, alto-bottomMargin-4);
+                       pixmap.DrawLine(pen_double_contacts, xStart2 +1, 10, xStart2 +1, alto-bottomMargin-4);
 
                        layoutMid_run_simple.SetMarkup("Start");
                        layoutMid_run_simple.GetPixelSize(out lWidth, out lHeight);
-                       pixmap.DrawLayout (pen_azul,
+                       pixmap.DrawLayout (pen_double_contacts,
                                        xStart2 -lWidth/2, 0, layoutMid_run_simple);
                }
 
@@ -1526,11 +1549,11 @@ public partial class ChronoJumpWindow
                        //paint end vertical line
                        int xEnd2 = event_execute_rightMargin + Convert.ToInt32((ancho - 
2*event_execute_rightMargin) *
                                        (timeTotal + negativePTLTime) / timeTotalWithExtraPTL);
-                       pixmap.DrawLine(pen_azul, xEnd2, 10, xEnd2, alto-bottomMargin-4);
+                       pixmap.DrawLine(pen_double_contacts, xEnd2, 10, xEnd2, alto-bottomMargin-4);
 
                        layoutMid_run_simple.SetMarkup("End");
                        layoutMid_run_simple.GetPixelSize(out lWidth, out lHeight);
-                       pixmap.DrawLayout (pen_azul,
+                       pixmap.DrawLayout (pen_double_contacts,
                                        xEnd2 -lWidth/2, 0, layoutMid_run_simple);
                }
        }
@@ -2040,6 +2063,7 @@ public partial class ChronoJumpWindow
        Gdk.GC pen_rojo; //tc, also time; jump avg personTc
        //Gdk.GC pen_azul_claro; //tf, also speed and pulse; jump avg personTv. This for bars
        Gdk.GC pen_azul; //tf, also speed and pulse; jump avg personTv. This for lines
+       Gdk.GC pen_double_contacts;
        Gdk.GC pen_rojo_discont; //avg tc in reactive; jump avg sessionTc 
        //Gdk.GC pen_azul_claro_discont; //avg tf in reactive; jump avg sessionTv
        Gdk.GC pen_azul_discont; //avg tf in reactive; jump avg sessionTv
@@ -2123,6 +2147,7 @@ public partial class ChronoJumpWindow
                pen_background = new Gdk.GC(event_execute_drawingarea.GdkWindow);
                pen_background_shifted = new Gdk.GC(event_execute_drawingarea.GdkWindow);
 
+               pen_double_contacts = new 
Gdk.GC(event_execute_drawingarea_run_simple_double_contacts.GdkWindow);
                
                pen_rojo.Foreground = UtilGtk.RED_PLOTS;
                //pen_azul_claro.Foreground = UtilGtk.LIGHT_BLUE_PLOTS;
@@ -2165,6 +2190,7 @@ public partial class ChronoJumpWindow
 
                pen_background.Foreground = colorBackground;
                pen_background_shifted.Foreground = colorBackgroundShifted;
+               pen_double_contacts.Foreground = colorBackground;
        }
        void on_event_execute_button_cancel_clicked (object o, EventArgs args)
        {


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