filter working: for selecting trace/tracefile
[lttv.git] / ltt / branches / poly / lttv / modules / gui / API / gtkTraceSet.c
index 336e1f8b21cdf49bdcf446cd7ca7335548e3565f..ec71b69d678705a6d213c0eaab290e25d5ed5fac 100644 (file)
  * Internal function parts
  */
 
-/**
- * Function to remove toolbar from the GUI
- * @param view_constructor constructor of the viewer.
- */
-
-void RemoveToolbar(lttv_constructor view_constructor)
-{
-  g_printf("Toolbar for the viewer will be removed\n");
-}
-
-/**
- * Function to remove menu entry from the GUI
- * @param view_constructor constructor of the viewer.
- */
-
-void RemoveMenu(lttv_constructor view_constructor)
-{
-  g_printf("Menu entry for the viewer will be removed\n");
-}
-
-
 /**
  * Function to set/update traceset for the viewers
  * @param main_win main window 
  * @param traceset traceset of the main window.
  */
 
-void SetTraceset(mainWindow * main_win, gpointer traceset)
+void SetTraceset(MainWindow * main_win, gpointer traceset)
 {
   LttvHooks * tmp;
   LttvAttributeValue value;
 
-  g_assert(lttv_iattribute_find_by_path(main_win->Attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->attributes,
           "hooks/updatetraceset", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL)return;
@@ -72,12 +51,12 @@ void SetTraceset(mainWindow * main_win, gpointer traceset)
  * @param filter filter of the main window.
  */
 
-void SetFilter(mainWindow * main_win, gpointer filter)
+void SetFilter(MainWindow * main_win, gpointer filter)
 {
   LttvHooks * tmp;
   LttvAttributeValue value;
 
-  g_assert(lttv_iattribute_find_by_path(main_win->Attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->attributes,
           "hooks/updatefilter", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
 
@@ -100,7 +79,7 @@ void SetFilter(mainWindow * main_win, gpointer filter)
  * @param view_constructor constructor of the viewer. 
  */
 
-void ToolbarItemReg(char ** pixmap, char *tooltip, lttv_constructor view_constructor)
+void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor)
 {
   LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
   LttvToolbars * toolbar;
@@ -126,7 +105,7 @@ void ToolbarItemReg(char ** pixmap, char *tooltip, lttv_constructor view_constru
  * a reference to find out where the pixmap and tooltip are.
  */
 
-void ToolbarItemUnreg(lttv_constructor view_constructor)
+void toolbar_item_unreg(lttv_constructor view_constructor)
 {
   LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
   LttvToolbars * toolbar;
@@ -136,8 +115,9 @@ void ToolbarItemUnreg(lttv_constructor view_constructor)
           "viewers/toolbar", LTTV_POINTER, &value));
   toolbar = (LttvToolbars*)*(value.v_pointer);
   
-  if(lttv_toolbars_remove(toolbar, view_constructor))
-    RemoveToolbar(view_constructor);
+  main_window_remove_toolbar_item(view_constructor);
+
+  lttv_toolbars_remove(toolbar, view_constructor);
 }
 
 
@@ -150,7 +130,7 @@ void ToolbarItemUnreg(lttv_constructor view_constructor)
  * @param view_constructor constructor of the viewer. 
  */
 
-void MenuItemReg(char *menu_path, char *menu_text, lttv_constructor view_constructor)
+void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor)
 {
   LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
   LttvMenus * menu;
@@ -175,7 +155,7 @@ void MenuItemReg(char *menu_path, char *menu_text, lttv_constructor view_constru
  * a reference to find out where the menu_path and menu_text are.
  */
 
-void MenuItemUnreg(lttv_constructor view_constructor)
+void menu_item_unreg(lttv_constructor view_constructor)
 {
   LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
   LttvMenus * menu;
@@ -185,8 +165,9 @@ void MenuItemUnreg(lttv_constructor view_constructor)
                               "viewers/menu", LTTV_POINTER, &value));
   menu = (LttvMenus*)*(value.v_pointer);
 
-  if(lttv_menus_remove(menu, view_constructor))  
-    RemoveMenu(view_constructor);
+  main_window_remove_menu_item(view_constructor);
+
+  lttv_menus_remove(menu, view_constructor);
 }
 
 
@@ -196,13 +177,29 @@ void MenuItemUnreg(lttv_constructor view_constructor)
  * @param info the message which will be shown in the status bar.
  */
 
-void UpdateStatus(mainWindow *main_win, char *info)
+void update_status(MainWindow *main_win, char *info)
 {
 }
 
 
 /**
- * Function to get the current time interval of the current tab.
+ * 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.
@@ -210,13 +207,16 @@ void UpdateStatus(mainWindow *main_win, char *info)
  * @param time_interval a pointer where time interval will be stored.
  */
 
-void GetTimeInterval(mainWindow *main_win, TimeInterval *time_interval)
+void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_interval)
 {
-  time_interval->startTime = main_win->CurrentTab->startTime;
-  time_interval->endTime = main_win->CurrentTab->endTime;
+  //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 
@@ -225,17 +225,16 @@ void GetTimeInterval(mainWindow *main_win, TimeInterval *time_interval)
  * @param time_interval a pointer where time interval is stored.
  */
 
-void SetTimeInterval(mainWindow *main_win, TimeInterval *time_interval)
+void set_time_window(MainWindow *main_win, TimeWindow *time_window)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  main_win->CurrentTab->startTime = time_interval->startTime;
-  main_win->CurrentTab->endTime = time_interval->endTime;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
-                      "hooks/updatetimeinterval", LTTV_POINTER, &value));
+  main_win->current_tab->time_window = *time_window;
+  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_interval);
+  if(tmp == NULL) return;
+  lttv_hooks_call(tmp, time_window);
 }
 
 
@@ -247,9 +246,9 @@ void SetTimeInterval(mainWindow *main_win, TimeInterval *time_interval)
  * @param time a pointer where time will be stored.
  */
 
-void GetCurrentTime(mainWindow *main_win, LttTime *time)
+void get_current_time(MainWindow *main_win, LttTime *time)
 {
-  time = &main_win->CurrentTab->currentTime;
+  time = &main_win->current_tab->current_time;
 }
 
 
@@ -261,12 +260,12 @@ void GetCurrentTime(mainWindow *main_win, LttTime *time)
  * @param time a pointer where time is stored.
  */
 
-void SetCurrentTime(mainWindow *main_win, LttTime *time)
+void set_current_time(MainWindow *main_win, LttTime *time)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  main_win->CurrentTab->currentTime = *time;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
+  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);
 
@@ -283,7 +282,7 @@ void SetCurrentTime(mainWindow *main_win, LttTime *time)
  * @param traceset a pointer to a traceset.
  */
 /*
-void GetTraceset(mainWindow *main_win, Traceset *traceset)
+void get_traceset(MainWindow *main_win, Traceset *traceset)
 {
 }
 */
@@ -296,7 +295,7 @@ void GetTraceset(mainWindow *main_win, Traceset *traceset)
  * @param filter, a pointer to a filter.
  */
 /*
-void GetFilter(mainWindow *main_win, Filter *filter)
+void get_filter(MainWindow *main_win, Filter *filter)
 {
 }
 */
@@ -310,13 +309,13 @@ void GetFilter(mainWindow *main_win, Filter *filter)
  * @param main_win the main window the viewer belongs to.
  */
 
-void RegUpdateTimeInterval(LttvHook hook, gpointer hook_data,
-                          mainWindow * main_win)
+void reg_update_time_window(LttvHook hook, gpointer hook_data,
+                          MainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
-                      "hooks/updatetimeinterval", LTTV_POINTER, &value));
+  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){    
     tmp = lttv_hooks_new();
@@ -335,13 +334,13 @@ void RegUpdateTimeInterval(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void UnregUpdateTimeInterval(LttvHook hook, gpointer hook_data,
-                            mainWindow * main_win)
+void unreg_update_time_window(LttvHook hook, gpointer hook_data,
+                            MainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
-                      "hooks/updatetimeinterval", LTTV_POINTER, &value));
+  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_remove_data(tmp, hook, hook_data);
@@ -357,12 +356,12 @@ void UnregUpdateTimeInterval(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void RegUpdateTraceset(LttvHook hook, gpointer hook_data,
-                      mainWindow * main_win)
+void reg_update_traceset(LttvHook hook, gpointer hook_data,
+                      MainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->Attributes,
+  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){    
@@ -382,12 +381,12 @@ void RegUpdateTraceset(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void UnregUpdateTraceset(LttvHook hook, gpointer hook_data,
-                        mainWindow * main_win)
+void unreg_update_traceset(LttvHook hook, gpointer hook_data,
+                        MainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->Attributes,
+  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;
@@ -395,6 +394,23 @@ void UnregUpdateTraceset(LttvHook hook, gpointer 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.
@@ -404,12 +420,12 @@ void UnregUpdateTraceset(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void RegUpdateFilter(LttvHook hook, gpointer hook_data,
-                    mainWindow *main_win)
+void reg_update_filter(LttvHook hook, gpointer hook_data,
+                    MainWindow *main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->Attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->attributes,
                       "hooks/updatefilter", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL){    
@@ -429,12 +445,12 @@ void RegUpdateFilter(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void UnregUpdateFilter(LttvHook hook, gpointer hook_data,
-                      mainWindow * main_win)
+void unreg_update_filter(LttvHook hook, gpointer hook_data,
+                      MainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->Attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->attributes,
                       "hooks/updatefilter", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL) return;
@@ -451,12 +467,12 @@ void UnregUpdateFilter(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void RegUpdateCurrentTime(LttvHook hook, gpointer hook_data, 
-                         mainWindow *main_win)
+void reg_update_current_time(LttvHook hook, gpointer hook_data, 
+                         MainWindow *main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
+  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){    
@@ -476,12 +492,12 @@ void RegUpdateCurrentTime(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void UnregUpdateCurrentTime(LttvHook hook, gpointer hook_data,
-                           mainWindow * main_win)
+void unreg_update_current_time(LttvHook hook, gpointer hook_data,
+                           MainWindow * main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
+  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;
@@ -489,6 +505,71 @@ void UnregUpdateCurrentTime(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.
+ * @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)
+{
+  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){    
+    tmp = lttv_hooks_new();
+    *(value.v_pointer) = tmp;
+  }
+  lttv_hooks_add(tmp, hook, 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)
+{
+  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_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 
@@ -497,9 +578,9 @@ void UnregUpdateCurrentTime(LttvHook hook, gpointer hook_data,
  * @param paned a pointer to a pane where the viewer is contained.
  */
 
-void SetFocusedPane(mainWindow *main_win, gpointer paned)
+void set_focused_pane(MainWindow *main_win, gpointer paned)
 {
-  gtk_custom_set_focus((GtkWidget*)main_win->CurrentTab->custom,paned);  
+  gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);  
 }
 
 
@@ -512,12 +593,12 @@ void SetFocusedPane(mainWindow *main_win, gpointer paned)
  * @param main_win the main window the viewer belongs to.
  */
 
-void RegUpdateDividor(LttvHook hook, gpointer hook_data, 
-                     mainWindow *main_win)
+void reg_update_dividor(LttvHook hook, gpointer hook_data, 
+                     MainWindow *main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
                       "hooks/hpanedividor", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL){    
@@ -537,12 +618,12 @@ void RegUpdateDividor(LttvHook hook, gpointer hook_data,
  * @param main_win the main window the viewer belongs to.
  */
 
-void UnregUpdateDividor(LttvHook hook, gpointer hook_data, 
-                       mainWindow *main_win)
+void unreg_update_dividor(LttvHook hook, gpointer hook_data, 
+                       MainWindow *main_win)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
                       "hooks/hpanedividor", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL) return;
@@ -558,11 +639,11 @@ void UnregUpdateDividor(LttvHook hook, gpointer hook_data,
  * @param position position of the hpane's dividor.
  */
 
-void SetHPaneDividor(mainWindow *main_win, gint position)
+void set_hpane_dividor(MainWindow *main_win, gint position)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->CurrentTab->Attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
                       "hooks/hpanedividor", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL) return;
@@ -578,11 +659,13 @@ void SetHPaneDividor(mainWindow *main_win, gint position)
  * @param end the end time of the last event to be processed.
  */
 
-void processTraceset(mainWindow *main_win, LttTime start, 
-                    LttTime end, unsigned maxNumEvents)
+void process_traceset_api(MainWindow *main_win, LttTime start, 
+                         LttTime end, unsigned maxNumEvents)
 {
-  lttv_process_trace(start, end, main_win->traceset, 
-                    main_win->traceset_context,  maxNumEvents);
+  lttv_process_traceset_seek_time(main_win->current_tab->traceset_info->
+                                 traceset_context, start);
+  lttv_process_traceset(main_win->current_tab->traceset_info->
+                       traceset_context, end, maxNumEvents);
 }
 
 /**
@@ -593,20 +676,22 @@ void processTraceset(mainWindow *main_win, LttTime start,
  * @param LttvHooks hooks to be registered.
  */
 
-void contextAddHooks(mainWindow *main_win ,
-                    LttvHooks *before_traceset, 
-                    LttvHooks *after_traceset,
-                    LttvHooks *check_trace, 
-                    LttvHooks *before_trace, 
-                    LttvHooks *after_trace, 
-                    LttvHooks *check_tracefile,
-                    LttvHooks *before_tracefile,
-                    LttvHooks *after_tracefile,
-                    LttvHooks *check_event, 
-                    LttvHooks *before_event, 
-                    LttvHooks *after_event)
-{
-  LttvTracesetContext * tsc = main_win->traceset_context;
+void context_add_hooks_api(MainWindow *main_win ,
+                          LttvHooks *before_traceset, 
+                          LttvHooks *after_traceset,
+                          LttvHooks *check_trace, 
+                          LttvHooks *before_trace, 
+                          LttvHooks *after_trace, 
+                          LttvHooks *check_tracefile,
+                          LttvHooks *before_tracefile,
+                          LttvHooks *after_tracefile,
+                          LttvHooks *check_event, 
+                          LttvHooks *before_event, 
+                          LttvHooks *after_event)
+{
+  LttvTracesetContext * tsc = 
+         LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
+                               traceset_context);
   lttv_traceset_context_add_hooks(tsc,before_traceset,after_traceset,
                                  check_trace,before_trace,after_trace,
                                  check_tracefile,before_tracefile,after_tracefile,
@@ -622,20 +707,21 @@ void contextAddHooks(mainWindow *main_win ,
  * @param LttvHooks hooks to be registered.
  */
 
-void contextRemoveHooks(mainWindow *main_win ,
-                       LttvHooks *before_traceset, 
-                       LttvHooks *after_traceset,
-                       LttvHooks *check_trace, 
-                       LttvHooks *before_trace, 
-                       LttvHooks *after_trace, 
-                       LttvHooks *check_tracefile,
-                       LttvHooks *before_tracefile,
-                       LttvHooks *after_tracefile,
-                       LttvHooks *check_event, 
-                       LttvHooks *before_event, 
-                       LttvHooks *after_event)
-{
-  LttvTracesetContext * tsc = main_win->traceset_context;
+void context_remove_hooks_api(MainWindow *main_win ,
+                             LttvHooks *before_traceset, 
+                             LttvHooks *after_traceset,
+                             LttvHooks *check_trace, 
+                             LttvHooks *before_trace, 
+                             LttvHooks *after_trace, 
+                             LttvHooks *check_tracefile,
+                             LttvHooks *before_tracefile,
+                             LttvHooks *after_tracefile,
+                             LttvHooks *check_event, 
+                             LttvHooks *before_event, 
+                             LttvHooks *after_event)
+{
+  LttvTracesetContext * tsc =
+        LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->traceset_context);
   lttv_traceset_context_remove_hooks(tsc,before_traceset,after_traceset,
                                     check_trace,before_trace,after_trace,
                                     check_tracefile,before_tracefile,after_tracefile,
@@ -643,56 +729,21 @@ void contextRemoveHooks(mainWindow *main_win ,
 }
 
 
-/**
- * Function to get the life span of the traceset
- * @param main_win the main window the viewer belongs to.
- * @param start start time of the traceset.
- * @param end end time of the traceset.
- */
-
-void getTracesetTimeSpan(mainWindow *main_win, LttTime * start, LttTime* end)
-{
-  LttvTraceset * traceset = main_win->traceset;
-  int numTraces = lttv_traceset_number(traceset);
-  int i;
-  LttTime s, e;
-  LttvTraceContext *tc;
-  LttTrace * trace;
-
-  for(i=0; i<numTraces;i++){
-    tc = main_win->traceset_context->traces[i];
-    trace = tc->t;
-
-    ltt_trace_time_span_get(trace, &s, &e);
-
-    if(i==0){
-      *start = s;
-      *end   = e;
-    }else{
-      if(s.tv_sec < start->tv_sec ||
-        (s.tv_sec == start->tv_sec && s.tv_nsec < start->tv_nsec))
-       *start = s;
-      if(e.tv_sec > end->tv_sec ||
-        (e.tv_sec == end->tv_sec && e.tv_nsec > end->tv_nsec))
-       *end = e;      
-    }
-  }
-}
-
-
 /**
  * Function to add/remove event hooks for state 
  * @param main_win the main window the viewer belongs to.
  */
 
-void stateAddEventHooks(mainWindow *main_win )
+void state_add_event_hooks_api(MainWindow *main_win )
 {
-  lttv_state_add_event_hooks((LttvTracesetState*)main_win->traceset_context);
+  lttv_state_add_event_hooks(
+       (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context);
 }
 
-void stateRemoveEventHooks(mainWindow *main_win )
+void state_remove_event_hooks_api(MainWindow *main_win )
 {
-  lttv_state_remove_event_hooks((LttvTracesetState*)main_win->traceset_context);
+  lttv_state_remove_event_hooks(
+       (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context);
 }
 
 
@@ -701,14 +752,16 @@ void stateRemoveEventHooks(mainWindow *main_win )
  * @param main_win the main window the viewer belongs to.
  */
 
-void statsAddEventHooks(mainWindow *main_win )
+void stats_add_event_hooks_api(MainWindow *main_win )
 {
-  lttv_stats_add_event_hooks((LttvTracesetStats*)main_win->traceset_context);
+  lttv_stats_add_event_hooks(
+        (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context);
 }
 
-void statsRemoveEventHooks(mainWindow *main_win )
+void stats_remove_event_hooks_api(MainWindow *main_win )
 {
-  lttv_stats_remove_event_hooks((LttvTracesetStats*)main_win->traceset_context);
+  lttv_stats_remove_event_hooks(
+        (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context);
 }
 
 /**
@@ -716,7 +769,13 @@ void statsRemoveEventHooks(mainWindow *main_win )
  * @param main_win the main window the viewer belongs to.
  */
 
-LttvTracesetStats* getTracesetStats(mainWindow *main_win)
+LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win)
+{
+  return main_win->current_tab->traceset_info->traceset_context;
+}
+
+
+LttvTracesetContext* get_traceset_context(MainWindow *main_win)
 {
-  return (LttvTracesetStats*)main_win->traceset_context;
+  return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
 }
This page took 0.038378 seconds and 4 git commands to generate.