]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed bug [ 1714813 ] ApplyXXXToSelection remove style
authorJulian Smart <julian@anthemion.co.uk>
Tue, 26 Feb 2008 14:55:42 +0000 (14:55 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 26 Feb 2008 14:55:42 +0000 (14:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextctrl.cpp

index ff2bc2426bfe425c05f75782a6a408d6f2971788..01cbd9387a36a2b5c190c7b5bdf2ebe44e83ad4a 100644 (file)
@@ -2880,7 +2880,11 @@ bool wxRichTextCtrl::ApplyBoldToSelection()
     if (HasSelection())
         return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY);
     else
-        SetAndShowDefaultStyle(attr);
+    {
+        wxRichTextAttr current = GetDefaultStyleEx();
+        current.Apply(attr);
+        SetAndShowDefaultStyle(current);
+    }
     return true;
 }
 
@@ -2894,7 +2898,11 @@ bool wxRichTextCtrl::ApplyItalicToSelection()
     if (HasSelection())
         return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY);
     else
-        SetAndShowDefaultStyle(attr);
+    {
+        wxRichTextAttr current = GetDefaultStyleEx();
+        current.Apply(attr);
+        SetAndShowDefaultStyle(current);
+    }
     return true;
 }
 
@@ -2908,7 +2916,11 @@ bool wxRichTextCtrl::ApplyUnderlineToSelection()
     if (HasSelection())
         return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY);
     else
-        SetAndShowDefaultStyle(attr);
+    {
+        wxRichTextAttr current = GetDefaultStyleEx();
+        current.Apply(attr);
+        SetAndShowDefaultStyle(current);
+    }
     return true;
 }
 
@@ -2986,7 +2998,9 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def)
         return SetStyleEx(GetSelectionRange(), attr, flags);
     else
     {
-        SetAndShowDefaultStyle(attr);
+        wxRichTextAttr current = GetDefaultStyleEx();
+        current.Apply(attr);
+        SetAndShowDefaultStyle(current);
         return true;
     }
 }