From facf56c1bbadd9c405935496176d3bd546a4940d Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 19 Jun 2009 18:03:10 +0000 Subject: [PATCH] - MGR: Fix a long standing bug where the project list control for the account manager info page and the project info page was not consuming available screen space. Previously we hacked around it by setting an explicit size. Note: this works on Windows, I don't yet know about Mac and Linux. clientgui/ AccountManagerInfoPage.cpp, .h ProjectInfoPage.cpp ProjectListCtrl.cpp, .h svn path=/branches/boinc_core_release_6_8/; revision=18468 --- checkin_notes | 14 +++ clientgui/AccountManagerInfoPage.cpp | 159 +++++++++++++++------------ clientgui/AccountManagerInfoPage.h | 3 +- clientgui/ProjectInfoPage.cpp | 10 +- clientgui/ProjectListCtrl.cpp | 8 +- clientgui/ProjectListCtrl.h | 4 +- 6 files changed, 114 insertions(+), 84 deletions(-) diff --git a/checkin_notes b/checkin_notes index e4f1ecdecd..31fafc2d85 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5766,3 +5766,17 @@ Rom 19 June 2009 UnavailablePage.cpp WelcomePage.cpp, .h WizardAttachProject.cpp + +Rom 19 June 2009 + - MGR: Fix a long standing bug where the project list control + for the account manager info page and the project info page + was not consuming available screen space. Previously + we hacked around it by setting an explicit size. + + Note: this works on Windows, I don't yet know about Mac and + Linux. + + clientgui/ + AccountManagerInfoPage.cpp, .h + ProjectInfoPage.cpp + ProjectListCtrl.cpp, .h diff --git a/clientgui/AccountManagerInfoPage.cpp b/clientgui/AccountManagerInfoPage.cpp index dbaed9bb77..f336612ae8 100644 --- a/clientgui/AccountManagerInfoPage.cpp +++ b/clientgui/AccountManagerInfoPage.cpp @@ -25,6 +25,7 @@ #include "mfile.h" #include "miofile.h" #include "parse.h" +#include "str_util.h" #include "error_numbers.h" #include "wizardex.h" #include "error_numbers.h" @@ -60,6 +61,7 @@ BEGIN_EVENT_TABLE( CAccountManagerInfoPage, wxWizardPageEx ) END_EVENT_TABLE() + /*! * CAccountManagerInfoPage constructors */ @@ -73,8 +75,9 @@ CAccountManagerInfoPage::CAccountManagerInfoPage( CBOINCBaseWizard* parent ) Create( parent ); } + /*! - * CProjectInfoPage creator + * CAccountManagerInfoPage creator */ bool CAccountManagerInfoPage::Create( CBOINCBaseWizard* parent ) @@ -98,8 +101,9 @@ bool CAccountManagerInfoPage::Create( CBOINCBaseWizard* parent ) return TRUE; } + /*! - * Control creation for CProjectInfoPage + * Control creation for CAccountManagerInfoPage */ void CAccountManagerInfoPage::CreateControls() @@ -125,7 +129,7 @@ void CAccountManagerInfoPage::CreateControls() itemBoxSizer24->Add(itemFlexGridSizer3, 1, wxGROW|wxALL, 5); m_pProjectListCtrl = new CProjectListCtrl; - m_pProjectListCtrl->Create( itemWizardPage23, wxSize(250,155) ); + m_pProjectListCtrl->Create( itemWizardPage23 ); itemFlexGridSizer3->Add(m_pProjectListCtrl, 0, wxGROW|wxRIGHT, 10); wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(2, 1, 0, 0); @@ -153,21 +157,87 @@ void CAccountManagerInfoPage::CreateControls() ////@end CAccountManagerInfoPage content construction } + +/*! + * Gets the previous page. + */ + +wxWizardPageEx* CAccountManagerInfoPage::GetPrev() const +{ + return PAGE_TRANSITION_BACK; +} + + +/*! + * Gets the next page. + */ + +wxWizardPageEx* CAccountManagerInfoPage::GetNext() const +{ + if (CHECK_CLOSINGINPROGRESS()) { + // Cancel Event Detected + return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); + } else { + return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROPERTIESPAGE); + } + return NULL; +} + + +/*! + * Should we show tooltips? + */ + +bool CAccountManagerInfoPage::ShowToolTips() +{ + return TRUE; +} + + +/*! + * Get bitmap resources + */ + +wxBitmap CAccountManagerInfoPage::GetBitmapResource( const wxString& WXUNUSED(name) ) +{ + // Bitmap retrieval +////@begin CAccountManagerInfoPage bitmap retrieval + return wxNullBitmap; +////@end CAccountManagerInfoPage bitmap retrieval +} + + +/*! + * Get icon resources + */ + +wxIcon CAccountManagerInfoPage::GetIconResource( const wxString& WXUNUSED(name) ) +{ + // Icon retrieval +////@begin CAccountManagerInfoPage icon retrieval + return wxNullIcon; +////@end CAccountManagerInfoPage icon retrieval +} + + /*! * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_PROJECTINFOPAGE */ void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) { if (event.GetDirection() == false) return; + wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function Begin")); - unsigned int i; - CMainDocument* pDoc = wxGetApp().GetDocument(); + unsigned int i; + ALL_PROJECTS_LIST pl; + CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(m_pTitleStaticCtrl); wxASSERT(m_pDescriptionStaticCtrl); wxASSERT(m_pProjectUrlStaticCtrl); wxASSERT(m_pProjectUrlCtrl); + m_pTitleStaticCtrl->SetLabel( _("Choose an account manager") ); @@ -181,13 +251,19 @@ void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) { // Populate the virtual list control with project information // if (!m_bAccountManagerListPopulated) { - pDoc->rpc.get_all_projects_list(m_pl); - for (i=0; irpc.get_all_projects_list(pl); + for (i=0; iname.c_str(), wxConvUTF8), + wxString(pl.account_managers[i]->url.c_str(), wxConvUTF8), + true + ); m_pProjectListCtrl->Append( - wxString(m_pl.account_managers[i]->name.c_str(), wxConvUTF8), - wxString(m_pl.account_managers[i]->url.c_str(), wxConvUTF8), + wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8), + wxString(pl.account_managers[i]->url.c_str(), wxConvUTF8), true ); } @@ -195,9 +271,10 @@ void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) { } Layout(); - Fit(); - m_pProjectListCtrl->Layout(); + FitInside(); m_pProjectListCtrl->SetFocus(); + + wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function End")); } /*! @@ -225,61 +302,3 @@ void CAccountManagerInfoPage::OnAccountManagerSelectionChanged( ProjectListCtrlE void CAccountManagerInfoPage::OnCancel( wxWizardExEvent& event ) { PROCESS_CANCELEVENT(event); } - -/*! - * Gets the previous page. - */ - -wxWizardPageEx* CAccountManagerInfoPage::GetPrev() const -{ - return PAGE_TRANSITION_BACK; -} - -/*! - * Gets the next page. - */ - -wxWizardPageEx* CAccountManagerInfoPage::GetNext() const -{ - if (CHECK_CLOSINGINPROGRESS()) { - // Cancel Event Detected - return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); - } else { - return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROPERTIESPAGE); - } - return NULL; -} - -/*! - * Should we show tooltips? - */ - -bool CAccountManagerInfoPage::ShowToolTips() -{ - return TRUE; -} - -/*! - * Get bitmap resources - */ - -wxBitmap CAccountManagerInfoPage::GetBitmapResource( const wxString& WXUNUSED(name) ) -{ - // Bitmap retrieval -////@begin CAccountManagerInfoPage bitmap retrieval - return wxNullBitmap; -////@end CAccountManagerInfoPage bitmap retrieval -} - -/*! - * Get icon resources - */ - -wxIcon CAccountManagerInfoPage::GetIconResource( const wxString& WXUNUSED(name) ) -{ - // Icon retrieval -////@begin CAccountManagerInfoPage icon retrieval - return wxNullIcon; -////@end CAccountManagerInfoPage icon retrieval -} - diff --git a/clientgui/AccountManagerInfoPage.h b/clientgui/AccountManagerInfoPage.h index 3530bc6fa8..69903168d2 100644 --- a/clientgui/AccountManagerInfoPage.h +++ b/clientgui/AccountManagerInfoPage.h @@ -91,8 +91,7 @@ public: wxTextCtrl* m_pProjectUrlCtrl; wxString m_strProjectURL; ////@end CAccountManagerInfoPage member variables - bool m_bAccountManagerListPopulated; - ALL_PROJECTS_LIST m_pl; + bool m_bAccountManagerListPopulated; }; #endif // _WIZ_ACCOUNTMANAGERINFOPAGE_H_ diff --git a/clientgui/ProjectInfoPage.cpp b/clientgui/ProjectInfoPage.cpp index f333cc2a3a..686e3144f7 100644 --- a/clientgui/ProjectInfoPage.cpp +++ b/clientgui/ProjectInfoPage.cpp @@ -77,7 +77,7 @@ CProjectInfoPage::CProjectInfoPage( CBOINCBaseWizard* parent ) /*! - * WizardPage creator + * CProjectInfoPage creator */ bool CProjectInfoPage::Create( CBOINCBaseWizard* parent ) @@ -129,7 +129,7 @@ void CProjectInfoPage::CreateControls() itemBoxSizer24->Add(itemFlexGridSizer3, 1, wxGROW|wxALL, 5); m_pProjectListCtrl = new CProjectListCtrl; - m_pProjectListCtrl->Create( itemWizardPage23, wxSize(250,155) ); + m_pProjectListCtrl->Create( itemWizardPage23 ); itemFlexGridSizer3->Add(m_pProjectListCtrl, 0, wxGROW|wxRIGHT, 10); wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(2, 1, 0, 0); @@ -225,7 +225,6 @@ wxIcon CProjectInfoPage::GetIconResource( const wxString& WXUNUSED(name) ) void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) { if (event.GetDirection() == false) return; - wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanged - Function Begin")); unsigned int i, j, k; @@ -245,7 +244,7 @@ void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) { _("Choose a project") ); m_pDescriptionStaticCtrl->SetLabel( - _("To choose a project, click its name or type its URL below.") + _("To choose a project, click its name or\ntype its URL below.") ); m_pProjectUrlStaticCtrl->SetLabel( _("Project &URL:") @@ -291,8 +290,7 @@ void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) { } Layout(); - Fit(); - m_pProjectListCtrl->Layout(); + FitInside(); m_pProjectListCtrl->SetFocus(); wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanged - Function End")); diff --git a/clientgui/ProjectListCtrl.cpp b/clientgui/ProjectListCtrl.cpp index dcd8dc6cc1..862ae68b12 100644 --- a/clientgui/ProjectListCtrl.cpp +++ b/clientgui/ProjectListCtrl.cpp @@ -61,23 +61,23 @@ CProjectListCtrl::CProjectListCtrl( ) { } -CProjectListCtrl::CProjectListCtrl( wxWindow* parent, wxSize size ) +CProjectListCtrl::CProjectListCtrl( wxWindow* parent ) { - Create( parent, size ); + Create( parent ); } /*! * CProjectList creator */ -bool CProjectListCtrl::Create( wxWindow* parent, wxSize size ) +bool CProjectListCtrl::Create( wxWindow* parent ) { ////@begin CProjectListCtrl member initialisation m_pMainSizer = NULL; ////@end CProjectListCtrl member initialisation ////@begin CProjectListCtrl creation - wxScrolledWindow::Create( parent, wxID_ANY, wxDefaultPosition, size, wxSUNKEN_BORDER ); + wxScrolledWindow::Create( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER ); SetExtraStyle( wxWS_EX_BLOCK_EVENTS ); SetMinSize(GetSize()); diff --git a/clientgui/ProjectListCtrl.h b/clientgui/ProjectListCtrl.h index dc7ba3d9e2..90bf39b389 100644 --- a/clientgui/ProjectListCtrl.h +++ b/clientgui/ProjectListCtrl.h @@ -47,10 +47,10 @@ public: /// Constructors CProjectListCtrl( ); - CProjectListCtrl( wxWindow* parent, wxSize theSize ); + CProjectListCtrl( wxWindow* parent ); /// Creation - bool Create( wxWindow* parent, wxSize theSize ); + bool Create( wxWindow* parent ); /// Creates the controls and sizers void CreateControls();