]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/ogl/src/drawn.cpp
Added test for sprintf and vsnprintf to fix string.cpp for non-GNU systems.
[wxWidgets.git] / utils / ogl / src / drawn.cpp
index 178dcfaf9a004df7403f7a32b95a4cadfed5712d..d602580b8688877b75e8ab02667c221f3613fa47 100644 (file)
@@ -11,6 +11,7 @@
 
 #ifdef __GNUG__
 #pragma implementation "drawn.h"
+#pragma implementation "drawnp.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
@@ -24,9 +25,7 @@
 #include <wx/wx.h>
 #endif
 
-#ifdef PROLOGIO
 #include <wx/wxexpr.h>
-#endif
 
 #include "basic.h"
 #include "basicp.h"
@@ -240,6 +239,7 @@ void wxDrawnShape::WriteAttributes(wxExpr *clause)
 {
   wxRectangleShape::WriteAttributes(clause);
 
+  clause->AddAttributeValue("current_angle", (long)m_currentAngle);
   clause->AddAttributeValue("save_metafile", (long)m_saveToFile);
   if (m_saveToFile)
   {
@@ -257,7 +257,8 @@ void wxDrawnShape::ReadAttributes(wxExpr *clause)
   wxRectangleShape::ReadAttributes(clause);
 
   int iVal = (int) m_saveToFile;
-  clause->AssignAttributeValue("save_metafile", &iVal);
+  clause->GetAttributeValue("save_metafile", iVal);
+  clause->GetAttributeValue("current_angle", m_currentAngle);
   m_saveToFile = (iVal != 0);
 
   if (m_saveToFile)
@@ -521,7 +522,7 @@ wxDrawOp *wxOpSetGDI::Copy(wxPseudoMetaFile *newImage)
 
 wxExpr *wxOpSetGDI::WriteExpr(wxPseudoMetaFile *image)
 {
-  wxExpr *expr = new wxExpr(PrologList);
+  wxExpr *expr = new wxExpr(wxExprList);
   expr->Append(new wxExpr((long)m_op));
   switch (m_op)
   {
@@ -606,7 +607,7 @@ void wxOpSetClipping::Do(wxDC& dc, double xoffset, double yoffset)
   {
     case DRAWOP_SET_CLIPPING_RECT:
     {
-      dc.SetClippingRegion(m_x1 + xoffset, m_y1 + yoffset, m_x2 + xoffset, m_y2 + yoffset);
+      dc.SetClippingRegion((long)(m_x1 + xoffset), (long)(m_y1 + yoffset), (long)(m_x2 + xoffset), (long)(m_y2 + yoffset));
       break;
     }
     case DRAWOP_DESTROY_CLIPPING_RECT:
@@ -635,7 +636,7 @@ void wxOpSetClipping::Translate(double x, double y)
 
 wxExpr *wxOpSetClipping::WriteExpr(wxPseudoMetaFile *image)
 {
-  wxExpr *expr = new wxExpr(PrologList);
+  wxExpr *expr = new wxExpr(wxExprList);
   expr->Append(new wxExpr((long)m_op));
   switch (m_op)
   {
@@ -879,7 +880,7 @@ void wxOpDraw::Rotate(double x, double y, double theta, double sinTheta, double
 
 wxExpr *wxOpDraw::WriteExpr(wxPseudoMetaFile *image)
 {
-  wxExpr *expr = new wxExpr(PrologList);
+  wxExpr *expr = new wxExpr(wxExprList);
   expr->Append(new wxExpr((long)m_op));
   switch (m_op)
   {
@@ -912,7 +913,7 @@ wxExpr *wxOpDraw::WriteExpr(wxPseudoMetaFile *image)
     {
       expr->Append(new wxExpr(m_x1));
       expr->Append(new wxExpr(m_y1));
-      expr->Append(new wxExpr(PrologString, m_textString));
+      expr->Append(new wxExpr(wxExprString, m_textString));
       break;
     }
     case DRAWOP_DRAW_ARC:
@@ -1103,7 +1104,7 @@ void wxOpPolyDraw::Rotate(double x, double y, double theta, double sinTheta, dou
 
 wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image)
 {
-  wxExpr *expr = new wxExpr(PrologList);
+  wxExpr *expr = new wxExpr(wxExprList);
   expr->Append(new wxExpr((long)m_op));
   expr->Append(new wxExpr((long)m_noPoints));
 
@@ -1140,7 +1141,7 @@ wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image)
       strcat(oglBuffer, buf3);
     }
   }
-  expr->Append(new wxExpr(PrologString, oglBuffer));
+  expr->Append(new wxExpr(wxExprString, oglBuffer));
   return expr;
 }
 
@@ -1207,7 +1208,7 @@ bool wxOpPolyDraw::OnDrawOutline(wxDC& dc, double x, double y, double w, double
         intPoints[i].x = WXROUND (x_proportion * m_points[i].x);
         intPoints[i].y = WXROUND (y_proportion * m_points[i].y);
     }
-    dc.DrawPolygon(n, intPoints, x, y);
+    dc.DrawPolygon(n, intPoints, (long) x, (long) y);
     delete[] intPoints;
     return TRUE;
 }
@@ -1217,7 +1218,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1,
                                      double x2, double y2,
                                      double *x3, double *y3,
                                      double xOffset, double yOffset,
-                                     bool attachmentMode)
+                                     int attachmentMode)
 {
   int n = m_noPoints;
 
@@ -1225,7 +1226,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1,
   // and we would want to connect to a point on that vertical --
   // oglFindEndForPolyline can't cope with this (the arrow
   // gets drawn to the wrong place).
-  if ((!attachmentMode) && (x1 == x2))
+  if ((attachmentMode == ATTACHMENT_MODE_NONE) && (x1 == x2))
   {
     // Look for the point we'd be connecting to. This is
     // a heuristic...
@@ -1480,7 +1481,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
       if (obj->IsKindOf(CLASSINFO(wxPen)))
       {
         wxPen *thePen = (wxPen *)obj;
-        expr = new wxExpr(PrologList);
+        expr = new wxExpr(wxExprList);
         expr->Append(new wxExpr((long)gyTYPE_PEN));
         expr->Append(new wxExpr((long)thePen->GetWidth()));
         expr->Append(new wxExpr((long)thePen->GetStyle()));
@@ -1491,7 +1492,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
       else if (obj->IsKindOf(CLASSINFO(wxBrush)))
       {
         wxBrush *theBrush = (wxBrush *)obj;
-        expr = new wxExpr(PrologList);
+        expr = new wxExpr(wxExprList);
         expr->Append(new wxExpr((long)gyTYPE_BRUSH));
         expr->Append(new wxExpr((long)theBrush->GetStyle()));
         expr->Append(new wxExpr((long)theBrush->GetColour().Red()));
@@ -1501,7 +1502,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
       else if (obj->IsKindOf(CLASSINFO(wxFont)))
       {
         wxFont *theFont = (wxFont *)obj;
-        expr = new wxExpr(PrologList);
+        expr = new wxExpr(wxExprList);
         expr->Append(new wxExpr((long)gyTYPE_FONT));
         expr->Append(new wxExpr((long)theFont->GetPointSize()));
         expr->Append(new wxExpr((long)theFont->GetFamily()));
@@ -1513,7 +1514,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
     else
     {
       // If no recognised GDI object, append a place holder anyway.
-      expr = new wxExpr(PrologList);
+      expr = new wxExpr(wxExprList);
       expr->Append(new wxExpr((long)0));
     }
 
@@ -1544,7 +1545,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
   // Write outline and fill GDI op lists (if any)
   if (m_outlineColours.Number() > 0)
   {
-    wxExpr *outlineExpr = new wxExpr(PrologList);
+    wxExpr *outlineExpr = new wxExpr(wxExprList);
     node = m_outlineColours.First();
     while (node)
     {
@@ -1558,7 +1559,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
   }
   if (m_fillColours.Number() > 0)
   {
-    wxExpr *fillExpr = new wxExpr(PrologList);
+    wxExpr *fillExpr = new wxExpr(wxExprList);
     node = m_fillColours.First();
     while (node)
     {