X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/23a9a87c85d4e08cd96ab6ab95db64efe46a972f..7be2a7af39888b264eb0c5787fb2914005633d1b:/src/richtext/richtextstyles.cpp diff --git a/src/richtext/richtextstyles.cpp b/src/richtext/richtextstyles.cpp index ef62442eaf..9e0a84a177 100644 --- a/src/richtext/richtextstyles.cpp +++ b/src/richtext/richtextstyles.cpp @@ -47,11 +47,12 @@ void wxRichTextStyleDefinition::Copy(const wxRichTextStyleDefinition& def) m_baseStyle = def.m_baseStyle; m_style = def.m_style; m_description = def.m_description; + m_properties = def.m_properties; } bool wxRichTextStyleDefinition::Eq(const wxRichTextStyleDefinition& def) const { - return (m_name == def.m_name && m_baseStyle == def.m_baseStyle && m_style == def.m_style); + return (m_name == def.m_name && m_baseStyle == def.m_baseStyle && m_style == def.m_style && m_properties == def.m_properties); } /// Gets the style combined with the base style @@ -60,10 +61,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; @@ -442,7 +443,7 @@ bool wxRichTextStyleSheet::AddListStyle(wxRichTextListStyleDefinition* def) /// Add a definition to the box style list bool wxRichTextStyleSheet::AddBoxStyle(wxRichTextBoxStyleDefinition* def) { - def->GetStyle().SetParagraphStyleName(def->GetName()); + def->GetStyle().GetTextBoxAttr().SetBoxStyleName(def->GetName()); return AddStyle(m_boxStyleDefinitions, def); } @@ -523,6 +524,7 @@ void wxRichTextStyleSheet::Copy(const wxRichTextStyleSheet& sheet) SetName(sheet.GetName()); SetDescription(sheet.GetDescription()); + m_properties = sheet.m_properties; } /// Equality @@ -664,6 +666,13 @@ void wxRichTextStyleListBox::UpdateStyles() SendSelectedEvent(); } } + else + { + m_styleNames.Clear(); + SetSelection(wxNOT_FOUND); + SetItemCount(0); + Refresh(); + } } // Get index for style name @@ -697,7 +706,11 @@ int wxRichTextStyleListBox::SetStyleSelection(const wxString& name) { int i = GetIndexForStyle(name); if (i > -1) + { SetSelection(i); + if (!IsVisible(i)) + ScrollToRow(i); + } return i; } @@ -766,7 +779,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; @@ -787,7 +800,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()] ++; @@ -807,7 +820,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 --; @@ -1209,8 +1222,8 @@ END_EVENT_TABLE() bool wxRichTextStyleComboPopup::Create( wxWindow* parent ) { int borderStyle = GetDefaultBorder(); - if (borderStyle == wxBORDER_SUNKEN) - borderStyle = wxBORDER_SIMPLE; + if (borderStyle == wxBORDER_SUNKEN || borderStyle == wxBORDER_NONE) + borderStyle = wxBORDER_THEME; return wxRichTextStyleListBox::Create(parent, wxID_ANY, wxPoint(0,0), wxDefaultSize,