filter starts to work
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 1 Sep 2005 23:53:19 +0000 (23:53 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 1 Sep 2005 23:53:19 +0000 (23:53 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1113 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/filter/filter.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h

index 7222a889e2d74406f28f47cd705a5c1a20f02c47..5a674589ecce0c30cad0439a17f4af9f0044c411 100644 (file)
@@ -125,6 +125,8 @@ typedef struct _EventViewerData {
   LttvTracesetContextPosition *first_event;  /* Time of the first event shown */
   LttvTracesetContextPosition *last_event;  /* Time of the first event shown */
 
+  LttvFilter *main_win_filter;
+
 } EventViewerData ;
 
 /** hook functions for update time interval, current time ... */
@@ -132,6 +134,7 @@ gboolean update_current_time(void * hook_data, void * call_data);
 gboolean update_current_position(void * hook_data, void * call_data);
 //gboolean show_event_detail(void * hook_data, void * call_data);
 gboolean traceset_changed(void * hook_data, void * call_data);
+gboolean filter_changed(void * hook_data, void * call_data);
 
 //! Event Viewer's constructor hook
 GtkWidget *h_gui_events(Tab *tab);
@@ -232,6 +235,8 @@ gui_events(Tab *tab)
                 update_current_position,event_viewer_data);
   lttvwindow_register_traceset_notify(tab, 
                 traceset_changed,event_viewer_data);
+  lttvwindow_register_filter_notify(tab,
+                filter_changed, event_viewer_data);
 
   event_viewer_data->scroll_win = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_show (event_viewer_data->scroll_win);
@@ -246,6 +251,8 @@ gui_events(Tab *tab)
   event_viewer_data->last_event =
     lttv_traceset_context_position_new(tsc);
 
+  event_viewer_data->main_win_filter = NULL;
+
   /* Create a model for storing the data list */
   event_viewer_data->store_m = gtk_list_store_new (
     N_COLUMNS,      /* Total number of columns     */
@@ -978,7 +985,7 @@ 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,
-          lttvwindow_get_filter(event_viewer_data->tab));
+          event_viewer_data->main_win_filter);
     } else if(relative_position < 0) {
       guint count;
       
@@ -993,7 +1000,7 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
       count = lttv_process_traceset_seek_n_backward(tsc, abs(relative_position),
           time_diff,
           (seek_time_fct)lttv_state_traceset_seek_time_closest,
-          lttvwindow_get_filter(event_viewer_data->tab));
+          event_viewer_data->main_win_filter);
     } /* else 0 : do nothing : we are already at the beginning position */
 
     lttv_traceset_context_position_destroy(pos);
@@ -1078,7 +1085,7 @@ int event_hook(void *hook_data, void *call_data)
   LttvTracefileContext *tfc = (LttvTracefileContext*)call_data;
   LttEvent *e = ltt_tracefile_get_event(tfc->tf);
 
-  LttvFilter *filter = lttvwindow_get_filter(event_viewer_data->tab);
+  LttvFilter *filter = event_viewer_data->main_win_filter;
   if(filter != NULL && filter->head != NULL)
     if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
           tfc->t_context->t,tfc))
@@ -1225,6 +1232,19 @@ gboolean traceset_changed(void * hook_data, void * call_data)
   return FALSE;
 }
 
+gboolean filter_changed(void * hook_data, void * call_data)
+{
+  EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
+  LttvTracesetContext * tsc =
+        lttvwindow_get_traceset_context(event_viewer_data->tab);
+
+  event_viewer_data->main_win_filter = 
+    (LttvFilter*)call_data;
+  g_signal_emit_by_name(event_viewer_data->vadjust_c, "value-changed");
+
+  return FALSE;
+}
+
 
 
 
@@ -1260,6 +1280,8 @@ void gui_events_free(EventViewerData *event_viewer_data)
     //                    show_event_detail, event_viewer_data);
     lttvwindow_unregister_traceset_notify(tab,
                         traceset_changed, event_viewer_data);
+    lttvwindow_unregister_filter_notify(tab,
+                        filter_changed, event_viewer_data);
 
     g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list,
         event_viewer_data);
index 893929b4ccb0be337cde5a0a1f63cdbad6b3f222..9b4af150327b1aec804659acaf75cdffbf65b105 100644 (file)
@@ -499,7 +499,8 @@ callback_process_button(GtkWidget *widget, gpointer data) {
     GString* s = g_string_new(gtk_entry_get_text(GTK_ENTRY(fvd->f_expression_field)));
     lttv_filter_append_expression(filter,s->str);
     g_string_free(s,TRUE);
-    SetFilter(fvd->tab,filter);
+    //SetFilter(fvd->tab,filter);
+    lttvwindow_report_filter(fvd->tab, filter);
   }
 }
 
index 060fcbc7dd64bd633a151699ba7cc152bf0292b6..22fe64137a274aa96078fb617d3cb6d9c61327d1 100644 (file)
@@ -514,7 +514,7 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
  *  0 : filters updated
  *  1 : no filter hooks to update; not an error.
  */
-
+#if 0
 int SetFilter(Tab * tab, gpointer filter)
 {
   LttvHooks * tmp;
@@ -530,7 +530,7 @@ int SetFilter(Tab * tab, gpointer filter)
 
   return 0;
 }
-
+#endif //0
 
 
 /**
@@ -3238,6 +3238,8 @@ void time_change_manager               (Tab *tab,
   LttTime start_time = new_time_window.start_time;
   LttTime end_time = new_time_window.end_time;
 
+  g_assert(ltt_time_compare(start_time, end_time) < 0);
+  
   /* Set scrollbar */
   GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar));
   LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time);
index 96a3a48b5388b103284167392874708cd6f0d846..179eab0ad157806f33bd85545ea64315d81a2d43 100644 (file)
@@ -1027,11 +1027,12 @@ LttTime lttvwindow_get_current_time(Tab *tab)
  * @param main_win, the main window the viewer belongs to.
  * @param filter, a pointer to a filter.
  */
-
+#if 0
 LttvFilter *lttvwindow_get_filter(Tab *tab)
 {
   return tab->filter;
 }
+#endif //0
 
 /**
  * Function to set the filter of the current tab.
index c555f7ae9174e79ddd02849d6b7f40c2e492258c..f7c7441f4010acb4f2e34985bf352bdb24d31d54 100644 (file)
@@ -727,7 +727,7 @@ LttTime lttvwindow_get_current_time(Tab *tab);
  * @param filter, a pointer to a filter.
  */
 
-LttvFilter *lttvwindow_get_filter(Tab *tab);
+//LttvFilter *lttvwindow_get_filter(Tab *tab);
 
 /**
  * Function to set the filter of the current tab.
This page took 0.027548 seconds and 4 git commands to generate.