nemiver r674 - in trunk: . src/persp/dbgperspective src/persp/dbgperspective/glade src/persp/dbgperspective/menus



Author: jjongsma
Date: Thu Jan 10 03:00:58 2008
New Revision: 674
URL: http://svn.gnome.org/viewvc/nemiver?rev=674&view=rev

Log:
Add global variables dialog

	* src/persp/dbgperspective/Makefile.am: add new files
	* src/persp/dbgperspective/glade/Makefile.am: add new file
	* src/persp/dbgperspective/menus/menus.xml: add menu item to view the global
	variables dialog
	* src/persp/dbgperspective/nmv-dbg-perspective.cc: add handling for global
	variable view action
	* src/persp/dbgperspective/glade/globalvarsinspector.glade:
	* src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc:
	* src/persp/dbgperspective/nmv-global-vars-inspector-dialog.h: add a global
	variables display dialog
	* src/persp/dbgperspective/nmv-variables-utils2.cc:
	* src/persp/dbgperspective/nmv-variables-utils2.h: update the
	append_a_variable() functions to take a const RefPtr&
	* src/persp/dbgperspective/nmv-vars-treeview.cc:
	* src/persp/dbgperspective/nmv-vars-treeview.h: abstract out the treeview
	that displays variables so that we can use it in several different places
	and reduce code duplication.  Right now it is only used in the global
	variables widget, but the locals and variable inspector dialog may be
	refactored to use it later


Added:
   trunk/src/persp/dbgperspective/glade/globalvarsinspector.glade
   trunk/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
   trunk/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.h
   trunk/src/persp/dbgperspective/nmv-vars-treeview.cc
   trunk/src/persp/dbgperspective/nmv-vars-treeview.h
Modified:
   trunk/ChangeLog
   trunk/src/persp/dbgperspective/Makefile.am
   trunk/src/persp/dbgperspective/glade/Makefile.am
   trunk/src/persp/dbgperspective/menus/menus.xml
   trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc
   trunk/src/persp/dbgperspective/nmv-variables-utils2.cc
   trunk/src/persp/dbgperspective/nmv-variables-utils2.h

Modified: trunk/src/persp/dbgperspective/Makefile.am
==============================================================================
--- trunk/src/persp/dbgperspective/Makefile.am	(original)
+++ trunk/src/persp/dbgperspective/Makefile.am	Thu Jan 10 03:00:58 2008
@@ -54,6 +54,8 @@
 nmv-local-vars-inspector.h \
 nmv-local-vars-inspector2.cc \
 nmv-local-vars-inspector2.h \
+nmv-global-vars-inspector-dialog.cc \
+nmv-global-vars-inspector-dialog.h \
 nmv-var-inspector.cc \
 nmv-var-inspector.h \
 nmv-var-inspector2.cc \
@@ -75,7 +77,9 @@
 nmv-remote-target-dialog.cc \
 nmv-remote-target-dialog.h \
 nmv-dbg-perspective.cc \
-nmv-dbg-perspective.h
+nmv-dbg-perspective.h \
+nmv-vars-treeview.h \
+nmv-vars-treeview.cc
 
 if BUILD_MEMORYVIEW
 memoryview_sources = \

Modified: trunk/src/persp/dbgperspective/glade/Makefile.am
==============================================================================
--- trunk/src/persp/dbgperspective/glade/Makefile.am	(original)
+++ trunk/src/persp/dbgperspective/glade/Makefile.am	Thu Jan 10 03:00:58 2008
@@ -11,7 +11,8 @@
 openfiledialog.glade \
 setbreakpointdialog.glade \
 chooseoverloadsdialog.glade \
-remotetargetdialog.glade
+remotetargetdialog.glade \
+globalvarsinspector.glade
 
 gladedir = @NEMIVER_PLUGINS_DIR@/$(PLUGIN_NAME)/glade
 glade_DATA = $(gladefiles)

Added: trunk/src/persp/dbgperspective/glade/globalvarsinspector.glade
==============================================================================
--- (empty file)
+++ trunk/src/persp/dbgperspective/glade/globalvarsinspector.glade	Thu Jan 10 03:00:58 2008
@@ -0,0 +1,78 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
+
+<glade-interface>
+
+<widget class="GtkDialog" id="globalvarsinspector">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Global Variables</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="default_width">600</property>
+  <property name="default_height">500</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+  <property name="has_separator">False</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area1">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="closebutton">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-7</property>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkVBox" id="inspectorwidgetbox">
+	  <property name="border_width">6</property>
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <placeholder/>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>

Modified: trunk/src/persp/dbgperspective/menus/menus.xml
==============================================================================
--- trunk/src/persp/dbgperspective/menus/menus.xml	(original)
+++ trunk/src/persp/dbgperspective/menus/menus.xml	Thu Jan 10 03:00:58 2008
@@ -48,6 +48,8 @@
                 name="ActivateRegistersViewMenuItem"/>
             <menuitem action="ActivateMemoryViewMenuAction"
                 name="ActivateMemoryViewMenuItem"/>
+            <menuitem action="ActivateGlobalVariablesDialogMenuAction"
+                name="ActivateGlobalVariablesDialogMenuItem"/>
             <separator/>
             <!--<menuitem action="ShowCommandsMenuAction"
                 name="ShowCommandsMenuItem"/> -->

Modified: trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc
==============================================================================
--- trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc	(original)
+++ trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc	Thu Jan 10 03:00:58 2008
@@ -58,6 +58,7 @@
 #else
 #include "nmv-local-vars-inspector2.h"
 #endif
+#include "nmv-global-vars-inspector-dialog.h"
 #include "nmv-terminal.h"
 #include "nmv-breakpoints-view.h"
 #include "nmv-open-file-dialog.h"
@@ -308,6 +309,7 @@
 #ifdef WITH_MEMORYVIEW
     void on_activate_memory_view () ;
 #endif // WITH_MEMORYVIEW
+    void on_activate_global_variables () ;
     void on_default_config_read ();
 
     //************
@@ -2134,6 +2136,14 @@
 #endif // WITH_MEMORYVIEW
 
 void
+DBGPerspective::on_activate_global_variables ()
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD ;
+    GlobalVarsInspectorDialog dialog (plugin_path (), debugger (), workbench ()) ;
+    dialog.run () ;
+}
+
+void
 DBGPerspective::on_default_config_read ()
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
@@ -2475,6 +2485,15 @@
         },
 #endif // WITH_MEMORYVIEW
         {
+            "ActivateGlobalVariablesDialogMenuAction",
+            nil_stock_id,
+            _("Global Variables"),
+            _("Display Global variables"),
+            sigc::mem_fun(*this, &DBGPerspective::on_activate_global_variables),
+            ActionEntry::DEFAULT,
+            "<control>G"
+        },
+        {
             "ShowCommandsMenuAction",
             nil_stock_id,
             _("Show Commands"),

Added: trunk/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
==============================================================================
--- (empty file)
+++ trunk/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc	Thu Jan 10 03:00:58 2008
@@ -0,0 +1,311 @@
+//Author: Dodji Seketeli
+/*
+ *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 "config.h"
+
+#ifdef WITH_VARIABLE_WALKER
+
+#include <map>
+#include <list>
+#include <glib/gi18n.h>
+#include "common/nmv-exception.h"
+#include "nmv-global-vars-inspector-dialog.h"
+#include "nmv-variables-utils2.h"
+#include "nmv-vars-treeview.h"
+#include "nmv-ui-utils.h"
+#include "nmv-i-workbench.h"
+#include "nmv-i-var-list-walker.h"
+
+using namespace nemiver::common ;
+namespace vutil=nemiver::variables_utils2 ;
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+struct GlobalVarsInspectorDialog::Priv {
+private:
+    Priv ();
+public:
+    Gtk::Dialog &dialog ;
+    Glib::RefPtr<Gnome::Glade::Xml> glade ;
+    IDebuggerSafePtr debugger ;
+    IVarListWalkerSafePtr global_variables_walker_list;
+
+    IWorkbench &workbench ;
+    VarsTreeViewSafePtr tree_view ;
+    Glib::RefPtr<Gtk::TreeStore> tree_store ;
+    Gtk::TreeModel::iterator cur_selected_row ;
+    SafePtr<Gtk::Menu> contextual_menu ;
+    UString previous_function_name ;
+
+    Priv (Gtk::Dialog &a_dialog,
+            const Glib::RefPtr<Gnome::Glade::Xml> &a_glade,
+            IDebuggerSafePtr &a_debugger,
+            IWorkbench &a_workbench) :
+        dialog (a_dialog),
+        glade (a_glade),
+        workbench (a_workbench)
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
+        THROW_IF_FAIL (a_debugger) ;
+        debugger = a_debugger ;
+        build_tree_view () ;
+        re_init_tree_view () ;
+        connect_to_debugger_signals () ;
+        init_graphical_signals () ;
+        build_dialog ();
+        debugger->list_global_variables () ;
+    }
+
+    void build_dialog ()
+    {
+        Gtk::Box *box =
+            ui_utils::get_widget_from_glade<Gtk::Box> (glade,
+                    "inspectorwidgetbox") ;
+        THROW_IF_FAIL (box);
+        Gtk::ScrolledWindow *scr = Gtk::manage (new Gtk::ScrolledWindow) ;
+        THROW_IF_FAIL (scr);
+        scr->set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) ;
+        scr->set_shadow_type (Gtk::SHADOW_IN);
+        THROW_IF_FAIL (tree_view);
+        scr->add (*tree_view) ;
+        box->pack_start (*scr) ;
+        dialog.show_all () ;
+    }
+
+    void build_tree_view ()
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+        if (tree_view) {return;}
+        tree_view = VarsTreeView::create ();
+        THROW_IF_FAIL (tree_view);
+        tree_store = tree_view->get_tree_store ();
+        THROW_IF_FAIL (tree_store);
+    }
+
+    void re_init_tree_view ()
+    {
+        NEMIVER_TRY
+
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+        THROW_IF_FAIL (tree_view);
+        THROW_IF_FAIL (tree_store) ;
+        //tree_store->clear () ;
+        previous_function_name = "" ;
+        NEMIVER_CATCH
+    }
+
+    IVarListWalkerSafePtr get_global_variables_walker_list ()
+    {
+        if (!global_variables_walker_list) {
+            global_variables_walker_list = create_variable_walker_list () ;
+            THROW_IF_FAIL (global_variables_walker_list) ;
+            global_variables_walker_list->variable_visited_signal ().connect
+                (sigc::mem_fun
+                 (*this, &GlobalVarsInspectorDialog::Priv::on_global_variable_visited_signal)) ;
+        }
+        return global_variables_walker_list ;
+    }
+
+    IVarListWalkerSafePtr create_variable_walker_list ()
+    {
+        DynamicModule::Loader *loader =
+            workbench.get_dynamic_module ().get_module_loader ();
+        THROW_IF_FAIL (loader) ;
+        DynamicModuleManager *module_manager = loader->get_dynamic_module_manager ();
+        THROW_IF_FAIL (module_manager) ;
+        IVarListWalkerSafePtr result =
+            module_manager->load_iface<IVarListWalker> ("varlistwalker",
+                                                        "IVarListWalker");
+        THROW_IF_FAIL (result) ;
+        result->initialize (debugger) ;
+        return result ;
+    }
+
+
+    void connect_to_debugger_signals ()
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
+        THROW_IF_FAIL (debugger) ;
+        debugger->global_variables_listed_signal ().connect
+            (sigc::mem_fun (*this, &Priv::on_global_variables_listed_signal)) ;
+    }
+
+    void init_graphical_signals ()
+    {
+        THROW_IF_FAIL (tree_view) ;
+        Glib::RefPtr<Gtk::TreeSelection> selection = tree_view->get_selection () ;
+        THROW_IF_FAIL (selection) ;
+        selection->signal_changed ().connect
+            (sigc::mem_fun (*this, &Priv::on_tree_view_selection_changed_signal));
+        tree_view->signal_row_expanded ().connect
+            (sigc::mem_fun (*this, &Priv::on_tree_view_row_expanded_signal)) ;
+        tree_view->signal_row_activated ().connect
+            (sigc::mem_fun (*this, &Priv::on_tree_view_row_activated_signal)) ;
+    }
+
+    void set_global_variables (const std::list<IDebugger::VariableSafePtr> &a_vars)
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
+        THROW_IF_FAIL (tree_view && tree_store);
+        tree_store->clear ();
+        std::list<IDebugger::VariableSafePtr>::const_iterator it ;
+        for (it = a_vars.begin () ; it != a_vars.end () ; ++it) {
+            THROW_IF_FAIL ((*it)->name () != "") ;
+            append_a_global_variable (*it) ;
+        }
+    }
+
+    void append_a_global_variable (const IDebugger::VariableSafePtr &a_var)
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
+        THROW_IF_FAIL (tree_view && tree_store) ;
+
+        Gtk::TreeModel::iterator iter;
+        vutil::append_a_variable (a_var, static_cast<Gtk::TreeView&>(*tree_view),
+                Glib::RefPtr<Gtk::TreeStore>::cast_static(tree_store),
+                iter /* no parent */,
+                iter /* result iter */) ;
+        tree_view->expand_row (tree_store->get_path (iter), false) ;
+    }
+
+    void update_a_global_variable (const IDebugger::VariableSafePtr &a_var)
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
+        THROW_IF_FAIL (tree_view) ;
+        Gtk::TreeModel::iterator parent_row_it ;
+        vutil::update_a_variable (a_var, *tree_view, parent_row_it,
+                                  true, false) ;
+    }
+
+    //****************************
+    //<debugger signal handlers>
+    //****************************
+    void on_global_variables_listed_signal
+                                (const list<IDebugger::VariableSafePtr> &a_vars,
+                                 const UString &a_cookie)
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
+        if (a_cookie == "") {}
+
+        NEMIVER_TRY
+
+        IVarListWalkerSafePtr walker_list = get_global_variables_walker_list () ;
+        THROW_IF_FAIL (walker_list) ;
+
+        walker_list->remove_variables () ;
+        walker_list->append_variables (a_vars) ;
+        walker_list->do_walk_variables () ;
+
+        NEMIVER_CATCH
+    }
+
+    //****************************
+    //</debugger signal handlers>
+    //****************************
+
+    void on_global_variable_visited_signal (const IVarWalkerSafePtr &a_walker)
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
+        NEMIVER_TRY
+
+        THROW_IF_FAIL (a_walker->get_variable ()) ;
+
+        append_a_global_variable (a_walker->get_variable ()) ;
+
+        NEMIVER_CATCH
+    }
+
+    void on_tree_view_selection_changed_signal ()
+    {
+    }
+
+    void on_tree_view_row_expanded_signal (const Gtk::TreeModel::iterator &a_it,
+                                           const Gtk::TreeModel::Path &a_path)
+    {
+        if (a_it) {}
+        if (a_path.size ()) {}
+    }
+
+    void on_tree_view_row_activated_signal (const Gtk::TreeModel::Path &a_path,
+                                            Gtk::TreeViewColumn *a_col)
+    {
+        NEMIVER_TRY
+        THROW_IF_FAIL (tree_view && tree_store) ;
+        Gtk::TreeModel::iterator it = tree_store->get_iter (a_path) ;
+        UString type =
+            (Glib::ustring) it->get_value (vutil::get_variable_columns ().type) ;
+        if (type == "") {return;}
+
+        if (a_col != tree_view->get_column (2)) {return;}
+        cur_selected_row = it ;
+        show_variable_type_in_dialog () ;
+        NEMIVER_CATCH
+    }
+
+    void show_variable_type_in_dialog ()
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
+        if (!cur_selected_row) {return;}
+        UString type =
+            (Glib::ustring) (*cur_selected_row)[vutil::get_variable_columns ().type] ;
+        UString message ;
+        message.printf (_("Variable type is: \n %s"), type.c_str ()) ;
+
+        IDebugger::VariableSafePtr variable =
+            (IDebugger::VariableSafePtr)
+                cur_selected_row->get_value (vutil::get_variable_columns ().variable);
+        THROW_IF_FAIL (variable) ;
+        //message += "\nDumped for debug: \n" ;
+        //variable->to_string (message, false) ;
+        ui_utils::display_info (message) ;
+    }
+
+};//end GlobalVarsInspectorDialog::Priv
+
+GlobalVarsInspectorDialog::GlobalVarsInspectorDialog (const UString &a_root_path,
+        IDebuggerSafePtr &a_debugger, IWorkbench &a_workbench) :
+    Dialog (a_root_path,
+            "globalvarsinspector.glade",
+            "globalvarsinspector")
+{
+    m_priv.reset (new Priv (widget (), glade (), a_debugger, a_workbench));
+}
+
+GlobalVarsInspectorDialog::~GlobalVarsInspectorDialog ()
+{
+    LOG_D ("deleted", "destructor-domain") ;
+}
+
+NEMIVER_END_NAMESPACE (nemiver)
+
+#endif //WITH_VARIABLE_WALKER
+

Added: trunk/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.h
==============================================================================
--- (empty file)
+++ trunk/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.h	Thu Jan 10 03:00:58 2008
@@ -0,0 +1,63 @@
+//Author: Jonathon Jongsma
+/*
+ *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_GLOBAL_VARS_INSPECTOR_DIALOG_H__
+#define __NMV_GLOBAL_VARS_INSPECTOR_DIALOG_H__
+
+#include <list>
+#include "common/nmv-object.h"
+#include "common/nmv-safe-ptr-utils.h"
+#include "nmv-dialog.h"
+#include "nmv-i-debugger.h"
+
+namespace Gtk {
+    class Widget ;
+}
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+class IWorkbench ;
+
+class NEMIVER_API GlobalVarsInspectorDialog : public Dialog {
+    //non copyable
+    GlobalVarsInspectorDialog (const GlobalVarsInspectorDialog&) ;
+    GlobalVarsInspectorDialog& operator= (const GlobalVarsInspectorDialog&) ;
+
+    struct Priv ;
+    SafePtr<Priv> m_priv ;
+
+protected:
+    GlobalVarsInspectorDialog () ;
+
+public:
+
+    GlobalVarsInspectorDialog (const UString &a_root_path,
+            IDebuggerSafePtr &a_dbg, IWorkbench &a_wb) ;
+    virtual ~GlobalVarsInspectorDialog () ;
+};//end GlobalVarsInspectorDialog
+
+NEMIVER_END_NAMESPACE (nemiver)
+#endif //__NMV_GLOBAL_VARS_INSPECTOR_DIALOG_H__
+
+

Modified: trunk/src/persp/dbgperspective/nmv-variables-utils2.cc
==============================================================================
--- trunk/src/persp/dbgperspective/nmv-variables-utils2.cc	(original)
+++ trunk/src/persp/dbgperspective/nmv-variables-utils2.cc	Thu Jan 10 03:00:58 2008
@@ -222,7 +222,7 @@
 void
 append_a_variable (const IDebugger::VariableSafePtr &a_var,
                    const Gtk::TreeView &a_tree_view,
-                   Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
+                   const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
                    Gtk::TreeModel::iterator &a_parent_row_it)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD ;
@@ -235,7 +235,7 @@
 void
 append_a_variable (const IDebugger::VariableSafePtr &a_var,
                    const Gtk::TreeView &a_tree_view,
-                   Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
+                   const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
                    Gtk::TreeModel::iterator &a_parent_row_it,
                    Gtk::TreeModel::iterator &a_result)
 {

Modified: trunk/src/persp/dbgperspective/nmv-variables-utils2.h
==============================================================================
--- trunk/src/persp/dbgperspective/nmv-variables-utils2.h	(original)
+++ trunk/src/persp/dbgperspective/nmv-variables-utils2.h	Thu Jan 10 03:00:58 2008
@@ -88,12 +88,12 @@
 
 void append_a_variable (const IDebugger::VariableSafePtr &a_var,
                         const Gtk::TreeView &a_tree_view,
-                        Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
+                        const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
                         Gtk::TreeModel::iterator &a_parent_row_it) ;
 
 void append_a_variable (const IDebugger::VariableSafePtr &a_var,
                         const Gtk::TreeView &a_tree_view,
-                        Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
+                        const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
                         Gtk::TreeModel::iterator &a_parent_row_it,
                         Gtk::TreeModel::iterator &a_result /*the resulting row*/);
 

Added: trunk/src/persp/dbgperspective/nmv-vars-treeview.cc
==============================================================================
--- (empty file)
+++ trunk/src/persp/dbgperspective/nmv-vars-treeview.cc	Thu Jan 10 03:00:58 2008
@@ -0,0 +1,78 @@
+//Author: Jonathon Jongsma
+/*
+ *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 <glib/gi18n.h>
+#include "nmv-vars-treeview.h"
+#include "nmv-variables-utils2.h"
+
+namespace vutil=nemiver::variables_utils2 ;
+
+namespace nemiver {
+
+VarsTreeViewSafePtr VarsTreeView::create ()
+{
+    Glib::RefPtr<Gtk::TreeStore> model =
+        Gtk::TreeStore::create (vutil::get_variable_columns ());
+    THROW_IF_FAIL (model);
+    return VarsTreeViewSafePtr(new VarsTreeView (model));
+}
+
+VarsTreeView::VarsTreeView (Glib::RefPtr<Gtk::TreeStore>& model) :
+    Gtk::TreeView (model),
+    m_tree_store (model)
+{
+    set_headers_clickable (true) ;
+    get_selection ()->set_mode (Gtk::SELECTION_SINGLE) ;
+    //create the columns of the tree view
+    append_column (_("Variable"),
+            vutil::get_variable_columns ().name) ;
+    Gtk::TreeViewColumn * col = get_column (0) ;
+    THROW_IF_FAIL (col) ;
+    col->set_resizable (true) ;
+    col->add_attribute (*col->get_first_cell_renderer (),
+            "foreground-gdk",
+            vutil::VariableColumns::FG_COLOR_OFFSET) ;
+
+    append_column (_("Value"), vutil::get_variable_columns ().value) ;
+    col = get_column (1) ;
+    THROW_IF_FAIL (col) ;
+    col->set_resizable (true) ;
+    col->add_attribute (*col->get_first_cell_renderer (),
+            "foreground-gdk",
+            vutil::VariableColumns::FG_COLOR_OFFSET) ;
+
+    append_column (_("Type"),
+            vutil::get_variable_columns ().type_caption);
+    col = get_column (2) ;
+    THROW_IF_FAIL (col) ;
+    col->set_resizable (true) ;
+}
+
+Glib::RefPtr<Gtk::TreeStore>& VarsTreeView::get_tree_store ()
+{
+    return m_tree_store;
+}
+
+} // namespace nemiver

Added: trunk/src/persp/dbgperspective/nmv-vars-treeview.h
==============================================================================
--- (empty file)
+++ trunk/src/persp/dbgperspective/nmv-vars-treeview.h	Thu Jan 10 03:00:58 2008
@@ -0,0 +1,57 @@
+//Author: Jonathon Jongsma
+/*
+ *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_VARS_TREEVIEW_H__
+#define __NMV_VARS_TREEVIEW_H__
+
+#include <gtkmm/treeview.h>
+#include <gtkmm/treestore.h>
+#include "common/nmv-safe-ptr.h"
+#include "nmv-ui-utils.h"
+
+using nemiver::common::SafePtr;
+
+namespace nemiver {
+
+    class VarsTreeView;
+
+    typedef SafePtr<VarsTreeView,
+                    nemiver::ui_utils::WidgetRef,
+                    nemiver::ui_utils::WidgetUnref> VarsTreeViewSafePtr ;
+
+    class VarsTreeView : public Gtk::TreeView
+    {
+        public:
+            static VarsTreeViewSafePtr create () ;
+            Glib::RefPtr<Gtk::TreeStore>& get_tree_store ();
+
+        protected:
+            VarsTreeView ();
+            VarsTreeView (Glib::RefPtr<Gtk::TreeStore>& model);
+
+        private:
+            Glib::RefPtr<Gtk::TreeStore> m_tree_store;
+    };
+} // namespace nemiver
+#endif // __NMV_VARS_TREEVIEW_H__



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