diff --git a/checkin_notes b/checkin_notes index c7e31c6953..e9b6f68766 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11825,3 +11825,14 @@ Rom 30 Oct 2006 clientgui/ AccountInfoPage.cpp + +Rom 20 Oct 2006 + - MGR: Use a buffered device context to draw the background on the preferences + dialog which reduces the amount of flicker even further. + - MGR: Make sure the workunit text does not exceed the tab area when using + large fonts. + + clientgui/ + sg_DlgPreferences.cpp + sg_ViewTabPage.cpp, .h + diff --git a/clientgui/sg_DlgPreferences.cpp b/clientgui/sg_DlgPreferences.cpp index 1e19441ebd..1ec10803ad 100644 --- a/clientgui/sg_DlgPreferences.cpp +++ b/clientgui/sg_DlgPreferences.cpp @@ -515,24 +515,30 @@ void CDlgPreferences::OnEraseBackground( wxEraseEvent& event ) { wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); - wxDC* dc = event.GetDC(); - wxSize sz = GetClientSize(); - wxBitmap bmp(*pSkinSimple->GetPreferencesDialogBackgroundImage()->GetBitmap()); wxMemoryDC memDC; wxCoord w, h, x, y; + // Get the desired background bitmap + wxBitmap bmp(*pSkinSimple->GetPreferencesDialogBackgroundImage()->GetBitmap()); + + // Dialog dimensions + wxSize sz = GetClientSize(); + + // Create a buffered device context to reduce flicker + wxBufferedDC dc(event.GetDC(), sz, wxBUFFER_CLIENT_AREA); + + // bitmap dimensions + w = bmp.GetWidth(); + h = bmp.GetHeight(); + #ifdef __WXDEBUG__ // Fill the dialog with a magenta color so people can detect when something // is wrong - dc->SetBrush(wxBrush(wxColour(255,0,255))); - dc->SetPen(wxPen(wxColour(255,0,255))); - dc->DrawRectangle(0, 0, sz.GetWidth(), sz.GetHeight()); + dc.SetBrush(wxBrush(wxColour(255,0,255))); + dc.SetPen(wxPen(wxColour(255,0,255))); + dc.DrawRectangle(0, 0, sz.GetWidth(), sz.GetHeight()); #endif - // Our bitmap dimensions - w = bmp.GetWidth(); - h = bmp.GetHeight(); - // Is the bitmap smaller than the window? if ( (w < sz.x) || (h < sz.y) ) { // Center the bitmap on the window, but never @@ -541,7 +547,7 @@ void CDlgPreferences::OnEraseBackground( wxEraseEvent& event ) { y = wxMax(0, (sz.y - h)/2); // Draw our cool background (centered) - dc->DrawBitmap(bmp, x, y); + dc.DrawBitmap(bmp, x, y); } else { // Snag the center of the bitmap and use it // for the background image @@ -553,7 +559,7 @@ void CDlgPreferences::OnEraseBackground( wxEraseEvent& event ) { memDC.SelectObject(bmp); // Draw the center chunk on the window - dc->Blit(0, 0, w, h, &memDC, x, y, wxCOPY); + dc.Blit(0, 0, w, h, &memDC, x, y, wxCOPY); // Drop the bitmap memDC.SelectObject(wxNullBitmap); diff --git a/clientgui/sg_ViewTabPage.cpp b/clientgui/sg_ViewTabPage.cpp index 1b8ff65637..6ef0b3fc3c 100644 --- a/clientgui/sg_ViewTabPage.cpp +++ b/clientgui/sg_ViewTabPage.cpp @@ -281,13 +281,15 @@ void CViewTabPage::UpdateInterface() m_canvas->Refresh(); m_canvas->Update(); } - - } + + void CViewTabPage::CreateSlideShowWindow() { wSlideShow=new wxWindow(this,-1,wxPoint(30,156),wxSize(290,126),wxNO_BORDER); m_canvas = new MyCanvas(wSlideShow, wxPoint(0,0), wxSize(290,126), GetSlideShow()); } + + void CViewTabPage::ReskinInterface() { CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); @@ -400,53 +402,69 @@ void CViewTabPage::OnWorkShowGraphics() { strDefaultDisplay ); } - } -wxString CViewTabPage::FormatText(const wxString& text, wxDC* dc) { - wxCoord width, height; + + +void CViewTabPage::FormatText(const wxString& title, const wxString& text, wxDC* dc, wxPoint pos) { + wxCoord width, height; + wxCoord col = pos.x; + wxCoord max_col = 330; + wxString translated_text; + + // Title + dc->SetFont(wxFont(9,74,90,90,0,wxT("Arial"))); + dc->GetTextExtent(title, &width, &height); + dc->DrawText(title, pos); + + // How wide was the title? Add 5 pixel buffer before drawing the next piece of text. + col += width + 5; + + // Text + dc->SetFont(wxFont(9,74,90,92,0,wxT("Arial"))); dc->GetTextExtent(text, &width, &height); - if ( width > 201 ) { + if ( width > (max_col - col) ) { int i = (int) text.length(); - while ( width > 201 ) { + while ( width > (max_col - col) ) { i--; dc->GetTextExtent(text.substr(0,i) + _T("..."), &width, &height); } - return text.substr(0,i) + _T("..."); - } - return text; + translated_text = text.substr(0,i) + _T("..."); + } else { + translated_text = text; + } + dc->DrawText(translated_text, wxPoint(col, pos.y)); } + void CViewTabPage::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CViewTabPage::OnPaint - Begin")); - wxPaintDC dc(this); + wxBufferedPaintDC dc(this); + //Project Name dc.SetFont(wxFont(16,74,90,90,0,wxT("Arial"))); dc.DrawText(projName, wxPoint(20,8)); - //static: APPLICATION,MY PROGRESS,ELAPSED TIME,TIME REMAINING - dc.SetFont(wxFont(9,74,90,90,0,wxT("Arial"))); - dc.DrawText(wxT("APPLICATION >"), wxPoint(20,49)); - dc.DrawText(wxT("MY PROGRESS >"), wxPoint(20,71)); - dc.DrawText(wxT("ELAPSED TIME >"), wxPoint(20,115)); - dc.DrawText(wxT("TIME REMAINING >"), wxPoint(20,134)); - //static: projectFrName,wrkUnitName,gaugePercent,elapsedTimeValue,timeRemainingValue + + FormatText(wxT("APPLICATION >"), projectFrName, &dc, wxPoint(20,49)); + FormatText(wxT("MY PROGRESS >"), wrkUnitName, &dc, wxPoint(20,71)); + FormatText(wxT("ELAPSED TIME >"), elapsedTimeValue, &dc, wxPoint(20,115)); + FormatText(wxT("TIME REMAINING >"), timeRemainingValue, &dc, wxPoint(20,134)); + dc.SetFont(wxFont(9,74,90,92,0,wxT("Arial"))); - dc.DrawText(projectFrName, wxPoint(110,49)); - dc.DrawText(FormatText(wrkUnitName, &dc), wxPoint(120,71)); dc.DrawText(gaugePercent, wxPoint(290,90)); - dc.DrawText(elapsedTimeValue, wxPoint(118,115)); - dc.DrawText(timeRemainingValue, wxPoint(130,134)); + wxLogTrace(wxT("Function Start/End"), wxT("CViewTabPage::OnPaint - End")); } -void CViewTabPage::OnImageButton() -{ - if(m_hasGraphic){ + + +void CViewTabPage::OnImageButton() { + if (m_hasGraphic) { OnWorkShowGraphics(); } - } -void CViewTabPage::DrawText() -{ + + +void CViewTabPage::DrawText() { CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); @@ -461,20 +479,13 @@ void CViewTabPage::DrawText() dc.SetFont(wxFont(16,74,90,90,0,wxT("Arial"))); dc.DrawText(projName, wxPoint(20,8)); - //static: APPLICATION,MY PROGRESS,ELAPSED TIME,TIME REMAINING - dc.SetFont(wxFont(9,74,90,90,0,wxT("Arial"))); - dc.DrawText(wxT("APPLICATION >"), wxPoint(20,49)); - dc.DrawText(wxT("MY PROGRESS >"), wxPoint(20,71)); - dc.DrawText(wxT("ELAPSED TIME >"), wxPoint(20,115)); - dc.DrawText(wxT("TIME REMAINING >"), wxPoint(20,134)); + FormatText(wxT("APPLICATION >"), projectFrName, &dc, wxPoint(20,49)); + FormatText(wxT("MY PROGRESS >"), wrkUnitName, &dc, wxPoint(20,71)); + FormatText(wxT("ELAPSED TIME >"), elapsedTimeValue, &dc, wxPoint(20,115)); + FormatText(wxT("TIME REMAINING >"), timeRemainingValue, &dc, wxPoint(20,134)); - //static: projectFrName,wrkUnitName,gaugePercent,elapsedTimeValue,timeRemainingValue dc.SetFont(wxFont(9,74,90,92,0,wxT("Arial"))); - dc.DrawText(projectFrName, wxPoint(110,49)); - dc.DrawText(FormatText(wrkUnitName, &dc), wxPoint(120,71)); dc.DrawText(gaugePercent, wxPoint(290,90)); - dc.DrawText(elapsedTimeValue, wxPoint(118,115)); - dc.DrawText(timeRemainingValue, wxPoint(130,134)); wxLogTrace(wxT("Function Start/End"), wxT("CViewTabPage::DrawText - End")); } diff --git a/clientgui/sg_ViewTabPage.h b/clientgui/sg_ViewTabPage.h index 6b970f915c..e2ea17f385 100644 --- a/clientgui/sg_ViewTabPage.h +++ b/clientgui/sg_ViewTabPage.h @@ -120,7 +120,7 @@ private: void LoadSlideShow(std::vector *vSlideShow); bool Downloading(); int ComputeState(); - wxString FormatText(const wxString& text, wxDC* dc); + void FormatText(const wxString& title, const wxString& text, wxDC* dc, wxPoint pos); std::vector GetSlideShow(); wxWindow* wSlideShow; MyCanvas* m_canvas;