changeset 19461: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 f90bb1e30de2
children be53bf420464
files libgui/src/m-editor/file-editor-interface.h libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h
diffstat 3 files changed, 5 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-interface.h	Wed Dec 24 15:07:31 2014 +0100
+++ b/libgui/src/m-editor/file-editor-interface.h	Thu Dec 25 08:31:31 2014 +0100
@@ -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;
--- a/libgui/src/m-editor/file-editor.cc	Wed Dec 24 15:07:31 2014 +0100
+++ b/libgui/src/m-editor/file-editor.cc	Thu Dec 25 08:31:31 2014 +0100
@@ -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 ();
             }
         }
--- a/libgui/src/m-editor/file-editor.h	Wed Dec 24 15:07:31 2014 +0100
+++ b/libgui/src/m-editor/file-editor.h	Thu Dec 25 08:31:31 2014 +0100
@@ -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);