From a998b781c5e28cb4a364ce09cd99dc1d3dbf6a06 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 1 Sep 2005 23:53:19 +0000 Subject: [PATCH] filter starts to work git-svn-id: http://ltt.polymtl.ca/svn@1113 04897980-b3bd-0310-b5e0-8ef037075253 --- .../lttv/modules/gui/detailedevents/events.c | 28 +++++++++++++++++-- .../poly/lttv/modules/gui/filter/filter.c | 3 +- .../gui/lttvwindow/lttvwindow/callbacks.c | 6 ++-- .../gui/lttvwindow/lttvwindow/lttvwindow.c | 3 +- .../gui/lttvwindow/lttvwindow/lttvwindow.h | 2 +- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index 7222a889..5a674589 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -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); diff --git a/ltt/branches/poly/lttv/modules/gui/filter/filter.c b/ltt/branches/poly/lttv/modules/gui/filter/filter.c index 893929b4..9b4af150 100644 --- a/ltt/branches/poly/lttv/modules/gui/filter/filter.c +++ b/ltt/branches/poly/lttv/modules/gui/filter/filter.c @@ -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); } } diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 060fcbc7..22fe6413 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -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); diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index 96a3a48b..179eab0a 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -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. diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h index c555f7ae..f7c7441f 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -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. -- 2.34.1