comparison libgui/src/m-editor/file-editor.cc @ 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 83cc56cc7cb7
children de76baa76aa1 bfb735b70978
comparison
equal deleted inserted replaced
18544:e0cc67d5a462 18545:17baa684892c
39 #include <QProcess> 39 #include <QProcess>
40 #include <QInputDialog> 40 #include <QInputDialog>
41 41
42 #include "octave-link.h" 42 #include "octave-link.h"
43 #include "utils.h" 43 #include "utils.h"
44 #include "main-window.h"
44 45
45 file_editor::file_editor (QWidget *p) 46 file_editor::file_editor (QWidget *p)
46 : file_editor_interface (p) 47 : file_editor_interface (p)
47 { 48 {
48 // Set current editing directory before construct because loaded 49 // Set current editing directory before construct because loaded
262 } 263 }
263 264
264 return false; 265 return false;
265 } 266 }
266 267
268 bool
269 file_editor::is_editor_console_tabbed ()
270 {
271 main_window *w = static_cast<main_window *>(main_win ());
272 QList<QDockWidget *> w_list = w->tabifiedDockWidgets (this);
273 QDockWidget *console =
274 static_cast<QDockWidget *> (w->get_dock_widget_list ().at (0));
275
276 for (int i = 0; i < w_list.count (); i++)
277 {
278 if (w_list.at (i) == console)
279 return true;
280 }
281
282 return false;
283 }
284
267 void 285 void
268 file_editor::request_open_file (const QString& openFileName, int line, 286 file_editor::request_open_file (const QString& openFileName, int line,
269 bool debug_pointer, 287 bool debug_pointer,
270 bool breakpoint_marker, bool insert) 288 bool breakpoint_marker, bool insert)
271 { 289 {
300 318
301 if (breakpoint_marker) 319 if (breakpoint_marker)
302 emit fetab_do_breakpoint_marker (insert, tab, line); 320 emit fetab_do_breakpoint_marker (insert, tab, line);
303 } 321 }
304 322
305 emit fetab_set_focus (tab); 323 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
306 set_focus (); 324 {
325 emit fetab_set_focus (tab);
326 set_focus ();
327 }
307 } 328 }
308 else 329 else
309 { 330 {
310 file_editor_tab *fileEditorTab = new file_editor_tab (); 331 file_editor_tab *fileEditorTab = new file_editor_tab ();
311 if (fileEditorTab) 332 if (fileEditorTab)
400 } 421 }
401 } 422 }
402 } 423 }
403 } 424 }
404 425
405 // really show editor and the current editor tab 426 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
406 set_focus (); 427 {
407 emit file_loaded_signal (); 428 // really show editor and the current editor tab
429 set_focus ();
430 emit file_loaded_signal ();
431 }
408 } 432 }
409 } 433 }
410 } 434 }
411 435
412 // open a file from the mru list 436 // open a file from the mru list