MGR: Save and restore height and width of Properties dialog; fix comments

svn path=/trunk/boinc/; revision=20738
This commit is contained in:
Charlie Fenton 2010-02-26 09:18:53 +00:00
parent a11e452c31
commit 804be2ad2a
4 changed files with 49 additions and 2 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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: