[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master fb91253 12/13: Revert "Store the last selecte
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master fb91253 12/13: Revert "Store the last selected page of MvcController persistently" |
Date: |
Tue, 8 May 2018 19:51:07 -0400 (EDT) |
branch: master
commit fb912535b69d4d28ca1745f9372f0c611bca6c41
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Revert "Store the last selected page of MvcController persistently"
This reverts commit e4f1a40cf81bcb9ca65777cb193e198582229cf3. It was
worth experimenting with the "persistent" behavior, but the original
behavior is preferred.
---
mvc_controller.cpp | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/mvc_controller.cpp b/mvc_controller.cpp
index 6914184..04a7b68 100644
--- a/mvc_controller.cpp
+++ b/mvc_controller.cpp
@@ -44,7 +44,6 @@
#include <wx/checkbox.h>
#include <wx/ctrlsub.h>
#include <wx/datectrl.h>
-#include <wx/persist/bookctrl.h>
#include <wx/radiobox.h>
#include <wx/spinctrl.h>
#include <wx/textctrl.h>
@@ -57,6 +56,11 @@
namespace
{
+/// Open new bookcontrol to page selected in most recent instance.
+///
+/// A page selection is maintained for each bookcontrol resource.
+
+std::map<std::string,std::size_t> last_selected_page;
/// Custom event to trigger a call to SetFocus(). This action requires
/// a custom event because wxFocusEvent does not change focus--it only
@@ -111,16 +115,7 @@ MvcController::MvcController
// https://lists.nongnu.org/archive/html/lmi/2018-03/msg00041.html
SetIcons(TopWindow().GetIcons());
- // Use resource file name as the unique identifier of the particular
- // controller, as different controllers use different book controls with
- // different number of pages, and so shouldn't reuse the last saved page of
- // each other.
- //
- // For cosmetic purposes, remove the ".xrc" suffix of the resource file
- // name as it doesn't really make much sense in the config file/registry
- // context.
- wxString const name{view_.ResourceFileName()};
- wxPersistentRegisterAndRestore(&BookControl(), name.BeforeLast('.'));
+
BookControl().ChangeSelection(last_selected_page[view_.ResourceFileName()]);
// This assignment must follow the call to LoadDialog().
// Initialization to 'parent' in the ctor-initializer-list
@@ -737,6 +732,10 @@ void MvcController::UponPageChanged(wxBookCtrlBaseEvent&
event)
{
event.Skip();
+ int const z = event.GetSelection();
+ LMI_ASSERT(wxNOT_FOUND != z);
+ last_selected_page[view_.ResourceFileName()] = z;
+
ConditionallyEnable();
}
- [lmi-commits] [lmi] master 86ed6fe 01/13: Correct a comment, (continued)
- [lmi-commits] [lmi] master 86ed6fe 01/13: Correct a comment, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master fad1828 03/13: Explicitly assert some implicit assumptions, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master b0c3633 05/13: Improve documentation, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master d5096d9 11/13: Paste out to spreadsheet: show dates as YYYYMMDD, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master d92a865 09/13: Grow only multiline "Comments" control, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master a5d5799 10/13: Widen all date-picker controls, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master 274f13e 04/13: Assert that the clipping width is nonnegative, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master 6ac7331 07/13: Use a dummy name for a dummy variable, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master 0c90de6 13/13: Designate release candidate 20180508T2349Z, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master 7320efb 08/13: Adjust layout of certain controls, Greg Chicares, 2018/05/08
- [lmi-commits] [lmi] master fb91253 12/13: Revert "Store the last selected page of MvcController persistently",
Greg Chicares <=