Mercurial > hg > octave-lojdl
changeset 14795:e3ae0850b105 gui
Fixed integrating debug menu in the editor window.
* file-editor-interface.h: Removed methods for enabling/disabling debug mode.
* file-editor-tab.cc: Renamed variable to meet coding style standards.
* file-editor: Added get for the editors debug menu.
* main-window: Added the same actions in the main windows as well the editors debug menu.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Thu, 21 Jun 2012 21:29:01 +0200 |
parents | 85daba52b2d4 |
children | e10d7bcfdd9e |
files | gui/src/m-editor/file-editor-interface.h gui/src/m-editor/file-editor-tab.cc gui/src/m-editor/file-editor.cc gui/src/m-editor/file-editor.h gui/src/main-window.cc gui/src/main-window.h |
diffstat | 6 files changed, 66 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/src/m-editor/file-editor-interface.h +++ b/gui/src/m-editor/file-editor-interface.h @@ -19,6 +19,7 @@ #define FILEEDITORINTERFACE_H #include <QDockWidget> +#include <QMenu> class QTerminal; class main_window; @@ -39,14 +40,14 @@ } virtual ~file_editor_interface () { } + + virtual QMenu *debug_menu () = 0; + public slots: virtual void request_new_file () = 0; virtual void request_open_file () = 0; virtual void request_open_file (QString fileName) = 0; - virtual void handle_entered_debug_mode () = 0; - virtual void handle_quit_debug_mode () = 0; - signals: void active_changed (bool active);
--- a/gui/src/m-editor/file-editor-tab.cc +++ b/gui/src/m-editor/file-editor-tab.cc @@ -98,7 +98,7 @@ void file_editor_tab::closeEvent (QCloseEvent *event) { - if (_file_editor->mainWindow ()->is_closing ()) + if (_file_editor->get_main_window ()->is_closing ()) { // close whole application: save file or not if modified check_file_modified ("Closing Octave", 0); // no cancel possible
--- a/gui/src/m-editor/file-editor.cc +++ b/gui/src/m-editor/file-editor.cc @@ -25,13 +25,13 @@ #include <QStyle> #include <QTextStream> -file_editor::file_editor (QTerminal *terminal, main_window *mainWindow) - : file_editor_interface(terminal, mainWindow) +file_editor::file_editor (QTerminal *terminal, main_window *m) + : file_editor_interface(terminal, m) { construct (); _terminal = terminal; - _main_window = mainWindow; + _main_window = m; setVisible (false); } @@ -52,11 +52,17 @@ } main_window * -file_editor::mainWindow () +file_editor::get_main_window () { return _main_window; } +QMenu * +file_editor::debug_menu () +{ + return _debug_menu; +} + void file_editor::request_new_file () { @@ -100,18 +106,6 @@ } void -file_editor::handle_entered_debug_mode () -{ - -} - -void -file_editor::handle_quit_debug_mode () -{ - -} - -void file_editor::request_undo () { file_editor_tab *activeFileEditorTab = active_editor_tab (); @@ -353,7 +347,7 @@ _cut_action->setShortcutContext (Qt::WindowShortcut); paste_action->setShortcut (QKeySequence::Paste); paste_action->setShortcutContext (Qt::WindowShortcut); - run_action->setShortcut (Qt::SHIFT + Qt::Key_F5); + run_action->setShortcut (Qt::SHIFT + Qt::Key_R); run_action->setShortcutContext (Qt::WindowShortcut); next_bookmark_action->setShortcut (Qt::Key_F2); next_bookmark_action->setShortcutContext (Qt::WindowShortcut); @@ -407,17 +401,6 @@ _menu_bar->addMenu (editMenu); _debug_menu = new QMenu (tr ("&Debug"), _menu_bar); - QAction * debug_continue = _debug_menu->addAction (tr ("Continue")); - debug_continue->setShortcut (Qt::Key_F5); - QAction * debug_step_into = _debug_menu->addAction (tr ("Step into")); - debug_step_into->setShortcut (Qt::Key_F9); - QAction * debug_step_over = _debug_menu->addAction (tr ("Next")); - debug_step_over->setShortcut (Qt::Key_F10); - QAction * debug_step_out = _debug_menu->addAction (tr ("Step out")); - debug_step_out->setShortcut (Qt::Key_F11); - _debug_menu->addSeparator (); - QAction * debug_quit = _debug_menu->addAction (tr ("Quit")); - debug_quit->setShortcut (Qt::Key_Escape); _menu_bar->addMenu (_debug_menu); QMenu *runMenu = new QMenu (tr ("&Run"), _menu_bar);
--- a/gui/src/m-editor/file-editor.h +++ b/gui/src/m-editor/file-editor.h @@ -46,22 +46,21 @@ Q_OBJECT public: - file_editor (QTerminal *terminal, main_window *mainWindow); + file_editor (QTerminal *terminal, main_window *m); ~file_editor (); void loadFile (QString fileName); lexer_octave_gui *lexer (); QTerminal * terminal (); - main_window * mainWindow (); + main_window * get_main_window (); + + QMenu * debug_menu(); public slots: void request_new_file (); void request_open_file (); void request_open_file (QString fileName); - void handle_entered_debug_mode (); - void handle_quit_debug_mode (); - void request_undo (); void request_redo (); void request_copy ();
--- a/gui/src/main-window.cc +++ b/gui/src/main-window.cc @@ -207,16 +207,22 @@ main_window::handle_entered_debug_mode () { setWindowTitle ("Octave (Debugging)"); - _file_editor->handle_entered_debug_mode (); - _debug_menu->setEnabled (true); + _debug_continue->setEnabled (true); + _debug_step_into->setEnabled (true); + _debug_step_over->setEnabled (true); + _debug_step_out->setEnabled (true); + _debug_quit->setEnabled (true); } void main_window::handle_quit_debug_mode () { setWindowTitle ("Octave"); - _file_editor->handle_quit_debug_mode (); - _debug_menu->setEnabled (false); + _debug_continue->setEnabled (false); + _debug_step_into->setEnabled (false); + _debug_step_over->setEnabled (false); + _debug_step_out->setEnabled (false); + _debug_quit->setEnabled (false); } void @@ -398,19 +404,33 @@ redo_action->setShortcut (QKeySequence::Redo); _debug_menu = menuBar ()->addMenu (tr ("De&bug")); - QAction * debug_continue = _debug_menu->addAction (tr ("Continue")); - debug_continue->setShortcut (Qt::Key_F5); - QAction * debug_step_into = _debug_menu->addAction (tr ("Step into")); - debug_step_into->setShortcut (Qt::Key_F9); - QAction * debug_step_over = _debug_menu->addAction (tr ("Next")); - debug_step_over->setShortcut (Qt::Key_F10); - QAction * debug_step_out = _debug_menu->addAction (tr ("Step out")); - debug_step_out->setShortcut (Qt::Key_F11); + + _debug_continue = _debug_menu->addAction (tr ("Continue")); + _debug_continue->setEnabled (false); + _file_editor->debug_menu ()->addAction (_debug_continue); + _debug_continue->setShortcut (Qt::Key_F5); + + _debug_step_into = _debug_menu->addAction (tr ("Step into")); + _debug_step_into->setEnabled (false); + _file_editor->debug_menu ()->addAction (_debug_step_into); + _debug_step_into->setShortcut (Qt::Key_F9); + + _debug_step_over = _debug_menu->addAction (tr ("Next")); + _debug_step_over->setEnabled (false); + _file_editor->debug_menu ()->addAction (_debug_step_over); + _debug_step_over->setShortcut (Qt::Key_F10); + + _debug_step_out = _debug_menu->addAction (tr ("Step out")); + _debug_step_out->setEnabled (false); + _file_editor->debug_menu ()->addAction (_debug_step_over); + _debug_step_out->setShortcut (Qt::Key_F11); + _debug_menu->addSeparator (); - QAction * debug_quit = _debug_menu->addAction (tr ("Quit")); - debug_quit->setShortcut (Qt::Key_Escape); - _debug_menu->setEnabled (false); + _debug_quit = _debug_menu->addAction (tr ("Quit")); + _debug_quit->setEnabled (false); + _file_editor->debug_menu ()->addAction (_debug_quit); + _debug_quit->setShortcut (Qt::Key_Escape); //QMenu *parallelMenu = menuBar ()->addMenu (tr ("&Parallel")); @@ -524,15 +544,15 @@ _terminal, SLOT (pasteClipboard ())); connect (_current_directory_combo_box, SIGNAL (activated (QString)), this, SLOT (change_current_working_directory (QString))); - connect (debug_continue, SIGNAL (triggered ()), + connect (_debug_continue, SIGNAL (triggered ()), this, SLOT (debug_continue ())); - connect (debug_step_into, SIGNAL (triggered ()), + connect (_debug_step_into, SIGNAL (triggered ()), this, SLOT (debug_step_into ())); - connect (debug_step_over, SIGNAL (triggered ()), + connect (_debug_step_over, SIGNAL (triggered ()), this, SLOT (debug_step_over ())); - connect (debug_step_out, SIGNAL (triggered ()), + connect (_debug_step_out, SIGNAL (triggered ()), this, SLOT (debug_step_out ())); - connect (debug_quit, SIGNAL (triggered ()), + connect (_debug_quit, SIGNAL (triggered ()), this, SLOT (debug_quit ())); setWindowTitle ("Octave");
--- a/gui/src/main-window.h +++ b/gui/src/main-window.h @@ -116,6 +116,12 @@ QMenu * _debug_menu; QTimer _update_performance_information_timer; + QAction * _debug_continue; + QAction * _debug_step_into; + QAction * _debug_step_over; + QAction * _debug_step_out; + QAction * _debug_quit; + // Dock widgets. workspace_view * _workspace_view; history_dock_widget * _history_dock_widget;