filter working: for selecting trace/tracefile
[lttv.git] / ltt / branches / poly / lttv / modules / gui / API / gtkTraceSet.c
index 4eb1d3e623e92a4f6d589161dce0d26d9fd70315..ec71b69d678705a6d213c0eaab290e25d5ed5fac 100644 (file)
@@ -211,7 +211,8 @@ 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->traceset_info->traceset_context)->Time_Span);
+  *time_interval = *(LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
+                                          traceset_context)->Time_Span);
 }
 
 
@@ -360,7 +361,7 @@ void reg_update_traceset(LttvHook hook, gpointer hook_data,
 {
   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){    
@@ -385,7 +386,7 @@ void unreg_update_traceset(LttvHook hook, gpointer hook_data,
 {
   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;
@@ -393,6 +394,23 @@ void unreg_update_traceset(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.
@@ -487,6 +505,71 @@ 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.
+ * @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,7 +580,7 @@ void unreg_update_current_time(LttvHook hook, gpointer hook_data,
 
 void set_focused_pane(MainWindow *main_win, gpointer paned)
 {
-  gtk_custom_set_focus((GtkWidget*)main_win->current_tab->custom,paned);  
+  gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);  
 }
 
 
@@ -579,8 +662,10 @@ void set_hpane_dividor(MainWindow *main_win, gint position)
 void process_traceset_api(MainWindow *main_win, LttTime start, 
                          LttTime end, unsigned maxNumEvents)
 {
-  lttv_process_traceset_seek_time(main_win->traceset_info->traceset_context, start);
-  lttv_process_traceset(main_win->traceset_info->traceset_context, end, 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);
 }
 
 /**
@@ -605,7 +690,8 @@ void context_add_hooks_api(MainWindow *main_win ,
                           LttvHooks *after_event)
 {
   LttvTracesetContext * tsc = 
-         LTTV_TRACESET_CONTEXT(main_win->traceset_info->traceset_context);
+         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,
@@ -635,7 +721,7 @@ void context_remove_hooks_api(MainWindow *main_win ,
                              LttvHooks *after_event)
 {
   LttvTracesetContext * tsc =
-        LTTV_TRACESET_CONTEXT(main_win->traceset_info->traceset_context);
+        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,
@@ -651,13 +737,13 @@ void context_remove_hooks_api(MainWindow *main_win ,
 void state_add_event_hooks_api(MainWindow *main_win )
 {
   lttv_state_add_event_hooks(
-       (LttvTracesetState*)main_win->traceset_info->traceset_context);
+       (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context);
 }
 
 void state_remove_event_hooks_api(MainWindow *main_win )
 {
   lttv_state_remove_event_hooks(
-       (LttvTracesetState*)main_win->traceset_info->traceset_context);
+       (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context);
 }
 
 
@@ -669,13 +755,13 @@ void state_remove_event_hooks_api(MainWindow *main_win )
 void stats_add_event_hooks_api(MainWindow *main_win )
 {
   lttv_stats_add_event_hooks(
-        (LttvTracesetStats*)main_win->traceset_info->traceset_context);
+        (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context);
 }
 
 void stats_remove_event_hooks_api(MainWindow *main_win )
 {
   lttv_stats_remove_event_hooks(
-        (LttvTracesetStats*)main_win->traceset_info->traceset_context);
+        (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context);
 }
 
 /**
@@ -685,5 +771,11 @@ void stats_remove_event_hooks_api(MainWindow *main_win )
 
 LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win)
 {
-  return main_win->traceset_info->traceset_context;
+  return main_win->current_tab->traceset_info->traceset_context;
+}
+
+
+LttvTracesetContext* get_traceset_context(MainWindow *main_win)
+{
+  return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
 }
This page took 0.026151 seconds and 4 git commands to generate.