Mercurial > hg > octave-nkf
changeset 19802:d258070914ef gui-release
open file directly without edit command when editing a function from editor
* file-editor-tab.cc (handle_context_menu_edit): append .m to file name if
necessary, emit new signal to editor for the file open request
* file-editor-tab.h: new signal requesting to open a file
* file-editor.cc (add_file_editor_tab): connect new request-open-signal to
the already existing slot for opening a file
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 22 Jan 2015 06:52:37 +0100 |
parents | b6bd9159c1c9 |
children | 3156773fcc80 |
files | libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/file-editor.cc |
diffstat | 3 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -311,8 +311,10 @@ filename = QString::fromStdString ( map.contents ("file").data ()[0].string_value ()); - emit execute_command_in_terminal_signal (QString("edit ") - + "\""+filename+"\""); + if (! filename.endsWith (".m")) + filename.append (".m"); + + emit request_open_file (filename); } void
--- a/libgui/src/m-editor/file-editor-tab.h +++ b/libgui/src/m-editor/file-editor-tab.h @@ -138,6 +138,7 @@ void execute_command_in_terminal_signal (const QString&); void set_global_edit_shortcuts_signal (bool); void create_context_menu_tab_signal (QMenu *); + void request_open_file (const QString&); protected:
--- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -1615,6 +1615,9 @@ connect (f, SIGNAL (execute_command_in_terminal_signal (const QString&)), main_win (), SLOT (execute_command_in_terminal (const QString&))); + connect (f, SIGNAL (request_open_file (const QString&)), + this, SLOT (request_open_file (const QString&))); + connect (f, SIGNAL (set_global_edit_shortcuts_signal (bool)), main_win (), SLOT (set_global_edit_shortcuts (bool)));