From e49232d0870c0a150005ff3d470e2e6cd6f0b0c5 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 10 Sep 2014 06:31:05 -0700 Subject: [PATCH] MGR: On MS Windows, fix Attach Wizard to scale according to users DPI setting. --- clientgui/ProjectInfoPage.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/clientgui/ProjectInfoPage.cpp b/clientgui/ProjectInfoPage.cpp index ad9ae5cca6..c18f7dfe93 100644 --- a/clientgui/ProjectInfoPage.cpp +++ b/clientgui/ProjectInfoPage.cpp @@ -200,13 +200,18 @@ void CProjectInfoPage::CreateControls() { ////@begin CProjectInfoPage content construction #ifdef __WXMAC__ -#define LISTBOXWIDTH 225 #define DESCRIPTIONSWIDTH 350 #else -#define LISTBOXWIDTH 150 -#define DESCRIPTIONSWIDTH 200 +#define DESCRIPTIONSWIDTH ADJUSTFORXDPI(200) #endif + bool bCategoryFound = false; + wxArrayString aCategories; + ALL_PROJECTS_LIST pl; + CMainDocument* pDoc = wxGetApp().GetDocument(); + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + CProjectInfoPage* itemWizardPage23 = this; wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxVERTICAL); @@ -228,9 +233,7 @@ void CProjectInfoPage::CreateControls() itemFlexGridSizer4->AddGrowableCol(0); itemBoxSizer24->Add(itemFlexGridSizer4, 0, wxGROW|wxALL, 0); - wxFlexGridSizer* itemFlexGridSizer6 = new wxFlexGridSizer(2, 2, 0, 0); - itemFlexGridSizer6->AddGrowableRow(1); - itemFlexGridSizer6->AddGrowableCol(1); + wxFlexGridSizer* itemFlexGridSizer6 = new wxFlexGridSizer(2, 0, 0); itemFlexGridSizer4->Add(itemFlexGridSizer6, 0, wxGROW|wxALL, 0); wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL); @@ -239,9 +242,17 @@ void CProjectInfoPage::CreateControls() m_pProjectCategoriesStaticCtrl = new wxStaticText( itemWizardPage23, wxID_STATIC, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer7->Add(m_pProjectCategoriesStaticCtrl, 0, wxALIGN_LEFT|wxRIGHT|wxBOTTOM, 5); - wxArrayString m_pProjectCategoriesCtrlStrings; - m_pProjectCategoriesCtrl = new wxComboBox( itemWizardPage23, ID_CATEGORIES, wxT(""), wxDefaultPosition, wxSize(LISTBOXWIDTH, -1), m_pProjectCategoriesCtrlStrings, wxCB_READONLY -#ifndef __WXMAC__ // wxCB_SORT is not available in wxCocoa 2.9.5 + // We must populate the combo box before our sizers can calculate its width. + // The combo box will be repopulated in CProjectInfoPage::OnPageChanged(), + // so we don't need to worry about duplicate entries here. + // Get the project list + pDoc->rpc.get_all_projects_list(pl); + for (int i=0; igeneral_area.c_str(), wxConvUTF8)); + aCategories.Add(strGeneralArea); + } + m_pProjectCategoriesCtrl = new wxComboBox( itemWizardPage23, ID_CATEGORIES, wxT(""), wxDefaultPosition, wxDefaultSize, aCategories, wxCB_READONLY +#ifndef __WXMAC__ // wxCB_SORT is not available in wxCocoa 3.0 |wxCB_SORT #endif ); @@ -256,16 +267,16 @@ void CProjectInfoPage::CreateControls() itemBoxSizer7->Add(itemFlexGridSizer11, 0, wxGROW|wxALL, 0); wxArrayString m_pProjectsCtrlStrings; - m_pProjectsCtrl = new wxListBox( itemWizardPage23, ID_PROJECTS, wxDefaultPosition, wxSize(LISTBOXWIDTH, 175), m_pProjectsCtrlStrings, wxLB_SINGLE|wxLB_SORT ); + m_pProjectsCtrl = new wxListBox( itemWizardPage23, ID_PROJECTS, wxDefaultPosition, wxSize(-1, ADJUSTFORYDPI(175)), m_pProjectsCtrlStrings, wxLB_SINGLE|wxLB_SORT ); itemFlexGridSizer11->Add(m_pProjectsCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 0); m_pProjectDetailsStaticCtrl = new wxStaticBox(itemWizardPage23, wxID_ANY, wxT("")); wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(m_pProjectDetailsStaticCtrl, wxVERTICAL); itemFlexGridSizer6->Add(itemStaticBoxSizer13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); - m_pProjectDetailsDescriptionCtrl = new wxTextCtrl( itemWizardPage23, ID_PROJECTDESCRIPTION, wxT(""), wxDefaultPosition, wxSize(DESCRIPTIONSWIDTH, 100), wxTE_MULTILINE|wxTE_READONLY ); +// wxPanel* ProjectDetailsDescriptionPanel = new wxPanel(m_pProjectDetailsStaticCtrl, wxID_ANY, wxDefaultPosition, wxSize(DESCRIPTIONSWIDTH, ADJUSTFORYDPI(100))); + m_pProjectDetailsDescriptionCtrl = new wxTextCtrl( itemWizardPage23, ID_PROJECTDESCRIPTION, wxT(""), wxDefaultPosition, wxSize(DESCRIPTIONSWIDTH, ADJUSTFORYDPI(100)), wxTE_MULTILINE|wxTE_READONLY ); itemStaticBoxSizer13->Add(m_pProjectDetailsDescriptionCtrl, 0, wxGROW|wxLEFT|wxTOP|wxBOTTOM, 5); - wxFlexGridSizer* itemFlexGridSizer16 = new wxFlexGridSizer(2, 0, 0); itemFlexGridSizer16->AddGrowableCol(1); itemStaticBoxSizer13->Add(itemFlexGridSizer16, 0, wxGROW|wxALL, 0);