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

ltt/branches/poly/lttv/modules/gui/controlflow/lttv_plugin_cfv.c [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/controlflow/lttv_plugin_cfv.h [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin.c [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin.h [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.c [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.h [new file with mode: 0644]

diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/lttv_plugin_cfv.c b/ltt/branches/poly/lttv/modules/gui/controlflow/lttv_plugin_cfv.c
new file mode 100644 (file)
index 0000000..d8b005a
--- /dev/null
@@ -0,0 +1,84 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
+
+#include "lttv_plugin_cfv.h"
+#include <lttvwindow/lttvwindow.h>
+#include "drawing.h"
+
+/* 
+ * forward definitions
+ */
+
+/*
+ * Implementation
+ */
+
+static void cfv_update_filter(LttvPlugin *parent, LttvFilter *filter)
+{
+  LttvPluginCFV *self = LTTV_PLUGIN_CFV(parent);
+  g_message("In CFV update filter.");
+  lttv_filter_destroy(self->cfd->filter);
+  self->cfd->filter = filter;
+  redraw_notify(self->cfd, NULL);
+}
+
+
+static void
+lttv_plugin_cfv_class_init (LttvPluginCFVClass *klass)
+{
+  LttvPluginClass *parent_klass;
+  parent_klass = &klass->parent;
+  parent_klass->update_filter = cfv_update_filter;
+  g_type_class_add_private (klass, sizeof (ControlFlowData));
+}
+
+
+static void
+lttv_plugin_cfv_init (GTypeInstance *instance, gpointer g_class)
+{
+  LttvPluginCFV *self = LTTV_PLUGIN_CFV (instance);
+  self->cfd = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      LTTV_TYPE_PLUGIN_CFV, ControlFlowData);
+}
+
+
+GType
+lttv_plugin_cfv_get_type (void)
+{
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      sizeof (LttvPluginCFVClass),
+      NULL,   /* base_init */
+      NULL,   /* base_finalize */
+      lttv_plugin_cfv_class_init,   /* class_init */
+      NULL,   /* class_finalize */
+      NULL,   /* class_data */
+      sizeof (LttvPluginCFV),
+      0,      /* n_preallocs */
+      lttv_plugin_cfv_init    /* instance_init */
+      };
+      type = g_type_register_static (G_TYPE_OBJECT,
+                                     "LttvPluginCFVType",
+                                     &info, 0);
+    }
+    return type;
+}
+
+
diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/lttv_plugin_cfv.h b/ltt/branches/poly/lttv/modules/gui/controlflow/lttv_plugin_cfv.h
new file mode 100644 (file)
index 0000000..45445da
--- /dev/null
@@ -0,0 +1,63 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
+#ifndef LTTV_PLUGIN_CFV_H
+#define LTTV_PLUGIN_CFV_H
+
+#include <lttvwindow/lttv_plugin.h>
+#include <lttvwindow/mainwindow-private.h>
+#include "cfv.h"
+
+/*
+ * Type macros.
+ */
+
+#define LTTV_TYPE_PLUGIN_CFV             (lttv_plugin_cfv_get_type ())
+#define LTTV_PLUGIN_CFV(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TYPE_PLUGIN_CFV, LttvPluginCFV))
+#define LTTV_PLUGIN_CFV_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), LTTV_TYPE_PLUGIN_CFV, LttvPluginCFVClass))
+#define LTTV_IS_PLUGIN_CFV(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TYPE_PLUGIN_CFV))
+#define LTTV_IS_PLUGIN_CFV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LTTV_TYPE_PLUGIN_CFV))
+#define LTTV_PLUGIN_CFV_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), LTTV_TYPE_PLUGIN_CFV, LttvPluginCFVClass))
+
+typedef struct _LttvPluginCFV LttvPluginCFV;
+typedef struct _LttvPluginCFVClass LttvPluginCFVClass;
+
+struct _LttvPluginCFV {
+  LttvPlugin parent;
+
+  /* instance members */
+  ControlFlowData *cfd;
+
+  /* private */
+};
+
+struct _LttvPluginCFVClass {
+  LttvPluginClass parent;
+
+  /* class members */
+};
+
+/* used by LTTV_PLUGIN_TAB_TYPE */
+GType lttv_plugin_cfv_get_type (void);
+
+/*
+ * Method definitions.
+ */
+
+
+#endif
diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin.c
new file mode 100644 (file)
index 0000000..32eb60b
--- /dev/null
@@ -0,0 +1,73 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
+
+#include "lttv_plugin.h"
+
+/* 
+ * forward definitions
+ */
+
+
+
+static void
+lttv_plugin_class_init (LttvPluginClass *klass)
+{
+  klass->update_filter = NULL; /* Pure Virtual */
+}
+
+static void
+lttv_plugin_instance_init (GTypeInstance *instance, gpointer g_class)
+{
+  LttvPlugin *self;
+  self->top_widget = NULL;
+}
+
+GType
+lttv_plugin_get_type (void)
+{
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      sizeof (LttvPluginClass),
+      NULL,   /* base_init */
+      NULL,   /* base_finalize */
+      lttv_plugin_class_init,   /* class_init */
+      NULL,   /* class_finalize */
+      NULL,   /* class_data */
+      sizeof (LttvPlugin),
+      0,      /* n_preallocs */
+      NULL    /* instance_init */
+      };
+      type = g_type_register_static (G_TYPE_OBJECT,
+                                     "LttvPluginType",
+                                     &info, 0);
+    }
+    return type;
+}
+
+
+/* implementation in the source file */
+void lttv_plugin_update_filter (LttvPlugin *self, LttvFilter *filter)
+{
+  LTTV_PLUGIN_GET_CLASS (self)->update_filter (self, filter);
+}
+
+
+
+
diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin.h
new file mode 100644 (file)
index 0000000..4db2d04
--- /dev/null
@@ -0,0 +1,72 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
+/* The LttvPlugin class is a pure virtual class. It only contains the functions
+ * available for interaction with a plugin (tab or viewer).
+ */
+
+#ifndef LTTV_PLUGIN_H
+#define LTTV_PLUGIN_H
+
+#include <gtk/gtk.h>
+#include <lttv/filter.h>
+
+/*
+ * Type macros.
+ */
+
+#define LTTV_TYPE_PLUGIN                 (lttv_plugin_get_type ())
+#define LTTV_PLUGIN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TYPE_PLUGIN, LttvPlugin))
+#define LTTV_PLUGIN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), LTTV_TYPE_PLUGIN, LttvPluginClass))
+#define LTTV_IS_PLUGIN(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TYPE_PLUGIN))
+#define LTTV_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LTTV_TYPE_PLUGIN))
+#define LTTV_PLUGIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), LTTV_TYPE_PLUGIN, LttvPluginClass))
+
+typedef struct _LttvPlugin LttvPlugin;
+typedef struct _LttvPluginClass LttvPluginClass;
+
+struct _LttvPlugin {
+  GObject parent;
+  /* instance members */
+  GtkWidget *top_widget;
+
+  /* private */
+};
+
+struct _LttvPluginClass {
+  GObjectClass parent;
+
+  void (*update_filter) (LttvPlugin *self, LttvFilter *filter);
+  
+  /* class members */
+};
+
+/* used by LTTV_PLUGIN_TYPE */
+GType lttv_plugin_get_type (void);
+
+/*
+ * Method definitions.
+ */
+
+/* declaration in the header. */
+void lttv_plugin_update_filter (LttvPlugin *self, LttvFilter *filter);
+
+
+
+
+#endif
diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.c
new file mode 100644 (file)
index 0000000..4571f65
--- /dev/null
@@ -0,0 +1,83 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
+
+#include "lttv_plugin_tab.h"
+#include <lttvwindow/lttvwindow.h>
+
+/* 
+ * forward definitions
+ */
+
+/*
+ * Implementation
+ */
+
+static void tab_update_filter(LttvPlugin *parent, LttvFilter *filter)
+{
+  LttvPluginTab *self = LTTV_PLUGIN_TAB(parent);
+  g_message("In tab update filter.");
+  lttv_filter_destroy(self->tab->filter);
+  self->tab->filter = filter;
+  lttvwindow_report_filter(self->tab, filter);
+}
+
+
+static void
+lttv_plugin_tab_class_init (LttvPluginTabClass *klass)
+{
+  LttvPluginClass *parent_klass;
+  parent_klass = &klass->parent;
+  parent_klass->update_filter = tab_update_filter;
+  g_type_class_add_private (klass, sizeof (Tab));
+}
+
+
+static void
+lttv_plugin_tab_init (GTypeInstance *instance, gpointer g_class)
+{
+  LttvPluginTab *self = LTTV_PLUGIN_TAB (instance);
+  self->tab = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      LTTV_TYPE_PLUGIN_TAB, Tab);
+}
+
+
+GType
+lttv_plugin_tab_get_type (void)
+{
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      sizeof (LttvPluginTabClass),
+      NULL,   /* base_init */
+      NULL,   /* base_finalize */
+      lttv_plugin_tab_class_init,   /* class_init */
+      NULL,   /* class_finalize */
+      NULL,   /* class_data */
+      sizeof (LttvPluginTab),
+      0,      /* n_preallocs */
+      lttv_plugin_tab_init    /* instance_init */
+      };
+      type = g_type_register_static (G_TYPE_OBJECT,
+                                     "LttvPluginTabType",
+                                     &info, 0);
+    }
+    return type;
+}
+
+
diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.h
new file mode 100644 (file)
index 0000000..6acbec4
--- /dev/null
@@ -0,0 +1,62 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
+#ifndef LTTV_PLUGIN_TAB_H
+#define LTTV_PLUGIN_TAB_H
+
+#include <lttvwindow/lttv_plugin.h>
+#include <lttvwindow/mainwindow-private.h>
+
+/*
+ * Type macros.
+ */
+
+#define LTTV_TYPE_PLUGIN_TAB             (lttv_plugin_tab_get_type ())
+#define LTTV_PLUGIN_TAB(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TYPE_PLUGIN_TAB, LttvPluginTab))
+#define LTTV_PLUGIN_TAB_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), LTTV_TYPE_PLUGIN_TAB, LttvPluginTabClass))
+#define LTTV_IS_PLUGIN_TAB(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TYPE_PLUGIN_TAB))
+#define LTTV_IS_PLUGIN_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LTTV_TYPE_PLUGIN_TAB))
+#define LTTV_PLUGIN_TAB_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), LTTV_TYPE_PLUGIN_TAB, LttvPluginTabClass))
+
+typedef struct _LttvPluginTab LttvPluginTab;
+typedef struct _LttvPluginTabClass LttvPluginTabClass;
+
+struct _LttvPluginTab {
+  LttvPlugin parent;
+
+  /* instance members */
+  Tab *tab;
+
+  /* private */
+};
+
+struct _LttvPluginTabClass {
+  LttvPluginClass parent;
+
+  /* class members */
+};
+
+/* used by LTTV_PLUGIN_TAB_TYPE */
+GType lttv_plugin_tab_get_type (void);
+
+/*
+ * Method definitions.
+ */
+
+
+#endif
This page took 0.028768 seconds and 4 git commands to generate.