compile ok after API cleanup
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 5 May 2004 20:55:13 +0000 (20:55 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 5 May 2004 20:55:13 +0000 (20:55 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@518 04897980-b3bd-0310-b5e0-8ef037075253

14 files changed:
ltt/branches/poly/lttv/lttv/module.c
ltt/branches/poly/lttv/lttv/module.h
ltt/branches/poly/lttv/modules/gui/controlflow/cfv-private.h
ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c
ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/gtkmultivpaned.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/viewer.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/viewer.h
ltt/branches/poly/lttv/modules/gui/statistics/statistics.c

index c4d3d6b07405c037a444cd11058e42cea2de876a..18cc24e03a2740efd21c10ebca5d8a4e7e431414 100644 (file)
@@ -459,14 +459,14 @@ LttvLibrary *lttv_library_get(unsigned i)
 }
 
 
-void lttv_library_path_add(char *name)
+void lttv_library_path_add(const char *name)
 {
   g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Add library path %s", name);
   g_ptr_array_add(library_paths,(char*)g_strdup(name));
 }
 
 
-void lttv_library_path_remove(char *name) 
+void lttv_library_path_remove(const char *name) 
 {
   guint i;
 
index e88b7b92afaee406a5f3bd2085cb38331156236a..68791a2dc8dd7ee5ada476c6bed2a72d03cb0997 100644 (file)
@@ -136,9 +136,9 @@ LttvLibrary *lttv_library_get(unsigned i);
 
 /* Add or remove directory names to the library search path */
 
-void lttv_library_path_add(char *name);
+void lttv_library_path_add(const char *name);
 
-void lttv_library_path_remove(char *name);
+void lttv_library_path_remove(const char *name);
 
 
 /* List the directory names in the library search path */
index 291c129fc04e105800785b3780338239e459ad86..de324869f47d52ae4436b5231a008e7408e12cec 100644 (file)
@@ -32,8 +32,8 @@ struct _ControlFlowData {
   GtkAdjustment *v_adjust ;
   
   /* Shown events information */
-  TimeWindow time_window;
-  LttTime current_time;
+//  TimeWindow time_window;
+//  LttTime current_time;
   
   //guint currently_Selected_Event  ;
   guint number_of_process;
index 687adcce8f05bf4e3ce14ec5f01dc4e147c7bd88..f51f974d05bc559e827dc7ca6f34487ec8667510 100644 (file)
@@ -32,7 +32,7 @@ extern GSList *g_control_flow_data_list;
 static void control_flow_grab_focus(GtkWidget *widget, gpointer data){
   ControlFlowData * control_flow_data = (ControlFlowData *)data;
   MainWindow * mw = control_flow_data->mw;
-  set_focused_pane(mw, gtk_widget_get_parent(control_flow_data->scrolled_window));
+  lttvwindow_report_focus(mw, gtk_widget_get_parent(control_flow_data->scrolled_window));
 }
 
 
@@ -166,13 +166,13 @@ guicontrolflow_destructor(ControlFlowData *control_flow_data)
   //ProcessList_destroy(control_flow_data->process_list);
   if(control_flow_data->mw != NULL)
   {
-    unreg_update_time_window(update_time_window_hook,
-        control_flow_data,
-        control_flow_data->mw);
+    lttvwindow_unregister_time_window_notify(control_flow_data->mw,
+        update_time_window_hook,
+        control_flow_data);
   
-    unreg_update_current_time(update_current_time_hook,
-        control_flow_data,
-        control_flow_data->mw);
+    lttvwindow_unregister_current_time_notify(control_flow_data->mw,
+        update_current_time_hook,
+        control_flow_data);
   }
   g_info("CFV.c : guicontrolflow_destructor, %p", control_flow_data);
   g_slist_remove(g_control_flow_data_list,control_flow_data);
@@ -190,13 +190,4 @@ ProcessList *guicontrolflow_get_process_list
     return control_flow_data->process_list ;
 }
 
-TimeWindow *guicontrolflow_get_time_window(ControlFlowData *control_flow_data)
-{
-  return &control_flow_data->time_window;
-}
-LttTime *guicontrolflow_get_current_time(ControlFlowData *control_flow_data)
-{
-  return &control_flow_data->current_time;
-}
-
 
index c5f9d14ff79e2c506f77a81306a6f05ad2d66177..eb01fa586b3061d6b4c2710a0b496ce4e4e4e1ac 100644 (file)
@@ -36,8 +36,6 @@ void
 guicontrolflow_destructor(ControlFlowData *control_flow_data);
 GtkWidget *guicontrolflow_get_widget(ControlFlowData *control_flow_data);
 ProcessList *guicontrolflow_get_process_list(ControlFlowData *control_flow_data);
-TimeWindow *guicontrolflow_get_time_window(ControlFlowData *control_flow_data);
-LttTime *guicontrolflow_get_current_time(ControlFlowData *control_flow_data);
 
 
 #endif // _CFV_H
index 15fbf239067af2e6a88e3ac115a826c92d6b22a9..acaf0a4230541954bec6a2ea1008e225718c72bc 100644 (file)
@@ -79,46 +79,40 @@ void drawing_data_request(Drawing_t *drawing,
 {
   if(width < 0) return ;
   if(height < 0) return ;
+
+  const TimeWindow *time_window = lttvwindow_get_time_window(drawing->control_flow_data->mw);
+
   ControlFlowData *control_flow_data =
       (ControlFlowData*)g_object_get_data(
-                G_OBJECT(
-                    drawing->drawing_area),
-                "control_flow_data");
+                 G_OBJECT(drawing->drawing_area), "control_flow_data");
 
   LttTime start, end;
-  LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
-                        control_flow_data->time_window.start_time);
+  LttTime window_end = ltt_time_add(time_window->time_width,
+                                    time_window->start_time);
 
   g_debug("req : window_end : %u, %u", window_end.tv_sec, 
-                                      window_end.tv_nsec);
+                                       window_end.tv_nsec);
 
-  g_debug("req : time width : %u, %u", control_flow_data->time_window.time_width.tv_sec, 
-                                control_flow_data->time_window.time_width.tv_nsec);
+  g_debug("req : time width : %u, %u", time_window->time_width.tv_sec, 
+                                       time_window->time_width.tv_nsec);
   
   g_debug("x is : %i, x+width is : %i", x, x+width);
 
   convert_pixels_to_time(drawing->drawing_area->allocation.width, x,
-        &control_flow_data->time_window.start_time,
-        &window_end,
+        time_window->start_time,
+        window_end,
         &start);
 
   convert_pixels_to_time(drawing->drawing_area->allocation.width, x + width,
-        &control_flow_data->time_window.start_time,
-        &window_end,
+        time_window->start_time,
+        window_end,
         &end);
   
   LttvTracesetContext * tsc =
-        get_traceset_context(control_flow_data->mw);
+        lttvwindow_get_traceset_context(control_flow_data->mw);
   LttvTracesetState * tss =
         (LttvTracesetState*)tsc;
   
-    //send_test_process(
-  //guicontrolflow_get_process_list(drawing->control_flow_data),
-  //drawing);
-  //send_test_drawing(
-  //guicontrolflow_get_process_list(drawing->control_flow_data),
-  //drawing, *pixmap, x, y, width, height);
-  
   // Let's call processTrace() !!
   EventRequest event_request; // Variable freed at the end of the function.
   event_request.control_flow_data = control_flow_data;
@@ -185,8 +179,8 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
    * has updated the time interval before this configure gets
    * executed.
    */
-  get_time_window(drawing->control_flow_data->mw,
-        &drawing->control_flow_data->time_window);
+  //lttvwindow_get_time_window(drawing->control_flow_data->mw,
+  //      &drawing->control_flow_data->time_window);
   
   /* New pixmap, size of the configure event */
   //GdkPixmap *pixmap = gdk_pixmap_new(widget->window,
@@ -306,6 +300,10 @@ static gboolean
 expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
 {
   Drawing_t *drawing = (Drawing_t*)user_data;
+  const TimeWindow *time_window = lttvwindow_get_time_window(drawing->control_flow_data->mw);
+  const LttTime* current_time = 
+      lttvwindow_get_current_time(drawing->control_flow_data->mw);
+
   ControlFlowData *control_flow_data =
       (ControlFlowData*)g_object_get_data(
                 G_OBJECT(widget),
@@ -314,14 +312,12 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
   g_debug("drawing expose event");
   
   guint x=0;
-  LttTime* current_time = 
-      guicontrolflow_get_current_time(control_flow_data);
 
-  LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
-                      control_flow_data->time_window.start_time);
+  LttTime window_end = ltt_time_add(time_window->time_width,
+                                    time_window->start_time);
 
   convert_time_to_pixels(
-        control_flow_data->time_window.start_time,
+        time_window->start_time,
         window_end,
         *current_time,
         widget->allocation.width,
@@ -366,30 +362,30 @@ button_press_event( GtkWidget *widget, GdkEventButton *event, gpointer user_data
                 G_OBJECT(widget),
                 "control_flow_data");
   Drawing_t *drawing = control_flow_data->drawing;
-
+  const TimeWindow *time_window = lttvwindow_get_time_window(drawing->control_flow_data->mw);
 
   g_debug("click");
   if(event->button == 1)
   {
     LttTime time;
 
-    LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
-                        control_flow_data->time_window.start_time);
+    LttTime window_end = ltt_time_add(time_window->time_width,
+                                      time_window->start_time);
 
 
     /* left mouse button click */
     g_debug("x click is : %f", event->x);
 
     convert_pixels_to_time(widget->allocation.width, (guint)event->x,
-        &control_flow_data->time_window.start_time,
-        &window_end,
+        time_window->start_time,
+        window_end,
         &time);
 
-    set_current_time(control_flow_data->mw, &time);
+    lttvwindow_report_current_time(control_flow_data->mw, &time);
 
   }
 
-  set_focused_pane(control_flow_data->mw, gtk_widget_get_parent(control_flow_data->scrolled_window));
+  lttvwindow_report_focus(control_flow_data->mw, gtk_widget_get_parent(control_flow_data->scrolled_window));
   
   return FALSE;
 }
@@ -517,16 +513,16 @@ GtkWidget *drawing_get_widget(Drawing_t *drawing)
 void convert_pixels_to_time(
     gint width,
     guint x,
-    LttTime *window_time_begin,
-    LttTime *window_time_end,
+    LttTime window_time_begin,
+    LttTime window_time_end,
     LttTime *time)
 {
   LttTime window_time_interval;
   
-  window_time_interval = ltt_time_sub(*window_time_end, 
-            *window_time_begin);
+  window_time_interval = ltt_time_sub(window_time_end, 
+            window_time_begin);
   *time = ltt_time_mul(window_time_interval, (x/(float)width));
-  *time = ltt_time_add(*window_time_begin, *time);
+  *time = ltt_time_add(window_time_begin, *time);
 }
 
 
@@ -737,7 +733,7 @@ static gboolean
 expose_ruler( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
 {
   Drawing_t *drawing = (Drawing_t*)user_data;
-
+  const TimeWindow *time_window = lttvwindow_get_time_window(drawing->control_flow_data->mw);
   gchar text[255];
   
   PangoContext *context;
@@ -751,13 +747,13 @@ expose_ruler( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
   GdkColor background = { 0, 0xffff, 0xffff, 0xffff };
 
   LttTime window_end = 
-    ltt_time_add(drawing->control_flow_data->time_window.time_width,
-                 drawing->control_flow_data->time_window.start_time);
+    ltt_time_add(time_window->time_width,
+                 time_window->start_time);
   LttTime half_width =
-    ltt_time_div(drawing->control_flow_data->time_window.time_width,2.0);
+    ltt_time_div(time_window->time_width,2.0);
   LttTime window_middle =
     ltt_time_add(half_width,
-                 drawing->control_flow_data->time_window.start_time);
+                 time_window->start_time);
   g_debug("ruler expose event");
  
   gdk_draw_rectangle (drawing->ruler->window,
@@ -781,8 +777,8 @@ expose_ruler( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
 
 
   snprintf(text, 255, "%lus\n%luns",
-    drawing->control_flow_data->time_window.start_time.tv_sec,
-    drawing->control_flow_data->time_window.start_time.tv_nsec);
+    time_window->start_time.tv_sec,
+    time_window->start_time.tv_nsec);
 
   layout = gtk_widget_create_pango_layout(drawing->drawing_area, NULL);
 
index 6576a89213ebe016a8283ce9d16f08270904d0b8..e37e56dfbb168c042b77606f1f946b10bf40b2af 100644 (file)
@@ -104,8 +104,8 @@ void drawing_remove_square(Drawing_t *drawing,
 void convert_pixels_to_time(
     gint width,
     guint x,
-    LttTime *window_time_begin,
-    LttTime *window_time_end,
+    LttTime window_time_begin,
+    LttTime window_time_end,
     LttTime *time);
 
 void convert_time_to_pixels(
index 697b7df70c45d512c01cd45037dcf5c1cdced3d4..1fb3f1ec5c812959c7a8e1fe64598524ec946b7d 100644 (file)
@@ -68,29 +68,15 @@ h_guicontrolflow(MainWindow *mw, LttvTracesetSelector * s, char * key)
   ControlFlowData *control_flow_data = guicontrolflow() ;
   
   control_flow_data->mw = mw;
-  TimeWindow *time_window = guicontrolflow_get_time_window(control_flow_data);
-  time_window->start_time.tv_sec = 0;
-  time_window->start_time.tv_nsec = 0;
-  time_window->time_width.tv_sec = 0;
-  time_window->time_width.tv_nsec = 0;
-
-  LttTime *current_time = guicontrolflow_get_current_time(control_flow_data);
-  current_time->tv_sec = 0;
-  current_time->tv_nsec = 0;
   
-  //g_debug("time width1 : %u",time_window->time_width);
-  
-  get_time_window(mw,
-      time_window);
-  get_current_time(mw,
-      current_time);
-
   //g_debug("time width2 : %u",time_window->time_width);
   // Unreg done in the GuiControlFlow_Destructor
-  reg_update_time_window(update_time_window_hook, control_flow_data,
-        mw);
-  reg_update_current_time(update_current_time_hook, control_flow_data,
-        mw);
+  lttvwindow_register_time_window_notify(mw,
+                                         update_time_window_hook,
+                                         control_flow_data);
+  lttvwindow_register_current_time_notify(mw,
+                                          update_current_time_hook,
+                                          control_flow_data);
   return guicontrolflow_get_widget(control_flow_data) ;
   
 }
@@ -156,8 +142,8 @@ int draw_event_hook(void *hook_data, void *call_data)
   e = tfc->e;
 
   LttTime evtime = ltt_event_time(e);
-  TimeWindow *time_window = 
-    guicontrolflow_get_time_window(control_flow_data);
+  const TimeWindow *time_window = 
+    lttvwindow_get_time_window(control_flow_data->mw);
 
   LttTime end_time = ltt_time_add(time_window->start_time,
                                     time_window->time_width);
@@ -272,12 +258,12 @@ int draw_event_hook(void *hook_data, void *call_data)
 
     LttTime time = ltt_event_time(e);
 
-    LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
-                          control_flow_data->time_window.start_time);
+    LttTime window_end = ltt_time_add(time_window->time_width,
+                          time_window->start_time);
 
     
     convert_time_to_pixels(
-        control_flow_data->time_window.start_time,
+        time_window->start_time,
         window_end,
         time,
         width,
@@ -756,8 +742,8 @@ int draw_after_hook(void *hook_data, void *call_data)
   e = tfc->e;
 
   LttTime evtime = ltt_event_time(e);
-  TimeWindow *time_window = 
-    guicontrolflow_get_time_window(control_flow_data);
+  const TimeWindow *time_window = 
+    lttvwindow_get_time_window(control_flow_data->mw);
 
   LttTime end_time = ltt_time_add(time_window->start_time,
                                     time_window->time_width);
@@ -873,12 +859,12 @@ int draw_after_hook(void *hook_data, void *call_data)
 
     //LttTime time = ltt_event_time(e);
 
-    //LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
-    //                      control_flow_data->time_window.start_time);
+    //LttTime window_end = ltt_time_add(time_window->time_width,
+    //                      time_window->start_time);
 
     
     //convert_time_to_pixels(
-    //    control_flow_data->time_window.start_time,
+    //    time_window->start_time,
     //    window_end,
     //    time,
     //    width,
@@ -1200,9 +1186,13 @@ int draw_after_hook(void *hook_data, void *call_data)
 gint update_time_window_hook(void *hook_data, void *call_data)
 {
   ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
+  const TimeWindowNotifyData *time_window_nofify_data = 
+                          ((const TimeWindowNotifyData *)call_data);
+
   TimeWindow *old_time_window = 
-    guicontrolflow_get_time_window(control_flow_data);
-  TimeWindow *new_time_window = ((TimeWindow*)call_data);
+    time_window_nofify_data->old_time_window;
+  TimeWindow *new_time_window = 
+    time_window_nofify_data->new_time_window;
   
   /* Update the ruler */
   drawing_update_ruler(control_flow_data->drawing,
@@ -1318,7 +1308,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
             x, 0,
             -1, -1);
   
-        *old_time_window = *new_time_window;
+        //*old_time_window = *new_time_window;
 
         /* Clean the data request background */
         gdk_draw_rectangle (control_flow_data->drawing->pixmap,
@@ -1342,7 +1332,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
       } else {
         g_info("scrolling far");
         /* Cannot reuse any part of the screen : far jump */
-        *old_time_window = *new_time_window;
+        //*old_time_window = *new_time_window;
         
         
         gdk_draw_rectangle (control_flow_data->drawing->pixmap,
@@ -1368,7 +1358,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
     /* Different scale (zoom) */
     g_info("zoom");
 
-    *old_time_window = *new_time_window;
+    //*old_time_window = *new_time_window;
   
     gdk_draw_rectangle (control_flow_data->drawing->pixmap,
           control_flow_data->drawing->drawing_area->style->black_gc,
@@ -1399,25 +1389,24 @@ gint update_current_time_hook(void *hook_data, void *call_data)
 {
   ControlFlowData *control_flow_data = (ControlFlowData*)hook_data;
 
-  LttTime* current_time = 
-    guicontrolflow_get_current_time(control_flow_data);
-  *current_time = *((LttTime*)call_data);
+  LttTime current_time = *((LttTime*)call_data);
   
-  TimeWindow time_window;
+  const TimeWindow *time_window =
+            lttvwindow_get_time_window(control_flow_data->mw);
   
-  LttTime time_begin = control_flow_data->time_window.start_time;
-  LttTime width = control_flow_data->time_window.time_width;
+  LttTime time_begin = time_window->start_time;
+  LttTime width = time_window->time_width;
   LttTime half_width = ltt_time_div(width,2.0);
   LttTime time_end = ltt_time_add(time_begin, width);
 
   LttvTracesetContext * tsc =
-        get_traceset_context(control_flow_data->mw);
+        lttvwindow_get_traceset_context(control_flow_data->mw);
   
   LttTime trace_start = tsc->Time_Span->startTime;
   LttTime trace_end = tsc->Time_Span->endTime;
   
-  g_info("New current time HOOK : %u, %u", current_time->tv_sec,
-              current_time->tv_nsec);
+  g_info("New current time HOOK : %u, %u", current_time.tv_sec,
+              current_time.tv_nsec);
 
 
   
@@ -1431,30 +1420,34 @@ gint update_current_time_hook(void *hook_data, void *call_data)
    * at one end of the trace. */
   
   
-  if(ltt_time_compare(*current_time, time_begin) == -1)
+  if(ltt_time_compare(current_time, time_begin) == -1)
   {
-    if(ltt_time_compare(*current_time,
+    TimeWindow new_time_window;
+
+    if(ltt_time_compare(current_time,
           ltt_time_add(trace_start,half_width)) == -1)
       time_begin = trace_start;
     else
-      time_begin = ltt_time_sub(*current_time,half_width);
+      time_begin = ltt_time_sub(current_time,half_width);
   
-    time_window.start_time = time_begin;
-    time_window.time_width = width;
+    new_time_window.start_time = time_begin;
+    new_time_window.time_width = width;
 
-    set_time_window(control_flow_data->mw, &time_window);
+    lttvwindow_report_time_window(control_flow_data->mw, &new_time_window);
   }
-  else if(ltt_time_compare(*current_time, time_end) == 1)
+  else if(ltt_time_compare(current_time, time_end) == 1)
   {
-    if(ltt_time_compare(*current_time, ltt_time_sub(trace_end, half_width)) == 1)
+    TimeWindow new_time_window;
+
+    if(ltt_time_compare(current_time, ltt_time_sub(trace_end, half_width)) == 1)
       time_begin = ltt_time_sub(trace_end,width);
     else
-      time_begin = ltt_time_sub(*current_time,half_width);
+      time_begin = ltt_time_sub(current_time,half_width);
   
-    time_window.start_time = time_begin;
-    time_window.time_width = width;
+    new_time_window.start_time = time_begin;
+    new_time_window.time_width = width;
 
-    set_time_window(control_flow_data->mw, &time_window);
+    lttvwindow_report_time_window(control_flow_data->mw, &new_time_window);
     
   }
   gtk_widget_queue_draw(control_flow_data->drawing->drawing_area);
index 1b6c422530b230739476c8b9f4171d218c911075..6799b2262944dba7eedbc17676a0ea6c066ffe1e 100644 (file)
@@ -92,8 +92,8 @@ typedef enum _ScrollDirection{
 typedef struct _EventViewerData {
 
   MainWindow * mw;
-  TimeWindow   time_window;
-  LttTime      current_time;
+  //TimeWindow   time_window;
+//  LttTime      current_time;
   LttvHooks  * before_event_hooks;
 
   gboolean     append;                    //prepend or append item 
@@ -101,7 +101,7 @@ typedef struct _EventViewerData {
   GQueue     * raw_trace_data_queue_tmp;  //tmp buf to contain raw data
   unsigned     current_event_index;
   double       previous_value;            //value of the slide
-  TimeInterval time_span;
+//  TimeInterval time_span;
   unsigned     start_event_index;        //the first event shown in the window
   unsigned     end_event_index;          //the last event shown in the window
   unsigned     size;                     //maxi number of events loaded when instance the viewer
@@ -233,8 +233,6 @@ gui_events(MainWindow *parent_window, LttvTracesetSelector * s,char* key )
   RawTraceData * data;
 
   event_viewer_data->mw = parent_window;
-  get_time_window(event_viewer_data->mw, &event_viewer_data->time_window);
-  get_current_time(event_viewer_data->mw, &event_viewer_data->current_time);
   
   event_viewer_data->before_event_hooks = lttv_hooks_new();
   lttv_hooks_add(event_viewer_data->before_event_hooks, parse_event, event_viewer_data);
@@ -242,15 +240,20 @@ gui_events(MainWindow *parent_window, LttvTracesetSelector * s,char* key )
   event_viewer_data->raw_trace_data_queue     = g_queue_new();
   event_viewer_data->raw_trace_data_queue_tmp = g_queue_new();  
 
-  reg_update_time_window(update_time_window,event_viewer_data, event_viewer_data->mw);
-  reg_update_current_time(update_current_time,event_viewer_data, event_viewer_data->mw);
-  reg_show_viewer(show_event_detail,event_viewer_data, event_viewer_data->mw);
-  reg_update_traceset(traceset_changed,event_viewer_data, event_viewer_data->mw);
+  lttvwindow_register_time_window_notify(event_viewer_data->mw,
+                update_time_window, event_viewer_data);
+  lttvwindow_register_current_time_notify(event_viewer_data->mw, 
+                update_current_time,event_viewer_data);
+  lttvwindow_register_show(event_viewer_data->mw, 
+                show_event_detail,event_viewer_data);
+  lttvwindow_register_traceset_notify(event_viewer_data->mw, 
+                traceset_changed,event_viewer_data);
 
   event_viewer_data->scroll_win = gtk_scrolled_window_new (NULL, NULL);
-  gtk_widget_show ( event_viewer_data->scroll_win);
-  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(event_viewer_data->scroll_win), 
-         GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
+  gtk_widget_show (event_viewer_data->scroll_win);
+  gtk_scrolled_window_set_policy(
+      GTK_SCROLLED_WINDOW(event_viewer_data->scroll_win), 
+      GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
 
   /* TEST DATA, TO BE READ FROM THE TRACE */
   event_viewer_data->currently_selected_event = FALSE  ;
@@ -258,16 +261,17 @@ gui_events(MainWindow *parent_window, LttvTracesetSelector * s,char* key )
 
   /* Create a model for storing the data list */
   event_viewer_data->store_m = gtk_list_store_new (
-    N_COLUMNS,  /* Total number of columns */
-    G_TYPE_INT, /* CPUID                  */
-    G_TYPE_STRING,  /* Event                   */
-    G_TYPE_UINT64,  /* Time                    */
-    G_TYPE_INT, /* PID                     */
-    G_TYPE_INT, /* Entry length            */
-    G_TYPE_STRING); /* Event's description     */
+    N_COLUMNS,      /* Total number of columns     */
+    G_TYPE_INT,     /* CPUID                       */
+    G_TYPE_STRING,  /* Event                       */
+    G_TYPE_UINT64,  /* Time                        */
+    G_TYPE_INT,     /* PID                         */
+    G_TYPE_INT,     /* Entry length                */
+    G_TYPE_STRING); /* Event's description         */
   
   /* Create the viewer widget for the columned list */
-  event_viewer_data->tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (event_viewer_data->store_m));
+  event_viewer_data->tree_v =
+    gtk_tree_view_new_with_model (GTK_TREE_MODEL (event_viewer_data->store_m));
     
   g_signal_connect (G_OBJECT (event_viewer_data->tree_v), "size-allocate",
         G_CALLBACK (tree_v_size_allocate_cb),
@@ -405,10 +409,12 @@ gui_events(MainWindow *parent_window, LttvTracesetSelector * s,char* key )
   event_viewer_data->num_visible_events = 1;
 
   //get the life span of the traceset and set the upper of the scroll bar
-  get_traceset_time_span(event_viewer_data->mw, &event_viewer_data->time_span);
+  const TimeInterval *time_span =
+              lttvwindow_get_time_span(event_viewer_data->mw);
   
-  start = ltt_time_sub(event_viewer_data->time_span.endTime, event_viewer_data->time_span.startTime);
-  event_viewer_data->vadjust_c->upper = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
+  start = ltt_time_sub(time_span->endTime, time_span->startTime);
+  event_viewer_data->vadjust_c->upper =
+              ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
 
   event_viewer_data->append = TRUE;
 
@@ -429,7 +435,7 @@ gui_events(MainWindow *parent_window, LttvTracesetSelector * s,char* key )
   g_object_set_data(
         G_OBJECT(event_viewer_data->hbox_v),
         TRACESET_TIME_SPAN,
-        &event_viewer_data->time_span);
+        time_span);
 */
   event_viewer_data->filter_key = g_strdup(key);
   g_object_set_data(
@@ -477,7 +483,7 @@ void tree_v_get_cursor(EventViewerData *event_viewer_data)
     {
       event_viewer_data->selected_event = TRUE;
       event_viewer_data->currently_selected_event =
-  event_viewer_data->first_event + indices[0];
+              event_viewer_data->first_event + indices[0];
       
     } else {
       event_viewer_data->selected_event = FALSE;
@@ -490,75 +496,80 @@ void tree_v_get_cursor(EventViewerData *event_viewer_data)
 
 
 
-void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, gpointer data)
+void tree_v_move_cursor_cb (GtkWidget *widget,
+                            GtkMovementStep arg1,
+                            gint arg2,
+                            gpointer data)
 {
   GtkTreePath *path; // = gtk_tree_path_new();
   gint *indices;
   gdouble value;
   EventViewerData *event_viewer_data = (EventViewerData*)data;
   
-  gtk_tree_view_get_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), &path, NULL);
+  gtk_tree_view_get_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v),
+                            &path, NULL);
   if(path == NULL)
-    {
-      /* No prior cursor, put it at beginning of page and let the execution do */
-      path = gtk_tree_path_new_from_indices(0, -1);
-      gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
-    }
-  
+  {
+    /* No prior cursor, put it at beginning of page
+     * and let the execution do */
+    path = gtk_tree_path_new_from_indices(0, -1);
+    gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v),
+                                path, NULL, FALSE);
+  }
+
   indices = gtk_tree_path_get_indices(path);
   
   value = gtk_adjustment_get_value(event_viewer_data->vadjust_c);
   
   if(arg1 == GTK_MOVEMENT_DISPLAY_LINES)
-    {
-      /* Move one line */
-      if(arg2 == 1)
   {
-    /* move one line down */
-    if(indices[0] == event_viewer_data->num_visible_events - 1)
+    /* Move one line */
+    if(arg2 == 1)
+    {
+      /* move one line down */
+      if(indices[0] == event_viewer_data->num_visible_events - 1)
       {
         if(value + event_viewer_data->num_visible_events <= 
-     event_viewer_data->number_of_events -1)
-    {
-      event_viewer_data->currently_selected_event += 1;
-      //      gtk_adjustment_set_value(event_viewer_data->vadjust_c, value+1);
-      //gtk_tree_path_free(path);
-      //path = gtk_tree_path_new_from_indices(event_viewer_data->num_visible_events-1, -1);
-      //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
-      g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
-    }
+            event_viewer_data->number_of_events -1)
+        {
+          event_viewer_data->currently_selected_event += 1;
+          //      gtk_adjustment_set_value(event_viewer_data->vadjust_c, value+1);
+          //gtk_tree_path_free(path);
+          //path = gtk_tree_path_new_from_indices(event_viewer_data->num_visible_events-1, -1);
+          //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+          g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+        }
       }
-  } else {
-    /* Move one line up */
-    if(indices[0] == 0)
+    } else {
+      /* Move one line up */
+      if(indices[0] == 0)
       {
         if(value - 1 >= 0 )
-    {
-      event_viewer_data->currently_selected_event -= 1;
-      //      gtk_adjustment_set_value(event_viewer_data->vadjust_c, value-1);
-      //gtk_tree_path_free(path);
-      //path = gtk_tree_path_new_from_indices(0, -1);
-      //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
-      g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
-    }
-        
+        {
+          event_viewer_data->currently_selected_event -= 1;
+          //      gtk_adjustment_set_value(event_viewer_data->vadjust_c, value-1);
+          //gtk_tree_path_free(path);
+          //path = gtk_tree_path_new_from_indices(0, -1);
+          //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+          g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+        }
       }
-  }
-      
     }
+  }
   
   if(arg1 == GTK_MOVEMENT_PAGES)
-    {
-      /* Move one page */
-      if(arg2 == 1)
   {
-    if(event_viewer_data->num_visible_events == 1)
-      value += 1 ;
-    /* move one page down */
-    if(value + event_viewer_data->num_visible_events-1 <= 
-       event_viewer_data->number_of_events )
+    /* Move one page */
+    if(arg2 == 1)
+    {
+      if(event_viewer_data->num_visible_events == 1)
+        value += 1 ;
+      /* move one page down */
+      if(value + event_viewer_data->num_visible_events-1 <= 
+                      event_viewer_data->number_of_events )
       {
-        event_viewer_data->currently_selected_event += event_viewer_data->num_visible_events-1;
+        event_viewer_data->currently_selected_event += 
+                                  event_viewer_data->num_visible_events-1;
         //        gtk_adjustment_set_value(event_viewer_data->vadjust_c,
         //               value+(event_viewer_data->num_visible_events-1));
         //gtk_tree_path_free(path);
@@ -566,67 +577,65 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2,
         //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
         g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
       }
-  } else {
-    /* Move one page up */
-    if(event_viewer_data->num_visible_events == 1)
-      value -= 1 ;
+    } else {
+      /* Move one page up */
+      if(event_viewer_data->num_visible_events == 1)
+        value -= 1 ;
 
-    if(indices[0] < event_viewer_data->num_visible_events - 2 )
+      if(indices[0] < event_viewer_data->num_visible_events - 2 )
       {
         if(value - (event_viewer_data->num_visible_events-1) >= 0)
-    {
-      event_viewer_data->currently_selected_event -= event_viewer_data->num_visible_events-1;
+        {
+          event_viewer_data->currently_selected_event -=
+                          event_viewer_data->num_visible_events-1;
       
-      //      gtk_adjustment_set_value(event_viewer_data->vadjust_c,
-      //             value-(event_viewer_data->num_visible_events-1));
-      //gtk_tree_path_free(path);
-      //path = gtk_tree_path_new_from_indices(0, -1);
-      //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
-      g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+          //      gtk_adjustment_set_value(event_viewer_data->vadjust_c,
+          //             value-(event_viewer_data->num_visible_events-1));
+          //gtk_tree_path_free(path);
+          //path = gtk_tree_path_new_from_indices(0, -1);
+          //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+          g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
       
-    } else {
-      /* Go to first Event */
-      event_viewer_data->currently_selected_event == 0 ;
-      //      gtk_adjustment_set_value(event_viewer_data->vadjust_c,
-      //             0);
-      //gtk_tree_path_free(path);
-      //path = gtk_tree_path_new_from_indices(0, -1);
-      //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
-      g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+        } else {
+          /* Go to first Event */
+          event_viewer_data->currently_selected_event == 0 ;
+          //      gtk_adjustment_set_value(event_viewer_data->vadjust_c,
+          //             0);
+          //gtk_tree_path_free(path);
+          //path = gtk_tree_path_new_from_indices(0, -1);
+          //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+          g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
       
-    }
+        }
       }
-    
-  }
-      
     }
+  }
   
   if(arg1 == GTK_MOVEMENT_BUFFER_ENDS)
-    {
-      /* Move to the ends of the buffer */
-      if(arg2 == 1)
   {
-    /* move end of buffer */
-    event_viewer_data->currently_selected_event = event_viewer_data->number_of_events-1 ;
-    //    gtk_adjustment_set_value(event_viewer_data->vadjust_c, 
-    //           event_viewer_data->number_of_events -
-    //           event_viewer_data->num_visible_events);
-    //gtk_tree_path_free(path);
-    //path = gtk_tree_path_new_from_indices(event_viewer_data->num_visible_events-1, -1);
-    //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
-    g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
-  } else {
-    /* Move beginning of buffer */
-    event_viewer_data->currently_selected_event = 0 ;
-    //    gtk_adjustment_set_value(event_viewer_data->vadjust_c, 0);
+    /* Move to the ends of the buffer */
+    if(arg2 == 1)
+    {
+      /* move end of buffer */
+      event_viewer_data->currently_selected_event =
+                            event_viewer_data->number_of_events-1 ;
+      //    gtk_adjustment_set_value(event_viewer_data->vadjust_c, 
+      //           event_viewer_data->number_of_events -
+      //           event_viewer_data->num_visible_events);
       //gtk_tree_path_free(path);
-      //path = gtk_tree_path_new_from_indices(0, -1);
+      //path = gtk_tree_path_new_from_indices(event_viewer_data->num_visible_events-1, -1);
       //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
-    g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
-  }
-      
+      g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+    } else {
+      /* Move beginning of buffer */
+      event_viewer_data->currently_selected_event = 0 ;
+      //    gtk_adjustment_set_value(event_viewer_data->vadjust_c, 0);
+        //gtk_tree_path_free(path);
+        //path = gtk_tree_path_new_from_indices(0, -1);
+        //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+      g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
     }
-  
+  }
   
   gtk_tree_path_free(path);
 }
@@ -634,6 +643,8 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2,
 void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*) data;
+  const LttTime* current_time =
+                lttvwindow_get_current_time(event_viewer_data->mw);
   LttTime ltt_time;
   guint64 time;
   GtkTreeIter iter;
@@ -650,10 +661,10 @@ void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data)
     ltt_time.tv_sec = time / NANOSECONDS_PER_SECOND;
     ltt_time.tv_nsec = time % NANOSECONDS_PER_SECOND;
  
-    if(ltt_time.tv_sec != event_viewer_data->current_time.tv_sec ||
-       ltt_time.tv_nsec != event_viewer_data->current_time.tv_nsec){
+    if(ltt_time.tv_sec != current_time->tv_sec ||
+       ltt_time.tv_nsec != current_time->tv_nsec){
       event_viewer_data->current_time_updated = TRUE;
-      set_current_time(event_viewer_data->mw,&ltt_time);
+      lttvwindow_report_current_time(event_viewer_data->mw,&ltt_time);
     }
   }else{
     g_warning("Can not get iter\n");
@@ -714,7 +725,7 @@ void tree_v_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer
   
   exact_num_visible = ( alloc->height -
       TREE_VIEW_HEADER_HEIGHT (GTK_TREE_VIEW(event_viewer_data->tree_v)) )
-    / (double)cell_height ;
+        / (double)cell_height ;
   
   event_viewer_data->num_visible_events = ceil(exact_num_visible) ;
   
@@ -750,7 +761,7 @@ void tree_v_size_request_cb (GtkWidget *widget, GtkRequisition *requisition, gpo
 gboolean show_event_detail(void * hook_data, void * call_data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
-  LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
+  LttvTracesetContext * tsc = lttvwindow_get_traceset_context(event_viewer_data->mw);
 
   if(event_viewer_data->raw_trace_data_queue_tmp->length == 0 &&
      event_viewer_data->raw_trace_data_queue->length == 0){
@@ -824,7 +835,9 @@ void get_test_data(double time_value, guint list_height,
   GdkWindow * win;
   GdkCursor * new;
   GtkWidget* widget = gtk_widget_get_parent(event_viewer_data->hbox_v);
-  
+  const TimeInterval *time_span =
+              lttvwindow_get_time_span(event_viewer_data->mw);
+
   if(widget){
     new = gdk_cursor_new(GDK_X_CURSOR);
     win = gtk_widget_get_parent_window(widget);  
@@ -975,7 +988,7 @@ void get_test_data(double time_value, guint list_height,
   end.tv_sec = G_MAXULONG;
   end.tv_nsec = G_MAXULONG;
   time = ltt_time_from_double(time_value / NANOSECONDS_PER_SECOND);
-  start = ltt_time_add(event_viewer_data->time_span.startTime, time);
+  start = ltt_time_add(time_span->startTime, time);
   event_viewer_data->previous_value = time_value;
   get_events(event_viewer_data, start, end, RESERVE_SMALL_SIZE,&size);
   if(size < list_height && size > 0){
@@ -1024,7 +1037,7 @@ void get_test_data(double time_value, guint list_height,
       if(first){
   raw_data = (RawTraceData*)g_list_nth_data(first,event_number);
   if(!raw_data) raw_data = (RawTraceData*)g_list_nth_data(first,0);       
-  time = ltt_time_sub(raw_data->time, event_viewer_data->time_span.startTime);
+  time = ltt_time_sub(raw_data->time, time_span->startTime);
   event_viewer_data->vadjust_c->value = ltt_time_to_double(time) * NANOSECONDS_PER_SECOND;
   g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
   event_viewer_data->previous_value = event_viewer_data->vadjust_c->value;
@@ -1149,10 +1162,14 @@ gui_events_free(EventViewerData *event_viewer_data)
     g_queue_free(event_viewer_data->raw_trace_data_queue);
     g_queue_free(event_viewer_data->raw_trace_data_queue_tmp);
 
-    unreg_update_time_window(update_time_window,event_viewer_data, event_viewer_data->mw);
-    unreg_update_current_time(update_current_time,event_viewer_data, event_viewer_data->mw);
-    unreg_show_viewer(show_event_detail,event_viewer_data, event_viewer_data->mw);
-    unreg_update_traceset(traceset_changed,event_viewer_data, event_viewer_data->mw);
+    lttvwindow_unregister_time_window_notify(event_viewer_data->mw,
+                        update_time_window, event_viewer_data);
+    lttvwindow_unregister_current_time_notify(event_viewer_data->mw,
+                        update_current_time, event_viewer_data);
+    lttvwindow_unregister_show(event_viewer_data->mw,
+                        show_event_detail, event_viewer_data);
+    lttvwindow_unregister_traceset_notify(event_viewer_data->mw,
+                        traceset_changed, event_viewer_data);
 
     g_free(event_viewer_data->filter_key);
     g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list, event_viewer_data);
@@ -1357,10 +1374,11 @@ void remove_context_hooks(EventViewerData * event_viewer_data,
 gboolean update_time_window(void * hook_data, void * call_data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
-  LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
+  const TimeWindowNotifyData *time_window_notify_data;
+  LttvTracesetContext * tsc = lttvwindow_get_traceset_context(event_viewer_data->mw);
 
   if(event_viewer_data->shown == FALSE){
-    event_viewer_data->time_window = *(TimeWindow*)call_data;
+    //event_viewer_data->time_window = *(TimeWindow*)call_data;
     
     add_context_hooks(event_viewer_data, tsc);
   }
@@ -1371,9 +1389,9 @@ gboolean update_time_window(void * hook_data, void * call_data)
 gboolean update_current_time(void * hook_data, void * call_data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
-  event_viewer_data->current_time = *(LttTime*)call_data;
-  guint64 nsec = event_viewer_data->current_time.tv_sec * NANOSECONDS_PER_SECOND 
-                  + event_viewer_data->current_time.tv_nsec;
+  const LttTime * current_time = (LttTime*)call_data;
+  guint64 nsec = current_time->tv_sec * NANOSECONDS_PER_SECOND 
+                  + current_time->tv_nsec;
   GtkTreeIter iter;
   guint64 time;
   int count = -1;
@@ -1384,6 +1402,8 @@ gboolean update_current_time(void * hook_data, void * call_data)
   char str_path[64];
   int i, j;
   LttTime t;
+  const TimeInterval *time_span =
+              lttvwindow_get_time_span(event_viewer_data->mw);
 
   if(!event_viewer_data->raw_trace_data_queue->head) return FALSE;
 
@@ -1418,11 +1438,11 @@ gboolean update_current_time(void * hook_data, void * call_data)
     data1 = (RawTraceData*)g_list_nth_data(list,event_viewer_data->raw_trace_data_queue->length-1);
 
     //the event is in the buffer
-    if(ltt_time_compare(data->time, event_viewer_data->current_time)<=0 &&
-       ltt_time_compare(data1->time, event_viewer_data->current_time)>=0){
+    if(ltt_time_compare(data->time, *current_time)<=0 &&
+       ltt_time_compare(data1->time, *current_time)>=0){
       for(i=0;i<event_viewer_data->raw_trace_data_queue->length;i++){
   data = (RawTraceData*)g_list_nth_data(list,i);
-  if(ltt_time_compare(data->time, event_viewer_data->current_time) < 0){
+  if(ltt_time_compare(data->time, *current_time) < 0){
     count++;
     continue;
   }
@@ -1436,13 +1456,13 @@ gboolean update_current_time(void * hook_data, void * call_data)
   j = count;
   count = 0;
       }
-      t = ltt_time_sub(data->time, event_viewer_data->time_span.startTime);
+      t = ltt_time_sub(data->time, time_span->startTime);
       event_viewer_data->vadjust_c->value = ltt_time_to_double(t) * NANOSECONDS_PER_SECOND;
       g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
       event_viewer_data->previous_value = event_viewer_data->vadjust_c->value;
       insert_data_into_model(event_viewer_data,j, j+event_viewer_data->num_visible_events);      
     }else{//the event is not in the buffer
-      LttTime start = ltt_time_sub(event_viewer_data->current_time, event_viewer_data->time_span.startTime);
+      LttTime start = ltt_time_sub(*current_time, time_span->startTime);
       double position = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
       gtk_adjustment_set_value(event_viewer_data->vadjust_c, position);
     }
@@ -1460,15 +1480,15 @@ gboolean update_current_time(void * hook_data, void * call_data)
 gboolean traceset_changed(void * hook_data, void * call_data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
+  const TimeInterval *time_span =
+              lttvwindow_get_time_span(event_viewer_data->mw);
   LttTime start;
-  
   remove_all_items_from_queue(event_viewer_data->raw_trace_data_queue);
   gtk_list_store_clear(event_viewer_data->store_m);
   event_viewer_data->shown = FALSE;
   event_viewer_data->append = TRUE;
 
-  get_traceset_time_span(event_viewer_data->mw, &event_viewer_data->time_span);
-  start = ltt_time_sub(event_viewer_data->time_span.endTime, event_viewer_data->time_span.startTime);
+  start = ltt_time_sub(time_span->endTime, time_span->startTime);
   event_viewer_data->vadjust_c->upper = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
   //  event_viewer_data->vadjust_c->value = 0;
 
@@ -1479,7 +1499,7 @@ gboolean traceset_changed(void * hook_data, void * call_data)
 void tree_v_grab_focus(GtkWidget *widget, gpointer data){
   EventViewerData *event_viewer_data = (EventViewerData *)data;
   MainWindow * mw = event_viewer_data->mw;
-  set_focused_pane(mw, gtk_widget_get_parent(event_viewer_data->hbox_v));
+  lttvwindow_report_focus(mw, gtk_widget_get_parent(event_viewer_data->hbox_v));
 }
 
 void update_raw_data_array(EventViewerData* event_viewer_data, unsigned size)
@@ -1616,7 +1636,7 @@ void get_events(EventViewerData* event_viewer_data, LttTime start,
     LttTime end,unsigned max_num_events, unsigned * real_num_events)
 {
   int size;
-  LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
+  LttvTracesetContext * tsc = lttvwindow_get_traceset_context(event_viewer_data->mw);
 
   add_context_hooks(event_viewer_data,tsc);
 
@@ -1841,10 +1861,10 @@ void remove_all_items_from_queue(GQueue *q)
 static void init() {
 
   /* Register the toolbar insert button */
-  toolbar_item_reg(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events);
+  lttvwindow_register_toolbar(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events);
   
   /* Register the menu item insert entry */
-  menu_item_reg("/", "Insert Event Viewer", h_gui_events);
+  lttvwindow_register_menu("/", "Insert Event Viewer", h_gui_events);
   
 }
 
@@ -1870,10 +1890,10 @@ static void destroy() {
   }
 
   /* Unregister the toolbar insert button */
-  toolbar_item_unreg(h_gui_events);
+  lttvwindow_unregister_toolbar(h_gui_events);
   
   /* Unregister the menu item insert entry */
-  menu_item_unreg(h_gui_events);
+  lttvwindow_unregister_menu(h_gui_events);
 }
 
 
index 0a514509807449595d7d4d13ecb1d9da2b621ba2..fac0c00f7bd14458854ddce1424183414c4001f8 100644 (file)
@@ -191,7 +191,7 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor)
     redraw_viewer(mw_data,&time_window);
     set_current_time(mw_data,&(mw_data->current_tab->current_time));
     if(time_interval){
-      set_time_window(mw_data,&t);
+      lttvwindow_report_time_window(mw_data,&t);
     }
   }
 }
@@ -389,7 +389,7 @@ void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window)
   GdkCursor * new;
   GtkWidget* widget;
   LttvTracesetContext *tsc = 
-   LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
+   LTTV_TRACESET_CONTEXT(mw_data->current_tab->traceset_info->
                             traceset_context);
 
   //set the cursor to be X shape, indicating that the computer is busy in doing its job
@@ -402,7 +402,7 @@ void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window)
   gdk_window_unstick(win);
  
   //update time window of each viewer, let viewer insert hooks needed by process_traceset
-  set_time_window(mw_data, time_window);
+  lttvwindow_report_time_window(mw_data, time_window);
   
   max_nb_events = get_max_event_number(mw_data);
 
@@ -2049,7 +2049,7 @@ void remove_toolbar_item(gpointer main_win, gpointer user_data)
  * main windows
  */
 
-void main_window_remove_menu_item(lttv_constructor constructor)
+void main_window_remove_menu_item(lttvwindow_viewer_constructor constructor)
 {
   int i;
   LttvMenus * menu;
@@ -2074,7 +2074,7 @@ void main_window_remove_menu_item(lttv_constructor constructor)
   
 }
 
-void main_window_remove_toolbar_item(lttv_constructor constructor)
+void main_window_remove_toolbar_item(lttvwindow_viewer_constructor constructor)
 {
   int i;
   LttvToolbars * toolbar;
index 198a57f9e2455b3769974865e2444f71371a3a3d..962807c831a85e21a00b14fd0f3cfd7513da9913 100644 (file)
@@ -431,7 +431,7 @@ void gtk_multi_vpaned_scroll_value_changed(GtkRange *range, gpointer multi_vpane
   if(ltt_time_compare(time,time_window.time_width) < 0){
     time_window.time_width = time;
   }
-  set_time_window(multi_vpaned->mw, &time_window); 
+  lttvwindow_report_time_window(multi_vpaned->mw, &time_window); 
 }
 
 
index 101f0e734a10193bc63bb10d6e38fd7afd9b76e4..78a96fa8be356e47e19ccc9d7cdc7f44751e5667 100644 (file)
  * Function to set/update traceset for the viewers
  * @param main_win main window 
  * @param traceset traceset of the main window.
+ * return value :
+ * -1 : error
+ *  0 : traceset updated
+ *  1 : no traceset hooks to update; not an error.
  */
 
-void SetTraceset(MainWindow * main_win, gpointer traceset)
+int SetTraceset(MainWindow * main_win, gpointer traceset)
 {
   LttvHooks * tmp;
   LttvAttributeValue value;
 
-  g_assert(lttv_iattribute_find_by_path(main_win->attributes,
-     "hooks/updatetraceset", LTTV_POINTER, &value));
+  if( lttv_iattribute_find_by_path(main_win->attributes,
+     "hooks/updatetraceset", LTTV_POINTER, &value) != 0)
+    return -1;
+
   tmp = (LttvHooks*)*(value.v_pointer);
-  if(tmp == NULL)return;
+  if(tmp == NULL) return 1;
+
   lttv_hooks_call(tmp,traceset);
+
+  return 0;
 }
 
 
@@ -67,23 +76,67 @@ void SetTraceset(MainWindow * main_win, gpointer traceset)
  * Function to set/update filter for the viewers
  * @param main_win main window 
  * @param filter filter of the main window.
+ * return value :
+ * -1 : error
+ *  0 : filters updated
+ *  1 : no filter hooks to update; not an error.
  */
 
-void SetFilter(MainWindow * main_win, gpointer filter)
+int SetFilter(MainWindow * main_win, gpointer filter)
 {
   LttvHooks * tmp;
   LttvAttributeValue value;
 
-  g_assert(lttv_iattribute_find_by_path(main_win->attributes,
-     "hooks/updatefilter", LTTV_POINTER, &value));
+  if(lttv_iattribute_find_by_path(main_win->attributes,
+     "hooks/updatefilter", LTTV_POINTER, &value) != 0)
+    return -1;
+
   tmp = (LttvHooks*)*(value.v_pointer);
 
-  if(tmp == NULL)return;
+  if(tmp == NULL) return 1;
   lttv_hooks_call(tmp,filter);
+
+  return 0;
+}
+
+/**
+ * Function to redraw each viewer belonging to the current tab 
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void update_traceset(MainWindow * main_win)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+           "hooks/updatetraceset", LTTV_POINTER, &value));
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL) return;
+  lttv_hooks_call(tmp, NULL);
+}
+
+
+
+/**
+ * Function to show each viewer in the current tab.
+ * It will be called by main window after it called process_traceset 
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void show_viewer(MainWindow *main_win)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+           "hooks/showviewer", LTTV_POINTER, &value));
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL) return;
+  lttv_hooks_call(tmp, NULL);
 }
 
 
 
+
 /**
  * API parts
  */
@@ -97,7 +150,7 @@ void SetFilter(MainWindow * main_win, gpointer filter)
  * @param view_constructor constructor of the viewer. 
  */
 
-void lttvwindow_viewer_register_toolbar_item(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor)
+void lttvwindow_register_toolbar(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor)
 {
   LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
   LttvToolbars * toolbar;
@@ -107,7 +160,7 @@ void lttvwindow_viewer_register_toolbar_item(char ** pixmap, char *tooltip, lttv
      "viewers/toolbar", LTTV_POINTER, &value));
   toolbar = (LttvToolbars*)*(value.v_pointer);
 
-  if(toolbar == NULL){    
+  if(toolbar == NULL){
     toolbar = lttv_toolbars_new();
     *(value.v_pointer) = toolbar;
   }
@@ -123,7 +176,7 @@ void lttvwindow_viewer_register_toolbar_item(char ** pixmap, char *tooltip, lttv
  * a reference to find out where the pixmap and tooltip are.
  */
 
-void lttvwindow_viewer_unregister_toolbar_item(lttvwindow_viewer_constructor view_constructor)
+void lttvwindow_unregister_toolbar(lttvwindow_viewer_constructor view_constructor)
 {
   LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
   LttvToolbars * toolbar;
@@ -148,7 +201,7 @@ void lttvwindow_viewer_unregister_toolbar_item(lttvwindow_viewer_constructor vie
  * @param view_constructor constructor of the viewer. 
  */
 
-void menu_item_reg(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor)
+void lttvwindow_register_menu(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor)
 {
   LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
   LttvMenus * menu;
@@ -173,7 +226,7 @@ void menu_item_reg(char *menu_path, char *menu_text, lttvwindow_viewer_construct
  * a reference to find out where the menu_path and menu_text are.
  */
 
-void menu_item_unreg(lttvwindow_viewer_constructor view_constructor)
+void lttvwindow_unregister_menu(lttvwindow_viewer_constructor view_constructor)
 {
   LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
   LttvMenus * menu;
@@ -188,150 +241,15 @@ void menu_item_unreg(lttvwindow_viewer_constructor view_constructor)
   lttv_menus_remove(menu, view_constructor);
 }
 
-
-/**
- * Update the status bar whenever something changed in the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param info the message which will be shown in the status bar.
- */
-
-void update_status(MainWindow *main_win, char *info)
-{
-}
-
-
-/**
- * Function to get the current time interval shown on the current tab.
- * It will be called by a viewer's hook function to update the 
- * shown time interval of the viewer and also be called by the constructor
- * of the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param time_interval a pointer where time interval will be stored.
- */
-
-void get_time_window(MainWindow *main_win, TimeWindow *time_window)
-{
-  //time_window->start_time = main_win->current_tab->time_window.start_time;
-  //time_window->time_width = main_win->current_tab->time_window.time_width;
-  *time_window = main_win->current_tab->time_window;
-}
-
-/**
- * Function to get the current time interval of the current traceset.
- * It will be called by a viewer's hook function to update the 
- * time interval of the viewer and also be called by the constructor
- * of the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param time_interval a pointer where time interval will be stored.
- */
-
-void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_interval)
-{
-  //time_window->start_time = main_win->current_tab->time_window.start_time;
-  //time_window->time_width = main_win->current_tab->time_window.time_width;
-  *time_interval = *(LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
-             traceset_context)->Time_Span);
-}
-
-
-
-/**
- * Function to set the time interval of the current tab.
- * It will be called by a viewer's signal handle associated with 
- * the move_slider signal
- * @param main_win the main window the viewer belongs to.
- * @param time_interval a pointer where time interval is stored.
- */
-
-void set_time_window(MainWindow *main_win, TimeWindow *time_window)
-{
-  LttvAttributeValue value;
-  LttvHooks * tmp;
-  main_win->current_tab->time_window = *time_window;
-  gtk_multi_vpaned_set_scroll_value(main_win->current_tab->multi_vpaned,
-            ltt_time_to_double(time_window->start_time)
-            * NANOSECONDS_PER_SECOND );
-  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
-           "hooks/updatetimewindow", LTTV_POINTER, &value));
-  tmp = (LttvHooks*)*(value.v_pointer);
-  if(tmp == NULL) return;
-  lttv_hooks_call(tmp, time_window);
-}
-
-
-/**
- * Function to get the current time/event of the current tab.
- * It will be called by a viewer's hook function to update the 
- * current time/event of the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param time a pointer where time will be stored.
- */
-
-void get_current_time(MainWindow *main_win, LttTime *time)
-{
-  time = &main_win->current_tab->current_time;
-}
-
-
-/**
- * Function to set the current time/event of the current tab.
- * It will be called by a viewer's signal handle associated with 
- * the button-release-event signal
- * @param main_win the main window the viewer belongs to.
- * @param time a pointer where time is stored.
- */
-
-void set_current_time(MainWindow *main_win, LttTime *time)
-{
-  LttvAttributeValue value;
-  LttvHooks * tmp;
-  main_win->current_tab->current_time = *time;
-  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
-           "hooks/updatecurrenttime", LTTV_POINTER, &value));
-  tmp = (LttvHooks*)*(value.v_pointer);
-
-  if(tmp == NULL)return;
-  lttv_hooks_call(tmp, time);
-}
-
-
-/**
- * Function to get the traceset from the current tab.
- * It will be called by the constructor of the viewer and also be
- * called by a hook funtion of the viewer to update its traceset.
- * @param main_win the main window the viewer belongs to.
- * @param traceset a pointer to a traceset.
- */
-/*
-void get_traceset(MainWindow *main_win, Traceset *traceset)
-{
-}
-*/
-
-/**
- * Function to get the filter of the current tab.
- * It will be called by the constructor of the viewer and also be
- * called by a hook funtion of the viewer to update its filter.
- * @param main_win, the main window the viewer belongs to.
- * @param filter, a pointer to a filter.
- */
-/*
-void get_filter(MainWindow *main_win, Filter *filter)
-{
-}
-*/
-
 /**
  * Function to register a hook function for a viewer to set/update its
  * time interval.
- * It will be called by the constructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
-
-void reg_update_time_window(LttvHook hook, gpointer hook_data,
-         MainWindow * main_win)
+void lttvwindow_register_time_window_notify(MainWindow * main_win,
+    LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -349,14 +267,13 @@ void reg_update_time_window(LttvHook hook, gpointer hook_data,
 /**
  * Function to unregister a viewer's hook function which is used to 
  * set/update the time interval of the viewer.
- * It will be called by the destructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void unreg_update_time_window(LttvHook hook, gpointer hook_data,
-           MainWindow * main_win)
+void lttvwindow_unregister_time_window_notify(MainWindow * main_win,
+    LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -367,18 +284,16 @@ void unreg_update_time_window(LttvHook hook, gpointer hook_data,
   lttv_hooks_remove_data(tmp, hook, hook_data);
 }
 
-
 /**
  * Function to register a hook function for a viewer to set/update its 
  * traceset.
- * It will be called by the constructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void reg_update_traceset(LttvHook hook, gpointer hook_data,
-           MainWindow * main_win)
+void lttvwindow_register_traceset_notify(MainWindow * main_win,
+    LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -396,14 +311,13 @@ void reg_update_traceset(LttvHook hook, gpointer hook_data,
 /**
  * Function to unregister a viewer's hook function which is used to 
  * set/update the traceset of the viewer.
- * It will be called by the destructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void unreg_update_traceset(LttvHook hook, gpointer hook_data,
-       MainWindow * main_win)
+void lttvwindow_unregister_traceset_notify(MainWindow * main_win,
+              LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -414,35 +328,16 @@ void unreg_update_traceset(LttvHook hook, gpointer hook_data,
   lttv_hooks_remove_data(tmp, hook, hook_data);
 }
 
-
-/**
- * Function to redraw each viewer belonging to the current tab 
- * @param main_win the main window the viewer belongs to.
- */
-
-void update_traceset(MainWindow * main_win)
-{
-  LttvAttributeValue value;
-  LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
-           "hooks/updatetraceset", LTTV_POINTER, &value));
-  tmp = (LttvHooks*)*(value.v_pointer);
-  if(tmp == NULL) return;
-  lttv_hooks_call(tmp, NULL);
-}
-
-
 /**
  * Function to register a hook function for a viewer to set/update its 
  * filter.
- * It will be called by the constructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void reg_update_filter(LttvHook hook, gpointer hook_data,
-         MainWindow *main_win)
+void lttvwindow_register_filter_notify(MainWindow *main_win,
+      LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -460,14 +355,13 @@ void reg_update_filter(LttvHook hook, gpointer hook_data,
 /**
  * Function to unregister a viewer's hook function which is used to 
  * set/update the filter of the viewer.
- * It will be called by the destructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void unreg_update_filter(LttvHook hook, gpointer hook_data,
-           MainWindow * main_win)
+void lttvwindow_unregister_filter_notify(LttvHook hook,  gpointer hook_data,
+                      MainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -482,14 +376,13 @@ void unreg_update_filter(LttvHook hook, gpointer hook_data,
 /**
  * Function to register a hook function for a viewer to set/update its 
  * current time.
- * It will be called by the constructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void reg_update_current_time(LttvHook hook, gpointer hook_data, 
-        MainWindow *main_win)
+void lttvwindow_register_current_time_notify(MainWindow *main_win,
+            LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -507,14 +400,13 @@ void reg_update_current_time(LttvHook hook, gpointer hook_data,
 /**
  * Function to unregister a viewer's hook function which is used to 
  * set/update the current time of the viewer.
- * It will be called by the destructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void unreg_update_current_time(LttvHook hook, gpointer hook_data,
-          MainWindow * main_win)
+void lttvwindow_unregister_current_time_notify(MainWindow * main_win,
+            LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -528,15 +420,14 @@ void unreg_update_current_time(LttvHook hook, gpointer hook_data,
 
 /**
  * Function to register a hook function for a viewer to show 
- *the content of the viewer.
- * It will be called by the constructor of the viewer.
+ * the content of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void reg_show_viewer(LttvHook hook, gpointer hook_data, 
-         MainWindow *main_win)
+void lttvwindow_register_show(MainWindow *main_win,
+          LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -554,14 +445,13 @@ void reg_show_viewer(LttvHook hook, gpointer hook_data,
 /**
  * Function to unregister a viewer's hook function which is used to 
  * show the content of the viewer..
- * It will be called by the destructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void unreg_show_viewer(LttvHook hook, gpointer hook_data,
-           MainWindow * main_win)
+void lttvwindow_unregister_show(MainWindow * main_win,
+              LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -572,50 +462,16 @@ void unreg_show_viewer(LttvHook hook, gpointer hook_data,
   lttv_hooks_remove_data(tmp, hook, hook_data);
 }
 
-
-/**
- * Function to show each viewer in the current tab.
- * It will be called by main window after it called process_traceset 
- * @param main_win the main window the viewer belongs to.
- */
-
-void show_viewer(MainWindow *main_win)
-{
-  LttvAttributeValue value;
-  LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
-           "hooks/showviewer", LTTV_POINTER, &value));
-  tmp = (LttvHooks*)*(value.v_pointer);
-  if(tmp == NULL) return;
-  lttv_hooks_call(tmp, NULL);
-}
-
-
-/**
- * Function to set the focused pane (viewer).
- * It will be called by a viewer's signal handle associated with 
- * the grab_focus signal
- * @param main_win the main window the viewer belongs to.
- * @param paned a pointer to a pane where the viewer is contained.
- */
-
-void set_focused_pane(MainWindow *main_win, gpointer paned)
-{
-  gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);  
-}
-
-
 /**
  * Function to register a hook function for a viewer to set/update the 
  * dividor of the hpane.
- * It will be called by the constructor of the viewer.
  * @param hook hook function of the viewer.
  * @param hook_data hook data associated with the hook function.
  * @param main_win the main window the viewer belongs to.
  */
 
-void reg_update_dividor(LttvHook hook, gpointer hook_data, 
-          MainWindow *main_win)
+void lttvwindow_register_dividor(MainWindow *main_win,
+                    LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -639,8 +495,8 @@ void reg_update_dividor(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void unreg_update_dividor(LttvHook hook, gpointer hook_data, 
-      MainWindow *main_win)
+void lttvwindow_unregister_dividor(MainWindow *main_win,
+                    LttvHook hook, gpointer hook_data)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -652,6 +508,70 @@ void unreg_update_dividor(LttvHook hook, gpointer hook_data,
 }
 
 
+/**
+ * Update the status bar whenever something changed in the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param info the message which will be shown in the status bar.
+ */
+
+void lttvwindow_report_status(MainWindow *main_win, char *info)
+{ 
+  //FIXME
+  g_warning("update_status not implemented in viewer.c");
+}
+
+/**
+ * Function to set the time interval of the current tab.
+ * It will be called by a viewer's signal handle associated with 
+ * the move_slider signal
+ * @param main_win the main window the viewer belongs to.
+ * @param time_interval a pointer where time interval is stored.
+ */
+
+void lttvwindow_report_time_window(MainWindow *main_win,
+                                   TimeWindow *time_window)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+
+  TimeWindowNotifyData time_window_notify_data;
+  TimeWindow old_time_window = main_win->current_tab->time_window;
+  time_window_notify_data.old_time_window = &old_time_window;
+  main_win->current_tab->time_window = *time_window;
+  time_window_notify_data.new_time_window = 
+                          &(main_win->current_tab->time_window);
+
+  gtk_multi_vpaned_set_scroll_value(main_win->current_tab->multi_vpaned,
+            ltt_time_to_double(time_window->start_time)
+            * NANOSECONDS_PER_SECOND );
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+           "hooks/updatetimewindow", LTTV_POINTER, &value));
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL) return;
+  lttv_hooks_call(tmp, &time_window_notify_data);
+}
+
+/**
+ * Function to set the current time/event of the current tab.
+ * It will be called by a viewer's signal handle associated with 
+ * the button-release-event signal
+ * @param main_win the main window the viewer belongs to.
+ * @param time a pointer where time is stored.
+ */
+
+void lttvwindow_report_current_time(MainWindow *main_win, LttTime *time)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  main_win->current_tab->current_time = *time;
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+           "hooks/updatecurrenttime", LTTV_POINTER, &value));
+  tmp = (LttvHooks*)*(value.v_pointer);
+
+  if(tmp == NULL)return;
+  lttv_hooks_call(tmp, time);
+}
+
 /**
  * Function to set the position of the hpane's dividor (viewer).
  * It will be called by a viewer's signal handle associated with 
@@ -660,7 +580,7 @@ void unreg_update_dividor(LttvHook hook, gpointer hook_data,
  * @param position position of the hpane's dividor.
  */
 
-void set_hpane_dividor(MainWindow *main_win, gint position)
+void lttvwindow_report_dividor(MainWindow *main_win, gint position)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
@@ -671,18 +591,110 @@ void set_hpane_dividor(MainWindow *main_win, gint position)
   lttv_hooks_call(tmp, &position);
 }
 
+/**
+ * Function to set the focused pane (viewer).
+ * It will be called by a viewer's signal handle associated with 
+ * the grab_focus signal
+ * @param main_win the main window the viewer belongs to.
+ * @param paned a pointer to a pane where the viewer is contained.
+ */
+
+void lttvwindow_report_focus(MainWindow *main_win, gpointer paned)
+{
+  gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);  
+}
+
+
+
+/**
+ * Function to get the current time interval of the current traceset.
+ * It will be called by a viewer's hook function to update the 
+ * time interval of the viewer and also be called by the constructor
+ * of the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param time_interval a pointer where time interval will be stored.
+ */
+
+const TimeInterval *lttvwindow_get_time_span(MainWindow *main_win)
+{
+  //time_window->start_time = main_win->current_tab->time_window.start_time;
+  //time_window->time_width = main_win->current_tab->time_window.time_width;
+  return (LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
+             traceset_context)->Time_Span);
+}
+
+
+
+/**
+ * Function to get the current time interval shown on the current tab.
+ * It will be called by a viewer's hook function to update the 
+ * shown time interval of the viewer and also be called by the constructor
+ * of the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param time_interval a pointer where time interval will be stored.
+ */
+
+const TimeWindow *lttvwindow_get_time_window(MainWindow *main_win)
+{
+  //time_window->start_time = main_win->current_tab->time_window.start_time;
+  //time_window->time_width = main_win->current_tab->time_window.time_width;
+  return &(main_win->current_tab->time_window);
+  
+}
+
+
+/**
+ * Function to get the current time/event of the current tab.
+ * It will be called by a viewer's hook function to update the 
+ * current time/event of the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param time a pointer where time will be stored.
+ */
+
+const LttTime *lttvwindow_get_current_time(MainWindow *main_win)
+{
+  return &(main_win->current_tab->current_time);
+}
+
+
+/**
+ * Function to get the traceset from the current tab.
+ * It will be called by the constructor of the viewer and also be
+ * called by a hook funtion of the viewer to update its traceset.
+ * @param main_win the main window the viewer belongs to.
+ * @param traceset a pointer to a traceset.
+ */
+const LttvTraceset *lttvwindow_get_traceset(MainWindow *main_win)
+{
+  return main_win->current_tab->traceset_info->traceset;
+}
+
+/**
+ * Function to get the filter of the current tab.
+ * It will be called by the constructor of the viewer and also be
+ * called by a hook funtion of the viewer to update its filter.
+ * @param main_win, the main window the viewer belongs to.
+ * @param filter, a pointer to a filter.
+ */
+const lttv_filter *lttvwindow_get_filter(MainWindow *main_win)
+{
+  //FIXME
+  g_warning("lttvwindow_get_filter not implemented in viewer.c");
+}
+
+
 /**
  * Function to get the stats of the traceset 
  * @param main_win the main window the viewer belongs to.
  */
 
-LttvTracesetStats* get_traceset_stats(MainWindow *main_win)
+LttvTracesetStats* lttvwindow_get_traceset_stats(MainWindow *main_win)
 {
   return main_win->current_tab->traceset_info->traceset_context;
 }
 
 
-LttvTracesetContext* get_traceset_context(MainWindow *main_win)
+LttvTracesetContext* lttvwindow_get_traceset_context(MainWindow *main_win)
 {
   return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
 }
index bff8af474c19f01fe7eb43d8f0f4b1c9b3742b97..4495c6b84390923172254fa1563dab00c63387e6 100644 (file)
@@ -77,11 +77,11 @@ update_dividor
 Things that a viewer can do:
 
 update_status
-set_time_window
+lttvwindow_report_time_window
 set_current_time
-update_traceset?
-update_filter?
-show_viewer?
+update_traceset -> not actually
+update_filter -> not actually
+show_viewer -> makes no sense.
 set_focused_pane
 set_hpane_dividor
 */
@@ -106,7 +106,7 @@ set_hpane_dividor
 #include <lttv/hook.h>
 #include <lttvwindow/common.h>
 #include <lttv/stats.h>
-#include <lttv/filter.h>
+//FIXME (not ready yet) #include <lttv/filter.h>
 
 /**
  * Function to register a view constructor so that main window can generate
@@ -117,7 +117,7 @@ set_hpane_dividor
  * @param view_constructor constructor of the viewer. 
  */
 
-void lttvwindow_viewer_register_toolbar(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor);
+void lttvwindow_register_toolbar(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor);
 
 
 /**
@@ -128,7 +128,7 @@ void lttvwindow_viewer_register_toolbar(char ** pixmap, char *tooltip, lttvwindo
  * a reference to find out where the pixmap and tooltip are.
  */
 
-void lttvwindow_viewer_unregister_toolbar(lttvwindow_viewer_constructor view_constructor);
+void lttvwindow_unregister_toolbar(lttvwindow_viewer_constructor view_constructor);
 
 
 /**
@@ -140,7 +140,7 @@ void lttvwindow_viewer_unregister_toolbar(lttvwindow_viewer_constructor view_con
  * @param view_constructor constructor of the viewer. 
  */
 
-void lttvwindow_viewer_register_menu(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor);
+void lttvwindow_register_menu(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor);
 
 
 /**
@@ -151,7 +151,7 @@ void lttvwindow_viewer_register_menu(char *menu_path, char *menu_text, lttvwindo
  * a reference to find out where the menu_path and menu_text are.
  */
 
-void lttvwindow_viewer_unregister_menu(lttvwindow_viewer_constructor view_constructor);
+void lttvwindow_unregister_menu(lttvwindow_viewer_constructor view_constructor);
 
 
 /**
@@ -163,7 +163,12 @@ void lttvwindow_viewer_unregister_menu(lttvwindow_viewer_constructor view_constr
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_register_time_window_notify(MainWindow * main_win,
+typedef struct _TimeWindowNotifyData {
+  TimeWindow *new_time_window;
+  TimeWindow *old_time_window;
+} TimeWindowNotifyData;
+
+void lttvwindow_register_time_window_notify(MainWindow * main_win,
     LttvHook hook, gpointer hook_data);
 
 
@@ -176,7 +181,7 @@ void lttvwindow_viewer_register_time_window_notify(MainWindow * main_win,
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_unregister_time_window_notify(MainWindow * main_win,
+void lttvwindow_unregister_time_window_notify(MainWindow * main_win,
     LttvHook hook, gpointer hook_data);
 
 
@@ -189,7 +194,7 @@ void lttvwindow_viewer_unregister_time_window_notify(MainWindow * main_win,
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_register_traceset_notify(MainWindow * main_win,
+void lttvwindow_register_traceset_notify(MainWindow * main_win,
     LttvHook hook, gpointer hook_data);
 
 
@@ -201,7 +206,7 @@ void lttvwindow_viewer_register_traceset_notify(MainWindow * main_win,
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_unregister_traceset_notify(MainWindow * main_win,
+void lttvwindow_unregister_traceset_notify(MainWindow * main_win,
               LttvHook hook, gpointer hook_data);
 
 
@@ -214,7 +219,7 @@ void lttvwindow_viewer_unregister_traceset_notify(MainWindow * main_win,
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_register_filter_notify(MainWindow *main_win,
+void lttvwindow_register_filter_notify(MainWindow *main_win,
       LttvHook hook, gpointer hook_data);
 
 
@@ -227,7 +232,7 @@ void lttvwindow_viewer_register_filter_notify(MainWindow *main_win,
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_unregister_filter_notify(LttvHook hook,  gpointer hook_data,
+void lttvwindow_unregister_filter_notify(LttvHook hook,  gpointer hook_data,
                       MainWindow * main_win);
 
 
@@ -239,7 +244,7 @@ void lttvwindow_viewer_unregister_filter_notify(LttvHook hook,  gpointer hook_da
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_register_current_time_notify(MainWindow *main_win,
+void lttvwindow_register_current_time_notify(MainWindow *main_win,
             LttvHook hook, gpointer hook_data);
 
 
@@ -251,7 +256,7 @@ void lttvwindow_viewer_register_current_time_notify(MainWindow *main_win,
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_unregister_current_time_notify(MainWindow * main_win,
+void lttvwindow_unregister_current_time_notify(MainWindow * main_win,
             LttvHook hook, gpointer hook_data);
 
 
@@ -263,7 +268,7 @@ void lttvwindow_viewer_unregister_current_time_notify(MainWindow * main_win,
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_register_show(MainWindow *main_win,
+void lttvwindow_register_show(MainWindow *main_win,
           LttvHook hook, gpointer hook_data);
 
 
@@ -275,13 +280,33 @@ void lttvwindow_viewer_register_show(MainWindow *main_win,
  * @param main_win the main window the viewer belongs to.
  */
 
-void lttvwindow_viewer_unregister_show(MainWindow * main_win,
+void lttvwindow_unregister_show(MainWindow * main_win,
               LttvHook hook, gpointer hook_data);
 
 
+/**
+ * Function to register a hook function for a viewer to set/update the 
+ * dividor of the hpane. It provides a way to make the horizontal
+ * dividors of all the viewers linked together.
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ * @param main_win the main window the viewer belongs to.
+ */
 
+void lttvwindow_register_dividor(MainWindow *main_win,
+                    LttvHook hook, gpointer hook_data);
 
 
+/**
+ * Function to unregister a viewer's hook function which is used to 
+ * set/update hpane's dividor of the viewer.
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void lttvwindow_unregister_dividor(MainWindow *main_win,
+                    LttvHook hook, gpointer hook_data);
 
 
 
@@ -291,7 +316,7 @@ void lttvwindow_viewer_unregister_show(MainWindow * main_win,
  * @param info the message which will be shown in the status bar.
  */
 
-void lttvwindow_viewer_report_status(MainWindow *main_win, char *info);
+void lttvwindow_report_status(MainWindow *main_win, char *info);
 
 
 /**
@@ -302,7 +327,7 @@ void lttvwindow_viewer_report_status(MainWindow *main_win, char *info);
  * @param time_interval a pointer where time interval is stored.
  */
 
-void lttvwindow_viewer_report_time_window(MainWindow *main_win, TimeWindow *time_window);
+void lttvwindow_report_time_window(MainWindow *main_win, TimeWindow *time_window);
 
 /**
  * Function to set the current time/event of the current tab.
@@ -312,7 +337,7 @@ void lttvwindow_viewer_report_time_window(MainWindow *main_win, TimeWindow *time
  * @param time a pointer where time is stored.
  */
 
-void lttvwindow_viewer_report_current_time(MainWindow *main_win, LttTime *time);
+void lttvwindow_report_current_time(MainWindow *main_win, LttTime *time);
 
 
 /**
@@ -323,25 +348,7 @@ void lttvwindow_viewer_report_current_time(MainWindow *main_win, LttTime *time);
  * @param position position of the hpane's dividor.
  */
 
-void lttvwindow_viewer_report_dividor(MainWindow *main_win, gint position);
-
-/**
- * Function to redraw each viewer belonging to the current tab, when a traceset
- * change has been made by the viewer.
- * @param main_win the main window the viewer belongs to.
- */
-// FIXME : should never be directly changed by a viewer.
-//void lttvwindow_viewer_report_traceset(MainWindow * main_win);
-
-
-/**
- * Function to show each viewer in the current tab.
- * It will be called by main window after it called process_traceset 
- * @param main_win the main window the viewer belongs to.
- */
-//FIXME : not an API function, belongs to the main window.
-//void lttvwindow_viewer_report_show(MainWindow *main_win);
-
+void lttvwindow_report_dividor(MainWindow *main_win, gint position);
 
 /**
  * Function to set the focused pane (viewer).
@@ -351,33 +358,7 @@ void lttvwindow_viewer_report_dividor(MainWindow *main_win, gint position);
  * @param paned a pointer to a pane where the viewer is contained.
  */
 //FIXME : can we do this through normal GTK signals ?
-//void set_focused_pane(MainWindow *main_win, gpointer paned);
-
-
-/**
- * Function to register a hook function for a viewer to set/update the 
- * dividor of the hpane. It provides a way to make the horizontal
- * dividors of all the viewers linked together.
- * @param hook hook function of the viewer.
- * @param hook_data hook data associated with the hook function.
- * @param main_win the main window the viewer belongs to.
- */
-
-void lttvwindow_viewer_register_dividor(MainWindow *main_win,
-                    LttvHook hook, gpointer hook_data);
-
-
-/**
- * Function to unregister a viewer's hook function which is used to 
- * set/update hpane's dividor of the viewer.
- * @param hook hook function of the viewer.
- * @param hook_data hook data associated with the hook function.
- * @param main_win the main window the viewer belongs to.
- */
-
-void lttvwindow_viewer_unregister_dividor(MainWindow *main_win,
-                    LttvHook hook, gpointer hook_data);
-
+void lttvwindow_report_focus(MainWindow *main_win, gpointer paned);
 
 /**
  * Function to get the life span of the traceset
@@ -386,7 +367,7 @@ void lttvwindow_viewer_unregister_dividor(MainWindow *main_win,
  * @param end end time of the traceset.
  */
 
-const TimeInterval *lttvwindow_viewer_get_time_span(MainWindow *main_win);
+const TimeInterval *lttvwindow_get_time_span(MainWindow *main_win);
 
 /**
  * Function to get the current time window of the current tab.
@@ -394,7 +375,7 @@ const TimeInterval *lttvwindow_viewer_get_time_span(MainWindow *main_win);
  * @param time_interval a pointer where time interval will be stored.
  */
 
-const TimeWindow *lttvwindow_viewer_get_time_window(MainWindow *main_win);
+const TimeWindow *lttvwindow_get_time_window(MainWindow *main_win);
 
 
 /**
@@ -403,7 +384,7 @@ const TimeWindow *lttvwindow_viewer_get_time_window(MainWindow *main_win);
  * @param time a pointer where time will be stored.
  */
 
-const LttTime *lttvwindow_viewer_get_current_time(MainWindow *main_win);
+const LttTime *lttvwindow_get_current_time(MainWindow *main_win);
 
 /**
  * Function to get the traceset from the current tab.
@@ -411,7 +392,7 @@ const LttTime *lttvwindow_viewer_get_current_time(MainWindow *main_win);
  * @param traceset a pointer to a traceset.
  */
 
-const LttvTraceset *lttvwindow_viewer_get_traceset(MainWindow *main_win);
+const LttvTraceset *lttvwindow_get_traceset(MainWindow *main_win);
 
 
 /**
@@ -420,16 +401,27 @@ const LttvTraceset *lttvwindow_viewer_get_traceset(MainWindow *main_win);
  * @param filter, a pointer to a filter.
  */
 
-const lttv_filter *lttvwindow_viewer_get_filter(MainWindow *main_win);
+//FIXME
+typedef void lttv_filter;
+//FIXME
+const lttv_filter *lttvwindow_get_filter(MainWindow *main_win);
 
 
 /**
  * Function to get the stats of the traceset 
+ * It must be non const so the viewer can modify it. //FIXME really ?
+ * @param main_win the main window the viewer belongs to.
+ */
+
+LttvTracesetStats* lttvwindow_get_traceset_stats(MainWindow *main_win);
+
+/**
+ * Function to get the context of the traceset 
+ * It must be non const so the viewer can add and remove hooks from it.
  * @param main_win the main window the viewer belongs to.
  */
 
-LttvTracesetStats* lttvwindow_viewer_get_traceset_stats(MainWindow *main_win);
 
-LttvTracesetContext* lttvwindow_viewer_get_traceset_context(MainWindow *main_win);
+LttvTracesetContext* lttvwindow_get_traceset_context(MainWindow *main_win);
 
 
index 9f3889fa63e814b4608c01773705ad2b901dda72..341ea771d4654fac4092bd31b0ac7f62c3a25433 100644 (file)
@@ -92,7 +92,7 @@ struct _StatisticViewerData{
   gboolean            calculate_stats;
   int                 size;
 
-  TimeInterval time_span;
+  //TimeInterval time_span;
   gboolean     shown;       //indicate if the statistic is shown or not
   char *       filter_key;
 
@@ -119,9 +119,12 @@ void
 gui_statistic_free(StatisticViewerData *statistic_viewer_data)
 { 
   if(statistic_viewer_data){
-    unreg_update_time_window(statistic_update_time_window,statistic_viewer_data, statistic_viewer_data->mw);
-    unreg_show_viewer(statistic_show_viewer,statistic_viewer_data, statistic_viewer_data->mw);
-    unreg_update_traceset(statistic_traceset_changed,statistic_viewer_data, statistic_viewer_data->mw);
+    lttvwindow_unregister_time_window_notify(statistic_viewer_data->mw,
+                            statistic_update_time_window,statistic_viewer_data);
+    lttvwindow_unregister_show(statistic_viewer_data->mw,
+                            statistic_show_viewer,statistic_viewer_data);
+    lttvwindow_unregister_traceset_notify(statistic_viewer_data->mw,
+                            statistic_traceset_changed,statistic_viewer_data);
 
     g_hash_table_destroy(statistic_viewer_data->statistic_hash);
     g_free(statistic_viewer_data->filter_key);
@@ -194,20 +197,27 @@ gui_statistic(MainWindow *parent_window, LttvTracesetSelector * s, char* key)
   StatisticViewerData* statistic_viewer_data = g_new(StatisticViewerData,1);
 
   statistic_viewer_data->mw     = parent_window;
-  statistic_viewer_data->stats  = get_traceset_stats(statistic_viewer_data->mw);
+  statistic_viewer_data->stats  =
+          lttvwindow_get_traceset_stats(statistic_viewer_data->mw);
   statistic_viewer_data->calculate_stats = statistic_insert_traceset_stats((void *)statistic_viewer_data->stats);
 
-  reg_update_time_window(statistic_update_time_window,statistic_viewer_data, statistic_viewer_data->mw);
-  reg_show_viewer(statistic_show_viewer,statistic_viewer_data, statistic_viewer_data->mw);
-  reg_update_traceset(statistic_traceset_changed,statistic_viewer_data, statistic_viewer_data->mw);
+  lttvwindow_register_time_window_notify(statistic_viewer_data->mw,
+                          statistic_update_time_window,statistic_viewer_data);
+  lttvwindow_register_show(statistic_viewer_data->mw,
+                          statistic_show_viewer,statistic_viewer_data);
+  lttvwindow_register_traceset_notify(statistic_viewer_data->mw,
+                          statistic_traceset_changed,statistic_viewer_data);
 
-  statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
-                statistic_destroy_hash_key,
-                statistic_destroy_hash_data);
+  statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash,
+                                                  g_str_equal,
+                                                  statistic_destroy_hash_key,
+                                                  statistic_destroy_hash_data);
 
   statistic_viewer_data->hpaned_v  = gtk_hpaned_new();
   statistic_viewer_data->store_m = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING);
-  statistic_viewer_data->tree_v  = gtk_tree_view_new_with_model (GTK_TREE_MODEL (statistic_viewer_data->store_m));
+  statistic_viewer_data->tree_v  = 
+    gtk_tree_view_new_with_model (
+        GTK_TREE_MODEL (statistic_viewer_data->store_m));
   g_object_unref (G_OBJECT (statistic_viewer_data->store_m));
 
   g_signal_connect (G_OBJECT (statistic_viewer_data->tree_v), "grab-focus",
@@ -261,21 +271,19 @@ gui_statistic(MainWindow *parent_window, LttvTracesetSelector * s, char* key)
   gtk_widget_show(statistic_viewer_data->text_v);
   gtk_widget_show(statistic_viewer_data->hpaned_v);
 
-  //get the life span of the traceset and set the upper of the scroll bar
-  get_traceset_time_span(statistic_viewer_data->mw, &statistic_viewer_data->time_span);
-
   statistic_viewer_data->shown = FALSE;  
   statistic_viewer_data->filter_key = g_strdup(key);
   g_object_set_data(
         G_OBJECT(statistic_viewer_data->hpaned_v),
         statistic_viewer_data->filter_key,
         s);
-
+  /*
   g_object_set_data(
         G_OBJECT(statistic_viewer_data->hpaned_v),
         TRACESET_TIME_SPAN,
         &statistic_viewer_data->time_span);
-  
+  */
+
   if(statistic_viewer_data->calculate_stats){
     //if(lttv_stats_load_statistics(statistic_viewer_data->stats))
     //  statistic_viewer_data->calculate_stats = FALSE;
@@ -307,7 +315,7 @@ void grab_focus(GtkWidget *widget, gpointer data)
 {
   StatisticViewerData *statistic_viewer_data = (StatisticViewerData *)data;
   MainWindow * mw = statistic_viewer_data->mw;
-  set_focused_pane(mw, gtk_widget_get_parent(statistic_viewer_data->hpaned_v));
+  lttvwindow_report_focus(mw, gtk_widget_get_parent(statistic_viewer_data->hpaned_v));
 }
 
 static void
@@ -505,7 +513,8 @@ void show_statistic(StatisticViewerData * statistic_viewer_data,
 gboolean statistic_update_time_window(void * hook_data, void * call_data)
 {
   StatisticViewerData *statistic_viewer_data = (StatisticViewerData*) hook_data;
-  LttvTracesetContext * tsc = get_traceset_context(statistic_viewer_data->mw);
+  LttvTracesetContext * tsc =
+    lttvwindow_get_traceset_context(statistic_viewer_data->mw);
 
   //if statistic is already calculated, do nothing
   if(!statistic_viewer_data->calculate_stats){
@@ -521,7 +530,8 @@ gboolean statistic_update_time_window(void * hook_data, void * call_data)
 gboolean statistic_show_viewer(void * hook_data, void * call_data)
 {
   StatisticViewerData *statistic_viewer_data = (StatisticViewerData*) hook_data;
-  LttvTracesetContext * tsc = get_traceset_context(statistic_viewer_data->mw);
+  LttvTracesetContext * tsc = 
+        lttvwindow_get_traceset_context(statistic_viewer_data->mw);
 
   if(statistic_viewer_data->shown == FALSE){
     statistic_viewer_data->shown = TRUE;
@@ -586,7 +596,7 @@ void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data,
     }
   }  
 
-  lttv_stats_add_event_hooks(tsc);
+  lttv_stats_add_event_hooks(LTTV_TRACESET_STATS(tsc));
   
 }
 
@@ -631,7 +641,7 @@ void statistic_remove_context_hooks(StatisticViewerData * statistic_viewer_data,
     }
   }
 
-  lttv_stats_remove_event_hooks(tsc);
+  lttv_stats_remove_event_hooks(LTTV_TRACESET_STATS(tsc));
 }
 
 
@@ -646,10 +656,10 @@ static void init() {
   statistic_traceset = g_ptr_array_new ();
 
   /* Register the toolbar insert button */
-  toolbar_item_reg(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", h_gui_statistic);
+  lttvwindow_register_toolbar(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", h_gui_statistic);
   
   /* Register the menu item insert entry */
-  menu_item_reg("/", "Insert Statistic Viewer", h_gui_statistic);
+  lttvwindow_register_menu("/", "Insert Statistic Viewer", h_gui_statistic);
   
 }
 
@@ -674,10 +684,10 @@ static void destroy() {
   g_ptr_array_free (statistic_traceset, TRUE);
 
   /* Unregister the toolbar insert button */
-  toolbar_item_unreg(h_gui_statistic);
+  lttvwindow_unregister_toolbar(h_gui_statistic);
   
   /* Unregister the menu item insert entry */
-  menu_item_unreg(h_gui_statistic);
+  lttvwindow_unregister_menu(h_gui_statistic);
 }
 
 
This page took 0.059476 seconds and 4 git commands to generate.