add plugin interface to objects
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 23 Jun 2006 20:15:30 +0000 (20:15 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 23 Jun 2006 20:15:30 +0000 (20:15 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1962 04897980-b3bd-0310-b5e0-8ef037075253

25 files changed:
ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am
ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c
ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h
ltt/branches/poly/lttv/modules/gui/controlflow/module.c
ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/diskperformance/diskperformance.c
ltt/branches/poly/lttv/modules/gui/filter/filter.c
ltt/branches/poly/lttv/modules/gui/histogram/histocfv.c
ltt/branches/poly/lttv/modules/gui/histogram/histocfv.h
ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.c
ltt/branches/poly/lttv/modules/gui/histogram/histoeventhooks.h
ltt/branches/poly/lttv/modules/gui/interrupts/interrupts.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h
ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am
ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_file-properties.png [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/statistics/statistics.c
ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c
ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo
ltt/branches/poly/lttv/modules/gui/tutorial/tutorial.c

index edf21a01442785db739f01b1bbf87f40a8360afe..523e69c5e9b5ec83822b9ec9316fbdb0bb54c856 100644 (file)
@@ -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
index 6f033bd1e9f6c3d87afd8b6d363ea1a0031a63fc..184caf9ac51ab2be130d07ef63d361e3ebae69de 100644 (file)
 #include <lttv/lttv.h>
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/lttvwindowtraces.h>
+#include <lttvwindow/support.h>
 
 #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);
 }
 
 
index d5410cafea2bcddbfc9eb336116a348c809ab9f7..5c2276e4ed4d09951511e7e97879a68084bb00fc 100644 (file)
 #include <lttvwindow/mainwindow.h>
 #include <lttv/filter.h>
 #include "processlist.h"
+#include <lttvwindow/lttv_plugin_tab.h>
 
 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)
index 54eba010749b14d1b0f96df1f0defae0d1813cab..7e2cc1d062479abb7bfd94b07a5cbf3bbd884e88 100644 (file)
@@ -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));
index aab74e9499ea034ce0cd495a41d80341cda38ae3..8c74e36c7435787f4d486d6f08090dde33416242 100644 (file)
@@ -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);
 
index 14311efed2a552661b6eb7dd1cee0e5afeb1d8a7..48995c0a91685f7834ccbeef90a82be86f16f445 100644 (file)
@@ -47,6 +47,7 @@
 #include <lttvwindow/lttvwindow.h>
 
 #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)
index 0a7f8b8d31a4a2c2ed7a2624f6ed08d549b19f19..db39fcbc5ec43084b2fbfd580bdf8313edc3187a 100644 (file)
@@ -65,6 +65,7 @@
 #include <lttv/print.h>
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/lttvwindowtraces.h>
+#include <lttvwindow/lttv_plugin_tab.h>
 
 #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);
index 4805347b146c469c6d5030de6abd957363b69465..d59d0f3f3e0218cd7982e4e7a76f29db50a3a955 100644 (file)
@@ -36,6 +36,7 @@
 #include <lttv/state.h>
 #include <lttv/filter.h>
 #include <lttvwindow/lttvwindow.h>
+#include <lttvwindow/lttv_plugin_tab.h>
 #include <ltt/time.h>
 
 #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 ));
index f12646df35e109b5b3e1f3e06158da6956ff5da4..8420650957aabaa3cbbcc43550cbff070a71aa14 100644 (file)
@@ -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,
index 32da15b06779d66b8833cf3cf8e1be9a796ba97a..80c5c5ac2164b1532dfa4833a23ed517b05b6fae 100644 (file)
@@ -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 = 
index 4ab10513badcac49cbd927d28f53596baa0141b8..d897f77d62cc1357405b4ab5f0c0778fd7961b27 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <gtk/gtk.h>
 #include <lttvwindow/mainwindow.h>
+#include <lttvwindow/lttv_plugin_tab.h>
+
 //#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
index 900154b4ef808e137b856a4d99088c7103533187..dc37164c8ad6e07dc3d22506ed47145dc7d25ac9 100644 (file)
@@ -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
index e8a49bea06ac7461490a47602f901e501009aa15..f5a76309b240de71b1ae7fbd346059c84b9b25b1 100644 (file)
@@ -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);
 
index 2818875f650edc6553354be2bb7ef0db7994c6a9..35011cb4a37b34542a88bd738dfc11582ec6fea4 100644 (file)
@@ -82,6 +82,7 @@ Xa: Frequency  (Hz)
 #include <lttv/state.h>
 #include <lttv/filter.h>
 #include <lttvwindow/lttvwindow.h>
+#include <lttvwindow/lttv_plugin_tab.h>
 #include <ltt/time.h>
 
 #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 */
index 25ca2ecf689c8a06cf4ba57533b7e4d803b48e12..bb4263ac259c6b78249ad534222657f64795f890 100644 (file)
@@ -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)
 
index 1dc237d2aa35056b276dd8a8f0e254fafbf4163f..bb8932373df05c6c500563c3011a38cabcd3b0e6 100644 (file)
@@ -46,7 +46,7 @@
 #include <lttvwindow/toolbar.h>
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/lttvwindowtraces.h>
-
+#include <lttvwindow/lttv_plugin_tab.h>
 
 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 */
index 2372124273ceb179f4272dce7dfad5fdcd096712..7dd2e0c7eb8f0b06099b37499cd85f62004f61e8 100644 (file)
@@ -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));
index ca0e203c329388cfb30595f3668b1358f9d32b57..e690ec570c70a62f1e7cea84a04de55fc2c30a11 100644 (file)
@@ -259,6 +259,7 @@ FIXME : explain other important events
 #include <lttv/stats.h>
 #include <lttv/filter.h>
 #include <lttvwindow/mainwindow.h>
+#include <lttvwindow/lttv_plugin.h>
 
 /* 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);
 
 
 /**
index 2602061e62807a2c6a57b999c3bba7e21a0e2441..f478aae9d74d7edb977f508ec6c16aeb097ec35c 100644 (file)
@@ -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;
index 047e50c4fcab6f52e25606aabd5db7e7c93c9904..c07cdd7e3070cf50486ea7a47dc07fa904e92b53 100644 (file)
@@ -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 (file)
index 0000000..e81b562
Binary files /dev/null and b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_file-properties.png differ
index 0e87e3822b6e8ade46cf440b82f5bb53c432cee8..8efa6b26a228ce06d2c689755d6e9133735fd785 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/lttvwindowtraces.h>
+#include <lttvwindow/lttv_plugin_tab.h>
 
 #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 = 
index 8382655245abbae1e96fa41744c2978889173698..bc7ec1882ed67c5b875e0517ff5ca3d297804df2 100644 (file)
@@ -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;
 }
index 5be74d21e827ec15e6b0841ec83e95f833d5f735..38735a47683447c4822def7c0791b04083a5a843 100644 (file)
@@ -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:
index f113355f3e62dcc4102dade39ef659df91f60702..46ab96aa4e679bd3bebc29b113f8094ec9e63398 100644 (file)
@@ -52,6 +52,7 @@
 #include <lttv/state.h>
 #include <lttv/filter.h>
 #include <lttvwindow/lttvwindow.h>
+#include <lttvwindow/lttv_plugin_tab.h>
 #include <ltt/time.h>
 
 #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);
This page took 0.047384 seconds and 4 git commands to generate.