Mercurial > hg > octave-lyh
diff libgui/src/main-window.h @ 16502:45ae1038ee89
allow renaming of variables in workspace viewer
* main-window.h, main-window.cc
(main_window::handle_rename_variable_request): New function.
(main_window::construct_octave_qt_link): Connect
_workspace_model::rename_variable to
main_window::handle_rename_variable_request.
(main_window::rename_variable_callback): New function.
* octave-qt-link.h, octave-qt-link.cc
(octave_qt_link::do_set_workspace,
octave_qt_link::set_workspace_signal): New argument, top_level.
Change all uses.
* octave-link.h, octave-link.cc (octave_link::post_event):
Provide two-argument version.
(octave_link::set_workspace, octave_link::do_set_workspace):
New argument, top_level. Change all uses.
* workspace-model.h, workspace-model.cc (workspace_model::flags):
Conditionally add Qt::ItemIsEditable to flags.
(workspace_model::data): Also return value for column 0 if it is
editable.
(workspace_model::setData): Handle setting new values.
(workspace_model::_top_level): New data member.
(workspace_model::set_workspace): New argument, top_level.
(workspace_model::rename_variable): New signal.
* workspace-view.h, workspace-view.cc (variable_name_editor):
New class.
(workspace_view::var_name_editor): New data member.
(workspace_view::workspace_view): Initialize it. Set var_name_editor
as delegate for column 0.
(workspace_view::~workspace_view): Delete var_name_editor.
(workspace_view::item_double_clicked): Delete.
* symtab.h (symbol_table::rename, symbol_table::do_rename,
symbol_table::symbol_record::rename): New functions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 12 Apr 2013 14:50:56 -0400 |
parents | 8b783661e03f |
children | 49b059bf27c7 |
line wrap: on
line diff
--- a/libgui/src/main-window.h +++ b/libgui/src/main-window.h @@ -64,6 +64,8 @@ public: + typedef std::pair <std::string, std::string> name_pair; + main_window (QWidget *parent = 0); ~main_window (void); @@ -82,6 +84,8 @@ void handle_load_workspace_request (void); void handle_clear_workspace_request (void); void handle_clear_history_request (void); + void handle_rename_variable_request (const QString& old_name, + const QString& new_name); void new_file (const QString& commands = QString ()); void open_file (const QString& file_name = QString ()); void open_online_documentation_page (void); @@ -150,6 +154,8 @@ void load_workspace_callback (const std::string& file); + void rename_variable_callback (const name_pair& names); + void clear_workspace_callback (void); void clear_history_callback (void);