changeset 19460:f90bb1e30de2 gui-release

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
author Torsten <ttl@justmail.de>
date Wed, 24 Dec 2014 15:07:31 +0100
parents 5e93d228ff6b
children 3c038da18218
files libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/octave-qscintilla.cc libgui/src/m-editor/octave-qscintilla.h libgui/src/main-window.cc
diffstat 5 files changed, 10 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- 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 ()
 {
--- 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&);
 
--- 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 ());
--- 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;
--- 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 <octave_dock_widget *> (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;
     }
 }