Initial port of the detailed event view
[lttv.git] / lttv / modules / gui / lttvwindow / lttvwindow / callbacks.c
index 401bb79c0b952cd43236882a839ab3ac3a2492d5..ae56ee67354108613cf5b8793c3b61414f48a2c6 100644 (file)
@@ -226,7 +226,6 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor)
 int SetTraceset(Tab * tab, LttvTraceset *traceset)
 {
   
-  guint i;
   TimeInterval time_span;
   TimeWindow new_time_window;
   LttTime new_current_time;
@@ -283,9 +282,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;
   
@@ -712,7 +709,7 @@ void open_traceset(GtkWidget * widget, gpointer user_data)
 
 gboolean lttvwindow_process_pending_requests(Tab *tab)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   LttvTracesetContext *tsc;
   LttvTracefileContext *tfc;
   GSList *list_in = NULL;
@@ -989,11 +986,12 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
             /* Process the traceset with only state hooks */
 #ifdef DEBUG
             seek_count =
-#endif
+
                lttv_process_traceset_middle(tsc,
                                             ltt_time_infinite,
                                             G_MAXUINT,
                                             events_request->start_position);
+#endif
             g_assert(lttv_traceset_context_ctx_pos_compare(tsc,
                          events_request->start_position) == 0);
 
@@ -1502,8 +1500,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
 static gboolean
 live_trace_update_handler(Tab *tab)
 {  
-       unsigned int updated_count;
 #ifdef BABEL_CLEANUP
+       unsigned int updated_count;
        LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
        TimeInterval initial_time_span = tsc->time_span;
        TimeInterval updated_time_span;
@@ -1543,7 +1541,7 @@ live_trace_update_handler(Tab *tab)
 
 static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   LttvTraceset *traceset = tab->traceset_info->traceset;
   guint i;
   guint num_traces = lttv_traceset_number(traceset);
@@ -1727,7 +1725,7 @@ void add_trace(GtkWidget * widget, gpointer user_data)
 
 void remove_trace(GtkWidget *widget, gpointer user_data)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   LttTrace *trace;
   LttvTrace * trace_v;
   LttvTraceset * traceset;
@@ -2069,7 +2067,7 @@ void save_as(GtkWidget * widget, gpointer user_data)
 
 void zoom(GtkWidget * widget, double size)
 {
-  #ifdef BABEL_CLEANUP
+#ifdef BABEL_CLEANUP
   TimeInterval time_span;
   TimeWindow new_time_window;
   LttTime    current_time, time_delta;
@@ -3349,34 +3347,26 @@ void current_time_change_manager       (Tab *tab,
   tab->current_time_manager_lock = FALSE;
 }
 
-void current_position_change_manager(Tab *tab,
-                                     LttvTracesetPosition *pos)
+void current_position_change_manager(Tab *tab, LttvTracesetPosition *pos)
 {
-    #ifdef BABEL_CLEANUP
-  LttvTracesetContext *tsc =
-    LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
-  int retval;
-
-  retval= lttv_process_traceset_seek_position(tsc, pos);
-  g_assert_cmpint(retval, ==, 0);
-  LttTime new_time = lttv_traceset_context_position_get_time(pos);
+  lttv_traceset_seek_to_position( pos);
+
+  LttTime new_time = lttv_traceset_position_get_time(pos);
   /* Put the context in a state coherent position */
-  lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero);
-  
+#ifdef BABEL_CLEANUP
+   lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero);
+#endif /* BABEL_CLEANUP */
   current_time_change_manager(tab, new_time);
   
   set_current_position(tab, pos);
-    #endif /* BABEL_CLEANUP */
 }
 
 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 +3394,15 @@ 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 +3429,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 +3444,6 @@ 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 +3451,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 +3473,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar,
 
 
   time_change_manager(tab, new_time_window);
+
 #if 0
   //time_window = tab->time_window;
 
@@ -3515,7 +3502,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.025092 seconds and 4 git commands to generate.