[nemiver] Do not blindly truncate types (Closes: #602074)
- From: Dodji Seketeli <dodji src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nemiver] Do not blindly truncate types (Closes: #602074)
- Date: Mon, 23 Nov 2009 10:07:52 +0000 (UTC)
commit ce8787ee5304c2d0117bba81b431013d2d7eeff0
Author: Dodji Seketeli <dodji redhat com>
Date: Sun Nov 22 12:43:32 2009 +0100
Do not blindly truncate types (Closes: #602074)
* src/persp/dbgperspective/nmv-variables-utils.cc:
(set_a_variable_node_type): Add a flag to indicate whether the type
should be truncated or not. Truncate multi-line types to the first
line in all cases. Set the truncation limit to 50 instead of 15
characters.
(update_a_variable_real, update_a_variable_node,
update_unfolded_variable, update_a_variable,
update_a_variable_real, append_a_variable): Add a flag to indicate
whether the type should be truncated or not. Eventually Pass it down to
set_a_variable_node_type.
* src/persp/dbgperspective/nmv-variables-utils.h:
(set_a_variable_node_type, update_a_variable_node,
update_unfolded_variable, update_a_variable, append_a_variable):
Update these declarations to add a flag indicating whether the type
should be truncated or not.
* src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc:
(GlobalVarsInspectorDialog::Priv::update_a_global_variable,
GlobalVarsInspectorDialog::Priv::append_a_global_variable):
Do not truncate the type in the global variables inspector dialog.
* src/persp/dbgperspective/nmv-local-vars-inspector.cc:
(LocalVarsInspector::Priv::append_a_local_variable,
LocalVarsInspector::Priv::append_a_function_argument,
LocalVarsInspector::Priv::update_a_function_argument,
LocalVarsInspector::Priv::update_a_local_variable,
LocalVarsInspector::Priv::on_variable_unfolded_signal,
LocalVarsInspector::Priv::on_variable_assigned_signal):
Do not truncate the type in the local variables inspector widget.
* src/persp/dbgperspective/nmv-var-inspector.cc:
(VarInspector::Priv::set_variable,
VarInspector::Priv::on_variable_unfolded_signal,
VarInspector::Priv::on_variable_assigned_signal):
Do truncate the type in this variable widget used in the popup variable
inspector and variable inspector (modal) dialog.
.../nmv-global-vars-inspector-dialog.cc | 7 ++-
.../dbgperspective/nmv-local-vars-inspector.cc | 16 ++++--
src/persp/dbgperspective/nmv-var-inspector.cc | 13 ++++-
src/persp/dbgperspective/nmv-variables-utils.cc | 54 ++++++++++++++-----
src/persp/dbgperspective/nmv-variables-utils.h | 14 ++++--
5 files changed, 77 insertions(+), 27 deletions(-)
---
diff --git a/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc b/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
index 65e521f..9b7ff29 100644
--- a/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
+++ b/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
@@ -200,7 +200,8 @@ public:
static_cast<Gtk::TreeView&> (*tree_view),
TreeStoreRefPtr::cast_static (tree_store),
iter /* no parent */,
- iter /* result iter */);
+ iter /* result iter */,
+ false /* do not truncate type */);
tree_view->expand_row (tree_store->get_path (iter), false);
}
@@ -211,7 +212,9 @@ public:
THROW_IF_FAIL (tree_view);
Gtk::TreeModel::iterator parent_row_it;
vutil::update_a_variable (a_var, *tree_view, parent_row_it,
- true, false);
+ false /* Do not truncate type */ ,
+ true /* Handle highlight */ ,
+ false /* The frame is not new */ );
}
//****************************
diff --git a/src/persp/dbgperspective/nmv-local-vars-inspector.cc b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
index 88eb26f..1fba95b 100644
--- a/src/persp/dbgperspective/nmv-local-vars-inspector.cc
+++ b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
@@ -365,7 +365,8 @@ public:
vutil::append_a_variable (a_var,
*tree_view,
tree_store,
- parent_row_it);
+ parent_row_it,
+ false /* do not truncate types */);
tree_view->expand_row (tree_store->get_path (parent_row_it), false);
local_vars.push_back (a_var);
}
@@ -383,7 +384,8 @@ public:
vutil::append_a_variable (a_var,
*tree_view,
tree_store,
- parent_row_it);
+ parent_row_it,
+ false /* do not truncate type */);
tree_view->expand_row (tree_store->get_path (parent_row_it), false);
function_arguments.push_back (a_var);
}
@@ -401,6 +403,7 @@ public:
if (get_local_variables_row_iterator (parent_row_it)) {
vutil::update_a_variable (a_var, *tree_view,
parent_row_it,
+ false /* do not truncate type */,
true /* handle highlight */,
false /* is not a new frame */,
a_update_members);
@@ -420,6 +423,7 @@ public:
return vutil::update_a_variable (a_var,
*tree_view,
parent_row_it,
+ false /* do not truncate type */,
true /* handle highlight */,
false /* is not a new frame */);
}
@@ -850,7 +854,8 @@ public:
vutil::update_unfolded_variable (a_var,
*tree_view,
tree_store,
- var_it);
+ var_it,
+ false /* do not truncate type */);
tree_view->expand_row (a_var_node, false);
NEMIVER_CATCH
}
@@ -1036,7 +1041,10 @@ public:
THROW_IF_FAIL (var_row);
THROW_IF_FAIL (tree_view);
vutil::update_a_variable_node (a_var, *tree_view,
- var_row, false, false);
+ var_row,
+ false /* do not truncate type */,
+ false /* do not highlight variable */,
+ false /* frame ain't new */);
NEMIVER_CATCH
}
diff --git a/src/persp/dbgperspective/nmv-var-inspector.cc b/src/persp/dbgperspective/nmv-var-inspector.cc
index ca89fc5..f7684ce 100644
--- a/src/persp/dbgperspective/nmv-var-inspector.cc
+++ b/src/persp/dbgperspective/nmv-var-inspector.cc
@@ -192,7 +192,8 @@ class VarInspector::Priv : public sigc::trackable {
*tree_view,
tree_store,
parent_iter,
- var_row);
+ 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.
@@ -489,7 +490,10 @@ class VarInspector::Priv : public sigc::trackable {
NEMIVER_TRY
Gtk::TreeModel::iterator var_it = tree_store->get_iter (a_var_node);
- vutil::update_unfolded_variable (a_var, *tree_view, tree_store, var_it);
+ vutil::update_unfolded_variable (a_var, *tree_view,
+ tree_store,
+ var_it,
+ true /* Do truncate type */);
tree_view->expand_row (a_var_node, false);
NEMIVER_CATCH
@@ -508,7 +512,10 @@ class VarInspector::Priv : public sigc::trackable {
THROW_IF_FAIL (var_row);
THROW_IF_FAIL (tree_view);
vutil::update_a_variable_node (a_var, *tree_view,
- var_row, false, false);
+ var_row,
+ true /* do truncate types */,
+ false /* don't handle highlight ... */ ,
+ false /* ... really */);
NEMIVER_CATCH
}
diff --git a/src/persp/dbgperspective/nmv-variables-utils.cc b/src/persp/dbgperspective/nmv-variables-utils.cc
index 422260c..4a078b5 100644
--- a/src/persp/dbgperspective/nmv-variables-utils.cc
+++ b/src/persp/dbgperspective/nmv-variables-utils.cc
@@ -35,6 +35,7 @@ NEMIVER_BEGIN_NAMESPACE (variables_utils2)
static void update_a_variable_real (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
Gtk::TreeModel::iterator &a_row_it,
+ bool a_truncate_type,
bool a_handle_highlight,
bool a_is_new_frame,
bool a_update_members);
@@ -71,9 +72,19 @@ is_type_a_pointer (const UString &a_type)
return false;
}
+/// Populate the type information of the graphical node representing
+/// a variable.
+/// \param a_var_it the iterator to the graphical node representing the
+/// variable we want to set the type for
+/// \param a_type the type string to set
+/// \param a_truncate when true, if the type exceeds a certain length,
+/// truncate it. Do not truncate the variable otherwise. In any case, in
+/// presence of a multi-line type string the type is _always_ truncated to the
+/// first line.
void
set_a_variable_node_type (Gtk::TreeModel::iterator &a_var_it,
- const UString &a_type)
+ const UString &a_type,
+ bool a_truncate)
{
THROW_IF_FAIL (a_var_it);
a_var_it->set_value (get_variable_columns ().type,
@@ -83,10 +94,11 @@ set_a_variable_node_type (Gtk::TreeModel::iterator &a_var_it,
if (nb_lines) {--nb_lines;}
UString::size_type truncation_index = 0;
- static const UString::size_type MAX_TYPE_STRING_LENGTH = 15;
+ static const UString::size_type MAX_TYPE_STRING_LENGTH = 50;
if (nb_lines) {
truncation_index = a_type.find ('\n');
- } else if (a_type.size () > MAX_TYPE_STRING_LENGTH) {
+ } else if (a_truncate
+ && (a_type.size () > MAX_TYPE_STRING_LENGTH)) {
truncation_index = MAX_TYPE_STRING_LENGTH;
}
if (truncation_index) {
@@ -121,6 +133,7 @@ void
update_a_variable_node (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
Gtk::TreeModel::iterator &a_iter,
+ bool a_truncate_type,
bool a_handle_highlight,
bool a_is_new_frame)
{
@@ -168,7 +181,7 @@ update_a_variable_node (const IDebugger::VariableSafePtr a_var,
}
(*a_iter)[get_variable_columns ().value] = a_var->value ();
- set_a_variable_node_type (a_iter, a_var->type ());
+ set_a_variable_node_type (a_iter, a_var->type (), a_truncate_type);
}
@@ -186,7 +199,8 @@ void
update_unfolded_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
- Gtk::TreeModel::iterator a_var_it)
+ Gtk::TreeModel::iterator a_var_it,
+ bool a_truncate_type)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
@@ -200,7 +214,8 @@ update_unfolded_variable (const IDebugger::VariableSafePtr a_var,
a_tree_view,
a_tree_store,
a_var_it,
- result_var_row_it);
+ result_var_row_it,
+ a_truncate_type);
}
}
@@ -391,6 +406,7 @@ bool
update_a_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
Gtk::TreeModel::iterator &a_parent_row_it,
+ bool a_truncate_type,
bool a_handle_highlight,
bool a_is_new_frame,
bool a_update_members)
@@ -410,7 +426,7 @@ update_a_variable (const IDebugger::VariableSafePtr a_var,
}
update_a_variable_real (a_var, a_tree_view,
- row_it, a_handle_highlight,
+ row_it, a_truncate_type, a_handle_highlight,
a_is_new_frame, a_update_members);
return true;
}
@@ -432,6 +448,7 @@ static void
update_a_variable_real (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
Gtk::TreeModel::iterator &a_row_it,
+ bool a_truncate_type,
bool a_handle_highlight,
bool a_is_new_frame,
bool a_update_members)
@@ -439,6 +456,7 @@ update_a_variable_real (const IDebugger::VariableSafePtr a_var,
update_a_variable_node (a_var,
a_tree_view,
a_row_it,
+ a_truncate_type,
a_handle_highlight,
a_is_new_frame);
Gtk::TreeModel::iterator row_it;
@@ -449,7 +467,8 @@ update_a_variable_real (const IDebugger::VariableSafePtr a_var,
row_it != rows.end () && var_it != a_var->members ().end ();
++row_it, ++var_it) {
update_a_variable_real (*var_it, a_tree_view,
- row_it, a_handle_highlight,
+ row_it, a_truncate_type,
+ a_handle_highlight,
a_is_new_frame,
true /* update members */);
}
@@ -469,13 +488,14 @@ bool
append_a_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
- Gtk::TreeModel::iterator &a_parent_row_it)
+ Gtk::TreeModel::iterator &a_parent_row_it,
+ bool a_truncate_type)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
Gtk::TreeModel::iterator row_it;
return append_a_variable (a_var, a_tree_view, a_tree_store,
- a_parent_row_it, row_it);
+ a_parent_row_it, row_it, a_truncate_type);
}
/// Append a variable to a variable tree view widget.
@@ -496,7 +516,8 @@ append_a_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
Gtk::TreeModel::iterator &a_parent_row_it,
- Gtk::TreeModel::iterator &a_result)
+ Gtk::TreeModel::iterator &a_result,
+ bool a_truncate_type)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
THROW_IF_FAIL (a_tree_store);
@@ -525,19 +546,24 @@ append_a_variable (const IDebugger::VariableSafePtr a_var,
if (!a_var) {
return false;
}
- update_a_variable_node (a_var, a_tree_view, row_it, true, true);
+ update_a_variable_node (a_var, a_tree_view, row_it,
+ a_truncate_type, true, true);
list<IDebugger::VariableSafePtr>::const_iterator it;
if (a_var->needs_unfolding ()) {
// Mark *row_it as needing unfolding, and add an empty
// child node to it
(*row_it)[get_variable_columns ().needs_unfolding] = true;
IDebugger::VariableSafePtr empty_var;
- append_a_variable (empty_var, a_tree_view, a_tree_store, row_it);
+ append_a_variable (empty_var, a_tree_view,
+ a_tree_store, row_it,
+ a_truncate_type);
} else {
for (it = a_var->members ().begin ();
it != a_var->members ().end ();
++it) {
- append_a_variable (*it, a_tree_view, a_tree_store, row_it);
+ append_a_variable (*it, a_tree_view,
+ a_tree_store, row_it,
+ a_truncate_type);
}
}
a_result = row_it;
diff --git a/src/persp/dbgperspective/nmv-variables-utils.h b/src/persp/dbgperspective/nmv-variables-utils.h
index 8b15486..d0c2cf0 100644
--- a/src/persp/dbgperspective/nmv-variables-utils.h
+++ b/src/persp/dbgperspective/nmv-variables-utils.h
@@ -78,18 +78,21 @@ VariableColumns& get_variable_columns ();
bool is_type_a_pointer (const UString &a_type);
void set_a_variable_node_type (Gtk::TreeModel::iterator &a_var_it,
- const UString &a_type);
+ const UString &a_type,
+ bool a_truncate);
void update_a_variable_node (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
Gtk::TreeModel::iterator &a_iter,
+ bool a_truncate_type,
bool a_handle_highlight,
bool a_is_new_frame);
void update_unfolded_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
- Gtk::TreeModel::iterator a_var_it);
+ Gtk::TreeModel::iterator a_var_it,
+ bool a_truncate_type);
bool find_a_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeModel::iterator &a_parent_row_it,
@@ -105,6 +108,7 @@ bool find_a_variable_descendent (const IDebugger::VariableSafePtr a_var,
bool update_a_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
Gtk::TreeModel::iterator &a_parent_row_it,
+ bool a_truncate_type,
bool a_handle_highlight,
bool a_is_new_frame,
bool a_update_members = false);
@@ -112,13 +116,15 @@ bool update_a_variable (const IDebugger::VariableSafePtr a_var,
bool append_a_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
- Gtk::TreeModel::iterator &a_parent_row_it);
+ Gtk::TreeModel::iterator &a_parent_row_it,
+ bool a_truncate_type);
bool append_a_variable (const IDebugger::VariableSafePtr a_var,
const Gtk::TreeView &a_tree_view,
const Glib::RefPtr<Gtk::TreeStore> &a_tree_store,
Gtk::TreeModel::iterator &a_parent_row_it,
- Gtk::TreeModel::iterator &a_result);
+ Gtk::TreeModel::iterator &a_result,
+ bool a_truncate_type);
NEMIVER_END_NAMESPACE (variables_utils2)
NEMIVER_END_NAMESPACE (nemiver)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]