nemiver r963 - in trunk: . src/persp/dbgperspective src/persp/dbgperspective/glade
- From: jjongsma svn gnome org
- To: svn-commits-list gnome org
- Subject: nemiver r963 - in trunk: . src/persp/dbgperspective src/persp/dbgperspective/glade
- Date: Wed, 24 Dec 2008 19:43:08 +0000 (UTC)
Author: jjongsma
Date: Wed Dec 24 19:43:08 2008
New Revision: 963
URL: http://svn.gnome.org/viewvc/nemiver?rev=963&view=rev
Log:
Remember history in var inspector dialog (Bug #536259)
* src/persp/dbgperspective/glade/varinspectordialog.glade:
* src/persp/dbgperspective/nmv-var-inspector-dialog.cc: remember the history
of the variables inspected in the variable inspector dialog so that you
don't have to re-type them if you want to go back to one that you viewed
earlier. This isn't a perfect solution since the history is lost when the
dialog is closed. I'm not sure if it would be better to somehow make the
history outlive the dialog or if we should jsut change the lifetime of the
dialog (so that we call show()/hide() rather than creating and destroying it
every time it's shown)
Bug #536259
Modified:
trunk/ChangeLog
trunk/src/persp/dbgperspective/glade/varinspectordialog.glade
trunk/src/persp/dbgperspective/nmv-var-inspector-dialog.cc
Modified: trunk/src/persp/dbgperspective/glade/varinspectordialog.glade
==============================================================================
--- trunk/src/persp/dbgperspective/glade/varinspectordialog.glade (original)
+++ trunk/src/persp/dbgperspective/glade/varinspectordialog.glade Wed Dec 24 19:43:08 2008
@@ -1,176 +1,113 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
<glade-interface>
-
-<widget class="GtkDialog" id="varinspectordialog">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Inspect a Variable</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="default_width">300</property>
- <property name="default_height">400</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
- <property name="has_separator">False</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="okbutton">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-close</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-7</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox1">
- <property name="border_width">6</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table1">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="inspectbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Inspect</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="variablenameentry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Variable Name:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">variablenameentry</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="inspectorwidgetbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
+ <widget class="GtkDialog" id="varinspectordialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Inspect a Variable</property>
+ <property name="default_width">300</property>
+ <property name="default_height">400</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkComboBoxEntry" id="variablenameentry">
+ <property name="visible">True</property>
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="comboboxentry-entry1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</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>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="inspectbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Inspect</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ <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>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="inspectorwidgetbox">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="okbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-7</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</glade-interface>
Modified: trunk/src/persp/dbgperspective/nmv-var-inspector-dialog.cc
==============================================================================
--- trunk/src/persp/dbgperspective/nmv-var-inspector-dialog.cc (original)
+++ trunk/src/persp/dbgperspective/nmv-var-inspector-dialog.cc Wed Dec 24 19:43:08 2008
@@ -24,6 +24,7 @@
*/
#include <glib/gi18n.h>
+#include <gtkmm/liststore.h>
#include "common/nmv-exception.h"
#include "nmv-var-inspector-dialog.h"
#include "nmv-var-inspector.h"
@@ -31,9 +32,18 @@
NEMIVER_BEGIN_NAMESPACE (nemiver)
+class VariableHistoryStoreColumns : public Gtk::TreeModel::ColumnRecord
+{
+public:
+ Gtk::TreeModelColumn<Glib::ustring> varname;
+ VariableHistoryStoreColumns() { add (varname); }
+};
+
class VarInspectorDialog::Priv {
friend class VarInspectorDialog;
- Gtk::Entry *var_name_entry;
+ Gtk::ComboBoxEntry *var_name_entry;
+ Glib::RefPtr<Gtk::ListStore> m_variable_history_store;
+ VariableHistoryStoreColumns m_variable_store_columns;
Gtk::Button *inspect_button;
SafePtr<VarInspector2> var_inspector;
Gtk::Dialog &dialog;
@@ -62,8 +72,13 @@
LOG_FUNCTION_SCOPE_NORMAL_DD;
var_name_entry =
- ui_utils::get_widget_from_glade<Gtk::Entry> (glade,
+ ui_utils::get_widget_from_glade<Gtk::ComboBoxEntry> (glade,
"variablenameentry");
+ m_variable_history_store =
+ Gtk::ListStore::create (m_variable_store_columns);
+ var_name_entry->set_model (m_variable_history_store);
+ var_name_entry->set_text_column (m_variable_store_columns.varname);
+
inspect_button =
ui_utils::get_widget_from_glade<Gtk::Button> (glade,
"inspectbutton");
@@ -85,44 +100,55 @@
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::on_inspect_button_clicked_signal));
+ (*this, &Priv::do_inspect_variable));
var_name_entry->signal_changed ().connect (sigc::mem_fun
(*this, &Priv::on_var_name_changed_signal));
- var_name_entry->signal_activate ().connect (sigc::mem_fun
- (*this, &Priv::on_var_name_activated_signal));
+ var_name_entry->get_entry()->signal_activate ().connect (sigc::mem_fun
+ (*this, &Priv::do_inspect_variable));
}
//************************
//<signal handlers>
//*************************
- void on_var_name_activated_signal ()
+ void do_inspect_variable ()
{
NEMIVER_TRY
THROW_IF_FAIL (var_name_entry);
- THROW_IF_FAIL (var_inspector);
- UString var_name = var_name_entry->get_text ();
+ UString var_name = var_name_entry->get_active_text ();
if (var_name == "") {return;}
- var_inspector->inspect_variable (var_name);
+ inspect_variable (var_name);
NEMIVER_CATCH
}
- void on_inspect_button_clicked_signal ()
+ void inspect_variable (const UString& a_varname)
{
- LOG_FUNCTION_SCOPE_NORMAL_DD;
- NEMIVER_TRY
-
- THROW_IF_FAIL (var_name_entry);
THROW_IF_FAIL (var_inspector);
+ THROW_IF_FAIL (m_variable_history_store);
- UString variable_name = var_name_entry->get_text ();
- if (variable_name == "") {return;}
- var_inspector->inspect_variable (variable_name);
+ var_inspector->inspect_variable (a_varname);
- NEMIVER_CATCH
+ // now update the history in the entry combobox
+ bool found = false;
+ // first check if this variable is already in the history
+ Gtk::TreeModel::iterator tree_iter;
+ for (tree_iter = m_variable_history_store->children ().begin ();
+ tree_iter != m_variable_history_store->children ().end ();
+ ++tree_iter) {
+ if (a_varname == (*tree_iter)[m_variable_store_columns.varname]) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ // if it's not already in the list, add it.
+ Gtk::TreeModel::iterator new_iter = m_variable_history_store->append ();
+ (*new_iter)[m_variable_store_columns.varname] = a_varname;
+ }
}
void on_var_name_changed_signal ()
@@ -133,13 +159,21 @@
THROW_IF_FAIL (var_name_entry);
THROW_IF_FAIL (inspect_button);
- UString var_name = var_name_entry->get_text ();
+ UString var_name = var_name_entry->get_active_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);
+ }
+
NEMIVER_CATCH
}
@@ -170,7 +204,7 @@
{
THROW_IF_FAIL (m_priv);
THROW_IF_FAIL (m_priv->var_name_entry);
- return m_priv->var_name_entry->get_text ();
+ return m_priv->var_name_entry->get_active_text ();
}
void
@@ -181,8 +215,8 @@
THROW_IF_FAIL (m_priv->var_inspector);
if (a_var_name != "") {
- m_priv->var_name_entry->set_text (a_var_name);
- m_priv->var_inspector->inspect_variable (a_var_name);
+ m_priv->var_name_entry->get_entry ()->set_text (a_var_name);
+ m_priv->inspect_variable (a_var_name);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]