Mercurial > octave-nkf
comparison libgui/src/m-editor/file-editor.h @ 18699:777281eeb3d4 gui-release
add all editor actions to the shortcut manager and fix their shortcut context
* file_editor_interface.h: new virtual function insert_new_open_actions
* file-editor.cc (request_undo, request_redo, request_copy, request_cut,
request_paste, request_selectall, request_save_file, request_save_file_as,
request_print_file, request_run_file, request_toggle_bookmark,
request_next_bookmark, request_previous_bookmark, request_remove_bookmark,
request_toggle_breakpoint, request_next_breakpoint,
request_previous_breakpoint, request_remove_breakpoint,
request_comment_selected_text, request_uncomment_selected_text,
request_indent_selected_text, request_unindent_selected_text, request_find,
request_goto_line, request_completion) : change slot parameter
from void to bool;
(handle_editor_state_changed): renamed context_run_action;
(notice_settings): call set_shortcuts without parameter;
(insert_new_open_actions): new function called from main window for addings
global action (new, open) to the editors file menu;
(add_action): new function for adding a new action to a menu, connecting the
slot, adding the action to the editor, and setting the shortcut context;
(construct): make all actions class variables, add actions with add_actions,
removing obsolete calls to QAction (), to setShortcutContext (), and to
connect (), new submenu for navigation actions;
(copyClipboard, pasteClipboard, selectAll): use slots with bool parameter;
(set_shortcuts): remove the parameter of this function, it is now only
called when the shortcut settings were changed and not when the terminal
changes focus;
(check_actions): enable/disable whole submenus instead of singe actions
* file-editor.h: new function insert_new_open_actions, slots with bool
parameter instead void, class variables for all actions, new submenus,
set_shortcuts without parameter
* main-window.cc (construct): do not connect the signal for setting shortcuts
depending on terminal focus to the editor, insert new and open file actions
into the editor file menu
* main-window.h: remove the signal for settings other widgets shortcuts
* shortcut-manager.cc (do_init_data): add more actions to the list
author | Torsten <ttl@justmail.de> |
---|---|
date | Wed, 23 Apr 2014 08:42:19 +0200 |
parents | 1b289f45187f |
children | 86eca5d178a6 |
comparison
equal
deleted
inserted
replaced
18695:8b9e99c061f9 | 18699:777281eeb3d4 |
---|---|
27 #include <QAction> | 27 #include <QAction> |
28 #include <QMenuBar> | 28 #include <QMenuBar> |
29 #include <QStatusBar> | 29 #include <QStatusBar> |
30 #include <QCloseEvent> | 30 #include <QCloseEvent> |
31 #include <QTabWidget> | 31 #include <QTabWidget> |
32 #include <QStackedWidget> | |
32 | 33 |
33 #include <QDragEnterEvent> | 34 #include <QDragEnterEvent> |
34 #include <QDropEvent> | 35 #include <QDropEvent> |
35 | 36 |
36 #include <map> | 37 #include <map> |
53 void loadFile (const QString& fileName); | 54 void loadFile (const QString& fileName); |
54 | 55 |
55 QMenu *get_mru_menu (void) { return _mru_file_menu; } | 56 QMenu *get_mru_menu (void) { return _mru_file_menu; } |
56 QMenu *debug_menu (void); | 57 QMenu *debug_menu (void); |
57 QToolBar *toolbar (void); | 58 QToolBar *toolbar (void); |
59 void insert_new_open_actions (QAction*,QAction*,QAction*); | |
58 | 60 |
59 void set_focus (void); | 61 void set_focus (void); |
60 void handle_enter_debug_mode (void); | 62 void handle_enter_debug_mode (void); |
61 void handle_exit_debug_mode (void); | 63 void handle_exit_debug_mode (void); |
62 | 64 |
126 void request_open_file (void); | 128 void request_open_file (void); |
127 void request_close_file (bool); | 129 void request_close_file (bool); |
128 void request_close_all_files (bool); | 130 void request_close_all_files (bool); |
129 void request_close_other_files (bool); | 131 void request_close_other_files (bool); |
130 void request_mru_open_file (QAction *action); | 132 void request_mru_open_file (QAction *action); |
131 void request_print_file (void); | 133 void request_print_file (bool); |
132 | 134 |
133 void request_undo (void); | 135 void request_undo (bool); |
134 void request_redo (void); | 136 void request_redo (bool); |
135 void request_copy (void); | 137 void request_copy (bool); |
136 void request_cut (void); | 138 void request_cut (bool); |
137 void request_paste (void); | 139 void request_paste (bool); |
138 void request_selectall (void); | 140 void request_selectall (bool); |
139 void request_context_help (bool); | 141 void request_context_help (bool); |
140 void request_context_doc (bool); | 142 void request_context_doc (bool); |
141 void request_context_edit (bool); | 143 void request_context_edit (bool); |
142 void request_save_file (void); | 144 void request_save_file (bool); |
143 void request_save_file_as (void); | 145 void request_save_file_as (bool); |
144 void request_run_file (void); | 146 void request_run_file (bool); |
145 void request_context_run (bool); | 147 void request_context_run (bool); |
146 void request_toggle_bookmark (void); | 148 void request_toggle_bookmark (bool); |
147 void request_next_bookmark (void); | 149 void request_next_bookmark (bool); |
148 void request_previous_bookmark (void); | 150 void request_previous_bookmark (bool); |
149 void request_remove_bookmark (void); | 151 void request_remove_bookmark (bool); |
150 | 152 |
151 void request_toggle_breakpoint (void); | 153 void request_toggle_breakpoint (bool); |
152 void request_next_breakpoint (void); | 154 void request_next_breakpoint (bool); |
153 void request_previous_breakpoint (void); | 155 void request_previous_breakpoint (bool); |
154 void request_remove_breakpoint (void); | 156 void request_remove_breakpoint (bool); |
155 | 157 |
156 void request_delete_start_word (bool); | 158 void request_delete_start_word (bool); |
157 void request_delete_end_word (bool); | 159 void request_delete_end_word (bool); |
158 void request_delete_start_line (bool); | 160 void request_delete_start_line (bool); |
159 void request_delete_end_line (bool); | 161 void request_delete_end_line (bool); |
161 void request_copy_line (bool); | 163 void request_copy_line (bool); |
162 void request_cut_line (bool); | 164 void request_cut_line (bool); |
163 void request_duplicate_selection (bool); | 165 void request_duplicate_selection (bool); |
164 void request_transpose_line (bool); | 166 void request_transpose_line (bool); |
165 | 167 |
166 void request_comment_selected_text (void); | 168 void request_comment_selected_text (bool); |
167 void request_uncomment_selected_text (void); | 169 void request_uncomment_selected_text (bool); |
168 | 170 |
169 void request_upper_case (bool); | 171 void request_upper_case (bool); |
170 void request_lower_case (bool); | 172 void request_lower_case (bool); |
171 void request_indent_selected_text (void); | 173 void request_indent_selected_text (bool); |
172 void request_unindent_selected_text (void); | 174 void request_unindent_selected_text (bool); |
173 | 175 |
174 void request_find (void); | 176 void request_find (bool); |
175 | 177 |
176 void request_goto_line (void); | 178 void request_goto_line (bool); |
177 void request_completion (void); | 179 void request_completion (bool); |
178 | 180 |
179 void handle_file_name_changed (const QString& fileName, | 181 void handle_file_name_changed (const QString& fileName, |
180 const QString& toolTip); | 182 const QString& toolTip); |
181 void handle_tab_close_request (int index); | 183 void handle_tab_close_request (int index); |
182 void handle_tab_remove_request (void); | 184 void handle_tab_remove_request (void); |
194 void handle_edit_file_request (const QString& file); | 196 void handle_edit_file_request (const QString& file); |
195 | 197 |
196 // Tells the editor to react on changed settings. | 198 // Tells the editor to react on changed settings. |
197 void notice_settings (const QSettings *settings); | 199 void notice_settings (const QSettings *settings); |
198 | 200 |
199 // Tells the ditor to dis- or enable some shortcuts | 201 void set_shortcuts (); |
200 void set_shortcuts (bool set_shortcuts); | |
201 | 202 |
202 void handle_visibility (bool visible); | 203 void handle_visibility (bool visible); |
203 | 204 |
204 | 205 |
205 protected slots: | 206 protected slots: |
234 void save_file_as (QWidget *fetabID = 0); | 235 void save_file_as (QWidget *fetabID = 0); |
235 void mru_menu_update (void); | 236 void mru_menu_update (void); |
236 bool call_custom_editor (const QString& file_name = QString (), int line = -1); | 237 bool call_custom_editor (const QString& file_name = QString (), int line = -1); |
237 | 238 |
238 QWidget *find_tab_widget (const QString& openFileName) const; | 239 QWidget *find_tab_widget (const QString& openFileName) const; |
240 QAction *add_action (QMenu *menu, const QIcon &icon, const QString &text, | |
241 const char *member); | |
239 | 242 |
240 std::map<QString, QWidget *> editor_tab_map; | 243 std::map<QString, QWidget *> editor_tab_map; |
241 | 244 |
242 QString ced; | 245 QString ced; |
243 | 246 |
244 QMenuBar *_menu_bar; | 247 QMenuBar *_menu_bar; |
245 QToolBar *_tool_bar; | 248 QToolBar *_tool_bar; |
246 QMenu *_debug_menu; | 249 QMenu *_debug_menu; |
250 | |
251 QAction *_new_action; | |
252 QAction *_new_function_action; | |
253 QAction *_open_action; | |
247 | 254 |
248 QAction *_upper_case_action; | 255 QAction *_upper_case_action; |
249 QAction *_lower_case_action; | 256 QAction *_lower_case_action; |
250 QAction *_comment_selection_action; | 257 QAction *_comment_selection_action; |
251 QAction *_uncomment_selection_action; | 258 QAction *_uncomment_selection_action; |
282 QAction *_toggle_bookmark_action; | 289 QAction *_toggle_bookmark_action; |
283 QAction * _remove_bookmark_action; | 290 QAction * _remove_bookmark_action; |
284 | 291 |
285 QAction *_print_action; | 292 QAction *_print_action; |
286 QAction *_run_action; | 293 QAction *_run_action; |
287 QAction *_context_run_action; | 294 QAction *_run_selection_action; |
288 | 295 |
289 QAction *_context_edit_action; | 296 QAction *_edit_function_action; |
290 QAction *_save_action; | 297 QAction *_save_action; |
291 QAction *_save_as_action; | 298 QAction *_save_as_action; |
292 QAction *_close_action; | 299 QAction *_close_action; |
293 QAction *_close_all_action; | 300 QAction *_close_all_action; |
294 QAction *_close_others_action; | 301 QAction *_close_others_action; |
297 QAction *_undo_action; | 304 QAction *_undo_action; |
298 | 305 |
299 QAction *_preferences_action; | 306 QAction *_preferences_action; |
300 QAction *_styles_preferences_action; | 307 QAction *_styles_preferences_action; |
301 | 308 |
309 QAction *_toggle_breakpoint_action; | |
310 QAction *_next_breakpoint_action; | |
311 QAction *_previous_breakpoint_action; | |
312 QAction *_remove_all_breakpoints_action; | |
313 | |
302 QMenu *_edit_cmd_menu; | 314 QMenu *_edit_cmd_menu; |
303 QMenu *_edit_fmt_menu; | 315 QMenu *_edit_fmt_menu; |
316 QMenu *_edit_nav_menu; | |
317 QMenu *_fileMenu; | |
304 | 318 |
305 QTabWidget *_tab_widget; | 319 QTabWidget *_tab_widget; |
306 | 320 |
307 int _marker_breakpoint; | 321 int _marker_breakpoint; |
308 | 322 |