[nemiver/varobjs-support] Allow VarInspector2 to expand the variable it appended
- From: Dodji Seketeli <dodji src gnome org>
- To: svn-commits-list gnome org
- Subject: [nemiver/varobjs-support] Allow VarInspector2 to expand the variable it appended
- Date: Mon, 18 May 2009 17:42:15 -0400 (EDT)
commit 00f52528cb97d707b545bb9eb56abe937cfbdebb
Author: Dodji Seketeli <dodji redhat com>
Date: Mon May 18 22:47:48 2009 +0200
Allow VarInspector2 to expand the variable it appended
* src/persp/dbgperspective/nmv-var-inspector2.cc:
(VarInspector2::Priv::set_variable): Add a new param to expand the
variable to its first level if it has children.
* src/persp/dbgperspective/nmv-var-inspector-dialog.cc: Expand
variable shown in the inspector.
---
.../dbgperspective/nmv-var-inspector-dialog.cc | 11 +++---
src/persp/dbgperspective/nmv-var-inspector2.cc | 33 ++++++++++++--------
src/persp/dbgperspective/nmv-var-inspector2.h | 6 ++-
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/src/persp/dbgperspective/nmv-var-inspector-dialog.cc b/src/persp/dbgperspective/nmv-var-inspector-dialog.cc
index 0f803a1..0cf4f52 100644
--- a/src/persp/dbgperspective/nmv-var-inspector-dialog.cc
+++ b/src/persp/dbgperspective/nmv-var-inspector-dialog.cc
@@ -139,16 +139,17 @@ public:
UString var_name = var_name_entry->get_entry ()->get_text ();
if (var_name == "") {return;}
- inspect_variable (var_name);
+ inspect_variable (var_name, true);
NEMIVER_CATCH
}
- void inspect_variable (const UString& a_expr)
+ void inspect_variable (const UString& a_expr,
+ bool a_expand)
{
THROW_IF_FAIL (var_inspector);
THROW_IF_FAIL (m_variable_history);
- var_inspector->inspect_variable (a_expr);
+ var_inspector->inspect_variable (a_expr, a_expand);
add_to_history (a_expr,
false /*append*/,
false /*don't allow duplicates*/);
@@ -218,7 +219,7 @@ public:
// 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);
+ inspect_variable (var_name, true);
}
NEMIVER_CATCH
@@ -263,7 +264,7 @@ VarInspectorDialog::inspect_variable (const UString &a_var_name)
if (a_var_name != "") {
m_priv->var_name_entry->get_entry ()->set_text (a_var_name);
- m_priv->inspect_variable (a_var_name);
+ m_priv->inspect_variable (a_var_name, true);
}
}
diff --git a/src/persp/dbgperspective/nmv-var-inspector2.cc b/src/persp/dbgperspective/nmv-var-inspector2.cc
index 0082323..6f0c61d 100644
--- a/src/persp/dbgperspective/nmv-var-inspector2.cc
+++ b/src/persp/dbgperspective/nmv-var-inspector2.cc
@@ -47,6 +47,7 @@ class VarInspector2::Priv : public sigc::trackable {
bool requested_variable;
bool requested_type;
+ bool expand_variable;
IDebuggerSafePtr debugger;
// Variable that is being inspected
// at a given point in time
@@ -115,7 +116,8 @@ class VarInspector2::Priv : public sigc::trackable {
}
void
- set_variable (const IDebugger::VariableSafePtr a_variable)
+ set_variable (const IDebugger::VariableSafePtr a_variable,
+ bool a_expand)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
@@ -132,13 +134,13 @@ class VarInspector2::Priv : public sigc::trackable {
parent_iter,
var_row);
LOG_DD ("set variable" << a_variable->name ());
- // Don't expand the row if the variable needs unfolding.
- // It means its children nodes (members) are not known yet, and
- // will be queried when the user wants to expand it himself.
- if (var_row
- && !(*var_row)[vutil::get_variable_columns ().needs_unfolding]) {
+
+ // 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;
}
@@ -165,10 +167,12 @@ class VarInspector2::Priv : public sigc::trackable {
}
void
- create_variable (const UString &a_name)
+ create_variable (const UString &a_name,
+ bool a_expand)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
+ expand_variable = a_expand;
debugger->create_variable
(a_name, sigc::mem_fun
(this, &VarInspector2::Priv::on_variable_created_signal));
@@ -287,7 +291,7 @@ class VarInspector2::Priv : public sigc::trackable {
NEMIVER_TRY
- set_variable (a_var);
+ set_variable (a_var, expand_variable);
NEMIVER_CATCH
}
@@ -334,6 +338,7 @@ public:
Priv (IDebuggerSafePtr a_debugger) :
requested_variable (false),
requested_type (false),
+ expand_variable (false),
debugger (a_debugger)
{
build_widget ();
@@ -366,15 +371,17 @@ VarInspector2::widget () const
}
void
-VarInspector2::set_variable (IDebugger::VariableSafePtr a_variable)
+VarInspector2::set_variable (IDebugger::VariableSafePtr a_variable,
+ bool a_expand)
{
THROW_IF_FAIL (m_priv);
- m_priv->set_variable (a_variable);
+ m_priv->set_variable (a_variable, a_expand);
}
void
-VarInspector2::inspect_variable (const UString &a_variable_name)
+VarInspector2::inspect_variable (const UString &a_variable_name,
+ bool a_expand)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
@@ -382,7 +389,7 @@ VarInspector2::inspect_variable (const UString &a_variable_name)
THROW_IF_FAIL (m_priv);
m_priv->re_init_tree_view ();
m_priv->delete_variable_if_needed ();
- m_priv->create_variable (a_variable_name);
+ m_priv->create_variable (a_variable_name, a_expand);
}
IDebugger::VariableSafePtr
diff --git a/src/persp/dbgperspective/nmv-var-inspector2.h b/src/persp/dbgperspective/nmv-var-inspector2.h
index 1ae012f..49c684a 100644
--- a/src/persp/dbgperspective/nmv-var-inspector2.h
+++ b/src/persp/dbgperspective/nmv-var-inspector2.h
@@ -52,8 +52,10 @@ public:
VarInspector2 (IDebuggerSafePtr a_debugger);
virtual ~VarInspector2 ();
Gtk::Widget& widget () const;
- void set_variable (IDebugger::VariableSafePtr a_variable);
- void inspect_variable (const UString &a_variable_name);
+ void set_variable (IDebugger::VariableSafePtr a_variable,
+ bool a_expand = false);
+ void inspect_variable (const UString &a_variable_name,
+ bool a_expand = false);
IDebugger::VariableSafePtr get_variable () const;
void clear ();
};//end class VarInspector2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]