From d71757f322746223ba535a9b04239541c81e3da3 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 29 Oct 2017 19:56:10 +0000 Subject: [PATCH] frmMain: Fix issue where window is reset when LoadPreferences is called --- source/frmMain.cpp | 20 ++++++++++---------- source/frmMain.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/frmMain.cpp b/source/frmMain.cpp index e9ce304..bcbad5c 100644 --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@ -428,7 +428,7 @@ void frmMain::QuitApp() if (SaveWindowPos == TRUE){ - wxRect frmMainPos = this->GetRect(); + wxRect frmMainPos = GetRect(); cfgfile->Write(wxT("WindowPositionX"), frmMainPos.GetX()); cfgfile->Write(wxT("WindowPositionY"), frmMainPos.GetY()); @@ -440,7 +440,7 @@ void frmMain::QuitApp() delete cfgfile; cfgfile = NULL; - //Everything closed... exit. + // Everything closed... exit. std::exit(0); @@ -497,7 +497,7 @@ void frmMain::OpenPreferences( wxCommandEvent& event) // Reload the accounts as a change has been made within // the application and clear the current contact information. - this->LoadPreferences(); + this->LoadPreferences(true); this->ResetContactInfo(); } @@ -522,7 +522,7 @@ void frmMain::OpenNewABDialog( wxCommandEvent& event) // Reload the accounts as a change has been made within // the application. - this->LoadPreferences(); + this->LoadPreferences(true); } @@ -1426,11 +1426,11 @@ void frmMain::LoadPreferences( wxActivateEvent& event) // Load the preferences. - this->LoadPreferences(); + this->LoadPreferences(true); } -void frmMain::LoadPreferences(){ +void frmMain::LoadPreferences(bool skipWindowSizeReload){ // Load the preferences. @@ -1444,7 +1444,7 @@ void frmMain::LoadPreferences(){ bool HideLocalABs = preferences.GetBoolData(wxT("HideLocalAddressBooks")); bool UseBackgroundContactColour = preferences.GetBoolData(wxT("UseBackgroundContactColour")); - if (SaveWindowPos == true){ + if (SaveWindowPos == true && skipWindowSizeReload == false){ this->SetSize(preferences.GetMainWindowData()); @@ -1830,7 +1830,7 @@ void frmMain::SetupForm(){ ciicon_png.LoadFile(ciextstream, wxBITMAP_TYPE_PNG); wxMemoryFSHandler::AddFile(wxT("ciext.png"), ciicon_png, wxBITMAP_TYPE_PNG); - LoadPreferences(); + LoadPreferences(false); } @@ -1955,8 +1955,8 @@ void frmMain::RevealContact(wxCommandEvent& event){ if (uc->ContactAccount == AccountAccDirList[i]){ - treAccounts->SelectItem(nextChild, TRUE); - AccCtrl->SetText(treAccounts->GetItemText(nextChild)); + treAccounts->SelectItem(nextChild, TRUE); + AccCtrl->SetText(treAccounts->GetItemText(nextChild)); } diff --git a/source/frmMain.h b/source/frmMain.h index 59b4c54..657cfc9 100644 --- a/source/frmMain.h +++ b/source/frmMain.h @@ -206,7 +206,7 @@ class frmMain : public frmMainADT void OpenPreferences( wxCommandEvent& event ); void OpenNewABDialog( wxCommandEvent& event ); void LoadPreferences( wxActivateEvent& event ); - void LoadPreferences(); + void LoadPreferences(bool skipWindowSizeReload); void ShowContactInfo( wxListEvent& event ); void OpenContactInfoList( wxListEvent& event ); void OpenContactInfoList( wxCommandEvent& event ); -- 2.39.5