comparison libgui/src/main-window.cc @ 18665: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 7cb98e81ecd1
children c199304dfb2a 6113e0c6920b
comparison
equal deleted inserted replaced
18661:8b9e99c061f9 18665:777281eeb3d4
1217 this, SLOT (handle_load_workspace_request (const QString&))); 1217 this, SLOT (handle_load_workspace_request (const QString&)));
1218 1218
1219 connect (file_browser_window, SIGNAL (find_files_signal (const QString&)), 1219 connect (file_browser_window, SIGNAL (find_files_signal (const QString&)),
1220 this, SLOT (find_files (const QString&))); 1220 this, SLOT (find_files (const QString&)));
1221 1221
1222 connect (this, SIGNAL (set_widget_shortcuts_signal (bool)),
1223 editor_window, SLOT (set_shortcuts (bool)));
1224
1225 connect_uiwidget_links (); 1222 connect_uiwidget_links ();
1226 1223
1227 setWindowTitle ("Octave"); 1224 setWindowTitle ("Octave");
1228 1225
1229 setDockOptions (QMainWindow::AnimatedDocks 1226 setDockOptions (QMainWindow::AnimatedDocks
1438 _open_action 1435 _open_action
1439 = file_menu->addAction (QIcon (":/actions/icons/folder_documents.png"), 1436 = file_menu->addAction (QIcon (":/actions/icons/folder_documents.png"),
1440 tr ("Open...")); 1437 tr ("Open..."));
1441 _open_action->setShortcutContext (Qt::ApplicationShortcut); 1438 _open_action->setShortcutContext (Qt::ApplicationShortcut);
1442 1439
1440 editor_window->insert_new_open_actions (_new_script_action,
1441 _new_function_action,
1442 _open_action);
1443 1443
1444 #ifdef HAVE_QSCINTILLA 1444 #ifdef HAVE_QSCINTILLA
1445 file_menu->addMenu (editor_window->get_mru_menu ()); 1445 file_menu->addMenu (editor_window->get_mru_menu ());
1446 #endif 1446 #endif
1447 1447
2331 _clear_command_window_action->setShortcut (no_key); 2331 _clear_command_window_action->setShortcut (no_key);
2332 _clear_workspace_action->setShortcut (no_key); 2332 _clear_workspace_action->setShortcut (no_key);
2333 2333
2334 } 2334 }
2335 2335
2336 emit set_widget_shortcuts_signal (set_shortcuts);
2337 } 2336 }
2338 2337
2339 void 2338 void
2340 main_window::handle_show_doc (const QString& file) 2339 main_window::handle_show_doc (const QString& file)
2341 { 2340 {