~ubuntu-branches/ubuntu/lucid/boinc/lucid

« back to all changes in this revision

Viewing changes to clientgui/common/wxPieCtrl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Frank S. Thomas, Frank S. Thomas
  • Date: 2008-05-31 08:02:47 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20080531080247-4ce890lp2rc768cr
Tags: 6.2.7-1
[ Frank S. Thomas ]
* New upstream release.
  - BOINC Manager: Redraw disk usage charts immediately after connecting to
    a (different) client. (closes: 463823)
* debian/copyright:
  - Added the instructions from debian/README.Debian-source about how
    repackaged BOINC tarballs can be reproduced because DevRef now
    recommends to put this here instead of in the afore-mentioned file.
  - Updated for the new release.
* Removed the obsolete debian/README.Debian-source.
* For consistency upstream renamed the core client and the command tool
  ("boinc_client" to "boinc" and "boinc_cmd" to "boinccmd"). Done the same
  in all packages and created symlinks with the old names for the binaries
  and man pages. Also added an entry in debian/boinc-client.NEWS explaining
  this change.
* debian/rules: Do not list Makefile.ins in the clean target individually,
  just remove all that can be found.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
/////////////////////////////////////////////////////////////////////////////
11
11
#include "wxPieCtrl.h"
12
12
#include <wx/arrimpl.cpp>
 
13
#include <vector>
13
14
 
14
15
using namespace std;
15
16
 
187
188
        }       
188
189
}
189
190
 
 
191
#define MINANGLE 2
190
192
 
191
193
void wxPieCtrl::DrawParts(wxRect& pieRect)
192
194
{
193
195
        wxArrayDouble angles;
 
196
    unsigned int i;
 
197
    std::vector<int> intAngles;
194
198
        wxPen oldpen = m_CanvasDC.GetPen();
195
 
        if(m_ShowEdges) {
 
199
 
 
200
    intAngles.clear();
 
201
        
 
202
    if(m_ShowEdges) {
196
203
                m_CanvasDC.SetPen(*wxBLACK_PEN);
197
204
        }
 
205
        
198
206
        if(m_Series.Count() == 1)
199
207
        {
200
208
                m_CanvasDC.SetBrush(wxBrush(m_Series[0].GetColour()));
211
219
                                                                                           pieRect.GetBottom()-pieRect.GetTop(),
212
220
                                                                                           0,360);
213
221
#endif
214
 
        }
215
 
        else {
 
222
    } else {
216
223
                GetPartAngles(angles);
217
 
                for(unsigned int i = 0; i < angles.Count(); i++)
 
224
                
 
225
        if (angles.Count() > 1) {
 
226
            // Try to adjust angles so each segment is visible
 
227
            for(i = 0; i < angles.Count(); i++) {
 
228
                intAngles.push_back((int)angles[i]);
 
229
                if (i > 0) {
 
230
                    if ((intAngles[i] - intAngles[i-1]) < MINANGLE) {
 
231
                        if (angles[i] > 0.0) {
 
232
                            intAngles[i] = intAngles[i-1] + MINANGLE;
 
233
                        }
 
234
                    }
 
235
                }
 
236
            }
 
237
            
 
238
            // If we expanded last segment past 360, go back and fix it
 
239
            if (intAngles[angles.Count()-1] > 360) {
 
240
                intAngles[angles.Count()-1] = 360;
 
241
                for(i = angles.Count()-2; i > 0; i--) {
 
242
                    if ((intAngles[i+1] - intAngles[i]) >= MINANGLE) {
 
243
                        break;
 
244
                    }
 
245
                    if (angles[i+1] > 0.0) {
 
246
                        intAngles[i] = intAngles[i+1] - MINANGLE;
 
247
                    }
 
248
                }
 
249
            }
 
250
        }
 
251
                
 
252
                for(i = 0; i < angles.Count(); i++)
218
253
                {
219
254
                        if(i > 0)
220
255
                        {
226
261
                                double t1,t2;
227
262
#ifndef __WXMSW__
228
263
                                // Convert angles to ints and back to doubles to avoid roundoff error which causes gaps between parts
229
 
                                t1 = (double)(int)angles[i-1];
230
 
                                t2 = (double)(int)angles[i];
231
 
                                // !!! very little parts (angel diff < 1) are not shown
 
264
                                t1 = (double)intAngles[i-1];
 
265
                                t2 = (double)intAngles[i];
 
266
                                // !!! very little parts (angle diff < 1) are not shown
232
267
                                // because t1=t2 after type conversion
233
268
#else
234
 
                                t1 = angles[i-1];
235
 
                                t2 = angles[i];
 
269
                                t1 = intAngles[i-1];
 
270
                                t2 = intAngles[i];
236
271
#endif 
237
272
                                if(t1 != t2) {
238
273
#if (defined(__WXMAC__) && wxCHECK_VERSION(2,8,2))
279
314
 
280
315
        int right(left+maxwidth-1), bottom(top+dy-1);
281
316
 
282
 
        if(! IsTransparent())
 
317
        if(!IsTransparent())
283
318
        {
284
319
                m_CanvasDC.SetBrush(wxBrush(m_LegendBackColour));
285
320
                m_CanvasDC.DrawRectangle(left, top, maxwidth, dy);