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
*
*/
#define DRAWOP_SET_PEN 1
#define DRAWOP_SET_BRUSH 2
#define DRAWOP_SET_FONT 3
@ -54,7 +54,7 @@
* Base, virtual class
*
*/
class wxDrawOp: public wxObject
{
public:
@ -91,7 +91,7 @@ protected:
* Set font, brush, text colour
*
*/
class wxOpSetGDI: public wxDrawOp
{
public:
@ -114,7 +114,7 @@ public:
* Set/destroy clipping
*
*/
class wxOpSetClipping: public wxDrawOp
{
public:
@ -137,12 +137,12 @@ public:
* Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
*
*/
class wxOpDraw: public wxDrawOp
{
public:
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();
void Do(wxDC& dc, double xoffset, double yoffset);
void Scale(double scaleX, double scaleY);
@ -160,7 +160,7 @@ public:
double m_x3;
double m_y3;
double m_radius;
char* m_textString;
wxChar* m_textString;
};
@ -196,7 +196,7 @@ public:
public:
wxRealPoint* m_points;
int m_noPoints;
};
#endif

View File

@ -169,9 +169,9 @@ class wxMetaRecord: public wxObject
long param6;
long param7;
long param8;
char *stringParam;
wxChar *stringParam;
wxRealPoint *points;
wxMetaRecord(int fun)
{
metaFunction = fun; points = NULL; stringParam = NULL;
@ -197,7 +197,7 @@ class wxXMetaFile: public wxObject
// referenced by position in list by SelectObject
wxXMetaFile(char *file = NULL);
~wxXMetaFile(void);
// After this is called, the metafile cannot be used for anything
// since it is now owned by the clipboard.
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)
{
int n = GetNumberOfTextRegions();
char buf[100];
wxString buff;
for (int i = 0; i < n; i++)
{
if (parentName.Length() > 0)
sprintf(buf, "%s.%d", (const char*) parentName, i);
buff << parentName << "." << i;
else
sprintf(buf, "%d", i);
SetRegionName(buf, i);
buff << i;
SetRegionName(buff, i);
}
wxNode *node = m_children.First();
int j = 0;
while (node)
{
buff.Empty();
wxShape *child = (wxShape *)node->Data();
if (parentName.Length() > 0)
sprintf(buf, "%s.%d", (const char*) parentName, j);
buff << parentName << "." << i;
else
sprintf(buf, "%d", j);
child->NameRegions(buf);
buff << i;
child->NameRegions(buff);
node = node->Next();
j ++;
}
@ -872,7 +873,7 @@ void wxShape::FindRegionNames(wxStringList& list)
for (int i = 0; i < n; i++)
{
wxString name(GetRegionName(i));
list.Add((const char*) name);
list.Add(name);
}
wxNode *node = m_children.First();
@ -1931,7 +1932,7 @@ void wxShape::ReadAttributes(wxExpr *clause)
}
}
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);
node = node->next;
@ -2226,7 +2227,7 @@ void wxShape::ReadRegions(wxExpr *clause)
if (the_string)
{
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);
}
node = node->next;
@ -2992,7 +2993,7 @@ bool wxShape::GetBranchingAttachmentInfo(int attachment, wxRealPoint& root, wxRe
}
default:
{
wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentInfo." );
wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentInfo.") );
break;
}
}
@ -3051,7 +3052,7 @@ bool wxShape::GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& pt
}
default:
{
wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentPoint." );
wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentPoint.") );
break;
}
}
@ -3116,7 +3117,7 @@ wxRealPoint wxShape::GetBranchingAttachmentRoot(int attachment)
}
default:
{
wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentRoot." );
wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentRoot.") );
break;
}
}

View File

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

View File

@ -723,7 +723,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
if (objExpr1 && objExpr1->GetClientData())
m_constrainingObject = (wxShape *)objExpr1->GetClientData();
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;
wxExpr *currentIdExpr = constrainedExpr->Nth(i);
@ -737,7 +737,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
}
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 ++;
@ -746,7 +746,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
wxOGLConstraint *newConstraint = AddConstraint(cType, m_constrainingObject, m_constrainedObjects);
newConstraint->SetSpacing(cXSpacing, cYSpacing);
newConstraint->m_constraintId = cId;
newConstraint->m_constraintName = (const char*) cName;
newConstraint->m_constraintName = cName;
constraintNo ++;
}
}

View File

@ -706,7 +706,7 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double x, double y, int keys, int
wxShapeRegion *region = (wxShapeRegion *)node->Data();
if (region->GetText())
{
char *s = copystring(region->GetText());
wxChar *s = copystring(region->GetText());
dividedObject->FormatText(dc, s, i);
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].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 +137,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);
}
@ -406,12 +406,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)
{
@ -585,7 +585,7 @@ void wxOpSetGDI::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr)
* Set/destroy clipping
*
*/
wxOpSetClipping::wxOpSetClipping(int theOp, double theX1, double theY1,
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);
return newOp;
}
void wxOpSetClipping::Do(wxDC& dc, double xoffset, double yoffset)
{
switch (m_op)
@ -675,9 +675,9 @@ void wxOpSetClipping::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr)
* 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;
@ -969,7 +969,7 @@ void wxOpDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr)
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:
@ -1119,7 +1119,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 +1128,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);
@ -1163,7 +1163,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)];
@ -1251,7 +1251,7 @@ bool wxOpPolyDraw::GetPerimeterPoint(double x1, double y1,
}
}
}
double *xpoints = new double[n];
double *ypoints = new double[n];
@ -1263,7 +1263,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 +1288,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];
@ -1450,16 +1450,16 @@ void wxPseudoMetaFile::Rotate(double x, double y, double theta)
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);
@ -1553,7 +1553,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
node = node->Next();
}
wxString outlineObjectsStr;
outlineObjectsStr.Printf("outline_objects%d", whichAngle);
outlineObjectsStr.Printf(wxT("outline_objects%d"), whichAngle);
clause->AddAttributeValue(outlineObjectsStr, outlineExpr);
}
@ -1567,26 +1567,26 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
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);
@ -1693,7 +1693,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 +1733,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 +1748,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)
@ -1784,7 +1784,7 @@ void wxPseudoMetaFile::Copy(wxPseudoMetaFile& copy)
copy.m_gdiObjects.Append(obj);
node = node->Next();
}
// Copy the operations
node = m_ops.First();
while (node)
@ -1814,14 +1814,14 @@ void wxPseudoMetaFile::Copy(wxPseudoMetaFile& copy)
* fit width and return new width and height.
*
*/
bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, double *rwidth, double *rheight)
{
if (!FileExists(filename))
return NULL;
wxXMetaFile *metaFile = new wxXMetaFile;
if (!metaFile->ReadFile(filename))
{
delete metaFile;
@ -1977,7 +1977,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 +1991,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;

View File

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

View File

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

View File

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

View File

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