From e433e6d6da2cc572a3d14257abe18bc3afd5c7e6 Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 23 Jun 2006 20:15:30 +0000 Subject: [PATCH] add plugin interface to objects git-svn-id: http://ltt.polymtl.ca/svn@1962 04897980-b3bd-0310-b5e0-8ef037075253 --- .../lttv/modules/gui/controlflow/Makefile.am | 4 +- .../poly/lttv/modules/gui/controlflow/cfv.c | 135 +++++++++++++--- .../poly/lttv/modules/gui/controlflow/cfv.h | 17 +- .../lttv/modules/gui/controlflow/eventhooks.c | 10 +- .../lttv/modules/gui/controlflow/eventhooks.h | 4 +- .../lttv/modules/gui/controlflow/module.c | 3 +- .../lttv/modules/gui/detailedevents/events.c | 16 +- .../gui/diskperformance/diskperformance.c | 22 +-- .../poly/lttv/modules/gui/filter/filter.c | 27 ++-- .../lttv/modules/gui/histogram/histocfv.c | 6 +- .../lttv/modules/gui/histogram/histocfv.h | 5 +- .../modules/gui/histogram/histoeventhooks.c | 8 +- .../modules/gui/histogram/histoeventhooks.h | 2 +- .../lttv/modules/gui/interrupts/interrupts.c | 17 +- .../gui/lttvwindow/lttvwindow/Makefile.am | 8 +- .../gui/lttvwindow/lttvwindow/callbacks.c | 150 +++++++++++++----- .../gui/lttvwindow/lttvwindow/lttvwindow.c | 7 +- .../gui/lttvwindow/lttvwindow/lttvwindow.h | 3 +- .../lttvwindow/mainwindow-private.h | 2 +- .../gui/lttvwindow/pixmaps/Makefile.am | 1 + .../pixmaps/stock_file-properties.png | Bin 0 -> 562 bytes .../lttv/modules/gui/statistics/statistics.c | 16 +- .../modules/gui/tracecontrol/tracecontrol.c | 11 +- .../modules/gui/tutorial/.deps/tutorial.Plo | 23 ++- .../poly/lttv/modules/gui/tutorial/tutorial.c | 17 +- 25 files changed, 356 insertions(+), 158 deletions(-) create mode 100644 ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_file-properties.png diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am b/ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am index edf21a01..523e69c5 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am @@ -32,10 +32,10 @@ libdir = ${lttvplugindir} lib_LTLIBRARIES = libguicontrolflow.la libguicontrolflow_la_LDFLAGS = -module libguicontrolflow_la_SOURCES = module.c eventhooks.c cfv.c processlist.c\ - drawing.c drawitem.c + drawing.c drawitem.c lttv_plugin_cfv.c noinst_HEADERS = eventhooks.h cfv.h processlist.h\ - drawing.h drawitem.h + drawing.h drawitem.h lttv_plugin_cfv.h EXTRA_DIST = \ hGuiControlFlowInsert.xpm hLegendInsert.xpm diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c index 6f033bd1..184caf9a 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c @@ -26,11 +26,13 @@ #include #include #include +#include #include "cfv.h" #include "drawing.h" #include "processlist.h" #include "eventhooks.h" +#include "lttv_plugin_cfv.h" extern GSList *g_control_flow_data_list; @@ -81,6 +83,44 @@ gboolean cfv_scroll_event(GtkWidget *widget, GdkEventScroll *event, } +/* Toolbar callbacks */ +static void property_button (GtkToolButton *toolbutton, + gpointer user_data) +{ + ControlFlowData *control_flow_data = (ControlFlowData*)user_data; + + g_printf("CFV Property button clicked\n"); + +} + +/* Toolbar callbacks */ +static void filter_button (GtkToolButton *toolbutton, + gpointer user_data) +{ + LttvPluginCFV *plugin_cfv = (LttvPluginCFV*)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_cfv->parent); + else g_warning("Filter module not loaded."); + + //FIXME : viewer returned. +} + + + /***************************************************************************** * Control Flow Viewer class implementation * *****************************************************************************/ @@ -93,13 +133,16 @@ gboolean cfv_scroll_event(GtkWidget *widget, GdkEventScroll *event, * @return The widget created. */ ControlFlowData * -guicontrolflow(Tab *tab) +guicontrolflow(LttvPluginTab *ptab) { + Tab *tab = ptab->tab; + GtkWidget *tmp_toolbar_icon; GtkWidget *process_list_widget, *drawing_widget, *drawing_area; - - ControlFlowData* control_flow_data = g_new(ControlFlowData,1) ; - - control_flow_data->tab = tab; + //ControlFlowData* control_flow_data = g_new(ControlFlowData,1) ; + LttvPluginCFV *plugin_cfv = g_object_new(LTTV_TYPE_PLUGIN_CFV, NULL); + ControlFlowData* control_flow_data = plugin_cfv->cfd; + control_flow_data->ptab = ptab; + control_flow_data->tab = ptab->tab; control_flow_data->v_adjust = GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */ @@ -153,9 +196,50 @@ guicontrolflow(Tab *tab) (gpointer)control_flow_data); #endif //0 + control_flow_data->hbox = gtk_hbox_new(FALSE, 1); + control_flow_data->toolbar = gtk_toolbar_new(); + gtk_toolbar_set_orientation(GTK_TOOLBAR(control_flow_data->toolbar), + GTK_ORIENTATION_VERTICAL); + + tmp_toolbar_icon = create_pixmap (main_window_get_widget(tab), + "guifilter16x16.png"); + gtk_widget_show(tmp_toolbar_icon); + control_flow_data->button_filter = gtk_tool_button_new(tmp_toolbar_icon, + "Filter"); + g_signal_connect (G_OBJECT(control_flow_data->button_filter), + "clicked", + G_CALLBACK (filter_button), + (gpointer)plugin_cfv); + gtk_toolbar_insert(GTK_TOOLBAR(control_flow_data->toolbar), + control_flow_data->button_filter, + 0); + + tmp_toolbar_icon = create_pixmap (main_window_get_widget(tab), + "stock_file-properties.png"); + gtk_widget_show(tmp_toolbar_icon); + control_flow_data->button_prop = gtk_tool_button_new(tmp_toolbar_icon, + "Properties"); + g_signal_connect (G_OBJECT(control_flow_data->button_prop), + "clicked", + G_CALLBACK (property_button), + (gpointer)control_flow_data); + gtk_toolbar_insert(GTK_TOOLBAR(control_flow_data->toolbar), + control_flow_data->button_prop, + 1); + + gtk_toolbar_set_style(GTK_TOOLBAR(control_flow_data->toolbar), + GTK_TOOLBAR_ICONS); + + gtk_box_pack_start(GTK_BOX(control_flow_data->hbox), + control_flow_data->toolbar, + FALSE, FALSE, 0); control_flow_data->h_paned = gtk_hpaned_new(); control_flow_data->box = gtk_event_box_new(); - control_flow_data->top_widget = control_flow_data->box; + gtk_box_pack_end(GTK_BOX(control_flow_data->hbox), + control_flow_data->box, + TRUE, TRUE, 0); + control_flow_data->top_widget = control_flow_data->hbox; + plugin_cfv->parent.top_widget = control_flow_data->top_widget; gtk_container_add(GTK_CONTAINER(control_flow_data->box), control_flow_data->h_paned); @@ -176,11 +260,15 @@ guicontrolflow(Tab *tab) gtk_widget_show(process_list_widget); gtk_widget_show(control_flow_data->h_paned); gtk_widget_show(control_flow_data->box); + gtk_widget_show(control_flow_data->toolbar); + gtk_widget_show(GTK_WIDGET(control_flow_data->button_prop)); + gtk_widget_show(GTK_WIDGET(control_flow_data->button_filter)); + gtk_widget_show(control_flow_data->hbox); g_object_set_data_full( G_OBJECT(control_flow_data->top_widget), - "control_flow_data", - control_flow_data, + "plugin_data", + plugin_cfv, (GDestroyNotify)guicontrolflow_destructor); g_object_set_data( @@ -190,7 +278,7 @@ guicontrolflow(Tab *tab) g_control_flow_data_list = g_slist_append( g_control_flow_data_list, - control_flow_data); + plugin_cfv); control_flow_data->filter = NULL; @@ -205,28 +293,31 @@ guicontrolflow(Tab *tab) /* Destroys widget also */ void -guicontrolflow_destructor_full(ControlFlowData *control_flow_data) +guicontrolflow_destructor_full(gpointer data) { - g_info("CFV.c : guicontrolflow_destructor_full, %p", control_flow_data); + LttvPluginCFV *plugin_cfv = (LttvPluginCFV*)data; + g_info("CFV.c : guicontrolflow_destructor_full, %p", plugin_cfv); /* May already have been done by GTK window closing */ - if(GTK_IS_WIDGET(guicontrolflow_get_widget(control_flow_data))) - gtk_widget_destroy(guicontrolflow_get_widget(control_flow_data)); + if(GTK_IS_WIDGET(guicontrolflow_get_widget(plugin_cfv->cfd))) + gtk_widget_destroy(guicontrolflow_get_widget(plugin_cfv->cfd)); //control_flow_data->mw = NULL; //FIXME guicontrolflow_destructor(control_flow_data); } /* When this destructor is called, the widgets are already disconnected */ void -guicontrolflow_destructor(ControlFlowData *control_flow_data) +guicontrolflow_destructor(gpointer data) { - Tab *tab = control_flow_data->tab; + LttvPluginCFV *plugin_cfv = (LttvPluginCFV*)data; + Tab *tab = plugin_cfv->cfd->tab; + ControlFlowData *control_flow_data = plugin_cfv->cfd; - g_info("CFV.c : guicontrolflow_destructor, %p", control_flow_data); - g_info("%p, %p, %p", update_time_window_hook, control_flow_data, tab); - if(GTK_IS_WIDGET(guicontrolflow_get_widget(control_flow_data))) + g_info("CFV.c : guicontrolflow_destructor, %p", plugin_cfv); + g_info("%p, %p, %p", update_time_window_hook, plugin_cfv, tab); + if(GTK_IS_WIDGET(guicontrolflow_get_widget(plugin_cfv->cfd))) g_info("widget still exists"); - lttv_filter_destroy(control_flow_data->filter); + lttv_filter_destroy(plugin_cfv->cfd->filter); /* Process List is removed with it's widget */ //ProcessList_destroy(control_flow_data->process_list); if(tab != NULL) @@ -255,11 +346,11 @@ guicontrolflow_destructor(ControlFlowData *control_flow_data) } lttvwindowtraces_background_notify_remove(control_flow_data); g_control_flow_data_list = - g_slist_remove(g_control_flow_data_list,control_flow_data); + g_slist_remove(g_control_flow_data_list, control_flow_data); g_info("CFV.c : guicontrolflow_destructor end, %p", control_flow_data); - g_free(control_flow_data); - + //g_free(control_flow_data); + g_object_unref(plugin_cfv); } diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h index d5410caf..5c2276e4 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h @@ -25,10 +25,10 @@ #include #include #include "processlist.h" +#include extern GQuark LTT_NAME_CPU; - #ifndef TYPE_DRAWING_T_DEFINED #define TYPE_DRAWING_T_DEFINED typedef struct _Drawing_t Drawing_t; @@ -43,10 +43,13 @@ struct _ControlFlowData { GtkWidget *top_widget; Tab *tab; - - GtkWidget *box; /* box that contains the hpaned. necessary for it to work */ + LttvPluginTab *ptab; + + GtkWidget *hbox; GtkWidget *toolbar; /* Vbox that contains the viewer's toolbar */ - GtkWidget *button_prop; /* Properties button. */ + GtkToolItem *button_prop; /* Properties button. */ + GtkToolItem *button_filter; /* Properties button. */ + GtkWidget *box; /* box that contains the hpaned. necessary for it to work */ GtkWidget *h_paned; ProcessList *process_list; @@ -68,11 +71,11 @@ struct _ControlFlowData { } ; /* Control Flow Data constructor */ -ControlFlowData *guicontrolflow(Tab *tab); +ControlFlowData *guicontrolflow(LttvPluginTab *ptab); void -guicontrolflow_destructor_full(ControlFlowData *control_flow_data); +guicontrolflow_destructor_full(gpointer data); void -guicontrolflow_destructor(ControlFlowData *control_flow_data); +guicontrolflow_destructor(gpointer data); static inline GtkWidget *guicontrolflow_get_widget( ControlFlowData *control_flow_data) diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index 54eba010..7e2cc1d0 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -180,10 +180,12 @@ static void request_background_data(ControlFlowData *control_flow_data) * @return The widget created. */ GtkWidget * -h_guicontrolflow(Tab *tab) +h_guicontrolflow(LttvPlugin *plugin) { + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + Tab *tab = ptab->tab; g_info("h_guicontrolflow, %p", tab); - ControlFlowData *control_flow_data = guicontrolflow(tab) ; + ControlFlowData *control_flow_data = guicontrolflow(ptab); control_flow_data->tab = tab; @@ -218,8 +220,10 @@ void legend_destructor(GtkWindow *legend) /* Create a popup legend */ GtkWidget * -h_legend(Tab *tab) +h_legend(LttvPlugin *plugin) { + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + Tab *tab = ptab->tab; g_info("h_legend, %p", tab); GtkWindow *legend = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h index aab74e94..8c74e36c 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h @@ -57,9 +57,9 @@ void send_test_data(ProcessList *process_list, Drawing_t *drawing); -GtkWidget *h_guicontrolflow(Tab *tab); +GtkWidget *h_guicontrolflow(LttvPlugin *plugin); -GtkWidget *h_legend(Tab *tab); +GtkWidget *h_legend(LttvPlugin *plugin); int event_selected_hook(void *hook_data, void *call_data); diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/module.c b/ltt/branches/poly/lttv/modules/gui/controlflow/module.c index 14311efe..48995c0a 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/module.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/module.c @@ -47,6 +47,7 @@ #include #include "cfv.h" +#include "lttv_plugin_cfv.h" #include "eventhooks.h" #include "hGuiControlFlowInsert.xpm" @@ -94,7 +95,7 @@ static void init() { void destroy_walk(gpointer data, gpointer user_data) { g_info("Walk destroy GUI Control Flow Viewer"); - guicontrolflow_destructor_full((ControlFlowData*)data); + guicontrolflow_destructor_full((LttvPluginCFV*)data); } void destroy_legend_walk(gpointer data, gpointer user_data) diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index 0a7f8b8d..db39fcbc 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -65,6 +65,7 @@ #include #include #include +#include #include "hGuiEventsInsert.xpm" @@ -92,6 +93,7 @@ typedef enum _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 @@ -154,9 +156,9 @@ gboolean filter_changed(void * hook_data, void * call_data); static void request_background_data(EventViewerData *event_viewer_data); //! Event Viewer's constructor hook -GtkWidget *h_gui_events(Tab *tab); +GtkWidget *h_gui_events(LttvPlugin *plugin); //! Event Viewer's constructor -EventViewerData *gui_events(Tab *tab); +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); @@ -215,9 +217,10 @@ enum * @return The widget created. */ GtkWidget * -h_gui_events(Tab * tab) +h_gui_events(LttvPlugin *plugin) { - EventViewerData* event_viewer_data = gui_events(tab) ; + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + EventViewerData* event_viewer_data = gui_events(ptab) ; if(event_viewer_data) return event_viewer_data->top_widget; else return NULL; @@ -231,14 +234,15 @@ h_gui_events(Tab * tab) * @return The Event viewer data created. */ EventViewerData * -gui_events(Tab *tab) +gui_events(LttvPluginTab *ptab) { LttTime end; GtkTreeViewColumn *column; GtkCellRenderer *renderer; EventViewerData* event_viewer_data = g_new(EventViewerData,1) ; - + Tab *tab = ptab->tab; event_viewer_data->tab = tab; + event_viewer_data->ptab = ptab; LttvTracesetContext * tsc = lttvwindow_get_traceset_context(event_viewer_data->tab); diff --git a/ltt/branches/poly/lttv/modules/gui/diskperformance/diskperformance.c b/ltt/branches/poly/lttv/modules/gui/diskperformance/diskperformance.c index 4805347b..d59d0f3f 100644 --- a/ltt/branches/poly/lttv/modules/gui/diskperformance/diskperformance.c +++ b/ltt/branches/poly/lttv/modules/gui/diskperformance/diskperformance.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "hDiskPerformanceInsert.xpm" @@ -65,6 +66,8 @@ enum operation_t { typedef struct _DiskPerformanceData { Tab * tab; + + LttvPluginTab *ptab; LttvHooks * hooks_trace_after; @@ -118,7 +121,7 @@ GQuark LTT_FACILITY_BLOCK; GQuark LTT_EVENT_BLOCK_READ; GQuark LTT_EVENT_BLOCK_WRITE; -static DiskPerformanceData *disk_performance_data(Tab *tab); +static DiskPerformanceData *disk_performance_data(LttvPluginTab *ptab); static void disk_destroy_walk(gpointer data, gpointer user_data); static gboolean disk_show(void *hook_data, void *call_data); static gboolean trace_header(void *hook_data, void *call_data); @@ -128,7 +131,7 @@ void gui_disperformance_free(DiskPerformanceData *event_viewer_data); static void get_event_detail(LttEvent *e, lttv_block* disk_data); static char * major_minor_to_diskname( lttv_block* disk_data); static void sum_data(char* diskname, guint size, enum operation_t opt, GArray *disk_array); -static GtkWidget *disk_performance(Tab * tab); +static GtkWidget *disk_performance(LttvPlugin *plugin); static gboolean block_read_callback(void *hook_data, void *call_data); @@ -263,13 +266,13 @@ static void init() * Constructor hook * */ -GtkWidget *disk_performance(Tab * tab) +GtkWidget *disk_performance(LttvPlugin *plugin) { - - DiskPerformanceData* disk_data = disk_performance_data(tab); - if(disk_data) + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + DiskPerformanceData* disk_data = disk_performance_data(ptab); + if(disk_data) return disk_data->hbox_v; - else + else return NULL; } @@ -277,7 +280,7 @@ GtkWidget *disk_performance(Tab * tab) * This function initializes the Event Viewer functionnality through the * GTK API. */ -DiskPerformanceData *disk_performance_data(Tab *tab) +DiskPerformanceData *disk_performance_data(LttvPluginTab *ptab) { LttTime end; GtkTreeViewColumn *column; @@ -285,8 +288,9 @@ DiskPerformanceData *disk_performance_data(Tab *tab) DiskPerformanceData* disk_data = g_new(DiskPerformanceData,1) ; g_info("enter disk_performance_data \n"); - + Tab *tab = ptab->tab; disk_data->tab = tab; + disk_data->ptab = ptab; disk_data->time_window = lttvwindow_get_time_window(tab); disk_data->disk_array = g_array_new(FALSE, FALSE, sizeof(lttv_total_block )); diff --git a/ltt/branches/poly/lttv/modules/gui/filter/filter.c b/ltt/branches/poly/lttv/modules/gui/filter/filter.c index f12646df..84206509 100644 --- a/ltt/branches/poly/lttv/modules/gui/filter/filter.c +++ b/ltt/branches/poly/lttv/modules/gui/filter/filter.c @@ -61,12 +61,12 @@ typedef struct _FilterViewerDataLine FilterViewerDataLine; * Prototypes */ GtkWidget *guifilter_get_widget(FilterViewerData *fvd); -FilterViewerData *gui_filter(Tab *tab); +FilterViewerData *gui_filter(LttvPlugin *plugin); void gui_filter_destructor(FilterViewerData *fvd); FilterViewerDataLine* gui_filter_add_line(FilterViewerData *fvd); void gui_filter_line_set_visible(FilterViewerDataLine *fvdl, gboolean v); void gui_filter_line_reset(FilterViewerDataLine *fvdl); -GtkWidget* h_guifilter(Tab *tab); +GtkWidget* h_guifilter(LttvPlugin *plugin); void filter_destroy_walk(gpointer data, gpointer user_data); /* @@ -105,7 +105,7 @@ struct _FilterViewerDataLine { * Main struct for the filter gui module */ struct _FilterViewerData { - Tab *tab; /**< current tab of module */ + LttvPlugin *plugin; /**< Plugin on which we interact. */ GtkWidget *f_window; /**< filter window */ @@ -150,7 +150,7 @@ guifilter_get_widget(FilterViewerData *fvd) * @return The Filter viewer data created. */ FilterViewerData* -gui_filter(Tab *tab) +gui_filter(LttvPlugin *plugin) { g_debug("filter::gui_filter()"); @@ -160,7 +160,7 @@ gui_filter(Tab *tab) FilterViewerData* fvd = g_new(FilterViewerData,1); - fvd->tab = tab; + fvd->plugin = plugin; // lttvwindow_register_traceset_notify(fvd->tab, // filter_traceset_changed, @@ -218,7 +218,7 @@ gui_filter(Tab *tab) fvd->f_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(fvd->f_window), "LTTV Filter"); gtk_window_set_transient_for(GTK_WINDOW(fvd->f_window), - GTK_WINDOW(main_window_get_widget(tab))); + GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(fvd->plugin->top_widget)))); gtk_window_set_destroy_with_parent(GTK_WINDOW(fvd->f_window), TRUE); /* @@ -423,8 +423,6 @@ gui_filter_line_reset(FilterViewerDataLine *fvdl) { void gui_filter_destructor(FilterViewerData *fvd) { - Tab *tab = fvd->tab; - /* May already been done by GTK window closing */ if(GTK_IS_WIDGET(guifilter_get_widget(fvd))){ g_info("widget still exists"); @@ -449,13 +447,13 @@ gui_filter_destructor(FilterViewerData *fvd) * * This constructor is given as a parameter to the menuitem and toolbar button * registration. It creates the list. - * @param tab A pointer to the parent window. + * @param obj Object to interact with. * @return The widget created. */ GtkWidget * -h_guifilter(Tab *tab) +h_guifilter(LttvPlugin *plugin) { - FilterViewerData* f = gui_filter(tab) ; + FilterViewerData* f = gui_filter(plugin) ; return NULL; } @@ -529,11 +527,14 @@ 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); } else { filter = NULL; } - lttvwindow_report_filter(fvd->tab, filter); + /* Remove the old filter if present */ + //g_object_set_data_full(fvd->obj, "filter", filter, + // (GDestroyNotify)lttv_filter_destroy); + //g_object_notify(fvd->obj, "filter"); + lttv_plugin_update_filter(fvd->plugin, filter); } gboolean callback_enter_check(GtkWidget *widget, diff --git a/ltt/branches/poly/lttv/modules/gui/histogram/histocfv.c b/ltt/branches/poly/lttv/modules/gui/histogram/histocfv.c index 32da15b0..80c5c5ac 100644 --- a/ltt/branches/poly/lttv/modules/gui/histogram/histocfv.c +++ b/ltt/branches/poly/lttv/modules/gui/histogram/histocfv.c @@ -62,15 +62,15 @@ header_size_allocate(GtkWidget *widget, * @return The widget created. */ HistoControlFlowData * -guihistocontrolflow(Tab *tab) +guihistocontrolflow(LttvPluginTab *ptab) { GtkWidget *button_widget, *drawing_widget, *drawing_area; GtkWidget *buttonP,*buttonM; histoDrawing_t *drawing; HistoControlFlowData* histo_control_flow_data = g_new(HistoControlFlowData,1) ; - - histo_control_flow_data->tab = tab; + histo_control_flow_data->ptab = ptab; + histo_control_flow_data->tab = ptab->tab; histo_control_flow_data->max_height = PREDEFINED_HEIGHT; /*histo_control_flow_data->v_adjust = diff --git a/ltt/branches/poly/lttv/modules/gui/histogram/histocfv.h b/ltt/branches/poly/lttv/modules/gui/histogram/histocfv.h index 4ab10513..d897f77d 100644 --- a/ltt/branches/poly/lttv/modules/gui/histogram/histocfv.h +++ b/ltt/branches/poly/lttv/modules/gui/histogram/histocfv.h @@ -23,6 +23,8 @@ #include #include +#include + //#include "histobuttonwidget.h" extern GQuark LTT_NAME_CPU; @@ -48,6 +50,7 @@ typedef struct _HistoControlFlowData HistoControlFlowData; struct _HistoControlFlowData { GtkWidget *top_widget;//The hbox containing buttons and drawing area. + LttvPluginTab *ptab; Tab *tab; GtkWidget *box; GtkWidget *ev_box;//for histogram @@ -71,7 +74,7 @@ struct _HistoControlFlowData { } ; /* Control Flow Data constructor */ -HistoControlFlowData *guihistocontrolflow(Tab *tab); +HistoControlFlowData *guihistocontrolflow(LttvPluginTab *ptab); void guihistocontrolflow_destructor_full(HistoControlFlowData *histo_control_flow_data); void diff --git a/ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.c b/ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.c index 900154b4..dc37164c 100644 --- a/ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.c @@ -178,11 +178,13 @@ static void histo_request_background_data(HistoControlFlowData *histocontrol_flo * @return The widget created. */ GtkWidget * -h_guihistocontrolflow(Tab *tab) +h_guihistocontrolflow(LttvPlugin *plugin) { - g_info("h_guihistocontrolflow, %p", tab); - HistoControlFlowData *histocontrol_flow_data = guihistocontrolflow(tab) ; + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + g_info("h_guihistocontrolflow, %p", ptab); + HistoControlFlowData *histocontrol_flow_data = guihistocontrolflow(ptab) ; + Tab *tab = ptab->tab; histocontrol_flow_data->tab = tab; // Unreg done in the GuiHistoControlFlow_Destructor diff --git a/ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.h b/ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.h index e8a49bea..f5a76309 100644 --- a/ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.h +++ b/ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.h @@ -57,7 +57,7 @@ void send_test_data(ButtonWidget *buttonwidget, histoDrawing_t *drawing);//?? -GtkWidget *h_guihistocontrolflow(Tab *tab); +GtkWidget *h_guihistocontrolflow(LttvPlugin *plugin); //GtkWidget *h_legend(Tab *tab); diff --git a/ltt/branches/poly/lttv/modules/gui/interrupts/interrupts.c b/ltt/branches/poly/lttv/modules/gui/interrupts/interrupts.c index 2818875f..35011cb4 100644 --- a/ltt/branches/poly/lttv/modules/gui/interrupts/interrupts.c +++ b/ltt/branches/poly/lttv/modules/gui/interrupts/interrupts.c @@ -82,6 +82,7 @@ Xa: Frequency (Hz) #include #include #include +#include #include #include "hInterruptsInsert.xpm" @@ -145,6 +146,7 @@ typedef struct _InterruptEventData { GtkTreeSelection *SelectionTree; Tab * tab; /* tab that contains this plug-in*/ + LttvPluginTab *ptab; LttvHooks * event_hooks; LttvHooks * hooks_trace_after; LttvHooks * hooks_trace_before; @@ -162,8 +164,8 @@ typedef struct _InterruptEventData { /* Function prototypes */ static gboolean interrupt_update_time_window(void * hook_data, void * call_data); -static GtkWidget *interrupts(Tab *tab); -static InterruptEventData *system_info(Tab *tab); +static GtkWidget *interrupts(LttvPlugin *plugin); +static InterruptEventData *system_info(LttvPluginTab *ptab); void interrupt_destructor(InterruptEventData *event_viewer_data); static void FirstRequest(InterruptEventData *event_data ); static guint64 get_interrupt_id(LttEvent *e); @@ -227,10 +229,10 @@ static void init() { * Constructor hook * */ -static GtkWidget *interrupts(Tab * tab) +static GtkWidget *interrupts(LttvPlugin *plugin) { - - InterruptEventData* event_data = system_info(tab) ; + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + InterruptEventData* event_data = system_info(ptab) ; if(event_data) return event_data->Hbox; else @@ -241,14 +243,15 @@ static GtkWidget *interrupts(Tab * tab) * This function initializes the Event Viewer functionnality through the * GTK API. */ -InterruptEventData *system_info(Tab *tab) +InterruptEventData *system_info(LttvPluginTab *ptab) { LttTime end; GtkTreeViewColumn *column; GtkCellRenderer *renderer; InterruptEventData* event_viewer_data = g_new(InterruptEventData,1) ; - + Tab *tab = ptab->tab; + event_viewer_data->ptab = ptab; event_viewer_data->tab = tab; /*Get the current time frame from the main window */ diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am index 25ca2ecf..bb4263ac 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am @@ -24,7 +24,9 @@ liblttvwindow_la_SOURCES = \ init_module.c \ support.c \ interface.c \ - callbacks.c + callbacks.c \ + lttv_plugin_tab.c \ + lttv_plugin.c noinst_HEADERS = \ support.h \ @@ -37,7 +39,9 @@ lttvwindowinclude_HEADERS = \ lttvwindowtraces.h\ mainwindow.h\ menu.h\ - toolbar.h + toolbar.h\ + lttv_plugin_tab.h \ + lttv_plugin.h liblttvwindow_la_LIBADD = @PACKAGE_LIBS@ $(INTLLIBS) 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 1dc237d2..bb893237 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -46,7 +46,7 @@ #include #include #include - +#include static LttTime lttvwindow_default_time_width = { 1, 0 }; #define CLIP_BUF 256 // size of clipboard buffer @@ -61,6 +61,7 @@ extern GSList * g_main_window_list; static char remember_plugins_dir[PATH_MAX] = ""; static char remember_trace_dir[PATH_MAX] = ""; +void tab_destructor(LttvPluginTab * ptab); MainWindow * get_window_data_struct(GtkWidget * widget); char * get_load_module(MainWindow *mw, @@ -70,12 +71,12 @@ char * get_unload_module(MainWindow *mw, char * get_remove_trace(MainWindow *mw, char ** all_trace_name, int nb_trace); char * get_selection(MainWindow *mw, char ** all_name, int nb, char *title, char * column_title); -Tab* create_tab(MainWindow * mw, Tab *copy_tab, +void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, GtkNotebook * notebook, char * label); static void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor); -Tab *create_new_tab(GtkWidget* widget, gpointer user_data); +LttvPluginTab *create_new_tab(GtkWidget* widget, gpointer user_data); static gboolean lttvwindow_process_pending_requests(Tab *tab); @@ -348,7 +349,16 @@ static gboolean on_MEventBox8_paste(GtkWidget *widget, GdkEventButton *event, return 0; } +#if 0 +static void on_top_notify(GObject *gobject, + GParamSpec *arg1, + gpointer user_data) +{ + Tab *tab = (Tab*)user_data; + g_message("in on_top_notify.\n"); +} +#endif //0 static gboolean viewer_grab_focus(GtkWidget *widget, GdkEventButton *event, gpointer data) { @@ -414,17 +424,19 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor) TimeInterval * time_interval; GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); + LttvPluginTab *ptab; Tab *tab; if(!page) { - tab = create_new_tab(widget, NULL); + ptab = create_new_tab(widget, NULL); } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); } + tab = ptab->tab; viewer_container = tab->viewer_container; - viewer = (GtkWidget*)constructor(tab); + viewer = (GtkWidget*)constructor(ptab); if(viewer) { //gtk_multivpaned_widget_add(GTK_MULTIVPANED(multivpaned), viewer); @@ -752,7 +764,9 @@ void move_down_viewer(GtkWidget * widget, gpointer user_data) if(!page) { return; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } //gtk_multivpaned_widget_move_up(GTK_MULTIVPANED(tab->multivpaned)); @@ -784,7 +798,9 @@ void move_up_viewer(GtkWidget * widget, gpointer user_data) if(!page) { return; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } //gtk_multivpaned_widget_move_down(GTK_MULTIVPANED(tab->multivpaned)); @@ -823,7 +839,9 @@ void delete_viewer(GtkWidget * widget, gpointer user_data) if(!page) { return; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } //gtk_multivpaned_widget_delete(GTK_MULTIVPANED(tab->multivpaned)); @@ -1750,12 +1768,15 @@ void add_trace(GtkWidget * widget, gpointer user_data) GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); + LttvPluginTab *ptab; Tab *tab; if(!page) { - tab = create_new_tab(widget, NULL); + ptab = create_new_tab(widget, NULL); + tab = ptab->tab; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } //GtkDirSelection * file_selector = (GtkDirSelection *)gtk_dir_selection_new("Select a trace"); @@ -1856,7 +1877,9 @@ void remove_trace(GtkWidget *widget, gpointer user_data) if(!page) { return; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } nb_trace =lttv_traceset_number(tab->traceset_info->traceset); @@ -2075,7 +2098,9 @@ void redraw(GtkWidget *widget, gpointer user_data) if(!page) { return; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } LttvHooks * tmp; @@ -2098,7 +2123,9 @@ void continue_processing(GtkWidget *widget, gpointer user_data) if(!page) { return; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } LttvHooks * tmp; @@ -2126,7 +2153,9 @@ void stop_processing(GtkWidget *widget, gpointer user_data) if(!page) { return; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } GSList *iter = tab->events_requests; @@ -2180,7 +2209,9 @@ void zoom(GtkWidget * widget, double size) if(!page) { return; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } if(size == 1) return; @@ -2297,7 +2328,8 @@ on_clone_traceset_activate (GtkMenuItem *menuitem, /* create_new_tab calls create_tab to construct a new tab in the main window */ -Tab *create_new_tab(GtkWidget* widget, gpointer user_data){ +LttvPluginTab *create_new_tab(GtkWidget* widget, gpointer user_data) +{ gchar label[PATH_MAX]; MainWindow * mw_data = get_window_data_struct(widget); @@ -2313,14 +2345,26 @@ Tab *create_new_tab(GtkWidget* widget, gpointer user_data){ if(!page) { copy_tab = NULL; } else { - copy_tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + copy_tab = ptab->tab; } strcpy(label,"Page"); - if(get_label(mw_data, label,"Get the name of the tab","Please input tab's name")) - return (create_tab (mw_data, copy_tab, notebook, label)); - else - return NULL; + if(get_label(mw_data, label,"Get the name of the tab","Please input tab's name")) { + LttvPluginTab *ptab; + + ptab = g_object_new(LTTV_TYPE_PLUGIN_TAB, NULL); + init_tab (ptab->tab, mw_data, copy_tab, notebook, label); + ptab->parent.top_widget = ptab->tab->top_widget; + g_object_set_data_full( + G_OBJECT(ptab->tab->vbox), + "Tab_Plugin", + ptab, + (GDestroyNotify)tab_destructor); + return ptab; + } + else return NULL; } void @@ -4263,11 +4307,30 @@ MainWindow *construct_main_window(MainWindow * parent) if(!page) { parent_tab = NULL; } else { - parent_tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + LttvPluginTab *ptab; + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + parent_tab = ptab->tab; } - new_tab = create_tab(new_m_window, parent_tab, notebook, "Traceset"); + LttvPluginTab *ptab = g_object_new(LTTV_TYPE_PLUGIN_TAB, NULL); + init_tab(ptab->tab, + new_m_window, parent_tab, notebook, "Traceset"); + ptab->parent.top_widget = ptab->tab->top_widget; + g_object_set_data_full( + G_OBJECT(ptab->tab->vbox), + "Tab_Plugin", + ptab, + (GDestroyNotify)tab_destructor); + new_tab = ptab->tab; } else { - new_tab = create_tab(new_m_window, NULL, notebook, "Traceset"); + LttvPluginTab *ptab = g_object_new(LTTV_TYPE_PLUGIN_TAB, NULL); + init_tab(ptab->tab, new_m_window, NULL, notebook, "Traceset"); + ptab->parent.top_widget = ptab->tab->top_widget; + g_object_set_data_full( + G_OBJECT(ptab->tab->vbox), + "Tab_Plugin", + ptab, + (GDestroyNotify)tab_destructor); + new_tab = ptab->tab; } /* Insert default viewers */ @@ -4323,10 +4386,11 @@ MainWindow *construct_main_window(MainWindow * parent) * destroy the tab */ -void tab_destructor(Tab * tab) +void tab_destructor(LttvPluginTab * ptab) { int i, nb, ref_count; LttvTrace * trace; + Tab *tab = ptab->tab; gtk_object_destroy(GTK_OBJECT(tab->tooltips)); @@ -4356,28 +4420,29 @@ void tab_destructor(Tab * tab) } } } - lttv_filter_destroy(tab->filter); lttv_traceset_destroy(tab->traceset_info->traceset); /* Remove the idle events requests processing function of the tab */ g_idle_remove_by_data(tab); g_slist_free(tab->events_requests); g_free(tab->traceset_info); - g_free(tab); + //g_free(tab); + g_object_unref(ptab); } /* Create a tab and insert it into the current main window */ -Tab* create_tab(MainWindow * mw, Tab *copy_tab, +void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, GtkNotebook * notebook, char * label) { GList * list; - Tab * tab; + //Tab * tab; + //LttvFilter *filter = NULL; //create a new tab data structure - tab = g_new(Tab,1); + //tab = g_new(Tab,1); //construct and initialize the traceset_info tab->traceset_info = g_new(TracesetInfo,1); @@ -4447,6 +4512,15 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, tab->interrupted_state = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); tab->vbox = gtk_vbox_new(FALSE, 2); + tab->top_widget = tab->vbox; + //g_object_set_data_full(G_OBJECT(tab->top_widget), "filter", +// filter, (GDestroyNotify)lttv_filter_destroy); + +// g_signal_connect (G_OBJECT(tab->top_widget), +// "notify", +// G_CALLBACK (on_top_notify), +// (gpointer)tab); + tab->viewer_container = gtk_vbox_new(TRUE, 2); tab->scrollbar = gtk_hscrollbar_new(NULL); //tab->multivpaned = gtk_multi_vpaned_new(); @@ -4698,11 +4772,6 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, tab->events_requests = NULL; tab->events_request_pending = FALSE; - g_object_set_data_full( - G_OBJECT(tab->vbox), - "Tab_Info", - tab, - (GDestroyNotify)tab_destructor); g_signal_connect(G_OBJECT(tab->scrollbar), "value-changed", G_CALLBACK(scroll_value_changed_cb), tab); @@ -4763,8 +4832,6 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, LttvTraceset *traceset = tab->traceset_info->traceset; SetTraceset(tab, traceset); - - return tab; } /* @@ -4791,12 +4858,15 @@ void create_main_window_with_trace(const gchar *path) GtkWidget * notebook = lookup_widget(widget, "MNotebook"); GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); + LttvPluginTab *ptab; Tab *tab; if(!page) { - tab = create_new_tab(widget, NULL); + ptab = create_new_tab(widget, NULL); + tab = ptab->tab; } else { - tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); + tab = ptab->tab; } /* Add trace */ 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 23721242..7dd2e0c7 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -1057,7 +1057,7 @@ LttTime lttvwindow_get_current_time(Tab *tab) */ LttvFilter *lttvwindow_get_filter(Tab *tab) { - return tab->filter; + return g_object_get_data(G_OBJECT(tab->vbox), "filter"); } /** @@ -1072,14 +1072,13 @@ LttvFilter *lttvwindow_get_filter(Tab *tab) * @param main_win, the main window the viewer belongs to. * @param filter, a pointer to a filter. */ - void lttvwindow_report_filter(Tab *tab, LttvFilter *filter) { LttvAttributeValue value; LttvHooks * tmp; - lttv_filter_destroy(tab->filter); - tab->filter = filter; + //lttv_filter_destroy(tab->filter); + //tab->filter = filter; g_assert(lttv_iattribute_find_by_path(tab->attributes, "hooks/updatefilter", LTTV_POINTER, &value)); 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 ca0e203c..e690ec57 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -259,6 +259,7 @@ FIXME : explain other important events #include #include #include +#include /* Module Related API */ @@ -266,7 +267,7 @@ FIXME : explain other important events extern GQuark LTTV_VIEWER_CONSTRUCTORS; /* constructor a the viewer */ -typedef GtkWidget* (*lttvwindow_viewer_constructor)(Tab *tab); +typedef GtkWidget* (*lttvwindow_viewer_constructor)(LttvPlugin *plugin); /** diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h index 2602061e..f478aae9 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h @@ -69,7 +69,7 @@ struct _MainWindow{ struct _Tab{ GtkWidget *label; - + GtkWidget *top_widget; GtkWidget *vbox; /* contains viewer_container and scrollbar */ //GtkWidget *multivpaned; GtkWidget *viewer_container; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am index 047e50c4..c07cdd7e 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am @@ -27,6 +27,7 @@ EXTRA_DIST = \ stock_refresh_24.png\ close.png\ stock_jump_to_24.png\ + stock_file-properties.png lttv-color-list.png\ guifilter22x22.png\ guifilter16x16.png diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_file-properties.png b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_file-properties.png new file mode 100644 index 0000000000000000000000000000000000000000..e81b562f63c337acf35c4bdea78f7c49e64eb312 GIT binary patch literal 562 zcmV-20?qx2P)eyEGu`V*=*vvE+Rs!)xx%I z?(gqdE|;dqIN0y^rnp!v@H~(4c+By5q|s<#+cqKsz-qOk)9C=H3qUEQ3`q)(qR0Sv zPys+|ovUA@PEr!j^B4|?Y&ILhFr-*40&sbG2|%@4Jxh>_cDoHgrBX4?*;8wMLSRM+ zf`D?ljPLu@YBg@Ze9e*HetMsCVEwzqdc95%1a!Mylu`h^eDR9%vn%7^>pF07*qoM6N<$g2UhO Ang9R* literal 0 HcmV?d00001 diff --git a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c index 0e87e382..8efa6b26 100644 --- a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c +++ b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c @@ -39,6 +39,7 @@ #include #include +#include #include "hGuiStatisticInsert.xpm" @@ -57,9 +58,9 @@ static void request_background_data(StatisticViewerData *svd); GtkWidget *guistatistic_get_widget(StatisticViewerData *svd); //! Statistic Viewer's constructor hook -GtkWidget *h_gui_statistic(Tab *tab); +GtkWidget *h_gui_statistic(LttvPlugin *plugin); //! Statistic Viewer's constructor -StatisticViewerData *gui_statistic(Tab *tab); +StatisticViewerData *gui_statistic(LttvPluginTab *ptab); //! Statistic Viewer's destructor void gui_statistic_destructor(StatisticViewerData *statistic_viewer_data); @@ -91,6 +92,7 @@ enum struct _StatisticViewerData{ Tab *tab; + LttvPluginTab *ptab; //LttvTracesetStats * stats; int size; @@ -232,9 +234,10 @@ gui_statistic_destructor(StatisticViewerData *statistic_viewer_data) * @return The widget created. */ GtkWidget * -h_gui_statistic(Tab *tab) +h_gui_statistic(LttvPlugin *plugin) { - StatisticViewerData* statistic_viewer_data = gui_statistic(tab) ; + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + StatisticViewerData* statistic_viewer_data = gui_statistic(ptab) ; if(statistic_viewer_data) return guistatistic_get_widget(statistic_viewer_data); @@ -268,14 +271,15 @@ gboolean statistic_insert_traceset_stats(void * stats) * @return The Statistic viewer data created. */ StatisticViewerData * -gui_statistic(Tab *tab) +gui_statistic(LttvPluginTab *ptab) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; StatisticViewerData* statistic_viewer_data = g_new(StatisticViewerData,1); - + Tab *tab = ptab->tab; statistic_viewer_data->tab = tab; + statistic_viewer_data->ptab = ptab; // statistic_viewer_data->stats = // lttvwindow_get_traceset_stats(statistic_viewer_data->tab); // statistic_viewer_data->calculate_stats = diff --git a/ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c b/ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c index 83826552..bc7ec188 100644 --- a/ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c +++ b/ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c @@ -69,9 +69,9 @@ typedef struct _ControlData ControlData; * Prototypes */ GtkWidget *guicontrol_get_widget(ControlData *tcd); -ControlData *gui_control(Tab *tab); +ControlData *gui_control(GObject *obj); void gui_control_destructor(ControlData *tcd); -GtkWidget* h_guicontrol(Tab *tab); +GtkWidget* h_guicontrol(GObject *obj); void control_destroy_walk(gpointer data, gpointer user_data); /* @@ -152,8 +152,9 @@ guicontrol_get_widget(ControlData *tcd) * @return The Filter viewer data created. */ ControlData* -gui_control(Tab *tab) +gui_control(GObject *obj) { + Tab *tab = g_object_get_data(obj, "Tab"); g_debug("filter::gui_control()"); unsigned i; @@ -1089,9 +1090,9 @@ void stop_clicked (GtkButton *button, gpointer user_data) * @return The widget created. */ GtkWidget * -h_guicontrol(Tab *tab) +h_guicontrol(GObject *obj) { - ControlData* f = gui_control(tab) ; + ControlData* f = gui_control(obj); return NULL; } diff --git a/ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo b/ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo index 5be74d21..38735a47 100644 --- a/ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo +++ b/ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo @@ -2,8 +2,7 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/gnu/stubs.h /usr/include/bits/huge_val.h \ /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ - /usr/include/bits/mathinline.h /usr/include/glib-2.0/glib.h \ - /usr/include/glib-2.0/glib/galloca.h \ + /usr/include/glib-2.0/glib.h /usr/include/glib-2.0/glib/galloca.h \ /usr/include/glib-2.0/glib/gtypes.h \ /usr/lib/glib-2.0/include/glibconfig.h \ /usr/include/glib-2.0/glib/gmacros.h \ @@ -101,7 +100,7 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ /usr/include/bits/wchar.h /usr/include/gconv.h \ /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ - /usr/include/bits/stdio.h /usr/include/glib-2.0/gmodule.h \ + /usr/include/glib-2.0/gmodule.h \ /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-loader.h \ /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-enum-types.h \ /usr/include/pango-1.0/pango/pangocairo.h \ @@ -319,7 +318,6 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/bits/select.h /usr/include/bits/sigset.h \ /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ /usr/include/bits/sched.h /usr/include/alloca.h /usr/include/string.h \ - /usr/include/bits/string.h /usr/include/bits/string2.h \ ../../../../ltt/ltt.h ../../../../ltt/time.h ../../../../ltt/compiler.h \ ../../../../ltt/event.h ../../../../ltt/type.h ../../../../ltt/trace.h \ ../../../../ltt/facility.h ../../../../lttv/lttv/module.h \ @@ -330,6 +328,9 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ ../../../../lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h \ ../../../../lttv/lttv/stats.h \ ../../../../lttv/modules/gui/lttvwindow/lttvwindow/mainwindow.h \ + ../../../../lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin.h \ + ../../../../lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.h \ + ../../../../lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h \ hTutorialInsert.xpm /usr/include/math.h: @@ -346,8 +347,6 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/bits/mathcalls.h: -/usr/include/bits/mathinline.h: - /usr/include/glib-2.0/glib.h: /usr/include/glib-2.0/glib/galloca.h: @@ -594,8 +593,6 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/bits/sys_errlist.h: -/usr/include/bits/stdio.h: - /usr/include/glib-2.0/gmodule.h: /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-loader.h: @@ -1076,10 +1073,6 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/string.h: -/usr/include/bits/string.h: - -/usr/include/bits/string2.h: - ../../../../ltt/ltt.h: ../../../../ltt/time.h: @@ -1116,4 +1109,10 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ ../../../../lttv/modules/gui/lttvwindow/lttvwindow/mainwindow.h: +../../../../lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin.h: + +../../../../lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.h: + +../../../../lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h: + hTutorialInsert.xpm: diff --git a/ltt/branches/poly/lttv/modules/gui/tutorial/tutorial.c b/ltt/branches/poly/lttv/modules/gui/tutorial/tutorial.c index f113355f..46ab96aa 100644 --- a/ltt/branches/poly/lttv/modules/gui/tutorial/tutorial.c +++ b/ltt/branches/poly/lttv/modules/gui/tutorial/tutorial.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include "hTutorialInsert.xpm" @@ -98,6 +99,7 @@ typedef struct _InterruptEventData GtkTreeSelection *SelectionTree; Tab * tab; /* tab that contains this plug-in*/ + LttvPluginTab * ptab; LttvHooks * event_hooks; LttvHooks * hooks_trace_after; LttvHooks * hooks_trace_before; @@ -111,8 +113,8 @@ typedef struct _InterruptEventData /* Function prototypes */ static gboolean interrupt_update_time_window(void * hook_data, void * call_data); -static GtkWidget *interrupts(Tab *tab); -static InterruptEventData *system_info(Tab *tab); +static GtkWidget *interrupts(LttvPlugin *plugin); +static InterruptEventData *system_info(LttvPluginTab *ptab); void interrupt_destructor(InterruptEventData *event_viewer_data); static void request_event(InterruptEventData *event_data ); static guint64 get_interrupt_id(LttEvent *e); @@ -159,10 +161,10 @@ static void init() * Constructor hook * */ -static GtkWidget *interrupts(Tab * tab) +static GtkWidget *interrupts(LttvPlugin *plugin) { - - InterruptEventData* event_data = system_info(tab) ; + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + InterruptEventData* event_data = system_info(ptab) ; if(event_data) return event_data->Hbox; else @@ -173,15 +175,16 @@ static GtkWidget *interrupts(Tab * tab) * This function initializes the Event Viewer functionnality through the * GTK API. */ -InterruptEventData *system_info(Tab *tab) +InterruptEventData *system_info(LttvPluginTab *ptab) { LttTime end; GtkTreeViewColumn *column; GtkCellRenderer *renderer; InterruptEventData* event_viewer_data = g_new(InterruptEventData,1) ; - + Tab *tab = ptab->tab; event_viewer_data->tab = tab; + event_viewer_data->ptab = ptab; /*Get the current time frame from the main window */ event_viewer_data->time_window = lttvwindow_get_time_window(tab); -- 2.34.1