MGR: In Simple View, avoid unnecessary horizontal scroll bar in Project Description text when switching from Advanced View.

This commit is contained in:
Charlie Fenton 2014-01-09 04:27:07 -08:00
parent 7496667272
commit 2dea4866c8
2 changed files with 36 additions and 20 deletions

View File

@ -212,6 +212,7 @@ CSlideShowPanel::CSlideShowPanel( wxWindow* parent ) :
m_SlideBitmap = wxNullBitmap;
m_bCurrentSlideIsDefault = false;
m_bGotAllProjectsList = false;
m_bHasBeenDrawn = false;
#ifdef __WXMAC__
// Tell accessibility aids to ignore this panel (but not its contents)
@ -235,11 +236,36 @@ void CSlideShowPanel::OnSlideShowTimer(wxTimerEvent& WXUNUSED(event)) {
AdvanceSlideShow(true, false);
}
void CSlideShowPanel::SetDescriptionText(void) {
unsigned int i;
wxString s, ss;
TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData();
if (selData == NULL) return;
for (i=0; i<m_AllProjectsList.projects.size(); i++) {
if (!strcmp(m_AllProjectsList.projects[i]->url.c_str(), selData->project_url)) {
s = wxString(m_AllProjectsList.projects[i]->home.c_str(), wxConvUTF8);
ss = wxGetTranslation(s);
ss.Append("\n\n");
s = wxString(m_AllProjectsList.projects[i]->specific_area.c_str(), wxConvUTF8);
ss += wxGetTranslation(s);
ss.Append("\n\n");
s = wxString(m_AllProjectsList.projects[i]->description.c_str(), wxConvUTF8);
ss += wxGetTranslation(s);
m_description->SetValue(ss);
m_description->Show(true);
Enable( true );
m_description->Enable();
this->Layout();
break;
}
}
}
void CSlideShowPanel::AdvanceSlideShow(bool changeSlide, bool reload) {
double xRatio, yRatio, ratio;
unsigned int i;
wxString s, ss;
TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData();
if (selData == NULL) return;
@ -274,25 +300,8 @@ numSlides = 0;
m_bGotAllProjectsList = true;
}
for (i=0; i<m_AllProjectsList.projects.size(); i++) {
if (!strcmp(m_AllProjectsList.projects[i]->url.c_str(), selData->project_url)) {
s = wxString(m_AllProjectsList.projects[i]->home.c_str(), wxConvUTF8);
ss = wxGetTranslation(s);
ss.Append("\n\n");
s = wxString(m_AllProjectsList.projects[i]->specific_area.c_str(), wxConvUTF8);
ss += wxGetTranslation(s);
ss.Append("\n\n");
s = wxString(m_AllProjectsList.projects[i]->description.c_str(), wxConvUTF8);
ss += wxGetTranslation(s);
m_description->SetValue(ss);
SetDescriptionText();
m_description->Show(true);
Enable( true );
m_description->Enable();
this->Layout();
break;
}
}
return;
#else // HIDEDEFAULTSLIDE
SetBackgroundColour(*wxBLACK);
@ -405,6 +414,11 @@ numSlides = 0;
);
}
}
if (!m_bHasBeenDrawn) {
m_bHasBeenDrawn = true;
SetDescriptionText();
}
}

View File

@ -80,6 +80,7 @@ class CSlideShowPanel : public wxPanel
~CSlideShowPanel();
void OnSlideShowTimer(wxTimerEvent& WXUNUSED(event));
void SetDescriptionText(void);
void AdvanceSlideShow(bool changeSlide, bool reload);
void OnPaint(wxPaintEvent& WXUNUSED(event));
void OnEraseBackground(wxEraseEvent& event);
@ -90,6 +91,7 @@ class CSlideShowPanel : public wxPanel
wxBitmap m_SlideBitmap;
bool m_bCurrentSlideIsDefault;
bool m_bGotAllProjectsList;
bool m_bHasBeenDrawn;
ALL_PROJECTS_LIST m_AllProjectsList;
};