X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1484b5cc701329c54bbe70f2a155119fd86945c7..4b7ded8bad3a45ea4838e6d3f5d1957a134050ec:/contrib/src/ogl/drawn.cpp diff --git a/contrib/src/ogl/drawn.cpp b/contrib/src/ogl/drawn.cpp index 15b1863a49..010a45792f 100644 --- a/contrib/src/ogl/drawn.cpp +++ b/contrib/src/ogl/drawn.cpp @@ -6,7 +6,7 @@ // Created: 12/07/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -51,7 +51,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDrawnShape, wxRectangleShape) wxDrawnShape::wxDrawnShape():wxRectangleShape(100.0, 50.0) { - m_saveToFile = TRUE; + m_saveToFile = true; m_currentAngle = oglDRAWN_ANGLE_0; } @@ -89,8 +89,7 @@ void wxDrawnShape::SetSize(double w, double h, bool WXUNUSED(recursive)) scaleY = 1.0; else scaleY = h/GetHeight(); - int i = 0; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (m_metafiles[i].IsValid()) m_metafiles[i].Scale(scaleX, scaleY); @@ -226,7 +225,7 @@ bool wxDrawnShape::GetPerimeterPoint(double x1, double y1, wxDrawOp* op = (wxDrawOp*) node->GetData(); if (op->GetPerimeterPoint(x1, y1, x2, y2, x3, y3, GetX(), GetY(), GetAttachmentMode())) - return TRUE; + return true; } // Default... just use a rectangle @@ -242,8 +241,7 @@ void wxDrawnShape::WriteAttributes(wxExpr *clause) clause->AddAttributeValue(_T("save_metafile"), (long)m_saveToFile); if (m_saveToFile) { - int i = 0; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (m_metafiles[i].IsValid()) m_metafiles[i].WriteAttributes(clause, i); @@ -262,8 +260,7 @@ void wxDrawnShape::ReadAttributes(wxExpr *clause) if (m_saveToFile) { - int i = 0; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { m_metafiles[i].ReadAttributes(clause, i); } @@ -280,8 +277,7 @@ void wxDrawnShape::Copy(wxShape& copy) wxDrawnShape& drawnCopy = (wxDrawnShape&) copy; - int i = 0; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { m_metafiles[i].Copy(drawnCopy.m_metafiles[i]); } @@ -680,7 +676,7 @@ void wxOpSetClipping::ReadExpr(wxPseudoMetaFile *WXUNUSED(image), wxExpr *expr) */ wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, - double theRadius, wxChar *s) : wxDrawOp(theOp) + double theRadius, const wxString& s) : wxDrawOp(theOp) { m_x1 = theX1; m_y1 = theY1; @@ -689,13 +685,11 @@ wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double t m_x3 = 0.0; m_y3 = 0.0; m_radius = theRadius; - if (s) m_textString = copystring(s); - else m_textString = NULL; + m_textString = s; } wxOpDraw::~wxOpDraw() { - if (m_textString) delete[] m_textString; } wxDrawOp *wxOpDraw::Copy(wxPseudoMetaFile *WXUNUSED(newImage)) @@ -821,10 +815,10 @@ void wxOpDraw::Rotate(double x, double y, double theta, double sinTheta, double double newX2 = m_x2*cosTheta - m_y2*sinTheta + x*(1.0 - cosTheta) + y*sinTheta; double newY2 = m_x2*sinTheta + m_y2*cosTheta + y*(1.0 - cosTheta) + x*sinTheta; - m_x1 = newX1; - m_y1 = newY1; - m_x2 = newX2; - m_y2 = newY2; + m_x1 = newX1; + m_y1 = newY1; + m_x2 = newX2; + m_y2 = newY2; break; } case DRAWOP_DRAW_RECT: @@ -867,12 +861,12 @@ void wxOpDraw::Rotate(double x, double y, double theta, double sinTheta, double double newX3 = m_x3*cosTheta - m_y3*sinTheta + x*(1.0 - cosTheta) + y*sinTheta; double newY3 = m_x3*sinTheta + m_y3*cosTheta + y*(1.0 - cosTheta) + x*sinTheta; - m_x1 = newX1; - m_y1 = newY1; - m_x2 = newX2; - m_y2 = newY2; - m_x3 = newX3; - m_y3 = newY3; + m_x1 = newX1; + m_y1 = newY1; + m_x2 = newX2; + m_y2 = newY2; + m_x3 = newX3; + m_y3 = newY3; break; } @@ -972,8 +966,7 @@ void wxOpDraw::ReadExpr(wxPseudoMetaFile *WXUNUSED(image), wxExpr *expr) { m_x1 = expr->Nth(1)->RealValue(); m_y1 = expr->Nth(2)->RealValue(); - wxString str(expr->Nth(3)->StringValue()); - m_textString = copystring(str); + m_textString = wxString(expr->Nth(3)->StringValue()); break; } case DRAWOP_DRAW_ARC: @@ -1216,7 +1209,7 @@ bool wxOpPolyDraw::OnDrawOutline(wxDC& dc, double x, double y, double w, double } dc.DrawPolygon(n, intPoints, (long) x, (long) y); delete[] intPoints; - return TRUE; + return true; } // Assume (x1, y1) is centre of box (most generally, line end at box) @@ -1246,13 +1239,13 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1, { *x3 = point->x + xOffset; *y3 = point->y + yOffset; - return TRUE; + return true; } else if ((y2 < y1) && (point->y < 0.0)) { *x3 = point->x + xOffset; *y3 = point->y + yOffset; - return TRUE; + return true; } } } @@ -1261,8 +1254,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1, double *xpoints = new double[n]; double *ypoints = new double[n]; - int i = 0; - for (i = 0; i < n; i++) + for (int i = 0; i < n; i++) { wxRealPoint *point = & (m_points[i]); xpoints[i] = point->x + xOffset; @@ -1275,7 +1267,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1, delete[] xpoints; delete[] ypoints; - return TRUE; + return true; } @@ -1371,7 +1363,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPseudoMetaFile, wxObject) wxPseudoMetaFile::wxPseudoMetaFile() { m_currentRotation = 0; - m_rotateable = TRUE; + m_rotateable = true; m_width = 0.0; m_height = 0.0; m_outlinePen = NULL; @@ -1610,7 +1602,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) // Read GDI objects wxChar buf[50]; int i = 1; - bool keepGoing = TRUE; + bool keepGoing = true; while (keepGoing) { wxSprintf(buf, _T("gdi%d_%d"), whichAngle, i); @@ -1618,7 +1610,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) clause->GetAttributeValue(buf, &expr); if (!expr) { - keepGoing = FALSE; + keepGoing = false; } else { @@ -1675,7 +1667,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } // Now read in the operations - keepGoing = TRUE; + keepGoing = true; i = 1; while (keepGoing) { @@ -1684,7 +1676,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) clause->GetAttributeValue(buf, &expr); if (!expr) { - keepGoing = FALSE; + keepGoing = false; } else { @@ -1829,14 +1821,14 @@ void wxPseudoMetaFile::Copy(wxPseudoMetaFile& copy) bool wxPseudoMetaFile::LoadFromMetaFile(const wxString& filename, double *rwidth, double *rheight) { if (!wxFileExists(filename)) - return FALSE; + return false; wxXMetaFile *metaFile = new wxXMetaFile; if (!metaFile->ReadFile(filename)) { delete metaFile; - return FALSE; + return false; } double lastX = 0.0; @@ -2173,7 +2165,7 @@ bool wxPseudoMetaFile::LoadFromMetaFile(const wxString& filename, double *rwidth m_height = *rheight; delete metaFile; - return TRUE; + return true; } // Scale to fit size @@ -2370,7 +2362,7 @@ void wxPseudoMetaFile::DrawText(const wxString& text, const wxPoint& pt) wxOpDraw *theOp = new wxOpDraw(DRAWOP_DRAW_TEXT, (double) pt.x, (double) pt.y, 0.0, 0.0); - theOp->m_textString = copystring(text); + theOp->m_textString = text; m_ops.Append(theOp); }