diff --git a/checkin_notes b/checkin_notes index a149403c60..ced0bbe2ce 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8741,3 +8741,9 @@ Charlie 30 Nov 2011 clientgui/ sg_TaskPanel.cpp,.h + +Charlie 30 Nov 2011 + - MGR: Better sizing of Simple View description text box. + + clientgui/ + sg_TaskPanel.cpp,.h diff --git a/clientgui/sg_TaskPanel.cpp b/clientgui/sg_TaskPanel.cpp index 6161fa7304..da0be6d1f4 100755 --- a/clientgui/sg_TaskPanel.cpp +++ b/clientgui/sg_TaskPanel.cpp @@ -46,17 +46,10 @@ CScrolledTextBox::CScrolledTextBox() { } -CScrolledTextBox::CScrolledTextBox( wxWindow* parent, const wxSize& size) : +CScrolledTextBox::CScrolledTextBox( wxWindow* parent) : wxScrolledWindow( parent, ID_SGPROJECTDESCRIPTION, wxDefaultPosition, wxDefaultSize, wxVSCROLL) { - // We need dimensions before sizers have set them, so - // parent must calculate them and pass them in to us - - m_iAvailableWidth = size.GetWidth(); - m_iAvailableHeight = size.GetHeight(); -#ifndef __WXMAC__ - m_iAvailableWidth -= 20; -#endif + m_iAvailableWidth = 296; // This will be overwritten SetForegroundColour(*wxBLACK); @@ -80,12 +73,21 @@ void CScrolledTextBox::SetValue(const wxString& s) { // Delete sizer & its children (CTransparentStaticText objects) m_TextSizer->Clear(true); - + // Change all occurrences of "n" to "^n" t.Replace(wxT(""), wxT("^"), true); t.Replace(wxT(""), wxT(""), true); + wxString tt = t; - totalLines = Wrap(t, m_iAvailableWidth, &lineHeight); + // First, determine if scroll bars needed so sizer can recompute + totalLines = Wrap(tt, m_iAvailableWidth, &lineHeight); + m_TextSizer->FitInside(this); + + // Now get the actual client size with or without scroll bars + GetClientSize(&m_iAvailableWidth, &lineHeight); + m_TextSizer->Clear(true); // Delete sizer & its children + + totalLines = Wrap(t, m_iAvailableWidth - 3, &lineHeight); m_TextSizer->FitInside(this); SetScrollRate(1, lineHeight); @@ -192,21 +194,20 @@ CSlideShowPanel::CSlideShowPanel( wxWindow* parent ) : wxPanel( parent, wxID_ANY, wxDefaultPosition, wxSize(290+(2*SLIDESHOWBORDER), 126+(2*SLIDESHOWBORDER)), wxBORDER_NONE ) { int w, h; - wxSize descriptionBoxSize; wxBoxSizer* bSizer1; bSizer1 = new wxBoxSizer( wxVERTICAL ); - GetSize(&w, &h); m_institution = new CTransparentStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizer1->Add( m_institution, 0, 0, 0 ); + m_scienceArea = new CTransparentStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizer1->Add( m_scienceArea, 0, 0, 0 ); + bSizer1->AddSpacer(DESCRIPTIONSPACER); - descriptionBoxSize.SetWidth(w); - descriptionBoxSize.SetHeight(h - 2*GetCharHeight() - DESCRIPTIONSPACER); - m_description = new CScrolledTextBox( this, descriptionBoxSize ); - m_description->SetMinSize(wxSize(w, 1)); + m_description = new CScrolledTextBox( this ); + GetSize(&w, &h); + m_description->SetMinSize(wxSize(w, h - (2 * GetCharHeight()) - DESCRIPTIONSPACER)); bSizer1->Add( m_description, 1, wxEXPAND, 0 ); this->SetSizer( bSizer1 ); diff --git a/clientgui/sg_TaskPanel.h b/clientgui/sg_TaskPanel.h index f0dc004d9e..9e2d587c2e 100755 --- a/clientgui/sg_TaskPanel.h +++ b/clientgui/sg_TaskPanel.h @@ -46,7 +46,7 @@ class CScrolledTextBox : public wxScrolledWindow DECLARE_EVENT_TABLE() public: CScrolledTextBox(); - CScrolledTextBox( wxWindow* parent, const wxSize& size); + CScrolledTextBox( wxWindow* parent); ~CScrolledTextBox(); void SetValue(const wxString& s);