[nemiver/profiler: 2/8] Basic for the profiling perspective



commit 4b922b77d828e509f418d1681b38f01c9cd65be5
Author: Fabien Parent <parent f gmail com>
Date:   Mon May 21 22:24:34 2012 +0200

    Basic for the profiling perspective

 configure.ac                                      |   10 +
 src/persp/Makefile.am                             |    2 +-
 src/persp/profperspective/Makefile.am             |   34 ++++
 src/persp/profperspective/nmv-prof-perspective.cc |  203 +++++++++++++++++++++
 src/persp/profperspective/nmv-prof-perspective.h  |   49 +++++
 src/persp/profperspective/plugin-descriptor.xml   |   15 ++
 6 files changed, 312 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a007b54..bc25b27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -379,6 +379,14 @@ NEMIVERDBGPERSP_CFLAGS="$NEMIVERDBGPERSP_CFLAGS $CPPUNIT_CFLAGS"
 AC_SUBST(NEMIVERDBGPERSP_LIBS)
 AC_SUBST(NEMIVERDBGPERSP_CFLAGS)
 
+dnl library dependencies for the nemiver profiling perspective plugin
+PKG_CHECK_MODULES(NEMIVERPROFPERSP, $DEP_UICOMMON)
+NEMIVERPROFPERSP_LIBS="$NEMIVERPROFPERSP_LIBS $CPPUNIT_LIBS"
+NEMIVERPROFPERSP_CFLAGS="$NEMIVERPROFPERSP_CFLAGS $CPPUNIT_CFLAGS"
+
+AC_SUBST(NEMIVERPROFPERSP_LIBS)
+AC_SUBST(NEMIVERPROFPERSP_CFLAGS)
+
 NEMIVER_LIBS="$NEMIVERUICOMMON_LIBS"
 NEMIVER_CFLAGS="$NEMIVERUICOMMON_CFLAGS"
 
@@ -488,6 +496,8 @@ src/Makefile
     src/persp/dbgperspective/icons/Makefile
     src/persp/dbgperspective/sqlscripts/Makefile
     src/persp/dbgperspective/sqlscripts/sqlite/Makefile
+  src/persp/profperspective/Makefile
+  src/persp/profperspective/profperspective.conf
 data/Makefile
     data/icons/Makefile
         data/icons/16x16/Makefile
diff --git a/src/persp/Makefile.am b/src/persp/Makefile.am
index 335bc9d..d9becf1 100644
--- a/src/persp/Makefile.am
+++ b/src/persp/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS=dbgperspective
+SUBDIRS=dbgperspective profperspective
 
 h=$(abs_srcdir)
 
diff --git a/src/persp/profperspective/Makefile.am b/src/persp/profperspective/Makefile.am
new file mode 100644
index 0000000..7920e02
--- /dev/null
+++ b/src/persp/profperspective/Makefile.am
@@ -0,0 +1,34 @@
+h=$(abs_srcdir)
+
+plugin_config_files= \
+plugin-descriptor.xml \
+profperspective.conf
+
+EXTRA_DIST=$(plugin_config_files)
+
+pluginconfig_DATA=$(plugin_config_files)
+
+PLUGIN_NAME=profperspective
+pluginconfigdir= NEMIVER_PLUGINS_DIR@/$(PLUGIN_NAME)
+
+plugin_LTLIBRARIES=libprofperspectiveplugin.la
+plugindir= NEMIVER_PLUGINS_DIR@/$(PLUGIN_NAME)
+sources= \
+$(h)/nmv-prof-perspective.cc \
+$(h)/nmv-prof-perspective.h
+
+libprofperspectiveplugin_la_SOURCES=$(sources)
+libprofperspectiveplugin_la_LDFLAGS= -module -avoid-version -Wl,--as-needed
+libprofperspectiveplugin_la_LIBADD= \
+ NEMIVERPROFPERSP_LIBS@ \
+$(abs_top_builddir)/src/common/libnemivercommon.la \
+$(abs_top_builddir)/src/uicommon/libnemiveruicommon.la
+
+INCLUDES= NEMIVERPROFPERSP_CFLAGS@ -DENABLE_NLS=1 -DDATADIR=\"${datadir}\" \
+-I$(abs_top_srcdir)/src \
+-I$(abs_top_srcdir)/src/confmgr \
+-I$(abs_top_srcdir)/src/uicommon \
+-I$(abs_top_srcdir)/src/workbench \
+-I$(abs_top_srcdir)/src/persp \
+-I$(abs_top_srcdir)/src/profperspective
+
diff --git a/src/persp/profperspective/nmv-prof-perspective.cc b/src/persp/profperspective/nmv-prof-perspective.cc
new file mode 100644
index 0000000..f78cc6a
--- /dev/null
+++ b/src/persp/profperspective/nmv-prof-perspective.cc
@@ -0,0 +1,203 @@
+//Author: Fabien Parent
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver 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 Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+
+#include "nmv-prof-perspective.h"
+#include <list>
+#include <gtkmm/widget.h>
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+class ProfPerspective : public IProfPerspective {
+    //non copyable
+    ProfPerspective (const IProfPerspective&);
+    ProfPerspective& operator= (const IProfPerspective&);
+
+    Gtk::TextView body;
+    IWorkbench *workbench;
+    sigc::signal<void, bool> signal_activated;
+    sigc::signal<void> signal_layout_changed;
+
+public:
+
+    ProfPerspective (DynamicModule *a_dynmod);
+    GOptionGroup* option_group () const;
+    bool process_options (GOptionContext *a_context,
+                          int a_argc,
+                          char **a_argv);
+    bool process_gui_options (int a_argc, char **a_argv);
+    const UString& name () const;
+    void do_init (IWorkbench *a_workbench);
+    const UString& get_perspective_identifier ();
+    void get_toolbars (std::list<Gtk::Widget*> &a_tbs);
+    Gtk::Widget* get_body ();
+    IWorkbench& get_workbench ();
+    std::list<Gtk::UIManager::ui_merge_id> edit_workbench_menu ();
+    Gtk::Widget* load_menu (const UString &a_filename,
+                            const UString &a_widget_name);
+    bool agree_to_shutdown ();
+
+    sigc::signal<void, bool>& activated_signal ();
+    sigc::signal<void>& layout_changed_signal ();
+}; // end class ProfPerspective
+
+ProfPerspective::ProfPerspective (DynamicModule *a_dynmod) :
+    IProfPerspective (a_dynmod)
+{
+}
+
+GOptionGroup*
+ProfPerspective::option_group () const
+{
+    return 0;
+}
+
+bool
+ProfPerspective::process_options (GOptionContext */*a_context*/,
+                 int /*a_argc*/,
+                 char **/*a_argv*/)
+{
+    return true;
+}
+
+bool
+ProfPerspective::process_gui_options (int /*a_argc*/, char **/*a_argv*/)
+{
+    return true;
+}
+
+const UString&
+ProfPerspective::name () const
+{
+    static const UString &s_name = "Profiler";
+    return s_name;
+}
+
+void
+ProfPerspective::do_init (IWorkbench *a_workbench)
+{
+    workbench = a_workbench;
+}
+
+const UString&
+ProfPerspective::get_perspective_identifier ()
+{
+    static UString s_id = "org.nemiver.ProfilerPerspective";
+    return s_id;
+}
+
+void
+ProfPerspective::get_toolbars (std::list<Gtk::Widget*> &/*a_tbs*/)
+{
+
+}
+
+Gtk::Widget*
+ProfPerspective::get_body ()
+{
+    return &body;
+}
+
+IWorkbench&
+ProfPerspective::get_workbench ()
+{
+    THROW_IF_FAIL (workbench);
+    return *workbench;
+}
+
+std::list<Gtk::UIManager::ui_merge_id>
+ProfPerspective::edit_workbench_menu ()
+{
+    return std::list<Gtk::UIManager::ui_merge_id> ();
+}
+
+Gtk::Widget*
+ProfPerspective::load_menu (const UString &/*a_filename*/, const UString &/*a_widget_name*/)
+{
+    return 0;
+}
+
+bool
+ProfPerspective::agree_to_shutdown ()
+{
+    return true;
+}
+
+sigc::signal<void, bool>&
+ProfPerspective::activated_signal ()
+{
+    return signal_activated;
+}
+
+sigc::signal<void>&
+ProfPerspective::layout_changed_signal ()
+{
+    return signal_layout_changed;
+}
+
+class ProfPerspectiveModule : DynamicModule {
+
+public:
+
+    void get_info (Info &a_info) const
+    {
+        static Info s_info ("Profiler perspective plugin",
+                            "The profiler perspective of Nemiver",
+                            "1.0");
+        a_info = s_info;
+    }
+
+    void do_init ()
+    {
+    }
+
+    bool lookup_interface (const std::string &a_iface_name,
+                           DynModIfaceSafePtr &a_iface)
+    {
+        LOG_DD ("looking up interface: " + a_iface_name);
+        if (a_iface_name == "IPerspective") {
+            a_iface.reset (new ProfPerspective (this));
+        } else if (a_iface_name == "IProfPerspective") {
+            a_iface.reset (new ProfPerspective (this));
+        } else {
+            return false;
+        }
+        LOG_DD ("interface " + a_iface_name + " found");
+        return true;
+    }
+};// end class ProfPerspective
+
+NEMIVER_END_NAMESPACE (nemiver)
+
+//the dynmod initial factory.
+extern "C" {
+NEMIVER_API bool
+nemiver_common_create_dynamic_module_instance (void **a_new_instance)
+{
+    *a_new_instance = new nemiver::ProfPerspectiveModule ();
+    return (*a_new_instance != 0);
+}
+
+}//end extern C
+
diff --git a/src/persp/profperspective/nmv-prof-perspective.h b/src/persp/profperspective/nmv-prof-perspective.h
new file mode 100644
index 0000000..75731b9
--- /dev/null
+++ b/src/persp/profperspective/nmv-prof-perspective.h
@@ -0,0 +1,49 @@
+//Author: Fabien Parent
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver 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 Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+#ifndef __NMV_PROF_PERSPECTIVE_H__
+#define __NMV_PROF_PERSPECTIVE_H__
+
+#include "nmv-i-perspective.h"
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+class NEMIVER_API IProfPerspective : public IPerspective {
+    //non copyable
+    IProfPerspective (const IProfPerspective&);
+    IProfPerspective& operator= (const IProfPerspective&);
+
+public:
+
+    IProfPerspective (DynamicModule *a_dynmod) :
+        IPerspective (a_dynmod)
+    {
+    }
+
+    virtual ~IProfPerspective () {};
+};//end class IProfPerspective
+
+NEMIVER_END_NAMESPACE (nemiver)
+#endif //__NMV_PROF_PERSPECTIVE_H__
+
diff --git a/src/persp/profperspective/plugin-descriptor.xml b/src/persp/profperspective/plugin-descriptor.xml
new file mode 100644
index 0000000..8c6a53c
--- /dev/null
+++ b/src/persp/profperspective/plugin-descriptor.xml
@@ -0,0 +1,15 @@
+<plugindescriptor autoactivate="yes" candeactivate="no">
+    <name>profperspective</name>
+    <version>0.0.1</version>
+    <entrypoint>
+        <modulename>profperspective</modulename>
+        <interfacename>IProfPerspective</interfacename>
+    </entrypoint>
+    <dependencies>
+        <plugin>
+            <name>profperspective</name>
+            <version>0.0.1</version>
+        </plugin>
+    </dependencies>
+</plugindescriptor>
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]