Fixed box style application.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4014,10 +4014,22 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def)
|
||||
// to change its style independently.
|
||||
flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
|
||||
}
|
||||
else
|
||||
else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
|
||||
attr.SetCharacterStyleName(def->GetName());
|
||||
else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
|
||||
attr.GetTextBoxAttr().SetBoxStyleName(def->GetName());
|
||||
|
||||
if (HasSelection())
|
||||
if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
|
||||
{
|
||||
if (GetFocusObject() && (GetFocusObject() != & GetBuffer()))
|
||||
{
|
||||
SetStyle(GetFocusObject(), attr);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if (HasSelection())
|
||||
return SetStyleEx(GetSelectionRange(), attr, flags);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -141,13 +141,11 @@ bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTe
|
||||
}
|
||||
|
||||
// Apply attributes to the object being edited, if any
|
||||
bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* WXUNUSED(ctrl), int flags)
|
||||
bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* ctrl, int WXUNUSED(flags))
|
||||
{
|
||||
if (GetObject())
|
||||
{
|
||||
wxRichTextParagraphLayoutBox* parentContainer = GetObject()->GetParentContainer();
|
||||
if (parentContainer)
|
||||
parentContainer->SetStyle(GetObject(), m_attributes, flags);
|
||||
ctrl->SetStyle(GetObject(), m_attributes);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -538,26 +538,15 @@ bool wxRichTextStyleOrganiserDialog::ApplyStyle(wxRichTextCtrl* ctrl)
|
||||
ctrl = GetRichTextCtrl();
|
||||
if (!ctrl)
|
||||
return false;
|
||||
if (!ctrl->HasSelection())
|
||||
return false;
|
||||
|
||||
|
||||
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
|
||||
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
|
||||
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
|
||||
|
||||
if (listDef && m_restartNumberingCtrl->GetValue())
|
||||
if (listDef && m_restartNumberingCtrl->GetValue() && ctrl->HasSelection())
|
||||
{
|
||||
wxRichTextRange range = ctrl->GetSelectionRange();
|
||||
return ctrl->SetListStyle(range, listDef, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER);
|
||||
}
|
||||
else if (boxDef)
|
||||
{
|
||||
if (!ctrl->GetFocusObject() || (ctrl->GetFocusObject() && (ctrl->GetFocusObject() == & ctrl->GetBuffer())))
|
||||
return false;
|
||||
ctrl->SetStyle(ctrl->GetFocusObject(), def->GetStyleMergedWithBase(m_stylesListBox->GetStyleSheet()));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ctrl->ApplyStyle(def);
|
||||
|
||||
Reference in New Issue
Block a user