*** empty log message ***

svn path=/trunk/boinc/; revision=11276
This commit is contained in:
Charlie Fenton 2006-10-12 12:52:19 +00:00
parent 48791e6531
commit c4a6bc274e
6 changed files with 48 additions and 18 deletions

View File

@ -11040,4 +11040,15 @@ Kevin 11 Oct 2006
sg_SGUIListControl.cpp/h
sg_StatImageLoader.cpp
sg_ViewTabPage.cpp/h
Charlie 11 Oct 2006
- Fix compiler warnings and errors.
- Changes to wxPieCtrl to fix crashes, compiler warnings on Mac.
client/
app_start.C
http_curl.C
clientgui/
ViewResources.cpp
common/
wxPieCtrl.cpp,h

View File

@ -593,7 +593,7 @@ int ACTIVE_TASK::start(bool first_time) {
//
char libpath[8192];
get_project_dir(wup->project, buf);
sprintf(libpath, "%:%s", getenv("LD_LIBRARY_PATH"), buf);
sprintf(libpath, "%s:%s", getenv("LD_LIBRARY_PATH"), buf);
setenv("LD_LIBRARY_PATH", libpath, 1);
retval = chdir(slot_dir);

View File

@ -1039,8 +1039,10 @@ void HTTP_OP::update_speed() {
}
void HTTP_OP::set_speed_limit(bool is_upload, double bytes_sec) {
CURLcode cc;
CURLcode cc = CURLE_OK;
#if defined(CURLOPT_MAX_SEND_SPEED_LARGE) || defined(CURLOPT_MAX_RECV_SPEED_LARGE)
curl_off_t bs = (curl_off_t)bytes_sec;
#endif
if (is_upload) {
#ifdef CURLOPT_MAX_SEND_SPEED_LARGE

View File

@ -59,7 +59,7 @@ CViewResources::CViewResources(wxNotebook* pNotebook) :
//create a default task pane
m_pTaskPane = new CBOINCTaskCtrl(this, ID_TASK_RESOURCEUTILIZATIONVIEW, DEFAULT_TASK_FLAGS);
wxASSERT(m_pTaskPane);
#ifndef __WXMAC__ // wxPieCtrl crashes Mac
// create pie chart ctrl for total disk usage
m_pieCtrlTotal = new wxPieCtrl(this, ID_LIST_RESOURCEUTILIZATIONVIEWTOTAL, wxDefaultPosition, wxSize(-1,-1));
wxASSERT(m_pieCtrlTotal);
@ -102,7 +102,7 @@ CViewResources::CViewResources(wxNotebook* pNotebook) :
SetSizer(itemFlexGridSizer);
Layout();
#endif // __WXMAC__ // wxPieCtrl crashes Mac
m_pTaskPane->UpdateControls();
UpdateSelection();
@ -181,7 +181,6 @@ void CViewResources::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
wxString diskspace;
double boinctotal=0.0;
#ifndef __WXMAC__ // wxPieCtrl crashes Mac
//clear former data
m_pieCtrlBOINC->m_Series.Clear();
m_pieCtrlTotal->m_Series.Clear();
@ -259,7 +258,6 @@ void CViewResources::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
//force a repaint of the legend (doesn't work if not explicitly resized)
m_pieCtrlTotal->GetLegend()->SetSize(wxSize(10,10));
m_pieCtrlTotal->Refresh();
#endif // __WXMAC__ // wxPieCtrl crashes Mac
}
wxInt32 CViewResources::FormatDiskSpace(wxInt32 item, wxString& strBuffer) const {

View File

@ -122,6 +122,10 @@ void wxPieCtrlLegend::OnPaint(wxPaintEvent & event)
dy += (th+3);
maxwidth = max(maxwidth, (int)(2*m_HorBorder+tw+15));
}
#ifdef __WXMAC__
if (maxwidth == 0)
return;
#endif
dy += m_VerBorder;
if(w != maxwidth || h != dy) SetSize(maxwidth, dy);
pdc.Blit(0,0,w,h,&mdc,0,0);
@ -130,6 +134,9 @@ void wxPieCtrlLegend::OnPaint(wxPaintEvent & event)
void wxPieCtrlLegend::SetLabelFont(wxFont font)
{
m_LabelFont = font;
#ifdef __WXMAC__
m_TitleFont = font;
#endif
Refresh();
}
@ -185,8 +192,14 @@ void wxPieCtrl::OnSize(wxSizeEvent & event)
void wxPieCtrl::RecreateCanvas()
{
m_CanvasBitmap.Create(GetSize().GetWidth(), GetSize().GetHeight());
m_CanvasDC.SelectObject(m_CanvasBitmap);
int x = GetSize().GetWidth();
int y = GetSize().GetHeight();
#ifdef __WXMAC__
if ((x < 1) || (y < 1))
return;
#endif
m_CanvasBitmap.Create(x, y);
m_CanvasDC.SelectObject(m_CanvasBitmap);
}
void wxPieCtrl::GetPartAngles(wxArrayDouble & angles)
@ -235,7 +248,7 @@ void wxPieCtrl::SetBackColour(wxColour colour)
Refresh();
}
#ifdef __WXMSW__
#if defined(__WXMSW__) || defined(__WXMAC__)
void wxPieCtrl::DrawParts(wxMemoryDC & dc, int cx, int cy, int w, int h)
{
if(m_bDrawCircle) {
@ -259,8 +272,13 @@ void wxPieCtrl::DrawParts(wxMemoryDC & dc, int cx, int cy, int w, int h)
{
if(!m_ShowEdges) dc.SetPen(wxPen(m_Series[i-1].GetColour()));
dc.SetBrush(wxBrush(m_Series[i-1].GetColour()));
if(angles[i-1] != angles[i])
if(angles[i-1] != angles[i]) {
#ifdef __WXMAC__ // Convert angles to ints and back to doubles to avoid roundoff error which causes gaps between parts
dc.DrawEllipticArc(0, (int)((1-sin(m_Angle))*(h/2)+cy), w, (int)(h * sin(m_Angle)), (double)((int)angles[i-1]+m_RotationAngle/M_PI*180), (double)((int)angles[i]+m_RotationAngle/M_PI*180));
#else
dc.DrawEllipticArc(0, (int)((1-sin(m_Angle))*(h/2)+cy), w, (int)(h * sin(m_Angle)), angles[i-1]+m_RotationAngle/M_PI*180, angles[i]+m_RotationAngle/M_PI*180);
#endif
}
}
}
if(m_Series.Count() == 1)
@ -307,13 +325,13 @@ void wxPieCtrl::Draw(wxPaintDC & pdc)
}
if(m_Series.Count())
{
#ifdef __WXMSW__
#if defined(__WXMSW__) || defined(__WXMAC__)
if(m_Angle <= M_PI/2)
{
DrawParts(m_CanvasDC, 0, (int)(m_Height*cos(m_Angle)), w,h);
} else DrawParts(m_CanvasDC, 0, 0, w, h);
#endif
wxPoint points[4], triangle[3];
wxPoint points[4];
m_CanvasDC.SetPen(wxPen(*wxBLACK));
wxArrayDouble angles;
GetPartAngles(angles);
@ -325,7 +343,8 @@ void wxPieCtrl::Draw(wxPaintDC & pdc)
bool changeangle(false);
wxColour curColour;
wxPen oldPen;
#ifndef __WXMSW__
#if ! (defined(__WXMSW__) || defined(__WXMAC__))
wxPoint triangle[3];
for(x = 0; x <= 2 * M_PI; x += 0.05)
{
changeangle = false;
@ -451,7 +470,7 @@ void wxPieCtrl::Draw(wxPaintDC & pdc)
m_CanvasDC.DrawPolygon(4, points);
}
//-----------------------------------------------------------------------
#ifdef __WXMSW__
#if defined(__WXMSW__) || defined(__WXMAC__)
if(m_Angle <= M_PI/2)
{
DrawParts(m_CanvasDC, 0, 0, w, h);

View File

@ -128,8 +128,6 @@ public:
/// The component for drawing pie diagrams
class wxPieCtrl : public wxWindow
{
bool m_bPaint3D;
bool m_bDrawCircle;
double m_Angle;
double m_RotationAngle;
int m_Height;
@ -141,12 +139,14 @@ class wxPieCtrl : public wxWindow
wxPieCtrlLegend * m_Legend;
bool m_ShowEdges;
void GetPartAngles(wxArrayDouble & angles);
#ifdef __WXMSW__
#if defined(__WXMSW__) || defined(__WXMAC__)
void DrawParts(wxMemoryDC & dc, int cx, int cy, int w, int h);
#endif
void RecreateCanvas();
protected:
bool m_CanRepaint;
bool m_bPaint3D;
bool m_bDrawCircle;
void Draw(wxPaintDC & pdc);
public:
/// An array of wxPiePart objects for storing information about sectors