#endif
// For compilers that support precompilation, includes "wx.h".
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#include <wx/ogl/drawnp.h>
#include <wx/ogl/misc.h>
+#include <math.h>
+
static void IntToHex(unsigned int dec, char *buf);
static unsigned long HexToInt(char *buf);
extern char *oglBuffer;
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);
// Rotate metafile
if (!m_metafiles[0].GetRotateable())
return;
-
+
m_metafiles[0].Rotate(x, y, theta);
}
return wxRectangleShape::GetPerimeterPoint(x1, y1, x2, y2, x3, y3);
}
-#ifdef PROLOGIO
+#if wxUSE_PROLOGIO
void wxDrawnShape::WriteAttributes(wxExpr *clause)
{
wxRectangleShape::WriteAttributes(clause);
* Individual operations
*
*/
-
+
/*
* Set font, brush, text colour
*
*/
-
+
wxOpSetGDI::wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode):
wxDrawOp(theOp)
{
return newOp;
}
+#if wxUSE_PROLOGIO
wxExpr *wxOpSetGDI::WriteExpr(wxPseudoMetaFile *image)
{
wxExpr *expr = new wxExpr(wxExprList);
break;
}
}
+#endif
/*
* Set/destroy clipping
*
*/
-
+
wxOpSetClipping::wxOpSetClipping(int theOp, double theX1, double theY1,
double theX2, double theY2):wxDrawOp(theOp)
{
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)
m_y1 += y;
}
+#if wxUSE_PROLOGIO
wxExpr *wxOpSetClipping::WriteExpr(wxPseudoMetaFile *image)
{
wxExpr *expr = new wxExpr(wxExprList);
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;
}
}
+#if wxUSE_PROLOGIO
wxExpr *wxOpDraw::WriteExpr(wxPseudoMetaFile *image)
{
wxExpr *expr = new wxExpr(wxExprList);
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_textString = copystring(str);
break;
}
case DRAWOP_DRAW_ARC:
}
}
}
+#endif
/*
* Draw polygon, polyline, spline
}
}
+#if wxUSE_PROLOGIO
wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image)
{
wxExpr *expr = new wxExpr(wxExprList);
* 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);
// 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);
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)];
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)
}
}
}
-
+
double *xpoints = new double[n];
double *ypoints = new double[n];
ypoints[i] = point->y + yOffset;
}
- oglFindEndForPolyline(n, xpoints, ypoints,
+ oglFindEndForPolyline(n, xpoints, ypoints,
x1, y1, x2, y2, x3, y3);
delete[] xpoints;
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];
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);
node = node->Next();
}
wxString outlineObjectsStr;
- outlineObjectsStr.Printf("outline_objects%d", whichAngle);
+ outlineObjectsStr.Printf(wxT("outline_objects%d"), whichAngle);
clause->AddAttributeValue(outlineObjectsStr, outlineExpr);
}
node = node->Next();
}
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);
m_ops.Append(theOp);
break;
}
-
+
case DRAWOP_SET_CLIPPING_RECT:
case DRAWOP_DESTROY_CLIPPING_RECT:
{
}
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);
}
wxString fillObjectsStr;
- fillObjectsStr.Printf("fill_objects%d", whichAngle);
+ fillObjectsStr.Printf(wxT("fill_objects%d"), whichAngle);
expr1 = clause->AttributeValue(fillObjectsStr);
if (expr1)
copy.m_gdiObjects.Append(obj);
node = node->Next();
}
-
+
// Copy the operations
node = m_ops.First();
while (node)
* fit width and return new width and height.
*
*/
-
+
bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double *rheight)
{
- if (!FileExists(filename))
+ if (!wxFileExists(filename))
return NULL;
-
+
wxXMetaFile *metaFile = new wxXMetaFile;
-
+
if (!metaFile->ReadFile(filename))
{
delete metaFile;
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;
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;