filter starts to work
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / lttvwindow.h
index a4956331e235030b63efe94c0d0530119255d90a..f7c7441f4010acb4f2e34985bf352bdb24d31d54 100644 (file)
@@ -102,12 +102,6 @@ dividor :     This notice links the positions of the horizontal dividors
               typically showing processes, cpus, ...
               
 
-FIXME : Add background computation explanation here
-background_init: prepare for background computation (comes after show_end).
-process_trace for background: done in small chunks in gtk_idle, hooks called.
-background_end: remove the hooks and perhaps update the window.
-
-
 Reporting Changes to the Main Window
 
 In most cases, the enclosing window knows about updates such as described
@@ -122,12 +116,10 @@ consequently call current_time_notify for each of its contained viewers.
 
 Available report methods are :
 
-lttvwindow_report_status : reports the text of the status bar.
 lttvwindow_report_time_window : reports the new time window.
 lttvwindow_report_current_time : reports the new current time.
 lttvwindow_report_dividor : reports the new horizontal dividor's position.
-lttvwindow_report_focus : One on the widgets in the viewer has the keyboard's
-                          focus from GTK.
+lttvwindow_report_filter : reports the new filter object
 
 
 
@@ -159,7 +151,7 @@ the main window will look for the stop_flag and remove the EventRequests
 from its lists, calling the process_traceset_end for this request (it
 removes hooks from the context and calls the after hooks).
 
-It no stop_flag is rose, the end timestamp, end position or number
+It no stop_flag is risen, the end timestamp, end position or number
 of events to read has to be reached to determine the end of the
 request. Otherwise, the end of traceset does determine it.
 
@@ -247,8 +239,8 @@ FIXME : explain other important events
 */
 
 
-#ifndef VIEWER_H
-#define VIEWER_H
+#ifndef LTTVWINDOW_H
+#define LTTVWINDOW_H
 
 /*! \file lttvwindow.h
  * \brief API used by the graphical viewers to interact with their top window.
@@ -265,17 +257,16 @@ FIXME : explain other important events
 #include <lttv/hook.h>
 #include <lttv/tracecontext.h>
 #include <lttv/stats.h>
+#include <lttv/filter.h>
 #include <lttvwindow/mainwindow.h>
-#include <lttvwindow/lttvfilter.h>
-//FIXME (not ready yet) #include <lttv/filter.h>
 
 /* Module Related API */
 
+/* GQuark containing constructors of viewers in global attributes */
+extern GQuark LTTV_VIEWER_CONSTRUCTORS;
 
 /* constructor a the viewer */
-//FIXME explain LttvTracesetSelector and key
-typedef GtkWidget * (*lttvwindow_viewer_constructor)
-                (Tab *tab, LttvTracesetSelector * s, char *key);
+typedef GtkWidget* (*lttvwindow_viewer_constructor)(Tab *tab);
 
 
 /**
@@ -285,7 +276,8 @@ typedef GtkWidget * (*lttvwindow_viewer_constructor)
  * window.
  * 
  * It should be called by init function of the module.
- * 
+ *
+ * @param name name of the viewer : mainly used as tag for constructor
  * @param menu_path path of the menu item. NULL : no menu entry.
  * @param menu_text text of the menu item.
  * @param pixmap Image shown on the toolbar item. NULL : no button.
@@ -294,7 +286,8 @@ typedef GtkWidget * (*lttvwindow_viewer_constructor)
  */
 
 void lttvwindow_register_constructor
-                            (char *  menu_path, 
+                            (char * name,
+                             char *  menu_path, 
                              char *  menu_text,
                              char ** pixmap,
                              char *  tooltip,
@@ -400,6 +393,60 @@ void lttvwindow_unregister_traceset_notify(Tab *tab,
                                            gpointer    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);
+
+/**
+ * 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);
+
+
+/**
+ * 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);
+
+
+/**
+ * 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);
+
+
 /**
  * Function to register a hook function for a viewer to set/update its 
  * filter. 
@@ -469,6 +516,37 @@ void lttvwindow_unregister_current_time_notify(Tab *tab,
                                                LttvHook    hook,
                                                gpointer    hook_data);
 
+/**
+ * Function to register a hook function for a viewer to set/update its 
+ * current position.
+ * 
+ * @param tab the tab the viewer belongs to.
+ * @param hook hook function of the viewer that updates the current time. The
+ *             call_data is a LttTime* representing the new current time.
+ * @param hook_data hook data associated with the hook function. It will
+ *                  be typically a pointer to the viewer's data structure.
+ */
+
+void lttvwindow_register_current_position_notify(Tab *tab,
+                                             LttvHook    hook,
+                                             gpointer    hook_data);
+
+
+/**
+ * Function to unregister a viewer's hook function which is used to 
+ * set/update the current position of the viewer.
+ * @param tab the tab the viewer belongs to.
+ * @param hook hook function of the viewer that updates the current time. The
+ *             call_data is a LttTime* representing the new current time.
+ * @param hook_data hook data associated with the hook function. It will
+ *                  be typically a pointer to the viewer's data structure.
+ */
+
+void lttvwindow_unregister_current_position_notify(Tab *tab,
+                                               LttvHook    hook,
+                                               gpointer    hook_data);
+
+
 
 /**
  * Function to register a hook function for a viewer to set/update the 
@@ -508,39 +586,39 @@ void lttvwindow_unregister_dividor(Tab *tab,
 
 
 
-/**
- * This method reports the information to show on the status bar in the
- * main window.
- * 
- * @param tab the tab the viewer belongs to.
- * @param info the message which will be shown in the status bar.
- */
-
-void lttvwindow_report_status(Tab *tab, const char *info);
-
-
 /**
  * Function to set the time interval of the current tab.a
  *
  * @param tab the tab the viewer belongs to.
- * @param time_interval pointer to the time interval value.
+ * @param time_interval new time window.
  */
 
 void lttvwindow_report_time_window(Tab *tab,
-                                   const TimeWindow *time_window);
+                                   TimeWindow time_window);
 
 /**
- * Function to set the current time/event of the current tab.
+ * Function to set the current time of the current tab.
  * It will be called by a viewer's signal handle associated with 
  * the button-release-event signal
  * @param tab the tab the viewer belongs to.
- * @param time a pointer where time is stored.
+ * @param time current time.
  */
 
 void lttvwindow_report_current_time(Tab *tab, 
-                                    const LttTime *time);
+                                    LttTime time);
 
 
+/**
+ * Function to set the current event of the current tab.
+ * It will be called by a viewer's signal handle associated with 
+ * the button-release-event signal
+ * @param tab the tab the viewer belongs to.
+ * @param pos the current position.
+ */
+
+void lttvwindow_report_current_position(Tab *tab,
+                                        LttvTracesetContextPosition *pos);
+
 /**
  * Function to set the position of the hpane's dividor (viewer).
  * It will typically be called by a viewer's signal handle associated 
@@ -552,31 +630,21 @@ void lttvwindow_report_current_time(Tab *tab,
 
 void lttvwindow_report_dividor(Tab *tab, gint position);
 
-/**
- * Function to set the focused viewer of the tab.
- * It will be called by a viewer's signal handle associated with 
- * the grab_focus signal of all widgets in the viewer.
- *
- * @param tab the tab the viewer belongs to.
- * @param top_widget the top widget containing all the other widgets of the
- *                   viewer.
- */
-void lttvwindow_report_focus(Tab *tab, 
-                             GtkWidget  *top_widget);
-
 
 /* Structure sent to the events request hook */
-                                                /* Value considered as empty */
+                                                /* Value considered as empty*/
 typedef struct _EventsRequest {
   gpointer                     owner;           /* Owner of the request     */
   gpointer                     viewer_data;     /* Unset : NULL             */
-  gboolean                     servicing;       /* service in progress: TRUE */ 
-  LttTime                      start_time;/* Unset : { G_MAXUINT, G_MAXUINT }*/
+  gboolean                     servicing;       /* service in progress: TRUE*/ 
+  LttTime                      start_time;      /* Unset : ltt_time_infinite*/
   LttvTracesetContextPosition *start_position;  /* Unset : NULL             */
   gboolean                     stop_flag;       /* Continue:TRUE Stop:FALSE */
-  LttTime                      end_time;/* Unset : { G_MAXUINT, G_MAXUINT } */
+  LttTime                      end_time;        /* Unset : ltt_time_infinite*/
   guint                        num_events;      /* Unset : G_MAXUINT        */
   LttvTracesetContextPosition *end_position;    /* Unset : NULL             */
+  gint                         trace;           /* unset : -1               */
+  GArray                      *hooks;           /* Unset : NULL             */
   LttvHooks                   *before_chunk_traceset; /* Unset : NULL       */
   LttvHooks                   *before_chunk_trace;    /* Unset : NULL       */
   LttvHooks                   *before_chunk_tracefile;/* Unset : NULL       */
@@ -590,7 +658,7 @@ typedef struct _EventsRequest {
 } EventsRequest;
 
 /* Maximum number of events to proceed at once in a chunk */
-#define CHUNK_NUM_EVENTS 50000
+#define CHUNK_NUM_EVENTS 6000
 
 
 /**
@@ -606,13 +674,16 @@ typedef struct _EventsRequest {
  *
  * end_time, end_position and num_events can all be defined. The first one
  * to occur will be used as end criterion.
+ *
+ * The events_request memory will be managed by the main window once its
+ * pointer is passed by this function.
  * 
  * @param tab the tab the viewer belongs to.
  * @param events_requested Details about the event request.
  */
 
 void lttvwindow_events_request(Tab                  *tab,
-                               const EventsRequest  *events_request);
+                               EventsRequest  *events_request);
 
 /**
  * Function to remove data requests related to a viewer.
@@ -628,78 +699,51 @@ void lttvwindow_events_request_remove_all(Tab            *tab,
                                           gconstpointer   viewer);
 
 
-typedef struct _BackgroundRequest {
-  gchar *hook_path; /* Hook path in global attributes, where all standard hooks
-                       are : i.e. /TraceState/Statistics/ModuleName */
-  gchar *trace_path; /* path_to_trace */
-} BackgroundRequest;
-
-typedef struct _BackgroundNotify {
-  gchar                       *trace_path; /* path_to_trace */
-  LttTime                      notify_time;
-  LttvTracesetContextPosition *notify_position;
-  LttvHooks                   *notify; /* Hook to call when the notify is
-                                          passed, or at the end of trace */
-} BackgroundNotify;
-
-/**
- * Function to request data from a specific trace
- * 
- * @param bg_request Request specification
- */
-
-void lttvwindow_background_request_queue(const BackgroundRequest  *bg_request);
-
-/**
- * Register a callback to be called when requested data is passed in the next
- * queued background processing.
- * 
- * @param bg_request Request specification
- */
-
-void lttvwindow_background_notify_queue(const BackgroundNotify  *bg_notify);
-
-
 /**
- * Register a callback to be called when requested data is passed in the current
- * background processing.
- * 
- * @param bg_request Request specification
+ * 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 tab viewer's tab 
+ * @return time window.
  */
 
-void lttvwindow_background_notify_current(const BackgroundNotify  *bg_notify);
+TimeWindow lttvwindow_get_time_window(Tab *tab);
 
 
 /**
- * Function to get the current time window of the current tab.
- * 
+ * Function to get the current time of the current tab.
+ *
  * @param tab the tab the viewer belongs to.
- * @return a pointer to the current tab's time interval.
+ * @return the current tab's current time.
  */
 
-const TimeWindow *lttvwindow_get_time_window(Tab *tab);
+LttTime lttvwindow_get_current_time(Tab *tab);
 
 
 /**
- * Function to get the current time of the current tab.
- *
- * @param tab the tab the viewer belongs to.
- * @return a pointer to the current tab's current time.
+ * Function to get the filter of the current tab.
+ * @param main_win, the main window the viewer belongs to.
+ * @param filter, a pointer to a filter.
  */
 
-const LttTime *lttvwindow_get_current_time(Tab *tab);
-
+//LttvFilter *lttvwindow_get_filter(Tab *tab);
 
 /**
- * Function to get the filter of the current tab.
+ * Function to set the filter of the current tab.
+ * It should be called by the filter GUI to tell the
+ * main window to update the filter tab's lttv_filter.
+ *
+ * Notice : the lttv_filter object will be owned by the
+ *          main window after the return of this function.
+ *          Do NOT desallocate it.
+ * 
  * @param main_win, the main window the viewer belongs to.
  * @param filter, a pointer to a filter.
  */
 
-//FIXME
-typedef void lttv_filter;
-//FIXME
-const lttv_filter *lttvwindow_get_filter(Tab *tab);
+void lttvwindow_report_filter(Tab *tab, LttvFilter *filter);
+
 
 
 /**
@@ -723,4 +767,32 @@ LttvTracesetStats* lttvwindow_get_traceset_stats(Tab *tab);
 LttvTracesetContext* lttvwindow_get_traceset_context(Tab *tab);
 
 
-#endif //VIEWER_H
+/* set_time_window 
+ *
+ * It updates the time window of the tab, then calls the updatetimewindow
+ * hooks of each viewer.
+ *
+ * This is called whenever the scrollbar value changes.
+ *
+ * This is mostly an internal function.
+ */
+
+void set_time_window(Tab *tab, const TimeWindow *time_window);
+
+
+/* set_current_time
+ *
+ * It updates the current time of the tab, then calls the updatetimewindow
+ * hooks of each viewer.
+ *
+ * This is called whenever the current time value changes.
+ *
+ * This is mostly an internal function.
+ */
+
+void set_current_time(Tab *tab, const LttTime *current_time);
+
+
+void events_request_free(EventsRequest *events_request);
+
+#endif //LTTVWINDOW_H
This page took 0.027964 seconds and 4 git commands to generate.