Merges from Scitech Branch (George Davison):
Added wxDisplayChangedEvent and triggering in MSW, when display mode changes this event gets triggered. I don't know what should happen with other OS's since I am not familiar with how they handle mode changes. Watcome Version 11 now compiles with wide character support. Fixed watcom warnings in html/htmlwin.h imagbmp.h listctrl.h imagbmp.cpp quantize.cpp strconv.cpp variant.cpp dirctrlg.cpp treectlg.cpp m_style.cpp fontenum.cpp listctrl.cpp ole\dataobj.cpp textctrl.cpp window.cpp xml.cpp msw/setup.h with watcom version 11 it now compiles with wide character support. xrc/xml.cpp fixed memory leak and compile warnings git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -332,7 +332,7 @@ bool wxXmlDocument::Save(const wxString& filename) const
|
||||
// wxXmlDocument loading routines
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
/*
|
||||
FIXME:
|
||||
- process all elements, including CDATA
|
||||
*/
|
||||
@@ -349,12 +349,12 @@ inline static wxString CharToString(wxMBConv *conv,
|
||||
{
|
||||
size_t nLen = (len != wxSTRING_MAXLEN) ? len :
|
||||
nLen = wxConvUTF8.MB2WC((wchar_t*) NULL, s, 0);
|
||||
|
||||
|
||||
wchar_t *buf = new wchar_t[nLen+1];
|
||||
wxConvUTF8.MB2WC(buf, s, nLen);
|
||||
buf[nLen] = 0;
|
||||
return wxString(buf, *conv, len);
|
||||
delete[] buf;
|
||||
return wxString(buf, *conv, len);
|
||||
}
|
||||
else
|
||||
return wxString(s, len);
|
||||
@@ -473,21 +473,21 @@ static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData),
|
||||
char mbBuf[255];
|
||||
wchar_t wcBuf[255];
|
||||
size_t i;
|
||||
|
||||
|
||||
for (i = 0; i < 255; i++)
|
||||
mbBuf[i] = i+1;
|
||||
mbBuf[i] = (char) (i+1);
|
||||
mbBuf[255] = 0;
|
||||
conv.MB2WC(wcBuf, mbBuf, 255);
|
||||
wcBuf[255] = 0;
|
||||
|
||||
|
||||
info->map[0] = 0;
|
||||
for (i = 0; i < 255; i++)
|
||||
info->map[i+1] = (int)wcBuf[i];
|
||||
|
||||
|
||||
info->data = NULL;
|
||||
info->convert = NULL;
|
||||
info->release = NULL;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
||||
if ( encoding != wxT("UTF-8") && encoding != wxT("utf-8") )
|
||||
ctx.conv = new wxCSConv(encoding);
|
||||
#endif
|
||||
|
||||
|
||||
XML_SetUserData(parser, (void*)&ctx);
|
||||
XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
|
||||
XML_SetCharacterDataHandler(parser, TextHnd);
|
||||
@@ -542,7 +542,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
||||
if ( ctx.conv )
|
||||
delete ctx.conv;
|
||||
#endif
|
||||
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
@@ -572,7 +572,7 @@ inline static void OutputString(wxOutputStream& stream, const wxString& str,
|
||||
#endif
|
||||
}
|
||||
|
||||
// Same as above, but create entities first.
|
||||
// Same as above, but create entities first.
|
||||
// Translates '<' to "<", '>' to ">" and '&' to "&"
|
||||
static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
|
||||
wxMBConv *convMem, wxMBConv *convFile)
|
||||
@@ -580,25 +580,25 @@ static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
|
||||
wxString buf;
|
||||
size_t i, last, len;
|
||||
wxChar c;
|
||||
|
||||
|
||||
len = str.Len();
|
||||
last = 0;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
c = str.GetChar(i);
|
||||
if (c == wxT('<') || c == wxT('>') ||
|
||||
if (c == wxT('<') || c == wxT('>') ||
|
||||
(c == wxT('&') && str.Mid(i+1, 4) != wxT("amp;")))
|
||||
{
|
||||
OutputString(stream, str.Mid(last, i - last), convMem, convFile);
|
||||
switch (c)
|
||||
{
|
||||
case wxT('<'):
|
||||
case wxT('<'):
|
||||
OutputString(stream, wxT("<"), NULL, NULL);
|
||||
break;
|
||||
case wxT('>'):
|
||||
case wxT('>'):
|
||||
OutputString(stream, wxT(">"), NULL, NULL);
|
||||
break;
|
||||
case wxT('&'):
|
||||
case wxT('&'):
|
||||
OutputString(stream, wxT("&"), NULL, NULL);
|
||||
break;
|
||||
default: break;
|
||||
@@ -628,11 +628,11 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
|
||||
case wxXML_TEXT_NODE:
|
||||
OutputStringEnt(stream, node->GetContent(), convMem, convFile);
|
||||
break;
|
||||
|
||||
|
||||
case wxXML_ELEMENT_NODE:
|
||||
OutputString(stream, wxT("<"), NULL, NULL);
|
||||
OutputString(stream, node->GetName(), NULL, NULL);
|
||||
|
||||
|
||||
prop = node->GetProperties();
|
||||
while (prop)
|
||||
{
|
||||
@@ -642,7 +642,7 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
|
||||
// FIXME - what if prop contains '"'?
|
||||
prop = prop->GetNext();
|
||||
}
|
||||
|
||||
|
||||
if (node->GetChildren())
|
||||
{
|
||||
OutputString(stream, wxT(">"), NULL, NULL);
|
||||
@@ -665,13 +665,13 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
|
||||
else
|
||||
OutputString(stream, wxT("/>"), NULL, NULL);
|
||||
break;
|
||||
|
||||
|
||||
case wxXML_COMMENT_NODE:
|
||||
OutputString(stream, wxT("<!--"), NULL, NULL);
|
||||
OutputString(stream, node->GetContent(), convMem, convFile);
|
||||
OutputString(stream, wxT("-->"), NULL, NULL);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("unsupported node type"));
|
||||
}
|
||||
@@ -681,9 +681,9 @@ bool wxXmlDocument::Save(wxOutputStream& stream) const
|
||||
{
|
||||
if ( !IsOk() )
|
||||
return FALSE;
|
||||
|
||||
|
||||
wxString s;
|
||||
|
||||
|
||||
wxMBConv *convMem = NULL, *convFile = NULL;
|
||||
#if wxUSE_UNICODE
|
||||
convFile = new wxCSConv(GetFileEncoding());
|
||||
@@ -694,18 +694,18 @@ bool wxXmlDocument::Save(wxOutputStream& stream) const
|
||||
convMem = new wxCSConv(GetEncoding());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
|
||||
GetVersion().c_str(), GetFileEncoding().c_str());
|
||||
OutputString(stream, s, NULL, NULL);
|
||||
|
||||
|
||||
OutputNode(stream, GetRoot(), 0, convMem, convFile);
|
||||
OutputString(stream, wxT("\n"), NULL, NULL);
|
||||
|
||||
|
||||
if ( convFile )
|
||||
delete convFile;
|
||||
if ( convMem )
|
||||
delete convMem;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user