]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed box style application.
authorJulian Smart <julian@anthemion.co.uk>
Thu, 5 Jan 2012 14:10:24 +0000 (14:10 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 5 Jan 2012 14:10:24 +0000 (14:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextctrl.cpp
src/richtext/richtextformatdlg.cpp
src/richtext/richtextstyledlg.cpp

index 83905493a164b107b543f561f77a8b7f7c212fa1..799fd61a0712db6ebcd5994da1382c7cb6f1bad0 100644 (file)
@@ -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
     {
index 032268117c3085c20c9752c8aaa277dfcce4d777..f7939da5a4aa5dc6f5e4bcebff179d07bfe3c3f2 100644 (file)
@@ -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
index 53419028269a298c2ed91be6c7b49806d625c2f0..796c1b154a6354cfad752ba8d7dee8e183f989a1 100644 (file)
@@ -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);