Changes needed for wxUSE_UNICODE for wxOGL to compile. I'm not

completely sure everything was converted right, but it at least
compiles now (and appears to work in wxPython.)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-03-15 20:50:40 +00:00
parent 1496068d02
commit c1fa2fda3c
11 changed files with 159 additions and 155 deletions

View File

@@ -22,7 +22,7 @@
* Drawing operations * Drawing operations
* *
*/ */
#define DRAWOP_SET_PEN 1 #define DRAWOP_SET_PEN 1
#define DRAWOP_SET_BRUSH 2 #define DRAWOP_SET_BRUSH 2
#define DRAWOP_SET_FONT 3 #define DRAWOP_SET_FONT 3
@@ -54,7 +54,7 @@
* Base, virtual class * Base, virtual class
* *
*/ */
class wxDrawOp: public wxObject class wxDrawOp: public wxObject
{ {
public: public:
@@ -91,7 +91,7 @@ protected:
* Set font, brush, text colour * Set font, brush, text colour
* *
*/ */
class wxOpSetGDI: public wxDrawOp class wxOpSetGDI: public wxDrawOp
{ {
public: public:
@@ -114,7 +114,7 @@ public:
* Set/destroy clipping * Set/destroy clipping
* *
*/ */
class wxOpSetClipping: public wxDrawOp class wxOpSetClipping: public wxDrawOp
{ {
public: public:
@@ -137,12 +137,12 @@ public:
* Draw line, rectangle, rounded rectangle, ellipse, point, arc, text * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
* *
*/ */
class wxOpDraw: public wxDrawOp class wxOpDraw: public wxDrawOp
{ {
public: public:
wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
double radius = 0.0, char *s = NULL); double radius = 0.0, wxChar *s = NULL);
~wxOpDraw(); ~wxOpDraw();
void Do(wxDC& dc, double xoffset, double yoffset); void Do(wxDC& dc, double xoffset, double yoffset);
void Scale(double scaleX, double scaleY); void Scale(double scaleX, double scaleY);
@@ -160,7 +160,7 @@ public:
double m_x3; double m_x3;
double m_y3; double m_y3;
double m_radius; double m_radius;
char* m_textString; wxChar* m_textString;
}; };
@@ -196,7 +196,7 @@ public:
public: public:
wxRealPoint* m_points; wxRealPoint* m_points;
int m_noPoints; int m_noPoints;
}; };
#endif #endif

View File

@@ -169,9 +169,9 @@ class wxMetaRecord: public wxObject
long param6; long param6;
long param7; long param7;
long param8; long param8;
char *stringParam; wxChar *stringParam;
wxRealPoint *points; wxRealPoint *points;
wxMetaRecord(int fun) wxMetaRecord(int fun)
{ {
metaFunction = fun; points = NULL; stringParam = NULL; metaFunction = fun; points = NULL; stringParam = NULL;
@@ -197,7 +197,7 @@ class wxXMetaFile: public wxObject
// referenced by position in list by SelectObject // referenced by position in list by SelectObject
wxXMetaFile(char *file = NULL); wxXMetaFile(char *file = NULL);
~wxXMetaFile(void); ~wxXMetaFile(void);
// After this is called, the metafile cannot be used for anything // After this is called, the metafile cannot be used for anything
// since it is now owned by the clipboard. // since it is now owned by the clipboard.
bool SetClipboard(int width = 0, int height = 0); bool SetClipboard(int width = 0, int height = 0);

View File

@@ -818,25 +818,26 @@ int wxShape::GetRegionId(const wxString& name)
void wxShape::NameRegions(const wxString& parentName) void wxShape::NameRegions(const wxString& parentName)
{ {
int n = GetNumberOfTextRegions(); int n = GetNumberOfTextRegions();
char buf[100]; wxString buff;
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
if (parentName.Length() > 0) if (parentName.Length() > 0)
sprintf(buf, "%s.%d", (const char*) parentName, i); buff << parentName << "." << i;
else else
sprintf(buf, "%d", i); buff << i;
SetRegionName(buf, i); SetRegionName(buff, i);
} }
wxNode *node = m_children.First(); wxNode *node = m_children.First();
int j = 0; int j = 0;
while (node) while (node)
{ {
buff.Empty();
wxShape *child = (wxShape *)node->Data(); wxShape *child = (wxShape *)node->Data();
if (parentName.Length() > 0) if (parentName.Length() > 0)
sprintf(buf, "%s.%d", (const char*) parentName, j); buff << parentName << "." << i;
else else
sprintf(buf, "%d", j); buff << i;
child->NameRegions(buf); child->NameRegions(buff);
node = node->Next(); node = node->Next();
j ++; j ++;
} }
@@ -872,7 +873,7 @@ void wxShape::FindRegionNames(wxStringList& list)
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
wxString name(GetRegionName(i)); wxString name(GetRegionName(i));
list.Add((const char*) name); list.Add(name);
} }
wxNode *node = m_children.First(); wxNode *node = m_children.First();
@@ -1931,7 +1932,7 @@ void wxShape::ReadAttributes(wxExpr *clause)
} }
} }
wxShapeTextLine *line = wxShapeTextLine *line =
new wxShapeTextLine(the_x, the_y, (char*) (const char*) the_string); new wxShapeTextLine(the_x, the_y, the_string);
m_text.Append(line); m_text.Append(line);
node = node->next; node = node->next;
@@ -2226,7 +2227,7 @@ void wxShape::ReadRegions(wxExpr *clause)
if (the_string) if (the_string)
{ {
wxShapeTextLine *line = wxShapeTextLine *line =
new wxShapeTextLine(the_x, the_y, (char*) (const char*) the_string); new wxShapeTextLine(the_x, the_y, the_string);
region->m_formattedText.Append(line); region->m_formattedText.Append(line);
} }
node = node->next; node = node->next;
@@ -2992,7 +2993,7 @@ bool wxShape::GetBranchingAttachmentInfo(int attachment, wxRealPoint& root, wxRe
} }
default: default:
{ {
wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentInfo." ); wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentInfo.") );
break; break;
} }
} }
@@ -3051,7 +3052,7 @@ bool wxShape::GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& pt
} }
default: default:
{ {
wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentPoint." ); wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentPoint.") );
break; break;
} }
} }
@@ -3116,7 +3117,7 @@ wxRealPoint wxShape::GetBranchingAttachmentRoot(int attachment)
} }
default: default:
{ {
wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentRoot." ); wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentRoot.") );
break; break;
} }
} }

View File

@@ -586,8 +586,8 @@ void wxPolygonShape::WriteAttributes(wxExpr *clause)
{ {
wxShape::WriteAttributes(clause); wxShape::WriteAttributes(clause);
clause->AddAttributeValue("x", m_xpos); clause->AddAttributeValue(wxT("x"), m_xpos);
clause->AddAttributeValue("y", m_ypos); clause->AddAttributeValue(wxT("y"), m_ypos);
// Make a list of lists for the coordinates // Make a list of lists for the coordinates
wxExpr *list = new wxExpr(wxExprList); wxExpr *list = new wxExpr(wxExprList);
@@ -605,7 +605,7 @@ void wxPolygonShape::WriteAttributes(wxExpr *clause)
node = node->Next(); node = node->Next();
} }
clause->AddAttributeValue("points", list); clause->AddAttributeValue(wxT("points"), list);
// Save the original (unscaled) points // Save the original (unscaled) points
list = new wxExpr(wxExprList); list = new wxExpr(wxExprList);
@@ -622,7 +622,7 @@ void wxPolygonShape::WriteAttributes(wxExpr *clause)
node = node->Next(); node = node->Next();
} }
clause->AddAttributeValue("m_originalPoints", list); clause->AddAttributeValue(wxT("m_originalPoints"), list);
} }
void wxPolygonShape::ReadAttributes(wxExpr *clause) void wxPolygonShape::ReadAttributes(wxExpr *clause)
@@ -634,7 +634,7 @@ void wxPolygonShape::ReadAttributes(wxExpr *clause)
m_originalPoints = new wxList; m_originalPoints = new wxList;
wxExpr *points_list = NULL; wxExpr *points_list = NULL;
clause->AssignAttributeValue("points", &points_list); clause->AssignAttributeValue(wxT("points"), &points_list);
// If no points_list, don't crash!! Assume a diamond instead. // If no points_list, don't crash!! Assume a diamond instead.
double the_height = 100.0; double the_height = 100.0;
@@ -676,7 +676,7 @@ void wxPolygonShape::ReadAttributes(wxExpr *clause)
} }
points_list = NULL; points_list = NULL;
clause->AssignAttributeValue("m_originalPoints", &points_list); clause->AssignAttributeValue(wxT("m_originalPoints"), &points_list);
// If no points_list, don't crash!! Assume a diamond instead. // If no points_list, don't crash!! Assume a diamond instead.
if (!points_list) if (!points_list)
@@ -944,21 +944,21 @@ bool wxRectangleShape::GetPerimeterPoint(double x1, double y1,
void wxRectangleShape::WriteAttributes(wxExpr *clause) void wxRectangleShape::WriteAttributes(wxExpr *clause)
{ {
wxShape::WriteAttributes(clause); wxShape::WriteAttributes(clause);
clause->AddAttributeValue("x", m_xpos); clause->AddAttributeValue(wxT("x"), m_xpos);
clause->AddAttributeValue("y", m_ypos); clause->AddAttributeValue(wxT("y"), m_ypos);
clause->AddAttributeValue("width", m_width); clause->AddAttributeValue(wxT("width"), m_width);
clause->AddAttributeValue("height", m_height); clause->AddAttributeValue(wxT("height"), m_height);
if (m_cornerRadius != 0.0) if (m_cornerRadius != 0.0)
clause->AddAttributeValue("corner", m_cornerRadius); clause->AddAttributeValue(wxT("corner"), m_cornerRadius);
} }
void wxRectangleShape::ReadAttributes(wxExpr *clause) void wxRectangleShape::ReadAttributes(wxExpr *clause)
{ {
wxShape::ReadAttributes(clause); wxShape::ReadAttributes(clause);
clause->AssignAttributeValue("width", &m_width); clause->AssignAttributeValue(wxT("width"), &m_width);
clause->AssignAttributeValue("height", &m_height); clause->AssignAttributeValue(wxT("height"), &m_height);
clause->AssignAttributeValue("corner", &m_cornerRadius); clause->AssignAttributeValue(wxT("corner"), &m_cornerRadius);
// In case we're reading an old file, set the region's size // In case we're reading an old file, set the region's size
if (m_regions.Number() == 1) if (m_regions.Number() == 1)
@@ -1084,18 +1084,18 @@ void wxEllipseShape::SetSize(double x, double y, bool recursive)
void wxEllipseShape::WriteAttributes(wxExpr *clause) void wxEllipseShape::WriteAttributes(wxExpr *clause)
{ {
wxShape::WriteAttributes(clause); wxShape::WriteAttributes(clause);
clause->AddAttributeValue("x", m_xpos); clause->AddAttributeValue(wxT("x"), m_xpos);
clause->AddAttributeValue("y", m_ypos); clause->AddAttributeValue(wxT("y"), m_ypos);
clause->AddAttributeValue("width", m_width); clause->AddAttributeValue(wxT("width"), m_width);
clause->AddAttributeValue("height", m_height); clause->AddAttributeValue(wxT("height"), m_height);
} }
void wxEllipseShape::ReadAttributes(wxExpr *clause) void wxEllipseShape::ReadAttributes(wxExpr *clause)
{ {
wxShape::ReadAttributes(clause); wxShape::ReadAttributes(clause);
clause->AssignAttributeValue("width", &m_width); clause->AssignAttributeValue(wxT("width"), &m_width);
clause->AssignAttributeValue("height", &m_height); clause->AssignAttributeValue(wxT("height"), &m_height);
// In case we're reading an old file, set the region's size // In case we're reading an old file, set the region's size
if (m_regions.Number() == 1) if (m_regions.Number() == 1)

View File

@@ -723,7 +723,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
if (objExpr1 && objExpr1->GetClientData()) if (objExpr1 && objExpr1->GetClientData())
m_constrainingObject = (wxShape *)objExpr1->GetClientData(); m_constrainingObject = (wxShape *)objExpr1->GetClientData();
else else
wxLogFatalError("Object graphics error: Couldn't find constraining image of composite."); wxLogFatalError(wxT("Object graphics error: Couldn't find constraining image of composite."));
int i = 0; int i = 0;
wxExpr *currentIdExpr = constrainedExpr->Nth(i); wxExpr *currentIdExpr = constrainedExpr->Nth(i);
@@ -737,7 +737,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
} }
else else
{ {
wxLogFatalError("Object graphics error: Couldn't find constrained image of composite."); wxLogFatalError(wxT("Object graphics error: Couldn't find constrained image of composite."));
} }
i ++; i ++;
@@ -746,7 +746,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
wxOGLConstraint *newConstraint = AddConstraint(cType, m_constrainingObject, m_constrainedObjects); wxOGLConstraint *newConstraint = AddConstraint(cType, m_constrainingObject, m_constrainedObjects);
newConstraint->SetSpacing(cXSpacing, cYSpacing); newConstraint->SetSpacing(cXSpacing, cYSpacing);
newConstraint->m_constraintId = cId; newConstraint->m_constraintId = cId;
newConstraint->m_constraintName = (const char*) cName; newConstraint->m_constraintName = cName;
constraintNo ++; constraintNo ++;
} }
} }

View File

@@ -706,7 +706,7 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double x, double y, int keys, int
wxShapeRegion *region = (wxShapeRegion *)node->Data(); wxShapeRegion *region = (wxShapeRegion *)node->Data();
if (region->GetText()) if (region->GetText())
{ {
char *s = copystring(region->GetText()); wxChar *s = copystring(region->GetText());
dividedObject->FormatText(dc, s, i); dividedObject->FormatText(dc, s, i);
delete[] s; delete[] s;
} }

View File

@@ -71,7 +71,7 @@ void wxDrawnShape::OnDraw(wxDC& dc)
m_metafiles[m_currentAngle].m_outlinePen = g_oglTransparentPen; 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].Draw(dc, m_xpos + m_shadowOffsetX, m_ypos + m_shadowOffsetY);
} }
m_metafiles[m_currentAngle].m_outlinePen = m_pen; m_metafiles[m_currentAngle].m_outlinePen = m_pen;
m_metafiles[m_currentAngle].m_fillBrush = m_brush; m_metafiles[m_currentAngle].m_fillBrush = m_brush;
m_metafiles[m_currentAngle].Draw(dc, m_xpos, m_ypos); m_metafiles[m_currentAngle].Draw(dc, m_xpos, m_ypos);
@@ -137,7 +137,7 @@ void wxDrawnShape::Rotate(double x, double y, double theta)
// Rotate metafile // Rotate metafile
if (!m_metafiles[0].GetRotateable()) if (!m_metafiles[0].GetRotateable())
return; return;
m_metafiles[0].Rotate(x, y, theta); m_metafiles[0].Rotate(x, y, theta);
} }
@@ -406,12 +406,12 @@ void wxDrawnShape::SetDrawnBackgroundMode(int mode)
* Individual operations * Individual operations
* *
*/ */
/* /*
* Set font, brush, text colour * Set font, brush, text colour
* *
*/ */
wxOpSetGDI::wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode): wxOpSetGDI::wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode):
wxDrawOp(theOp) wxDrawOp(theOp)
{ {
@@ -585,7 +585,7 @@ void wxOpSetGDI::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr)
* Set/destroy clipping * Set/destroy clipping
* *
*/ */
wxOpSetClipping::wxOpSetClipping(int theOp, double theX1, double theY1, wxOpSetClipping::wxOpSetClipping(int theOp, double theX1, double theY1,
double theX2, double theY2):wxDrawOp(theOp) double theX2, double theY2):wxDrawOp(theOp)
{ {
@@ -600,7 +600,7 @@ wxDrawOp *wxOpSetClipping::Copy(wxPseudoMetaFile *newImage)
wxOpSetClipping *newOp = new wxOpSetClipping(m_op, m_x1, m_y1, m_x2, m_y2); wxOpSetClipping *newOp = new wxOpSetClipping(m_op, m_x1, m_y1, m_x2, m_y2);
return newOp; return newOp;
} }
void wxOpSetClipping::Do(wxDC& dc, double xoffset, double yoffset) void wxOpSetClipping::Do(wxDC& dc, double xoffset, double yoffset)
{ {
switch (m_op) switch (m_op)
@@ -675,9 +675,9 @@ void wxOpSetClipping::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr)
* Draw line, rectangle, rounded rectangle, ellipse, point, arc, text * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
* *
*/ */
wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, 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_x1 = theX1;
m_y1 = theY1; m_y1 = theY1;
@@ -969,7 +969,7 @@ void wxOpDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr)
m_x1 = expr->Nth(1)->RealValue(); m_x1 = expr->Nth(1)->RealValue();
m_y1 = expr->Nth(2)->RealValue(); m_y1 = expr->Nth(2)->RealValue();
wxString str(expr->Nth(3)->StringValue()); wxString str(expr->Nth(3)->StringValue());
m_textString = copystring((const char*) str); m_textString = copystring(str);
break; break;
} }
case DRAWOP_DRAW_ARC: case DRAWOP_DRAW_ARC:
@@ -1119,7 +1119,7 @@ wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image)
* E.g. "1B9080CD". 4 hex digits per coordinate pair. * E.g. "1B9080CD". 4 hex digits per coordinate pair.
* *
*/ */
for (int i = 0; i < m_noPoints; i++) for (int i = 0; i < m_noPoints; i++)
{ {
long signedX = (long)(m_points[i].x*100.0); long signedX = (long)(m_points[i].x*100.0);
@@ -1128,7 +1128,7 @@ wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image)
// Scale to 0 -> 64K // Scale to 0 -> 64K
long unSignedX = (long)(signedX + 32767.0); long unSignedX = (long)(signedX + 32767.0);
long unSignedY = (long)(signedY + 32767.0); long unSignedY = (long)(signedY + 32767.0);
// IntToHex((unsigned int)signedX, buf2); // IntToHex((unsigned int)signedX, buf2);
// IntToHex((unsigned int)signedY, buf3); // IntToHex((unsigned int)signedY, buf3);
IntToHex((int)unSignedX, buf2); IntToHex((int)unSignedX, buf2);
@@ -1163,7 +1163,7 @@ void wxOpPolyDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr)
buf1[2] = hexString[(size_t)(bufPtr + 2)]; buf1[2] = hexString[(size_t)(bufPtr + 2)];
buf1[3] = hexString[(size_t)(bufPtr + 3)]; buf1[3] = hexString[(size_t)(bufPtr + 3)];
buf1[4] = 0; buf1[4] = 0;
buf2[0] = hexString[(size_t)(bufPtr + 4)]; buf2[0] = hexString[(size_t)(bufPtr + 4)];
buf2[1] = hexString[(size_t)(bufPtr + 5)]; buf2[1] = hexString[(size_t)(bufPtr + 5)];
buf2[2] = hexString[(size_t)(bufPtr + 6)]; buf2[2] = hexString[(size_t)(bufPtr + 6)];
@@ -1251,7 +1251,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1,
} }
} }
} }
double *xpoints = new double[n]; double *xpoints = new double[n];
double *ypoints = new double[n]; double *ypoints = new double[n];
@@ -1263,7 +1263,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1,
ypoints[i] = point->y + yOffset; ypoints[i] = point->y + yOffset;
} }
oglFindEndForPolyline(n, xpoints, ypoints, oglFindEndForPolyline(n, xpoints, ypoints,
x1, y1, x2, y2, x3, y3); x1, y1, x2, y2, x3, y3);
delete[] xpoints; delete[] xpoints;
@@ -1288,7 +1288,7 @@ static void IntToHex(unsigned int dec, char *buf)
int digit2 = (int)((dec - (digit1*4096))/256); int digit2 = (int)((dec - (digit1*4096))/256);
int digit3 = (int)((dec - (digit1*4096) - (digit2*256))/16); int digit3 = (int)((dec - (digit1*4096) - (digit2*256))/16);
int digit4 = dec - (digit1*4096 + digit2*256 + digit3*16); int digit4 = dec - (digit1*4096 + digit2*256 + digit3*16);
buf[0] = hexArray[digit1]; buf[0] = hexArray[digit1];
buf[1] = hexArray[digit2]; buf[1] = hexArray[digit2];
buf[2] = hexArray[digit3]; buf[2] = hexArray[digit3];
@@ -1450,16 +1450,16 @@ void wxPseudoMetaFile::Rotate(double x, double y, double theta)
void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle) void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
{ {
wxString widthStr; wxString widthStr;
widthStr.Printf("meta_width%d", whichAngle); widthStr.Printf(wxT("meta_width%d"), whichAngle);
wxString heightStr; wxString heightStr;
heightStr.Printf("meta_height%d", whichAngle); heightStr.Printf(wxT("meta_height%d"), whichAngle);
wxString outlineStr; wxString outlineStr;
outlineStr.Printf("outline_op%d", whichAngle); outlineStr.Printf(wxT("outline_op%d"), whichAngle);
wxString rotateableStr; wxString rotateableStr;
rotateableStr.Printf("meta_rotateable%d", whichAngle); rotateableStr.Printf(wxT("meta_rotateable%d"), whichAngle);
// Write width and height // Write width and height
clause->AddAttributeValue(widthStr, m_width); clause->AddAttributeValue(widthStr, m_width);
@@ -1553,7 +1553,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
node = node->Next(); node = node->Next();
} }
wxString outlineObjectsStr; wxString outlineObjectsStr;
outlineObjectsStr.Printf("outline_objects%d", whichAngle); outlineObjectsStr.Printf(wxT("outline_objects%d"), whichAngle);
clause->AddAttributeValue(outlineObjectsStr, outlineExpr); clause->AddAttributeValue(outlineObjectsStr, outlineExpr);
} }
@@ -1567,26 +1567,26 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
node = node->Next(); node = node->Next();
} }
wxString fillObjectsStr; wxString fillObjectsStr;
fillObjectsStr.Printf("fill_objects%d", whichAngle); fillObjectsStr.Printf(wxT("fill_objects%d"), whichAngle);
clause->AddAttributeValue(fillObjectsStr, fillExpr); clause->AddAttributeValue(fillObjectsStr, fillExpr);
} }
} }
void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle)
{ {
wxString widthStr; wxString widthStr;
widthStr.Printf("meta_width%d", whichAngle); widthStr.Printf(wxT("meta_width%d"), whichAngle);
wxString heightStr; wxString heightStr;
heightStr.Printf("meta_height%d", whichAngle); heightStr.Printf(wxT("meta_height%d"), whichAngle);
wxString outlineStr; wxString outlineStr;
outlineStr.Printf("outline_op%d", whichAngle); outlineStr.Printf(wxT("outline_op%d"), whichAngle);
wxString rotateableStr; wxString rotateableStr;
rotateableStr.Printf("meta_rotateable%d", whichAngle); rotateableStr.Printf(wxT("meta_rotateable%d"), whichAngle);
clause->GetAttributeValue(widthStr, m_width); clause->GetAttributeValue(widthStr, m_width);
clause->GetAttributeValue(heightStr, m_height); clause->GetAttributeValue(heightStr, m_height);
@@ -1693,7 +1693,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle)
m_ops.Append(theOp); m_ops.Append(theOp);
break; break;
} }
case DRAWOP_SET_CLIPPING_RECT: case DRAWOP_SET_CLIPPING_RECT:
case DRAWOP_DESTROY_CLIPPING_RECT: case DRAWOP_DESTROY_CLIPPING_RECT:
{ {
@@ -1733,7 +1733,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle)
} }
wxString outlineObjectsStr; 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 // Now read in the list of outline and fill operations, if any
wxExpr *expr1 = clause->AttributeValue(outlineObjectsStr); wxExpr *expr1 = clause->AttributeValue(outlineObjectsStr);
@@ -1748,7 +1748,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle)
} }
wxString fillObjectsStr; wxString fillObjectsStr;
fillObjectsStr.Printf("fill_objects%d", whichAngle); fillObjectsStr.Printf(wxT("fill_objects%d"), whichAngle);
expr1 = clause->AttributeValue(fillObjectsStr); expr1 = clause->AttributeValue(fillObjectsStr);
if (expr1) if (expr1)
@@ -1784,7 +1784,7 @@ void wxPseudoMetaFile::Copy(wxPseudoMetaFile& copy)
copy.m_gdiObjects.Append(obj); copy.m_gdiObjects.Append(obj);
node = node->Next(); node = node->Next();
} }
// Copy the operations // Copy the operations
node = m_ops.First(); node = m_ops.First();
while (node) while (node)
@@ -1814,14 +1814,14 @@ void wxPseudoMetaFile::Copy(wxPseudoMetaFile& copy)
* fit width and return new width and height. * fit width and return new width and height.
* *
*/ */
bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double *rheight) bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double *rheight)
{ {
if (!FileExists(filename)) if (!FileExists(filename))
return NULL; return NULL;
wxXMetaFile *metaFile = new wxXMetaFile; wxXMetaFile *metaFile = new wxXMetaFile;
if (!metaFile->ReadFile(filename)) if (!metaFile->ReadFile(filename))
{ {
delete metaFile; delete metaFile;
@@ -1977,7 +1977,7 @@ bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double *
newPoints[i].x = record->points[i].x; newPoints[i].x = record->points[i].x;
newPoints[i].y = record->points[i].y; newPoints[i].y = record->points[i].y;
} }
wxOpPolyDraw *op = new wxOpPolyDraw(DRAWOP_DRAW_POLYGON, n, newPoints); wxOpPolyDraw *op = new wxOpPolyDraw(DRAWOP_DRAW_POLYGON, n, newPoints);
m_ops.Append(op); m_ops.Append(op);
break; break;
@@ -1991,7 +1991,7 @@ bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double *
newPoints[i].x = record->points[i].x; newPoints[i].x = record->points[i].x;
newPoints[i].y = record->points[i].y; newPoints[i].y = record->points[i].y;
} }
wxOpPolyDraw *op = new wxOpPolyDraw(DRAWOP_DRAW_POLYLINE, n, newPoints); wxOpPolyDraw *op = new wxOpPolyDraw(DRAWOP_DRAW_POLYLINE, n, newPoints);
m_ops.Append(op); m_ops.Append(op);
break; break;

View File

@@ -224,7 +224,7 @@ void wxLineShape::FormatText(wxDC& dc, const wxString& s, int i)
region->GetSize(&w, &h); region->GetSize(&w, &h);
// Initialize the size if zero // Initialize the size if zero
if (((w == 0) || (h == 0)) && (strlen(s) > 0)) if (((w == 0) || (h == 0)) && (s.Length() > 0))
{ {
w = 100; h = 50; w = 100; h = 50;
region->SetSize(w, h); region->SetSize(w, h);
@@ -820,7 +820,7 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p
else else
{ {
wxLogFatalError("Unknown arrowhead rotation case in lines.cc"); wxLogFatalError(wxT("Unknown arrowhead rotation case in lines.cc"));
} }
// Rotate about the centre of the object, then place // Rotate about the centre of the object, then place
@@ -1449,15 +1449,15 @@ void wxLineShape::ReadAttributes(wxExpr *clause)
wxShape::ReadAttributes(clause); wxShape::ReadAttributes(clause);
int iVal = (int) m_isSpline; int iVal = (int) m_isSpline;
clause->AssignAttributeValue("is_spline", &iVal); clause->AssignAttributeValue(wxT("is_spline"), &iVal);
m_isSpline = (iVal != 0); m_isSpline = (iVal != 0);
iVal = (int) m_maintainStraightLines; iVal = (int) m_maintainStraightLines;
clause->AssignAttributeValue("keep_lines_straight", &iVal); clause->AssignAttributeValue(wxT("keep_lines_straight"), &iVal);
m_maintainStraightLines = (iVal != 0); m_maintainStraightLines = (iVal != 0);
clause->AssignAttributeValue("align_start", &m_alignmentStart); clause->AssignAttributeValue(wxT("align_start"), &m_alignmentStart);
clause->AssignAttributeValue("align_end", &m_alignmentEnd); clause->AssignAttributeValue(wxT("align_end"), &m_alignmentEnd);
// Compatibility: check for no regions. // Compatibility: check for no regions.
if (m_regions.Number() == 0) if (m_regions.Number() == 0)
@@ -1481,12 +1481,12 @@ void wxLineShape::ReadAttributes(wxExpr *clause)
} }
newRegion = new wxShapeRegion; newRegion = new wxShapeRegion;
newRegion->SetName("Start"); newRegion->SetName(wxT("Start"));
newRegion->SetSize(150, 50); newRegion->SetSize(150, 50);
m_regions.Append((wxObject *)newRegion); m_regions.Append((wxObject *)newRegion);
newRegion = new wxShapeRegion; newRegion = new wxShapeRegion;
newRegion->SetName("End"); newRegion->SetName(wxT("End"));
newRegion->SetSize(150, 50); newRegion->SetSize(150, 50);
m_regions.Append((wxObject *)newRegion); m_regions.Append((wxObject *)newRegion);
} }
@@ -1494,14 +1494,14 @@ void wxLineShape::ReadAttributes(wxExpr *clause)
m_attachmentTo = 0; m_attachmentTo = 0;
m_attachmentFrom = 0; m_attachmentFrom = 0;
clause->AssignAttributeValue("attachment_to", &m_attachmentTo); clause->AssignAttributeValue(wxT("attachment_to"), &m_attachmentTo);
clause->AssignAttributeValue("attachment_from", &m_attachmentFrom); clause->AssignAttributeValue(wxT("attachment_from"), &m_attachmentFrom);
wxExpr *line_list = NULL; wxExpr *line_list = NULL;
// When image is created, there are default control points. Override // When image is created, there are default control points. Override
// them if there are some in the file. // them if there are some in the file.
clause->AssignAttributeValue("controls", &line_list); clause->AssignAttributeValue(wxT("controls"), &line_list);
if (line_list) if (line_list)
{ {
@@ -1533,7 +1533,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause)
// Read arrow list, for new OGL code // Read arrow list, for new OGL code
wxExpr *arrow_list = NULL; wxExpr *arrow_list = NULL;
clause->AssignAttributeValue("arrows", &arrow_list); clause->AssignAttributeValue(wxT("arrows"), &arrow_list);
if (arrow_list) if (arrow_list)
{ {
wxExpr *node = arrow_list->value.first; wxExpr *node = arrow_list->value.first;
@@ -1544,7 +1544,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause)
int arrowEnd = 0; int arrowEnd = 0;
double xOffset = 0.0; double xOffset = 0.0;
double arrowSize = 0.0; double arrowSize = 0.0;
wxString arrowName(""); wxString arrowName;
long arrowId = -1; long arrowId = -1;
wxExpr *type_expr = node->Nth(0); wxExpr *type_expr = node->Nth(0);
@@ -1576,7 +1576,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause)
else else
wxRegisterId(arrowId); wxRegisterId(arrowId);
wxArrowHead *arrowHead = AddArrow(arrowType, arrowEnd, arrowSize, xOffset, (char*) (const char*) arrowName, NULL, arrowId); wxArrowHead *arrowHead = AddArrow(arrowType, arrowEnd, arrowSize, xOffset, arrowName, NULL, arrowId);
if (yOffsetExpr) if (yOffsetExpr)
arrowHead->SetYOffset(yOffsetExpr->RealValue()); arrowHead->SetYOffset(yOffsetExpr->RealValue());
if (spacingExpr) if (spacingExpr)

View File

@@ -381,8 +381,8 @@ bool wxXMetaFile::ReadFile(char *file)
{ {
wxMetaRecord *rec = new wxMetaRecord(META_TEXTOUT); wxMetaRecord *rec = new wxMetaRecord(META_TEXTOUT);
int count = getshort(handle); int count = getshort(handle);
rec->stringParam = new char[count+1]; rec->stringParam = new wxChar[count+1];
fread((void *)rec->stringParam, sizeof(char), count, handle); fread((void *)rec->stringParam, sizeof(wxChar), count, handle);
rec->stringParam[count] = 0; rec->stringParam[count] = 0;
rec->param2 = getshort(handle); // Y rec->param2 = getshort(handle); // Y
rec->param1 = getshort(handle); // X rec->param1 = getshort(handle); // X

View File

@@ -63,11 +63,11 @@ wxList oglObjectCopyMapping(wxKEY_INTEGER);
void wxOGLInitialize() void wxOGLInitialize()
{ {
g_oglNormalFont = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL); g_oglNormalFont = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
g_oglBlackPen = wxThePenList->FindOrCreatePen("BLACK", 1, wxSOLID); g_oglBlackPen = wxThePenList->FindOrCreatePen(wxT("BLACK"), 1, wxSOLID);
g_oglTransparentPen = wxThePenList->FindOrCreatePen("WHITE", 1, wxTRANSPARENT); g_oglTransparentPen = wxThePenList->FindOrCreatePen(wxT("WHITE"), 1, wxTRANSPARENT);
g_oglBlackForegroundPen = wxThePenList->FindOrCreatePen("BLACK", 1, wxSOLID); g_oglBlackForegroundPen = wxThePenList->FindOrCreatePen(wxT("BLACK"), 1, wxSOLID);
g_oglWhiteBackgroundPen = wxThePenList->FindOrCreatePen("WHITE", 1, wxSOLID); g_oglWhiteBackgroundPen = wxThePenList->FindOrCreatePen(wxT("WHITE"), 1, wxSOLID);
g_oglWhiteBackgroundBrush = wxTheBrushList->FindOrCreateBrush("WHITE", wxSOLID); g_oglWhiteBackgroundBrush = wxTheBrushList->FindOrCreateBrush(wxT("WHITE"), wxSOLID);
OGLInitializeConstraintTypes(); OGLInitializeConstraintTypes();
@@ -135,16 +135,17 @@ int FontSizeDialog(wxFrame *parent, int old_size)
{ {
if (old_size <= 0) if (old_size <= 0)
old_size = 10; old_size = 10;
char buf[40]; wxString buf;
sprintf(buf, "%d", old_size); buf << old_size;
wxString ans = wxGetTextFromUser("Enter point size", "Font size", buf, parent); wxString ans = wxGetTextFromUser(wxT("Enter point size"), wxT("Font size"), buf, parent);
if (ans == "") if (ans.Length() == 0)
return 0; return 0;
int new_size = atoi(ans); long new_size = 0;
ans.ToLong(&new_size);
if ((new_size <= 0) || (new_size > 40)) if ((new_size <= 0) || (new_size > 40))
{ {
wxMessageBox("Invalid point size!", "Error", wxOK); wxMessageBox(wxT("Invalid point size!"), wxT("Error"), wxOK);
return 0; return 0;
} }
return new_size; return new_size;
@@ -354,24 +355,24 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
wxStringList word_list; wxStringList word_list;
// Make new lines into NULL strings at this point // Make new lines into NULL strings at this point
int i = 0; int j = 0; int len = strlen(text); int i = 0; int j = 0; int len = text.Length();
char word[200]; word[0] = 0; wxChar word[200]; word[0] = 0;
bool end_word = FALSE; bool new_line = FALSE; bool end_word = FALSE; bool new_line = FALSE;
while (i < len) while (i < len)
{ {
switch (text[i]) switch (text[i])
{ {
case '%': case wxT('%'):
{ {
i ++; i ++;
if (i == len) if (i == len)
{ word[j] = '%'; j ++; } { word[j] = wxT('%'); j ++; }
else else
{ {
if (text[i] == 'n') if (text[i] == wxT('n'))
{ new_line = TRUE; end_word = TRUE; i++; } { new_line = TRUE; end_word = TRUE; i++; }
else else
{ word[j] = '%'; j ++; word[j] = text[i]; j ++; i ++; } { word[j] = wxT('%'); j ++; word[j] = text[i]; j ++; i ++; }
} }
break; break;
} }
@@ -384,7 +385,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
{ {
new_line = TRUE; end_word = TRUE; i++; new_line = TRUE; end_word = TRUE; i++;
} }
case ' ': case wxT(' '):
{ {
end_word = TRUE; end_word = TRUE;
i ++; i ++;
@@ -414,8 +415,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
// Now, make a list of strings which can fit in the box // Now, make a list of strings which can fit in the box
wxStringList *string_list = new wxStringList; wxStringList *string_list = new wxStringList;
char buffer[400]; wxString buffer;
buffer[0] = 0;
wxNode *node = word_list.First(); wxNode *node = word_list.First();
long x, y; long x, y;
@@ -427,17 +427,17 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
if (!s) if (!s)
{ {
// FORCE NEW LINE // FORCE NEW LINE
if (strlen(buffer) > 0) if (buffer.Length() > 0)
string_list->Add(buffer); string_list->Add(buffer);
buffer[0] = 0; buffer.Empty();
} }
else else
{ {
if (buffer[0] != 0) if (buffer.Length() != 0)
strcat(buffer, " "); buffer += " ";
strcat(buffer, s); buffer += s;
dc.GetTextExtent(buffer, &x, &y); dc.GetTextExtent(buffer, &x, &y);
// Don't fit within the bounding box if we're fitting shape to contents // Don't fit within the bounding box if we're fitting shape to contents
@@ -447,14 +447,14 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
if (oldBuffer.Length() > 0) if (oldBuffer.Length() > 0)
string_list->Add(oldBuffer); string_list->Add(oldBuffer);
buffer[0] = 0; buffer.Empty();
strcat(buffer, s); buffer += s;
} }
} }
node = node->Next(); node = node->Next();
} }
if (buffer[0] != 0) if (buffer.Length() != 0)
string_list->Add(buffer); string_list->Add(buffer);
return string_list; return string_list;
@@ -799,29 +799,32 @@ bool oglRoughlyEqual(double val1, double val2, double tol)
*/ */
// Array used in DecToHex conversion routine. // Array used in DecToHex conversion routine.
static char sg_HexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', static wxChar sg_HexArray[] = { wxT('0'), wxT('1'), wxT('2'), wxT('3'),
'C', 'D', 'E', 'F' }; wxT('4'), wxT('5'), wxT('6'), wxT('7'),
wxT('8'), wxT('9'), wxT('A'), wxT('B'),
wxT('C'), wxT('D'), wxT('E'), wxT('F')
};
// Convert 2-digit hex number to decimal // Convert 2-digit hex number to decimal
unsigned int oglHexToDec(char* buf) unsigned int oglHexToDec(wxChar* buf)
{ {
int firstDigit, secondDigit; int firstDigit, secondDigit;
if (buf[0] >= 'A') if (buf[0] >= wxT('A'))
firstDigit = buf[0] - 'A' + 10; firstDigit = buf[0] - wxT('A') + 10;
else else
firstDigit = buf[0] - '0'; firstDigit = buf[0] - wxT('0');
if (buf[1] >= 'A') if (buf[1] >= wxT('A'))
secondDigit = buf[1] - 'A' + 10; secondDigit = buf[1] - wxT('A') + 10;
else else
secondDigit = buf[1] - '0'; secondDigit = buf[1] - wxT('0');
return firstDigit * 16 + secondDigit; return firstDigit * 16 + secondDigit;
} }
// Convert decimal integer to 2-character hex string // Convert decimal integer to 2-character hex string
void oglDecToHex(unsigned int dec, char *buf) void oglDecToHex(unsigned int dec, wxChar *buf)
{ {
int firstDigit = (int)(dec/16.0); int firstDigit = (int)(dec/16.0);
int secondDigit = (int)(dec - (firstDigit*16.0)); int secondDigit = (int)(dec - (firstDigit*16.0));
@@ -834,22 +837,22 @@ void oglDecToHex(unsigned int dec, char *buf)
wxColour oglHexToColour(const wxString& hex) wxColour oglHexToColour(const wxString& hex)
{ {
if (hex.Length() == 6) if (hex.Length() == 6)
{ {
char buf[7]; long r, g, b;
strncpy(buf, hex, 7); r = g = b = 0;
unsigned int r = oglHexToDec((char *)buf); hex.Mid(0,2).ToLong(&r, 16);
unsigned int g = oglHexToDec((char *)(buf+2)); hex.Mid(2,2).ToLong(&g, 16);
unsigned int b = oglHexToDec((char *)(buf+4)); hex.Mid(4,2).ToLong(&b, 16);
return wxColour(r, g, b); return wxColour(r, g, b);
} }
else else
return wxColour(0,0,0); return wxColour(0,0,0);
} }
// RGB to 3-digit hex // RGB to 3-digit hex
wxString oglColourToHex(const wxColour& colour) wxString oglColourToHex(const wxColour& colour)
{ {
char buf[7]; wxChar buf[7];
unsigned int red = colour.Red(); unsigned int red = colour.Red();
unsigned int green = colour.Green(); unsigned int green = colour.Green();
unsigned int blue = colour.Blue(); unsigned int blue = colour.Blue();

View File

@@ -257,9 +257,9 @@ bool wxDiagram::SaveFile(const wxString& filename)
} }
OnDatabaseSave(*database); OnDatabaseSave(*database);
char tempFile[400]; wxString tempFile;
wxGetTempFileName("diag", tempFile); wxGetTempFileName(wxT("diag"), tempFile);
FILE* file = fopen(tempFile, "w"); FILE* file = fopen(tempFile.mb_str(wxConvFile), "w");
if (! file) if (! file)
{ {
wxEndBusyCursor(); wxEndBusyCursor();
@@ -350,11 +350,11 @@ void wxDiagram::ReadNodes(wxExprDatabase& database)
wxExpr *clause = database.FindClauseByFunctor("shape"); wxExpr *clause = database.FindClauseByFunctor("shape");
while (clause) while (clause)
{ {
char *type = NULL; wxChar *type = NULL;
long parentId = -1; long parentId = -1;
clause->AssignAttributeValue("type", &type); clause->AssignAttributeValue(wxT("type"), &type);
clause->AssignAttributeValue("parent", &parentId); clause->AssignAttributeValue(wxT("parent"), &parentId);
wxClassInfo *classInfo = wxClassInfo::FindClass(type); wxClassInfo *classInfo = wxClassInfo::FindClass(type);
if (classInfo) if (classInfo)
{ {
@@ -394,12 +394,12 @@ void wxDiagram::ReadLines(wxExprDatabase& database)
wxExpr *clause = database.FindClauseByFunctor("line"); wxExpr *clause = database.FindClauseByFunctor("line");
while (clause) while (clause)
{ {
wxString type(""); wxString type;
long parentId = -1; long parentId = -1;
clause->GetAttributeValue("type", type); clause->GetAttributeValue("type", type);
clause->GetAttributeValue("parent", parentId); clause->GetAttributeValue("parent", parentId);
wxClassInfo *classInfo = wxClassInfo::FindClass((char*) (const char*) type); wxClassInfo *classInfo = wxClassInfo::FindClass(type);
if (classInfo) if (classInfo)
{ {
wxLineShape *shape = (wxLineShape *)classInfo->CreateObject(); wxLineShape *shape = (wxLineShape *)classInfo->CreateObject();