Add per list filter
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 10 Oct 2006 18:35:41 +0000 (18:35 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 10 Oct 2006 18:35:41 +0000 (18:35 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2191 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/configure.in
ltt/branches/poly/lttv/lttv/batchtest.c
ltt/branches/poly/lttv/lttv/tracecontext.c
ltt/branches/poly/lttv/lttv/tracecontext.h
ltt/branches/poly/lttv/modules/gui/detailedevents/Makefile.am
ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/detailedevents/events.h [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/detailedevents/lttv_plugin_evd.c [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/detailedevents/lttv_plugin_evd.h [new file with mode: 0644]

index 2520438586c156b96f9fce40b93429cd42f75e9e..2cf664c66ea17aba0344fbff60081f11d39dea4e 100644 (file)
@@ -23,7 +23,7 @@
 AC_PREREQ(2.57)
 AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
 #AC_WITH_LTDL  # not needed ?
-AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.62-03102006)
+AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.63-10102006)
 AM_CONFIG_HEADER(config.h)
 AM_PROG_LIBTOOL
 
index ff4d6f19259c37e5c341d5d20046ae37cadea653..865a4cb9e8184641eb7e315c6a1e6b27e208060e 100644 (file)
@@ -661,18 +661,18 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     g_message("Running test 9 : seek_forward and seek_backward");
     lttv_process_traceset_seek_time(tsc, ltt_time_zero);
 
-    count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL);
     g_assert(count == 500);
     lttv_traceset_context_position_save(tsc, saved_pos);
     t0 = get_time();
-    count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek forward 150000 events in %g seconds", t1 - t0);
     g_assert(count == 150000);
     t0 = get_time();
     count = lttv_process_traceset_seek_n_backward(tsc, 150000,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL);
+        NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek backward 150000 events in %g seconds", t1 - t0);
     g_assert(count == 150000);
@@ -680,20 +680,20 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
       g_warning("Problem with seek_n ! Positions differ. (1)");
     }
     
-    lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL);
+    lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL);
     lttv_traceset_context_position_save(tsc, saved_pos);
-    lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL);
+    lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL);
     lttv_process_traceset_seek_n_backward(tsc, 15005,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL);
-    lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL);
+    lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL, NULL, NULL);
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
       g_warning("Problem with seek_n ! Positions differ. (2)");
     }
     
     lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
     
-    count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL);
     if(count > 0)
       g_warning("Problem with seek_n ! Forward at end of traceset.");
     
@@ -703,11 +703,11 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     t0 = get_time();
     lttv_process_traceset_seek_n_backward(tsc, 300,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL);
+        NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek backward 300 events in %g seconds", t1 - t0);
-    count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL);
-    count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL);
 
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
       g_warning("Problem with seek_n ! Positions differ. (4)");
@@ -717,11 +717,11 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     t0 = get_time();
     lttv_process_traceset_seek_n_backward(tsc, 10,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL);
+        NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek backward 10 events in %g seconds", t1 - t0);
     t0 = get_time();
-    count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek forward 10 events in %g seconds", t1 - t0);
 
@@ -732,9 +732,9 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     lttv_traceset_context_position_save(tsc, saved_pos);
     lttv_process_traceset_seek_n_backward(tsc, 301,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL);
-    count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL);
-    count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL);
 
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) == 0) {
       g_warning("Problem with seek_n ! Positions _should_ differ. (5)");
@@ -743,17 +743,17 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     /* Try a seek by closest time : Hint : try this one with and without states
      * computed. */
     lttv_process_traceset_seek_time(tsc, ltt_time_zero);
-    count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL);
     lttv_traceset_context_position_save(tsc, saved_pos);
     t0 = get_time();
     lttv_process_traceset_seek_n_backward(tsc, 100301,
         seek_back_default_offset,
         (seek_time_fct)lttv_state_traceset_seek_time_closest, NULL,
-        NULL, NULL);
+        NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek backward 100301 events (with seek closest) in %g seconds",
                 t1 - t0);
-    count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL, NULL, NULL);
     
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
       g_warning("Problem with seek_n with state seek time! Positions differ. (6)");
@@ -769,7 +769,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
       lttv_traceset_context_position_new(tsc);
 
     lttv_process_traceset_seek_time(tsc, ltt_time_zero);
-    lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL);
+    lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL);
     lttv_traceset_context_position_save(tsc, saved_pos);
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
       g_critical("Error in seek position. (1)");
@@ -777,7 +777,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
     lttv_process_traceset_seek_n_backward(tsc, 500,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL);
+        NULL, NULL, NULL, NULL);
     lttv_traceset_context_position_save(tsc, saved_pos);
 
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
index 5d24e11bc75f66e9c88d694b6867ae696bf9ca82..f98f812c3db1043b61f33ad1b5e12a1a19769e45 100644 (file)
@@ -1337,7 +1337,9 @@ struct seek_back_data {
   guint events_found;
   guint n;             /* number of events requested */
   GPtrArray *array; /* array of LttvTracesetContextPositions pointers */
-  LttvFilter *filter;
+  LttvFilter *filter1;
+  LttvFilter *filter2;
+  LttvFilter *filter3;
   check_handler *check;
   gboolean *stop_flag;
   guint raw_event_count;
@@ -1353,15 +1355,31 @@ static gint seek_back_event_hook(void *hook_data, void* call_data)
   if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE;
   sd->raw_event_count++;
 
-  if(sd->filter != NULL && sd->filter->head != NULL) {
-    if(!lttv_filter_tree_parse(sd->filter->head,
+  if(sd->filter1 != NULL && sd->filter1->head != NULL && 
+    !lttv_filter_tree_parse(sd->filter1->head,
           ltt_tracefile_get_event(tfc->tf),
           tfc->tf,
           tfc->t_context->t,
-          tfc))
-      return FALSE;
+          tfc)) {
+         return FALSE;
   }
-  
+  if(sd->filter2 != NULL && sd->filter2->head != NULL && 
+    !lttv_filter_tree_parse(sd->filter2->head,
+          ltt_tracefile_get_event(tfc->tf),
+          tfc->tf,
+          tfc->t_context->t,
+          tfc)) {
+         return FALSE;
+  }
+  if(sd->filter3 != NULL && sd->filter3->head != NULL && 
+    !lttv_filter_tree_parse(sd->filter3->head,
+          ltt_tracefile_get_event(tfc->tf),
+          tfc->tf,
+          tfc->t_context->t,
+          tfc)) {
+         return FALSE;
+  }
+
   pos = (LttvTracesetContextPosition*)g_ptr_array_index (sd->array,
                                                          sd->first_event);
 
@@ -1404,9 +1422,11 @@ static gint seek_back_event_hook(void *hook_data, void* call_data)
 guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self,
                                             guint n, LttTime first_offset,
                                             seek_time_fct time_seeker,
-                                            LttvFilter *filter,
                                             check_handler *check,
-                                            gboolean *stop_flag)
+                                            gboolean *stop_flag,
+                                           LttvFilter *filter1,
+                                           LttvFilter *filter2,
+                                           LttvFilter *filter3)
 {
   if(lttv_traceset_number(self->ts) == 0) return 0;
   g_assert(ltt_time_compare(first_offset, ltt_time_zero) != 0);
@@ -1427,7 +1447,9 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self,
   sd.first_event = 0;
   sd.events_found = 0;
   sd.array = g_ptr_array_sized_new(n);
-  sd.filter = filter;
+  sd.filter1 = filter1;
+  sd.filter2 = filter2;
+  sd.filter3 = filter3;
   sd.n = n;
   sd.check = check;
   sd.stop_flag = stop_flag;
@@ -1537,7 +1559,9 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self,
 struct seek_forward_data {
   guint event_count;  /* event counter */
   guint n;            /* requested number of events to jump over */
-  LttvFilter *filter;
+  LttvFilter *filter1;
+  LttvFilter *filter2;
+  LttvFilter *filter3;
   check_handler *check;
   gboolean *stop_flag;
   guint raw_event_count;  /* event counter */
@@ -1551,16 +1575,34 @@ static gint seek_forward_event_hook(void *hook_data, void* call_data)
   if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE;
   sd->raw_event_count++;
 
-  if(sd->filter == NULL || lttv_filter_tree_parse(sd->filter->head,
+  if(sd->filter1 != NULL && sd->filter1->head != NULL && 
+    !lttv_filter_tree_parse(sd->filter1->head,
           ltt_tracefile_get_event(tfc->tf),
           tfc->tf,
           tfc->t_context->t,
           tfc)) {
-    sd->event_count++;
-    if(sd->event_count >= sd->n)
-      return TRUE;
+         return FALSE;
   }
-  return FALSE;
+  if(sd->filter2 != NULL && sd->filter2->head != NULL && 
+    !lttv_filter_tree_parse(sd->filter2->head,
+          ltt_tracefile_get_event(tfc->tf),
+          tfc->tf,
+          tfc->t_context->t,
+          tfc)) {
+         return FALSE;
+  }
+  if(sd->filter3 != NULL && sd->filter3->head != NULL && 
+    !lttv_filter_tree_parse(sd->filter3->head,
+          ltt_tracefile_get_event(tfc->tf),
+          tfc->tf,
+          tfc->t_context->t,
+          tfc)) {
+         return FALSE;
+  }
+
+  sd->event_count++;
+  if(sd->event_count >= sd->n)
+      return TRUE;
 }
 
 /* Seek back n events forward from the current position (1 to n)
@@ -1574,14 +1616,19 @@ static gint seek_forward_event_hook(void *hook_data, void* call_data)
  * returns : the number of events jumped over (may be less than requested if end
  * of traceset reached) */
 guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self,
-                                          guint n, LttvFilter *filter,
+                                          guint n,
                                           check_handler *check,
-                                          gboolean *stop_flag)
+                                          gboolean *stop_flag,
+                                         LttvFilter *filter1,
+                                         LttvFilter *filter2,
+                                         LttvFilter *filter3)
 {
   struct seek_forward_data sd;
   sd.event_count = 0;
   sd.n = n;
-  sd.filter = filter;
+  sd.filter1 = filter1;
+  sd.filter2 = filter2;
+  sd.filter3 = filter3;
   sd.check = check;
   sd.stop_flag = stop_flag;
   sd.raw_event_count = 0;
index 61879a7ff9c42e72806d83f4237143658c738e60..70993e7a693c8ed4570bb918f297cad921360b34 100644 (file)
@@ -356,9 +356,11 @@ typedef gboolean check_handler(guint count, gboolean *stop_flag);
 
 guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self,
                                            guint n,
-                                           LttvFilter *filter,
                                           check_handler *check,
-                                          gboolean *stop_flag);
+                                          gboolean *stop_flag,
+                                          LttvFilter *filter1,
+                                          LttvFilter *filter2,
+                                          LttvFilter *filter3);
 typedef void (*seek_time_fct)(LttvTracesetContext *self, LttTime start);
 
 /* If first_offset is ltt_time_zero, it will choose a default value */
@@ -366,9 +368,11 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self,
                                             guint n,
                                             LttTime first_offset,
                                             seek_time_fct,
-                                            LttvFilter *filter,
                                            check_handler *check,
-                                           gboolean *stop_flag);
+                                           gboolean *stop_flag,
+                                           LttvFilter *filter1,
+                                           LttvFilter *filter2,
+                                           LttvFilter *filter3);
 
 
 #endif // PROCESSTRACE_H
index 98c70c90f645fdaf62849e383ec870c2907d62c4..7f26b15fcf1415ed60a5bc5a9dd5b78ec7e3b1c7 100644 (file)
@@ -32,7 +32,9 @@ libdir = ${lttvplugindir}
 
 lib_LTLIBRARIES = libguievents.la
 libguievents_la_LDFLAGS = -module
-libguievents_la_SOURCES = events.c
+libguievents_la_SOURCES = events.c lttv_plugin_evd.c
+
+noinst_HEADERS =       lttv_plugin_evd.h events.h
 
 EXTRA_DIST = \
                hGuiEventsInsert.xpm
index dcd2cf998460c1cedefbfef453782ba9d3e8b302..2e123ad6ea4b0388bad64df41fa46a268e59bc64 100644 (file)
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/lttvwindowtraces.h>
 #include <lttvwindow/lttv_plugin_tab.h>
+#include <lttvwindow/support.h>
+#include "lttv_plugin_evd.h"
 
+#include "events.h"
 #include "hGuiEventsInsert.xpm"
 
 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
@@ -91,64 +94,6 @@ typedef enum _ScrollDirection{
   SCROLL_NONE
 } ScrollDirection;
 
-typedef struct _EventViewerData {
-
-  Tab * tab;
-  LttvPluginTab *ptab;
-  LttvHooks  * event_hooks;
-
-  /* previous value is used to determine if it is a page up/down or
-   * step up/down, in which case we move of a certain amount of events (one or
-   * the number of events shown on the screen) instead of changing begin time.
-   */
-  double       previous_value;
-
-  //scroll window containing Tree View
-  GtkWidget * scroll_win;
-
-  /* Model containing list data */
-  GtkListStore *store_m;
-
-  GPtrArray *pos; /* Array of LttvTracesetContextPosition * */
-  GtkWidget *top_widget;
-  GtkWidget *hbox_v;
-  /* Widget to display the data in a columned list */
-  GtkWidget *tree_v;
-  GtkAdjustment *vtree_adjust_c ;
-  GtkWidget *button; /* a button of the header, used to get the header_height */
-  gint header_height;
-  
-  /* Vertical scrollbar and its adjustment */
-  GtkWidget *vscroll_vc;
-  GtkAdjustment *vadjust_c;
-  
-  /* Selection handler */
-  GtkTreeSelection *select_c;
-  
-  gint num_visible_events;
-  
-  LttvTracesetContextPosition *currently_selected_position;
-  gboolean update_cursor; /* Speed optimisation : do not update cursor when 
-                             unnecessary */
-  gboolean report_position; /* do not report position when in current_time
-                               update */
-
-  LttvTracesetContextPosition *first_event;  /* Time of the first event shown */
-  LttvTracesetContextPosition *last_event;  /* Time of the first event shown */
-
-  LttvTracesetContextPosition *current_time_get_first; 
-
-  LttvFilter *main_win_filter;
-
-  gint background_info_waiting;
-
-  guint32 last_tree_update_time; /* To filter out repeat keys */
-
-  guint num_events;  /* Number of events processed */
-
-} EventViewerData ;
-
 /** hook functions for update time interval, current time ... */
 gboolean update_current_time(void * hook_data, void * call_data);
 gboolean update_current_position(void * hook_data, void * call_data);
@@ -163,8 +108,8 @@ GtkWidget *h_gui_events(LttvPlugin *plugin);
 //! Event Viewer's constructor
 EventViewerData *gui_events(LttvPluginTab *ptab);
 //! Event Viewer's destructor
-void gui_events_destructor(EventViewerData *event_viewer_data);
-void gui_events_free(EventViewerData *event_viewer_data);
+void gui_events_destructor(gpointer data);
+void gui_events_free(gpointer data);
 
 static gboolean
 header_size_allocate(GtkWidget *widget,
@@ -185,12 +130,12 @@ static void tree_v_size_request_cb (GtkWidget *widget,
 static void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data);
 static void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1,
     gint arg2, gpointer data);
+static void        filter_button      (GtkToolButton *toolbutton,
+                                          gpointer       user_data);
 static gboolean tree_v_scroll_handler (GtkWidget *widget, GdkEventScroll *event, gpointer data);
 static gboolean key_handler(GtkWidget *widget, GdkEventKey *event,
     gpointer user_data);
 
-static gint redraw_notify(void *hook_data, void *call_data);
-
 static void get_events(double time, EventViewerData *event_viewer_data);
 
 int event_hook(void *hook_data, void *call_data);
@@ -242,10 +187,13 @@ gui_events(LttvPluginTab *ptab)
   LttTime end;
   GtkTreeViewColumn *column;
   GtkCellRenderer *renderer;
-  EventViewerData* event_viewer_data = g_new(EventViewerData,1) ;
+  EventViewerData* event_viewer_data = g_new(EventViewerData,1);
+  LttvPluginEVD *plugin_evd = g_object_new(LTTV_TYPE_PLUGIN_EVD, NULL);
+  plugin_evd->evd = event_viewer_data;
   Tab *tab = ptab->tab;
   event_viewer_data->tab = tab;
   event_viewer_data->ptab = ptab;
+  GtkWidget *tmp_toolbar_icon;
 
   LttvTracesetContext * tsc =
         lttvwindow_get_traceset_context(event_viewer_data->tab);
@@ -266,7 +214,7 @@ gui_events(LttvPluginTab *ptab)
   lttvwindow_register_filter_notify(tab,
                 filter_changed, event_viewer_data);
   lttvwindow_register_redraw_notify(tab,
-                redraw_notify, event_viewer_data);
+                evd_redraw_notify, event_viewer_data);
   
 
   event_viewer_data->scroll_win = gtk_scrolled_window_new (NULL, NULL);
@@ -332,6 +280,8 @@ gui_events(LttvPluginTab *ptab)
       G_CALLBACK(tree_v_scroll_handler),
       event_viewer_data);
 
+
+
   // Use on each column!
   //gtk_tree_view_column_set_sizing(event_viewer_data->tree_v,
   //GTK_TREE_VIEW_COLUMN_FIXED);
@@ -459,6 +409,30 @@ gui_events(LttvPluginTab *ptab)
 
   event_viewer_data->hbox_v = gtk_hbox_new(0, 0);
   event_viewer_data->top_widget = event_viewer_data->hbox_v;
+  plugin_evd->parent.top_widget = event_viewer_data->hbox_v;
+
+  event_viewer_data->toolbar = gtk_toolbar_new();
+  gtk_toolbar_set_orientation(GTK_TOOLBAR(event_viewer_data->toolbar),
+                              GTK_ORIENTATION_VERTICAL);
+
+  tmp_toolbar_icon = create_pixmap (main_window_get_widget(tab),
+      "guifilter16x16.png");
+  gtk_widget_show(tmp_toolbar_icon);
+  event_viewer_data->button_filter = gtk_tool_button_new(tmp_toolbar_icon,
+      "Filter");
+  g_signal_connect (G_OBJECT(event_viewer_data->button_filter),
+        "clicked",
+        G_CALLBACK (filter_button),
+        (gpointer)plugin_evd);
+  gtk_toolbar_insert(GTK_TOOLBAR(event_viewer_data->toolbar),
+      event_viewer_data->button_filter,
+      0);
+  gtk_toolbar_set_style(GTK_TOOLBAR(event_viewer_data->toolbar),
+      GTK_TOOLBAR_ICONS);
+  gtk_box_pack_start(GTK_BOX(event_viewer_data->hbox_v),
+      event_viewer_data->toolbar, FALSE, FALSE, 0);
+  event_viewer_data->filter = NULL;
+
   gtk_box_pack_start(GTK_BOX(event_viewer_data->hbox_v),
       event_viewer_data->scroll_win, TRUE, TRUE, 0);
 
@@ -493,13 +467,15 @@ gui_events(LttvPluginTab *ptab)
   event_viewer_data->vadjust_c->page_size = 2.0;
   //    event_viewer_data->vtree_adjust_c->upper;
   /*  Raw event trace */
+  gtk_widget_show(GTK_WIDGET(event_viewer_data->button_filter));
+  gtk_widget_show(event_viewer_data->toolbar);
   gtk_widget_show(event_viewer_data->hbox_v);
   gtk_widget_show(event_viewer_data->tree_v);
   gtk_widget_show(event_viewer_data->vscroll_vc);
 
   /* Add the object's information to the module's array */
   g_event_viewer_data_list = g_slist_append(g_event_viewer_data_list,
-      event_viewer_data);
+      plugin_evd);
 
   event_viewer_data->num_visible_events = 1;
 
@@ -518,9 +494,14 @@ gui_events(LttvPluginTab *ptab)
  //
   g_object_set_data_full(
       G_OBJECT(event_viewer_data->hbox_v),
-      "event_viewer_data",
-      event_viewer_data,
+      "plugin_data",
+      plugin_evd,
       (GDestroyNotify)gui_events_free);
+
+  g_object_set_data(
+      G_OBJECT(event_viewer_data->hbox_v),
+      "event_viewer_data",
+      event_viewer_data);
   
   event_viewer_data->background_info_waiting = 0;
 
@@ -542,7 +523,7 @@ static gint background_ready(void *hook_data, void *call_data)
   if(event_viewer_data->background_info_waiting == 0) {
     g_message("event viewer : background computation data ready.");
 
-    redraw_notify(event_viewer_data, NULL);
+    evd_redraw_notify(event_viewer_data, NULL);
   }
 
   return 0;
@@ -1036,6 +1017,30 @@ void tree_v_move_cursor_cb (GtkWidget *widget,
 #endif //0
 }
 
+static void        filter_button      (GtkToolButton *toolbutton,
+                                          gpointer       user_data)
+{
+  LttvPluginEVD *plugin_evd = (LttvPluginEVD*)user_data;
+  LttvAttribute *attribute;
+  LttvAttributeValue value;
+  gboolean ret;
+  g_printf("Filter button clicked\n");
+
+  attribute = LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+        LTTV_IATTRIBUTE(lttv_global_attributes()),
+        LTTV_VIEWER_CONSTRUCTORS));
+  g_assert(attribute);
+
+  ret = lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(attribute),
+      "guifilter", LTTV_POINTER, &value);
+  g_assert(ret);
+  lttvwindow_viewer_constructor constructor =
+    (lttvwindow_viewer_constructor)*(value.v_pointer);
+  if(constructor) constructor(&plugin_evd->parent);
+  else g_warning("Filter module not loaded.");
+
+  //FIXME : viewer returned.
+}
 
 gboolean tree_v_scroll_handler (GtkWidget *widget, GdkEventScroll *event, gpointer data)
 {
@@ -1402,8 +1407,10 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
     if(relative_position > 0) {
       guint count;
       count += lttv_process_traceset_seek_n_forward(tsc, relative_position,
-          event_viewer_data->main_win_filter, events_check_handler,
-          &event_viewer_data->tab->stop_foreground);
+          events_check_handler,
+          &event_viewer_data->tab->stop_foreground,
+          event_viewer_data->main_win_filter,
+          event_viewer_data->filter, NULL);
     } else if(relative_position < 0) {
       guint count;
       
@@ -1420,9 +1427,10 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
           abs(relative_position),
           time_diff,
           (seek_time_fct)lttv_state_traceset_seek_time_closest,
-          event_viewer_data->main_win_filter,
          events_check_handler,
-         &event_viewer_data->tab->stop_foreground);
+         &event_viewer_data->tab->stop_foreground,
+          event_viewer_data->main_win_filter,
+          event_viewer_data->filter, NULL);
     } /* else 0 : do nothing : we are already at the beginning position */
 
     lttv_traceset_context_position_destroy(pos);
@@ -1509,7 +1517,6 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
 }
 
 
-
 int event_hook(void *hook_data, void *call_data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*)hook_data;
@@ -1530,6 +1537,13 @@ int event_hook(void *hook_data, void *call_data)
           tfc->t_context->t,tfc))
       return FALSE;
 
+  filter = event_viewer_data->filter;
+  if(filter != NULL && filter->head != NULL)
+    if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
+          tfc->t_context->t,tfc))
+      return FALSE;
+
+
   LttFacility *facility = ltt_event_facility(e);
   LttEventType *event_type = ltt_event_eventtype(e);
   LttTime time = ltt_event_time(e);
@@ -1623,6 +1637,12 @@ static int current_time_get_first_event_hook(void *hook_data, void *call_data)
           tfc->t_context->t,tfc))
       return FALSE;
 
+  filter = event_viewer_data->filter;
+  if(filter != NULL && filter->head != NULL)
+    if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
+          tfc->t_context->t,tfc))
+      return FALSE;
+
   lttv_traceset_context_position_save(tfc->t_context->ts_context, 
       event_viewer_data->current_time_get_first);
   return TRUE;
@@ -1789,7 +1809,7 @@ gboolean filter_changed(void * hook_data, void * call_data)
 }
 
 
-gint redraw_notify(void *hook_data, void *call_data)
+gint evd_redraw_notify(void *hook_data, void *call_data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
 
@@ -1797,12 +1817,16 @@ gint redraw_notify(void *hook_data, void *call_data)
   return 0;
 }
 
-void gui_events_free(EventViewerData *event_viewer_data)
+void gui_events_free(gpointer data)
 {
-  Tab *tab = event_viewer_data->tab;
+  LttvPluginEVD *plugin_evd = (LttvPluginEVD*)data;
+  Tab *tab = plugin_evd->evd->tab;
+  EventViewerData *event_viewer_data = plugin_evd->evd;
   guint i;
  
-  if(event_viewer_data){
+  lttv_filter_destroy(plugin_evd->evd->filter);
+
+  if(tab != NULL){
     lttv_hooks_remove(event_viewer_data->event_hooks,event_hook);
     lttv_hooks_destroy(event_viewer_data->event_hooks);
     
@@ -1831,23 +1855,25 @@ void gui_events_free(EventViewerData *event_viewer_data)
     lttvwindow_unregister_filter_notify(tab,
                         filter_changed, event_viewer_data);
     lttvwindow_unregister_redraw_notify(tab,
-                redraw_notify, event_viewer_data);
-
-    lttvwindowtraces_background_notify_remove(event_viewer_data);
+                evd_redraw_notify, event_viewer_data);
 
-    g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list,
-        event_viewer_data);
-    g_free(event_viewer_data);
   }
+  lttvwindowtraces_background_notify_remove(event_viewer_data);
+
+  g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list,
+      event_viewer_data);
+  //g_free(event_viewer_data);
+  g_object_unref(plugin_evd);
 }
 
 
 
-void gui_events_destructor(EventViewerData *event_viewer_data)
+void gui_events_destructor(gpointer data)
 {
+  LttvPluginEVD *plugin_evd = (LttvPluginEVD*)data;
   /* May already been done by GTK window closing */
-  if(GTK_IS_WIDGET(event_viewer_data->hbox_v)){
-    gtk_widget_destroy(event_viewer_data->hbox_v);
+  if(GTK_IS_WIDGET(plugin_evd->parent.top_widget)){
+    gtk_widget_destroy(plugin_evd->parent.top_widget);
   }
 }
 
@@ -1871,7 +1897,7 @@ static void init() {
 
 void event_destroy_walk(gpointer data, gpointer user_data)
 {
-  gui_events_destructor((EventViewerData*)data);
+  gui_events_destructor((LttvPluginEVD*)data);
 }
 
 /**
diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.h b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.h
new file mode 100644 (file)
index 0000000..43818c0
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef _EVENTS_H
+#define _EVENTS_H
+
+#include <lttvwindow/lttvwindow.h>
+#include <lttvwindow/lttv_plugin_tab.h>
+
+typedef struct _EventViewerData EventViewerData;
+
+struct _EventViewerData {
+
+  Tab * tab;
+  LttvPluginTab *ptab;
+  LttvHooks  * event_hooks;
+
+  /* previous value is used to determine if it is a page up/down or
+   * step up/down, in which case we move of a certain amount of events (one or
+   * the number of events shown on the screen) instead of changing begin time.
+   */
+  double       previous_value;
+
+  //scroll window containing Tree View
+  GtkWidget * scroll_win;
+
+  /* Model containing list data */
+  GtkListStore *store_m;
+
+  GPtrArray *pos; /* Array of LttvTracesetContextPosition * */
+  GtkWidget *top_widget;
+  GtkWidget *hbox_v;
+  /* Widget to display the data in a columned list */
+  GtkWidget *tree_v;
+  GtkAdjustment *vtree_adjust_c ;
+  GtkWidget *button; /* a button of the header, used to get the header_height */
+  gint header_height;
+  
+  /* Vertical scrollbar and its adjustment */
+  GtkWidget *vscroll_vc;
+  GtkAdjustment *vadjust_c;
+  
+  /* Selection handler */
+  GtkTreeSelection *select_c;
+  
+  gint num_visible_events;
+  
+  LttvTracesetContextPosition *currently_selected_position;
+  gboolean update_cursor; /* Speed optimisation : do not update cursor when 
+                             unnecessary */
+  gboolean report_position; /* do not report position when in current_time
+                               update */
+
+  LttvTracesetContextPosition *first_event;  /* Time of the first event shown */
+  LttvTracesetContextPosition *last_event;  /* Time of the first event shown */
+
+  LttvTracesetContextPosition *current_time_get_first; 
+
+  LttvFilter *main_win_filter;
+
+  gint background_info_waiting;
+
+  guint32 last_tree_update_time; /* To filter out repeat keys */
+
+  guint num_events;  /* Number of events processed */
+
+  LttvFilter *filter;
+  GtkWidget *toolbar;
+  GtkToolItem *button_filter;
+
+};
+
+extern gint evd_redraw_notify(void *hook_data, void *call_data);
+
+#endif //EVENTS_H
diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/lttv_plugin_evd.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/lttv_plugin_evd.c
new file mode 100644 (file)
index 0000000..ae93579
--- /dev/null
@@ -0,0 +1,84 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
+
+#include "lttv_plugin_evd.h"
+#include <lttvwindow/lttvwindow.h>
+#include "events.h"
+
+/* 
+ * forward definitions
+ */
+
+/*
+ * Implementation
+ */
+
+static void evd_update_filter(LttvPlugin *parent, LttvFilter *filter)
+{
+  LttvPluginEVD *self = LTTV_PLUGIN_EVD(parent);
+  g_message("In EVD update filter.");
+  lttv_filter_destroy(self->evd->filter);
+  self->evd->filter = filter;
+  evd_redraw_notify(self->evd, NULL);
+}
+
+
+static void
+lttv_plugin_evd_class_init (LttvPluginEVDClass *klass)
+{
+  LttvPluginClass *parent_klass;
+  parent_klass = &klass->parent;
+  parent_klass->update_filter = evd_update_filter;
+  g_type_class_add_private (klass, sizeof (EventViewerData));
+}
+
+
+static void
+lttv_plugin_evd_init (GTypeInstance *instance, gpointer g_class)
+{
+  LttvPluginEVD *self = LTTV_PLUGIN_EVD (instance);
+  self->evd = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      LTTV_TYPE_PLUGIN_EVD, EventViewerData);
+}
+
+
+GType
+lttv_plugin_evd_get_type (void)
+{
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      sizeof (LttvPluginEVDClass),
+      NULL,   /* base_init */
+      NULL,   /* base_finalize */
+      lttv_plugin_evd_class_init,   /* class_init */
+      NULL,   /* class_finalize */
+      NULL,   /* class_data */
+      sizeof (LttvPluginEVD),
+      0,      /* n_preallocs */
+      lttv_plugin_evd_init    /* instance_init */
+      };
+      type = g_type_register_static (G_TYPE_OBJECT,
+                                     "LttvPluginEVDType",
+                                     &info, 0);
+    }
+    return type;
+}
+
+
diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/lttv_plugin_evd.h b/ltt/branches/poly/lttv/modules/gui/detailedevents/lttv_plugin_evd.h
new file mode 100644 (file)
index 0000000..fe9eb10
--- /dev/null
@@ -0,0 +1,63 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
+#ifndef LTTV_PLUGIN_EVD_H
+#define LTTV_PLUGIN_EVD_H
+
+#include <lttvwindow/lttv_plugin.h>
+#include <lttvwindow/mainwindow-private.h>
+#include "events.h"
+
+/*
+ * Type macros.
+ */
+
+#define LTTV_TYPE_PLUGIN_EVD             (lttv_plugin_evd_get_type ())
+#define LTTV_PLUGIN_EVD(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TYPE_PLUGIN_EVD, LttvPluginEVD))
+#define LTTV_PLUGIN_EVD_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), LTTV_TYPE_PLUGIN_EVD, LttvPluginEVDClass))
+#define LTTV_IS_PLUGIN_EVD(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TYPE_PLUGIN_EVD))
+#define LTTV_IS_PLUGIN_EVD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LTTV_TYPE_PLUGIN_EVD))
+#define LTTV_PLUGIN_EVD_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), LTTV_TYPE_PLUGIN_EVD, LttvPluginEVDClass))
+
+typedef struct _LttvPluginEVD LttvPluginEVD;
+typedef struct _LttvPluginEVDClass LttvPluginEVDClass;
+
+struct _LttvPluginEVD {
+  LttvPlugin parent;
+
+  /* instance members */
+  EventViewerData *evd;
+
+  /* private */
+};
+
+struct _LttvPluginEVDClass {
+  LttvPluginClass parent;
+
+  /* class members */
+};
+
+/* used by LTTV_PLUGIN_TAB_TYPE */
+GType lttv_plugin_evd_get_type (void);
+
+/*
+ * Method definitions.
+ */
+
+
+#endif
This page took 0.036792 seconds and 4 git commands to generate.