Mercurial > octave-libgccjit
diff libgui/src/m-editor/file-editor.cc @ 18687:99e26cb0f87f gui-release
use the actions from the editor for the context menu
* octave-qscintilla.cc (contextMenuEvent): emit new signal for adding the
actions from the editor to the edit areas context menu
* octave-qscintilla.h: new signal
* file-editor-tab.cc (create_context_menu): new slot for the new signal from
the edit area,
(constructor): connect the edit areas signal for creating the context menu
to this new slot
* file-edit-tab.h: new slot and new signal for the editor dock widget
* file-editor.cc (create_context_menu): new slot for the new signal from
the edit tab adding the actions from the editor menu to the context menu,
(add_new_edit_tab): connect the edit tabs signal for creating the context
menu to this new slot
* file-editor.h: new slot
author | Torsten <ttl@justmail.de> |
---|---|
date | Sun, 27 Apr 2014 18:35:19 +0200 |
parents | 74ef7fed8b9a |
children | 02b75b57ed80 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc Sun Apr 27 15:13:05 2014 +0200 +++ b/libgui/src/m-editor/file-editor.cc Sun Apr 27 18:35:19 2014 +0200 @@ -940,12 +940,33 @@ editor_tab_map[fileName] = ID; } +// context menu of edit area void file_editor::active_tab_changed (int index) { emit fetab_change_request (_tab_widget->widget (index)); } +void file_editor::create_context_menu (QMenu *menu) +{ + // remove all standard actions from scintilla + QList<QAction *> all_actions = menu->actions (); + QAction* a; + + foreach (a, all_actions) + menu->removeAction (a); + + // add editor's actions with icons and customized shortcuts + menu->addAction (_undo_action); + menu->addAction (_redo_action); + menu->addSeparator (); + menu->addAction (_cut_action); + menu->addAction (_copy_action); + menu->addAction (_paste_action); + menu->addSeparator (); + menu->addAction (_selectall_action); +} + void file_editor::zoom_in (bool) { @@ -1395,6 +1416,9 @@ connect (f, SIGNAL (mru_add_file (const QString&)), this, SLOT (handle_mru_add_file (const QString&))); + connect (f, SIGNAL (create_context_menu_tab_signal (QMenu *)), + this, SLOT (create_context_menu (QMenu *))); + connect (f, SIGNAL (run_file_signal (const QFileInfo&)), main_win (), SLOT (run_file_in_terminal (const QFileInfo&)));