Use wxPointList instead of wxList in wxDC code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-10-19 14:53:55 +00:00
parent 24b209464f
commit b0d7707bc4
15 changed files with 259 additions and 174 deletions

View 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 adding the optional offset coordinate. The current pen is
used for drawing the lines. 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 This method uses a list of wxPoints, adding the optional offset
with a type-safe version. It uses a wxList of pointers to coordinate. The programmer is responsible for deleting the list
wxPoints, adding the optional offset coordinate. The programmer of points.
is responsible for deleting the list of points.
\pythonnote{The wxPython version of this method accepts a Python list \pythonnote{The wxPython version of this method accepts a Python list
of wxPoint objects.} of wxPoint objects.}
@@ -386,13 +385,11 @@ of wxPoint objects.}
Draws a filled polygon using an array of {\it points} of size {\it n}, Draws a filled polygon using an array of {\it points} of size {\it n},
adding the optional offset coordinate. 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}} \param{int }{fill\_style = wxODDEVEN\_RULE}}
This method is deprecated and will be removed or replaced This method draws a filled polygon using a list of wxPoints,
with a type-safe version. It draws a filled polygon using adding the optional offset coordinate.
a list of pointers to wxPoints, adding the optional offset
coordinate.
The last argument specifies the fill rule: {\bf wxODDEVEN\_RULE} (the The last argument specifies the fill rule: {\bf wxODDEVEN\_RULE} (the
default) or {\bf wxWINDING\_RULE}. default) or {\bf wxWINDING\_RULE}.
@@ -500,10 +497,9 @@ the rectangle.
Draws a spline between all given control points, using the current Draws a spline between all given control points, using the current
pen. 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 Draws a spline between all given control points.
pen. Doesn't delete the wxList and contents.
\func{void}{DrawSpline}{\param{wxCoord}{ x1}, \param{wxCoord}{ y1}, \param{wxCoord}{ x2}, \param{wxCoord}{ y2}, \param{wxCoord}{ x3}, \param{wxCoord}{ y3}} \func{void}{DrawSpline}{\param{wxCoord}{ x1}, \param{wxCoord}{ y1}, \param{wxCoord}{ x2}, \param{wxCoord}{ y2}, \param{wxCoord}{ x3}, \param{wxCoord}{ y3}}

View File

@@ -26,7 +26,6 @@
#include "wx/brush.h" #include "wx/brush.h"
#include "wx/pen.h" #include "wx/pen.h"
#include "wx/palette.h" #include "wx/palette.h"
#include "wx/list.h" // we use wxList in inline functions
#include "wx/dynarray.h" #include "wx/dynarray.h"
#include "wx/math.h" #include "wx/math.h"
#include "wx/image.h" #include "wx/image.h"
@@ -441,7 +440,7 @@ public:
#if wxUSE_SPLINES #if wxUSE_SPLINES
virtual void DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3); 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(int n, wxPoint points[]);
virtual void DoDrawSpline(wxList *points); virtual void DoDrawSpline(const wxPointList *points);
#endif #endif
private: private:
@@ -841,7 +840,7 @@ public:
#if 0 #if 0
// needs to be removed // needs to be removed
void DrawLines(const wxList *list, void DrawLines(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0) wxCoord xoffset = 0, wxCoord yoffset = 0)
#endif #endif
@@ -852,7 +851,7 @@ public:
#if 0 #if 0
// needs to be removed // needs to be removed
void DrawPolygon(const wxList *list, void DrawPolygon(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0, wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE) int fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); } { m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
@@ -975,12 +974,8 @@ public:
{ m_pimpl->DoDrawSpline(x1,y1,x2,y2,x3,y3); } { m_pimpl->DoDrawSpline(x1,y1,x2,y2,x3,y3); }
void DrawSpline(int n, wxPoint points[]) void DrawSpline(int n, wxPoint points[])
{ m_pimpl->DoDrawSpline(n,points); } { m_pimpl->DoDrawSpline(n,points); }
void DrawSpline(const wxPointList *points)
#if 0
// needs to be removed
void DrawSpline(wxList *points)
{ m_pimpl->DoDrawSpline(points); } { m_pimpl->DoDrawSpline(points); }
#endif
#endif // wxUSE_SPLINES #endif // wxUSE_SPLINES
@@ -1149,18 +1144,30 @@ public:
void DrawLines(int n, wxPoint points[], void DrawLines(int n, wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0) wxCoord xoffset = 0, wxCoord yoffset = 0)
{ DoDrawLines(n, points, xoffset, yoffset); } { DoDrawLines(n, points, xoffset, yoffset); }
void DrawLines(const wxList *list, void DrawLines(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0); 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[], void DrawPolygon(int n, wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0, wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE) int fillStyle = wxODDEVEN_RULE)
{ DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } { DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
void DrawPolygon(const wxList *list, void DrawPolygon(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0, wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE); 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[], void DrawPolyPolygon(int n, int count[], wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0, wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE) int fillStyle = wxODDEVEN_RULE)
@@ -1272,13 +1279,17 @@ public:
} }
#if wxUSE_SPLINES #if wxUSE_SPLINES
// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
void DrawSpline(wxCoord x1, wxCoord y1, void DrawSpline(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2, wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3); wxCoord x3, wxCoord y3);
void DrawSpline(int n, wxPoint points[]); 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 #endif // wxUSE_SPLINES
// Eventually we will have wxUSE_GENERIC_DRAWELLIPSE // 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 angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle).
* \param center Center of rotation. * \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 // used by DrawEllipticArcRot
// Careful: wxList gets filled with points you have to delete later. // Careful: wxList gets filled with points you have to delete later.
void CalculateEllipticPoints( wxList* points, void CalculateEllipticPoints( wxPointList* points,
wxCoord xStart, wxCoord yStart, wxCoord xStart, wxCoord yStart,
wxCoord w, wxCoord h, wxCoord w, wxCoord h,
double sa, double ea ); double sa, double ea );
@@ -1710,7 +1721,7 @@ protected:
virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
#if wxUSE_SPLINES #if wxUSE_SPLINES
virtual void DoDrawSpline(wxList *points); virtual void DoDrawSpline(const wxPointList *points);
#endif #endif
protected: protected:

View File

@@ -110,7 +110,7 @@ protected:
virtual void DoDrawPoint(wxCoord x, wxCoord y); virtual void DoDrawPoint(wxCoord x, wxCoord y);
#if wxUSE_SPLINES #if wxUSE_SPLINES
virtual void DoDrawSpline(wxList *points); virtual void DoDrawSpline(const wxPointList *points);
#endif #endif
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);

View File

@@ -419,6 +419,7 @@ inline wxPoint operator-(const wxPoint& p)
return wxPoint(-p.x, -p.y); return wxPoint(-p.x, -p.y);
} }
WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxRect // wxRect

View File

@@ -105,7 +105,7 @@ protected:
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES #if wxUSE_SPLINES
void DoDrawSpline(wxList *points); void DoDrawSpline(const wxPointList *points);
#endif // wxUSE_SPLINES #endif // wxUSE_SPLINES
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,

View File

@@ -253,7 +253,7 @@ protected:
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0); void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES #if wxUSE_SPLINES
void DoDrawSpline(wxList *points); void DoDrawSpline(const wxPointList *points);
#endif // wxUSE_SPLINES #endif // wxUSE_SPLINES
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
@@ -274,9 +274,6 @@ protected:
void SetPrintData(const wxPrintData& data); void SetPrintData(const wxPrintData& data);
wxPrintData& GetPrintData() { return m_printData; } wxPrintData& GetPrintData() { return m_printData; }
private:
static float ms_PSScaleFactor;
private: private:
wxPrintData m_printData; wxPrintData m_printData;
PangoContext *m_context; PangoContext *m_context;

View File

@@ -266,7 +266,7 @@ protected:
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0); void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES #if wxUSE_SPLINES
void DoDrawSpline(wxList *points); void DoDrawSpline(const wxPointList *points);
#endif // wxUSE_SPLINES #endif // wxUSE_SPLINES
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,

View File

@@ -200,7 +200,7 @@ protected:
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES #if wxUSE_SPLINES
virtual void DoDrawSpline(wxList *points); virtual void DoDrawSpline(const wxPointList *points);
#endif #endif
virtual void DoCrossHair(wxCoord x, wxCoord y); virtual void DoCrossHair(wxCoord x, wxCoord y);

View File

@@ -843,16 +843,15 @@ wxImplDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
return rc; return rc;
} }
#if 0 void wxImplDC::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffset)
void wxImplDC::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
{ {
int n = list->GetCount(); int n = list->GetCount();
wxPoint *points = new wxPoint[n]; wxPoint *points = new wxPoint[n];
int i = 0; 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].x = point->x;
points[i].y = point->y; points[i].y = point->y;
} }
@@ -862,7 +861,7 @@ void wxImplDC::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
delete [] points; delete [] points;
} }
void wxImplDC::DrawPolygon(const wxList *list, void wxImplDC::DrawPolygon(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset, wxCoord xoffset, wxCoord yoffset,
int fillStyle) int fillStyle)
{ {
@@ -870,9 +869,9 @@ void wxImplDC::DrawPolygon(const wxList *list,
wxPoint *points = new wxPoint[n]; wxPoint *points = new wxPoint[n];
int i = 0; 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].x = point->x;
points[i].y = point->y; points[i].y = point->y;
} }
@@ -881,7 +880,6 @@ void wxImplDC::DrawPolygon(const wxList *list,
delete [] points; delete [] points;
} }
#endif
void void
wxImplDC::DoDrawPolyPolygon(int n, wxImplDC::DoDrawPolyPolygon(int n,
@@ -928,39 +926,36 @@ wxImplDC::DoDrawPolyPolygon(int n,
#if wxUSE_SPLINES #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) 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; wxPoint *point1 = new wxPoint;
point1->x = x1; point1->y = y1; point1->x = x1; point1->y = y1;
point_list.Append((wxObject*)point1); point_list.Append( point1 );
wxPoint *point2 = new wxPoint; wxPoint *point2 = new wxPoint;
point2->x = x2; point2->y = y2; point2->x = x2; point2->y = y2;
point_list.Append((wxObject*)point2); point_list.Append( point2 );
wxPoint *point3 = new wxPoint; wxPoint *point3 = new wxPoint;
point3->x = x3; point3->y = y3; point3->x = x3; point3->y = y3;
point_list.Append((wxObject*)point3); point_list.Append( point3 );
DoDrawSpline(&point_list); 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; delete p;
} }
} }
void wxImplDC::DoDrawSpline(int n, wxPoint points[]) void wxImplDC::DoDrawSpline(int n, wxPoint points[])
{ {
wxList list; wxPointList list;
for (int i =0; i < n; i++) for (int i =0; i < n; i++)
{ list.Append( &points[i] );
list.Append((wxObject*)&points[i]);
}
DoDrawSpline(&list); 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 bool wx_spline_add_point(double x, double y);
static void wx_spline_draw_point_array(wxDC *dc); 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 half(z1, z2) ((z1+z2)/2.0)
#define THRESHOLD 5 #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) static bool wx_spline_add_point(double x, double y)
{ {
wxPoint *point = new wxPoint ; wxPoint *point = new wxPoint( wxRound(x), wxRound(y) );
point->x = (int) x; wx_spline_point_list.Append(point );
point->y = (int) y; return true;
wx_spline_point_list.Append((wxObject*)point);
return true;
} }
static void wx_spline_draw_point_array(wxDC *dc) static void wx_spline_draw_point_array(wxDC *dc)
{ {
// dc->DrawLines(&wx_spline_point_list, 0, 0 ); wxList wxPointList::compatibility_iterator node = wx_spline_point_list.GetFirst();
wxList::compatibility_iterator node = wx_spline_point_list.GetFirst(); while (node)
while (node) {
{ wxPoint *point = node->GetData();
wxPoint *point = (wxPoint *)node->GetData(); delete point;
delete point; wx_spline_point_list.Erase(node);
wx_spline_point_list.Erase(node); node = wx_spline_point_list.GetFirst();
node = wx_spline_point_list.GetFirst(); }
}
} }
void wxImplDC::DoDrawSpline( wxList *points ) void wxImplDC::DoDrawSpline( const wxPointList *points )
{ {
wxCHECK_RET( IsOk(), wxT("invalid window dc") ); 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 cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2; double x1, y1, x2, y2;
wxList::compatibility_iterator node = points->GetFirst(); wxPointList::compatibility_iterator node = points->GetFirst();
if (!node) if (!node)
// empty list // empty list
return; return;
@@ -1099,7 +1091,7 @@ void wxImplDC::DoDrawSpline( wxList *points )
y1 = p->y; y1 = p->y;
node = node->GetNext(); node = node->GetNext();
p = (wxPoint *)node->GetData(); p = node->GetData();
x2 = p->x; x2 = p->x;
y2 = p->y; y2 = p->y;
@@ -1116,7 +1108,7 @@ void wxImplDC::DoDrawSpline( wxList *points )
#endif // !wxUSE_STL #endif // !wxUSE_STL
) )
{ {
p = (wxPoint *)node->GetData(); p = node->GetData();
x1 = x2; x1 = x2;
y1 = y2; y1 = y2;
x2 = p->x; x2 = p->x;
@@ -1823,15 +1815,16 @@ wxDCBase::DoStretchBlit(wxCoord xdest, wxCoord ydest,
// line/polygons // 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]; wxPoint *points = new wxPoint[n];
int i = 0; unsigned int i = 0;
for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ ) 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].x = point->x;
points[i].y = point->y; points[i].y = point->y;
} }
@@ -1841,18 +1834,40 @@ void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
delete [] points; 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, wxCoord xoffset, wxCoord yoffset,
int fillStyle) int fillStyle)
{ {
int n = list->GetCount(); unsigned int n = list->GetCount();
wxPoint *points = new wxPoint[n]; wxPoint *points = new wxPoint[n];
int i = 0; unsigned int i = 0;
for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ ) 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].x = point->x;
points[i].y = point->y; points[i].y = point->y;
} }
@@ -1862,6 +1877,30 @@ void wxDCBase::DrawPolygon(const wxList *list,
delete [] points; 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();
points[i].x = point->x;
points[i].y = point->y;
}
DoDrawPolygon(n, points, xoffset, yoffset, fillStyle);
delete [] points;
}
#endif // WXWIN_COMPATIBILITY_2_8
void void
wxDCBase::DoDrawPolyPolygon(int n, wxDCBase::DoDrawPolyPolygon(int n,
int count[], int count[],
@@ -1911,39 +1950,36 @@ wxDCBase::DoDrawPolyPolygon(int n,
#if wxUSE_SPLINES #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) 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; wxPoint *point1 = new wxPoint;
point1->x = x1; point1->y = y1; point1->x = x1; point1->y = y1;
point_list.Append((wxObject*)point1); point_list.Append( point1 );
wxPoint *point2 = new wxPoint; wxPoint *point2 = new wxPoint;
point2->x = x2; point2->y = y2; point2->x = x2; point2->y = y2;
point_list.Append((wxObject*)point2); point_list.Append( point2 );
wxPoint *point3 = new wxPoint; wxPoint *point3 = new wxPoint;
point3->x = x3; point3->y = y3; point3->x = x3; point3->y = y3;
point_list.Append((wxObject*)point3); point_list.Append( point3 );
DrawSpline(&point_list); 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; delete p;
} }
} }
void wxDCBase::DrawSpline(int n, wxPoint points[]) void wxDCBase::DrawSpline(int n, wxPoint points[])
{ {
wxList list; wxPointList list;
for (int i =0; i < n; i++) for (int i =0; i < n; i++)
{ list.Append( &points[i] );
list.Append((wxObject*)&points[i]);
}
DrawSpline(&list); 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 bool wx_spline_add_point(double x, double y);
static void wx_spline_draw_point_array(wxDCBase *dc); 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 half(z1, z2) ((z1+z2)/2.0)
#define THRESHOLD 5 #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) static bool wx_spline_add_point(double x, double y)
{ {
wxPoint *point = new wxPoint ; wxPoint *point = new wxPoint( wxRound(x), wxRound(y) );
point->x = (int) x; wx_spline_point_list.Append( point );
point->y = (int) y; return true;
wx_spline_point_list.Append((wxObject*)point);
return true;
} }
static void wx_spline_draw_point_array(wxDCBase *dc) static void wx_spline_draw_point_array(wxDCBase *dc)
{ {
dc->DrawLines(&wx_spline_point_list, 0, 0 ); dc->DrawLines(&wx_spline_point_list, 0, 0 );
wxList::compatibility_iterator node = wx_spline_point_list.GetFirst(); wxPointList::compatibility_iterator node = wx_spline_point_list.GetFirst();
while (node) while (node)
{ {
wxPoint *point = (wxPoint *)node->GetData(); wxPoint *point = node->GetData();
delete point; delete point;
wx_spline_point_list.Erase(node); wx_spline_point_list.Erase(node);
node = wx_spline_point_list.GetFirst(); 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") ); 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 cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2; double x1, y1, x2, y2;
wxList::compatibility_iterator node = points->GetFirst(); wxPointList::compatibility_iterator node = points->GetFirst();
if (!node) if (!node)
// empty list // empty list
return; return;
p = (wxPoint *)node->GetData(); p = node->GetData();
x1 = p->x; x1 = p->x;
y1 = p->y; y1 = p->y;
node = node->GetNext(); node = node->GetNext();
p = (wxPoint *)node->GetData(); p = node->GetData();
x2 = p->x; x2 = p->x;
y2 = p->y; y2 = p->y;
@@ -2099,7 +2147,7 @@ void wxDCBase::DoDrawSpline( wxList *points )
#endif // !wxUSE_STL #endif // !wxUSE_STL
) )
{ {
p = (wxPoint *)node->GetData(); p = node->GetData();
x1 = x2; x1 = x2;
y1 = y2; y1 = y2;
x2 = p->x; x2 = p->x;
@@ -2632,22 +2680,22 @@ void wxDCBase::DoDrawEllipticArcRot( wxCoord x, wxCoord y,
wxCoord w, wxCoord h, wxCoord w, wxCoord h,
double sa, double ea, double angle ) double sa, double ea, double angle )
{ {
wxList list; wxPointList list;
CalculateEllipticPoints( &list, x, y, w, h, sa, ea ); CalculateEllipticPoints( &list, x, y, w, h, sa, ea );
Rotate( &list, angle, wxPoint( x+w/2, y+h/2 ) ); Rotate( &list, angle, wxPoint( x+w/2, y+h/2 ) );
// Add center (for polygon/pie) // 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 // copy list into array and delete list elements
int n = list.GetCount(); int n = list.GetCount();
wxPoint *points = new wxPoint[n]; wxPoint *points = new wxPoint[n];
int i = 0; int i = 0;
wxNode* node = 0; wxPointList::compatibility_iterator node;
for ( node = list.GetFirst(); node; node = node->GetNext(), i++ ) 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].x = point->x;
points[i].y = point->y; points[i].y = point->y;
delete point; delete point;
@@ -2673,16 +2721,17 @@ void wxDCBase::DoDrawEllipticArcRot( wxCoord x, wxCoord y,
} // DrawEllipticArcRot } // DrawEllipticArcRot
void wxDCBase::Rotate( wxList* points, double angle, wxPoint center ) void wxDCBase::Rotate( wxPointList* points, double angle, wxPoint center )
{ {
if( angle != 0.0 ) if( angle != 0.0 )
{ {
double pi(M_PI); double pi(M_PI);
double dSinA = -sin(angle*2.0*pi/360.0); double dSinA = -sin(angle*2.0*pi/360.0);
double dCosA = cos(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 // transform coordinates, if necessary
if( center.x ) point->x -= center.x; 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 xStart, wxCoord yStart,
wxCoord w, wxCoord h, wxCoord w, wxCoord h,
double sa, double ea ) double sa, double ea )
@@ -2773,7 +2822,7 @@ void wxDCBase::CalculateEllipticPoints( wxList* points,
long y2_old = 0; long y2_old = 0;
long y_old = 0; long y_old = 0;
// Lists for quadrant 1 to 4 // Lists for quadrant 1 to 4
wxList pointsarray[4]; wxPointList pointsarray[4];
// Calculate points for first quadrant and set in all quadrants // Calculate points for first quadrant and set in all quadrants
for( x = 0; x <= a; ++x ) for( x = 0; x <= a; ++x )
{ {
@@ -2792,40 +2841,41 @@ void wxDCBase::CalculateEllipticPoints( wxList* points,
{ {
int x1 = x - 1; int x1 = x - 1;
// remove points on the same line // remove points on the same line
pointsarray[0].Insert( (wxObject*) new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) ); pointsarray[0].Insert( new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) );
pointsarray[1].Append( (wxObject*) new wxPoint( xCenter - x1, yCenter - y_old ) ); pointsarray[1].Append( new wxPoint( xCenter - x1, yCenter - y_old ) );
pointsarray[2].Insert( (wxObject*) new wxPoint( xCenter - x1, yCenter + y_old - decrY ) ); pointsarray[2].Insert( new wxPoint( xCenter - x1, yCenter + y_old - decrY ) );
pointsarray[3].Append( (wxObject*) new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) ); pointsarray[3].Append( new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) );
} // set point } // set point
} // calculate point } // calculate point
// Starting and/or ending points for the quadrants, first quadrant gets both. // Starting and/or ending points for the quadrants, first quadrant gets both.
pointsarray[0].Insert( (wxObject*) new wxPoint( xCenter + a - decrX, yCenter ) ); pointsarray[0].Insert( new wxPoint( xCenter + a - decrX, yCenter ) );
pointsarray[0].Append( (wxObject*) new wxPoint( xCenter, yCenter - b ) ); pointsarray[0].Append( new wxPoint( xCenter, yCenter - b ) );
pointsarray[1].Append( (wxObject*) new wxPoint( xCenter - a, yCenter ) ); pointsarray[1].Append( new wxPoint( xCenter - a, yCenter ) );
pointsarray[2].Append( (wxObject*) new wxPoint( xCenter, yCenter + b - decrY ) ); pointsarray[2].Append( new wxPoint( xCenter, yCenter + b - decrY ) );
pointsarray[3].Append( (wxObject*) new wxPoint( xCenter + a - decrX, yCenter ) ); pointsarray[3].Append( new wxPoint( xCenter + a - decrX, yCenter ) );
// copy quadrants in original list // copy quadrants in original list
if( bUseAngles ) if( bUseAngles )
{ {
// Copy the right part of the points in the lists // Copy the right part of the points in the lists
// and delete the wxPoints, because they do not leave this method. // 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; int q = sq;
bool bStarted = false; bool bStarted = false;
bool bReady = false; bool bReady = false;
bool bForceTurn = ( sq == eq && sa > ea ); bool bForceTurn = ( sq == eq && sa > ea );
while( !bReady ) 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 // once: go to starting point in start quadrant
if( !bStarted && 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 // copy point
wxPoint* pPoint = new wxPoint( *((wxPoint*) node->GetData() ) ); wxPoint* pPoint = new wxPoint( *(node->GetData()) );
points->Append( (wxObject*) pPoint ); points->Append( pPoint );
} }
else if( q == eq && !bForceTurn || ( (wxPoint*) node->GetData() )->x == xea) else if( q == eq && !bForceTurn || node->GetData()->x == xea)
{ {
bReady = true; bReady = true;
} }
@@ -2857,40 +2907,41 @@ void wxDCBase::CalculateEllipticPoints( wxList* points,
bForceTurn = false; bForceTurn = false;
bStarted = true; bStarted = true;
} // while not bReady } // while not bReady
points->Append( (wxObject*) new wxPoint( xea, yea ) ); points->Append( new wxPoint( xea, yea ) );
// delete points // delete points
for( q = 0; q < 4; ++q ) 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; delete p;
} }
} }
} }
else else
{ {
wxNode* node; wxPointList::compatibility_iterator node;
// copy whole ellipse, wxPoints will be deleted outside // copy whole ellipse, wxPoints will be deleted outside
for( node = pointsarray[0].GetFirst(); node; node = node->GetNext() ) for( node = pointsarray[0].GetFirst(); node; node = node->GetNext() )
{ {
wxObject *p = node->GetData(); wxPoint *p = node->GetData();
points->Append( p ); points->Append( p );
} }
for( node = pointsarray[1].GetFirst(); node; node = node->GetNext() ) for( node = pointsarray[1].GetFirst(); node; node = node->GetNext() )
{ {
wxObject *p = node->GetData(); wxPoint *p = node->GetData();
points->Append( p ); points->Append( p );
} }
for( node = pointsarray[2].GetFirst(); node; node = node->GetNext() ) for( node = pointsarray[2].GetFirst(); node; node = node->GetNext() )
{ {
wxObject *p = node->GetData(); wxPoint *p = node->GetData();
points->Append( p ); points->Append( p );
} }
for( node = pointsarray[3].GetFirst(); node; node = node->GetNext() ) for( node = pointsarray[3].GetFirst(); node; node = node->GetNext() )
{ {
wxObject *p = node->GetData(); wxPoint *p = node->GetData();
points->Append( p ); points->Append( p );
} }
} // not iUseAngles } // not iUseAngles

View File

@@ -541,7 +541,7 @@ void wxGCDC::DoDrawLines(int n, wxPoint points[],
} }
#if wxUSE_SPLINES #if wxUSE_SPLINES
void wxGCDC::DoDrawSpline(wxList *points) void wxGCDC::DoDrawSpline(const wxPointList *points)
{ {
wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") ); wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") );
@@ -550,18 +550,18 @@ void wxGCDC::DoDrawSpline(wxList *points)
wxGraphicsPath path = m_graphicContext->CreatePath(); wxGraphicsPath path = m_graphicContext->CreatePath();
wxList::compatibility_iterator node = points->GetFirst(); wxPointList::compatibility_iterator node = points->GetFirst();
if (node == wxList::compatibility_iterator()) if (node == wxPointList::compatibility_iterator())
// empty list // empty list
return; return;
wxPoint *p = (wxPoint *)node->GetData(); wxPoint *p = node->GetData();
wxCoord x1 = p->x; wxCoord x1 = p->x;
wxCoord y1 = p->y; wxCoord y1 = p->y;
node = node->GetNext(); node = node->GetNext();
p = (wxPoint *)node->GetData(); p = node->GetData();
wxCoord x2 = p->x; wxCoord x2 = p->x;
wxCoord y2 = p->y; wxCoord y2 = p->y;
@@ -579,7 +579,7 @@ void wxGCDC::DoDrawSpline(wxList *points)
#endif // !wxUSE_STL #endif // !wxUSE_STL
{ {
p = (wxPoint *)node->GetData(); p = node->GetData();
x1 = x2; x1 = x2;
y1 = y2; y1 = y2;
x2 = p->x; x2 = p->x;

View File

@@ -58,6 +58,10 @@ WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle;
const wxSize wxDefaultSize(wxDefaultCoord, wxDefaultCoord); const wxSize wxDefaultSize(wxDefaultCoord, wxDefaultCoord);
const wxPoint wxDefaultPosition(wxDefaultCoord, wxDefaultCoord); const wxPoint wxDefaultPosition(wxDefaultCoord, wxDefaultCoord);
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxPointList);
#if wxUSE_EXTENDED_RTTI #if wxUSE_EXTENDED_RTTI
// wxPoint // wxPoint

View File

@@ -1470,7 +1470,7 @@ void wxPostScriptDC::SetLogicalFunction (int WXUNUSED(function))
} }
#if wxUSE_SPLINES #if wxUSE_SPLINES
void wxPostScriptDC::DoDrawSpline( wxList *points ) void wxPostScriptDC::DoDrawSpline( const wxPointList *points )
{ {
wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); 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; double c, d, x1, y1, x2, y2, x3, y3;
wxPoint *p, *q; wxPoint *p, *q;
wxList::compatibility_iterator node = points->GetFirst(); wxPointList::compatibility_iterator node = points->GetFirst();
p = (wxPoint *)node->GetData(); p = node->GetData();
x1 = p->x; x1 = p->x;
y1 = p->y; y1 = p->y;
node = node->GetNext(); node = node->GetNext();
p = (wxPoint *)node->GetData(); p = node->GetData();
c = p->x; c = p->x;
d = p->y; d = p->y;
x3 = x3 =
@@ -1516,7 +1516,7 @@ void wxPostScriptDC::DoDrawSpline( wxList *points )
node = node->GetNext(); node = node->GetNext();
while (node) while (node)
{ {
q = (wxPoint *)node->GetData(); q = node->GetData();
x1 = x3; x1 = x3;
y1 = y3; y1 = y3;

View File

@@ -158,6 +158,8 @@ public:
(GnomePrintConfig *config, const guchar *key), (config, key), NULL ) (GnomePrintConfig *config, const guchar *key), (config, key), NULL )
wxDL_METHOD_DEFINE( gboolean, gnome_print_config_get_length, wxDL_METHOD_DEFINE( gboolean, gnome_print_config_get_length,
(GnomePrintConfig *config, const guchar *key, gdouble *val, const GnomePrintUnit **unit), (config, key, val, unit), false ) (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, wxDL_METHOD_DEFINE( GtkWidget*, gnome_print_dialog_new,
(GnomePrintJob *gpj, const guchar *title, gint flags), (gpj, title, flags), NULL ) (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 );
wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_get_length ); 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_new );
wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_construct_range_page ); wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_construct_range_page );
@@ -308,6 +311,28 @@ bool wxGnomePrintNativeData::TransferTo( wxPrintData &data )
else else
data.SetOrientation( wxPORTRAIT ); data.SetOrientation( wxPORTRAIT );
g_free( res ); 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; return true;
} }
@@ -1377,20 +1402,20 @@ void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord
} }
#if wxUSE_SPLINES #if wxUSE_SPLINES
void wxGnomePrintDC::DoDrawSpline(wxList *points) void wxGnomePrintDC::DoDrawSpline(const wxPointList *points)
{ {
SetPen (m_pen); SetPen (m_pen);
double c, d, x1, y1, x2, y2, x3, y3; double c, d, x1, y1, x2, y2, x3, y3;
wxPoint *p, *q; wxPoint *p, *q;
wxList::compatibility_iterator node = points->GetFirst(); wxPointList::compatibility_iterator node = points->GetFirst();
p = (wxPoint *)node->GetData(); p = node->GetData();
x1 = p->x; x1 = p->x;
y1 = p->y; y1 = p->y;
node = node->GetNext(); node = node->GetNext();
p = (wxPoint *)node->GetData(); p = node->GetData();
c = p->x; c = p->x;
d = p->y; d = p->y;
x3 = x3 =
@@ -1408,7 +1433,7 @@ void wxGnomePrintDC::DoDrawSpline(wxList *points)
node = node->GetNext(); node = node->GetNext();
while (node) while (node)
{ {
q = (wxPoint *)node->GetData(); q = node->GetData();
x1 = x3; x1 = x3;
y1 = y3; y1 = y3;

View File

@@ -1505,20 +1505,20 @@ void wxGtkPrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord he
} }
#if wxUSE_SPLINES #if wxUSE_SPLINES
void wxGtkPrintDC::DoDrawSpline(wxList *points) void wxGtkPrintDC::DoDrawSpline(const wxPointList *points)
{ {
SetPen (m_pen); SetPen (m_pen);
double c, d, x1, y1, x2, y2, x3, y3; double c, d, x1, y1, x2, y2, x3, y3;
wxPoint *p, *q; wxPoint *p, *q;
wxList::compatibility_iterator node = points->GetFirst(); wxPointList::compatibility_iterator node = points->GetFirst();
p = (wxPoint *)node->GetData(); p = node->GetData();
x1 = p->x; x1 = p->x;
y1 = p->y; y1 = p->y;
node = node->GetNext(); node = node->GetNext();
p = (wxPoint *)node->GetData(); p = node->GetData();
c = p->x; c = p->x;
d = p->y; d = p->y;
x3 = x3 =
@@ -1536,7 +1536,7 @@ void wxGtkPrintDC::DoDrawSpline(wxList *points)
node = node->GetNext(); node = node->GetNext();
while (node) while (node)
{ {
q = (wxPoint *)node->GetData(); q = node->GetData();
x1 = x3; x1 = x3;
y1 = y3; y1 = y3;

View File

@@ -997,7 +997,7 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
} }
#if wxUSE_SPLINES #if wxUSE_SPLINES
void wxDC::DoDrawSpline(wxList *points) void wxDC::DoDrawSpline(const wxPointList *points)
{ {
#ifdef __WXWINCE__ #ifdef __WXWINCE__
// WinCE does not support ::PolyBezier so use generic version // WinCE does not support ::PolyBezier so use generic version
@@ -1029,8 +1029,8 @@ void wxDC::DoDrawSpline(wxList *points)
size_t bezier_pos = 0; size_t bezier_pos = 0;
wxCoord x1, y1, x2, y2, cx1, cy1, cx4, cy4; wxCoord x1, y1, x2, y2, cx1, cy1, cx4, cy4;
wxList::compatibility_iterator node = points->GetFirst(); wxPointList::compatibility_iterator node = points->GetFirst();
wxPoint *p = (wxPoint *)node->GetData(); wxPoint *p = node->GetData();
lppt[ bezier_pos ].x = x1 = p->x; lppt[ bezier_pos ].x = x1 = p->x;
lppt[ bezier_pos ].y = y1 = p->y; lppt[ bezier_pos ].y = y1 = p->y;
bezier_pos++; bezier_pos++;
@@ -1038,7 +1038,7 @@ void wxDC::DoDrawSpline(wxList *points)
bezier_pos++; bezier_pos++;
node = node->GetNext(); node = node->GetNext();
p = (wxPoint *)node->GetData(); p = node->GetData();
x2 = p->x; x2 = p->x;
y2 = p->y; y2 = p->y;