# HG changeset patch # User Torsten # Date 1419492691 -3600 # Node ID 3c038da18218b555740980460c2da0501949a42a # Parent f90bb1e30de2f663a8a27565af9db29ba7d8598c 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 diff --git a/libgui/src/m-editor/file-editor-interface.h b/libgui/src/m-editor/file-editor-interface.h --- a/libgui/src/m-editor/file-editor-interface.h +++ b/libgui/src/m-editor/file-editor-interface.h @@ -62,8 +62,6 @@ virtual bool check_closing (int closing_state) = 0; - virtual void set_focus () = 0; - virtual void empty_script (bool, bool) = 0; virtual void enable_menu_shortcuts (bool enable) = 0; diff --git a/libgui/src/m-editor/file-editor.cc b/libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -116,18 +116,9 @@ void file_editor::focus (void) { - set_focus (); -} + octave_dock_widget::focus (); -// set focus to editor and its current tab -void -file_editor::set_focus (void) -{ - if (!isVisible ()) - setVisible (true); - setFocus (); - activateWindow (); - raise (); +// set focus to current tab QWidget *fileEditorTab = _tab_widget->currentWidget (); if (fileEditorTab) emit fetab_set_focus (fileEditorTab); @@ -174,7 +165,7 @@ { add_file_editor_tab (fileEditorTab, ""); // new tab with empty title fileEditorTab->new_file (commands); // title is updated here - set_focus (); // focus editor and new tab + focus (); // focus editor and new tab } } @@ -372,7 +363,7 @@ if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) { emit fetab_set_focus (tab); - set_focus (); + focus (); } } else @@ -479,7 +470,7 @@ if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) { // really show editor and the current editor tab - set_focus (); + focus (); emit file_loaded_signal (); } } diff --git a/libgui/src/m-editor/file-editor.h b/libgui/src/m-editor/file-editor.h --- a/libgui/src/m-editor/file-editor.h +++ b/libgui/src/m-editor/file-editor.h @@ -58,7 +58,6 @@ QToolBar *toolbar (void); void insert_new_open_actions (QAction*,QAction*,QAction*); - void set_focus (void); void handle_enter_debug_mode (void); void handle_exit_debug_mode (void);