mirror of https://github.com/BOINC/boinc.git
parent
4dbe2c8fdf
commit
a0cbc14c5d
|
@ -143,3 +143,40 @@ void CSimplePanelBase::OnEraseBackground(wxEraseEvent& event) {
|
|||
dc->SetPen(oldPen);
|
||||
dc->SetBrush(oldBrush);
|
||||
}
|
||||
|
||||
|
||||
void CSimplePanelBase::UpdateStaticText(CTransparentStaticText **whichText, wxString s) {
|
||||
EllipseStringIfNeeded(s, *whichText);
|
||||
if ((*whichText)->GetLabel() != s) {
|
||||
(*whichText)->SetLabel(s);
|
||||
(*whichText)->SetName(s); // For accessibility on Windows
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CSimplePanelBase::EllipseStringIfNeeded(wxString& s, wxWindow *win) {
|
||||
int x, y;
|
||||
int w, h;
|
||||
wxSize sz = GetSize();
|
||||
win->GetPosition(&x, &y);
|
||||
int maxWidth = sz.GetWidth() - x - SIDEMARGINS;
|
||||
|
||||
win->GetTextExtent(s, &w, &h);
|
||||
|
||||
// Adapted from ellipis code in wxRendererGeneric::DrawHeaderButtonContents()
|
||||
if (w > maxWidth) {
|
||||
int ellipsisWidth;
|
||||
win->GetTextExtent( wxT("..."), &ellipsisWidth, NULL);
|
||||
if (ellipsisWidth > maxWidth) {
|
||||
s.Clear();
|
||||
w = 0;
|
||||
} else {
|
||||
do {
|
||||
s.Truncate( s.length() - 1 );
|
||||
win->GetTextExtent( s, &w, &h);
|
||||
} while (((w + ellipsisWidth) > maxWidth) && s.length() );
|
||||
s.append( wxT("...") );
|
||||
w += ellipsisWidth;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
#ifndef __sg_PanelBase__
|
||||
#define __sg_PanelBase__
|
||||
|
||||
#include "sg_CustomControls.h"
|
||||
#include "sg_BoincSimpleFrame.h"
|
||||
|
||||
|
||||
|
@ -69,14 +70,6 @@ class CSimplePanelBase : public wxPanel
|
|||
DECLARE_DYNAMIC_CLASS( CSimplePanelBase )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
void MakeBGBitMap();
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
|
||||
protected:
|
||||
wxBitmap m_TaskPanelBGBitMap;
|
||||
bool m_GotBGBitMap;
|
||||
|
||||
public:
|
||||
CSimplePanelBase();
|
||||
CSimplePanelBase( wxWindow* parent);
|
||||
|
@ -84,6 +77,15 @@ class CSimplePanelBase : public wxPanel
|
|||
|
||||
void ReskinInterface();
|
||||
virtual wxRect GetProgressRect() { return wxRect(0, 0, 0, 0); }
|
||||
void UpdateStaticText(CTransparentStaticText **whichText, wxString s);
|
||||
void EllipseStringIfNeeded(wxString& s, wxWindow *win);
|
||||
|
||||
protected:
|
||||
void MakeBGBitMap();
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
|
||||
wxBitmap m_TaskPanelBGBitMap;
|
||||
bool m_GotBGBitMap;
|
||||
};
|
||||
|
||||
#endif //__sg_PanelBase__
|
||||
|
|
|
@ -129,7 +129,8 @@ CSimpleProjectPanel::CSimpleProjectPanel( wxWindow* parent ) :
|
|||
#endif
|
||||
|
||||
// Make sure m_TotalCreditValue string is large enough
|
||||
str.Printf(_("%s: %0.2f"), m_sTotalWorkDoneString.c_str(), 9999999999.99);
|
||||
m_fDisplayedCredit = 9999999999.99;
|
||||
str.Printf(_("%s: %0.2f"), m_sTotalWorkDoneString.c_str(), m_fDisplayedCredit);
|
||||
m_TotalCreditValue = new CTransparentStaticText( this, wxID_ANY, str, wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE );
|
||||
m_TotalCreditValue->Wrap( -1 );
|
||||
m_TotalCreditValue->Enable( false );
|
||||
|
@ -246,9 +247,12 @@ void CSimpleProjectPanel::UpdateInterface() {
|
|||
|
||||
m_ProjectWebSitesButton->Enable();
|
||||
|
||||
str.Printf(_("%s: %0.2f"), m_sTotalWorkDoneString.c_str(), project->user_total_credit);
|
||||
m_TotalCreditValue->SetLabel(str);
|
||||
m_TotalCreditValue->SetName(str); // For accessibility on Windows
|
||||
if (m_fDisplayedCredit != project->user_total_credit) {
|
||||
m_fDisplayedCredit = project->user_total_credit;
|
||||
str.Printf(_("%s: %0.2f"), m_sTotalWorkDoneString.c_str(), m_fDisplayedCredit);
|
||||
UpdateStaticText(&m_TotalCreditValue, str);
|
||||
m_TotalCreditValue->SetName(str); // For accessibility on Windows
|
||||
}
|
||||
projName = m_ProjectSelectionCtrl->GetStringSelection();
|
||||
str.Printf(_("Pop up a menu of websites for project %s"), projName.c_str());
|
||||
m_ProjectWebSitesButton->SetToolTip(str);
|
||||
|
@ -257,7 +261,8 @@ void CSimpleProjectPanel::UpdateInterface() {
|
|||
} else {
|
||||
m_ProjectWebSitesButton->Disable();
|
||||
m_CurrentSelectedProjectURL[0] = '\0';
|
||||
m_TotalCreditValue->SetLabel(wxEmptyString);
|
||||
m_fDisplayedCredit = -1.0;
|
||||
UpdateStaticText(&m_TotalCreditValue, wxEmptyString);
|
||||
m_TotalCreditValue->SetName(wxEmptyString); // For accessibility on Windows
|
||||
m_ProjectWebSitesButton->SetToolTip(wxEmptyString);
|
||||
m_ProjectCommandsButton->SetToolTip(wxEmptyString);
|
||||
|
|
|
@ -63,8 +63,8 @@ class CSimpleProjectPanel : public CSimplePanelBase
|
|||
void OnWizardUpdate();
|
||||
void OnProjectWebSiteButton(wxCommandEvent& /*event*/);
|
||||
void UpdateProjectList();
|
||||
std::string CSimpleProjectPanel::GetProjectIconLoc(char* project_url);
|
||||
wxBitmap* CSimpleProjectPanel::GetProjectSpecificBitmap(char* project_url);
|
||||
std::string GetProjectIconLoc(char* project_url);
|
||||
wxBitmap* GetProjectSpecificBitmap(char* project_url);
|
||||
|
||||
protected:
|
||||
CTransparentStaticText* m_myProjectsLabel;
|
||||
|
@ -82,6 +82,7 @@ class CSimpleProjectPanel : public CSimplePanelBase
|
|||
double m_Project_last_rpc_time;
|
||||
wxString m_sAddProjectToolTip;
|
||||
wxString m_sSynchronizeToolTip;
|
||||
double m_fDisplayedCredit;
|
||||
};
|
||||
|
||||
#endif //__sg_ProjectPanel__
|
||||
|
|
|
@ -893,40 +893,3 @@ void CSimpleTaskPanel::DisplayIdleState() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CSimpleTaskPanel::UpdateStaticText(CTransparentStaticText **whichText, wxString s) {
|
||||
EllipseStringIfNeeded(s, *whichText);
|
||||
if ((*whichText)->GetLabel() != s) {
|
||||
(*whichText)->SetLabel(s);
|
||||
(*whichText)->SetName(s); // For accessibility on Windows
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CSimpleTaskPanel::EllipseStringIfNeeded(wxString& s, wxWindow *win) {
|
||||
int x, y;
|
||||
int w, h;
|
||||
wxSize sz = GetSize();
|
||||
win->GetPosition(&x, &y);
|
||||
int maxWidth = sz.GetWidth() - x - SIDEMARGINS;
|
||||
|
||||
win->GetTextExtent(s, &w, &h);
|
||||
|
||||
// Adapted from ellipis code in wxRendererGeneric::DrawHeaderButtonContents()
|
||||
if (w > maxWidth) {
|
||||
int ellipsisWidth;
|
||||
win->GetTextExtent( wxT("..."), &ellipsisWidth, NULL);
|
||||
if (ellipsisWidth > maxWidth) {
|
||||
s.Clear();
|
||||
w = 0;
|
||||
} else {
|
||||
do {
|
||||
s.Truncate( s.length() - 1 );
|
||||
win->GetTextExtent( s, &w, &h);
|
||||
} while (((w + ellipsisWidth) > maxWidth) && s.length() );
|
||||
s.append( wxT("...") );
|
||||
w += ellipsisWidth;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#define SELECTBYRESULTNAME 0
|
||||
|
||||
#include "sg_CustomControls.h"
|
||||
#include "sg_PanelBase.h"
|
||||
|
||||
|
||||
|
@ -89,7 +88,6 @@ class CSimpleTaskPanel : public CSimplePanelBase
|
|||
void Update();
|
||||
wxRect GetProgressRect() { return m_ProgressRect; }
|
||||
void ReskinInterface();
|
||||
void EllipseStringIfNeeded(wxString& s, wxWindow *win);
|
||||
|
||||
private:
|
||||
void OnTaskSelection(wxCommandEvent &event);
|
||||
|
@ -104,7 +102,6 @@ class CSimpleTaskPanel : public CSimplePanelBase
|
|||
bool Suspended();
|
||||
bool ProjectUpdateScheduled();
|
||||
void DisplayIdleState();
|
||||
void UpdateStaticText(CTransparentStaticText **whichText, wxString s);
|
||||
void OnPulseProgressIndicator(wxTimerEvent& event);
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue