MGR: Fix horizontal sizing of text in Simple View project description

svn path=/trunk/boinc/; revision=24851
This commit is contained in:
Charlie Fenton 2011-12-21 11:04:39 +00:00
parent 996a6dcc55
commit 97724f5ad7
3 changed files with 12 additions and 15 deletions

View File

@ -9214,3 +9214,9 @@ Charlie 21 Dec 2011
clientgui/
ProjectInfoPage.cpp,.h
Charlie 21 Dec 2011
- MGR: Fix horizontal sizing of text in Simple View project description.
clientgui/
sg_TaskPanel.cpp,.h

View File

@ -31,7 +31,8 @@
#define SLIDESHOWBORDER 3
#define DESCRIPTIONSPACER 4
#define HIDEDEFAULTSLIDE 1
#define TESTALLDESCRIPTIONS 0
#define TESTALLDESCRIPTIONS 1
#define SCROLLBARWIDTH 18
enum { suspendedIcon, waitingIcon, runningIcon };
@ -49,8 +50,6 @@ CScrolledTextBox::CScrolledTextBox() {
CScrolledTextBox::CScrolledTextBox( wxWindow* parent) :
wxScrolledWindow( parent, ID_SGPROJECTDESCRIPTION, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
{
m_iAvailableWidth = 296; // This will be overwritten
SetForegroundColour(*wxBLACK);
m_TextSizer = new wxBoxSizer( wxVERTICAL );
@ -68,7 +67,7 @@ CScrolledTextBox::~CScrolledTextBox() {
void CScrolledTextBox::SetValue(const wxString& s) {
int lineHeight, totalLines;
int lineHeight, totalLines, availableWidth;
wxString t = s;
// Delete sizer & its children (CTransparentStaticText objects)
@ -77,17 +76,10 @@ void CScrolledTextBox::SetValue(const wxString& s) {
// Change all occurrences of "<sup>n</sup>" to "^n"
t.Replace(wxT("<sup>"), wxT("^"), true);
t.Replace(wxT("</sup>"), wxT(""), true);
wxString tt = t;
// 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);
wxSize taskPanelSize = GetGrandParent()->GetSize();
availableWidth = taskPanelSize.GetWidth() - (2*SIDEMARGINS);
totalLines = Wrap(t, availableWidth - SCROLLBARWIDTH, &lineHeight);
m_TextSizer->FitInside(this);
SetScrollRate(1, lineHeight);

View File

@ -58,7 +58,6 @@ class CScrolledTextBox : public wxScrolledWindow
void OnOutputLine(const wxString& line);
wxBoxSizer* m_TextSizer;
int m_iAvailableWidth;
int m_iAvailableHeight;
bool m_eol;
wxString m_text;