Implements scrollbar in main window
authorFrancis Deslauriers <francis.deslauriers@polymtl.ca>
Mon, 11 Jun 2012 14:08:49 +0000 (10:08 -0400)
committerYannick Brosseau <yannick.brosseau@gmail.com>
Mon, 11 Jun 2012 21:34:34 +0000 (17:34 -0400)
Signed-off-by: Francis Deslauriers <francis.deslauriers@polymtl.ca>
Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
lttv/lttv/traceset.c
lttv/lttv/traceset.h
lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c

index 0a55ae43f960b83a6723cea260d548517f18b0cf..ae7c1a16cecf5e9319813d57a0fecbdf91dfb79e 100644 (file)
@@ -528,7 +528,19 @@ guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset)
     }
   }
   return timestamp_max;
-  
+}
+
+/*
+ * lttv_traceset_get_time_span : return a TimeInterval representing the
+ * minimum timestamp dans le maximum timestamp of the traceset.
+ * 
+ */
+TimeInterval lttv_traceset_get_time_span(LttvTraceset *ts)
+{
+        TimeInterval time_span;
+        time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(ts));
+        time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts));
+        return time_span;
 }
 
 const char *lttv_traceset_get_name_from_event(LttvEvent *event)
index 6af2e39cbb7eba0a26a89b59e7ce47989f892d34..6d4cedafd1dcceba4e7f9b46c0fd11c04796afdf 100644 (file)
@@ -23,6 +23,7 @@
 #include <lttv/hook.h>
 #include <lttv/event.h>
 #include <ltt/ltt.h>
+#include <ltt/time.h>
 #include <lttv/trace.h>
 /* A traceset is a set of traces to be analyzed together. */
 
@@ -122,6 +123,8 @@ guint lttv_traceset_get_cpuid_from_event(LttvEvent *event);
 guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset);
 /* Returns the maximum timestamp of the traces in the traceset */
 guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset);
+/* Returns a TimeInterval struct that represents the min and max of the traceset */
+TimeInterval lttv_traceset_get_time_span(LttvTraceset *traceset);
 
 const char *lttv_traceset_get_name_from_event(LttvEvent *event);
 
index 401bb79c0b952cd43236882a839ab3ac3a2492d5..34bce0a9bfd066e6e9832ea48a46e2657025bd8c 100644 (file)
@@ -283,9 +283,7 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
   }
 #endif /*BABEL_CLEANUP*/
 
-
-  time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(traceset));
-  time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(traceset));
+  time_span = lttv_traceset_get_time_span(traceset);
   
   tab->traceset_info->traceset = traceset;
   
@@ -3372,11 +3370,10 @@ void current_position_change_manager(Tab *tab,
 static void on_timebar_starttime_changed(Timebar *timebar,
                                gpointer user_data)
 {
-  #ifdef BABEL_CLEANUP
        Tab *tab = (Tab *)user_data;
-       LttvTracesetContext * tsc =
-               LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
-       TimeInterval time_span = tsc->time_span;
+       LttvTraceset * ts =tab->traceset_info->traceset;
+       TimeInterval time_span = lttv_traceset_get_time_span(ts);
 
        TimeWindow new_time_window = tab->time_window;
        new_time_window.start_time = timebar_get_start_time(timebar);
@@ -3404,17 +3401,16 @@ static void on_timebar_starttime_changed(Timebar *timebar,
 
        /* Notify the time_manager */
        time_change_manager(tab, new_time_window);
-#endif /* BABEL_CLEANUP */
+
 }
 
 static void on_timebar_endtime_changed(Timebar *timebar,
                                gpointer user_data)
 {
-    #ifdef BABEL_CLEANUP
+
        Tab *tab = (Tab *)user_data;
-       LttvTracesetContext * tsc = 
-               LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
-       TimeInterval time_span = tsc->time_span;
+        LttvTraceset * ts =tab->traceset_info->traceset;
+        TimeInterval time_span = lttv_traceset_get_time_span(ts);
 
        TimeWindow new_time_window = tab->time_window;
 
@@ -3441,8 +3437,7 @@ static void on_timebar_endtime_changed(Timebar *timebar,
        new_time_window.end_time = end_time;
 
        /* Notify the time_manager */
-       time_change_manager(tab, new_time_window);  
-         #endif /* BABEL_CLEANUP*/
+       time_change_manager(tab, new_time_window);
 }
 static void on_timebar_currenttime_changed(Timebar *timebar,
                                gpointer user_data)
@@ -3457,7 +3452,7 @@ static void on_timebar_currenttime_changed(Timebar *timebar,
 void scroll_value_changed_cb(GtkWidget *scrollbar,
                              gpointer user_data)
 {
-    #ifdef BABEL_CLEANUP
+   
   Tab *tab = (Tab *)user_data;
   TimeWindow new_time_window;
   LttTime time;
@@ -3465,9 +3460,9 @@ void scroll_value_changed_cb(GtkWidget *scrollbar,
   gdouble value = gtk_adjustment_get_value(adjust);
  // gdouble upper, lower, ratio, page_size;
   gdouble page_size;
-  LttvTracesetContext * tsc = 
-    LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
-  TimeInterval time_span = tsc->time_span;
+  
+  LttvTraceset * ts = tab->traceset_info->traceset;
+  TimeInterval time_span = lttv_traceset_get_time_span(ts);
 
   time = ltt_time_add(ltt_time_from_double(value),
                       time_span.start_time);
@@ -3487,6 +3482,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar,
 
 
   time_change_manager(tab, new_time_window);
+
 #if 0
   //time_window = tab->time_window;
 
@@ -3515,7 +3511,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar,
   /* call viewer hooks for new time window */
   set_time_window(tab, &time_window);
 #endif //0
-#endif /* BABEL_CLEANUP */
+
 }
 
 
This page took 0.02731 seconds and 4 git commands to generate.