Mercurial > hg > octave-shane
changeset 16576:2754c5fd6ae0
keep focus in the command window after dbstop, dbstep, etc.
* main-window.h, main-window.cc
(main_window::command_window_has_focus,
main_window::handle_insert_debugger_pointer_request,
main_window::handle_delete_debugger_pointer_request,
main_window::handle_update_breakpoint_marker_request): New functions.
(main_window::insert_debugger_pointer_signal
main_window::delete_debugger_pointer_signal,
main_window::update_breakpoint_marker_signal): New signals.
(main_window::construct): Connect
main_window::insert_debugger_pointer_signal to
editor_window::handle_insert_debugger_pointer_request.
Connect main_window::delete_debugger_pointer_signal to
editor_window::handle_delete_debugger_pointer_request.
Connect main_window::update_breakpoint_marker_signal to
editor_window::handle_update_breakpoint_marker_request.
(main_window::construct_octave_qt_link): Connect
_octave_qt_link::insert_debugger_pointer_signal to
main_window::handle_insert_debugger_pointer_request instead of
editor_window::handle_insert_debugger_pointer_request.
Connect _octave_qt_link::delete_debugger_pointer_signal to
main_window::handle_delete_debugger_pointer_request instead of
editor_window::handle_delete_debugger_pointer_request.
Connect _octave_qt_link::update_breakpoint_marker_signal to
main_window::handle_update_breakpoint_marker_request instead of
editor_window::handle_update_breakpoint_marker_request.
* terminal-dock-widget.h, terminal-dock-widget.cc
(terminal_dock_widget::has_focus): New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 28 Apr 2013 01:21:16 -0400 |
parents | 1a1f8199b5bb |
children | 02a90cb9d79f |
files | libgui/src/main-window.cc libgui/src/main-window.h libgui/src/terminal-dock-widget.cc libgui/src/terminal-dock-widget.h |
diffstat | 4 files changed, 87 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/main-window.cc +++ b/libgui/src/main-window.cc @@ -104,6 +104,12 @@ delete _octave_qt_link; } +bool +main_window::command_window_has_focus (void) const +{ + return command_window->has_focus (); +} + void main_window::focus_command_window (void) { @@ -457,6 +463,43 @@ } void +main_window::handle_insert_debugger_pointer_request (const QString& file, + int line) +{ + bool cmd_focus = command_window_has_focus (); + + emit insert_debugger_pointer_signal (file, line); + + if (cmd_focus) + focus_command_window (); +} + +void +main_window::handle_delete_debugger_pointer_request (const QString& file, + int line) +{ + bool cmd_focus = command_window_has_focus (); + + emit delete_debugger_pointer_signal (file, line); + + if (cmd_focus) + focus_command_window (); +} + +void +main_window::handle_update_breakpoint_marker_request (bool insert, + const QString& file, + int line) +{ + bool cmd_focus = command_window_has_focus (); + + emit update_breakpoint_marker_signal (insert, file, line); + + if (cmd_focus) + focus_command_window (); +} + +void main_window::show_about_octave (void) { QString message = OCTAVE_STARTUP_MESSAGE; @@ -733,6 +776,21 @@ construct_octave_qt_link (); + connect (this, + SIGNAL (insert_debugger_pointer_signal (const QString&, int)), + editor_window, + SLOT (handle_insert_debugger_pointer_request (const QString&, int))); + + connect (this, + SIGNAL (delete_debugger_pointer_signal (const QString&, int)), + editor_window, + SLOT (handle_delete_debugger_pointer_request (const QString&, int))); + + connect (this, + SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)), + editor_window, + SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int))); + QDir curr_dir; set_current_working_directory (curr_dir.absolutePath ()); @@ -789,25 +847,25 @@ this, SLOT (handle_exit_debugger ())); connect (_octave_qt_link, - SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)), - editor_window, - SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int))); - - connect (_octave_qt_link, SIGNAL (edit_file_signal (const QString&)), editor_window, SLOT (handle_edit_file_request (const QString&))); connect (_octave_qt_link, SIGNAL (insert_debugger_pointer_signal (const QString&, int)), - editor_window, + this, SLOT (handle_insert_debugger_pointer_request (const QString&, int))); connect (_octave_qt_link, SIGNAL (delete_debugger_pointer_signal (const QString&, int)), - editor_window, + this, SLOT (handle_delete_debugger_pointer_request (const QString&, int))); + connect (_octave_qt_link, + SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)), + this, + SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int))); + connect (_workspace_model, SIGNAL (rename_variable (const QString&, const QString&)), this,
--- a/libgui/src/main-window.h +++ b/libgui/src/main-window.h @@ -72,6 +72,8 @@ ~main_window (void); + bool command_window_has_focus (void) const; + void focus_command_window (void); signals: @@ -79,6 +81,11 @@ void new_file_signal (const QString&); void open_file_signal (const QString&); + void insert_debugger_pointer_signal (const QString& file, int line); + void delete_debugger_pointer_signal (const QString& file, int line); + void update_breakpoint_marker_signal (bool insert, const QString& file, + int line); + public slots: void report_status_message (const QString& statusMessage); void handle_save_workspace_request (void); @@ -122,6 +129,11 @@ void debug_step_out (void); void debug_quit (void); + void handle_insert_debugger_pointer_request (const QString& file, int line); + void handle_delete_debugger_pointer_request (const QString& file, int line); + void handle_update_breakpoint_marker_request (bool insert, + const QString& file, int line); + void read_settings (void); void write_settings (void); void connect_visibility_changed (void);
--- a/libgui/src/terminal-dock-widget.cc +++ b/libgui/src/terminal-dock-widget.cc @@ -56,6 +56,14 @@ terminal, SLOT (pasteClipboard (void))); } +bool +terminal_dock_widget::has_focus (void) const +{ + QWidget *w = widget (); + + return w->hasFocus (); +} + void terminal_dock_widget::notice_settings (const QSettings *settings) {