changeset 18545:17baa684892c stable

fix flashing while debuggung and editor is tabbed behind console (bug #41757) * file-editor.cc (is_editor_console_tabbed): new function returning true if editor is tabbed together with console; (request_open_file): do not give focus to editor if debug pointer or breakpoint marker is added and editor is tabbed with console * file-editor.h: new function is_editor_console_tabbed * main-window.h: new function get_dock_widget_list () returning the internal list of all dock widgets
author Torsten <ttl@justmail.de>
date Tue, 04 Mar 2014 21:58:27 +0100
parents e0cc67d5a462
children 8e384416ebb3
files libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h libgui/src/main-window.h
diffstat 3 files changed, 33 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Tue Mar 04 20:10:00 2014 +0000
+++ b/libgui/src/m-editor/file-editor.cc	Tue Mar 04 21:58:27 2014 +0100
@@ -41,6 +41,7 @@
 
 #include "octave-link.h"
 #include "utils.h"
+#include "main-window.h"
 
 file_editor::file_editor (QWidget *p)
   : file_editor_interface (p)
@@ -264,6 +265,23 @@
   return false;
 }
 
+bool
+file_editor::is_editor_console_tabbed ()
+{
+  main_window *w = static_cast<main_window *>(main_win ());
+  QList<QDockWidget *> w_list = w->tabifiedDockWidgets (this);
+  QDockWidget *console =
+    static_cast<QDockWidget *> (w->get_dock_widget_list ().at (0));
+
+  for (int i = 0; i < w_list.count (); i++)
+    {
+      if (w_list.at (i) == console)
+        return true;
+    }
+
+  return false;
+}
+
 void
 file_editor::request_open_file (const QString& openFileName, int line,
                                 bool debug_pointer,
@@ -302,8 +320,11 @@
                 emit fetab_do_breakpoint_marker (insert, tab, line);
             }
 
-          emit fetab_set_focus (tab);
-          set_focus ();
+          if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
+            {
+              emit fetab_set_focus (tab);
+              set_focus ();
+            }
         }
       else
         {
@@ -402,9 +423,12 @@
                 }
             }
 
-          // really show editor and the current editor tab
-          set_focus ();
-          emit file_loaded_signal ();
+          if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
+            {
+              // really show editor and the current editor tab
+              set_focus ();
+              emit file_loaded_signal ();
+            }
         }
     }
 }
--- a/libgui/src/m-editor/file-editor.h	Tue Mar 04 20:10:00 2014 +0000
+++ b/libgui/src/m-editor/file-editor.h	Tue Mar 04 21:58:27 2014 +0100
@@ -182,6 +182,7 @@
 
 private:
 
+  bool is_editor_console_tabbed ();
   void construct (void);
   void add_file_editor_tab (file_editor_tab *f, const QString& fn);
   void save_file_as (QWidget *fetabID = 0);
--- a/libgui/src/main-window.h	Tue Mar 04 20:10:00 2014 +0000
+++ b/libgui/src/main-window.h	Tue Mar 04 21:58:27 2014 +0100
@@ -196,6 +196,9 @@
   void clipboard_has_changed (QClipboard::Mode);
   void clear_clipboard ();
 
+  // get the dockwidgets
+  QList<octave_dock_widget *> get_dock_widget_list ()
+    { return dock_widget_list (); }
 
 protected:
   void closeEvent (QCloseEvent * closeEvent);