Use wxPointList instead of wxList in wxDC code
authorRobert Roebling <robert@roebling.de>
Fri, 19 Oct 2007 14:53:55 +0000 (14:53 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 19 Oct 2007 14:53:55 +0000 (14:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

15 files changed:
docs/latex/wx/dc.tex
include/wx/dc.h
include/wx/dcgraph.h
include/wx/gdicmn.h
include/wx/generic/dcpsg.h
include/wx/gtk/gnome/gprint.h
include/wx/gtk/print.h
include/wx/msw/dc.h
src/common/dcbase.cpp
src/common/dcgraph.cpp
src/common/gdicmn.cpp
src/generic/dcpsg.cpp
src/gtk/gnome/gprint.cpp
src/gtk/print.cpp
src/msw/dc.cpp

index fbb5a427d451b9e84ebb6564f3fe399c412d17a1..cdae272859df05937ded577190c42004b4590cb2 100644 (file)
@@ -363,12 +363,11 @@ Draws lines using an array of {\it points} of size {\it n}
 adding the optional offset coordinate. The current pen is
 used for drawing the lines.
 
-\func{void}{DrawLines}{\param{const wxList *}{points}, \param{wxCoord}{ xoffset = 0}, \param{wxCoord}{ yoffset = 0}}
+\func{void}{DrawLines}{\param{const wxPointList *}{points}, \param{wxCoord}{ xoffset = 0}, \param{wxCoord}{ yoffset = 0}}
 
-This method is deprecated and will be removed or replaced
-with a type-safe version. It uses a wxList of pointers to
-wxPoints, adding the optional offset coordinate. The programmer
-is responsible for deleting the list of points.
+This method uses a list of wxPoints, adding the optional offset
+coordinate. The programmer is responsible for deleting the list
+of points.
 
 \pythonnote{The wxPython version of this method accepts a Python list
 of wxPoint objects.}
@@ -386,13 +385,11 @@ of wxPoint objects.}
 Draws a filled polygon using an array of {\it points} of size {\it n},
 adding the optional offset coordinate.
 
-\func{void}{DrawPolygon}{\param{const wxList *}{points}, \param{wxCoord}{ xoffset = 0}, \param{wxCoord}{ yoffset = 0},\\
+\func{void}{DrawPolygon}{\param{const wxPointList *}{points}, \param{wxCoord}{ xoffset = 0}, \param{wxCoord}{ yoffset = 0},\\
   \param{int }{fill\_style = wxODDEVEN\_RULE}}
 
-This method is deprecated and will be removed or replaced
-with a type-safe version. It draws a filled polygon using
-a list of pointers to wxPoints, adding  the optional offset
-coordinate.
+This method draws a filled polygon using a list of wxPoints,
+adding the optional offset coordinate.
 
 The last argument specifies the fill rule: {\bf wxODDEVEN\_RULE} (the
 default) or {\bf wxWINDING\_RULE}.
@@ -500,10 +497,9 @@ the rectangle.
 Draws a spline between all given control points, using the current
 pen.
 
-\func{void}{DrawSpline}{\param{wxList *}{points}}
+\func{void}{DrawSpline}{\param{const wxPointList *}{points}}
 
-Draws a spline between all given control points, using the current
-pen.  Doesn't delete the wxList and contents.
+Draws a spline between all given control points.
 
 \func{void}{DrawSpline}{\param{wxCoord}{ x1}, \param{wxCoord}{ y1}, \param{wxCoord}{ x2}, \param{wxCoord}{ y2}, \param{wxCoord}{ x3}, \param{wxCoord}{ y3}}
 
index 58bb92bb830b74ccf81ec005b52e46309eedb0df..465d2e95880c36e267e6faec32d03630cef2068c 100644 (file)
@@ -26,7 +26,6 @@
 #include "wx/brush.h"
 #include "wx/pen.h"
 #include "wx/palette.h"
-#include "wx/list.h"            // we use wxList in inline functions
 #include "wx/dynarray.h"
 #include "wx/math.h"
 #include "wx/image.h"
@@ -441,7 +440,7 @@ public:
 #if wxUSE_SPLINES
     virtual void DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3);
     virtual void DoDrawSpline(int n, wxPoint points[]);
-    virtual void DoDrawSpline(wxList *points);
+    virtual void DoDrawSpline(const wxPointList *points);
 #endif
     
 private:
@@ -841,7 +840,7 @@ public:
 
 #if 0
     // needs to be removed
-    void DrawLines(const wxList *list,
+    void DrawLines(const wxPointList *list,
                    wxCoord xoffset = 0, wxCoord yoffset = 0)
 #endif
 
@@ -852,7 +851,7 @@ public:
 
 #if 0
     // needs to be removed
-    void DrawPolygon(const wxList *list,
+    void DrawPolygon(const wxPointList *list,
                      wxCoord xoffset = 0, wxCoord yoffset = 0,
                      int fillStyle = wxODDEVEN_RULE)
         { m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
@@ -975,12 +974,8 @@ public:
         { m_pimpl->DoDrawSpline(x1,y1,x2,y2,x3,y3); }
     void DrawSpline(int n, wxPoint points[])
         { m_pimpl->DoDrawSpline(n,points); }
-
-#if 0
-    // needs to be removed
-    void DrawSpline(wxList *points) 
+    void DrawSpline(const wxPointList *points) 
         { m_pimpl->DoDrawSpline(points); }
-#endif
 #endif // wxUSE_SPLINES
 
 
@@ -1149,18 +1144,30 @@ public:
     void DrawLines(int n, wxPoint points[],
                    wxCoord xoffset = 0, wxCoord yoffset = 0)
         { DoDrawLines(n, points, xoffset, yoffset); }
-    void DrawLines(const wxList *list,
+    void DrawLines(const wxPointList *list,
                    wxCoord xoffset = 0, wxCoord yoffset = 0);
 
+#if WXWIN_COMPATIBILITY_2_8
+    wxDEPRECATED( void DrawLines(const wxList *list,
+                                 wxCoord xoffset = 0, wxCoord yoffset = 0) );
+#endif  // WXWIN_COMPATIBILITY_2_8
+
+
     void DrawPolygon(int n, wxPoint points[],
                      wxCoord xoffset = 0, wxCoord yoffset = 0,
                      int fillStyle = wxODDEVEN_RULE)
         { DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
 
-    void DrawPolygon(const wxList *list,
+    void DrawPolygon(const wxPointList *list,
                      wxCoord xoffset = 0, wxCoord yoffset = 0,
                      int fillStyle = wxODDEVEN_RULE);
 
+#if WXWIN_COMPATIBILITY_2_8
+    wxDEPRECATED( void DrawPolygon(const wxList *list,
+                     wxCoord xoffset = 0, wxCoord yoffset = 0,
+                     int fillStyle = wxODDEVEN_RULE) );
+#endif  // WXWIN_COMPATIBILITY_2_8
+
     void DrawPolyPolygon(int n, int count[], wxPoint points[],
                          wxCoord xoffset = 0, wxCoord yoffset = 0,
                          int fillStyle = wxODDEVEN_RULE)
@@ -1272,13 +1279,17 @@ public:
     }
 
 #if wxUSE_SPLINES
-    // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
     void DrawSpline(wxCoord x1, wxCoord y1,
                     wxCoord x2, wxCoord y2,
                     wxCoord x3, wxCoord y3);
     void DrawSpline(int n, wxPoint points[]);
 
-    void DrawSpline(wxList *points) { DoDrawSpline(points); }
+    void DrawSpline(const wxPointList *points) { DoDrawSpline(points); }
+
+#if WXWIN_COMPATIBILITY_2_8
+    wxDEPRECATED( void DrawSpline(const wxList *points) );
+#endif  // WXWIN_COMPATIBILITY_2_8
+    
 #endif // wxUSE_SPLINES
 
     // Eventually we will have wxUSE_GENERIC_DRAWELLIPSE
@@ -1319,11 +1330,11 @@ public:
      *  \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle).
      *  \param center Center of rotation.
      */
-    void Rotate( wxList* points, double angle, wxPoint center = wxPoint(0,0) );
+    void Rotate( wxPointList* points, double angle, wxPoint center = wxPoint(0,0) );
 
     // used by DrawEllipticArcRot
     // Careful: wxList gets filled with points you have to delete later.
-    void CalculateEllipticPoints( wxList* points,
+    void CalculateEllipticPoints( wxPointList* points,
                                   wxCoord xStart, wxCoord yStart,
                                   wxCoord w, wxCoord h,
                                   double sa, double ea );
@@ -1710,7 +1721,7 @@ protected:
     virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
 
 #if wxUSE_SPLINES
-    virtual void DoDrawSpline(wxList *points);
+    virtual void DoDrawSpline(const wxPointList *points);
 #endif
 
 protected:
index cce940f27a452d4f1cd61eb2fe5e919896c244a4..2359129d76ba0c85eacf5cac1ac1c379213edaff 100644 (file)
@@ -110,7 +110,7 @@ protected:
     virtual void DoDrawPoint(wxCoord x, wxCoord y);
 
 #if wxUSE_SPLINES
-    virtual void DoDrawSpline(wxList *points);
+    virtual void DoDrawSpline(const wxPointList *points);
 #endif
 
     virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
index 88423327536f1fc5054bcec9bfb5195274bdcc1c..e25aaa433697c9c190b9296ccb69cf9d70853275 100644 (file)
@@ -419,6 +419,7 @@ inline wxPoint operator-(const wxPoint& p)
     return wxPoint(-p.x, -p.y);
 }
 
+WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE);
 
 // ---------------------------------------------------------------------------
 // wxRect
index a9f6822be21b6f5bb1e4660a5a69fb948cf90910..2d90c7fa64faf6835c7c964dc4f1cb6a3192e009 100644 (file)
@@ -105,7 +105,7 @@ protected:
     void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
     void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 #if wxUSE_SPLINES
-    void DoDrawSpline(wxList *points);
+    void DoDrawSpline(const wxPointList *points);
 #endif // wxUSE_SPLINES
     bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
index 59d3be5521af624261a3f2d04ee9a9dac1646a5d..d4a4117ea06a2bc13ac75a46f08a81ee12aee6c3 100644 (file)
@@ -253,7 +253,7 @@ protected:
     void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
     void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 #if wxUSE_SPLINES
-    void DoDrawSpline(wxList *points);
+    void DoDrawSpline(const wxPointList *points);
 #endif // wxUSE_SPLINES
     bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
             wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
@@ -274,9 +274,6 @@ protected:
     void SetPrintData(const wxPrintData& data);
     wxPrintData& GetPrintData() { return m_printData; }
 
-private:
-    static float ms_PSScaleFactor;
-
 private:
     wxPrintData             m_printData;
     PangoContext           *m_context;
index a4175c2f1bd0c141c56f0e3596bc1b77391234c7..eb4f3f7b0bf6dd50c81d74a1980108a86d124cc6 100644 (file)
@@ -266,7 +266,7 @@ protected:
     void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
     void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 #if wxUSE_SPLINES
-    void DoDrawSpline(wxList *points);
+    void DoDrawSpline(const wxPointList *points);
 #endif // wxUSE_SPLINES
     bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
             wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
index 7f2abb4bf673e35a80db3f864cc43cd8bc643cc8..fc9f9477a2b0677873cbd46ae390a6e13987eea9 100644 (file)
@@ -200,7 +200,7 @@ protected:
     virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
 #if wxUSE_SPLINES
-    virtual void DoDrawSpline(wxList *points);
+    virtual void DoDrawSpline(const wxPointList *points);
 #endif
 
     virtual void DoCrossHair(wxCoord x, wxCoord y);
index 28f3ab3db7c8f91ef76a4c2d024dbb4ccacbca84..a6e495af411513c3ce188dc9e3e7c97cec29a1a3 100644 (file)
@@ -843,16 +843,15 @@ wxImplDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
     return rc;
 }
 
-#if 0
-void wxImplDC::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
+void wxImplDC::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffset)
 {
     int n = list->GetCount();
     wxPoint *points = new wxPoint[n];
 
     int i = 0;
-    for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
+    for ( wxPointList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
     {
-        wxPoint *point = (wxPoint *)node->GetData();
+        wxPoint *point = node->GetData();
         points[i].x = point->x;
         points[i].y = point->y;
     }
@@ -862,7 +861,7 @@ void wxImplDC::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
     delete [] points;
 }
 
-void wxImplDC::DrawPolygon(const wxList *list,
+void wxImplDC::DrawPolygon(const wxPointList *list,
                            wxCoord xoffset, wxCoord yoffset,
                            int fillStyle)
 {
@@ -870,9 +869,9 @@ void wxImplDC::DrawPolygon(const wxList *list,
     wxPoint *points = new wxPoint[n];
 
     int i = 0;
-    for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
+    for ( wxPointList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
     {
-        wxPoint *point = (wxPoint *)node->GetData();
+        wxPoint *point = node->GetData();
         points[i].x = point->x;
         points[i].y = point->y;
     }
@@ -881,7 +880,6 @@ void wxImplDC::DrawPolygon(const wxList *list,
 
     delete [] points;
 }
-#endif
 
 void
 wxImplDC::DoDrawPolyPolygon(int n,
@@ -928,39 +926,36 @@ wxImplDC::DoDrawPolyPolygon(int n,
 
 #if wxUSE_SPLINES
 
-// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
 void wxImplDC::DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3)
 {
-    wxList point_list;
+    wxPointList point_list;
 
     wxPoint *point1 = new wxPoint;
     point1->x = x1; point1->y = y1;
-    point_list.Append((wxObject*)point1);
+    point_list.Append( point1 );
 
     wxPoint *point2 = new wxPoint;
     point2->x = x2; point2->y = y2;
-    point_list.Append((wxObject*)point2);
+    point_list.Append( point2 );
 
     wxPoint *point3 = new wxPoint;
     point3->x = x3; point3->y = y3;
-    point_list.Append((wxObject*)point3);
+    point_list.Append( point3 );
 
     DoDrawSpline(&point_list);
 
-    for( wxList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() )
+    for( wxPointList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() )
     {
-        wxPoint *p = (wxPoint *)node->GetData();
+        wxPoint *p = node->GetData();
         delete p;
     }
 }
 
 void wxImplDC::DoDrawSpline(int n, wxPoint points[])
 {
-    wxList list;
+    wxPointList list;
     for (int i =0; i < n; i++)
-    {
-        list.Append((wxObject*)&points[i]);
-    }
+        list.Append( &points[i] );
 
     DoDrawSpline(&list);
 }
@@ -977,7 +972,7 @@ void wx_spline_push(double x1, double y1, double x2, double y2, double x3, doubl
 static bool wx_spline_add_point(double x, double y);
 static void wx_spline_draw_point_array(wxDC *dc);
 
-wxList wx_spline_point_list;
+wxPointList wx_spline_point_list;
 
 #define                half(z1, z2)        ((z1+z2)/2.0)
 #define                THRESHOLD        5
@@ -1060,27 +1055,24 @@ int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
 
 static bool wx_spline_add_point(double x, double y)
 {
-  wxPoint *point = new wxPoint ;
-  point->x = (int) x;
-  point->y = (int) y;
-  wx_spline_point_list.Append((wxObject*)point);
-  return true;
+    wxPoint *point = new wxPoint( wxRound(x), wxRound(y) );
+    wx_spline_point_list.Append(point );
+    return true;
 }
 
 static void wx_spline_draw_point_array(wxDC *dc)
 {
-//  dc->DrawLines(&wx_spline_point_list, 0, 0 );  wxList
-  wxList::compatibility_iterator node = wx_spline_point_list.GetFirst();
-  while (node)
-  {
-    wxPoint *point = (wxPoint *)node->GetData();
-    delete point;
-    wx_spline_point_list.Erase(node);
-    node = wx_spline_point_list.GetFirst();
-  }
+    wxPointList::compatibility_iterator node = wx_spline_point_list.GetFirst();
+    while (node)
+    {
+        wxPoint *point = node->GetData();
+        delete point;
+        wx_spline_point_list.Erase(node);
+        node = wx_spline_point_list.GetFirst();
+    }
 }
 
-void wxImplDC::DoDrawSpline( wxList *points )
+void wxImplDC::DoDrawSpline( const wxPointList *points )
 {
     wxCHECK_RET( IsOk(), wxT("invalid window dc") );
 
@@ -1088,7 +1080,7 @@ void wxImplDC::DoDrawSpline( wxList *points )
     double           cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
     double           x1, y1, x2, y2;
 
-    wxList::compatibility_iterator node = points->GetFirst();
+    wxPointList::compatibility_iterator node = points->GetFirst();
     if (!node)
         // empty list
         return;
@@ -1099,7 +1091,7 @@ void wxImplDC::DoDrawSpline( wxList *points )
     y1 = p->y;
 
     node = node->GetNext();
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
 
     x2 = p->x;
     y2 = p->y;
@@ -1116,7 +1108,7 @@ void wxImplDC::DoDrawSpline( wxList *points )
 #endif // !wxUSE_STL
           )
     {
-        p = (wxPoint *)node->GetData();
+        p = node->GetData();
         x1 = x2;
         y1 = y2;
         x2 = p->x;
@@ -1823,15 +1815,16 @@ wxDCBase::DoStretchBlit(wxCoord xdest, wxCoord ydest,
 // line/polygons
 // ----------------------------------------------------------------------------
 
-void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
+void wxDCBase::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffset)
 {
-    int n = list->GetCount();
+    unsigned int n = list->GetCount();
     wxPoint *points = new wxPoint[n];
 
-    int i = 0;
-    for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
+    unsigned int i = 0;
+    wxPointList::compatibility_iterator node;
+    for ( node = list->GetFirst(); node; node = node->GetNext(), i++ )
     {
-        wxPoint *point = (wxPoint *)node->GetData();
+        wxPoint *point = node->GetData();
         points[i].x = point->x;
         points[i].y = point->y;
     }
@@ -1841,18 +1834,63 @@ void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
     delete [] points;
 }
 
+#if WXWIN_COMPATIBILITY_2_8
+void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset )
+{
+    unsigned int n = list->GetCount();
+    wxPoint *points = new wxPoint[n];
 
-void wxDCBase::DrawPolygon(const wxList *list,
+    unsigned int i = 0;
+    wxNode *node;
+    for ( node = list->GetFirst(); node; node = node->GetNext(), i++ )
+    {
+        wxPoint *point = (wxPoint*) node->GetData();
+        points[i].x = point->x;
+        points[i].y = point->y;
+    }
+
+    DoDrawLines(n, points, xoffset, yoffset);
+
+    delete [] points;
+}
+#endif  // WXWIN_COMPATIBILITY_2_8
+
+
+void wxDCBase::DrawPolygon(const wxPointList *list,
                            wxCoord xoffset, wxCoord yoffset,
                            int fillStyle)
 {
-    int n = list->GetCount();
+    unsigned int n = list->GetCount();
     wxPoint *points = new wxPoint[n];
 
-    int i = 0;
-    for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
+    unsigned int i = 0;
+    wxPointList::compatibility_iterator node;
+    for ( node = list->GetFirst(); node; node = node->GetNext(), i++ )
+    {
+        wxPoint *point = node->GetData();
+        points[i].x = point->x;
+        points[i].y = point->y;
+    }
+
+    DoDrawPolygon(n, points, xoffset, yoffset, fillStyle);
+
+    delete [] points;
+}
+
+
+#if WXWIN_COMPATIBILITY_2_8
+void wxDCBase::DrawPolygon(const wxList *list,
+                     wxCoord xoffset, wxCoord yoffset,
+                     int fillStyle )
+{
+    unsigned int n = list->GetCount();
+    wxPoint *points = new wxPoint[n];
+
+    unsigned int i = 0;
+    wxNode *node;
+    for ( node = list->GetFirst(); node; node = node->GetNext(), i++ )
     {
-        wxPoint *point = (wxPoint *)node->GetData();
+        wxPoint *point = (wxPoint*) node->GetData();
         points[i].x = point->x;
         points[i].y = point->y;
     }
@@ -1861,6 +1899,7 @@ void wxDCBase::DrawPolygon(const wxList *list,
 
     delete [] points;
 }
+#endif  // WXWIN_COMPATIBILITY_2_8
 
 void
 wxDCBase::DoDrawPolyPolygon(int n,
@@ -1911,39 +1950,36 @@ wxDCBase::DoDrawPolyPolygon(int n,
 
 #if wxUSE_SPLINES
 
-// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
 void wxDCBase::DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3)
 {
-    wxList point_list;
+    wxPointList point_list;
 
     wxPoint *point1 = new wxPoint;
     point1->x = x1; point1->y = y1;
-    point_list.Append((wxObject*)point1);
+    point_list.Append( point1 );
 
     wxPoint *point2 = new wxPoint;
     point2->x = x2; point2->y = y2;
-    point_list.Append((wxObject*)point2);
+    point_list.Append( point2 );
 
     wxPoint *point3 = new wxPoint;
     point3->x = x3; point3->y = y3;
-    point_list.Append((wxObject*)point3);
+    point_list.Append( point3 );
 
     DrawSpline(&point_list);
 
-    for( wxList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() )
+    for( wxPointList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() )
     {
-        wxPoint *p = (wxPoint *)node->GetData();
+        wxPoint *p = node->GetData();
         delete p;
     }
 }
 
 void wxDCBase::DrawSpline(int n, wxPoint points[])
 {
-    wxList list;
+    wxPointList list;
     for (int i =0; i < n; i++)
-    {
-        list.Append((wxObject*)&points[i]);
-    }
+        list.Append( &points[i] );
 
     DrawSpline(&list);
 }
@@ -1960,7 +1996,7 @@ void wx_spline_push(double x1, double y1, double x2, double y2, double x3, doubl
 static bool wx_spline_add_point(double x, double y);
 static void wx_spline_draw_point_array(wxDCBase *dc);
 
-wxList wx_spline_point_list;
+wxPointList wx_spline_point_list;
 
 #define                half(z1, z2)        ((z1+z2)/2.0)
 #define                THRESHOLD        5
@@ -2043,27 +2079,39 @@ int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
 
 static bool wx_spline_add_point(double x, double y)
 {
-  wxPoint *point = new wxPoint ;
-  point->x = (int) x;
-  point->y = (int) y;
-  wx_spline_point_list.Append((wxObject*)point);
-  return true;
+    wxPoint *point = new wxPoint( wxRound(x), wxRound(y) );
+    wx_spline_point_list.Append( point );
+    return true;
 }
 
 static void wx_spline_draw_point_array(wxDCBase *dc)
 {
-  dc->DrawLines(&wx_spline_point_list, 0, 0 );
-  wxList::compatibility_iterator node = wx_spline_point_list.GetFirst();
-  while (node)
-  {
-    wxPoint *point = (wxPoint *)node->GetData();
-    delete point;
-    wx_spline_point_list.Erase(node);
-    node = wx_spline_point_list.GetFirst();
-  }
+    dc->DrawLines(&wx_spline_point_list, 0, 0 );
+    wxPointList::compatibility_iterator node = wx_spline_point_list.GetFirst();
+    while (node)
+    {
+        wxPoint *point = node->GetData();
+        delete point;
+        wx_spline_point_list.Erase(node);
+        node = wx_spline_point_list.GetFirst();
+    }
 }
 
-void wxDCBase::DoDrawSpline( wxList *points )
+#if WXWIN_COMPATIBILITY_2_8
+void wxDCBase::DrawSpline(const wxList *points)
+{
+    wxPointList list;
+    wxNode *node = points->GetFirst();
+    while (node)
+    {
+        list.Append( (wxPoint*) node->GetData() );
+        node = node->GetNext();
+    }
+    DoDrawSpline( &list );
+}
+#endif  // WXWIN_COMPATIBILITY_2_8
+
+void wxDCBase::DoDrawSpline( const wxPointList *points )
 {
     wxCHECK_RET( Ok(), wxT("invalid window dc") );
 
@@ -2071,18 +2119,18 @@ void wxDCBase::DoDrawSpline( wxList *points )
     double           cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
     double           x1, y1, x2, y2;
 
-    wxList::compatibility_iterator node = points->GetFirst();
+    wxPointList::compatibility_iterator node = points->GetFirst();
     if (!node)
         // empty list
         return;
 
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
 
     x1 = p->x;
     y1 = p->y;
 
     node = node->GetNext();
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
 
     x2 = p->x;
     y2 = p->y;
@@ -2099,7 +2147,7 @@ void wxDCBase::DoDrawSpline( wxList *points )
 #endif // !wxUSE_STL
           )
     {
-        p = (wxPoint *)node->GetData();
+        p = node->GetData();
         x1 = x2;
         y1 = y2;
         x2 = p->x;
@@ -2632,22 +2680,22 @@ void wxDCBase::DoDrawEllipticArcRot( wxCoord x, wxCoord y,
                                      wxCoord w, wxCoord h,
                                      double sa, double ea, double angle )
 {
-    wxList list;
+    wxPointList list;
 
     CalculateEllipticPoints( &list, x, y, w, h, sa, ea );
     Rotate( &list, angle, wxPoint( x+w/2, y+h/2 ) );
 
     // Add center (for polygon/pie)
-    list.Append( (wxObject*) new wxPoint( x+w/2, y+h/2 ) );
+    list.Append( new wxPoint( x+w/2, y+h/2 ) );
 
     // copy list into array and delete list elements
     int n = list.GetCount();
     wxPoint *points = new wxPoint[n];
     int i = 0;
-    wxNode* node = 0;
+    wxPointList::compatibility_iterator node;
     for ( node = list.GetFirst(); node; node = node->GetNext(), i++ )
     {
-        wxPoint *point = (wxPoint *)node->GetData();
+        wxPoint *point = node->GetData();
         points[i].x = point->x;
         points[i].y = point->y;
         delete point;
@@ -2673,16 +2721,17 @@ void wxDCBase::DoDrawEllipticArcRot( wxCoord x, wxCoord y,
 
 } // DrawEllipticArcRot
 
-void wxDCBase::Rotate( wxList* points, double angle, wxPoint center )
+void wxDCBase::Rotate( wxPointList* points, double angle, wxPoint center )
 {
     if( angle != 0.0 )
     {
         double pi(M_PI);
         double dSinA = -sin(angle*2.0*pi/360.0);
         double dCosA = cos(angle*2.0*pi/360.0);
-        for ( wxNode* node = points->GetFirst(); node; node = node->GetNext() )
+        wxPointList::compatibility_iterator node;
+        for ( node = points->GetFirst(); node; node = node->GetNext() )
         {
-            wxPoint* point = (wxPoint*)node->GetData();
+            wxPoint* point = node->GetData();
 
             // transform coordinates, if necessary
             if( center.x ) point->x -= center.x;
@@ -2700,7 +2749,7 @@ void wxDCBase::Rotate( wxList* points, double angle, wxPoint center )
     }
 }
 
-void wxDCBase::CalculateEllipticPoints( wxList* points,
+void wxDCBase::CalculateEllipticPoints( wxPointList* points,
                                         wxCoord xStart, wxCoord yStart,
                                         wxCoord w, wxCoord h,
                                         double sa, double ea )
@@ -2773,7 +2822,7 @@ void wxDCBase::CalculateEllipticPoints( wxList* points,
     long y2_old = 0;
     long y_old = 0;
     // Lists for quadrant 1 to 4
-    wxList pointsarray[4];
+    wxPointList pointsarray[4];
     // Calculate points for first quadrant and set in all quadrants
     for( x = 0; x <= a; ++x )
     {
@@ -2792,40 +2841,41 @@ void wxDCBase::CalculateEllipticPoints( wxList* points,
         {
             int x1 = x - 1;
             // remove points on the same line
-            pointsarray[0].Insert( (wxObject*) new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) );
-            pointsarray[1].Append( (wxObject*) new wxPoint( xCenter - x1, yCenter - y_old ) );
-            pointsarray[2].Insert( (wxObject*) new wxPoint( xCenter - x1, yCenter + y_old - decrY ) );
-            pointsarray[3].Append( (wxObject*) new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) );
+            pointsarray[0].Insert( new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) );
+            pointsarray[1].Append( new wxPoint( xCenter - x1, yCenter - y_old ) );
+            pointsarray[2].Insert( new wxPoint( xCenter - x1, yCenter + y_old - decrY ) );
+            pointsarray[3].Append( new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) );
         } // set point
     } // calculate point
 
     // Starting and/or ending points for the quadrants, first quadrant gets both.
-    pointsarray[0].Insert( (wxObject*) new wxPoint( xCenter + a - decrX, yCenter ) );
-    pointsarray[0].Append( (wxObject*) new wxPoint( xCenter, yCenter - b ) );
-    pointsarray[1].Append( (wxObject*) new wxPoint( xCenter - a, yCenter ) );
-    pointsarray[2].Append( (wxObject*) new wxPoint( xCenter, yCenter + b - decrY ) );
-    pointsarray[3].Append( (wxObject*) new wxPoint( xCenter + a - decrX, yCenter ) );
+    pointsarray[0].Insert( new wxPoint( xCenter + a - decrX, yCenter ) );
+    pointsarray[0].Append( new wxPoint( xCenter, yCenter - b ) );
+    pointsarray[1].Append( new wxPoint( xCenter - a, yCenter ) );
+    pointsarray[2].Append( new wxPoint( xCenter, yCenter + b - decrY ) );
+    pointsarray[3].Append( new wxPoint( xCenter + a - decrX, yCenter ) );
 
     // copy quadrants in original list
     if( bUseAngles )
     {
         // Copy the right part of the points in the lists
         // and delete the wxPoints, because they do not leave this method.
-        points->Append( (wxObject*) new wxPoint( xsa, ysa ) );
+        points->Append( new wxPoint( xsa, ysa ) );
         int q = sq;
         bool bStarted = false;
         bool bReady = false;
         bool bForceTurn = ( sq == eq && sa > ea );
         while( !bReady )
         {
-            for( wxNode *node = pointsarray[q].GetFirst(); node; node = node->GetNext() )
+            wxPointList::compatibility_iterator node;
+            for( node = pointsarray[q].GetFirst(); node; node = node->GetNext() )
             {
                 // once: go to starting point in start quadrant
                 if( !bStarted &&
                     (
-                      ( (wxPoint*) node->GetData() )->x < xsa+1 && q <= 1
+                      node->GetData()->x < xsa+1 && q <= 1
                       ||
-                      ( (wxPoint*) node->GetData() )->x > xsa-1 && q >= 2
+                      node->GetData()->x > xsa-1 && q >= 2
                     )
                   )
                 {
@@ -2843,10 +2893,10 @@ void wxDCBase::CalculateEllipticPoints( wxList* points,
                       )
                     {
                         // copy point
-                        wxPoint* pPoint = new wxPoint( *((wxPoint*) node->GetData() ) );
-                        points->Append( (wxObject*) pPoint );
+                        wxPoint* pPoint = new wxPoint( *(node->GetData()) );
+                        points->Append( pPoint );
                     }
-                    else if( q == eq && !bForceTurn || ( (wxPoint*) node->GetData() )->x == xea)
+                    else if( q == eq && !bForceTurn || node->GetData()->x == xea)
                     {
                         bReady = true;
                     }
@@ -2857,40 +2907,41 @@ void wxDCBase::CalculateEllipticPoints( wxList* points,
             bForceTurn = false;
             bStarted = true;
         } // while not bReady
-        points->Append( (wxObject*) new wxPoint( xea, yea ) );
+        points->Append( new wxPoint( xea, yea ) );
 
         // delete points
         for( q = 0; q < 4; ++q )
         {
-            for( wxNode *node = pointsarray[q].GetFirst(); node; node = node->GetNext() )
+            wxPointList::compatibility_iterator node;
+            for( node = pointsarray[q].GetFirst(); node; node = node->GetNext() )
             {
-                wxPoint *p = (wxPoint *)node->GetData();
+                wxPoint *p = node->GetData();
                 delete p;
             }
         }
     }
     else
     {
-        wxNode* node;
+        wxPointList::compatibility_iterator node;
         // copy whole ellipse, wxPoints will be deleted outside
         for( node = pointsarray[0].GetFirst(); node; node = node->GetNext() )
         {
-            wxObject *p = node->GetData();
+            wxPoint *p = node->GetData();
             points->Append( p );
         }
         for( node = pointsarray[1].GetFirst(); node; node = node->GetNext() )
         {
-            wxObject *p = node->GetData();
+            wxPoint *p = node->GetData();
             points->Append( p );
         }
         for( node = pointsarray[2].GetFirst(); node; node = node->GetNext() )
         {
-            wxObject *p = node->GetData();
+            wxPoint *p = node->GetData();
             points->Append( p );
         }
         for( node = pointsarray[3].GetFirst(); node; node = node->GetNext() )
         {
-            wxObject *p = node->GetData();
+            wxPoint *p = node->GetData();
             points->Append( p );
         }
     } // not iUseAngles
index 420e9039bbb2ae64fe737c8d17a34148f2f72368..24801af63c298b884b5f809daa8d19b07b877b70 100644 (file)
@@ -541,7 +541,7 @@ void wxGCDC::DoDrawLines(int n, wxPoint points[],
 }
 
 #if wxUSE_SPLINES
-void wxGCDC::DoDrawSpline(wxList *points)
+void wxGCDC::DoDrawSpline(const wxPointList *points)
 {
     wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") );
 
@@ -550,18 +550,18 @@ void wxGCDC::DoDrawSpline(wxList *points)
 
     wxGraphicsPath path = m_graphicContext->CreatePath();
 
-    wxList::compatibility_iterator node = points->GetFirst();
-    if (node == wxList::compatibility_iterator())
+    wxPointList::compatibility_iterator node = points->GetFirst();
+    if (node == wxPointList::compatibility_iterator())
         // empty list
         return;
 
-    wxPoint *p = (wxPoint *)node->GetData();
+    wxPoint *p = node->GetData();
 
     wxCoord x1 = p->x;
     wxCoord y1 = p->y;
 
     node = node->GetNext();
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
 
     wxCoord x2 = p->x;
     wxCoord y2 = p->y;
@@ -579,7 +579,7 @@ void wxGCDC::DoDrawSpline(wxList *points)
 #endif // !wxUSE_STL
 
     {
-        p = (wxPoint *)node->GetData();
+        p = node->GetData();
         x1 = x2;
         y1 = y2;
         x2 = p->x;
index 7b6e3db37c92949066c8d8798a9ab24ddd1bcdc6..fecfa23638286575e234f20e4fbb66c984d5c24c 100644 (file)
@@ -58,6 +58,10 @@ WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle;
 const wxSize wxDefaultSize(wxDefaultCoord, wxDefaultCoord);
 const wxPoint wxDefaultPosition(wxDefaultCoord, wxDefaultCoord);
 
+#include "wx/listimpl.cpp"
+WX_DEFINE_LIST(wxPointList);
+
+
 #if wxUSE_EXTENDED_RTTI
 
 // wxPoint
index 1af7e67852bdd5a61ed992a73f82dac695a31d2b..d0b8b3fa36b9aea113f6e1c7641032455a8b53b2 100644 (file)
@@ -1470,7 +1470,7 @@ void wxPostScriptDC::SetLogicalFunction (int WXUNUSED(function))
 }
 
 #if wxUSE_SPLINES
-void wxPostScriptDC::DoDrawSpline( wxList *points )
+void wxPostScriptDC::DoDrawSpline( const wxPointList *points )
 {
     wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
 
@@ -1481,13 +1481,13 @@ void wxPostScriptDC::DoDrawSpline( wxList *points )
     double c, d, x1, y1, x2, y2, x3, y3;
     wxPoint *p, *q;
 
-    wxList::compatibility_iterator node = points->GetFirst();
-    p = (wxPoint *)node->GetData();
+    wxPointList::compatibility_iterator node = points->GetFirst();
+    p = node->GetData();
     x1 = p->x;
     y1 = p->y;
 
     node = node->GetNext();
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
     c = p->x;
     d = p->y;
     x3 =
@@ -1516,7 +1516,7 @@ void wxPostScriptDC::DoDrawSpline( wxList *points )
     node = node->GetNext();
     while (node)
     {
-        q = (wxPoint *)node->GetData();
+        q = node->GetData();
 
         x1 = x3;
         y1 = y3;
index 344569826a31d1fa7d05adda24be51f0452ad57f..c2d2f3b7b6ea40bd06513d13d7235aace481757e 100644 (file)
@@ -158,6 +158,8 @@ public:
         (GnomePrintConfig *config, const guchar *key), (config, key), NULL )
     wxDL_METHOD_DEFINE( gboolean, gnome_print_config_get_length,
         (GnomePrintConfig *config, const guchar *key, gdouble *val, const GnomePrintUnit **unit), (config, key, val, unit), false )
+    wxDL_METHOD_DEFINE( gboolean, gnome_print_config_get_boolean,
+        (GnomePrintConfig *config, const guchar *key, gboolean *val), (config, key, val), false )
 
     wxDL_METHOD_DEFINE( GtkWidget*, gnome_print_dialog_new,
         (GnomePrintJob *gpj, const guchar *title, gint flags), (gpj, title, flags), NULL )
@@ -265,6 +267,7 @@ bool wxGnomePrintLibrary::InitializeMethods()
     
     wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_get );
     wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_get_length );
+    wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_get_boolean );
 
     wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_new );
     wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_construct_range_page );
@@ -308,6 +311,28 @@ bool wxGnomePrintNativeData::TransferTo( wxPrintData &data )
     else
         data.SetOrientation( wxPORTRAIT );
     g_free( res );
+
+    res = gs_libGnomePrint->gnome_print_config_get( m_config,
+            (guchar*)(char*)GNOME_PRINT_KEY_OUTPUT_FILENAME );
+    if (res)
+    {
+        data.SetFilename( wxConvFile.cMB2WX( (const char*) res ) );
+        wxPrintf( "filename %s\n", data.GetFilename() );
+        g_free( res );
+    }
+    else
+    {
+        data.SetFilename( wxEmptyString );
+    }
+
+    gboolean ret;
+    if (gs_libGnomePrint->gnome_print_config_get_boolean( m_config,
+            (guchar*)(char*)GNOME_PRINT_KEY_COLLATE, &ret))
+    {
+        data.SetCollate( ret );
+    }
+
+    // gnome_print_v
     
     return true;
 }
@@ -1377,20 +1402,20 @@ void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord
 }
 
 #if wxUSE_SPLINES
-void wxGnomePrintDC::DoDrawSpline(wxList *points)
+void wxGnomePrintDC::DoDrawSpline(const wxPointList *points)
 {
     SetPen (m_pen);
 
     double c, d, x1, y1, x2, y2, x3, y3;
     wxPoint *p, *q;
 
-    wxList::compatibility_iterator node = points->GetFirst();
-    p = (wxPoint *)node->GetData();
+    wxPointList::compatibility_iterator node = points->GetFirst();
+    p = node->GetData();
     x1 = p->x;
     y1 = p->y;
 
     node = node->GetNext();
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
     c = p->x;
     d = p->y;
     x3 =
@@ -1408,7 +1433,7 @@ void wxGnomePrintDC::DoDrawSpline(wxList *points)
     node = node->GetNext();
     while (node)
     {
-        q = (wxPoint *)node->GetData();
+        q = node->GetData();
 
         x1 = x3;
         y1 = y3;
index 24b50d68ef2c27648d14cabc292d59cdb120d607..cf5103035307e937022e5112da26a7cec0a03259 100644 (file)
@@ -1505,20 +1505,20 @@ void wxGtkPrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord he
 }
 
 #if wxUSE_SPLINES
-void wxGtkPrintDC::DoDrawSpline(wxList *points)
+void wxGtkPrintDC::DoDrawSpline(const wxPointList *points)
 {
     SetPen (m_pen);
 
     double c, d, x1, y1, x2, y2, x3, y3;
     wxPoint *p, *q;
 
-    wxList::compatibility_iterator node = points->GetFirst();
-    p = (wxPoint *)node->GetData();
+    wxPointList::compatibility_iterator node = points->GetFirst();
+    p = node->GetData();
     x1 = p->x;
     y1 = p->y;
 
     node = node->GetNext();
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
     c = p->x;
     d = p->y;
     x3 =
@@ -1536,7 +1536,7 @@ void wxGtkPrintDC::DoDrawSpline(wxList *points)
     node = node->GetNext();
     while (node)
     {
-        q = (wxPoint *)node->GetData();
+        q = node->GetData();
 
         x1 = x3;
         y1 = y3;
index d1ef3afda27e39003400ca520954010e31a4420e..56748f75185151b079b48008ecb9eb04b6f262c4 100644 (file)
@@ -997,7 +997,7 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 }
 
 #if wxUSE_SPLINES
-void wxDC::DoDrawSpline(wxList *points)
+void wxDC::DoDrawSpline(const wxPointList *points)
 {
 #ifdef  __WXWINCE__
     // WinCE does not support ::PolyBezier so use generic version
@@ -1029,8 +1029,8 @@ void wxDC::DoDrawSpline(wxList *points)
     size_t bezier_pos = 0;
     wxCoord x1, y1, x2, y2, cx1, cy1, cx4, cy4;
 
-    wxList::compatibility_iterator node = points->GetFirst();
-    wxPoint *p = (wxPoint *)node->GetData();
+    wxPointList::compatibility_iterator node = points->GetFirst();
+    wxPoint *p = node->GetData();
     lppt[ bezier_pos ].x = x1 = p->x;
     lppt[ bezier_pos ].y = y1 = p->y;
     bezier_pos++;
@@ -1038,7 +1038,7 @@ void wxDC::DoDrawSpline(wxList *points)
     bezier_pos++;
 
     node = node->GetNext();
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
 
     x2 = p->x;
     y2 = p->y;