continue, redraw, stop, ok
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / lttvwindow.c
index 1733c34720fc9ca9ea56b49a6d6f11fac2c3e541..d2009771d83fdbc5dd98e97d63eb70b17468e00c 100644 (file)
@@ -33,8 +33,8 @@
 #include <lttv/state.h>
 #include <lttv/stats.h>
 #include <lttv/tracecontext.h>
-#include <lttvwindow/common.h>
 #include <lttvwindow/mainwindow.h>   
+#include <lttvwindow/mainwindow-private.h>   
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/toolbar.h>
 #include <lttvwindow/menu.h>
@@ -58,7 +58,7 @@ extern GSList * g_main_window_list;
  *  1 : no traceset hooks to update; not an error.
  */
 
-int SetTraceset(Tab * tab, gpointer traceset)
+int SetTraceset(Tab * tab, LttvTraceset *traceset)
 {
   LttvHooks * tmp;
   LttvAttributeValue value;
@@ -464,6 +464,102 @@ void lttvwindow_unregister_traceset_notify(Tab *tab,
   lttv_hooks_remove_data(tmp, hook, hook_data);
 }
 
+/**
+ * Function to register a hook function for a viewer be completely redrawn.
+ * 
+ * @param tab viewer's tab 
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+void lttvwindow_register_redraw_notify(Tab *tab,
+    LttvHook hook, gpointer hook_data)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  g_assert(lttv_iattribute_find_by_path(tab->attributes,
+           "hooks/redraw", 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, LTTV_PRIO_DEFAULT);
+}
+
+
+/**
+ * Function to unregister a hook function for a viewer be completely redrawn.
+ *
+ * @param tab viewer's tab 
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+void lttvwindow_unregister_redraw_notify(Tab *tab,
+              LttvHook hook, gpointer hook_data)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  g_assert(lttv_iattribute_find_by_path(tab->attributes,
+           "hooks/redraw", LTTV_POINTER, &value));
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL) return;
+  lttv_hooks_remove_data(tmp, hook, hook_data);
+}
+
+/**
+ * Function to register a hook function for a viewer to re-do the events
+ * requests for the needed interval.
+ *
+ * This action is typically done after a "stop".
+ *
+ * The typical hook will remove all current requests for the viewer
+ * and make requests for missing information.
+ * 
+ * @param tab viewer's tab 
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+void lttvwindow_register_continue_notify(Tab *tab,
+    LttvHook hook, gpointer hook_data)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  g_assert(lttv_iattribute_find_by_path(tab->attributes,
+           "hooks/continue", 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, LTTV_PRIO_DEFAULT);
+}
+
+
+/**
+ * Function to unregister a hook function for a viewer to re-do the events
+ * requests for the needed interval.
+ *
+ * @param tab viewer's tab 
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+void lttvwindow_unregister_continue_notify(Tab *tab,
+              LttvHook hook, gpointer hook_data)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  g_assert(lttv_iattribute_find_by_path(tab->attributes,
+           "hooks/continue", LTTV_POINTER, &value));
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL) return;
+  lttv_hooks_remove_data(tmp, hook, hook_data);
+}
+
+
 /**
  * Function to register a hook function for a viewer to set/update its 
  * filter.
@@ -749,12 +845,9 @@ void lttvwindow_report_focus(Tab *tab, GtkWidget *top_widget)
  */
 
 void lttvwindow_events_request(Tab *tab,
-                               const EventsRequest  *events_request)
+                               EventsRequest  *events_request)
 {
-  EventsRequest *alloc = g_new(sizeof(EventsRequest,1));
-  *alloc = *events_request;
-
-  tab->events_requests = g_slist_append(tab->events_requests, alloc);
+  tab->events_requests = g_slist_append(tab->events_requests, events_request);
   
   if(!tab->events_request_pending)
   {
@@ -780,7 +873,7 @@ void lttvwindow_events_request(Tab *tab,
 
 gint find_viewer (const EventsRequest *a, gconstpointer b)
 {
-  return (a->viewer != b);
+  return (a->owner != b);
 }
 
 
@@ -793,7 +886,7 @@ void lttvwindow_events_request_remove_all(Tab       *tab,
             g_slist_find_custom(tab->events_requests, viewer,
                                 (GCompareFunc)find_viewer))
               != NULL) {
-    EventRequest *events_request = (EventsRequest *)element->data;
+    EventsRequest *events_request = (EventsRequest *)element->data;
     if(events_request->servicing == TRUE) {
       lttv_hooks_call(events_request->after_request, NULL);
     }
@@ -811,12 +904,12 @@ void lttvwindow_events_request_remove_all(Tab       *tab,
  * shown time interval of the viewer and also be called by the constructor
  * of the viewer.
  * @param tab viewer's tab 
- * @param time_interval a pointer where time interval will be stored.
+ * @return time window.
  */
 
-const TimeWindow *lttvwindow_get_time_window(Tab *tab)
+TimeWindow lttvwindow_get_time_window(Tab *tab)
 {
-  return &(tab->time_window);
+  return tab->time_window;
   
 }
 
@@ -826,12 +919,12 @@ const TimeWindow *lttvwindow_get_time_window(Tab *tab)
  * It will be called by a viewer's hook function to update the 
  * current time/event of the viewer.
  * @param tab viewer's tab 
- * @param time a pointer where time will be stored.
+ * @return time
  */
 
-const LttTime *lttvwindow_get_current_time(Tab *tab)
+LttTime lttvwindow_get_current_time(Tab *tab)
 {
-  return &(tab->current_time);
+  return tab->current_time;
 }
 
 
This page took 0.025396 seconds and 4 git commands to generate.