From 804be2ad2a18c539b925d0229dac207fa0e2faf4 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Fri, 26 Feb 2010 09:18:53 +0000 Subject: [PATCH] MGR: Save and restore height and width of Properties dialog; fix comments svn path=/trunk/boinc/; revision=20738 --- checkin_notes | 9 +++++++++ clientgui/DlgAdvPreferences.cpp | 4 ++-- clientgui/DlgItemProperties.cpp | 36 +++++++++++++++++++++++++++++++++ clientgui/DlgItemProperties.h | 2 ++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index 45f9cda194..f13da830aa 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1386,3 +1386,12 @@ Rom 25 Feb 2010 client/ hostinfo_win.cpp + +Charlie 26 Feb 2010 + - MGR: Save and restore height and width of Properties dialog; fix comments. + + clientgui/ + DlgAdvPreferences.cpp + DlgItemProperties.cpp, .h + + \ No newline at end of file diff --git a/clientgui/DlgAdvPreferences.cpp b/clientgui/DlgAdvPreferences.cpp index 3290fdd059..c22cee873b 100644 --- a/clientgui/DlgAdvPreferences.cpp +++ b/clientgui/DlgAdvPreferences.cpp @@ -133,7 +133,7 @@ void CDlgAdvPreferences::SetSpecialTooltips() { m_txtNetSunday->SetToolTip(TXT_NET_TIME_TOOLTIP); } -/* saves selected tab page and dialog size*/ +/* saves selected tab page */ bool CDlgAdvPreferences::SaveState() { wxString strBaseConfigLocation = wxString(wxT("/DlgAdvPreferences/")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); @@ -146,7 +146,7 @@ bool CDlgAdvPreferences::SaveState() { return true; } -/* restores former selected tab page and dialog size*/ +/* restores former selected tab page */ bool CDlgAdvPreferences::RestoreState() { wxString strBaseConfigLocation = wxString(wxT("/DlgAdvPreferences/")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); diff --git a/clientgui/DlgItemProperties.cpp b/clientgui/DlgItemProperties.cpp index f7b87fa318..3054e5e0fe 100755 --- a/clientgui/DlgItemProperties.cpp +++ b/clientgui/DlgItemProperties.cpp @@ -64,10 +64,46 @@ CDlgItemProperties::CDlgItemProperties(wxWindow* parent) : Centre( wxBOTH ); m_current_row=0; + + RestoreState(); } // destructor CDlgItemProperties::~CDlgItemProperties() { + SaveState(); +} + +/* saves dialog size */ +bool CDlgItemProperties::SaveState() { + wxString strBaseConfigLocation = wxString(wxT("/DlgProperties/")); + wxConfigBase* pConfig = wxConfigBase::Get(FALSE); + + wxASSERT(pConfig); + if (!pConfig) return false; + + pConfig->SetPath(strBaseConfigLocation); + pConfig->Write(wxT("Width"),this->GetSize().GetWidth()); + pConfig->Write(wxT("Height"),this->GetSize().GetHeight()); + return true; +} + +/* restores former dialog size */ +bool CDlgItemProperties::RestoreState() { + wxString strBaseConfigLocation = wxString(wxT("/DlgProperties/")); + wxConfigBase* pConfig = wxConfigBase::Get(FALSE); + int w, h; + + wxASSERT(pConfig); + + if (!pConfig) return false; + + pConfig->SetPath(strBaseConfigLocation); + + pConfig->Read(wxT("Width"), &w,-1); + pConfig->Read(wxT("Height"), &h,-1); + SetSize(w,h); + + return true; } // show project properties diff --git a/clientgui/DlgItemProperties.h b/clientgui/DlgItemProperties.h index dfe8433367..b8ecb1b549 100755 --- a/clientgui/DlgItemProperties.h +++ b/clientgui/DlgItemProperties.h @@ -53,6 +53,8 @@ private: wxString FormatStatus(RESULT* result); wxString FormatTime(float fBuffer); //generic layout methods + bool SaveState(); + bool RestoreState(); void addSection(const wxString& title); void addProperty(const wxString& name, const wxString& value); protected: