X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1fc25a89ac1e6c5208db24bfc0abc8666b791dc6..f2638c97a5d7c4bf724c5c227e273ab002f0af40:/contrib/src/ogl/drawn.cpp?ds=sidebyside diff --git a/contrib/src/ogl/drawn.cpp b/contrib/src/ogl/drawn.cpp index b410537294..bb5c79e463 100644 --- a/contrib/src/ogl/drawn.cpp +++ b/contrib/src/ogl/drawn.cpp @@ -15,7 +15,7 @@ #endif // For compilers that support precompilation, includes "wx.h". -#include +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop @@ -35,6 +35,8 @@ #include #include +#include + static void IntToHex(unsigned int dec, char *buf); static unsigned long HexToInt(char *buf); extern char *oglBuffer; @@ -71,7 +73,7 @@ void wxDrawnShape::OnDraw(wxDC& dc) m_metafiles[m_currentAngle].m_outlinePen = g_oglTransparentPen; m_metafiles[m_currentAngle].Draw(dc, m_xpos + m_shadowOffsetX, m_ypos + m_shadowOffsetY); } - + m_metafiles[m_currentAngle].m_outlinePen = m_pen; m_metafiles[m_currentAngle].m_fillBrush = m_brush; m_metafiles[m_currentAngle].Draw(dc, m_xpos, m_ypos); @@ -137,7 +139,7 @@ void wxDrawnShape::Rotate(double x, double y, double theta) // Rotate metafile if (!m_metafiles[0].GetRotateable()) return; - + m_metafiles[0].Rotate(x, y, theta); } @@ -146,15 +148,15 @@ void wxDrawnShape::Rotate(double x, double y, double theta) // Rotate attachment points double sinTheta = (double)sin(actualTheta); double cosTheta = (double)cos(actualTheta); - wxNode *node = m_attachmentPoints.First(); + wxNode *node = m_attachmentPoints.GetFirst(); while (node) { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); + wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); double x1 = point->m_x; double y1 = point->m_y; point->m_x = x1*cosTheta - y1*sinTheta + x*(1.0 - cosTheta) + y*sinTheta; point->m_y = x1*sinTheta + y1*cosTheta + y*(1.0 - cosTheta) + x*sinTheta; - node = node->Next(); + node = node->GetNext(); } m_rotation = theta; @@ -202,9 +204,9 @@ void wxDrawnShape::OnDrawOutline(wxDC& dc, double x, double y, double w, double { if (m_metafiles[m_currentAngle].GetOutlineOp() != -1) { - wxNode* node = m_metafiles[m_currentAngle].GetOps().Nth(m_metafiles[m_currentAngle].GetOutlineOp()); + wxNode* node = m_metafiles[m_currentAngle].GetOps().Item(m_metafiles[m_currentAngle].GetOutlineOp()); wxASSERT (node != NULL); - wxDrawOp* op = (wxDrawOp*) node->Data(); + wxDrawOp* op = (wxDrawOp*) node->GetData(); if (op->OnDrawOutline(dc, x, y, w, h, m_width, m_height)) return; @@ -222,9 +224,9 @@ bool wxDrawnShape::GetPerimeterPoint(double x1, double y1, { if (m_metafiles[m_currentAngle].GetOutlineOp() != -1) { - wxNode* node = m_metafiles[m_currentAngle].GetOps().Nth(m_metafiles[m_currentAngle].GetOutlineOp()); + wxNode* node = m_metafiles[m_currentAngle].GetOps().Item(m_metafiles[m_currentAngle].GetOutlineOp()); wxASSERT (node != NULL); - wxDrawOp* op = (wxDrawOp*) node->Data(); + wxDrawOp* op = (wxDrawOp*) node->GetData(); if (op->GetPerimeterPoint(x1, y1, x2, y2, x3, y3, GetX(), GetY(), GetAttachmentMode())) return TRUE; @@ -234,7 +236,7 @@ bool wxDrawnShape::GetPerimeterPoint(double x1, double y1, return wxRectangleShape::GetPerimeterPoint(x1, y1, x2, y2, x3, y3); } -#ifdef PROLOGIO +#if wxUSE_PROLOGIO void wxDrawnShape::WriteAttributes(wxExpr *clause) { wxRectangleShape::WriteAttributes(clause); @@ -290,7 +292,7 @@ void wxDrawnShape::Copy(wxShape& copy) drawnCopy.m_currentAngle = m_currentAngle; } -bool wxDrawnShape::LoadFromMetaFile(char *filename) +bool wxDrawnShape::LoadFromMetaFile(const wxString& filename) { return m_metafiles[0].LoadFromMetaFile(filename, &m_width, &m_height); } @@ -406,12 +408,12 @@ void wxDrawnShape::SetDrawnBackgroundMode(int mode) * Individual operations * */ - + /* * Set font, brush, text colour * */ - + wxOpSetGDI::wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode): wxDrawOp(theOp) { @@ -435,10 +437,10 @@ void wxOpSetGDI::Do(wxDC& dc, double xoffset, double yoffset) } else { - wxNode *node = m_image->m_gdiObjects.Nth(m_gdiIndex); + wxNode *node = m_image->m_gdiObjects.Item(m_gdiIndex); if (node) { - wxPen *pen = (wxPen *)node->Data(); + wxPen *pen = (wxPen *)node->GetData(); if (pen) dc.SetPen(* pen); } @@ -468,10 +470,10 @@ void wxOpSetGDI::Do(wxDC& dc, double xoffset, double yoffset) } else { - wxNode *node = m_image->m_gdiObjects.Nth(m_gdiIndex); + wxNode *node = m_image->m_gdiObjects.Item(m_gdiIndex); if (node) { - wxBrush *brush = (wxBrush *)node->Data(); + wxBrush *brush = (wxBrush *)node->GetData(); if (brush) dc.SetBrush(* brush); } @@ -480,10 +482,10 @@ void wxOpSetGDI::Do(wxDC& dc, double xoffset, double yoffset) } case DRAWOP_SET_FONT: { - wxNode *node = m_image->m_gdiObjects.Nth(m_gdiIndex); + wxNode *node = m_image->m_gdiObjects.Item(m_gdiIndex); if (node) { - wxFont *font = (wxFont *)node->Data(); + wxFont *font = (wxFont *)node->GetData(); if (font) dc.SetFont(* font); } @@ -520,6 +522,7 @@ wxDrawOp *wxOpSetGDI::Copy(wxPseudoMetaFile *newImage) return newOp; } +#if wxUSE_PROLOGIO wxExpr *wxOpSetGDI::WriteExpr(wxPseudoMetaFile *image) { wxExpr *expr = new wxExpr(wxExprList); @@ -560,32 +563,33 @@ void wxOpSetGDI::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) case DRAWOP_SET_BRUSH: case DRAWOP_SET_FONT: { - m_gdiIndex = (int)expr->Nth(1)->IntegerValue(); + m_gdiIndex = (int)expr->Item(1)->IntegerValue(); break; } case DRAWOP_SET_TEXT_COLOUR: case DRAWOP_SET_BK_COLOUR: { - m_r = (unsigned char)expr->Nth(1)->IntegerValue(); - m_g = (unsigned char)expr->Nth(2)->IntegerValue(); - m_b = (unsigned char)expr->Nth(3)->IntegerValue(); + m_r = (unsigned char)expr->Item(1)->IntegerValue(); + m_g = (unsigned char)expr->Item(2)->IntegerValue(); + m_b = (unsigned char)expr->Item(3)->IntegerValue(); break; } case DRAWOP_SET_BK_MODE: { - m_mode = (int)expr->Nth(1)->IntegerValue(); + m_mode = (int)expr->Item(1)->IntegerValue(); break; } default: break; } } +#endif /* * Set/destroy clipping * */ - + wxOpSetClipping::wxOpSetClipping(int theOp, double theX1, double theY1, double theX2, double theY2):wxDrawOp(theOp) { @@ -600,7 +604,7 @@ wxDrawOp *wxOpSetClipping::Copy(wxPseudoMetaFile *newImage) wxOpSetClipping *newOp = new wxOpSetClipping(m_op, m_x1, m_y1, m_x2, m_y2); return newOp; } - + void wxOpSetClipping::Do(wxDC& dc, double xoffset, double yoffset) { switch (m_op) @@ -634,6 +638,7 @@ void wxOpSetClipping::Translate(double x, double y) m_y1 += y; } +#if wxUSE_PROLOGIO wxExpr *wxOpSetClipping::WriteExpr(wxPseudoMetaFile *image) { wxExpr *expr = new wxExpr(wxExprList); @@ -660,24 +665,25 @@ void wxOpSetClipping::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) { case DRAWOP_SET_CLIPPING_RECT: { - m_x1 = expr->Nth(1)->RealValue(); - m_y1 = expr->Nth(2)->RealValue(); - m_x2 = expr->Nth(3)->RealValue(); - m_y2 = expr->Nth(4)->RealValue(); + m_x1 = expr->Item(1)->RealValue(); + m_y1 = expr->Item(2)->RealValue(); + m_x2 = expr->Item(3)->RealValue(); + m_y2 = expr->Item(4)->RealValue(); break; } default: break; } } +#endif /* * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text * */ - + wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, - double theRadius, char *s):wxDrawOp(theOp) + double theRadius, wxChar *s) : wxDrawOp(theOp) { m_x1 = theX1; m_y1 = theY1; @@ -878,6 +884,7 @@ void wxOpDraw::Rotate(double x, double y, double theta, double sinTheta, double } } +#if wxUSE_PROLOGIO wxExpr *wxOpDraw::WriteExpr(wxPseudoMetaFile *image) { wxExpr *expr = new wxExpr(wxExprList); @@ -943,44 +950,44 @@ void wxOpDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) case DRAWOP_DRAW_RECT: case DRAWOP_DRAW_ELLIPSE: { - m_x1 = expr->Nth(1)->RealValue(); - m_y1 = expr->Nth(2)->RealValue(); - m_x2 = expr->Nth(3)->RealValue(); - m_y2 = expr->Nth(4)->RealValue(); + m_x1 = expr->Item(1)->RealValue(); + m_y1 = expr->Item(2)->RealValue(); + m_x2 = expr->Item(3)->RealValue(); + m_y2 = expr->Item(4)->RealValue(); break; } case DRAWOP_DRAW_ROUNDED_RECT: { - m_x1 = expr->Nth(1)->RealValue(); - m_y1 = expr->Nth(2)->RealValue(); - m_x2 = expr->Nth(3)->RealValue(); - m_y2 = expr->Nth(4)->RealValue(); - m_radius = expr->Nth(5)->RealValue(); + m_x1 = expr->Item(1)->RealValue(); + m_y1 = expr->Item(2)->RealValue(); + m_x2 = expr->Item(3)->RealValue(); + m_y2 = expr->Item(4)->RealValue(); + m_radius = expr->Item(5)->RealValue(); break; } case DRAWOP_DRAW_POINT: { - m_x1 = expr->Nth(1)->RealValue(); - m_y1 = expr->Nth(2)->RealValue(); + m_x1 = expr->Item(1)->RealValue(); + m_y1 = expr->Item(2)->RealValue(); break; } case DRAWOP_DRAW_TEXT: { - m_x1 = expr->Nth(1)->RealValue(); - m_y1 = expr->Nth(2)->RealValue(); - wxString str(expr->Nth(3)->StringValue()); - m_textString = copystring((const char*) str); + m_x1 = expr->Item(1)->RealValue(); + m_y1 = expr->Item(2)->RealValue(); + wxString str(expr->Item(3)->StringValue()); + m_textString = copystring(str); break; } case DRAWOP_DRAW_ARC: case DRAWOP_DRAW_ELLIPTIC_ARC: { - m_x1 = expr->Nth(1)->RealValue(); - m_y1 = expr->Nth(2)->RealValue(); - m_x2 = expr->Nth(3)->RealValue(); - m_y2 = expr->Nth(4)->RealValue(); - m_x3 = expr->Nth(5)->RealValue(); - m_y3 = expr->Nth(6)->RealValue(); + m_x1 = expr->Item(1)->RealValue(); + m_y1 = expr->Item(2)->RealValue(); + m_x2 = expr->Item(3)->RealValue(); + m_y2 = expr->Item(4)->RealValue(); + m_x3 = expr->Item(5)->RealValue(); + m_y3 = expr->Item(6)->RealValue(); break; } default: @@ -989,6 +996,7 @@ void wxOpDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) } } } +#endif /* * Draw polygon, polyline, spline @@ -1102,6 +1110,7 @@ void wxOpPolyDraw::Rotate(double x, double y, double theta, double sinTheta, dou } } +#if wxUSE_PROLOGIO wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image) { wxExpr *expr = new wxExpr(wxExprList); @@ -1119,7 +1128,7 @@ wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image) * E.g. "1B9080CD". 4 hex digits per coordinate pair. * */ - + for (int i = 0; i < m_noPoints; i++) { long signedX = (long)(m_points[i].x*100.0); @@ -1128,7 +1137,7 @@ wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image) // Scale to 0 -> 64K long unSignedX = (long)(signedX + 32767.0); long unSignedY = (long)(signedY + 32767.0); - + // IntToHex((unsigned int)signedX, buf2); // IntToHex((unsigned int)signedY, buf3); IntToHex((int)unSignedX, buf2); @@ -1147,7 +1156,7 @@ wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image) void wxOpPolyDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) { - m_noPoints = (int)expr->Nth(1)->IntegerValue(); + m_noPoints = (int)expr->Item(1)->IntegerValue(); char buf1[5]; char buf2[5]; @@ -1155,7 +1164,7 @@ void wxOpPolyDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) m_points = new wxRealPoint[m_noPoints]; int i = 0; int bufPtr = 0; - wxString hexString = expr->Nth(2)->StringValue(); + wxString hexString = expr->Item(2)->StringValue(); while (i < m_noPoints) { buf1[0] = hexString[(size_t)bufPtr]; @@ -1163,7 +1172,7 @@ void wxOpPolyDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) buf1[2] = hexString[(size_t)(bufPtr + 2)]; buf1[3] = hexString[(size_t)(bufPtr + 3)]; buf1[4] = 0; - + buf2[0] = hexString[(size_t)(bufPtr + 4)]; buf2[1] = hexString[(size_t)(bufPtr + 5)]; buf2[2] = hexString[(size_t)(bufPtr + 6)]; @@ -1190,6 +1199,7 @@ void wxOpPolyDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) i ++; } } +#endif // Draw an outline using the current operation. bool wxOpPolyDraw::OnDrawOutline(wxDC& dc, double x, double y, double w, double h, double oldW, double oldH) @@ -1251,7 +1261,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1, } } } - + double *xpoints = new double[n]; double *ypoints = new double[n]; @@ -1263,7 +1273,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1, ypoints[i] = point->y + yOffset; } - oglFindEndForPolyline(n, xpoints, ypoints, + oglFindEndForPolyline(n, xpoints, ypoints, x1, y1, x2, y2, x3, y3); delete[] xpoints; @@ -1288,7 +1298,7 @@ static void IntToHex(unsigned int dec, char *buf) int digit2 = (int)((dec - (digit1*4096))/256); int digit3 = (int)((dec - (digit1*4096) - (digit2*256))/16); int digit4 = dec - (digit1*4096 + digit2*256 + digit3*16); - + buf[0] = hexArray[digit1]; buf[1] = hexArray[digit2]; buf[2] = hexArray[digit3]; @@ -1380,12 +1390,12 @@ wxPseudoMetaFile::~wxPseudoMetaFile() void wxPseudoMetaFile::Clear() { - wxNode *node = m_ops.First(); + wxNode *node = m_ops.GetFirst(); while (node) { - wxDrawOp *op = (wxDrawOp *)node->Data(); + wxDrawOp *op = (wxDrawOp *)node->GetData(); delete op; - node = node->Next(); + node = node->GetNext(); } m_ops.Clear(); m_gdiObjects.Clear(); @@ -1396,23 +1406,23 @@ void wxPseudoMetaFile::Clear() void wxPseudoMetaFile::Draw(wxDC& dc, double xoffset, double yoffset) { - wxNode *node = m_ops.First(); + wxNode *node = m_ops.GetFirst(); while (node) { - wxDrawOp *op = (wxDrawOp *)node->Data(); + wxDrawOp *op = (wxDrawOp *)node->GetData(); op->Do(dc, xoffset, yoffset); - node = node->Next(); + node = node->GetNext(); } } void wxPseudoMetaFile::Scale(double sx, double sy) { - wxNode *node = m_ops.First(); + wxNode *node = m_ops.GetFirst(); while (node) { - wxDrawOp *op = (wxDrawOp *)node->Data(); + wxDrawOp *op = (wxDrawOp *)node->GetData(); op->Scale(sx, sy); - node = node->Next(); + node = node->GetNext(); } m_width *= sx; m_height *= sy; @@ -1420,12 +1430,12 @@ void wxPseudoMetaFile::Scale(double sx, double sy) void wxPseudoMetaFile::Translate(double x, double y) { - wxNode *node = m_ops.First(); + wxNode *node = m_ops.GetFirst(); while (node) { - wxDrawOp *op = (wxDrawOp *)node->Data(); + wxDrawOp *op = (wxDrawOp *)node->GetData(); op->Translate(x, y); - node = node->Next(); + node = node->GetNext(); } } @@ -1436,30 +1446,30 @@ void wxPseudoMetaFile::Rotate(double x, double y, double theta) double cosTheta = (double)cos(theta1); double sinTheta = (double)sin(theta1); - wxNode *node = m_ops.First(); + wxNode *node = m_ops.GetFirst(); while (node) { - wxDrawOp *op = (wxDrawOp *)node->Data(); + wxDrawOp *op = (wxDrawOp *)node->GetData(); op->Rotate(x, y, theta, sinTheta, cosTheta); - node = node->Next(); + node = node->GetNext(); } m_currentRotation = theta; } -#ifdef PROLOGIO +#if wxUSE_PROLOGIO void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle) { wxString widthStr; - widthStr.Printf("meta_width%d", whichAngle); + widthStr.Printf(wxT("meta_width%d"), whichAngle); wxString heightStr; - heightStr.Printf("meta_height%d", whichAngle); + heightStr.Printf(wxT("meta_height%d"), whichAngle); wxString outlineStr; - outlineStr.Printf("outline_op%d", whichAngle); + outlineStr.Printf(wxT("outline_op%d"), whichAngle); wxString rotateableStr; - rotateableStr.Printf("meta_rotateable%d", whichAngle); + rotateableStr.Printf(wxT("meta_rotateable%d"), whichAngle); // Write width and height clause->AddAttributeValue(widthStr, m_width); @@ -1470,11 +1480,11 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle) // Write GDI objects char buf[50]; int i = 1; - wxNode *node = m_gdiObjects.First(); + wxNode *node = m_gdiObjects.GetFirst(); while (node) { sprintf(buf, "gdi%d_%d", whichAngle, i); - wxObject *obj = (wxObject *)node->Data(); + wxObject *obj = (wxObject *)node->GetData(); wxExpr *expr = NULL; if (obj) { @@ -1523,70 +1533,70 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle) clause->AddAttributeValue(buf, expr); i ++; } - node = node->Next(); + node = node->GetNext(); } // Write drawing operations i = 1; - node = m_ops.First(); + node = m_ops.GetFirst(); while (node) { sprintf(buf, "op%d_%d", whichAngle, i); - wxDrawOp *op = (wxDrawOp *)node->Data(); + wxDrawOp *op = (wxDrawOp *)node->GetData(); wxExpr *expr = op->WriteExpr(this); if (expr) { clause->AddAttributeValue(buf, expr); i ++; } - node = node->Next(); + node = node->GetNext(); } // Write outline and fill GDI op lists (if any) - if (m_outlineColours.Number() > 0) + if (m_outlineColours.GetCount() > 0) { wxExpr *outlineExpr = new wxExpr(wxExprList); - node = m_outlineColours.First(); + node = m_outlineColours.GetFirst(); while (node) { - outlineExpr->Append(new wxExpr((long)node->Data())); - node = node->Next(); + outlineExpr->Append(new wxExpr((long)node->GetData())); + node = node->GetNext(); } wxString outlineObjectsStr; - outlineObjectsStr.Printf("outline_objects%d", whichAngle); + outlineObjectsStr.Printf(wxT("outline_objects%d"), whichAngle); clause->AddAttributeValue(outlineObjectsStr, outlineExpr); } - if (m_fillColours.Number() > 0) + if (m_fillColours.GetCount() > 0) { wxExpr *fillExpr = new wxExpr(wxExprList); - node = m_fillColours.First(); + node = m_fillColours.GetFirst(); while (node) { - fillExpr->Append(new wxExpr((long)node->Data())); - node = node->Next(); + fillExpr->Append(new wxExpr((long)node->GetData())); + node = node->GetNext(); } wxString fillObjectsStr; - fillObjectsStr.Printf("fill_objects%d", whichAngle); + fillObjectsStr.Printf(wxT("fill_objects%d"), whichAngle); clause->AddAttributeValue(fillObjectsStr, fillExpr); } - + } void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) { wxString widthStr; - widthStr.Printf("meta_width%d", whichAngle); + widthStr.Printf(wxT("meta_width%d"), whichAngle); wxString heightStr; - heightStr.Printf("meta_height%d", whichAngle); + heightStr.Printf(wxT("meta_height%d"), whichAngle); wxString outlineStr; - outlineStr.Printf("outline_op%d", whichAngle); + outlineStr.Printf(wxT("outline_op%d"), whichAngle); wxString rotateableStr; - rotateableStr.Printf("meta_rotateable%d", whichAngle); + rotateableStr.Printf(wxT("meta_rotateable%d"), whichAngle); clause->GetAttributeValue(widthStr, m_width); clause->GetAttributeValue(heightStr, m_height); @@ -1611,16 +1621,16 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } else { - wxExpr *idExpr = expr->Nth(0); + wxExpr *idExpr = expr->Item(0); switch (idExpr->IntegerValue()) { case gyTYPE_PEN: { - int penWidth = (int)expr->Nth(1)->IntegerValue(); - int penStyle = (int)expr->Nth(2)->IntegerValue(); - int penRed = (int)expr->Nth(3)->IntegerValue(); - int penGreen = (int)expr->Nth(4)->IntegerValue(); - int penBlue = (int)expr->Nth(5)->IntegerValue(); + int penWidth = (int)expr->Item(1)->IntegerValue(); + int penStyle = (int)expr->Item(2)->IntegerValue(); + int penRed = (int)expr->Item(3)->IntegerValue(); + int penGreen = (int)expr->Item(4)->IntegerValue(); + int penBlue = (int)expr->Item(5)->IntegerValue(); wxColour col(penRed, penGreen, penBlue); wxPen *p = wxThePenList->FindOrCreatePen(col, penWidth, penStyle); if (!p) @@ -1630,10 +1640,10 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } case gyTYPE_BRUSH: { - int brushStyle = (int)expr->Nth(1)->IntegerValue(); - int brushRed = (int)expr->Nth(2)->IntegerValue(); - int brushGreen = (int)expr->Nth(3)->IntegerValue(); - int brushBlue = (int)expr->Nth(4)->IntegerValue(); + int brushStyle = (int)expr->Item(1)->IntegerValue(); + int brushRed = (int)expr->Item(2)->IntegerValue(); + int brushGreen = (int)expr->Item(3)->IntegerValue(); + int brushBlue = (int)expr->Item(4)->IntegerValue(); wxColour col(brushRed, brushGreen, brushBlue); wxBrush *b = wxTheBrushList->FindOrCreateBrush(col, brushStyle); if (!b) @@ -1643,11 +1653,11 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } case gyTYPE_FONT: { - int fontPointSize = (int)expr->Nth(1)->IntegerValue(); - int fontFamily = (int)expr->Nth(2)->IntegerValue(); - int fontStyle = (int)expr->Nth(3)->IntegerValue(); - int fontWeight = (int)expr->Nth(4)->IntegerValue(); - int fontUnderlined = (int)expr->Nth(5)->IntegerValue(); + int fontPointSize = (int)expr->Item(1)->IntegerValue(); + int fontFamily = (int)expr->Item(2)->IntegerValue(); + int fontStyle = (int)expr->Item(3)->IntegerValue(); + int fontWeight = (int)expr->Item(4)->IntegerValue(); + int fontUnderlined = (int)expr->Item(5)->IntegerValue(); m_gdiObjects.Append(wxTheFontList->FindOrCreateFont(fontPointSize, fontFamily, fontStyle, fontWeight, (fontUnderlined != 0))); break; @@ -1677,7 +1687,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } else { - wxExpr *idExpr = expr->Nth(0); + wxExpr *idExpr = expr->Item(0); int opId = (int)idExpr->IntegerValue(); switch (opId) { @@ -1693,7 +1703,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) m_ops.Append(theOp); break; } - + case DRAWOP_SET_CLIPPING_RECT: case DRAWOP_DESTROY_CLIPPING_RECT: { @@ -1733,7 +1743,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } wxString outlineObjectsStr; - outlineObjectsStr.Printf("outline_objects%d", whichAngle); + outlineObjectsStr.Printf(wxT("outline_objects%d"), whichAngle); // Now read in the list of outline and fill operations, if any wxExpr *expr1 = clause->AttributeValue(outlineObjectsStr); @@ -1748,7 +1758,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } wxString fillObjectsStr; - fillObjectsStr.Printf("fill_objects%d", whichAngle); + fillObjectsStr.Printf(wxT("fill_objects%d"), whichAngle); expr1 = clause->AttributeValue(fillObjectsStr); if (expr1) @@ -1777,35 +1787,35 @@ void wxPseudoMetaFile::Copy(wxPseudoMetaFile& copy) copy.m_outlineOp = m_outlineOp; // Copy the GDI objects - wxNode *node = m_gdiObjects.First(); + wxNode *node = m_gdiObjects.GetFirst(); while (node) { - wxObject *obj = (wxObject *)node->Data(); + wxObject *obj = (wxObject *)node->GetData(); copy.m_gdiObjects.Append(obj); - node = node->Next(); + node = node->GetNext(); } - + // Copy the operations - node = m_ops.First(); + node = m_ops.GetFirst(); while (node) { - wxDrawOp *op = (wxDrawOp *)node->Data(); + wxDrawOp *op = (wxDrawOp *)node->GetData(); copy.m_ops.Append(op->Copy(©)); - node = node->Next(); + node = node->GetNext(); } // Copy the outline/fill operations - node = m_outlineColours.First(); + node = m_outlineColours.GetFirst(); while (node) { - copy.m_outlineColours.Append((wxObject *)node->Data()); - node = node->Next(); + copy.m_outlineColours.Append((wxObject *)node->GetData()); + node = node->GetNext(); } - node = m_fillColours.First(); + node = m_fillColours.GetFirst(); while (node) { - copy.m_fillColours.Append((wxObject *)node->Data()); - node = node->Next(); + copy.m_fillColours.Append((wxObject *)node->GetData()); + node = node->GetNext(); } } @@ -1814,14 +1824,14 @@ void wxPseudoMetaFile::Copy(wxPseudoMetaFile& copy) * fit width and return new width and height. * */ - -bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double *rheight) + +bool wxPseudoMetaFile::LoadFromMetaFile(const wxString& filename, double *rwidth, double *rheight) { - if (!FileExists(filename)) - return NULL; - + if (!wxFileExists(filename)) + return FALSE; + wxXMetaFile *metaFile = new wxXMetaFile; - + if (!metaFile->ReadFile(filename)) { delete metaFile; @@ -1832,10 +1842,10 @@ bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double * double lastY = 0.0; // Convert from metafile records to wxDrawnShape records - wxNode *node = metaFile->metaRecords.First(); + wxNode *node = metaFile->metaRecords.GetFirst(); while (node) { - wxMetaRecord *record = (wxMetaRecord *)node->Data(); + wxMetaRecord *record = (wxMetaRecord *)node->GetData(); switch (record->metaFunction) { case META_SETBKCOLOR: @@ -1977,7 +1987,7 @@ bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double * newPoints[i].x = record->points[i].x; newPoints[i].y = record->points[i].y; } - + wxOpPolyDraw *op = new wxOpPolyDraw(DRAWOP_DRAW_POLYGON, n, newPoints); m_ops.Append(op); break; @@ -1991,7 +2001,7 @@ bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double * newPoints[i].x = record->points[i].x; newPoints[i].y = record->points[i].y; } - + wxOpPolyDraw *op = new wxOpPolyDraw(DRAWOP_DRAW_POLYLINE, n, newPoints); m_ops.Append(op); break; @@ -2007,10 +2017,10 @@ bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double * { // The pen, brush etc. has already been created when the metafile // was read in, so we don't create it - we set it. - wxNode *recNode = metaFile->gdiObjects.Nth((int)record->param2); + wxNode *recNode = metaFile->gdiObjects.Item((int)record->param2); if (recNode) { - wxMetaRecord *gdiRec = (wxMetaRecord *)recNode->Data(); + wxMetaRecord *gdiRec = (wxMetaRecord *)recNode->GetData(); if (gdiRec && (gdiRec->param1 != 0)) { wxObject *obj = (wxObject *)gdiRec->param1; @@ -2125,7 +2135,7 @@ bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double * break; } } - node = node->Next(); + node = node->GetNext(); } double actualWidth = (double)fabs(metaFile->right - metaFile->left); double actualHeight = (double)fabs(metaFile->bottom - metaFile->top); @@ -2182,10 +2192,10 @@ void wxPseudoMetaFile::GetBounds(double *boundMinX, double *boundMinY, double *b double minX = (double) 99999.9; double minY = (double) 99999.9; - wxNode *node = m_ops.First(); + wxNode *node = m_ops.GetFirst(); while (node) { - wxDrawOp *op = (wxDrawOp *)node->Data(); + wxDrawOp *op = (wxDrawOp *)node->GetData(); switch (op->GetOp()) { case DRAWOP_DRAW_LINE: @@ -2252,7 +2262,7 @@ void wxPseudoMetaFile::GetBounds(double *boundMinX, double *boundMinY, double *b default: break; } - node = node->Next(); + node = node->GetNext(); } *boundMinX = minX; @@ -2390,7 +2400,7 @@ void wxPseudoMetaFile::DrawPolygon(int n, wxPoint pts[], int flags) m_ops.Append(theOp); if (flags & oglMETAFLAGS_OUTLINE) - m_outlineOp = (m_ops.Number() - 1); + m_outlineOp = (m_ops.GetCount() - 1); } void wxPseudoMetaFile::DrawSpline(int n, wxPoint pts[]) @@ -2423,7 +2433,7 @@ void wxPseudoMetaFile::DestroyClippingRect() void wxPseudoMetaFile::SetPen(wxPen* pen, bool isOutline) { m_gdiObjects.Append(pen); - int n = m_gdiObjects.Number(); + int n = m_gdiObjects.GetCount(); wxOpSetGDI* theOp = new wxOpSetGDI(DRAWOP_SET_PEN, this, n - 1); @@ -2438,7 +2448,7 @@ void wxPseudoMetaFile::SetPen(wxPen* pen, bool isOutline) void wxPseudoMetaFile::SetBrush(wxBrush* brush, bool isFill) { m_gdiObjects.Append(brush); - int n = m_gdiObjects.Number(); + int n = m_gdiObjects.GetCount(); wxOpSetGDI* theOp = new wxOpSetGDI(DRAWOP_SET_BRUSH, this, n - 1); @@ -2453,7 +2463,7 @@ void wxPseudoMetaFile::SetBrush(wxBrush* brush, bool isFill) void wxPseudoMetaFile::SetFont(wxFont* font) { m_gdiObjects.Append(font); - int n = m_gdiObjects.Number(); + int n = m_gdiObjects.GetCount(); wxOpSetGDI* theOp = new wxOpSetGDI(DRAWOP_SET_FONT, this, n - 1);