annotate libgui/src/m-editor/octave-qscintilla.h @ 20986:00835323fb44

prevent shortcut ambiguity between main and editor window * file-editor-interface.h: renamed insert_new_open_actions into insert_global_actions * file-editor-tab.h: no more signal for setting edit shortcuts * file-editor.cc (file_editor): initialize actions that will be copied from main window; (request_undo, request_copy, request_paste, request_selectall): remove slots for obsolete own action signals; (do_undo, copyClipboard, pasteClipboard, selectAll): and move the relevant code into these already existing slots of the related main window actions; (handle_tab_remove_request): make sure that the focus stays in editor window when tabs are closed; (edit_status_update, handle_editor_state_changed): only enable undo or copy action if already copied from main window; (insert_global_actions) renamed from insert_new_open_actions, insert some global actions and copy those global actions that are en/disabled depending on editor state; (enable_menu_shortcuts): when editor loses focus enable copy and undo action since these are alwys active in the main window; (construct): edit menu is stored in a class variable, actions that are copied from the main menu are not added to the menus here; (set_shortcuts): no shortcuts for the actions from the main menu; (check_actions): do not disable paste-/select-all-action when no tab is open; * file-editor.h: renamed insert_new_open_actions into insert_global_actions, no more slots for the action that are now copied from the main window, * octave-qscintilla.cc (octave_qscintilla): initialize undo and redo state for editor actions; (focusInEvent): emit undo and redo state for the editor actions; * octave-qscintilla.h: focusInEvent * main-window.cc (notice_settings): use renamed function for switching menu_bar accelerators between main window and editor; (construct): removed list and signal for adding common action to the dock widgets, since these action are globally valid; (construct_menu_bar): call function for inserting some action to the editor here and not in construct_file_menu; (disable_menu_shortcuts) renamed from enable_menu_shortcuts; (construct_edit_menu): global edit actions with ApplicationShortcut context; (set_global_edit_shortcuts): removed obsolete function since global edit actions now only exist once * main-window.h: removed obsolete function set_global_edit_shortcuts, renamed function enable_menu_shortcuts into disable_menu_shortcuts, * octave-dock-widget.cc (octave_dock_widget, add_actions): removed obsolete slot for adding actions from the main window * octave-dock-widget.h: removed slots add_actions * shortcut-manager.cc (do_init_data): remove shortcuts for obsolete editor actions which are now copied from the main window; (init): do not store widget name in the shortcut hash since duplicate shortcuts in different widgets are not possible anymore; (do_fill_treewidget): adapt check for duplicate shortcuts accordingly; (shortcut_dialog_finish): changes related to changed shortcut hash
author Torsten <ttl@justmail.de>
date Fri, 25 Dec 2015 22:31:23 +0100
parents f7084eae3318
children 65827e9cccb8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
1 /*
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19606
diff changeset
3 Copyright (C) 2013-2015 Torsten
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
4
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
5 This file is part of Octave.
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
6
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
10 option) any later version.
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
11
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
15 for more details.
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
16
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
20
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
21 */
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
22
16768
e2de3c8882be copyright notice fixes
John W. Eaton <jwe@octave.org>
parents: 16733
diff changeset
23 // Author: Torsten <ttl@justmail.de>
e2de3c8882be copyright notice fixes
John W. Eaton <jwe@octave.org>
parents: 16733
diff changeset
24
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20277
diff changeset
25 #if ! defined (octave_octave_qscintilla_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17635
diff changeset
26 #define octave_octave_qscintilla_h 1
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
27
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
28 #include <Qsci/qsciscintilla.h>
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
29 #include <QMenu>
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
30 #include <QContextMenuEvent>
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
31
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
32 class octave_qscintilla : public QsciScintilla
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
33 {
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
34 Q_OBJECT
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
35
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
36 public:
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
37
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
38 octave_qscintilla (QWidget *p);
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
39 ~octave_qscintilla ();
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
40
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
41 virtual void contextMenuEvent (QContextMenuEvent *e);
20277
48d9001bdee3 Avoid HAVE_ macros in header file.
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
42
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 16768
diff changeset
43 void context_help_doc (bool);
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
44 void context_edit ();
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
45 void context_run ();
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
46 void get_global_textcursor_pos (QPoint *global_pos, QPoint *local_pos);
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
47 bool get_actual_word ();
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
48
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
49 signals:
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
50
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
51 void execute_command_in_terminal_signal (const QString&);
18687
99e26cb0f87f use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents: 18684
diff changeset
52 void create_context_menu_signal (QMenu*);
19004
e87e65bc71ae improved finding a function file for editing in gui (bug #41509)
Torsten <ttl@justmail.de>
parents: 18689
diff changeset
53 void context_menu_edit_signal (const QString&);
18684
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
54 void qsci_has_focus_signal (bool);
18689
fac35875f6eb update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents: 18687
diff changeset
55 void status_update (bool,bool);
19606
3156773fcc80 open a doc page from editor directly without command window
Torsten <ttl@justmail.de>
parents: 19426
diff changeset
56 void show_doc_signal (const QString&);
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
57
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
58 private slots:
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
59
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
60 void contextmenu_help (bool);
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 16768
diff changeset
61 void contextmenu_doc (bool);
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 16768
diff changeset
62 void contextmenu_help_doc (bool);
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
63 void contextmenu_edit (bool);
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
64 void contextmenu_run (bool);
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
65
18689
fac35875f6eb update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents: 18687
diff changeset
66 void text_changed (void);
fac35875f6eb update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents: 18687
diff changeset
67
18684
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
68 protected:
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
69
20986
00835323fb44 prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents: 20791
diff changeset
70 void focusInEvent(QFocusEvent *focusEvent);
00835323fb44 prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents: 20791
diff changeset
71
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
72 private:
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
73
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
74 QString _word_at_cursor;
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
75
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
76 };
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
77
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
diff changeset
78 #endif