Mercurial > octave
diff libgui/src/main-window.cc @ 17901:2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
* file-editor-interface.h: request_new_function without string argument
* file-editor.cc (request_new_function): boolean instead of string as parameter,
ask for function name, set preference for not asking when creating new files,
connect a signal when file is loaded, and evaluate edit in the console
(restore_create_file_setting): slot that restores the create file pref when
file is loaded
(request_open_file): emit a signal when file is loaded
(construct): new action for new function, connect execute in terminal signal
* file_editor.h: new signal for executing a command in terminal, new signal
when file is loaded, request_new_function with boolean instead of string
parameter, new slot for restoring prompt create new file preference
* main-window.cc (construct_new_menu): new function action as class variable
(set_global_shortcuts): shortcut for new function
* main-window.h: new function action as class variable
author | Torsten <ttl@justmail.de> |
---|---|
date | Mon, 11 Nov 2013 22:01:27 +0100 |
parents | 14c427b5c5c1 |
children | a38cee8f0a9b |
line wrap: on
line diff
--- a/libgui/src/main-window.cc Mon Nov 11 09:54:07 2013 -0500 +++ b/libgui/src/main-window.cc Mon Nov 11 22:01:27 2013 +0100 @@ -1171,8 +1171,9 @@ tr ("Script")); _new_script_action->setShortcutContext (Qt::ApplicationShortcut); - QAction *new_function_action = new_menu->addAction (tr ("Function")); - new_function_action->setEnabled (true); + _new_function_action = new_menu->addAction (tr ("Function")); + _new_function_action->setEnabled (true); + _new_function_action->setShortcutContext (Qt::ApplicationShortcut); QAction *new_figure_action = new_menu->addAction (tr ("Figure")); new_figure_action->setEnabled (true); @@ -1181,7 +1182,7 @@ connect (_new_script_action, SIGNAL (triggered ()), editor_window, SLOT (request_new_script ())); - connect (new_function_action, SIGNAL (triggered ()), + connect (_new_function_action, SIGNAL (triggered ()), editor_window, SLOT (request_new_function ())); #endif @@ -1809,6 +1810,9 @@ _open_action->setShortcut (QKeySequence::Open); _new_script_action->setShortcut (QKeySequence::New); + _new_function_action->setShortcut (Qt::ControlModifier + + Qt::ShiftModifier + + Qt::Key_N); _exit_action->setShortcut (QKeySequence::Quit); @@ -1824,6 +1828,7 @@ _open_action->setShortcut (no_key); _new_script_action->setShortcut (no_key); + _new_function_action->setShortcut (no_key); _exit_action->setShortcut (no_key);