X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ef12fd203fd3be0944ecdf9c12e6faa33794b29..d58b140b13c4b9215a2d2de3f1a3c5efe418e669:/src/richtext/richtextstyles.cpp diff --git a/src/richtext/richtextstyles.cpp b/src/richtext/richtextstyles.cpp index 77e1d2abac..ab98d93d0a 100644 --- a/src/richtext/richtextstyles.cpp +++ b/src/richtext/richtextstyles.cpp @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 2005-09-30 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -61,10 +60,10 @@ wxRichTextAttr wxRichTextStyleDefinition::GetStyleMergedWithBase(const wxRichTex if (m_baseStyle.IsEmpty()) return m_style; - bool isParaStyle = IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)); - bool isCharStyle = IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)); - bool isListStyle = IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)); - bool isBoxStyle = IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)); + bool isParaStyle = IsKindOf(wxCLASSINFO(wxRichTextParagraphStyleDefinition)); + bool isCharStyle = IsKindOf(wxCLASSINFO(wxRichTextCharacterStyleDefinition)); + bool isListStyle = IsKindOf(wxCLASSINFO(wxRichTextListStyleDefinition)); + bool isBoxStyle = IsKindOf(wxCLASSINFO(wxRichTextBoxStyleDefinition)); // Collect the styles, detecting loops wxArrayString styleNames; @@ -706,7 +705,11 @@ int wxRichTextStyleListBox::SetStyleSelection(const wxString& name) { int i = GetIndexForStyle(name); if (i > -1) + { SetSelection(i); + if (!IsVisible(i)) + ScrollToRow(i); + } return i; } @@ -736,11 +739,20 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons if (attr.HasAlignment() && attr.GetAlignment() == wxTEXT_ALIGNMENT_CENTRE) isCentred = true; + str << wxT(""); + str << wxT(""); + if (isCentred) str << wxT("
"); + str << wxT(""); + str << wxT(">"); if (attr.GetLeftIndent() > 0) { @@ -775,7 +787,7 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons name.Find(wxT("default")) != wxNOT_FOUND || name.Find(defaultTranslated) != wxNOT_FOUND) { wxRichTextAttr attr2(d->GetStyleMergedWithBase(GetStyleSheet())); - if (attr2.HasFontSize()) + if (attr2.HasFontPointSize()) { stdFontSize = attr2.GetFontSize(); break; @@ -796,7 +808,7 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons if (d) { wxRichTextAttr attr2(d->GetStyleMergedWithBase(GetStyleSheet())); - if (attr2.HasFontSize()) + if (attr2.HasFontPointSize()) { if (attr2.GetFontSize() <= (int) maxSize) sizes[attr2.GetFontSize()] ++; @@ -816,7 +828,7 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons if (stdFontSize == 0) stdFontSize = 12; - int thisFontSize = ((attr.GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0) ? attr.GetFontSize() : stdFontSize; + int thisFontSize = attr.HasFontPointSize() ? attr.GetFontSize() : stdFontSize; if (thisFontSize < stdFontSize) size --; @@ -833,15 +845,18 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons if (attr.GetTextColour().IsOk()) str << wxT(" color=\"#") << ColourToHexString(attr.GetTextColour()) << wxT("\""); + if (attr.GetBackgroundColour().Ok()) + str << wxT(" bgcolor=\"#") << ColourToHexString(attr.GetBackgroundColour()) << wxT("\""); + str << wxT(">"); bool hasBold = false; bool hasItalic = false; bool hasUnderline = false; - if (attr.GetFontWeight() == wxBOLD) + if (attr.GetFontWeight() == wxFONTWEIGHT_BOLD) hasBold = true; - if (attr.GetFontStyle() == wxITALIC) + if (attr.GetFontStyle() == wxFONTSTYLE_ITALIC) hasItalic = true; if (attr.GetFontUnderlined()) hasUnderline = true; @@ -872,6 +887,7 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons if (isCentred) str << wxT("
"); + str << wxT(""); return str; }