]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextfontpage.cpp
don't use built-in support for menu bitmaps if they are too big, they don't come...
[wxWidgets.git] / src / richtext / richtextfontpage.cpp
index eccebbcced78b5a71e1fe878684db6638c264679..87a3fb7830cac8839c841e051db099f876d955f3 100644 (file)
@@ -314,11 +314,11 @@ bool wxRichTextFontPage::TransferDataFromWindow()
 
     if (m_styleCtrl->GetSelection() != wxNOT_FOUND)
     {
-        int style;
+        wxFontStyle style;
         if (m_styleCtrl->GetStringSelection() == _("Italic"))
-            style = wxITALIC;
+            style = wxFONTSTYLE_ITALIC;
         else
-            style = wxNORMAL;
+            style = wxFONTSTYLE_NORMAL;
 
         attr->SetFontStyle(style);
     }
@@ -327,11 +327,11 @@ bool wxRichTextFontPage::TransferDataFromWindow()
 
     if (m_weightCtrl->GetSelection() != wxNOT_FOUND)
     {
-        int weight;
+        wxFontWeight weight;
         if (m_weightCtrl->GetStringSelection() == _("Bold"))
-            weight = wxBOLD;
+            weight = wxFONTWEIGHT_BOLD;
         else
-            weight = wxNORMAL;
+            weight = wxFONTWEIGHT_NORMAL;
 
         attr->SetFontWeight(weight);
     }
@@ -392,8 +392,9 @@ bool wxRichTextFontPage::TransferDataFromWindow()
     }
     else
     {
-        attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_SUBSCRIPT | wxTEXT_ATTR_EFFECT_SUPERSCRIPT );
-        attr->SetTextEffects(attr->GetTextEffects() & ~( wxTEXT_ATTR_EFFECT_SUPERSCRIPT | wxTEXT_ATTR_EFFECT_SUBSCRIPT));
+        // If they are undetermined, we don't want to include these flags in the text effects - the objects
+        // should retain their original style.
+        attr->SetTextEffectFlags(attr->GetTextEffectFlags() & ~(wxTEXT_ATTR_EFFECT_SUBSCRIPT|wxTEXT_ATTR_EFFECT_SUPERSCRIPT) );
     }
 
     return true;
@@ -514,16 +515,16 @@ bool wxRichTextFontPage::TransferDataToWindow()
         }
         else
         {
-            m_superscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
-            m_subscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
+            m_superscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
+            m_subscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
         }
     }
     else
     {
         m_strikethroughCtrl->Set3StateValue(wxCHK_UNDETERMINED);
         m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);
-        m_superscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
-        m_subscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
+        m_superscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
+        m_subscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
     }
 
     UpdatePreview();
@@ -790,8 +791,9 @@ void wxRichTextFontPage::OnCapsctrlClick( wxCommandEvent& WXUNUSED(event) )
 
 void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXUNUSED(event) )
 {
-    if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED && m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED )
+    if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
         m_subscriptCtrl->Set3StateValue( wxCHK_UNCHECKED );
+
     UpdatePreview();
 }
 
@@ -801,7 +803,8 @@ void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXU
 
 void wxRichTextFontPage::OnRichtextfontpageSubscriptClick( wxCommandEvent& WXUNUSED(event) )
 {
-    if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED && m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED )
+    if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
         m_superscriptCtrl->Set3StateValue( wxCHK_UNCHECKED );
+
     UpdatePreview();
 }