Forgotten commits - image loading and XML speedups
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@65452 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9524,6 +9524,24 @@ inline void wxRichTextDecToHex(int dec, char* buf)
|
|||||||
buf[1] = hexArray[secondDigit];
|
buf[1] = hexArray[secondDigit];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int wxRichTextHexToDec(const wxChar* buf)
|
||||||
|
{
|
||||||
|
int firstDigit, secondDigit;
|
||||||
|
|
||||||
|
if (buf[0] >= wxT('A'))
|
||||||
|
firstDigit = buf[0] - wxT('A') + 10;
|
||||||
|
else
|
||||||
|
firstDigit = buf[0] - wxT('0');
|
||||||
|
|
||||||
|
if (buf[1] >= wxT('A'))
|
||||||
|
secondDigit = buf[1] - wxT('A') + 10;
|
||||||
|
else
|
||||||
|
secondDigit = buf[1] - wxT('0');
|
||||||
|
|
||||||
|
return (firstDigit & 0xF) * 16 + (secondDigit & 0xF );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write data in hex to a stream
|
// Write data in hex to a stream
|
||||||
bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream)
|
bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream)
|
||||||
{
|
{
|
||||||
@@ -9573,7 +9591,7 @@ bool wxRichTextImageBlock::ReadHex(wxInputStream& stream, int length, int imageT
|
|||||||
str[0] = stream.GetC();
|
str[0] = stream.GetC();
|
||||||
str[1] = stream.GetC();
|
str[1] = stream.GetC();
|
||||||
|
|
||||||
m_data[i] = (unsigned char)wxHexToDec(str);
|
m_data[i] = (unsigned char)wxRichTextHexToDec(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dataSize = dataSize;
|
m_dataSize = dataSize;
|
||||||
|
@@ -1143,10 +1143,10 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
int fontWeight = wxNORMAL;
|
int fontWeight = wxNORMAL;
|
||||||
int fontStyle = wxNORMAL;
|
int fontStyle = wxNORMAL;
|
||||||
bool fontUnderlined = false;
|
bool fontUnderlined = false;
|
||||||
|
|
||||||
int fontFlags = 0;
|
int fontFlags = 0;
|
||||||
|
const wxString emptyString; // save a temporary string construction in GetPropVal
|
||||||
|
|
||||||
fontFacename = node->GetPropVal(wxT("fontface"), wxEmptyString);
|
fontFacename = node->GetPropVal(wxT("fontface"), emptyString);
|
||||||
if (!fontFacename.IsEmpty())
|
if (!fontFacename.IsEmpty())
|
||||||
{
|
{
|
||||||
fontFlags |= wxTEXT_ATTR_FONT_FACE;
|
fontFlags |= wxTEXT_ATTR_FONT_FACE;
|
||||||
@@ -1156,32 +1156,32 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString value;
|
wxString value;
|
||||||
//value = node->GetPropVal(wxT("fontfamily"), wxEmptyString);
|
//value = node->GetPropVal(wxT("fontfamily"), emptyString);
|
||||||
//if (!value.empty())
|
//if (!value.empty())
|
||||||
// fontFamily = wxAtoi(value);
|
// fontFamily = wxAtoi(value);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("fontstyle"), wxEmptyString);
|
value = node->GetPropVal(wxT("fontstyle"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
fontStyle = wxAtoi(value);
|
fontStyle = wxAtoi(value);
|
||||||
fontFlags |= wxTEXT_ATTR_FONT_ITALIC;
|
fontFlags |= wxTEXT_ATTR_FONT_ITALIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("fontsize"), wxEmptyString);
|
value = node->GetPropVal(wxT("fontsize"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
fontSize = wxAtoi(value);
|
fontSize = wxAtoi(value);
|
||||||
fontFlags |= wxTEXT_ATTR_FONT_SIZE;
|
fontFlags |= wxTEXT_ATTR_FONT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("fontweight"), wxEmptyString);
|
value = node->GetPropVal(wxT("fontweight"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
fontWeight = wxAtoi(value);
|
fontWeight = wxAtoi(value);
|
||||||
fontFlags |= wxTEXT_ATTR_FONT_WEIGHT;
|
fontFlags |= wxTEXT_ATTR_FONT_WEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("fontunderlined"), wxEmptyString);
|
value = node->GetPropVal(wxT("fontunderlined"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
fontUnderlined = wxAtoi(value) != 0;
|
fontUnderlined = wxAtoi(value) != 0;
|
||||||
@@ -1196,7 +1196,7 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
// Restore correct font flags
|
// Restore correct font flags
|
||||||
attr.SetFlags(fontFlags);
|
attr.SetFlags(fontFlags);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("textcolor"), wxEmptyString);
|
value = node->GetPropVal(wxT("textcolor"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
if (value[0] == wxT('#'))
|
if (value[0] == wxT('#'))
|
||||||
@@ -1205,7 +1205,7 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
attr.SetTextColour(value);
|
attr.SetTextColour(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("bgcolor"), wxEmptyString);
|
value = node->GetPropVal(wxT("bgcolor"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
if (value[0] == wxT('#'))
|
if (value[0] == wxT('#'))
|
||||||
@@ -1214,30 +1214,30 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
attr.SetBackgroundColour(value);
|
attr.SetBackgroundColour(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("characterstyle"), wxEmptyString);
|
value = node->GetPropVal(wxT("characterstyle"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetCharacterStyleName(value);
|
attr.SetCharacterStyleName(value);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("texteffects"), wxEmptyString);
|
value = node->GetPropVal(wxT("texteffects"), emptyString);
|
||||||
if (!value.IsEmpty())
|
if (!value.IsEmpty())
|
||||||
{
|
{
|
||||||
attr.SetTextEffects(wxAtoi(value));
|
attr.SetTextEffects(wxAtoi(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("texteffectflags"), wxEmptyString);
|
value = node->GetPropVal(wxT("texteffectflags"), emptyString);
|
||||||
if (!value.IsEmpty())
|
if (!value.IsEmpty())
|
||||||
{
|
{
|
||||||
attr.SetTextEffectFlags(wxAtoi(value));
|
attr.SetTextEffectFlags(wxAtoi(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("url"), wxEmptyString);
|
value = node->GetPropVal(wxT("url"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetURL(value);
|
attr.SetURL(value);
|
||||||
|
|
||||||
// Set paragraph attributes
|
// Set paragraph attributes
|
||||||
if (isPara)
|
if (isPara)
|
||||||
{
|
{
|
||||||
value = node->GetPropVal(wxT("alignment"), wxEmptyString);
|
value = node->GetPropVal(wxT("alignment"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetAlignment((wxTextAttrAlignment) wxAtoi(value));
|
attr.SetAlignment((wxTextAttrAlignment) wxAtoi(value));
|
||||||
|
|
||||||
@@ -1245,14 +1245,14 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
int leftIndent = 0;
|
int leftIndent = 0;
|
||||||
bool hasLeftIndent = false;
|
bool hasLeftIndent = false;
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("leftindent"), wxEmptyString);
|
value = node->GetPropVal(wxT("leftindent"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
leftIndent = wxAtoi(value);
|
leftIndent = wxAtoi(value);
|
||||||
hasLeftIndent = true;
|
hasLeftIndent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("leftsubindent"), wxEmptyString);
|
value = node->GetPropVal(wxT("leftsubindent"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
leftSubIndent = wxAtoi(value);
|
leftSubIndent = wxAtoi(value);
|
||||||
@@ -1262,31 +1262,31 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
if (hasLeftIndent)
|
if (hasLeftIndent)
|
||||||
attr.SetLeftIndent(leftIndent, leftSubIndent);
|
attr.SetLeftIndent(leftIndent, leftSubIndent);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("rightindent"), wxEmptyString);
|
value = node->GetPropVal(wxT("rightindent"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetRightIndent(wxAtoi(value));
|
attr.SetRightIndent(wxAtoi(value));
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("parspacingbefore"), wxEmptyString);
|
value = node->GetPropVal(wxT("parspacingbefore"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetParagraphSpacingBefore(wxAtoi(value));
|
attr.SetParagraphSpacingBefore(wxAtoi(value));
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("parspacingafter"), wxEmptyString);
|
value = node->GetPropVal(wxT("parspacingafter"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetParagraphSpacingAfter(wxAtoi(value));
|
attr.SetParagraphSpacingAfter(wxAtoi(value));
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("linespacing"), wxEmptyString);
|
value = node->GetPropVal(wxT("linespacing"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetLineSpacing(wxAtoi(value));
|
attr.SetLineSpacing(wxAtoi(value));
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("bulletstyle"), wxEmptyString);
|
value = node->GetPropVal(wxT("bulletstyle"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetBulletStyle(wxAtoi(value));
|
attr.SetBulletStyle(wxAtoi(value));
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("bulletnumber"), wxEmptyString);
|
value = node->GetPropVal(wxT("bulletnumber"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetBulletNumber(wxAtoi(value));
|
attr.SetBulletNumber(wxAtoi(value));
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("bulletsymbol"), wxEmptyString);
|
value = node->GetPropVal(wxT("bulletsymbol"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
wxChar ch = wxAtoi(value);
|
wxChar ch = wxAtoi(value);
|
||||||
@@ -1295,27 +1295,27 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
attr.SetBulletText(s);
|
attr.SetBulletText(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("bullettext"), wxEmptyString);
|
value = node->GetPropVal(wxT("bullettext"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetBulletText(value);
|
attr.SetBulletText(value);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("bulletfont"), wxEmptyString);
|
value = node->GetPropVal(wxT("bulletfont"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetBulletFont(value);
|
attr.SetBulletFont(value);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("bulletname"), wxEmptyString);
|
value = node->GetPropVal(wxT("bulletname"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetBulletName(value);
|
attr.SetBulletName(value);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("parstyle"), wxEmptyString);
|
value = node->GetPropVal(wxT("parstyle"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetParagraphStyleName(value);
|
attr.SetParagraphStyleName(value);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("liststyle"), wxEmptyString);
|
value = node->GetPropVal(wxT("liststyle"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
attr.SetListStyleName(value);
|
attr.SetListStyleName(value);
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("tabs"), wxEmptyString);
|
value = node->GetPropVal(wxT("tabs"), emptyString);
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
wxArrayInt tabs;
|
wxArrayInt tabs;
|
||||||
@@ -1328,13 +1328,13 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
attr.SetTabs(tabs);
|
attr.SetTabs(tabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("pagebreak"), wxEmptyString);
|
value = node->GetPropVal(wxT("pagebreak"), emptyString);
|
||||||
if (!value.IsEmpty())
|
if (!value.IsEmpty())
|
||||||
{
|
{
|
||||||
attr.SetPageBreak(wxAtoi(value) != 0);
|
attr.SetPageBreak(wxAtoi(value) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = node->GetPropVal(wxT("outlinelevel"), wxEmptyString);
|
value = node->GetPropVal(wxT("outlinelevel"), emptyString);
|
||||||
if (!value.IsEmpty())
|
if (!value.IsEmpty())
|
||||||
{
|
{
|
||||||
attr.SetOutlineLevel(wxAtoi(value));
|
attr.SetOutlineLevel(wxAtoi(value));
|
||||||
|
Reference in New Issue
Block a user