changeset 32927:4b99c92fc2b2

prevent showing hidden editor on startup when restoring session (bug #62562) * file-editor-interface.h (restore_session): added boolean argument * file-editor.cc (file_editor): init m_closed with true; (restore_session): add boolean argument visible and do nothing if visible is false; (handle_visibility) call restore_session with desired visibility * file-editor.h (restore_session): added boolean argument * main-window.cc (handle_octave_ready): call restore_session with desired visibility
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 04 Feb 2024 13:14:48 +0100
parents 39b341c858a7
children de39818dca5e
files libgui/src/m-editor/file-editor-interface.h libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h libgui/src/main-window.cc
diffstat 4 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-interface.h	Sat Feb 03 18:35:17 2024 -0800
+++ b/libgui/src/m-editor/file-editor-interface.h	Sun Feb 04 13:14:48 2024 +0100
@@ -71,7 +71,7 @@
 
   virtual void empty_script (bool, bool) = 0;
 
-  virtual void restore_session () = 0;
+  virtual void restore_session (bool) = 0;
 
   virtual void enable_menu_shortcuts (bool enable) = 0;
 
--- a/libgui/src/m-editor/file-editor.cc	Sat Feb 03 18:35:17 2024 -0800
+++ b/libgui/src/m-editor/file-editor.cc	Sun Feb 04 13:14:48 2024 +0100
@@ -114,7 +114,7 @@
 
   m_find_dialog = nullptr;
 
-  m_closed = false;
+  m_closed = true;
   m_no_focus = false;
   m_editor_ready = false;
 
@@ -324,8 +324,12 @@
 }
 
 void
-file_editor::restore_session ()
+file_editor::restore_session (bool visible)
 {
+
+  if (! visible)
+    return;
+
   gui_settings settings;
 
   //restore previous session
@@ -1580,7 +1584,7 @@
     {
       m_closed = false;
 
-      restore_session ();
+      restore_session (visible);
     }
 
   empty_script (false, visible);
--- a/libgui/src/m-editor/file-editor.h	Sat Feb 03 18:35:17 2024 -0800
+++ b/libgui/src/m-editor/file-editor.h	Sun Feb 04 13:14:48 2024 +0100
@@ -124,7 +124,7 @@
 
   void check_actions ();
   void empty_script (bool startup, bool visible);
-  void restore_session ();
+  void restore_session (bool visible = true);
 
 signals:
 
--- a/libgui/src/main-window.cc	Sat Feb 03 18:35:17 2024 -0800
+++ b/libgui/src/main-window.cc	Sun Feb 04 13:14:48 2024 +0100
@@ -1836,7 +1836,10 @@
       // This can not be done when the editor is created because all functions
       // must be known for the lexer's auto completion information
       m_editor_window->empty_script (true, false);
-      m_editor_window->restore_session ();
+      bool ed_visible =
+        settings.value (dw_is_visible.settings_key ().arg (m_editor_window->objectName ()),
+                        dw_is_visible.def ()).toBool ();
+      m_editor_window->restore_session (ed_visible);
 #endif
     }