wxWarning replaced with wxLogWarning (to solve the compilation problems due
to wxWarning's const incorrectness) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@483 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -54,6 +54,8 @@
|
|||||||
|
|
||||||
#include "wx/validate.h"
|
#include "wx/validate.h"
|
||||||
|
|
||||||
|
#include "wx/log.h"
|
||||||
|
|
||||||
#if USE_WX_RESOURCES
|
#if USE_WX_RESOURCES
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -97,7 +99,7 @@ void wxCleanUpResourceSystem(void)
|
|||||||
delete wxDefaultResourceTable;
|
delete wxDefaultResourceTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWarning(char *msg)
|
void wxLogWarning(char *msg)
|
||||||
{
|
{
|
||||||
wxMessageBox(msg, _("Warning"), wxOK);
|
wxMessageBox(msg, _("Warning"), wxOK);
|
||||||
}
|
}
|
||||||
@@ -287,7 +289,7 @@ bool wxResourceTable::ParseResourceData(char *data)
|
|||||||
PrologDatabase db;
|
PrologDatabase db;
|
||||||
if (!db.ReadPrologFromString(data))
|
if (!db.ReadPrologFromString(data))
|
||||||
{
|
{
|
||||||
wxWarning(_("Ill-formed resource file syntax."));
|
wxLogWarning(_("Ill-formed resource file syntax."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -793,10 +795,10 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *e
|
|||||||
id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
|
id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("Could not resolve control class or id '%s'. "
|
||||||
sprintf(buf, _("Could not resolve control class or id '%s'. Use (non-zero) integer instead\n or provide #define (see manual for caveats)"),
|
"Use (non-zero) integer instead\n or provide #define "
|
||||||
|
"(see manual for caveats)"),
|
||||||
(const char*) expr1->StringValue());
|
(const char*) expr1->StringValue());
|
||||||
wxWarning(buf);
|
|
||||||
delete controlItem;
|
delete controlItem;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1208,10 +1210,10 @@ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, PrologExpr *
|
|||||||
id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
|
id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("Could not resolve menu id '%s'. "
|
||||||
sprintf(buf, _("Could not resolve menu id '%s'. Use (non-zero) integer instead\n or provide #define (see manual for caveats)"),
|
"Use (non-zero) integer instead\n"
|
||||||
|
"or provide #define (see manual for caveats)"),
|
||||||
(const char*) idExpr->StringValue());
|
(const char*) idExpr->StringValue());
|
||||||
wxWarning(buf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (idExpr->Type() == PrologInteger)
|
else if (idExpr->Type() == PrologInteger)
|
||||||
@@ -1630,9 +1632,7 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("#define %s must be an integer."), name);
|
||||||
sprintf(buf, _("#define %s must be an integer."), name);
|
|
||||||
wxWarning(buf);
|
|
||||||
delete[] name;
|
delete[] name;
|
||||||
delete[] value;
|
delete[] value;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1654,9 +1654,7 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
|
|||||||
name[len-1] = 0;
|
name[len-1] = 0;
|
||||||
if (!wxResourceParseIncludeFile(actualName, table))
|
if (!wxResourceParseIncludeFile(actualName, table))
|
||||||
{
|
{
|
||||||
char buf[400];
|
wxLogWarning(_("Could not find resource include file %s."), actualName);
|
||||||
sprintf(buf, _("Could not find resource include file %s."), actualName);
|
|
||||||
wxWarning(buf);
|
|
||||||
}
|
}
|
||||||
delete[] name;
|
delete[] name;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1667,35 +1665,35 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
|
|||||||
strcpy(buf, _("Found "));
|
strcpy(buf, _("Found "));
|
||||||
strncat(buf, wxResourceBuffer, 30);
|
strncat(buf, wxResourceBuffer, 30);
|
||||||
strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
|
strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
|
||||||
wxWarning(buf);
|
wxLogWarning(buf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// char
|
// char
|
||||||
if (!wxGetResourceToken(fd))
|
if (!wxGetResourceToken(fd))
|
||||||
{
|
{
|
||||||
wxWarning(_("Unexpected end of file whilst parsing resource."));
|
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
|
||||||
*eof = TRUE;
|
*eof = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(wxResourceBuffer, "char") != 0)
|
if (strcmp(wxResourceBuffer, "char") != 0)
|
||||||
{
|
{
|
||||||
wxWarning(_("Expected 'char' whilst parsing resource."));
|
wxLogWarning(_("Expected 'char' whilst parsing resource."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *name
|
// *name
|
||||||
if (!wxGetResourceToken(fd))
|
if (!wxGetResourceToken(fd))
|
||||||
{
|
{
|
||||||
wxWarning(_("Unexpected end of file whilst parsing resource."));
|
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
|
||||||
*eof = TRUE;
|
*eof = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wxResourceBuffer[0] != '*')
|
if (wxResourceBuffer[0] != '*')
|
||||||
{
|
{
|
||||||
wxWarning(_("Expected '*' whilst parsing resource."));
|
wxLogWarning(_("Expected '*' whilst parsing resource."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
char nameBuf[100];
|
char nameBuf[100];
|
||||||
@@ -1704,21 +1702,21 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
|
|||||||
// =
|
// =
|
||||||
if (!wxGetResourceToken(fd))
|
if (!wxGetResourceToken(fd))
|
||||||
{
|
{
|
||||||
wxWarning(_("Unexpected end of file whilst parsing resource."));
|
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
|
||||||
*eof = TRUE;
|
*eof = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(wxResourceBuffer, "=") != 0)
|
if (strcmp(wxResourceBuffer, "=") != 0)
|
||||||
{
|
{
|
||||||
wxWarning(_("Expected '=' whilst parsing resource."));
|
wxLogWarning(_("Expected '=' whilst parsing resource."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String
|
// String
|
||||||
if (!wxGetResourceToken(fd))
|
if (!wxGetResourceToken(fd))
|
||||||
{
|
{
|
||||||
wxWarning(_("Unexpected end of file whilst parsing resource."));
|
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
|
||||||
*eof = TRUE;
|
*eof = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1726,9 +1724,7 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
|
|||||||
{
|
{
|
||||||
if (!db.ReadPrologFromString(wxResourceBuffer))
|
if (!db.ReadPrologFromString(wxResourceBuffer))
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf);
|
||||||
sprintf(buf, _("%s: ill-formed resource file syntax."), nameBuf);
|
|
||||||
wxWarning(buf);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2059,9 +2055,7 @@ long wxParseWindowStyle(char *bitListString)
|
|||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
char buf[200];
|
wxLogWarning(_("Unrecognized style %s whilst parsing resource."), word);
|
||||||
sprintf(buf, _("Unrecognized style %s whilst parsing resource."), word);
|
|
||||||
wxWarning(buf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2083,9 +2077,7 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
|
|||||||
{
|
{
|
||||||
if (!item->GetType() || strcmp(item->GetType(), "wxBitmap") != 0)
|
if (!item->GetType() || strcmp(item->GetType(), "wxBitmap") != 0)
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("%s not a bitmap resource specification."), resource);
|
||||||
sprintf(buf, _("%s not a bitmap resource specification."), resource);
|
|
||||||
wxWarning(buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int thisDepth = wxDisplayDepth();
|
int thisDepth = wxDisplayDepth();
|
||||||
@@ -2185,14 +2177,13 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
|
|||||||
wxItemResource *item = table->FindResource(name);
|
wxItemResource *item = table->FindResource(name);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
char buf[400];
|
wxLogWarning(_("Failed to find XBM resource %s.\n"
|
||||||
sprintf(buf, _("Failed to find XBM resource %s.\nForgot to use wxResourceLoadBitmapData?"), name);
|
"Forgot to use wxResourceLoadBitmapData?"), name);
|
||||||
wxWarning(buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bitmap = new wxBitmap((char *)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
|
bitmap = new wxBitmap((char *)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
|
||||||
#else
|
#else
|
||||||
wxWarning(_("No XBM facility available!"));
|
wxLogWarning(_("No XBM facility available!"));
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2202,14 +2193,13 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
|
|||||||
wxItemResource *item = table->FindResource(name);
|
wxItemResource *item = table->FindResource(name);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
char buf[400];
|
wxLogWarning(_("Failed to find XPM resource %s.\n"
|
||||||
sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadBitmapData?"), name);
|
"Forgot to use wxResourceLoadBitmapData?"), name);
|
||||||
wxWarning(buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bitmap = new wxBitmap(item->GetValue1());
|
bitmap = new wxBitmap(item->GetValue1());
|
||||||
#else
|
#else
|
||||||
wxWarning(_("No XPM facility available!"));
|
wxLogWarning(_("No XPM facility available!"));
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2234,9 +2224,7 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("Bitmap resource specification %s not found."), resource);
|
||||||
sprintf(buf, _("Bitmap resource specification %s not found."), resource);
|
|
||||||
wxWarning(buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2256,9 +2244,7 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
|
|||||||
{
|
{
|
||||||
if (!item->GetType() || strcmp(item->GetType(), "wxIcon") != 0)
|
if (!item->GetType() || strcmp(item->GetType(), "wxIcon") != 0)
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("%s not an icon resource specification."), resource);
|
||||||
sprintf(buf, _("%s not an icon resource specification."), resource);
|
|
||||||
wxWarning(buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int thisDepth = wxDisplayDepth();
|
int thisDepth = wxDisplayDepth();
|
||||||
@@ -2358,14 +2344,13 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
|
|||||||
wxItemResource *item = table->FindResource(name);
|
wxItemResource *item = table->FindResource(name);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
char buf[400];
|
wxLogWarning(_("Failed to find XBM resource %s.\n"
|
||||||
sprintf(buf, _("Failed to find XBM resource %s.\nForgot to use wxResourceLoadIconData?"), name);
|
"Forgot to use wxResourceLoadIconData?"), name);
|
||||||
wxWarning(buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
icon = new wxIcon((char *)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
|
icon = new wxIcon((char *)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
|
||||||
#else
|
#else
|
||||||
wxWarning(_("No XBM facility available!"));
|
wxLogWarning(_("No XBM facility available!"));
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2379,15 +2364,15 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
|
|||||||
{
|
{
|
||||||
char buf[400];
|
char buf[400];
|
||||||
sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadIconData?"), name);
|
sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadIconData?"), name);
|
||||||
wxWarning(buf);
|
wxLogWarning(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
icon = new wxIcon((char **)item->GetValue1());
|
icon = new wxIcon((char **)item->GetValue1());
|
||||||
#else
|
#else
|
||||||
wxWarning(_("No XPM facility available!"));
|
wxLogWarning(_("No XPM facility available!"));
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
wxWarning(_("No XPM icon facility available!"));
|
wxLogWarning(_("No XPM icon facility available!"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -2411,9 +2396,7 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("Icon resource specification %s not found."), resource);
|
||||||
sprintf(buf, _("Icon resource specification %s not found."), resource);
|
|
||||||
wxWarning(buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2739,9 +2722,7 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("#define %s must be an integer."), name);
|
||||||
sprintf(buf, _("#define %s must be an integer."), name);
|
|
||||||
wxWarning(buf);
|
|
||||||
delete[] name;
|
delete[] name;
|
||||||
delete[] value;
|
delete[] value;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2766,7 +2747,7 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
|
|||||||
{
|
{
|
||||||
char buf[400];
|
char buf[400];
|
||||||
sprintf(buf, _("Could not find resource include file %s."), actualName);
|
sprintf(buf, _("Could not find resource include file %s."), actualName);
|
||||||
wxWarning(buf);
|
wxLogWarning(buf);
|
||||||
}
|
}
|
||||||
delete[] name;
|
delete[] name;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -2778,35 +2759,35 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
|
|||||||
strcpy(buf, _("Found "));
|
strcpy(buf, _("Found "));
|
||||||
strncat(buf, wxResourceBuffer, 30);
|
strncat(buf, wxResourceBuffer, 30);
|
||||||
strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
|
strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
|
||||||
wxWarning(buf);
|
wxLogWarning(buf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// char
|
// char
|
||||||
if (!wxGetResourceTokenString(s))
|
if (!wxGetResourceTokenString(s))
|
||||||
{
|
{
|
||||||
wxWarning(_("Unexpected end of file whilst parsing resource."));
|
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
|
||||||
*eof = TRUE;
|
*eof = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(wxResourceBuffer, "char") != 0)
|
if (strcmp(wxResourceBuffer, "char") != 0)
|
||||||
{
|
{
|
||||||
wxWarning(_("Expected 'char' whilst parsing resource."));
|
wxLogWarning(_("Expected 'char' whilst parsing resource."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *name
|
// *name
|
||||||
if (!wxGetResourceTokenString(s))
|
if (!wxGetResourceTokenString(s))
|
||||||
{
|
{
|
||||||
wxWarning(_("Unexpected end of file whilst parsing resource."));
|
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
|
||||||
*eof = TRUE;
|
*eof = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wxResourceBuffer[0] != '*')
|
if (wxResourceBuffer[0] != '*')
|
||||||
{
|
{
|
||||||
wxWarning(_("Expected '*' whilst parsing resource."));
|
wxLogWarning(_("Expected '*' whilst parsing resource."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
char nameBuf[100];
|
char nameBuf[100];
|
||||||
@@ -2815,21 +2796,21 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
|
|||||||
// =
|
// =
|
||||||
if (!wxGetResourceTokenString(s))
|
if (!wxGetResourceTokenString(s))
|
||||||
{
|
{
|
||||||
wxWarning(_("Unexpected end of file whilst parsing resource."));
|
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
|
||||||
*eof = TRUE;
|
*eof = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(wxResourceBuffer, "=") != 0)
|
if (strcmp(wxResourceBuffer, "=") != 0)
|
||||||
{
|
{
|
||||||
wxWarning(_("Expected '=' whilst parsing resource."));
|
wxLogWarning(_("Expected '=' whilst parsing resource."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String
|
// String
|
||||||
if (!wxGetResourceTokenString(s))
|
if (!wxGetResourceTokenString(s))
|
||||||
{
|
{
|
||||||
wxWarning(_("Unexpected end of file whilst parsing resource."));
|
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
|
||||||
*eof = TRUE;
|
*eof = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -2837,9 +2818,7 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
|
|||||||
{
|
{
|
||||||
if (!db.ReadPrologFromString(wxResourceBuffer))
|
if (!db.ReadPrologFromString(wxResourceBuffer))
|
||||||
{
|
{
|
||||||
char buf[300];
|
wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf);
|
||||||
sprintf(buf, _("%s: ill-formed resource file syntax."), nameBuf);
|
|
||||||
wxWarning(buf);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user