Unicode complation fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
cd99221a57
commit
00393283ff
@ -154,7 +154,7 @@ public:
|
||||
// Returns numeric ID that is equivalent to string id used in XML
|
||||
// resource. To be used in event tables
|
||||
// Macro XMLID is provided for convenience
|
||||
static int GetXMLID(const char *str_id);
|
||||
static int GetXMLID(const wxChar *str_id);
|
||||
|
||||
// Returns version info (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a)
|
||||
long GetVersion() const { return m_version; }
|
||||
|
@ -57,7 +57,7 @@ void wxUnknownControlContainer::AddChild(wxWindowBase *child)
|
||||
|
||||
SetBackgroundColour(m_bg);
|
||||
child->SetName(m_controlName);
|
||||
child->SetId(XMLID(m_controlName));
|
||||
child->SetId(wxXmlResource::GetXMLID(m_controlName));
|
||||
m_controlAdded = TRUE;
|
||||
|
||||
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
- handle unknown encodings
|
||||
- process all elements, including CDATA
|
||||
- XML resources should automatically select desired encoding besed on
|
||||
- XML resources should automatically select desired encoding based on
|
||||
runtime environment (?) (would need BIN and BINZ formats modification,
|
||||
too)
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
inline static wxString CharToString(const char *s, size_t len = wxSTRING_MAXLEN)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
return wxString(s, wxMBConvUTF8, len);
|
||||
return wxString(s, wxConvUTF8, len);
|
||||
#else
|
||||
return wxString(s, len);
|
||||
#endif
|
||||
|
@ -83,8 +83,8 @@ bool wxXmlResource::Load(const wxString& filemask)
|
||||
while (!!fnd)
|
||||
{
|
||||
#if wxUSE_FILESYSTEM
|
||||
if (filemask.Lower().Matches("*.zip") ||
|
||||
filemask.Lower().Matches("*.rsc"))
|
||||
if (filemask.Lower().Matches(wxT("*.zip")) ||
|
||||
filemask.Lower().Matches(wxT("*.rsc")))
|
||||
{
|
||||
rt = rt && Load(fnd + wxT("#zip:*.xmb"));
|
||||
rt = rt && Load(fnd + wxT("#zip:*.xrc"));
|
||||
@ -569,7 +569,7 @@ int wxXmlResourceHandler::GetID()
|
||||
stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP);
|
||||
stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT);
|
||||
#undef stdID
|
||||
else return XMLID(sid.c_str());
|
||||
else return wxXmlResource::GetXMLID(sid);
|
||||
}
|
||||
|
||||
|
||||
@ -618,7 +618,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param, wxSize size)
|
||||
wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
|
||||
if (fsfile == NULL)
|
||||
{
|
||||
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.mb_str());
|
||||
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.c_str());
|
||||
return wxNullBitmap;
|
||||
}
|
||||
wxImage img(*(fsfile->GetStream()));
|
||||
@ -628,7 +628,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param, wxSize size)
|
||||
#endif
|
||||
if (!img.Ok())
|
||||
{
|
||||
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.mb_str());
|
||||
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.c_str());
|
||||
return wxNullBitmap;
|
||||
}
|
||||
if (!(size == wxDefaultSize)) img.Rescale(size.x, size.y);
|
||||
@ -708,7 +708,7 @@ wxSize wxXmlResourceHandler::GetSize(const wxString& param)
|
||||
if (!s.BeforeFirst(wxT(',')).ToLong(&sx) ||
|
||||
!s.AfterLast(wxT(',')).ToLong(&sy))
|
||||
{
|
||||
wxLogError(_("Cannot parse coordinates from '%s'."), s.mb_str());
|
||||
wxLogError(_("Cannot parse coordinates from '%s'."), s.c_str());
|
||||
return wxDefaultSize;
|
||||
}
|
||||
|
||||
@ -749,7 +749,7 @@ wxCoord wxXmlResourceHandler::GetDimension(const wxString& param, wxCoord defaul
|
||||
|
||||
if (!s.ToLong(&sx))
|
||||
{
|
||||
wxLogError(_("Cannot parse dimension from '%s'."), s.mb_str());
|
||||
wxLogError(_("Cannot parse dimension from '%s'."), s.c_str());
|
||||
return defaultv;
|
||||
}
|
||||
|
||||
@ -775,7 +775,7 @@ wxFont wxXmlResourceHandler::GetFont(const wxString& param)
|
||||
wxXmlNode *font_node = GetParamNode(param);
|
||||
if (font_node == NULL)
|
||||
{
|
||||
wxLogError(_("Cannot find font node '%s'."), param.mb_str());
|
||||
wxLogError(_("Cannot find font node '%s'."), param.c_str());
|
||||
return wxNullFont;
|
||||
}
|
||||
|
||||
@ -904,26 +904,26 @@ void wxXmlResourceHandler::CreateChildrenPrivately(wxObject *parent, wxXmlNode *
|
||||
struct XMLID_record
|
||||
{
|
||||
int id;
|
||||
char *key;
|
||||
wxChar *key;
|
||||
XMLID_record *next;
|
||||
};
|
||||
|
||||
static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
|
||||
|
||||
/*static*/ int wxXmlResource::GetXMLID(const char *str_id)
|
||||
/*static*/ int wxXmlResource::GetXMLID(const wxChar *str_id)
|
||||
{
|
||||
static int XMLID_LastID = wxID_HIGHEST;
|
||||
|
||||
int index = 0;
|
||||
|
||||
for (const char *c = str_id; *c != '\0'; c++) index += (int)*c;
|
||||
for (const wxChar *c = str_id; *c != wxT('\0'); c++) index += (int)*c;
|
||||
index %= XMLID_TABLE_SIZE;
|
||||
|
||||
XMLID_record *oldrec = NULL;
|
||||
int matchcnt = 0;
|
||||
for (XMLID_record *rec = XMLID_Records[index]; rec; rec = rec->next)
|
||||
{
|
||||
if (strcmp(rec->key, str_id) == 0)
|
||||
if (wxStrcmp(rec->key, str_id) == 0)
|
||||
{
|
||||
return rec->id;
|
||||
}
|
||||
@ -935,7 +935,7 @@ static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
|
||||
&XMLID_Records[index] : &oldrec->next;
|
||||
*rec_var = new XMLID_record;
|
||||
(*rec_var)->id = ++XMLID_LastID;
|
||||
(*rec_var)->key = strdup(str_id);
|
||||
(*rec_var)->key = wxStrdup(str_id);
|
||||
(*rec_var)->next = NULL;
|
||||
|
||||
return (*rec_var)->id;
|
||||
@ -947,7 +947,7 @@ static void CleanXMLID_Record(XMLID_record *rec)
|
||||
if (rec)
|
||||
{
|
||||
CleanXMLID_Record(rec->next);
|
||||
free (rec->key);
|
||||
free(rec->key);
|
||||
delete rec;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ inline static void OutputString(wxOutputStream& stream, const wxString& str)
|
||||
{
|
||||
if (str.IsEmpty()) return;
|
||||
#if wxUSE_UNICODE
|
||||
char *buf = str.mb_str(wxMBConvUTF8);
|
||||
const char *buf = str.mb_str(wxConvUTF8);
|
||||
stream.Write(buf, strlen(buf));
|
||||
#else
|
||||
stream.Write(str.mb_str(), str.Len());
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
// Returns numeric ID that is equivalent to string id used in XML
|
||||
// resource. To be used in event tables
|
||||
// Macro XMLID is provided for convenience
|
||||
static int GetXMLID(const char *str_id);
|
||||
static int GetXMLID(const wxChar *str_id);
|
||||
|
||||
// Returns version info (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a)
|
||||
long GetVersion() const { return m_version; }
|
||||
|
@ -57,7 +57,7 @@ void wxUnknownControlContainer::AddChild(wxWindowBase *child)
|
||||
|
||||
SetBackgroundColour(m_bg);
|
||||
child->SetName(m_controlName);
|
||||
child->SetId(XMLID(m_controlName));
|
||||
child->SetId(wxXmlResource::GetXMLID(m_controlName));
|
||||
m_controlAdded = TRUE;
|
||||
|
||||
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
- handle unknown encodings
|
||||
- process all elements, including CDATA
|
||||
- XML resources should automatically select desired encoding besed on
|
||||
- XML resources should automatically select desired encoding based on
|
||||
runtime environment (?) (would need BIN and BINZ formats modification,
|
||||
too)
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
inline static wxString CharToString(const char *s, size_t len = wxSTRING_MAXLEN)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
return wxString(s, wxMBConvUTF8, len);
|
||||
return wxString(s, wxConvUTF8, len);
|
||||
#else
|
||||
return wxString(s, len);
|
||||
#endif
|
||||
|
@ -83,8 +83,8 @@ bool wxXmlResource::Load(const wxString& filemask)
|
||||
while (!!fnd)
|
||||
{
|
||||
#if wxUSE_FILESYSTEM
|
||||
if (filemask.Lower().Matches("*.zip") ||
|
||||
filemask.Lower().Matches("*.rsc"))
|
||||
if (filemask.Lower().Matches(wxT("*.zip")) ||
|
||||
filemask.Lower().Matches(wxT("*.rsc")))
|
||||
{
|
||||
rt = rt && Load(fnd + wxT("#zip:*.xmb"));
|
||||
rt = rt && Load(fnd + wxT("#zip:*.xrc"));
|
||||
@ -569,7 +569,7 @@ int wxXmlResourceHandler::GetID()
|
||||
stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP);
|
||||
stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT);
|
||||
#undef stdID
|
||||
else return XMLID(sid.c_str());
|
||||
else return wxXmlResource::GetXMLID(sid);
|
||||
}
|
||||
|
||||
|
||||
@ -618,7 +618,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param, wxSize size)
|
||||
wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
|
||||
if (fsfile == NULL)
|
||||
{
|
||||
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.mb_str());
|
||||
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.c_str());
|
||||
return wxNullBitmap;
|
||||
}
|
||||
wxImage img(*(fsfile->GetStream()));
|
||||
@ -628,7 +628,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param, wxSize size)
|
||||
#endif
|
||||
if (!img.Ok())
|
||||
{
|
||||
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.mb_str());
|
||||
wxLogError(_("XML resource: Cannot create bitmap from '%s'."), param.c_str());
|
||||
return wxNullBitmap;
|
||||
}
|
||||
if (!(size == wxDefaultSize)) img.Rescale(size.x, size.y);
|
||||
@ -708,7 +708,7 @@ wxSize wxXmlResourceHandler::GetSize(const wxString& param)
|
||||
if (!s.BeforeFirst(wxT(',')).ToLong(&sx) ||
|
||||
!s.AfterLast(wxT(',')).ToLong(&sy))
|
||||
{
|
||||
wxLogError(_("Cannot parse coordinates from '%s'."), s.mb_str());
|
||||
wxLogError(_("Cannot parse coordinates from '%s'."), s.c_str());
|
||||
return wxDefaultSize;
|
||||
}
|
||||
|
||||
@ -749,7 +749,7 @@ wxCoord wxXmlResourceHandler::GetDimension(const wxString& param, wxCoord defaul
|
||||
|
||||
if (!s.ToLong(&sx))
|
||||
{
|
||||
wxLogError(_("Cannot parse dimension from '%s'."), s.mb_str());
|
||||
wxLogError(_("Cannot parse dimension from '%s'."), s.c_str());
|
||||
return defaultv;
|
||||
}
|
||||
|
||||
@ -775,7 +775,7 @@ wxFont wxXmlResourceHandler::GetFont(const wxString& param)
|
||||
wxXmlNode *font_node = GetParamNode(param);
|
||||
if (font_node == NULL)
|
||||
{
|
||||
wxLogError(_("Cannot find font node '%s'."), param.mb_str());
|
||||
wxLogError(_("Cannot find font node '%s'."), param.c_str());
|
||||
return wxNullFont;
|
||||
}
|
||||
|
||||
@ -904,26 +904,26 @@ void wxXmlResourceHandler::CreateChildrenPrivately(wxObject *parent, wxXmlNode *
|
||||
struct XMLID_record
|
||||
{
|
||||
int id;
|
||||
char *key;
|
||||
wxChar *key;
|
||||
XMLID_record *next;
|
||||
};
|
||||
|
||||
static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
|
||||
|
||||
/*static*/ int wxXmlResource::GetXMLID(const char *str_id)
|
||||
/*static*/ int wxXmlResource::GetXMLID(const wxChar *str_id)
|
||||
{
|
||||
static int XMLID_LastID = wxID_HIGHEST;
|
||||
|
||||
int index = 0;
|
||||
|
||||
for (const char *c = str_id; *c != '\0'; c++) index += (int)*c;
|
||||
for (const wxChar *c = str_id; *c != wxT('\0'); c++) index += (int)*c;
|
||||
index %= XMLID_TABLE_SIZE;
|
||||
|
||||
XMLID_record *oldrec = NULL;
|
||||
int matchcnt = 0;
|
||||
for (XMLID_record *rec = XMLID_Records[index]; rec; rec = rec->next)
|
||||
{
|
||||
if (strcmp(rec->key, str_id) == 0)
|
||||
if (wxStrcmp(rec->key, str_id) == 0)
|
||||
{
|
||||
return rec->id;
|
||||
}
|
||||
@ -935,7 +935,7 @@ static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
|
||||
&XMLID_Records[index] : &oldrec->next;
|
||||
*rec_var = new XMLID_record;
|
||||
(*rec_var)->id = ++XMLID_LastID;
|
||||
(*rec_var)->key = strdup(str_id);
|
||||
(*rec_var)->key = wxStrdup(str_id);
|
||||
(*rec_var)->next = NULL;
|
||||
|
||||
return (*rec_var)->id;
|
||||
@ -947,7 +947,7 @@ static void CleanXMLID_Record(XMLID_record *rec)
|
||||
if (rec)
|
||||
{
|
||||
CleanXMLID_Record(rec->next);
|
||||
free (rec->key);
|
||||
free(rec->key);
|
||||
delete rec;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ inline static void OutputString(wxOutputStream& stream, const wxString& str)
|
||||
{
|
||||
if (str.IsEmpty()) return;
|
||||
#if wxUSE_UNICODE
|
||||
char *buf = str.mb_str(wxMBConvUTF8);
|
||||
const char *buf = str.mb_str(wxConvUTF8);
|
||||
stream.Write(buf, strlen(buf));
|
||||
#else
|
||||
stream.Write(str.mb_str(), str.Len());
|
||||
|
Loading…
Reference in New Issue
Block a user