# HG changeset patch # User Torsten # Date 1419430051 -3600 # Node ID f90bb1e30de2f663a8a27565af9db29ba7d8598c # Parent 5e93d228ff6b3e3a9e636f2e56dbb7588195d1cd switching between edit and main shortcuts depending on active dock widget now * file-editor-tab.cc (ctor): do not connect removed signal from edit area; (edit_area_has_focus): removed this related slot * file-editor-tab.h: remove slot * octave-qscintilla.cc (focusInEvent, focusOutEvent): removed event handlers * octave-qscintilla.h (focusInEvent, focusOutEvent): removed event handlers * main-window.cc (focus_changed): call set_global_edit_shortcuts depending on new active dock diff -r 5e93d228ff6b -r f90bb1e30de2 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Wed Dec 24 13:58:00 2014 +0100 +++ b/libgui/src/m-editor/file-editor-tab.cc Wed Dec 24 15:07:31 2014 +0100 @@ -169,9 +169,6 @@ connect (_edit_area, SIGNAL (copyAvailable (bool)), this, SLOT (handle_copy_available (bool))); - connect (_edit_area, SIGNAL (qsci_has_focus_signal (bool)), - this, SLOT (edit_area_has_focus (bool))); - connect (&_file_system_watcher, SIGNAL (fileChanged (const QString&)), this, SLOT (file_has_changed (const QString&))); @@ -2088,12 +2085,6 @@ emit create_context_menu_tab_signal (menu); } -void -file_editor_tab::edit_area_has_focus (bool focus) -{ - emit set_global_edit_shortcuts_signal (! focus); -} - QString file_editor_tab::get_function_name () { diff -r 5e93d228ff6b -r f90bb1e30de2 libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h Wed Dec 24 13:58:00 2014 +0100 +++ b/libgui/src/m-editor/file-editor-tab.h Wed Dec 24 15:07:31 2014 +0100 @@ -121,7 +121,6 @@ void file_has_changed (const QString& fileName); void execute_command_in_terminal (const QString& command); - void edit_area_has_focus (bool foucs); void create_context_menu (QMenu *); void handle_context_menu_edit (const QString&); diff -r 5e93d228ff6b -r f90bb1e30de2 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Wed Dec 24 13:58:00 2014 +0100 +++ b/libgui/src/m-editor/octave-qscintilla.cc Wed Dec 24 15:07:31 2014 +0100 @@ -279,20 +279,6 @@ } void -octave_qscintilla::focusInEvent (QFocusEvent *focusEvent) -{ - emit qsci_has_focus_signal (true); - QsciScintilla::focusInEvent(focusEvent); -} - -void -octave_qscintilla::focusOutEvent (QFocusEvent *focusEvent) -{ - emit qsci_has_focus_signal (false); - QsciScintilla::focusOutEvent(focusEvent); -} - -void octave_qscintilla::text_changed () { emit status_update (isUndoAvailable (), isRedoAvailable ()); diff -r 5e93d228ff6b -r f90bb1e30de2 libgui/src/m-editor/octave-qscintilla.h --- a/libgui/src/m-editor/octave-qscintilla.h Wed Dec 24 13:58:00 2014 +0100 +++ b/libgui/src/m-editor/octave-qscintilla.h Wed Dec 24 15:07:31 2014 +0100 @@ -67,9 +67,6 @@ protected: - void focusInEvent (QFocusEvent *focusEvent); - void focusOutEvent (QFocusEvent *focusEvent); - private: QString _word_at_cursor; diff -r 5e93d228ff6b -r f90bb1e30de2 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Wed Dec 24 13:58:00 2014 +0100 +++ b/libgui/src/main-window.cc Wed Dec 24 15:07:31 2014 +0100 @@ -184,7 +184,17 @@ // if new dock has focus, emit signal and store active focus if (dock != _active_dock) { + // signal to all dock widgets for updating the style emit active_dock_changed (_active_dock, dock); + + // if editor gets/loses focus, shortcuts and menus have to be updated + octave_dock_widget *edit_dock_widget = + static_cast (editor_window); + if (edit_dock_widget == dock) + set_global_edit_shortcuts (false); + else if (edit_dock_widget == _active_dock) + set_global_edit_shortcuts (true); + _active_dock = dock; } }