lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Saving and restoring window geometry (was: 'wine' anomalies)


From: Vadim Zeitlin
Subject: Re: [lmi] Saving and restoring window geometry (was: 'wine' anomalies)
Date: Sun, 11 Mar 2018 22:14:41 +0100

On Sun, 11 Mar 2018 17:08:42 +0000 Greg Chicares <address@hidden> wrote:

GC> I've never had more than one monitor,

 As an aside, I just don't imagine living without at least 2 monitors (3 is
slightly better, more doesn't really help in my limited experience).
Especially if you like maximizing windows (as I do), you should really
appreciate the convenient of having another monitor or two.

GC> But remembering the geometry would be nice even on a single monitor.

 Definitely.

GC> If I start lmi and unmaximize it, then resize it and exit, the new size
GC> isn't remembered when I start lmi again. I assume that's what you're
GC> talking about here, and I guess you'd like to be able to remember the
GC> resized dimensions of other windows like the tabbed input dialog as
GC> well.

 Yes, exactly.

GC> Me, I always maximize every application, so personally I have no
GC> compelling need for this, but it would be nice to have. Is there
GC> some facility built into wx that would make this easy?

 Yes, wxPersistentXXX<> classes, see

        http://docs.wxwidgets.org/trunk/overview_persistence.html

 E.g. to save (and restore) the main frame geometry it would be enough to
apply this patch:
---------------------------------- >8 --------------------------------------
diff --git a/skeleton.cpp b/skeleton.cpp
index dc3ca460d..ba1a20d97 100644
--- a/skeleton.cpp
+++ b/skeleton.cpp
@@ -98,6 +98,7 @@
 #include <wx/textdlg.h>                 // wxGetTextFromUser()
 #include <wx/toolbar.h>
 #include <wx/utils.h>                   // wxMilliSleep(), wxSafeYield()
+#include <wx/persist/toplevel.h>
 #include <wx/xrc/xmlres.h>
 
 #include <iterator>                     // insert_iterator
@@ -745,8 +746,12 @@ bool Skeleton::OnInit()
 
         frame_->Bind(wxEVT_MENU_OPEN, &Skeleton::UponMenuOpen, this);
         frame_->DragAcceptFiles(true);
-        frame_->Centre(wxBOTH);
-        frame_->Maximize(true);
+
+        if(!wxPersistentRegisterAndRestore(frame_, "lmi_main"))
+            {
+            frame_->Centre(wxBOTH);
+            frame_->Maximize(true);
+            }
 
         if
             (  custom_io_0_run_if_file_exists(doc_manager_)
---------------------------------- >8 --------------------------------------
 
or, in the PR form, https://github.com/vadz/lmi/pull/75

 Of course, we could (and probably should) persist other settings too, but
IMHO applying this would already be quite useful.

 Please let me know if you have any questions about the proposed change,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]