[PATCH] Rename "Variable Inspector" into "Expression Inspector"
- From: Dodji Seketeli <dodji seketeli org>
- To: Nemiver Development <nemiver-list gnome org>
- Subject: [PATCH] Rename "Variable Inspector" into "Expression Inspector"
- Date: Fri, 15 Jun 2012 18:20:55 +0200
Hello,
For a while now, it has been bugging me to see that we refer to what
really is an "Expression Inspector", by saying "Variable Inspector".
This patch is meant to correct that injustice.
Tested and applied to master.
* src/persp/dbgperspective/nmv-expr-inspector-dialog.cc: Renamed
src/persp/dbgperspective/nmv-var-inspector-dialog.cc into this,
and renamed most references to "variable monitor" to "expression
monitor.
* src/persp/dbgperspective/nmv-expr-inspector-dialog.h: Renamed
src/persp/dbgperspective/nmv-var-inspector-dialog.h into this and
and renamed most references to "variable monitor" to "expression
monitor..
* src/persp/dbgperspective/nmv-expr-inspector.cc: Renamed
src/persp/dbgperspective/nmv-var-inspector.cc in to this and
renamed most references to "variable monitor" to "expression
monitor.
* src/persp/dbgperspective/nmv-expr-inspector.h: Renamed
src/persp/dbgperspective/nmv-var-inspector.h into this and renamed
most references to "variable monitor" to "expression monitor.
* po/POTFILES.in: Adjust.
* src/persp/dbgperspective/Makefile.am: Likewise.
* src/persp/dbgperspective/menus/menus.xml: Likewise.
* src/persp/dbgperspective/nmv-dbg-perspective.cc: Likewise.
---
po/POTFILES.in | 7 +-
src/persp/dbgperspective/Makefile.am | 8 +-
src/persp/dbgperspective/menus/menus.xml | 4 +-
src/persp/dbgperspective/nmv-dbg-perspective.cc | 70 +-
.../dbgperspective/nmv-expr-inspector-dialog.cc | 442 +++++++++++
.../dbgperspective/nmv-expr-inspector-dialog.h | 64 ++
src/persp/dbgperspective/nmv-expr-inspector.cc | 785 ++++++++++++++++++++
src/persp/dbgperspective/nmv-expr-inspector.h | 79 ++
.../dbgperspective/nmv-var-inspector-dialog.cc | 442 -----------
.../dbgperspective/nmv-var-inspector-dialog.h | 64 --
src/persp/dbgperspective/nmv-var-inspector.cc | 785 --------------------
src/persp/dbgperspective/nmv-var-inspector.h | 79 --
src/persp/dbgperspective/nmv-watchpoint-dialog.cc | 8 +-
src/persp/dbgperspective/ui/Makefile.am | 2 +-
src/persp/dbgperspective/ui/exprinspectordialog.ui | 139 ++++
src/persp/dbgperspective/ui/varinspectordialog.ui | 139 ----
16 files changed, 1558 insertions(+), 1559 deletions(-)
create mode 100644 src/persp/dbgperspective/nmv-expr-inspector-dialog.cc
create mode 100644 src/persp/dbgperspective/nmv-expr-inspector-dialog.h
create mode 100644 src/persp/dbgperspective/nmv-expr-inspector.cc
create mode 100644 src/persp/dbgperspective/nmv-expr-inspector.h
delete mode 100644 src/persp/dbgperspective/nmv-var-inspector-dialog.cc
delete mode 100644 src/persp/dbgperspective/nmv-var-inspector-dialog.h
delete mode 100644 src/persp/dbgperspective/nmv-var-inspector.cc
delete mode 100644 src/persp/dbgperspective/nmv-var-inspector.h
create mode 100644 src/persp/dbgperspective/ui/exprinspectordialog.ui
delete mode 100644 src/persp/dbgperspective/ui/varinspectordialog.ui
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 48bb0c6..1813030 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,9 +19,8 @@ src/persp/dbgperspective/nmv-run-program-dialog.cc
src/persp/dbgperspective/nmv-saved-sessions-dialog.cc
src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc
src/persp/dbgperspective/nmv-thread-list.cc
-src/persp/dbgperspective/nmv-var-inspector.cc
-src/persp/dbgperspective/nmv-var-inspector.cc
-src/persp/dbgperspective/nmv-var-inspector-dialog.cc
+src/persp/dbgperspective/nmv-expr-inspector.cc
+src/persp/dbgperspective/nmv-expr-inspector-dialog.cc
src/persp/dbgperspective/nmv-vars-treeview.cc
[type: gettext/glade]src/persp/dbgperspective/ui/callfunctiondialog.ui
[type: gettext/glade]src/persp/dbgperspective/ui/chooseoverloadsdialog.ui
@@ -36,7 +35,7 @@ src/persp/dbgperspective/nmv-vars-treeview.cc
[type: gettext/glade]src/persp/dbgperspective/ui/savedsessionsdialog.ui
[type: gettext/glade]src/persp/dbgperspective/ui/setbreakpointdialog.ui
[type: gettext/glade]src/persp/dbgperspective/ui/setjumptodialog.ui
-[type: gettext/glade]src/persp/dbgperspective/ui/varinspectordialog.ui
+[type: gettext/glade]src/persp/dbgperspective/ui/exprinspectordialog.ui
[type: gettext/glade]src/persp/dbgperspective/ui/watchpointdialog.ui
src/uicommon/nmv-locate-file-dialog.cc
src/uicommon/nmv-source-editor.cc
diff --git a/src/persp/dbgperspective/Makefile.am b/src/persp/dbgperspective/Makefile.am
index 7852432..8fcfa95 100644
--- a/src/persp/dbgperspective/Makefile.am
+++ b/src/persp/dbgperspective/Makefile.am
@@ -26,8 +26,8 @@ $(h)/nmv-preferences-dialog.h \
$(h)/nmv-preferences-dialog.cc \
$(h)/nmv-proc-list-dialog.cc \
$(h)/nmv-proc-list-dialog.h \
-$(h)/nmv-var-inspector-dialog.cc \
-$(h)/nmv-var-inspector-dialog.h \
+$(h)/nmv-expr-inspector-dialog.cc \
+$(h)/nmv-expr-inspector-dialog.h \
$(h)/nmv-find-text-dialog.cc \
$(h)/nmv-find-text-dialog.h \
$(h)/nmv-sess-mgr.cc \
@@ -40,8 +40,8 @@ $(h)/nmv-local-vars-inspector.cc \
$(h)/nmv-local-vars-inspector.h \
$(h)/nmv-global-vars-inspector-dialog.cc \
$(h)/nmv-global-vars-inspector-dialog.h \
-$(h)/nmv-var-inspector.cc \
-$(h)/nmv-var-inspector.h \
+$(h)/nmv-expr-inspector.cc \
+$(h)/nmv-expr-inspector.h \
$(h)/nmv-breakpoints-view.cc \
$(h)/nmv-breakpoints-view.h \
$(h)/nmv-registers-view.cc \
diff --git a/src/persp/dbgperspective/menus/menus.xml b/src/persp/dbgperspective/menus/menus.xml
index 9273add..c9a52e2 100644
--- a/src/persp/dbgperspective/menus/menus.xml
+++ b/src/persp/dbgperspective/menus/menus.xml
@@ -74,8 +74,8 @@
<menuitem action="SetWatchPointUsingDialogMenuItemAction"
name="SetWatchUsingDialogMenuItem"/>
<separator/>
- <menuitem action="InspectVariableMenuItemAction"
- name="InspectVariableMenuItem"/>
+ <menuitem action="InspectExpressionMenuItemAction"
+ name="InspectExpressionMenuItem"/>
<menuitem action="CallFunctionMenuItemAction"
name="CallFunctionMenuItem"/>
<menuitem action="ActivateGlobalVariablesDialogMenuAction"
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 905a67f..d30d922 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -66,7 +66,7 @@
#include "nmv-call-stack.h"
#include "nmv-spinner-tool-item.h"
#include "nmv-local-vars-inspector.h"
-#include "nmv-var-inspector.h"
+#include "nmv-expr-inspector.h"
#include "nmv-global-vars-inspector-dialog.h"
#include "nmv-terminal.h"
#include "nmv-breakpoints-view.h"
@@ -75,7 +75,7 @@
#include "nmv-preferences-dialog.h"
#include "nmv-popup-tip.h"
#include "nmv-thread-list.h"
-#include "nmv-var-inspector-dialog.h"
+#include "nmv-expr-inspector-dialog.h"
#include "nmv-find-text-dialog.h"
#include "nmv-set-breakpoint-dialog.h"
#include "nmv-choose-overloads-dialog.h"
@@ -282,7 +282,7 @@ private:
void on_toggle_breakpoint_action ();
void on_toggle_breakpoint_enabled_action ();
void on_toggle_countpoint_action ();
- void on_inspect_variable_action ();
+ void on_inspect_expression_action ();
void on_call_function_action ();
void on_find_text_response_signal (int);
void on_breakpoint_delete_action
@@ -473,7 +473,7 @@ private:
const UString &a_text);
void show_underline_tip_at_position (int a_x, int a_y,
IDebugger::VariableSafePtr a_var);
- VarInspector& get_popup_var_inspector ();
+ ExprInspector& get_popup_expr_inspector ();
void restart_mouse_immobile_timer ();
void stop_mouse_immobile_timer ();
PopupTip& get_popup_tip ();
@@ -683,8 +683,8 @@ public:
void disassemble_around_address_and_do (const Address &adress,
IDebugger::DisassSlot &what_to_do);
- void inspect_variable ();
- void inspect_variable (const UString &a_variable_name);
+ void inspect_expression ();
+ void inspect_expression (const UString &a_variable_name);
void call_function ();
void call_function (const UString &a_call_expr);
void toggle_breakpoint ();
@@ -946,7 +946,7 @@ struct DBGPerspective::Priv {
//<variable value popup tip related data>
//****************************************
SafePtr<PopupTip> popup_tip;
- SafePtr<VarInspector> popup_var_inspector;
+ SafePtr<ExprInspector> popup_expr_inspector;
bool in_show_var_value_at_pos_transaction;
UString var_to_popup;
int var_popup_tip_x;
@@ -1619,11 +1619,11 @@ DBGPerspective::on_toggle_countpoint_action ()
}
void
-DBGPerspective::on_inspect_variable_action ()
+DBGPerspective::on_inspect_expression_action ()
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
NEMIVER_TRY
- inspect_variable ();
+ inspect_expression ();
NEMIVER_CATCH
}
@@ -2746,7 +2746,7 @@ DBGPerspective::on_popup_tip_hide ()
NEMIVER_TRY
m_priv->popup_tip.reset ();
- m_priv->popup_var_inspector.reset ();
+ m_priv->popup_expr_inspector.reset ();
NEMIVER_CATCH
}
@@ -3266,12 +3266,12 @@ DBGPerspective::init_actions ()
false
},
{
- "InspectVariableMenuItemAction",
+ "InspectExpressionMenuItemAction",
nil_stock_id,
- _("Inspect a Variable"),
- _("Inspect a global or local variable"),
+ _("Inspect an Expression"),
+ _("Inspect a global or local expression"),
sigc::mem_fun (*this,
- &DBGPerspective::on_inspect_variable_action),
+ &DBGPerspective::on_inspect_expression_action),
ActionEntry::DEFAULT,
"F12",
false
@@ -4394,8 +4394,8 @@ DBGPerspective::get_contextual_menu ()
workbench ().get_ui_manager ()->add_ui
(m_priv->contextual_menu_merge_id,
"/ContextualMenu",
- "InspectVariableMenuItem",
- "InspectVariableMenuItemAction",
+ "InspectExpressionMenuItem",
+ "InspectExpressionMenuItemAction",
Gtk::UI_MANAGER_AUTO,
false);
@@ -4828,22 +4828,22 @@ DBGPerspective::show_underline_tip_at_position
{
LOG_FUNCTION_SCOPE_NORMAL_DD
get_popup_tip ().show_at_position (a_x, a_y);
- get_popup_var_inspector ().set_variable (a_var,
- true/*expand variable*/,
- m_priv->pretty_printing_toggled);
+ get_popup_expr_inspector ().set_expression (a_var,
+ true/*expand variable*/,
+ m_priv->pretty_printing_toggled);
}
-VarInspector&
-DBGPerspective::get_popup_var_inspector ()
+ExprInspector&
+DBGPerspective::get_popup_expr_inspector ()
{
LOG_FUNCTION_SCOPE_NORMAL_DD
- if (!m_priv->popup_var_inspector)
- m_priv->popup_var_inspector.reset
- (new VarInspector (*debugger (),
+ if (!m_priv->popup_expr_inspector)
+ m_priv->popup_expr_inspector.reset
+ (new ExprInspector (*debugger (),
*const_cast<DBGPerspective*> (this)));
- THROW_IF_FAIL (m_priv->popup_var_inspector);
- return *m_priv->popup_var_inspector;
+ THROW_IF_FAIL (m_priv->popup_expr_inspector);
+ return *m_priv->popup_expr_inspector;
}
void
@@ -4883,7 +4883,7 @@ DBGPerspective::get_popup_tip ()
Gtk::ScrolledWindow *w = Gtk::manage (new PopupScrolledWindow ());
w->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
m_priv->popup_tip->set_child (*w);
- w->add (get_popup_var_inspector ().widget ());
+ w->add (get_popup_expr_inspector ().widget ());
m_priv->popup_tip->signal_hide ().connect (sigc::mem_fun
(*this, &DBGPerspective::on_popup_tip_hide));
}
@@ -7829,11 +7829,11 @@ DBGPerspective::update_src_dependant_bp_actions_sensitiveness ()
}
void
-DBGPerspective::inspect_variable ()
+DBGPerspective::inspect_expression ()
{
THROW_IF_FAIL (m_priv);
- UString variable_name;
+ UString expression;
Gtk::TextIter start, end;
SourceEditor *source_editor = get_current_source_editor ();
if (source_editor) {
@@ -7841,21 +7841,21 @@ DBGPerspective::inspect_variable ()
source_editor->source_view ().get_source_buffer ();
THROW_IF_FAIL (buffer);
if (buffer->get_selection_bounds (start, end)) {
- variable_name= buffer->get_slice (start, end);
+ expression = buffer->get_slice (start, end);
}
}
- inspect_variable (variable_name);
+ inspect_expression (expression);
}
void
-DBGPerspective::inspect_variable (const UString &a_variable_name)
+DBGPerspective::inspect_expression (const UString &a_expression)
{
THROW_IF_FAIL (debugger ());
- VarInspectorDialog dialog (*debugger (),
+ ExprInspectorDialog dialog (*debugger (),
*this);
dialog.set_history (m_priv->var_inspector_dialog_history);
- if (a_variable_name != "") {
- dialog.inspect_variable (a_variable_name);
+ if (a_expression != "") {
+ dialog.inspect_expression (a_expression);
}
dialog.run ();
m_priv->var_inspector_dialog_history.clear ();
diff --git a/src/persp/dbgperspective/nmv-expr-inspector-dialog.cc b/src/persp/dbgperspective/nmv-expr-inspector-dialog.cc
new file mode 100644
index 0000000..f2dee7d
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-expr-inspector-dialog.cc
@@ -0,0 +1,442 @@
+//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"
+#include <glib/gi18n.h>
+#include <gtkmm/liststore.h>
+#include "common/nmv-exception.h"
+#include "nmv-expr-inspector-dialog.h"
+#include "nmv-expr-inspector.h"
+#include "nmv-ui-utils.h"
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+class VariableHistoryStoreColumns : public Gtk::TreeModel::ColumnRecord
+{
+public:
+ Gtk::TreeModelColumn<Glib::ustring> varname;
+ VariableHistoryStoreColumns() { add (varname); }
+};
+
+VariableHistoryStoreColumns&
+get_cols ()
+{
+ static VariableHistoryStoreColumns cols;
+ return cols;
+}
+
+class ExprInspectorDialog::Priv {
+ friend class ExprInspectorDialog;
+ Gtk::ComboBox *var_name_entry;
+ Glib::RefPtr<Gtk::ListStore> m_variable_history;
+ Gtk::Button *inspect_button;
+ SafePtr<ExprInspector> expr_inspector;
+ Gtk::Dialog &dialog;
+ Glib::RefPtr<Gtk::Builder> gtkbuilder;
+ IDebugger &debugger;
+ IPerspective &perspective;
+
+ Priv ();
+public:
+
+ Priv (Gtk::Dialog &a_dialog,
+ const Glib::RefPtr<Gtk::Builder> &a_gtkbuilder,
+ IDebugger &a_debugger,
+ IPerspective &a_perspective) :
+ var_name_entry (0),
+ inspect_button (0),
+ dialog (a_dialog),
+ gtkbuilder (a_gtkbuilder),
+ debugger (a_debugger),
+ perspective (a_perspective)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ build_dialog ();
+ connect_to_widget_signals ();
+ }
+
+ /// Build the inspector dialog.
+ ///
+ /// Fetch widgets from gtkbuilder and initialize them.
+ void
+ build_dialog ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ var_name_entry =
+ ui_utils::get_widget_from_gtkbuilder<Gtk::ComboBox>
+ (gtkbuilder, "variablenameentry");
+ m_variable_history =
+ Gtk::ListStore::create (get_cols ());
+ var_name_entry->set_model (m_variable_history);
+ var_name_entry->set_entry_text_column (get_cols ().varname);
+
+ inspect_button =
+ ui_utils::get_widget_from_gtkbuilder<Gtk::Button> (gtkbuilder,
+ "inspectbutton");
+ inspect_button->set_sensitive (false);
+
+ Gtk::Box *box =
+ ui_utils::get_widget_from_gtkbuilder<Gtk::Box> (gtkbuilder,
+ "inspectorwidgetbox");
+
+ expr_inspector.reset (new ExprInspector (debugger, perspective));
+ expr_inspector->enable_contextual_menu (true);
+ expr_inspector->cleared_signal ().connect
+ (sigc::mem_fun
+ (*this,
+ &ExprInspectorDialog::Priv::on_variable_inspector_cleared));
+
+ Gtk::ScrolledWindow *scr = Gtk::manage (new Gtk::ScrolledWindow);
+ scr->set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ scr->set_shadow_type (Gtk::SHADOW_IN);
+ scr->add (expr_inspector->widget ());
+ box->pack_start (*scr);
+ dialog.show_all ();
+ }
+
+ void
+ connect_to_widget_signals ()
+ {
+ THROW_IF_FAIL (inspect_button);
+ THROW_IF_FAIL (var_name_entry);
+ inspect_button->signal_clicked ().connect (sigc::mem_fun
+ (*this, &Priv::do_inspect_expression));
+ var_name_entry->signal_changed ().connect (sigc::mem_fun
+ (*this, &Priv::on_var_name_changed_signal));
+ var_name_entry->get_entry()->signal_activate ().connect (sigc::mem_fun
+ (*this, &Priv::do_inspect_expression));
+ }
+
+ /// Inspect the variable (or, more generally the expression) which
+ /// name the user has typed in the variable name entry, in the UI.
+ void
+ do_inspect_expression ()
+ {
+ NEMIVER_TRY;
+
+ THROW_IF_FAIL (var_name_entry);
+
+ UString var_name = var_name_entry->get_entry ()->get_text ();
+ if (var_name == "")
+ return;
+
+ inspect_expression (var_name, /*expand=*/true);
+
+ NEMIVER_CATCH;
+ }
+
+ /// Inspect an expression.
+ ///
+ /// \param a_expr the expression to inspect.
+ ///
+ /// \param a_expand whether to expand the resulting expression
+ /// tree.
+ void
+ inspect_expression (const UString& a_expr,
+ bool a_expand)
+ {
+ inspect_expression (a_expr, a_expand,
+ sigc::mem_fun
+ (*this,
+ &ExprInspectorDialog::Priv::on_variable_inspected));
+ }
+
+ /// Inspect an expression.
+ ///
+ /// \param a_expr the expression to inspect.
+ ///
+ /// \param a_expand whether to expand the resulting expression
+ /// tree.
+ ///
+ /// \param a_s a slot to invoke whenever the expresion has been
+ /// inspected.
+ void
+ inspect_expression (const UString &a_expr,
+ bool a_expand,
+ const sigc::slot<void,
+ const IDebugger::VariableSafePtr> &a_s)
+ {
+ THROW_IF_FAIL (expr_inspector);
+ THROW_IF_FAIL (m_variable_history);
+
+ expr_inspector->inspect_expression
+ (a_expr, a_expand, a_s);
+
+ add_to_history (a_expr,
+ false /*append*/,
+ false /*don't allow duplicates*/);
+ }
+
+ /// Tests wheter if the variable expression exists in history.
+ ///
+ /// \param a_expr the expression to look for.
+ ///
+ /// \param a_iter if the return returned true and if this pointer
+ /// is non-null, then *a_iter is filled with an iterator pointing
+ /// at the expression found in history.
+ ///
+ /// \return true if the variable expression a_expr exits in
+ /// memory, false otherwise.
+ bool
+ exists_in_history (const UString &a_expr,
+ Gtk::TreeModel::iterator *a_iter = 0) const
+ {
+ THROW_IF_FAIL (m_variable_history);
+
+ Gtk::TreeModel::iterator it;
+ for (it = m_variable_history->children ().begin ();
+ it != m_variable_history->children ().end ();
+ ++it) {
+ if ((*it)[get_cols ().varname] == a_expr) {
+ if (a_iter != 0)
+ *a_iter = it;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// Erases an expression from expression history.
+ ///
+ /// \param a_iter the iterator pointing to the expression to erase
+ /// from history.
+ void
+ erase_expression_from_history (Gtk::TreeModel::iterator &a_iter)
+ {
+ THROW_IF_FAIL (m_variable_history);
+ m_variable_history->erase (a_iter);
+ }
+
+ /// Add an expression to variable expression history. If the
+ /// expression already exists in history, it can either be
+ /// duplicated or be not. Also, the new expression can be either
+ /// appended or prepended to history.
+ ///
+ /// \param a_expr the expression to add to history.
+ ///
+ /// \param a_prepend if true, prepend the expression to history.
+ ///
+ /// \param allow_dups if true, allow expressions to be present in
+ /// more than copy in history.
+ void
+ add_to_history (const UString &a_expr,
+ bool a_prepend = false,
+ bool a_allow_dups = false)
+ {
+ // Don't append empty expressions.
+ if (a_expr.empty ())
+ return;
+
+ // If the expression already exists in history, remove it, so
+ // that it can be added again, as to be the latest added item
+ // to historry.
+ Gtk::TreeModel::iterator it;
+ if (!a_allow_dups
+ && exists_in_history (a_expr, &it))
+ erase_expression_from_history (it);
+
+ THROW_IF_FAIL (m_variable_history);
+ if (a_prepend)
+ it = m_variable_history->insert
+ (m_variable_history->children ().begin ());
+ else
+ it = m_variable_history->append ();
+ (*it)[get_cols ().varname] = a_expr;
+ }
+
+ void
+ get_history (std::list<UString> &a_hist) const
+ {
+ Gtk::TreeModel::iterator it;
+ for (it = m_variable_history->children ().begin ();
+ it != m_variable_history->children ().end ();
+ ++it) {
+ Glib::ustring elem = (*it)[get_cols ().varname];
+ a_hist.push_back (elem);
+ }
+ }
+
+ /// Set the current history of variable expression to a new one.
+ ///
+ /// \param a_hist the new history to set.
+ void
+ set_history (const std::list<UString> &a_hist)
+ {
+ m_variable_history->clear ();
+ std::list<UString>::const_iterator it;
+ for (it = a_hist.begin (); it != a_hist.end (); ++it)
+ add_to_history (*it, /*a_prepend=*/false,
+ /*a_allow_dups=*/false);
+ }
+
+ //************************
+ //<signal handlers>
+ //*************************
+
+ /// Handler called when the name of the variable changes in the
+ /// variable name entry field.
+ void
+ on_var_name_changed_signal ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ NEMIVER_TRY
+
+ THROW_IF_FAIL (var_name_entry);
+ THROW_IF_FAIL (inspect_button);
+
+ UString var_name = var_name_entry->get_entry ()->get_text ();
+ if (var_name == "") {
+ inspect_button->set_sensitive (false);
+ } else {
+ inspect_button->set_sensitive (true);
+ }
+
+ // this handler is called when any text is changed in the entry or when
+ // an item is selected from the combobox. We don't want to inspect any
+ // text that is typed into the entry, but we do want to inspect when
+ // they choose an item from the dropdown list
+ if (var_name_entry->get_active ()) {
+ inspect_expression (var_name, true);
+ }
+
+ NEMIVER_CATCH
+ }
+
+ /// Handler called when the variable to be inspected is actually
+ /// added to the inspector.
+ void
+ on_variable_inspected (const IDebugger::VariableSafePtr)
+ {
+ }
+
+ /// Handler called when the variable inspector is cleared.
+ void
+ on_variable_inspector_cleared ()
+ {
+ }
+
+ //************************
+ //</signal handlers>
+ //*************************
+};//end class ExprInspectorDialog::Priv
+
+ExprInspectorDialog::ExprInspectorDialog (IDebugger &a_debugger,
+ IPerspective &a_perspective) :
+ Dialog (a_perspective.plugin_path (),
+ "exprinspectordialog.ui",
+ "exprinspectordialog")
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ m_priv.reset
+ (new ExprInspectorDialog::Priv (widget (),
+ gtkbuilder (), a_debugger,
+ a_perspective));
+ THROW_IF_FAIL (m_priv);
+}
+
+ExprInspectorDialog::~ExprInspectorDialog ()
+{
+ LOG_D ("delete", "destructor-domain");
+}
+
+UString
+ExprInspectorDialog::expression_name () const
+{
+ THROW_IF_FAIL (m_priv);
+ THROW_IF_FAIL (m_priv->var_name_entry);
+ return m_priv->var_name_entry->get_entry ()->get_text ();
+}
+
+/// Inspect an expression (including a variable)
+///
+/// \param a_var_name the expression to inspect.
+void
+ExprInspectorDialog::inspect_expression (const UString &a_var_name)
+{
+ THROW_IF_FAIL (m_priv);
+ THROW_IF_FAIL (m_priv->var_name_entry);
+
+ if (a_var_name != "") {
+ m_priv->var_name_entry->get_entry ()->set_text (a_var_name);
+ m_priv->inspect_expression (a_var_name, true);
+ }
+}
+
+/// Inspect an expression (including a variable)
+///
+/// \param a_var_name the expression to inspect.
+///
+/// \param a_slot a slot to invoke whenever the expression has been
+/// inspected.
+void
+ExprInspectorDialog::inspect_expression
+(const UString &a_var_name,
+ const sigc::slot<void,
+ const IDebugger::VariableSafePtr> &a_slot)
+{
+ THROW_IF_FAIL (m_priv);
+ THROW_IF_FAIL (m_priv->var_name_entry);
+
+ if (a_var_name != "") {
+ m_priv->var_name_entry->get_entry ()->set_text (a_var_name);
+ m_priv->inspect_expression (a_var_name, true, a_slot);
+ }
+}
+
+const IDebugger::VariableSafePtr
+ExprInspectorDialog::expression () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->expr_inspector->get_expression ();
+}
+
+/// Return the variable inspector used by this dialog
+ExprInspector&
+ExprInspectorDialog::inspector () const
+{
+ THROW_IF_FAIL (m_priv);
+ return *m_priv->expr_inspector;
+}
+
+/// Set the history of variable expression to a new one.
+///
+/// \param a_hist the new history.
+void
+ExprInspectorDialog::set_history (const std::list<UString> &a_hist)
+{
+ THROW_IF_FAIL (m_priv);
+
+ m_priv->set_history (a_hist);
+}
+
+void
+ExprInspectorDialog::get_history (std::list<UString> &a_hist) const
+{
+ THROW_IF_FAIL (m_priv);
+ m_priv->get_history (a_hist);
+}
+
+NEMIVER_END_NAMESPACE (nemiver)
+
diff --git a/src/persp/dbgperspective/nmv-expr-inspector-dialog.h b/src/persp/dbgperspective/nmv-expr-inspector-dialog.h
new file mode 100644
index 0000000..b0242ec
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-expr-inspector-dialog.h
@@ -0,0 +1,64 @@
+//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.
+ */
+#ifndef __NMV_EXPR_INSPECTOR_DIALOG_H__
+#define __NMV_EXPR_INSPECTOR_DIALOG_H__
+
+#include "nmv-dialog.h"
+#include "nmv-i-perspective.h"
+#include "nmv-i-debugger.h"
+#include "nmv-expr-inspector.h"
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+class ExprInspectorDialog : public Dialog {
+ //non copyable
+ ExprInspectorDialog (const ExprInspectorDialog &);
+ ExprInspectorDialog& operator= (const ExprInspectorDialog &);
+
+ //tell me why you would want to extend this.
+ ExprInspectorDialog ();
+
+ class Priv;
+ SafePtr<Priv> m_priv;
+
+public:
+ ExprInspectorDialog (IDebugger &a_debugger,
+ IPerspective &a_perspective);
+ virtual ~ExprInspectorDialog ();
+
+ UString expression_name () const;
+ void inspect_expression (const UString &a_expression_name);
+ void inspect_expression (const UString &a_expression_name,
+ const sigc::slot<void,
+ const IDebugger::VariableSafePtr> &);
+ const IDebugger::VariableSafePtr expression () const;
+ ExprInspector& inspector () const;
+ void set_history (const std::list<UString> &);
+ void get_history (std::list<UString> &) const;
+};//end class ExprInspectorDialog
+
+NEMIVER_END_NAMESPACE (nemiver)
+
+#endif //__NMV_EXPR_INSPECTOR_DIALOG_H__
diff --git a/src/persp/dbgperspective/nmv-expr-inspector.cc b/src/persp/dbgperspective/nmv-expr-inspector.cc
new file mode 100644
index 0000000..24ecc79
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-expr-inspector.cc
@@ -0,0 +1,785 @@
+//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"
+
+#include <glib/gi18n.h>
+#include <sstream>
+#include <gtkmm/treestore.h>
+#include "common/nmv-exception.h"
+#include "common/nmv-dynamic-module.h"
+#include "nmv-expr-inspector.h"
+#include "nmv-variables-utils.h"
+#include "nmv-i-var-walker.h"
+#include "nmv-ui-utils.h"
+#include "nmv-vars-treeview.h"
+#include "nmv-debugger-utils.h"
+
+namespace uutil = nemiver::ui_utils;
+namespace vutil = nemiver::variables_utils2;
+namespace dutil = nemiver::debugger_utils;
+namespace cmn = nemiver::common;
+
+using cmn::DynamicModuleManager;
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+/// A no-op variable slot.
+static void
+no_op_void_expression_slot (const IDebugger::VariableSafePtr)
+{
+}
+
+class ExprInspector::Priv : public sigc::trackable {
+ friend class ExprInspector;
+ Priv ();
+
+ bool requested_expression;
+ bool requested_type;
+ bool expand_expression;
+ bool re_visualize;
+ bool enable_contextual_menu;
+ IDebugger &debugger;
+ // Variable that is being inspected
+ // at a given point in time
+ IDebugger::VariableSafePtr variable;
+ IPerspective &perspective;
+ VarsTreeView *tree_view;
+ Glib::RefPtr<Gtk::TreeStore> tree_store;
+ Gtk::TreeModel::iterator var_row_it;
+ Gtk::TreeModel::iterator cur_selected_row;
+ Glib::RefPtr<Gtk::ActionGroup> expr_inspector_action_group;
+ Gtk::Widget *expr_inspector_menu;
+ IVarWalkerSafePtr varobj_walker;
+ DynamicModuleManager *module_manager;
+ Glib::RefPtr<Gtk::UIManager> ui_manager;
+ mutable sigc::signal<void,
+ const IDebugger::VariableSafePtr> var_inspected_signal;
+ mutable sigc::signal<void> cleared_signal;
+
+ void
+ build_widget ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ tree_view = Gtk::manage (VarsTreeView::create ());
+ THROW_IF_FAIL (tree_view);
+ tree_store = tree_view->get_tree_store ();
+ THROW_IF_FAIL (tree_store);
+ init_actions ();
+ }
+
+ void
+ connect_to_signals ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ 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_activated ().connect
+ (sigc::mem_fun (*this, &Priv::on_tree_view_row_activated_signal));
+
+ tree_view->signal_row_expanded ().connect
+ (sigc::mem_fun (*this, &Priv::on_tree_view_row_expanded_signal));
+
+ tree_view->signal_button_press_event ().connect_notify
+ (sigc::mem_fun (this, &Priv::on_button_press_signal));
+
+ Gtk::CellRenderer *r = tree_view->get_column_cell_renderer
+ (VarsTreeView::VARIABLE_VALUE_COLUMN_INDEX);
+ THROW_IF_FAIL (r);
+
+ Gtk::CellRendererText *t =
+ dynamic_cast<Gtk::CellRendererText*> (r);
+ t->signal_edited ().connect (sigc::mem_fun
+ (*this, &Priv::on_cell_edited_signal));
+ }
+
+ void
+ re_init_tree_view ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ THROW_IF_FAIL (tree_store);
+ tree_store->clear ();
+ }
+
+ void init_actions ()
+ {
+ ui_utils::ActionEntry s_expr_inspector_action_entries [] = {
+ {
+ "CopyVariablePathMenuItemAction",
+ Gtk::Stock::COPY,
+ _("_Copy Variable Name"),
+ _("Copy the variable path expression to the clipboard"),
+ sigc::mem_fun
+ (*this,
+ &Priv::on_expression_path_expr_copy_to_clipboard_action),
+ ui_utils::ActionEntry::DEFAULT,
+ "",
+ false
+ },
+ {
+ "CopyVariableValueMenuItemAction",
+ Gtk::Stock::COPY,
+ _("_Copy Variable Value"),
+ _("Copy the variable value to the clipboard"),
+ sigc::mem_fun
+ (*this,
+ &Priv::on_expression_value_copy_to_clipboard_action),
+ ui_utils::ActionEntry::DEFAULT,
+ "",
+ false
+ }
+ };
+
+ expr_inspector_action_group =
+ Gtk::ActionGroup::create ("expr-inspector-action-group");
+ expr_inspector_action_group->set_sensitive (true);
+ int num_actions =
+ sizeof (s_expr_inspector_action_entries)
+ /
+ sizeof (ui_utils::ActionEntry);
+
+ ui_utils::add_action_entries_to_action_group
+ (s_expr_inspector_action_entries,
+ num_actions,
+ expr_inspector_action_group);
+
+ get_ui_manager ()->insert_action_group (expr_inspector_action_group);
+ }
+
+ void
+ graphically_set_expression (const IDebugger::VariableSafePtr a_variable,
+ bool a_expand)
+ {
+ Gtk::TreeModel::iterator parent_iter =
+ tree_store->children ().begin ();
+ Gtk::TreeModel::iterator var_row;
+ vutil::append_a_variable (a_variable,
+ *tree_view,
+ parent_iter,
+ var_row,
+ true /* Do truncate type */);
+ LOG_DD ("set variable" << a_variable->name ());
+
+ // If the variable has children, unfold it so that we can see them.
+ if (a_expand
+ && var_row
+ && (a_variable->members ().size ()
+ || a_variable->needs_unfolding ()))
+ tree_view->expand_row (tree_store->get_path (var_row), false);
+ variable = a_variable;
+ }
+
+ void
+ set_expression (const IDebugger::VariableSafePtr a_variable,
+ bool a_expand,
+ bool a_re_visualize)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ THROW_IF_FAIL (tree_view && tree_store);
+
+ re_visualize = a_re_visualize;
+
+ re_init_tree_view ();
+ variable = a_variable;
+ if (a_re_visualize) {
+ debugger.revisualize_variable (a_variable,
+ sigc::bind
+ (sigc::mem_fun
+ (*this,
+ &Priv::on_var_revisualized),
+ a_expand));
+ } else {
+ graphically_set_expression (a_variable, a_expand);
+ }
+ }
+
+ void
+ show_expression_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);
+ }
+
+ /// Creates a variable (or more generally, an expression).
+ ///
+ /// \param a_name the expression (or name of the variable) to
+ /// create.
+ ///
+ /// \param a_expand whethet to expand the tree representing the
+ /// expression that is going to be created, or not.
+ void
+ create_expression (const UString &a_name,
+ bool a_expand)
+ {
+ create_expression (a_name, a_expand, &no_op_void_expression_slot);
+ }
+
+ /// Creates a variable (or more generally, an expression).
+ ///
+ /// \param a_name the expression (or name of the variable) to
+ /// create.
+ ///
+ /// \param a_expand whethet to expand the tree representing the
+ /// expression that is going to be created, or not.
+ ///
+ /// \param a_slot a slot (an abstraction of a handler function)
+ /// that is invoked whenever the resulting expression is added to
+ /// the inspector.
+ void
+ create_expression (const UString &a_name,
+ bool a_expand,
+ const sigc::slot<void,
+ const IDebugger::VariableSafePtr> &a_slot)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ expand_expression = a_expand;
+ debugger.create_variable
+ (a_name,
+ sigc::bind
+ (sigc::mem_fun
+ (this, &ExprInspector::Priv::on_expression_created_signal),
+ a_slot));
+ }
+
+ Glib::RefPtr<Gtk::UIManager> get_ui_manager ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ if (!ui_manager) {
+ ui_manager = Gtk::UIManager::create ();
+ }
+ return ui_manager;
+ }
+
+ Gtk::Widget* get_expr_inspector_menu ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ if (!expr_inspector_menu) {
+ string relative_path =
+ Glib::build_filename ("menus", "varinspectorpopup.xml");
+ string absolute_path;
+ THROW_IF_FAIL (perspective.build_absolute_resource_path
+ (relative_path, absolute_path));
+ get_ui_manager ()->add_ui_from_file (absolute_path);
+ get_ui_manager ()->ensure_update ();
+ expr_inspector_menu =
+ get_ui_manager ()->get_widget ("/ExprInspectorPopup");
+ }
+ return expr_inspector_menu;
+ }
+
+ void
+ popup_expr_inspector_menu (GdkEventButton *a_event)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ Gtk::Menu *menu =
+ dynamic_cast<Gtk::Menu*> (get_expr_inspector_menu ());
+ THROW_IF_FAIL (menu);
+
+ // only pop up a menu if a row exists at that position
+ Gtk::TreeModel::Path path;
+ Gtk::TreeViewColumn* column = 0;
+ int cell_x = 0, cell_y = 0;
+ THROW_IF_FAIL (tree_view);
+ THROW_IF_FAIL (a_event);
+ if (tree_view->get_path_at_pos (static_cast<int> (a_event->x),
+ static_cast<int> (a_event->y),
+ path,
+ column,
+ cell_x,
+ cell_y)) {
+ menu->popup (a_event->button, a_event->time);
+ }
+ }
+
+ DynamicModuleManager*
+ get_module_manager ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ if (!module_manager) {
+ DynamicModule::Loader *loader =
+ perspective.get_workbench ().get_dynamic_module
+ ().get_module_loader ();
+ THROW_IF_FAIL (loader);
+ module_manager = loader->get_dynamic_module_manager ();
+ THROW_IF_FAIL (module_manager);
+ }
+ return module_manager;
+ }
+
+ IVarWalkerSafePtr
+ create_varobj_walker ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ IVarWalkerSafePtr result =
+ get_module_manager ()->load_iface_with_default_manager<IVarWalker>
+ ("varobjwalker", "IVarWalker");
+ result->visited_variable_signal ().connect
+ (sigc::mem_fun (*this, &Priv::on_visited_expression_signal));
+ return result;
+ }
+
+ IVarWalkerSafePtr
+ get_varobj_walker ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ if (!varobj_walker)
+ varobj_walker = create_varobj_walker ();
+ return varobj_walker;
+ }
+
+ // ******************
+ // <signal handlers>
+ // ******************
+
+ void
+ on_visited_expression_signal (const IDebugger::VariableSafePtr a_var)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ std::string str;
+ dutil::dump_variable_value (*a_var, 0, str);
+
+ if (!str.empty ())
+ Gtk::Clipboard::get ()->set_text (str);
+
+ NEMIVER_CATCH
+ }
+
+ void
+ on_var_revisualized (const IDebugger::VariableSafePtr a_var,
+ bool a_expand)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY;
+
+ graphically_set_expression (a_var, a_expand);
+
+ NEMIVER_CATCH;
+ }
+
+ void
+ on_tree_view_selection_changed_signal ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ NEMIVER_TRY
+
+ THROW_IF_FAIL (tree_view);
+ Glib::RefPtr<Gtk::TreeSelection> sel = tree_view->get_selection ();
+ THROW_IF_FAIL (sel);
+ cur_selected_row = sel->get_selected ();
+ if (!cur_selected_row) {return;}
+ IDebugger::VariableSafePtr var =
+ (IDebugger::VariableSafePtr)cur_selected_row->get_value
+ (vutil::get_variable_columns ().variable);
+ if (!var)
+ return;
+
+ variable = var;
+
+ // If the variable should be editable, set the cell of the variable value
+ // editable.
+ cur_selected_row->set_value
+ (vutil::get_variable_columns ().variable_value_editable,
+ debugger.is_variable_editable (variable));
+
+ // Dump some log about the variable that got selected.
+ UString qname;
+ variable->build_qname (qname);
+ LOG_DD ("row of variable '" << qname << "'");
+
+ NEMIVER_CATCH
+ }
+
+ void
+ on_tree_view_row_activated_signal (const Gtk::TreeModel::Path &a_path,
+ Gtk::TreeViewColumn *a_col)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ THROW_IF_FAIL (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_expression_type_in_dialog ();
+
+ NEMIVER_CATCH
+ }
+
+ void
+ on_tree_view_row_expanded_signal (const Gtk::TreeModel::iterator &a_row_it,
+ const Gtk::TreeModel::Path &a_row_path)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ if (!(*a_row_it)[vutil::get_variable_columns ().needs_unfolding]) {
+ return;
+ }
+ LOG_DD ("The variable needs unfolding");
+
+ IDebugger::VariableSafePtr var =
+ (*a_row_it)[vutil::get_variable_columns ().variable];
+ debugger.unfold_variable
+ (var, sigc::bind (sigc::mem_fun (*this,
+ &Priv::on_expression_unfolded_signal),
+ a_row_path));
+ LOG_DD ("variable unfolding triggered");
+
+ NEMIVER_CATCH
+ }
+
+ void
+ on_cell_edited_signal (const Glib::ustring &a_path,
+ const Glib::ustring &a_text)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ Gtk::TreeModel::iterator row = tree_store->get_iter (a_path);
+ IDebugger::VariableSafePtr var =
+ (*row)[vutil::get_variable_columns ().variable];
+ THROW_IF_FAIL (var);
+
+ debugger.assign_variable
+ (var, a_text,
+ sigc::bind (sigc::mem_fun
+ (*this, &Priv::on_expression_assigned_signal),
+ a_path));
+
+ NEMIVER_CATCH
+ }
+
+ void on_button_press_signal (GdkEventButton *a_event)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ // right-clicking should pop up a context menu
+ if (a_event->type == GDK_BUTTON_PRESS
+ && a_event->button == 3
+ && enable_contextual_menu) {
+ popup_expr_inspector_menu (a_event);
+ }
+
+ NEMIVER_CATCH
+ }
+
+ /// A handler called whenever a variable is created in the
+ /// debugger interface, as a result of the user requesting that we
+ /// inspect it. The function then adds the variable into the
+ /// inspector.
+ ///
+ /// \param a_var the created variable
+ ///
+ /// \param a_slot a handler to be called whenever the variable is
+ /// added to the inspector.
+ void
+ on_expression_created_signal (const IDebugger::VariableSafePtr a_var,
+ sigc::slot<void,
+ const IDebugger::VariableSafePtr> &a_slot)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY;
+
+ set_expression (a_var, expand_expression, re_visualize);
+ var_inspected_signal.emit (a_var);
+ a_slot (a_var);
+
+ NEMIVER_CATCH;
+ }
+
+ void
+ on_expression_unfolded_signal (const IDebugger::VariableSafePtr a_var,
+ const Gtk::TreeModel::Path &a_var_node)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ Gtk::TreeModel::iterator var_it = tree_store->get_iter (a_var_node);
+ vutil::update_unfolded_variable (a_var, *tree_view,
+ var_it,
+ true /* Do truncate type */);
+ tree_view->expand_row (a_var_node, false);
+
+ NEMIVER_CATCH
+ }
+
+ void
+ on_expression_assigned_signal (const IDebugger::VariableSafePtr a_var,
+ const UString &a_var_path)
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ Gtk::TreeModel::iterator var_row
+ = tree_store->get_iter (a_var_path);
+ THROW_IF_FAIL (var_row);
+ THROW_IF_FAIL (tree_view);
+ vutil::update_a_variable_node (a_var, *tree_view,
+ var_row,
+ true /* do truncate types */,
+ false /* don't handle highlight ... */ ,
+ false /* ... really */);
+
+ NEMIVER_CATCH
+ }
+
+ void on_expression_path_expr_copy_to_clipboard_action ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ THROW_IF_FAIL (cur_selected_row);
+
+ IDebugger::VariableSafePtr variable =
+ cur_selected_row->get_value
+ (vutil::get_variable_columns ().variable);
+ THROW_IF_FAIL (variable);
+
+ debugger.query_variable_path_expr
+ (variable,
+ sigc::mem_fun (*this, &Priv::on_expression_path_expression_signal));
+
+ NEMIVER_CATCH
+ }
+
+ void on_expression_value_copy_to_clipboard_action ()
+ {
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ THROW_IF_FAIL (cur_selected_row);
+
+ IDebugger::VariableSafePtr variable =
+ cur_selected_row->get_value
+ (vutil::get_variable_columns ().variable);
+ THROW_IF_FAIL (variable);
+
+ IVarWalkerSafePtr walker = get_varobj_walker ();
+ walker->connect (&debugger, variable);
+ walker->do_walk_variable ();
+
+ NEMIVER_CATCH
+ }
+
+ void on_expression_path_expression_signal
+ (const IDebugger::VariableSafePtr a_var)
+ {
+ NEMIVER_TRY
+
+ Gtk::Clipboard::get ()->set_text (a_var->path_expression ());
+
+ NEMIVER_CATCH
+ }
+ // ******************
+ // </signal handlers>
+ // ******************
+
+public:
+
+ Priv (IDebugger &a_debugger,
+ IPerspective &a_perspective) :
+ requested_expression (false),
+ requested_type (false),
+ expand_expression (false),
+ re_visualize (false),
+ enable_contextual_menu (false),
+ debugger (a_debugger),
+ perspective (a_perspective),
+ tree_view (0),
+ expr_inspector_menu (0),
+ module_manager (0)
+ {
+ build_widget ();
+ re_init_tree_view ();
+ connect_to_signals ();
+ }
+
+ ~Priv ()
+ {
+ }
+};//end class ExprInspector::Priv
+
+ExprInspector::ExprInspector (IDebugger &a_debugger,
+ IPerspective &a_perspective)
+{
+ m_priv.reset (new Priv (a_debugger, a_perspective));
+}
+
+ExprInspector::~ExprInspector ()
+{
+ LOG_D ("deleted", "destructor-domain");
+}
+
+Gtk::Widget&
+ExprInspector::widget () const
+{
+ THROW_IF_FAIL (m_priv);
+ THROW_IF_FAIL (m_priv->tree_view);
+ return *m_priv->tree_view;
+}
+
+void
+ExprInspector::set_expression (IDebugger::VariableSafePtr a_variable,
+ bool a_expand, bool a_revisualize)
+{
+ THROW_IF_FAIL (m_priv);
+
+ m_priv->set_expression (a_variable, a_expand, a_revisualize);
+}
+
+/// Inspect a variable/expression.
+///
+/// \param a_variable_name the name of the variable, or more
+/// generally, the expression to the inspected.
+///
+/// \param a_expand whether to expand the resulting tree representing
+/// the expression.
+void
+ExprInspector::inspect_expression (const UString &a_variable_name,
+ bool a_expand)
+{
+ inspect_expression (a_variable_name,
+ a_expand,
+ &no_op_void_expression_slot);
+}
+
+/// Inspect a variable/expression.
+///
+/// \param a_variable_name the name of the variable, or more
+/// generally, the expression to the inspected.
+///
+/// \param a_expand whether to expand the resulting tree representing
+/// the expression.
+///
+/// \param a_s a slot (handler function) to be invoked whenever the
+/// resulting tree (representing the expression to the inspected) is
+/// added to the inspector.
+void
+ExprInspector::inspect_expression (const UString &a_variable_name,
+ bool a_expand,
+ const sigc::slot<void,
+ const IDebugger::VariableSafePtr> &a_s)
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ if (a_variable_name == "") {return;}
+ THROW_IF_FAIL (m_priv);
+ m_priv->re_init_tree_view ();
+ m_priv->create_expression (a_variable_name, a_expand, a_s);
+}
+
+IDebugger::VariableSafePtr
+ExprInspector::get_expression () const
+{
+ THROW_IF_FAIL (m_priv);
+
+ return m_priv->variable;
+}
+
+void
+ExprInspector::enable_contextual_menu (bool a_flag)
+{
+ THROW_IF_FAIL (m_priv);
+ m_priv->enable_contextual_menu = a_flag;
+}
+
+bool
+ExprInspector::is_contextual_menu_enabled () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->enable_contextual_menu;
+}
+
+void
+ExprInspector::clear ()
+{
+ THROW_IF_FAIL (m_priv);
+ m_priv->re_init_tree_view ();
+}
+
+/// A signal emitted when the variable to be inspected is added to the
+/// inspector.
+sigc::signal<void, const IDebugger::VariableSafePtr>&
+ExprInspector::expr_inspected_signal () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->var_inspected_signal;
+}
+
+/// A signal emitted when the inspector is cleared.
+sigc::signal<void>&
+ExprInspector::cleared_signal () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->cleared_signal;
+}
+
+NEMIVER_END_NAMESPACE (nemiver)
diff --git a/src/persp/dbgperspective/nmv-expr-inspector.h b/src/persp/dbgperspective/nmv-expr-inspector.h
new file mode 100644
index 0000000..377e4ae
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-expr-inspector.h
@@ -0,0 +1,79 @@
+//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.
+ */
+#ifndef __NMV_EXPR_INSPECTOR2_H__
+#define __NMV_EXPR_INSPECTOR2_H__
+
+#include "common/nmv-object.h"
+#include "common/nmv-safe-ptr-utils.h"
+#include "nmv-i-debugger.h"
+#include "nmv-i-perspective.h"
+
+namespace Gtk {
+ class Widget;
+}
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+namespace common {
+ class UString;
+}
+
+class ExprInspector : public nemiver::common::Object {
+ ExprInspector (const ExprInspector &);
+ ExprInspector& operator= (const ExprInspector &);
+ ExprInspector ();
+ class Priv;
+ SafePtr<Priv> m_priv;
+
+public:
+ ExprInspector (IDebugger &a_debugger,
+ IPerspective &a_perspective);
+ virtual ~ExprInspector ();
+ Gtk::Widget& widget () const;
+ void set_expression (IDebugger::VariableSafePtr a_variable,
+ bool a_expand = false,
+ bool a_re_visualize = false);
+ void inspect_expression (const UString &a_variable_name,
+ bool a_expand = false);
+ void inspect_expression (const UString &a_variable_name,
+ bool a_expand,
+ const sigc::slot<void,
+ const IDebugger::VariableSafePtr> &a_s);
+ IDebugger::VariableSafePtr get_expression () const;
+ void enable_contextual_menu (bool a_flag);
+ bool is_contextual_menu_enabled () const;
+ void clear ();
+
+ // Signals
+ sigc::signal<void, const IDebugger::VariableSafePtr>&
+ expr_inspected_signal () const;
+ sigc::signal<void>& cleared_signal () const;
+
+};//end class ExprInspector
+
+NEMIVER_END_NAMESPACE (nemiver)
+
+#endif //__NMV_EXPR_INSPECTOR2_H__
+
diff --git a/src/persp/dbgperspective/nmv-var-inspector-dialog.cc b/src/persp/dbgperspective/nmv-var-inspector-dialog.cc
deleted file mode 100644
index 1c5f0e7..0000000
--- a/src/persp/dbgperspective/nmv-var-inspector-dialog.cc
+++ /dev/null
@@ -1,442 +0,0 @@
-//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"
-#include <glib/gi18n.h>
-#include <gtkmm/liststore.h>
-#include "common/nmv-exception.h"
-#include "nmv-var-inspector-dialog.h"
-#include "nmv-var-inspector.h"
-#include "nmv-ui-utils.h"
-
-NEMIVER_BEGIN_NAMESPACE (nemiver)
-
-class VariableHistoryStoreColumns : public Gtk::TreeModel::ColumnRecord
-{
-public:
- Gtk::TreeModelColumn<Glib::ustring> varname;
- VariableHistoryStoreColumns() { add (varname); }
-};
-
-VariableHistoryStoreColumns&
-get_cols ()
-{
- static VariableHistoryStoreColumns cols;
- return cols;
-}
-
-class VarInspectorDialog::Priv {
- friend class VarInspectorDialog;
- Gtk::ComboBox *var_name_entry;
- Glib::RefPtr<Gtk::ListStore> m_variable_history;
- Gtk::Button *inspect_button;
- SafePtr<VarInspector> var_inspector;
- Gtk::Dialog &dialog;
- Glib::RefPtr<Gtk::Builder> gtkbuilder;
- IDebugger &debugger;
- IPerspective &perspective;
-
- Priv ();
-public:
-
- Priv (Gtk::Dialog &a_dialog,
- const Glib::RefPtr<Gtk::Builder> &a_gtkbuilder,
- IDebugger &a_debugger,
- IPerspective &a_perspective) :
- var_name_entry (0),
- inspect_button (0),
- dialog (a_dialog),
- gtkbuilder (a_gtkbuilder),
- debugger (a_debugger),
- perspective (a_perspective)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
- build_dialog ();
- connect_to_widget_signals ();
- }
-
- /// Build the inspector dialog.
- ///
- /// Fetch widgets from gtkbuilder and initialize them.
- void
- build_dialog ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- var_name_entry =
- ui_utils::get_widget_from_gtkbuilder<Gtk::ComboBox>
- (gtkbuilder, "variablenameentry");
- m_variable_history =
- Gtk::ListStore::create (get_cols ());
- var_name_entry->set_model (m_variable_history);
- var_name_entry->set_entry_text_column (get_cols ().varname);
-
- inspect_button =
- ui_utils::get_widget_from_gtkbuilder<Gtk::Button> (gtkbuilder,
- "inspectbutton");
- inspect_button->set_sensitive (false);
-
- Gtk::Box *box =
- ui_utils::get_widget_from_gtkbuilder<Gtk::Box> (gtkbuilder,
- "inspectorwidgetbox");
-
- var_inspector.reset (new VarInspector (debugger, perspective));
- var_inspector->enable_contextual_menu (true);
- var_inspector->cleared_signal ().connect
- (sigc::mem_fun
- (*this,
- &VarInspectorDialog::Priv::on_variable_inspector_cleared));
-
- Gtk::ScrolledWindow *scr = Gtk::manage (new Gtk::ScrolledWindow);
- scr->set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- scr->set_shadow_type (Gtk::SHADOW_IN);
- scr->add (var_inspector->widget ());
- box->pack_start (*scr);
- dialog.show_all ();
- }
-
- void
- connect_to_widget_signals ()
- {
- THROW_IF_FAIL (inspect_button);
- THROW_IF_FAIL (var_name_entry);
- inspect_button->signal_clicked ().connect (sigc::mem_fun
- (*this, &Priv::do_inspect_variable));
- var_name_entry->signal_changed ().connect (sigc::mem_fun
- (*this, &Priv::on_var_name_changed_signal));
- var_name_entry->get_entry()->signal_activate ().connect (sigc::mem_fun
- (*this, &Priv::do_inspect_variable));
- }
-
- /// Inspect the variable (or, more generally the expression) which
- /// name the user has typed in the variable name entry, in the UI.
- void
- do_inspect_variable ()
- {
- NEMIVER_TRY;
-
- THROW_IF_FAIL (var_name_entry);
-
- UString var_name = var_name_entry->get_entry ()->get_text ();
- if (var_name == "")
- return;
-
- inspect_variable (var_name, /*expand=*/true);
-
- NEMIVER_CATCH;
- }
-
- /// Inspect an expression.
- ///
- /// \param a_expr the expression to inspect.
- ///
- /// \param a_expand whether to expand the resulting expression
- /// tree.
- void
- inspect_variable (const UString& a_expr,
- bool a_expand)
- {
- inspect_variable (a_expr, a_expand,
- sigc::mem_fun
- (*this,
- &VarInspectorDialog::Priv::on_variable_inspected));
- }
-
- /// Inspect an expression.
- ///
- /// \param a_expr the expression to inspect.
- ///
- /// \param a_expand whether to expand the resulting expression
- /// tree.
- ///
- /// \param a_s a slot to invoke whenever the expresion has been
- /// inspected.
- void
- inspect_variable (const UString &a_expr,
- bool a_expand,
- const sigc::slot<void,
- const IDebugger::VariableSafePtr> &a_s)
- {
- THROW_IF_FAIL (var_inspector);
- THROW_IF_FAIL (m_variable_history);
-
- var_inspector->inspect_variable
- (a_expr, a_expand, a_s);
-
- add_to_history (a_expr,
- false /*append*/,
- false /*don't allow duplicates*/);
- }
-
- /// Tests wheter if the variable expression exists in history.
- ///
- /// \param a_expr the expression to look for.
- ///
- /// \param a_iter if the return returned true and if this pointer
- /// is non-null, then *a_iter is filled with an iterator pointing
- /// at the expression found in history.
- ///
- /// \return true if the variable expression a_expr exits in
- /// memory, false otherwise.
- bool
- exists_in_history (const UString &a_expr,
- Gtk::TreeModel::iterator *a_iter = 0) const
- {
- THROW_IF_FAIL (m_variable_history);
-
- Gtk::TreeModel::iterator it;
- for (it = m_variable_history->children ().begin ();
- it != m_variable_history->children ().end ();
- ++it) {
- if ((*it)[get_cols ().varname] == a_expr) {
- if (a_iter != 0)
- *a_iter = it;
- return true;
- }
- }
- return false;
- }
-
- /// Erases an expression from expression history.
- ///
- /// \param a_iter the iterator pointing to the expression to erase
- /// from history.
- void
- erase_expression_from_history (Gtk::TreeModel::iterator &a_iter)
- {
- THROW_IF_FAIL (m_variable_history);
- m_variable_history->erase (a_iter);
- }
-
- /// Add an expression to variable expression history. If the
- /// expression already exists in history, it can either be
- /// duplicated or be not. Also, the new expression can be either
- /// appended or prepended to history.
- ///
- /// \param a_expr the expression to add to history.
- ///
- /// \param a_prepend if true, prepend the expression to history.
- ///
- /// \param allow_dups if true, allow expressions to be present in
- /// more than copy in history.
- void
- add_to_history (const UString &a_expr,
- bool a_prepend = false,
- bool a_allow_dups = false)
- {
- // Don't append empty expressions.
- if (a_expr.empty ())
- return;
-
- // If the expression already exists in history, remove it, so
- // that it can be added again, as to be the latest added item
- // to historry.
- Gtk::TreeModel::iterator it;
- if (!a_allow_dups
- && exists_in_history (a_expr, &it))
- erase_expression_from_history (it);
-
- THROW_IF_FAIL (m_variable_history);
- if (a_prepend)
- it = m_variable_history->insert
- (m_variable_history->children ().begin ());
- else
- it = m_variable_history->append ();
- (*it)[get_cols ().varname] = a_expr;
- }
-
- void
- get_history (std::list<UString> &a_hist) const
- {
- Gtk::TreeModel::iterator it;
- for (it = m_variable_history->children ().begin ();
- it != m_variable_history->children ().end ();
- ++it) {
- Glib::ustring elem = (*it)[get_cols ().varname];
- a_hist.push_back (elem);
- }
- }
-
- /// Set the current history of variable expression to a new one.
- ///
- /// \param a_hist the new history to set.
- void
- set_history (const std::list<UString> &a_hist)
- {
- m_variable_history->clear ();
- std::list<UString>::const_iterator it;
- for (it = a_hist.begin (); it != a_hist.end (); ++it)
- add_to_history (*it, /*a_prepend=*/false,
- /*a_allow_dups=*/false);
- }
-
- //************************
- //<signal handlers>
- //*************************
-
- /// Handler called when the name of the variable changes in the
- /// variable name entry field.
- void
- on_var_name_changed_signal ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
- NEMIVER_TRY
-
- THROW_IF_FAIL (var_name_entry);
- THROW_IF_FAIL (inspect_button);
-
- UString var_name = var_name_entry->get_entry ()->get_text ();
- if (var_name == "") {
- inspect_button->set_sensitive (false);
- } else {
- inspect_button->set_sensitive (true);
- }
-
- // this handler is called when any text is changed in the entry or when
- // an item is selected from the combobox. We don't want to inspect any
- // text that is typed into the entry, but we do want to inspect when
- // they choose an item from the dropdown list
- if (var_name_entry->get_active ()) {
- inspect_variable (var_name, true);
- }
-
- NEMIVER_CATCH
- }
-
- /// Handler called when the variable to be inspected is actually
- /// added to the inspector.
- void
- on_variable_inspected (const IDebugger::VariableSafePtr)
- {
- }
-
- /// Handler called when the variable inspector is cleared.
- void
- on_variable_inspector_cleared ()
- {
- }
-
- //************************
- //</signal handlers>
- //*************************
-};//end class VarInspectorDialog::Priv
-
-VarInspectorDialog::VarInspectorDialog (IDebugger &a_debugger,
- IPerspective &a_perspective) :
- Dialog (a_perspective.plugin_path (),
- "varinspectordialog.ui",
- "varinspectordialog")
-{
- LOG_FUNCTION_SCOPE_NORMAL_DD;
- m_priv.reset
- (new VarInspectorDialog::Priv (widget (),
- gtkbuilder (), a_debugger,
- a_perspective));
- THROW_IF_FAIL (m_priv);
-}
-
-VarInspectorDialog::~VarInspectorDialog ()
-{
- LOG_D ("delete", "destructor-domain");
-}
-
-UString
-VarInspectorDialog::variable_name () const
-{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->var_name_entry);
- return m_priv->var_name_entry->get_entry ()->get_text ();
-}
-
-/// Inspect an expression (including a variable)
-///
-/// \param a_var_name the expression to inspect.
-void
-VarInspectorDialog::inspect_variable (const UString &a_var_name)
-{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->var_name_entry);
-
- if (a_var_name != "") {
- m_priv->var_name_entry->get_entry ()->set_text (a_var_name);
- m_priv->inspect_variable (a_var_name, true);
- }
-}
-
-/// Inspect an expression (including a variable)
-///
-/// \param a_var_name the expression to inspect.
-///
-/// \param a_slot a slot to invoke whenever the expression has been
-/// inspected.
-void
-VarInspectorDialog::inspect_variable
-(const UString &a_var_name,
- const sigc::slot<void,
- const IDebugger::VariableSafePtr> &a_slot)
-{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->var_name_entry);
-
- if (a_var_name != "") {
- m_priv->var_name_entry->get_entry ()->set_text (a_var_name);
- m_priv->inspect_variable (a_var_name, true, a_slot);
- }
-}
-
-const IDebugger::VariableSafePtr
-VarInspectorDialog::variable () const
-{
- THROW_IF_FAIL (m_priv);
- return m_priv->var_inspector->get_variable ();
-}
-
-/// Return the variable inspector used by this dialog
-VarInspector&
-VarInspectorDialog::inspector () const
-{
- THROW_IF_FAIL (m_priv);
- return *m_priv->var_inspector;
-}
-
-/// Set the history of variable expression to a new one.
-///
-/// \param a_hist the new history.
-void
-VarInspectorDialog::set_history (const std::list<UString> &a_hist)
-{
- THROW_IF_FAIL (m_priv);
-
- m_priv->set_history (a_hist);
-}
-
-void
-VarInspectorDialog::get_history (std::list<UString> &a_hist) const
-{
- THROW_IF_FAIL (m_priv);
- m_priv->get_history (a_hist);
-}
-
-NEMIVER_END_NAMESPACE (nemiver)
-
diff --git a/src/persp/dbgperspective/nmv-var-inspector-dialog.h b/src/persp/dbgperspective/nmv-var-inspector-dialog.h
deleted file mode 100644
index f397423..0000000
--- a/src/persp/dbgperspective/nmv-var-inspector-dialog.h
+++ /dev/null
@@ -1,64 +0,0 @@
-//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.
- */
-#ifndef __NMV_VAR_INSPECTOR_DIALOG_H__
-#define __NMV_VAR_INSPECTOR_DIALOG_H__
-
-#include "nmv-dialog.h"
-#include "nmv-i-perspective.h"
-#include "nmv-i-debugger.h"
-#include "nmv-var-inspector.h"
-
-NEMIVER_BEGIN_NAMESPACE (nemiver)
-
-class VarInspectorDialog : public Dialog {
- //non copyable
- VarInspectorDialog (const VarInspectorDialog &);
- VarInspectorDialog& operator= (const VarInspectorDialog &);
-
- //tell me why you would want to extend this.
- VarInspectorDialog ();
-
- class Priv;
- SafePtr<Priv> m_priv;
-
-public:
- VarInspectorDialog (IDebugger &a_debugger,
- IPerspective &a_perspective);
- virtual ~VarInspectorDialog ();
-
- UString variable_name () const;
- void inspect_variable (const UString &a_variable_name);
- void inspect_variable (const UString &a_variable_name,
- const sigc::slot<void,
- const IDebugger::VariableSafePtr> &);
- const IDebugger::VariableSafePtr variable () const;
- VarInspector& inspector () const;
- void set_history (const std::list<UString> &);
- void get_history (std::list<UString> &) const;
-};//end class VarInspectorDialog
-
-NEMIVER_END_NAMESPACE (nemiver)
-
-#endif //__NMV_VAR_INSPECTOR_DIALOG_H__
diff --git a/src/persp/dbgperspective/nmv-var-inspector.cc b/src/persp/dbgperspective/nmv-var-inspector.cc
deleted file mode 100644
index db178e7..0000000
--- a/src/persp/dbgperspective/nmv-var-inspector.cc
+++ /dev/null
@@ -1,785 +0,0 @@
-//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"
-
-#include <glib/gi18n.h>
-#include <sstream>
-#include <gtkmm/treestore.h>
-#include "common/nmv-exception.h"
-#include "common/nmv-dynamic-module.h"
-#include "nmv-var-inspector.h"
-#include "nmv-variables-utils.h"
-#include "nmv-i-var-walker.h"
-#include "nmv-ui-utils.h"
-#include "nmv-vars-treeview.h"
-#include "nmv-debugger-utils.h"
-
-namespace uutil = nemiver::ui_utils;
-namespace vutil = nemiver::variables_utils2;
-namespace dutil = nemiver::debugger_utils;
-namespace cmn = nemiver::common;
-
-using cmn::DynamicModuleManager;
-
-NEMIVER_BEGIN_NAMESPACE (nemiver)
-
-/// A no-op variable slot.
-static void
-no_op_void_variable_slot (const IDebugger::VariableSafePtr)
-{
-}
-
-class VarInspector::Priv : public sigc::trackable {
- friend class VarInspector;
- Priv ();
-
- bool requested_variable;
- bool requested_type;
- bool expand_variable;
- bool re_visualize;
- bool enable_contextual_menu;
- IDebugger &debugger;
- // Variable that is being inspected
- // at a given point in time
- IDebugger::VariableSafePtr variable;
- IPerspective &perspective;
- VarsTreeView *tree_view;
- Glib::RefPtr<Gtk::TreeStore> tree_store;
- Gtk::TreeModel::iterator var_row_it;
- Gtk::TreeModel::iterator cur_selected_row;
- Glib::RefPtr<Gtk::ActionGroup> var_inspector_action_group;
- Gtk::Widget *var_inspector_menu;
- IVarWalkerSafePtr varobj_walker;
- DynamicModuleManager *module_manager;
- Glib::RefPtr<Gtk::UIManager> ui_manager;
- mutable sigc::signal<void,
- const IDebugger::VariableSafePtr> var_inspected_signal;
- mutable sigc::signal<void> cleared_signal;
-
- void
- build_widget ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
- tree_view = Gtk::manage (VarsTreeView::create ());
- THROW_IF_FAIL (tree_view);
- tree_store = tree_view->get_tree_store ();
- THROW_IF_FAIL (tree_store);
- init_actions ();
- }
-
- void
- connect_to_signals ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- 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_activated ().connect
- (sigc::mem_fun (*this, &Priv::on_tree_view_row_activated_signal));
-
- tree_view->signal_row_expanded ().connect
- (sigc::mem_fun (*this, &Priv::on_tree_view_row_expanded_signal));
-
- tree_view->signal_button_press_event ().connect_notify
- (sigc::mem_fun (this, &Priv::on_button_press_signal));
-
- Gtk::CellRenderer *r = tree_view->get_column_cell_renderer
- (VarsTreeView::VARIABLE_VALUE_COLUMN_INDEX);
- THROW_IF_FAIL (r);
-
- Gtk::CellRendererText *t =
- dynamic_cast<Gtk::CellRendererText*> (r);
- t->signal_edited ().connect (sigc::mem_fun
- (*this, &Priv::on_cell_edited_signal));
- }
-
- void
- re_init_tree_view ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
- THROW_IF_FAIL (tree_store);
- tree_store->clear ();
- }
-
- void init_actions ()
- {
- ui_utils::ActionEntry s_var_inspector_action_entries [] = {
- {
- "CopyVariablePathMenuItemAction",
- Gtk::Stock::COPY,
- _("_Copy Variable Name"),
- _("Copy the variable path expression to the clipboard"),
- sigc::mem_fun
- (*this,
- &Priv::on_variable_path_expr_copy_to_clipboard_action),
- ui_utils::ActionEntry::DEFAULT,
- "",
- false
- },
- {
- "CopyVariableValueMenuItemAction",
- Gtk::Stock::COPY,
- _("_Copy Variable Value"),
- _("Copy the variable value to the clipboard"),
- sigc::mem_fun
- (*this,
- &Priv::on_variable_value_copy_to_clipboard_action),
- ui_utils::ActionEntry::DEFAULT,
- "",
- false
- }
- };
-
- var_inspector_action_group =
- Gtk::ActionGroup::create ("var-inspector-action-group");
- var_inspector_action_group->set_sensitive (true);
- int num_actions =
- sizeof (s_var_inspector_action_entries)
- /
- sizeof (ui_utils::ActionEntry);
-
- ui_utils::add_action_entries_to_action_group
- (s_var_inspector_action_entries,
- num_actions,
- var_inspector_action_group);
-
- get_ui_manager ()->insert_action_group (var_inspector_action_group);
- }
-
- void
- graphically_set_variable (const IDebugger::VariableSafePtr a_variable,
- bool a_expand)
- {
- Gtk::TreeModel::iterator parent_iter =
- tree_store->children ().begin ();
- Gtk::TreeModel::iterator var_row;
- vutil::append_a_variable (a_variable,
- *tree_view,
- parent_iter,
- var_row,
- true /* Do truncate type */);
- LOG_DD ("set variable" << a_variable->name ());
-
- // If the variable has children, unfold it so that we can see them.
- if (a_expand
- && var_row
- && (a_variable->members ().size ()
- || a_variable->needs_unfolding ()))
- tree_view->expand_row (tree_store->get_path (var_row), false);
- variable = a_variable;
- }
-
- void
- set_variable (const IDebugger::VariableSafePtr a_variable,
- bool a_expand,
- bool a_re_visualize)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- THROW_IF_FAIL (tree_view && tree_store);
-
- re_visualize = a_re_visualize;
-
- re_init_tree_view ();
- variable = a_variable;
- if (a_re_visualize) {
- debugger.revisualize_variable (a_variable,
- sigc::bind
- (sigc::mem_fun
- (*this,
- &Priv::on_var_revisualized),
- a_expand));
- } else {
- graphically_set_variable (a_variable, a_expand);
- }
- }
-
- 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);
- }
-
- /// Creates a variable (or more generally, an expression).
- ///
- /// \param a_name the expression (or name of the variable) to
- /// create.
- ///
- /// \param a_expand whethet to expand the tree representing the
- /// expression that is going to be created, or not.
- void
- create_variable (const UString &a_name,
- bool a_expand)
- {
- create_variable (a_name, a_expand, &no_op_void_variable_slot);
- }
-
- /// Creates a variable (or more generally, an expression).
- ///
- /// \param a_name the expression (or name of the variable) to
- /// create.
- ///
- /// \param a_expand whethet to expand the tree representing the
- /// expression that is going to be created, or not.
- ///
- /// \param a_slot a slot (an abstraction of a handler function)
- /// that is invoked whenever the resulting expression is added to
- /// the inspector.
- void
- create_variable (const UString &a_name,
- bool a_expand,
- const sigc::slot<void,
- const IDebugger::VariableSafePtr> &a_slot)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- expand_variable = a_expand;
- debugger.create_variable
- (a_name,
- sigc::bind
- (sigc::mem_fun
- (this, &VarInspector::Priv::on_variable_created_signal),
- a_slot));
- }
-
- Glib::RefPtr<Gtk::UIManager> get_ui_manager ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- if (!ui_manager) {
- ui_manager = Gtk::UIManager::create ();
- }
- return ui_manager;
- }
-
- Gtk::Widget* get_var_inspector_menu ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- if (!var_inspector_menu) {
- string relative_path =
- Glib::build_filename ("menus", "varinspectorpopup.xml");
- string absolute_path;
- THROW_IF_FAIL (perspective.build_absolute_resource_path
- (relative_path, absolute_path));
- get_ui_manager ()->add_ui_from_file (absolute_path);
- get_ui_manager ()->ensure_update ();
- var_inspector_menu =
- get_ui_manager ()->get_widget ("/VarInspectorPopup");
- }
- return var_inspector_menu;
- }
-
- void
- popup_var_inspector_menu (GdkEventButton *a_event)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- Gtk::Menu *menu =
- dynamic_cast<Gtk::Menu*> (get_var_inspector_menu ());
- THROW_IF_FAIL (menu);
-
- // only pop up a menu if a row exists at that position
- Gtk::TreeModel::Path path;
- Gtk::TreeViewColumn* column = 0;
- int cell_x = 0, cell_y = 0;
- THROW_IF_FAIL (tree_view);
- THROW_IF_FAIL (a_event);
- if (tree_view->get_path_at_pos (static_cast<int> (a_event->x),
- static_cast<int> (a_event->y),
- path,
- column,
- cell_x,
- cell_y)) {
- menu->popup (a_event->button, a_event->time);
- }
- }
-
- DynamicModuleManager*
- get_module_manager ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- if (!module_manager) {
- DynamicModule::Loader *loader =
- perspective.get_workbench ().get_dynamic_module
- ().get_module_loader ();
- THROW_IF_FAIL (loader);
- module_manager = loader->get_dynamic_module_manager ();
- THROW_IF_FAIL (module_manager);
- }
- return module_manager;
- }
-
- IVarWalkerSafePtr
- create_varobj_walker ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- IVarWalkerSafePtr result =
- get_module_manager ()->load_iface_with_default_manager<IVarWalker>
- ("varobjwalker", "IVarWalker");
- result->visited_variable_signal ().connect
- (sigc::mem_fun (*this, &Priv::on_visited_variable_signal));
- return result;
- }
-
- IVarWalkerSafePtr
- get_varobj_walker ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- if (!varobj_walker)
- varobj_walker = create_varobj_walker ();
- return varobj_walker;
- }
-
- // ******************
- // <signal handlers>
- // ******************
-
- void
- on_visited_variable_signal (const IDebugger::VariableSafePtr a_var)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- std::string str;
- dutil::dump_variable_value (*a_var, 0, str);
-
- if (!str.empty ())
- Gtk::Clipboard::get ()->set_text (str);
-
- NEMIVER_CATCH
- }
-
- void
- on_var_revisualized (const IDebugger::VariableSafePtr a_var,
- bool a_expand)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY;
-
- graphically_set_variable (a_var, a_expand);
-
- NEMIVER_CATCH;
- }
-
- void
- on_tree_view_selection_changed_signal ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
- NEMIVER_TRY
-
- THROW_IF_FAIL (tree_view);
- Glib::RefPtr<Gtk::TreeSelection> sel = tree_view->get_selection ();
- THROW_IF_FAIL (sel);
- cur_selected_row = sel->get_selected ();
- if (!cur_selected_row) {return;}
- IDebugger::VariableSafePtr var =
- (IDebugger::VariableSafePtr)cur_selected_row->get_value
- (vutil::get_variable_columns ().variable);
- if (!var)
- return;
-
- variable = var;
-
- // If the variable should be editable, set the cell of the variable value
- // editable.
- cur_selected_row->set_value
- (vutil::get_variable_columns ().variable_value_editable,
- debugger.is_variable_editable (variable));
-
- // Dump some log about the variable that got selected.
- UString qname;
- variable->build_qname (qname);
- LOG_DD ("row of variable '" << qname << "'");
-
- NEMIVER_CATCH
- }
-
- void
- on_tree_view_row_activated_signal (const Gtk::TreeModel::Path &a_path,
- Gtk::TreeViewColumn *a_col)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- THROW_IF_FAIL (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
- on_tree_view_row_expanded_signal (const Gtk::TreeModel::iterator &a_row_it,
- const Gtk::TreeModel::Path &a_row_path)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- if (!(*a_row_it)[vutil::get_variable_columns ().needs_unfolding]) {
- return;
- }
- LOG_DD ("The variable needs unfolding");
-
- IDebugger::VariableSafePtr var =
- (*a_row_it)[vutil::get_variable_columns ().variable];
- debugger.unfold_variable
- (var, sigc::bind (sigc::mem_fun (*this,
- &Priv::on_variable_unfolded_signal),
- a_row_path));
- LOG_DD ("variable unfolding triggered");
-
- NEMIVER_CATCH
- }
-
- void
- on_cell_edited_signal (const Glib::ustring &a_path,
- const Glib::ustring &a_text)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- Gtk::TreeModel::iterator row = tree_store->get_iter (a_path);
- IDebugger::VariableSafePtr var =
- (*row)[vutil::get_variable_columns ().variable];
- THROW_IF_FAIL (var);
-
- debugger.assign_variable
- (var, a_text,
- sigc::bind (sigc::mem_fun
- (*this, &Priv::on_variable_assigned_signal),
- a_path));
-
- NEMIVER_CATCH
- }
-
- void on_button_press_signal (GdkEventButton *a_event)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- // right-clicking should pop up a context menu
- if (a_event->type == GDK_BUTTON_PRESS
- && a_event->button == 3
- && enable_contextual_menu) {
- popup_var_inspector_menu (a_event);
- }
-
- NEMIVER_CATCH
- }
-
- /// A handler called whenever a variable is created in the
- /// debugger interface, as a result of the user requesting that we
- /// inspect it. The function then adds the variable into the
- /// inspector.
- ///
- /// \param a_var the created variable
- ///
- /// \param a_slot a handler to be called whenever the variable is
- /// added to the inspector.
- void
- on_variable_created_signal (const IDebugger::VariableSafePtr a_var,
- sigc::slot<void,
- const IDebugger::VariableSafePtr> &a_slot)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY;
-
- set_variable (a_var, expand_variable, re_visualize);
- var_inspected_signal.emit (a_var);
- a_slot (a_var);
-
- NEMIVER_CATCH;
- }
-
- void
- on_variable_unfolded_signal (const IDebugger::VariableSafePtr a_var,
- const Gtk::TreeModel::Path &a_var_node)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- Gtk::TreeModel::iterator var_it = tree_store->get_iter (a_var_node);
- vutil::update_unfolded_variable (a_var, *tree_view,
- var_it,
- true /* Do truncate type */);
- tree_view->expand_row (a_var_node, false);
-
- NEMIVER_CATCH
- }
-
- void
- on_variable_assigned_signal (const IDebugger::VariableSafePtr a_var,
- const UString &a_var_path)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- Gtk::TreeModel::iterator var_row
- = tree_store->get_iter (a_var_path);
- THROW_IF_FAIL (var_row);
- THROW_IF_FAIL (tree_view);
- vutil::update_a_variable_node (a_var, *tree_view,
- var_row,
- true /* do truncate types */,
- false /* don't handle highlight ... */ ,
- false /* ... really */);
-
- NEMIVER_CATCH
- }
-
- void on_variable_path_expr_copy_to_clipboard_action ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- THROW_IF_FAIL (cur_selected_row);
-
- IDebugger::VariableSafePtr variable =
- cur_selected_row->get_value
- (vutil::get_variable_columns ().variable);
- THROW_IF_FAIL (variable);
-
- debugger.query_variable_path_expr
- (variable,
- sigc::mem_fun (*this, &Priv::on_variable_path_expression_signal));
-
- NEMIVER_CATCH
- }
-
- void on_variable_value_copy_to_clipboard_action ()
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- NEMIVER_TRY
-
- THROW_IF_FAIL (cur_selected_row);
-
- IDebugger::VariableSafePtr variable =
- cur_selected_row->get_value
- (vutil::get_variable_columns ().variable);
- THROW_IF_FAIL (variable);
-
- IVarWalkerSafePtr walker = get_varobj_walker ();
- walker->connect (&debugger, variable);
- walker->do_walk_variable ();
-
- NEMIVER_CATCH
- }
-
- void on_variable_path_expression_signal
- (const IDebugger::VariableSafePtr a_var)
- {
- NEMIVER_TRY
-
- Gtk::Clipboard::get ()->set_text (a_var->path_expression ());
-
- NEMIVER_CATCH
- }
- // ******************
- // </signal handlers>
- // ******************
-
-public:
-
- Priv (IDebugger &a_debugger,
- IPerspective &a_perspective) :
- requested_variable (false),
- requested_type (false),
- expand_variable (false),
- re_visualize (false),
- enable_contextual_menu (false),
- debugger (a_debugger),
- perspective (a_perspective),
- tree_view (0),
- var_inspector_menu (0),
- module_manager (0)
- {
- build_widget ();
- re_init_tree_view ();
- connect_to_signals ();
- }
-
- ~Priv ()
- {
- }
-};//end class VarInspector::Priv
-
-VarInspector::VarInspector (IDebugger &a_debugger,
- IPerspective &a_perspective)
-{
- m_priv.reset (new Priv (a_debugger, a_perspective));
-}
-
-VarInspector::~VarInspector ()
-{
- LOG_D ("deleted", "destructor-domain");
-}
-
-Gtk::Widget&
-VarInspector::widget () const
-{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->tree_view);
- return *m_priv->tree_view;
-}
-
-void
-VarInspector::set_variable (IDebugger::VariableSafePtr a_variable,
- bool a_expand, bool a_revisualize)
-{
- THROW_IF_FAIL (m_priv);
-
- m_priv->set_variable (a_variable, a_expand, a_revisualize);
-}
-
-/// Inspect a variable/expression.
-///
-/// \param a_variable_name the name of the variable, or more
-/// generally, the expression to the inspected.
-///
-/// \param a_expand whether to expand the resulting tree representing
-/// the expression.
-void
-VarInspector::inspect_variable (const UString &a_variable_name,
- bool a_expand)
-{
- inspect_variable (a_variable_name,
- a_expand,
- &no_op_void_variable_slot);
-}
-
-/// Inspect a variable/expression.
-///
-/// \param a_variable_name the name of the variable, or more
-/// generally, the expression to the inspected.
-///
-/// \param a_expand whether to expand the resulting tree representing
-/// the expression.
-///
-/// \param a_s a slot (handler function) to be invoked whenever the
-/// resulting tree (representing the expression to the inspected) is
-/// added to the inspector.
-void
-VarInspector::inspect_variable (const UString &a_variable_name,
- bool a_expand,
- const sigc::slot<void,
- const IDebugger::VariableSafePtr> &a_s)
-{
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- if (a_variable_name == "") {return;}
- THROW_IF_FAIL (m_priv);
- m_priv->re_init_tree_view ();
- m_priv->create_variable (a_variable_name, a_expand, a_s);
-}
-
-IDebugger::VariableSafePtr
-VarInspector::get_variable () const
-{
- THROW_IF_FAIL (m_priv);
-
- return m_priv->variable;
-}
-
-void
-VarInspector::enable_contextual_menu (bool a_flag)
-{
- THROW_IF_FAIL (m_priv);
- m_priv->enable_contextual_menu = a_flag;
-}
-
-bool
-VarInspector::is_contextual_menu_enabled () const
-{
- THROW_IF_FAIL (m_priv);
- return m_priv->enable_contextual_menu;
-}
-
-void
-VarInspector::clear ()
-{
- THROW_IF_FAIL (m_priv);
- m_priv->re_init_tree_view ();
-}
-
-/// A signal emitted when the variable to be inspected is added to the
-/// inspector.
-sigc::signal<void, const IDebugger::VariableSafePtr>&
-VarInspector::var_inspected_signal () const
-{
- THROW_IF_FAIL (m_priv);
- return m_priv->var_inspected_signal;
-}
-
-/// A signal emitted when the inspector is cleared.
-sigc::signal<void>&
-VarInspector::cleared_signal () const
-{
- THROW_IF_FAIL (m_priv);
- return m_priv->cleared_signal;
-}
-
-NEMIVER_END_NAMESPACE (nemiver)
diff --git a/src/persp/dbgperspective/nmv-var-inspector.h b/src/persp/dbgperspective/nmv-var-inspector.h
deleted file mode 100644
index e194619..0000000
--- a/src/persp/dbgperspective/nmv-var-inspector.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//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.
- */
-#ifndef __NMV_VAR_INSPECTOR2_H__
-#define __NMV_VAR_INSPECTOR2_H__
-
-#include "common/nmv-object.h"
-#include "common/nmv-safe-ptr-utils.h"
-#include "nmv-i-debugger.h"
-#include "nmv-i-perspective.h"
-
-namespace Gtk {
- class Widget;
-}
-
-NEMIVER_BEGIN_NAMESPACE (nemiver)
-
-namespace common {
- class UString;
-}
-
-class VarInspector : public nemiver::common::Object {
- VarInspector (const VarInspector &);
- VarInspector& operator= (const VarInspector &);
- VarInspector ();
- class Priv;
- SafePtr<Priv> m_priv;
-
-public:
- VarInspector (IDebugger &a_debugger,
- IPerspective &a_perspective);
- virtual ~VarInspector ();
- Gtk::Widget& widget () const;
- void set_variable (IDebugger::VariableSafePtr a_variable,
- bool a_expand = false,
- bool a_re_visualize = false);
- void inspect_variable (const UString &a_variable_name,
- bool a_expand = false);
- void inspect_variable (const UString &a_variable_name,
- bool a_expand,
- const sigc::slot<void,
- const IDebugger::VariableSafePtr> &a_s);
- IDebugger::VariableSafePtr get_variable () const;
- void enable_contextual_menu (bool a_flag);
- bool is_contextual_menu_enabled () const;
- void clear ();
-
- // Signals
- sigc::signal<void, const IDebugger::VariableSafePtr>&
- var_inspected_signal () const;
- sigc::signal<void>& cleared_signal () const;
-
-};//end class VarInspector
-
-NEMIVER_END_NAMESPACE (nemiver)
-
-#endif //__NMV_VAR_INSPECTOR2_H__
-
diff --git a/src/persp/dbgperspective/nmv-watchpoint-dialog.cc b/src/persp/dbgperspective/nmv-watchpoint-dialog.cc
index de2b27d..e1ac371 100644
--- a/src/persp/dbgperspective/nmv-watchpoint-dialog.cc
+++ b/src/persp/dbgperspective/nmv-watchpoint-dialog.cc
@@ -29,7 +29,7 @@
#include "common/nmv-env.h"
#include "common/nmv-ustring.h"
#include "nmv-ui-utils.h"
-#include "nmv-var-inspector.h"
+#include "nmv-expr-inspector.h"
NEMIVER_BEGIN_NAMESPACE (nemiver)
@@ -43,7 +43,7 @@ struct WatchpointDialog::Priv {
Gtk::CheckButton *write_check_button;
Gtk::Button *ok_button;
Gtk::Button *cancel_button;
- SafePtr<VarInspector> var_inspector;
+ SafePtr<ExprInspector> var_inspector;
IDebugger &debugger;
IPerspective &perspective;
@@ -112,7 +112,7 @@ struct WatchpointDialog::Priv {
"varinspectorbox");
THROW_IF_FAIL (box);
- var_inspector.reset (new VarInspector (debugger, perspective));
+ var_inspector.reset (new ExprInspector (debugger, perspective));
THROW_IF_FAIL (var_inspector);
Gtk::ScrolledWindow *scr = Gtk::manage (new Gtk::ScrolledWindow);
@@ -168,7 +168,7 @@ struct WatchpointDialog::Priv {
UString expression = expression_entry->get_text ();
if (expression == "")
return;
- var_inspector->inspect_variable (expression);
+ var_inspector->inspect_expression (expression);
NEMIVER_CATCH
}
diff --git a/src/persp/dbgperspective/ui/Makefile.am b/src/persp/dbgperspective/ui/Makefile.am
index 5091f59..6615993 100644
--- a/src/persp/dbgperspective/ui/Makefile.am
+++ b/src/persp/dbgperspective/ui/Makefile.am
@@ -4,7 +4,7 @@ proclistdialog.ui \
loadcoredialog.ui \
savedsessionsdialog.ui \
preferencesdialog.ui \
-varinspectordialog.ui \
+exprinspectordialog.ui \
findtextdialog.ui \
openfiledialog.ui \
setbreakpointdialog.ui \
diff --git a/src/persp/dbgperspective/ui/exprinspectordialog.ui b/src/persp/dbgperspective/ui/exprinspectordialog.ui
new file mode 100644
index 0000000..158db4b
--- /dev/null
+++ b/src/persp/dbgperspective/ui/exprinspectordialog.ui
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 2.6 -->
+ <object class="GtkDialog" id="exprinspectordialog">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Inspect an Expression</property>
+ <property name="window_position">center</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="okbutton">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkComboBox" id="variablenameentry">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_entry">True</property>
+ <child internal-child="entry">
+ <object class="GtkEntry" id="comboboxentry-entry">
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_SHRINK</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Variable Name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">variablenameentry</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="inspectbutton">
+ <property name="label" translatable="yes">_Inspect</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="inspectorwidgetbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-7">okbutton</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/src/persp/dbgperspective/ui/varinspectordialog.ui b/src/persp/dbgperspective/ui/varinspectordialog.ui
deleted file mode 100644
index 5b6bf75..0000000
--- a/src/persp/dbgperspective/ui/varinspectordialog.ui
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <!-- interface-requires gtk+ 2.6 -->
- <object class="GtkDialog" id="varinspectordialog">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="title" translatable="yes">Inspect a Variable</property>
- <property name="window_position">center</property>
- <property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="okbutton">
- <property name="label">gtk-close</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkTable" id="table1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkComboBox" id="variablenameentry">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="has_entry">True</property>
- <child internal-child="entry">
- <object class="GtkEntry" id="comboboxentry-entry">
- <property name="can_focus">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options">GTK_SHRINK</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Variable Name:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">variablenameentry</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="inspectbutton">
- <property name="label" translatable="yes">_Inspect</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="inspectorwidgetbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-7">okbutton</action-widget>
- </action-widgets>
- </object>
-</interface>
--
Dodji
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]