From: yangxx Date: Fri, 7 Nov 2003 20:50:37 +0000 (+0000) Subject: Filter for selecting trace and tracefile X-Git-Tag: v0.12.20~3156 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=49bf71b500f112cc90b790eb3975cceac351d021;p=lttv.git Filter for selecting trace and tracefile git-svn-id: http://ltt.polymtl.ca/svn@333 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/include/ltt/trace.h b/ltt/branches/poly/include/ltt/trace.h index aa5cb6ba..191422c6 100644 --- a/ltt/branches/poly/include/ltt/trace.h +++ b/ltt/branches/poly/include/ltt/trace.h @@ -15,6 +15,8 @@ LttTrace *ltt_trace_open(const char *pathname); /* copy reopens a trace */ LttTrace *ltt_trace_copy(LttTrace *self); +char * ltt_trace_name(LttTrace *t); + void ltt_trace_close(LttTrace *t); diff --git a/ltt/branches/poly/include/lttv/Makefile.am b/ltt/branches/poly/include/lttv/Makefile.am index 230e9ef3..3dc065b8 100644 --- a/ltt/branches/poly/include/lttv/Makefile.am +++ b/ltt/branches/poly/include/lttv/Makefile.am @@ -17,4 +17,5 @@ lttvinclude_HEADERS = \ stats.h\ textDump.h\ toolbar.h\ - traceset.h + traceset.h\ + lttvfilter.h diff --git a/ltt/branches/poly/include/lttv/common.h b/ltt/branches/poly/include/lttv/common.h index 0da0ccd7..81bf7c63 100644 --- a/ltt/branches/poly/include/lttv/common.h +++ b/ltt/branches/poly/include/lttv/common.h @@ -4,12 +4,14 @@ #include #include #include +#include typedef struct _MainWindow MainWindow; typedef struct _Tab Tab; /* constructor of the viewer */ -typedef GtkWidget * (*lttv_constructor)(MainWindow * main_window); +typedef GtkWidget * (*lttv_constructor)(MainWindow * main_window, + LttvTracesetSelector * s, char *key); typedef lttv_constructor view_constructor; typedef struct _TimeWindow { diff --git a/ltt/branches/poly/include/lttv/gtkmultivpaned.h b/ltt/branches/poly/include/lttv/gtkmultivpaned.h index 8819a895..7acaf19d 100644 --- a/ltt/branches/poly/include/lttv/gtkmultivpaned.h +++ b/ltt/branches/poly/include/lttv/gtkmultivpaned.h @@ -33,6 +33,7 @@ struct _GtkMultiVPaned GtkPaned * first_pane; GtkPaned * last_pane; GtkPaned * focused_pane; + GtkPaned * iter; guint num_children; GtkWidget * vbox; @@ -58,8 +59,11 @@ void gtk_multi_vpaned_widget_delete(GtkMultiVPaned * multi_vpaned); void gtk_multi_vpaned_widget_move_up(GtkMultiVPaned * multi_vpaned); void gtk_multi_vpaned_widget_move_down(GtkMultiVPaned * multi_vpaned); void gtk_multi_vpaned_set_adjust(GtkMultiVPaned * multi_vpaned, gboolean first_time); - - +void gtk_multi_vpaned_set_data(GtkMultiVPaned * multi_vpaned, char * key, gpointer value); +gpointer gtk_multi_vpaned_get_data(GtkMultiVPaned * multi_vpaned, char * key); +GtkWidget * gtk_multi_vpaned_get_widget(GtkMultiVPaned * multi_vpaned); +GtkWidget * gtk_multi_vpaned_get_first_widget(GtkMultiVPaned * multi_vpaned); +GtkWidget * gtk_multi_vpaned_get_next_widget(GtkMultiVPaned * multi_vpaned); #ifdef __cplusplus } diff --git a/ltt/branches/poly/include/lttv/lttvfilter.h b/ltt/branches/poly/include/lttv/lttvfilter.h new file mode 100644 index 00000000..b0d22bcb --- /dev/null +++ b/ltt/branches/poly/include/lttv/lttvfilter.h @@ -0,0 +1,39 @@ +#ifndef LTTV_FILTER_H +#define LTTV_FILTER_H + +#include + + +typedef struct _LttvTracesetSelector LttvTracesetSelector; +typedef struct _LttvTraceSelector LttvTraceSelector; +typedef struct _LttvTracefileSelector LttvTracefileSelector; + + +LttvTracesetSelector *lttv_traceset_selector_new(char * name); +LttvTraceSelector *lttv_trace_selector_new(LttTrace *t); +LttvTracefileSelector *lttv_tracefile_selector_new(LttTracefile *t); +void lttv_traceset_selector_destroy(LttvTracesetSelector *s); +void lttv_trace_selector_destroy(LttvTraceSelector *t); +void lttv_tracefile_selector_destroy(LttvTracefileSelector *t); + + +void lttv_traceset_selector_add(LttvTracesetSelector *s, LttvTraceSelector *t); +unsigned lttv_traceset_selector_number(LttvTracesetSelector *s); +LttvTraceSelector *lttv_traceset_selector_get(LttvTracesetSelector *s, unsigned i); +void lttv_traceset_selector_remove(LttvTracesetSelector *s, unsigned i); + + +void lttv_trace_selector_add(LttvTraceSelector *s, LttvTracefileSelector *t); +unsigned lttv_trace_selector_number(LttvTraceSelector *s); +LttvTracefileSelector *lttv_trace_selector_get(LttvTraceSelector *s, unsigned i); +void lttv_trace_selector_remove(LttvTraceSelector *s, unsigned i); + +void lttv_trace_selector_set_selected(LttvTraceSelector *s, gboolean g); +void lttv_tracefile_selector_set_selected(LttvTracefileSelector *s, gboolean g); +gboolean lttv_trace_selector_get_selected(LttvTraceSelector *s); +gboolean lttv_tracefile_selector_get_selected(LttvTracefileSelector *s); +char * lttv_trace_selector_get_name(LttvTraceSelector *s); +char * lttv_tracefile_selector_get_name(LttvTracefileSelector *s); + +#endif // LTTV_FILTER_H + diff --git a/ltt/branches/poly/include/lttv/traceset.h b/ltt/branches/poly/include/lttv/traceset.h index 2f43a228..cb844220 100644 --- a/ltt/branches/poly/include/lttv/traceset.h +++ b/ltt/branches/poly/include/lttv/traceset.h @@ -15,6 +15,8 @@ typedef struct _LttvTrace LttvTrace; LttvTraceset *lttv_traceset_new(); +char * lttv_traceset_name(LttvTraceset * s); + LttvTrace *lttv_trace_new(LttTrace *t); LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig); diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index f98c171c..3d213971 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -458,6 +458,12 @@ LttTrace *ltt_trace_open(const char *pathname) return t; } +char * ltt_trace_name(LttTrace *t) +{ + return t->pathname; +} + + /****************************************************************************** * When we copy a trace, we want all the opening actions to happen again : * the trace will be reopened and totally independant from the original. diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/Makefile.am b/ltt/branches/poly/lttv/modules/gui/mainWin/src/Makefile.am index 4e12e16e..e65b712e 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/Makefile.am @@ -24,7 +24,8 @@ libmainwin_la_SOURCES = \ interface.c \ callbacks.c \ gtkmultivpaned.c \ - gtkdirsel.c + gtkdirsel.c \ + lttvfilter.c noinst_HEADERS = \ support.h \ diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c index b279afec..df9aa693 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c @@ -15,11 +15,12 @@ #include #include #include +#include #define PATH_LENGTH 256 #define DEFAULT_TIME_WIDTH_S 1 -extern LttTrace *g_init_trace ; +extern LttvTrace *g_init_trace ; /** Array containing instanced objects. */ @@ -31,10 +32,27 @@ MainWindow * get_window_data_struct(GtkWidget * widget); char * get_unload_module(char ** loaded_module_name, int nb_module); char * get_remove_trace(char ** all_trace_name, int nb_trace); char * get_selection(char ** all_name, int nb, char *title, char * column_title); +void get_filter_selection(LttvTracesetSelector *s, char *title, char * column_title); void * create_tab(MainWindow * parent, MainWindow * current_window, GtkNotebook * notebook, char * label); void insert_viewer(GtkWidget* widget, view_constructor constructor); +void update_filter(LttvTracesetSelector *s, GtkTreeStore *store ); + +void checkbox_changed(GtkTreeView *treeview, + GtkTreePath *arg1, + GtkTreeViewColumn *arg2, + gpointer user_data); +void remove_trace_from_traceset_selector(GtkMultiVPaned * paned, unsigned i); +void add_trace_into_traceset_selector(GtkMultiVPaned * paned, LttTrace * trace); + +LttvTracesetSelector * construct_traceset_selector(LttvTraceset * traceset); + +enum { + CHECKBOX_COLUMN, + NAME_COLUMN, + TOTAL_COLUMNS +}; enum { @@ -43,6 +61,39 @@ enum }; +LttvTracesetSelector * construct_traceset_selector(LttvTraceset * traceset) +{ + LttvTracesetSelector * s; + LttvTraceSelector * trace; + LttvTracefileSelector * tracefile; + int i, j, nb_trace, nb_tracefile, nb_control, nb_per_cpu; + LttvTrace * trace_v; + LttTrace * t; + LttTracefile *tf; + + s = lttv_traceset_selector_new(lttv_traceset_name(traceset)); + nb_trace = lttv_traceset_number(traceset); + for(i=0;icurrent_tab) return; multi_vpaned = mw_data->current_tab->multi_vpaned; - viewer = (GtkWidget*)constructor(mw_data); + s = construct_traceset_selector(mw_data->current_tab->traceset_info->traceset); + viewer = (GtkWidget*)constructor(mw_data, s, "Traceset_Selector"); if(viewer) { gtk_multi_vpaned_widget_add(multi_vpaned, viewer); @@ -212,6 +265,38 @@ void open_traceset(GtkWidget * widget, gpointer user_data) } +void add_trace_into_traceset_selector(GtkMultiVPaned * paned, LttTrace * t) +{ + int j, nb_tracefile, nb_control, nb_per_cpu; + LttvTracesetSelector * s; + LttvTraceSelector * trace; + LttvTracefileSelector * tracefile; + LttTracefile * tf; + GtkWidget * w; + + w = gtk_multi_vpaned_get_first_widget(paned); + while(w){ + s = g_object_get_data(G_OBJECT(w), "Traceset_Selector"); + + trace = lttv_trace_selector_new(t); + lttv_traceset_selector_add(s, trace); + nb_control = ltt_trace_control_tracefile_number(t); + nb_per_cpu = ltt_trace_per_cpu_tracefile_number(t); + nb_tracefile = nb_control + nb_per_cpu; + + for(j = 0 ; j < nb_tracefile ; j++) { + if(j < nb_control) + tf = ltt_trace_control_tracefile_get(t, j); + else + tf = ltt_trace_per_cpu_tracefile_get(t, j - nb_control); + tracefile = lttv_tracefile_selector_new(tf); + lttv_trace_selector_add(trace, tracefile); + } + + w = gtk_multi_vpaned_get_next_widget(paned); + } +} + void add_trace(GtkWidget * widget, gpointer user_data) { LttTrace *trace; @@ -242,14 +327,36 @@ void add_trace(GtkWidget * widget, gpointer user_data) g_object_new(LTTV_TRACESET_STATS_TYPE, NULL); lttv_context_init( LTTV_TRACESET_CONTEXT(mw_data->current_tab->traceset_info-> - traceset_context),traceset); + traceset_context),traceset); + add_trace_into_traceset_selector(mw_data->current_tab->multi_vpaned, trace); + + gtk_widget_destroy((GtkWidget*)file_selector); + + //update current tab + // set_current_time(mw_data, &(mw_data->current_tab->current_time)); + break; case GTK_RESPONSE_REJECT: case GTK_RESPONSE_CANCEL: default: gtk_widget_destroy((GtkWidget*)file_selector); break; } - g_printf("add a trace to a trace set\n"); +} + +void remove_trace_from_traceset_selector(GtkMultiVPaned * paned, unsigned i) +{ + LttvTracesetSelector * s; + LttvTraceSelector * t; + GtkWidget * w; + + w = gtk_multi_vpaned_get_first_widget(paned); + while(w){ + s = g_object_get_data(G_OBJECT(w), "Traceset_Selector"); + t = lttv_traceset_selector_get(s,i); + lttv_traceset_selector_remove(s, i); + lttv_trace_selector_destroy(t); + w = gtk_multi_vpaned_get_next_widget(paned); + } } void remove_trace(GtkWidget * widget, gpointer user_data) @@ -260,6 +367,10 @@ void remove_trace(GtkWidget * widget, gpointer user_data) gint i, nb_trace; char ** name, *remove_trace_name; MainWindow * mw_data = get_window_data_struct(widget); + LttvTracesetSelector * s; + LttvTraceSelector * t; + GtkWidget * w; + gboolean selected; nb_trace =lttv_traceset_number(mw_data->current_tab->traceset_info->traceset); name = g_new(char*,nb_trace); @@ -275,25 +386,52 @@ void remove_trace(GtkWidget * widget, gpointer user_data) if(remove_trace_name){ for(i=0; icurrent_tab->traceset_info->traceset; - if(mw_data->current_tab->traceset_info->traceset_context != NULL){ - lttv_context_fini(LTTV_TRACESET_CONTEXT(mw_data->current_tab-> - traceset_info->traceset_context)); - g_object_unref(mw_data->current_tab->traceset_info->traceset_context); + //unselect the trace from the current viewer + w = gtk_multi_vpaned_get_widget(mw_data->current_tab->multi_vpaned); + s = g_object_get_data(G_OBJECT(w), "Traceset_Selector"); + t = lttv_traceset_selector_get(s,i); + lttv_trace_selector_set_selected(t, FALSE); + + //check if other viewers select the trace + w = gtk_multi_vpaned_get_first_widget(mw_data->current_tab->multi_vpaned); + while(w){ + s = g_object_get_data(G_OBJECT(w), "Traceset_Selector"); + t = lttv_traceset_selector_get(s,i); + selected = lttv_trace_selector_get_selected(t); + if(selected)break; + w = gtk_multi_vpaned_get_next_widget(mw_data->current_tab->multi_vpaned); + } + + //if no viewer selects the trace, remove it + if(!selected){ + remove_trace_from_traceset_selector(mw_data->current_tab->multi_vpaned, i); + + traceset = mw_data->current_tab->traceset_info->traceset; + trace_v = lttv_traceset_get(traceset, i); + if(lttv_trace_get_ref_number(trace_v) <= 1) + ltt_trace_close(lttv_trace(trace_v)); + + if(mw_data->current_tab->traceset_info->traceset_context != NULL){ + lttv_context_fini(LTTV_TRACESET_CONTEXT(mw_data->current_tab-> + traceset_info->traceset_context)); + g_object_unref(mw_data->current_tab->traceset_info->traceset_context); + } + lttv_traceset_remove(traceset, i); + lttv_trace_destroy(trace_v); + mw_data->current_tab->traceset_info->traceset_context = + g_object_new(LTTV_TRACESET_STATS_TYPE, NULL); + lttv_context_init( + LTTV_TRACESET_CONTEXT(mw_data->current_tab-> + traceset_info->traceset_context),traceset); + //update current tab + // set_current_time(mw_data, &(mw_data->current_tab->current_time)); } - lttv_traceset_remove(traceset, i); - mw_data->current_tab->traceset_info->traceset_context = - g_object_new(LTTV_TRACESET_STATS_TYPE, NULL); - lttv_context_init( - LTTV_TRACESET_CONTEXT(mw_data->current_tab-> - traceset_info->traceset_context),traceset); break; } } } g_free(name); - g_printf("remove a trace from a trace set\n"); } void save(GtkWidget * widget, gpointer user_data) @@ -587,6 +725,28 @@ on_remove_viewer_activate (GtkMenuItem *menuitem, delete_viewer((GtkWidget*)menuitem, user_data); } +void +on_trace_filter_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem); + LttvTracesetSelector * s; + GtkWidget * w = gtk_multi_vpaned_get_widget(mw_data->current_tab->multi_vpaned); + + s = g_object_get_data(G_OBJECT(w), "Traceset_Selector"); + if(!s){ + g_printf("There is no viewer yet\n"); + return; + } + get_filter_selection(s, "Configure trace and tracefile filter", "Select traces and tracefiles"); +} + +void +on_trace_facility_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + g_printf("Trace facility selector: %s\n"); +} void on_load_module_activate (GtkMenuItem *menuitem, @@ -866,6 +1026,152 @@ on_MNotebook_switch_page (GtkNotebook *notebook, mw->current_tab = tab; } +void checkbox_changed(GtkTreeView *treeview, + GtkTreePath *arg1, + GtkTreeViewColumn *arg2, + gpointer user_data) +{ + GtkTreeStore * store = (GtkTreeStore *)gtk_tree_view_get_model (treeview); + GtkTreeIter iter; + gboolean value; + + if (gtk_tree_model_get_iter ((GtkTreeModel *)store, &iter, arg1)){ + gtk_tree_model_get ((GtkTreeModel *)store, &iter, CHECKBOX_COLUMN, &value, -1); + value = value? FALSE : TRUE; + gtk_tree_store_set (GTK_TREE_STORE (store), &iter, CHECKBOX_COLUMN, value, -1); + } + +} + +void update_filter(LttvTracesetSelector *s, GtkTreeStore *store ) +{ + GtkTreeIter iter, child_iter; + int i, j; + LttvTraceSelector * trace; + LttvTracefileSelector * tracefile; + gboolean value, value1; + + if(gtk_tree_model_get_iter_first((GtkTreeModel*)store, &iter)){ + i = 0; + do{ + trace = lttv_traceset_selector_get(s, i); + gtk_tree_model_get ((GtkTreeModel*)store, &iter, CHECKBOX_COLUMN, &value,-1); + if(value){ + j = 0; + if(gtk_tree_model_iter_children ((GtkTreeModel*)store, &child_iter, &iter)){ + do{ + tracefile = lttv_trace_selector_get(trace, j); + gtk_tree_model_get ((GtkTreeModel*)store, &child_iter, CHECKBOX_COLUMN, &value1,-1); + lttv_tracefile_selector_set_selected(tracefile,value1); + j++; + }while(gtk_tree_model_iter_next((GtkTreeModel*)store, &child_iter)); + } + } + lttv_trace_selector_set_selected(trace,value); + i++; + }while(gtk_tree_model_iter_next((GtkTreeModel*)store, &iter)); + } +} + +void get_filter_selection(LttvTracesetSelector *s,char *title, char * column_title) +{ + GtkWidget * dialogue; + GtkTreeStore * store; + GtkWidget * tree; + GtkWidget * scroll_win; + GtkCellRenderer * renderer; + GtkTreeViewColumn * column; + GtkTreeIter iter, child_iter; + int i, j, id, nb_trace, nb_tracefile; + LttvTraceSelector * trace; + LttvTracefileSelector * tracefile; + char * name; + gboolean checked; + + dialogue = gtk_dialog_new_with_buttons(title, + NULL, + GTK_DIALOG_MODAL, + GTK_STOCK_OK,GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL,GTK_RESPONSE_REJECT, + NULL); + gtk_window_set_default_size((GtkWindow*)dialogue, 300, 100); + + store = gtk_tree_store_new (TOTAL_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING); + tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); + g_object_unref (G_OBJECT (store)); + g_signal_connect (G_OBJECT (tree), "row-activated", + G_CALLBACK (checkbox_changed), + NULL); + + + renderer = gtk_cell_renderer_toggle_new (); + gtk_cell_renderer_toggle_set_radio((GtkCellRendererToggle *)renderer, FALSE); + + g_object_set (G_OBJECT (renderer),"activatable", TRUE, NULL); + + column = gtk_tree_view_column_new_with_attributes ("Checkbox", + renderer, + "active", CHECKBOX_COLUMN, + NULL); + gtk_tree_view_column_set_alignment (column, 0.5); + gtk_tree_view_column_set_fixed_width (column, 20); + gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column); + + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (column_title, + renderer, + "text", NAME_COLUMN, + NULL); + gtk_tree_view_column_set_alignment (column, 0.0); + gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (tree), FALSE); + + scroll_win = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win), + GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); + gtk_container_add (GTK_CONTAINER (scroll_win), tree); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialogue)->vbox), scroll_win,TRUE, TRUE,0); + + gtk_widget_show(scroll_win); + gtk_widget_show(tree); + + nb_trace = lttv_traceset_selector_number(s); + for(i=0;itraceset_info->traceset, i); ref_count = lttv_trace_get_ref_number(trace); - if(ref_count <= 1) + if(ref_count <= 1){ ltt_trace_close(lttv_trace(trace)); + } + lttv_trace_destroy(trace); } } lttv_traceset_destroy(tab_instance->traceset_info->traceset); @@ -1149,11 +1457,10 @@ void * create_tab(MainWindow * parent, MainWindow* current_window, lttv_traceset_copy(mw_data->current_tab->traceset_info->traceset); }else{ tmp_tab->traceset_info->traceset = lttv_traceset_new(); + /* Add the command line trace */ + if(g_init_trace != NULL) + lttv_traceset_add(tmp_tab->traceset_info->traceset, g_init_trace); } - - /* Add the command line trace */ - if(g_init_trace != NULL && parent == NULL) - lttv_traceset_add(tmp_tab->traceset_info->traceset, g_init_trace); } //FIXME copy not implemented in lower level tmp_tab->traceset_info->traceset_context = diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.h b/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.h index 95a24cb9..6efc450f 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.h +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.h @@ -104,6 +104,14 @@ void on_remove_viewer_activate (GtkMenuItem *menuitem, gpointer user_data); +void +on_trace_filter_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_trace_facility_activate (GtkMenuItem *menuitem, + gpointer user_data); + void on_load_module_activate (GtkMenuItem *menuitem, gpointer user_data); diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkmultivpaned.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkmultivpaned.c index 9c59a319..454351ed 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkmultivpaned.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkmultivpaned.c @@ -66,6 +66,7 @@ gtk_multi_vpaned_init (GtkMultiVPaned * multi_vpaned) multi_vpaned->first_pane = NULL; multi_vpaned->last_pane = NULL; multi_vpaned->focused_pane = NULL; + multi_vpaned->iter = NULL; multi_vpaned->num_children = 0; multi_vpaned->vbox = NULL; @@ -80,6 +81,39 @@ GtkWidget* gtk_multi_vpaned_new () return GTK_WIDGET (g_object_new (gtk_multi_vpaned_get_type (), NULL)); } +GtkWidget * gtk_multi_vpaned_get_widget(GtkMultiVPaned * multi_vpaned) +{ + if(multi_vpaned->focused_pane == NULL)return NULL; + return (GtkWidget*)multi_vpaned->focused_pane->child2; +} + +GtkWidget * gtk_multi_vpaned_get_first_widget(GtkMultiVPaned * multi_vpaned) +{ + if(multi_vpaned->first_pane == NULL)return NULL; + multi_vpaned->iter = multi_vpaned->first_pane; + return multi_vpaned->first_pane->child2; +} + +GtkWidget * gtk_multi_vpaned_get_next_widget(GtkMultiVPaned * multi_vpaned) +{ + if(multi_vpaned->iter != multi_vpaned->last_pane){ + multi_vpaned->iter = (GtkPaned *)multi_vpaned->iter->child1; + return multi_vpaned->iter->child2; + }else { + return NULL; + } +} + +void gtk_multi_vpaned_set_data(GtkMultiVPaned * multi_vpaned,char * key, gpointer value) +{ + g_object_set_data(G_OBJECT(multi_vpaned->focused_pane), key, value); +} + +gpointer gtk_multi_vpaned_get_data(GtkMultiVPaned * multi_vpaned,char * key) +{ + if(multi_vpaned->focused_pane == NULL)return NULL; + return g_object_get_data(G_OBJECT(multi_vpaned->focused_pane), key); +} void gtk_multi_vpaned_set_focus (GtkWidget * widget, gpointer user_data) { diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/interface.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/interface.c index 91944afe..a749a721 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/interface.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/interface.c @@ -37,7 +37,7 @@ create_MWindow (void) GtkWidget *FileMenuTitle_menu; GtkWidget *FileMenuNewTitle; GtkWidget *FileMenuNewTitle_menu; - GtkWidget *EmptyTraceset; + // GtkWidget *EmptyTraceset; GtkWidget *CloneTraceset; GtkWidget *FileMenuNewSep; GtkWidget *Tab; @@ -71,6 +71,9 @@ create_MWindow (void) GtkWidget *MoveViewerDown; GtkWidget *RemoveViewer; GtkWidget *ToolMenuSeparator; + GtkWidget *Filter; + // GtkWidget *Facility; + GtkWidget *ToolMenuSeparator1; // GtkWidget *insert_viewer_test; GtkWidget *PluginMenuTitle; GtkWidget *PluginMenuTitle_menu; @@ -145,11 +148,12 @@ create_MWindow (void) FileMenuNewTitle_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (FileMenuNewTitle), FileMenuNewTitle_menu); - EmptyTraceset = gtk_menu_item_new_with_mnemonic ("Empty trace set"); - gtk_widget_show (EmptyTraceset); - gtk_container_add (GTK_CONTAINER (FileMenuNewTitle_menu), EmptyTraceset); + // EmptyTraceset = gtk_menu_item_new_with_mnemonic ("Empty trace set"); + // gtk_widget_show (EmptyTraceset); + // gtk_container_add (GTK_CONTAINER (FileMenuNewTitle_menu), EmptyTraceset); - CloneTraceset = gtk_menu_item_new_with_mnemonic ("Clone trace set"); + // CloneTraceset = gtk_menu_item_new_with_mnemonic ("Clone trace set"); + CloneTraceset = gtk_menu_item_new_with_mnemonic ("New window"); gtk_widget_show (CloneTraceset); gtk_container_add (GTK_CONTAINER (FileMenuNewTitle_menu), CloneTraceset); @@ -283,6 +287,19 @@ create_MWindow (void) gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu), ToolMenuSeparator); gtk_widget_set_sensitive (ToolMenuSeparator, FALSE); + Filter = gtk_menu_item_new_with_mnemonic ("Trace Filter Selector"); + gtk_widget_show (Filter); + gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu), Filter); + + // Facility = gtk_menu_item_new_with_mnemonic ("Facility Selector"); + // gtk_widget_show (Facility); + // gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu), Facility); + + ToolMenuSeparator1 = gtk_menu_item_new (); + gtk_widget_show (ToolMenuSeparator1); + gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu), ToolMenuSeparator1); + gtk_widget_set_sensitive (ToolMenuSeparator1, FALSE); + // insert_viewer_test = gtk_menu_item_new_with_mnemonic ("Insert viewer test"); // gtk_widget_show (insert_viewer_test); // gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu), insert_viewer_test); @@ -364,7 +381,8 @@ create_MWindow (void) GTK_TOOLBAR_CHILD_BUTTON, NULL, "", - "New window with empty trace set", NULL, + "New window", NULL, + //"New window with empty trace set", NULL, tmp_toolbar_icon, NULL, NULL); gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR (MToolbar1)->children)->data))->label), TRUE); gtk_widget_show (tlbEmptyTraceset); @@ -542,9 +560,9 @@ create_MWindow (void) g_signal_connect ((gpointer) MWindow, "destroy", G_CALLBACK (on_MWindow_destroy), NULL); - g_signal_connect ((gpointer) EmptyTraceset, "activate", - G_CALLBACK (on_empty_traceset_activate), - NULL); + // g_signal_connect ((gpointer) EmptyTraceset, "activate", + // G_CALLBACK (on_empty_traceset_activate), + // NULL); g_signal_connect ((gpointer) CloneTraceset, "activate", G_CALLBACK (on_clone_traceset_activate), NULL); @@ -619,6 +637,12 @@ create_MWindow (void) g_signal_connect ((gpointer) RemoveViewer, "activate", G_CALLBACK (on_remove_viewer_activate), NULL); + g_signal_connect ((gpointer) Filter, "activate", + G_CALLBACK (on_trace_filter_activate), + NULL); + // g_signal_connect ((gpointer) Facility, "activate", + // G_CALLBACK (on_trace_facility_activate), + // NULL); // g_signal_connect ((gpointer) insert_viewer_test, "activate", // G_CALLBACK (on_insert_viewer_test_activate), // NULL); @@ -709,7 +733,7 @@ create_MWindow (void) GLADE_HOOKUP_OBJECT (MWindow, FileMenuTitle_menu, "FileMenuTitle_menu"); GLADE_HOOKUP_OBJECT (MWindow, FileMenuNewTitle, "FileMenuNewTitle"); GLADE_HOOKUP_OBJECT (MWindow, FileMenuNewTitle_menu, "FileMenuNewTitle_menu"); - GLADE_HOOKUP_OBJECT (MWindow, EmptyTraceset, "EmptyTraceset"); + // GLADE_HOOKUP_OBJECT (MWindow, EmptyTraceset, "EmptyTraceset"); GLADE_HOOKUP_OBJECT (MWindow, CloneTraceset, "CloneTraceset"); GLADE_HOOKUP_OBJECT (MWindow, FileMenuNewSep, "FileMenuNewSep"); GLADE_HOOKUP_OBJECT (MWindow, Tab, "Tab"); @@ -743,6 +767,9 @@ create_MWindow (void) GLADE_HOOKUP_OBJECT (MWindow, MoveViewerDown, "MoveViewerDown"); GLADE_HOOKUP_OBJECT (MWindow, RemoveViewer, "RemoveViewer"); GLADE_HOOKUP_OBJECT (MWindow, ToolMenuSeparator, "ToolMenuSeparator"); + GLADE_HOOKUP_OBJECT (MWindow, Filter, "Filter"); + // GLADE_HOOKUP_OBJECT (MWindow, Facility, "Facility"); + GLADE_HOOKUP_OBJECT (MWindow, ToolMenuSeparator1, "ToolMenuSeparator1"); // GLADE_HOOKUP_OBJECT (MWindow, insert_viewer_test, "insert_viewer_test"); GLADE_HOOKUP_OBJECT (MWindow, PluginMenuTitle, "PluginMenuTitle"); GLADE_HOOKUP_OBJECT (MWindow, PluginMenuTitle_menu, "PluginMenuTitle_menu"); diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/lttvfilter.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/lttvfilter.c new file mode 100644 index 00000000..24221569 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/lttvfilter.c @@ -0,0 +1,165 @@ + +#include +#include + +struct _LttvTracesetSelector { + char * traceset_name; + GPtrArray *traces; +}; + + +struct _LttvTraceSelector { + char * trace_name; + GPtrArray * tracefiles; + gboolean selected; +}; + +struct _LttvTracefileSelector { + char * tracefile_name; + gboolean selected; +}; + + +LttvTracesetSelector *lttv_traceset_selector_new(char * name) +{ + LttvTracesetSelector *s; + + s = g_new(LttvTracesetSelector, 1); + if(name) + s->traceset_name = g_strdup(name); + else + s->traceset_name = NULL; + s->traces = g_ptr_array_new(); + return s; +} + +LttvTraceSelector *lttv_trace_selector_new(LttTrace *t) +{ + LttvTraceSelector * trace; + + trace = g_new(LttvTraceSelector, 1); + trace->trace_name = g_strdup(ltt_trace_name(t)); + trace->tracefiles = g_ptr_array_new(); + trace->selected = TRUE; + return trace; +} + +LttvTracefileSelector *lttv_tracefile_selector_new(LttTracefile *t) +{ + LttvTracefileSelector * tracefile; + + tracefile = g_new(LttvTracefileSelector, 1); + tracefile->tracefile_name = g_strdup(ltt_tracefile_name(t)); + tracefile->selected = TRUE; + return tracefile; +} + + +void lttv_traceset_selector_destroy(LttvTracesetSelector *s) +{ + int i; + LttvTraceSelector * t; + + for(i=0;itraces->len;i++){ + t = (LttvTraceSelector*)s->traces->pdata[i]; + lttv_trace_selector_destroy(t); + } + g_ptr_array_free(s->traces, TRUE); + if(s->traceset_name) g_free(s->traceset_name); + g_free(s); +} + +void lttv_trace_selector_destroy(LttvTraceSelector *s) +{ + int i; + LttvTracefileSelector * t; + + for(i=0;itracefiles->len;i++){ + t = (LttvTracefileSelector*)s->tracefiles->pdata[i]; + lttv_tracefile_selector_destroy(t); + } + if(s->trace_name) g_free(s->trace_name); + g_free(s); +} + +void lttv_tracefile_selector_destroy(LttvTracefileSelector *t) +{ + if(t->tracefile_name) g_free(t->tracefile_name); + g_free(t); +} + +void lttv_traceset_selector_add(LttvTracesetSelector *s, LttvTraceSelector *t) +{ + g_ptr_array_add(s->traces, t); +} + +void lttv_trace_selector_add(LttvTraceSelector *s, LttvTracefileSelector *t) +{ + g_ptr_array_add(s->tracefiles, t); +} + + +unsigned lttv_traceset_selector_number(LttvTracesetSelector *s) +{ + return s->traces->len; +} + +unsigned lttv_trace_selector_number(LttvTraceSelector *s) +{ + return s->tracefiles->len; +} + +LttvTraceSelector *lttv_traceset_selector_get(LttvTracesetSelector *s, unsigned i) +{ + g_assert(s->traces->len > i); + return ((LttvTraceSelector *)s->traces->pdata[i]); +} + +LttvTracefileSelector *lttv_trace_selector_get(LttvTraceSelector *s, unsigned i) +{ + g_assert(s->tracefiles->len > i); + return ((LttvTracefileSelector *)s->tracefiles->pdata[i]); +} + +void lttv_traceset_selector_remove(LttvTracesetSelector *s, unsigned i) +{ + g_assert(s->traces->len > i); + g_ptr_array_remove_index(s->traces, i); +} + +void lttv_trace_selector_remove(LttvTraceSelector *s, unsigned i) +{ + g_assert(s->tracefiles->len > i); + g_ptr_array_remove_index(s->tracefiles, i); +} + + +void lttv_trace_selector_set_selected(LttvTraceSelector *s, gboolean g) +{ + s->selected = g; +} + +void lttv_tracefile_selector_set_selected(LttvTracefileSelector *s, gboolean g) +{ + s->selected = g; +} + +gboolean lttv_trace_selector_get_selected(LttvTraceSelector *s) +{ + return s->selected; +} + +gboolean lttv_tracefile_selector_get_selected(LttvTracefileSelector *s) +{ + return s->selected; +} + +char * lttv_trace_selector_get_name(LttvTraceSelector *s) +{ + return s->trace_name; +} + +char * lttv_tracefile_selector_get_name(LttvTracefileSelector *s) +{ + return s->tracefile_name; +} diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c index ba123f41..06f413ca 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c @@ -302,7 +302,7 @@ void send_test_process(ProcessList *Process_List, Drawing_t *Drawing) * @return The widget created. */ GtkWidget * -hGuiControlFlow(MainWindow *pmParentWindow) +hGuiControlFlow(MainWindow *pmParentWindow, LttvTracesetSelector * s, char * key) { g_critical("hGuiControlFlow"); ControlFlowData *Control_Flow_Data = GuiControlFlow() ; diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h index 5f7672ab..0d9baa1c 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h @@ -14,7 +14,7 @@ void send_test_data(ProcessList *Process_List, Drawing_t *Drawing); -GtkWidget *hGuiControlFlow(MainWindow *pmParentWindow); +GtkWidget *hGuiControlFlow(MainWindow *pmParentWindow, LttvTracesetSelector * s, char * key); int Event_Selected_Hook(void *hook_data, void *call_data); diff --git a/ltt/branches/poly/lttv/modules/guiEvents.c b/ltt/branches/poly/lttv/modules/guiEvents.c index 66f10d9b..94fc4a2d 100644 --- a/ltt/branches/poly/lttv/modules/guiEvents.c +++ b/ltt/branches/poly/lttv/modules/guiEvents.c @@ -129,9 +129,9 @@ typedef struct _EventViewerData { } EventViewerData ; //! Event Viewer's constructor hook -GtkWidget *h_gui_events(MainWindow *parent_window); +GtkWidget *h_gui_events(MainWindow *parent_window, LttvTracesetSelector * s, char* key); //! Event Viewer's constructor -EventViewerData *gui_events(MainWindow *parent_window); +EventViewerData *gui_events(MainWindow *parent_window, LttvTracesetSelector *s, char *key); //! Event Viewer's destructor void gui_events_destructor(EventViewerData *event_viewer_data); void gui_events_free(EventViewerData *event_viewer_data); @@ -235,9 +235,9 @@ enum * @return The widget created. */ GtkWidget * -h_gui_events(MainWindow * parent_window) +h_gui_events(MainWindow * parent_window, LttvTracesetSelector * s, char* key) { - EventViewerData* event_viewer_data = gui_events(parent_window) ; + EventViewerData* event_viewer_data = gui_events(parent_window, s, key) ; if(event_viewer_data) return event_viewer_data->hbox_v; @@ -252,7 +252,7 @@ h_gui_events(MainWindow * parent_window) * @return The Event viewer data created. */ EventViewerData * -gui_events(MainWindow *parent_window) +gui_events(MainWindow *parent_window, LttvTracesetSelector * s,char* key ) { LttTime start, end; GtkTreeViewColumn *column; @@ -456,6 +456,11 @@ gui_events(MainWindow *parent_window) // tree_v_set_cursor(event_viewer_data); + g_object_set_data( + G_OBJECT(event_viewer_data->hbox_v), + key, + s); + g_object_set_data_full( G_OBJECT(event_viewer_data->hbox_v), "event_viewer_data", diff --git a/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c b/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c index e23227f2..230cd842 100644 --- a/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c +++ b/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c @@ -33,9 +33,9 @@ static GSList *g_statistic_viewer_data_list = NULL ; typedef struct _StatisticViewerData StatisticViewerData; //! Statistic Viewer's constructor hook -GtkWidget *h_gui_statistic(MainWindow *parent_window); +GtkWidget *h_gui_statistic(MainWindow *parent_window, LttvTracesetSelector * s, char* key); //! Statistic Viewer's constructor -StatisticViewerData *gui_statistic(MainWindow *parent_window); +StatisticViewerData *gui_statistic(MainWindow *parent_window,LttvTracesetSelector * s, char* key); //! Statistic Viewer's destructor void gui_statistic_destructor(StatisticViewerData *statistic_viewer_data); void gui_statistic_free(StatisticViewerData *statistic_viewer_data); @@ -164,9 +164,9 @@ gui_statistic_destructor(StatisticViewerData *statistic_viewer_data) * @return The widget created. */ GtkWidget * -h_gui_statistic(MainWindow * parent_window) +h_gui_statistic(MainWindow * parent_window, LttvTracesetSelector * s, char* key) { - StatisticViewerData* statistic_viewer_data = gui_statistic(parent_window) ; + StatisticViewerData* statistic_viewer_data = gui_statistic(parent_window, s, key) ; if(statistic_viewer_data) return statistic_viewer_data->hpaned_v; @@ -181,7 +181,7 @@ h_gui_statistic(MainWindow * parent_window) * @return The Statistic viewer data created. */ StatisticViewerData * -gui_statistic(MainWindow *parent_window) +gui_statistic(MainWindow *parent_window, LttvTracesetSelector * s, char* key) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; @@ -251,6 +251,11 @@ gui_statistic(MainWindow *parent_window) gtk_widget_show(statistic_viewer_data->text_v); gtk_widget_show(statistic_viewer_data->hpaned_v); + g_object_set_data( + G_OBJECT(statistic_viewer_data->hpaned_v), + key, + s); + g_object_set_data_full( G_OBJECT(statistic_viewer_data->hpaned_v), "statistic_viewer_data", diff --git a/ltt/branches/poly/lttv/traceset.c b/ltt/branches/poly/lttv/traceset.c index 508afb16..ce96b99a 100644 --- a/ltt/branches/poly/lttv/traceset.c +++ b/ltt/branches/poly/lttv/traceset.c @@ -33,6 +33,11 @@ LttvTraceset *lttv_traceset_new() return s; } +char * lttv_traceset_name(LttvTraceset * s) +{ + return s->filename; +} + LttvTrace *lttv_trace_new(LttTrace *t) { LttvTrace *new_trace;