Added wxString version of wxStripExtension; changed OnClose to return TRUE;
fixed some bad casts in resource.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@322 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -267,6 +267,21 @@ void wxStripExtension(char *buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxStripExtension(wxString& buffer)
|
||||||
|
{
|
||||||
|
size_t len = buffer.Length();
|
||||||
|
size_t i = len-1;
|
||||||
|
while (i > 0)
|
||||||
|
{
|
||||||
|
if (buffer.GetChar(i) == '.')
|
||||||
|
{
|
||||||
|
buffer = buffer.Left(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i --;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Destructive removal of /./ and /../ stuff
|
// Destructive removal of /./ and /../ stuff
|
||||||
char *wxRealPath (char *path)
|
char *wxRealPath (char *path)
|
||||||
{
|
{
|
||||||
|
@@ -785,7 +785,8 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *e
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id = wxResourceGetIdentifier(WXSTRINGCAST expr1->StringValue(), &table);
|
wxString str(expr1->StringValue());
|
||||||
|
id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
char buf[300];
|
char buf[300];
|
||||||
@@ -861,10 +862,11 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *e
|
|||||||
// Check for bitmap resource name
|
// Check for bitmap resource name
|
||||||
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
||||||
{
|
{
|
||||||
controlItem->SetValue4(WXSTRINGCAST expr->Nth(count)->StringValue());
|
wxString str(expr->Nth(count)->StringValue());
|
||||||
count ++;
|
controlItem->SetValue4(WXSTRINGCAST str);
|
||||||
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
count ++;
|
||||||
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
|
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
||||||
|
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (controlType == "wxCheckBox")
|
else if (controlType == "wxCheckBox")
|
||||||
@@ -896,7 +898,8 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *e
|
|||||||
// Check for default value
|
// Check for default value
|
||||||
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
||||||
{
|
{
|
||||||
controlItem->SetValue4(WXSTRINGCAST expr->Nth(count)->StringValue());
|
wxString str(expr->Nth(count)->StringValue());
|
||||||
|
controlItem->SetValue4(WXSTRINGCAST str);
|
||||||
count ++;
|
count ++;
|
||||||
|
|
||||||
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
||||||
@@ -914,7 +917,8 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *e
|
|||||||
// Check for bitmap resource name
|
// Check for bitmap resource name
|
||||||
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
||||||
{
|
{
|
||||||
controlItem->SetValue4(WXSTRINGCAST expr->Nth(count)->StringValue());
|
wxString str(expr->Nth(count)->StringValue());
|
||||||
|
controlItem->SetValue4(WXSTRINGCAST str);
|
||||||
count ++;
|
count ++;
|
||||||
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
||||||
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
|
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
|
||||||
@@ -1081,7 +1085,8 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *e
|
|||||||
PrologExpr *textValue = expr->Nth(count);
|
PrologExpr *textValue = expr->Nth(count);
|
||||||
if (textValue && (textValue->Type() == PrologString || textValue->Type() == PrologWord))
|
if (textValue && (textValue->Type() == PrologString || textValue->Type() == PrologWord))
|
||||||
{
|
{
|
||||||
controlItem->SetValue4(WXSTRINGCAST textValue->StringValue());
|
wxString str(textValue->StringValue());
|
||||||
|
controlItem->SetValue4(WXSTRINGCAST str);
|
||||||
|
|
||||||
count ++;
|
count ++;
|
||||||
|
|
||||||
@@ -1186,7 +1191,8 @@ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, PrologExpr *
|
|||||||
item->SetType("wxMenu"); // Well, menu item, but doesn't matter.
|
item->SetType("wxMenu"); // Well, menu item, but doesn't matter.
|
||||||
if (labelExpr)
|
if (labelExpr)
|
||||||
{
|
{
|
||||||
item->SetTitle(WXSTRINGCAST labelExpr->StringValue());
|
wxString str(labelExpr->StringValue());
|
||||||
|
item->SetTitle(WXSTRINGCAST str);
|
||||||
}
|
}
|
||||||
if (idExpr)
|
if (idExpr)
|
||||||
{
|
{
|
||||||
@@ -1194,7 +1200,8 @@ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, PrologExpr *
|
|||||||
// If a string or word, must look up in identifier table.
|
// If a string or word, must look up in identifier table.
|
||||||
if ((idExpr->Type() == PrologString) || (idExpr->Type() == PrologWord))
|
if ((idExpr->Type() == PrologString) || (idExpr->Type() == PrologWord))
|
||||||
{
|
{
|
||||||
id = wxResourceGetIdentifier(WXSTRINGCAST idExpr->StringValue(), &table);
|
wxString str(idExpr->StringValue());
|
||||||
|
id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
char buf[300];
|
char buf[300];
|
||||||
@@ -1209,7 +1216,8 @@ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, PrologExpr *
|
|||||||
}
|
}
|
||||||
if (helpExpr)
|
if (helpExpr)
|
||||||
{
|
{
|
||||||
item->SetValue4(WXSTRINGCAST helpExpr->StringValue());
|
wxString str(helpExpr->StringValue());
|
||||||
|
item->SetValue4(WXSTRINGCAST str);
|
||||||
}
|
}
|
||||||
if (checkableExpr)
|
if (checkableExpr)
|
||||||
item->SetValue2(checkableExpr->IntegerValue());
|
item->SetValue2(checkableExpr->IntegerValue());
|
||||||
@@ -1346,9 +1354,15 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), Prol
|
|||||||
PrologExpr *xresExpr = listExpr->Nth(4);
|
PrologExpr *xresExpr = listExpr->Nth(4);
|
||||||
PrologExpr *yresExpr = listExpr->Nth(5);
|
PrologExpr *yresExpr = listExpr->Nth(5);
|
||||||
if (nameExpr && nameExpr->StringValue())
|
if (nameExpr && nameExpr->StringValue())
|
||||||
bitmapSpec->SetName(WXSTRINGCAST nameExpr->StringValue());
|
{
|
||||||
|
wxString str(nameExpr->StringValue());
|
||||||
|
bitmapSpec->SetName(WXSTRINGCAST str);
|
||||||
|
}
|
||||||
if (typeExpr && typeExpr->StringValue())
|
if (typeExpr && typeExpr->StringValue())
|
||||||
bitmapSpec->SetValue1(wxParseWindowStyle(WXSTRINGCAST typeExpr->StringValue()));
|
{
|
||||||
|
wxString str(typeExpr->StringValue());
|
||||||
|
bitmapSpec->SetValue1(wxParseWindowStyle(WXSTRINGCAST str));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
bitmapSpec->SetValue1(0);
|
bitmapSpec->SetValue1(0);
|
||||||
|
|
||||||
@@ -1421,12 +1435,23 @@ wxFont *wxResourceInterpretFontSpec(PrologExpr *expr)
|
|||||||
PrologExpr *faceNameExpr = expr->Nth(5);
|
PrologExpr *faceNameExpr = expr->Nth(5);
|
||||||
if (pointExpr)
|
if (pointExpr)
|
||||||
point = (int)pointExpr->IntegerValue();
|
point = (int)pointExpr->IntegerValue();
|
||||||
|
|
||||||
|
wxString str;
|
||||||
if (familyExpr)
|
if (familyExpr)
|
||||||
family = (int)wxParseWindowStyle(WXSTRINGCAST familyExpr->StringValue());
|
{
|
||||||
|
str = familyExpr->StringValue();
|
||||||
|
family = (int)wxParseWindowStyle(WXSTRINGCAST str);
|
||||||
|
}
|
||||||
if (styleExpr)
|
if (styleExpr)
|
||||||
style = (int)wxParseWindowStyle(WXSTRINGCAST styleExpr->StringValue());
|
{
|
||||||
|
str = styleExpr->StringValue();
|
||||||
|
style = (int)wxParseWindowStyle(WXSTRINGCAST str);
|
||||||
|
}
|
||||||
if (weightExpr)
|
if (weightExpr)
|
||||||
weight = (int)wxParseWindowStyle(WXSTRINGCAST weightExpr->StringValue());
|
{
|
||||||
|
str = weightExpr->StringValue();
|
||||||
|
weight = (int)wxParseWindowStyle(WXSTRINGCAST str);
|
||||||
|
}
|
||||||
if (underlineExpr)
|
if (underlineExpr)
|
||||||
underline = (int)underlineExpr->IntegerValue();
|
underline = (int)underlineExpr->IntegerValue();
|
||||||
if (faceNameExpr)
|
if (faceNameExpr)
|
||||||
|
@@ -813,6 +813,11 @@ void wxFrame::OnCloseWindow(wxCloseEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxFrame::OnClose(void)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Destroy the window (delayed, if a managed window)
|
// Destroy the window (delayed, if a managed window)
|
||||||
bool wxFrame::Destroy(void)
|
bool wxFrame::Destroy(void)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user