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:
@@ -142,7 +142,7 @@ 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;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -169,7 +169,7 @@ class wxMetaRecord: public wxObject
|
||||
long param6;
|
||||
long param7;
|
||||
long param8;
|
||||
char *stringParam;
|
||||
wxChar *stringParam;
|
||||
wxRealPoint *points;
|
||||
|
||||
wxMetaRecord(int fun)
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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 ++;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -677,7 +677,7 @@ void wxOpSetClipping::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr)
|
||||
*/
|
||||
|
||||
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:
|
||||
@@ -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,7 +1567,7 @@ 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);
|
||||
}
|
||||
@@ -1577,16 +1577,16 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
|
||||
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);
|
||||
@@ -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)
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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));
|
||||
@@ -835,11 +838,11 @@ 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
|
||||
@@ -849,7 +852,7 @@ wxColour oglHexToColour(const wxString& hex)
|
||||
// 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();
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user