comparison libgui/src/m-editor/file-editor.cc @ 19624:3c038da18218 gui-release

cleanup of focus function in gui editor * file-editor-interface.h: remove function set_focus * file-editor.cc (focus): call common function and extra code for the editor; (set_focus): removed, all code now in focus (); (request_new_file, request_open_file): replaced set_focus by focus * file-editor.h: removed set_focus
author Torsten <ttl@justmail.de>
date Thu, 25 Dec 2014 08:31:31 +0100
parents ed0df431631b
children be7ac98fab43
comparison
equal deleted inserted replaced
19623:f90bb1e30de2 19624:3c038da18218
114 114
115 115
116 void 116 void
117 file_editor::focus (void) 117 file_editor::focus (void)
118 { 118 {
119 set_focus (); 119 octave_dock_widget::focus ();
120 } 120
121 121 // set focus to current tab
122 // set focus to editor and its current tab
123 void
124 file_editor::set_focus (void)
125 {
126 if (!isVisible ())
127 setVisible (true);
128 setFocus ();
129 activateWindow ();
130 raise ();
131 QWidget *fileEditorTab = _tab_widget->currentWidget (); 122 QWidget *fileEditorTab = _tab_widget->currentWidget ();
132 if (fileEditorTab) 123 if (fileEditorTab)
133 emit fetab_set_focus (fileEditorTab); 124 emit fetab_set_focus (fileEditorTab);
134 } 125 }
135 126
172 file_editor_tab *fileEditorTab = new file_editor_tab (ced); 163 file_editor_tab *fileEditorTab = new file_editor_tab (ced);
173 if (fileEditorTab) 164 if (fileEditorTab)
174 { 165 {
175 add_file_editor_tab (fileEditorTab, ""); // new tab with empty title 166 add_file_editor_tab (fileEditorTab, ""); // new tab with empty title
176 fileEditorTab->new_file (commands); // title is updated here 167 fileEditorTab->new_file (commands); // title is updated here
177 set_focus (); // focus editor and new tab 168 focus (); // focus editor and new tab
178 } 169 }
179 } 170 }
180 171
181 void 172 void
182 file_editor::request_new_script (const QString& commands) 173 file_editor::request_new_script (const QString& commands)
370 } 361 }
371 362
372 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) 363 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
373 { 364 {
374 emit fetab_set_focus (tab); 365 emit fetab_set_focus (tab);
375 set_focus (); 366 focus ();
376 } 367 }
377 } 368 }
378 else 369 else
379 { 370 {
380 file_editor_tab *fileEditorTab = new file_editor_tab (); 371 file_editor_tab *fileEditorTab = new file_editor_tab ();
477 } 468 }
478 469
479 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) 470 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
480 { 471 {
481 // really show editor and the current editor tab 472 // really show editor and the current editor tab
482 set_focus (); 473 focus ();
483 emit file_loaded_signal (); 474 emit file_loaded_signal ();
484 } 475 }
485 } 476 }
486 } 477 }
487 } 478 }