]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextfontpage.cpp
Disable wxUSE_ENH_METAFILE for wxGTK builds.
[wxWidgets.git] / src / richtext / richtextfontpage.cpp
index 89c9f1e023adc8c61014227c32f3f7c774c1c796..81afb760dc5f04144368f60bde5e1e1e42efe6a3 100644 (file)
@@ -54,6 +54,8 @@ BEGIN_EVENT_TABLE( wxRichTextFontPage, wxRichTextDialogPage )
 
     EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_CAPSCTRL, wxRichTextFontPage::OnCapsctrlClick )
 
+    EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_SMALLCAPSCTRL, wxRichTextFontPage::OnCapsctrlClick )
+
     EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_SUPERSCRIPT, wxRichTextFontPage::OnRichtextfontpageSuperscriptClick )
 
     EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_SUBSCRIPT, wxRichTextFontPage::OnRichtextfontpageSubscriptClick )
@@ -105,6 +107,7 @@ void wxRichTextFontPage::Init()
     m_bgColourCtrl = NULL;
     m_strikethroughCtrl = NULL;
     m_capitalsCtrl = NULL;
+    m_smallCapitalsCtrl = NULL;
     m_superscriptCtrl = NULL;
     m_subscriptCtrl = NULL;
     m_previewCtrl = NULL;
@@ -293,6 +296,13 @@ void wxRichTextFontPage::CreateControls()
         m_capitalsCtrl->SetToolTip(_("Check to show the text in capitals."));
     itemBoxSizer34->Add(m_capitalsCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
 
+    m_smallCapitalsCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SMALLCAPSCTRL, _("Small C&apitals"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
+    m_smallCapitalsCtrl->SetValue(false);
+    m_smallCapitalsCtrl->SetHelpText(_("Check to show the text in small capitals."));
+    if (wxRichTextFontPage::ShowToolTips())
+        m_smallCapitalsCtrl->SetToolTip(_("Check to show the text in small capitals."));
+    itemBoxSizer34->Add(m_smallCapitalsCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
     m_superscriptCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SUPERSCRIPT, _("Supe&rscript"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
     m_superscriptCtrl->SetValue(false);
     m_superscriptCtrl->SetHelpText(_("Check to show the text in superscript."));
@@ -455,6 +465,21 @@ bool wxRichTextFontPage::TransferDataFromWindow()
         attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_CAPITALS);
     }
 
+    if (m_smallCapitalsCtrl->Get3StateValue() != wxCHK_UNDETERMINED)
+    {
+        attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_SMALL_CAPITALS);
+
+        if (m_smallCapitalsCtrl->Get3StateValue() == wxCHK_CHECKED)
+            attr->SetTextEffects(attr->GetTextEffects() | wxTEXT_ATTR_EFFECT_SMALL_CAPITALS);
+        else
+            attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_SMALL_CAPITALS);
+    }
+    else
+    {
+        attr->SetTextEffectFlags(attr->GetTextEffectFlags() & ~wxTEXT_ATTR_EFFECT_SMALL_CAPITALS);
+        attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_SMALL_CAPITALS);
+    }
+
     if (m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
     {
         attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
@@ -475,6 +500,9 @@ bool wxRichTextFontPage::TransferDataFromWindow()
         attr->SetTextEffects(attr->GetTextEffects() & ~(wxTEXT_ATTR_EFFECT_SUBSCRIPT|wxTEXT_ATTR_EFFECT_SUPERSCRIPT) );
     }
 
+    if (attr->GetTextEffectFlags() == 0)
+        attr->SetFlags(attr->GetFlags() & ~wxTEXT_ATTR_EFFECTS);
+
     return true;
 }
 
@@ -519,7 +547,7 @@ bool wxRichTextFontPage::TransferDataToWindow()
 
     if (attr->HasFontWeight())
     {
-        if (attr->GetFontWeight() == wxBOLD)
+        if (attr->GetFontWeight() == wxFONTWEIGHT_BOLD)
             m_weightCtrl->SetSelection(2);
         else
             m_weightCtrl->SetSelection(1);
@@ -531,7 +559,7 @@ bool wxRichTextFontPage::TransferDataToWindow()
 
     if (attr->HasFontItalic())
     {
-        if (attr->GetFontStyle() == wxITALIC)
+        if (attr->GetFontStyle() == wxFONTSTYLE_ITALIC)
             m_styleCtrl->SetSelection(2);
         else
             m_styleCtrl->SetSelection(1);
@@ -599,6 +627,16 @@ bool wxRichTextFontPage::TransferDataToWindow()
         else
             m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);
 
+        if (attr->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_SMALL_CAPITALS)
+        {
+            if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SMALL_CAPITALS)
+                m_smallCapitalsCtrl->Set3StateValue(wxCHK_CHECKED);
+            else
+                m_smallCapitalsCtrl->Set3StateValue(wxCHK_UNCHECKED);
+        }
+        else
+            m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);
+
         if ( attr->GetTextEffectFlags() & (wxTEXT_ATTR_EFFECT_SUPERSCRIPT | wxTEXT_ATTR_EFFECT_SUBSCRIPT) )
         {
             if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT)
@@ -627,6 +665,7 @@ bool wxRichTextFontPage::TransferDataToWindow()
     {
         m_strikethroughCtrl->Set3StateValue(wxCHK_UNDETERMINED);
         m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);
+        m_smallCapitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);
         m_superscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
         m_subscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
     }
@@ -737,6 +776,11 @@ void wxRichTextFontPage::UpdatePreview()
         textEffects |= wxTEXT_ATTR_EFFECT_CAPITALS;
     }
 
+    if (m_smallCapitalsCtrl->Get3StateValue() == wxCHK_CHECKED)
+    {
+        textEffects |= wxTEXT_ATTR_EFFECT_SMALL_CAPITALS;
+    }
+
     if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED )
         textEffects |= wxTEXT_ATTR_EFFECT_SUPERSCRIPT;
     else if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED )
@@ -784,7 +828,7 @@ wxIcon wxRichTextFontPage::GetIconResource( const wxString& name )
 }
 
 /*!
- * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL
+ * wxEVT_TEXT event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL
  */
 
 void wxRichTextFontPage::OnFaceTextCtrlUpdated( wxCommandEvent& WXUNUSED(event) )
@@ -819,7 +863,7 @@ void wxRichTextFontPage::OnFaceTextCtrlUpdated( wxCommandEvent& WXUNUSED(event)
 
 
 /*!
- * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL
+ * wxEVT_TEXT event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL
  */
 
 void wxRichTextFontPage::OnSizeTextCtrlUpdated( wxCommandEvent& WXUNUSED(event) )
@@ -835,7 +879,7 @@ void wxRichTextFontPage::OnSizeTextCtrlUpdated( wxCommandEvent& WXUNUSED(event)
 
 
 /*!
- * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX
+ * wxEVT_LISTBOX event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX
  */
 
 void wxRichTextFontPage::OnSizeListBoxSelected( wxCommandEvent& event )
@@ -854,7 +898,7 @@ void wxRichTextFontPage::OnSizeListBoxSelected( wxCommandEvent& event )
 }
 
 /*!
- * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_FACELISTBOX
+ * wxEVT_LISTBOX event handler for ID_RICHTEXTFONTPAGE_FACELISTBOX
  */
 
 void wxRichTextFontPage::OnFaceListBoxSelected( wxCommandEvent& WXUNUSED(event) )
@@ -873,7 +917,7 @@ void wxRichTextFontPage::OnFaceListBoxSelected( wxCommandEvent& WXUNUSED(event)
 }
 
 /*!
- * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_STYLECTRL
+ * wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_STYLECTRL
  */
 
 void wxRichTextFontPage::OnStyleCtrlSelected( wxCommandEvent& WXUNUSED(event) )
@@ -886,7 +930,7 @@ void wxRichTextFontPage::OnStyleCtrlSelected( wxCommandEvent& WXUNUSED(event) )
 
 
 /*!
- * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL
+ * wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL
  */
 
 void wxRichTextFontPage::OnUnderliningCtrlSelected( wxCommandEvent& WXUNUSED(event) )
@@ -899,7 +943,7 @@ void wxRichTextFontPage::OnUnderliningCtrlSelected( wxCommandEvent& WXUNUSED(eve
 
 
 /*!
- * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL
+ * wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL
  */
 
 void wxRichTextFontPage::OnWeightCtrlSelected( wxCommandEvent& WXUNUSED(event) )
@@ -933,7 +977,7 @@ void wxRichTextFontPage::OnColourClicked( wxCommandEvent& event )
     UpdatePreview();
 }
 /*!
- * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL
+ * wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL
  */
 
 void wxRichTextFontPage::OnStrikethroughctrlClick( wxCommandEvent& WXUNUSED(event) )
@@ -945,7 +989,7 @@ void wxRichTextFontPage::OnStrikethroughctrlClick( wxCommandEvent& WXUNUSED(even
 }
 
 /*!
- * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL
+ * wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL
  */
 
 void wxRichTextFontPage::OnCapsctrlClick( wxCommandEvent& WXUNUSED(event) )
@@ -957,7 +1001,7 @@ void wxRichTextFontPage::OnCapsctrlClick( wxCommandEvent& WXUNUSED(event) )
 }
 
 /*!
- * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT
+ * wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT
  */
 
 void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXUNUSED(event) )
@@ -972,7 +1016,7 @@ void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXU
 }
 
 /*!
- * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT
+ * wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT
  */
 
 void wxRichTextFontPage::OnRichtextfontpageSubscriptClick( wxCommandEvent& WXUNUSED(event) )
@@ -987,7 +1031,7 @@ void wxRichTextFontPage::OnRichtextfontpageSubscriptClick( wxCommandEvent& WXUNU
 }
 
 /*!
- * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZE_UNITS
+ * wxEVT_CHOICE event handler for ID_RICHTEXTFONTPAGE_SIZE_UNITS
  */
 
 void wxRichTextFontPage::OnRichtextfontpageSizeUnitsSelected( wxCommandEvent& WXUNUSED(event) )
@@ -999,7 +1043,7 @@ void wxRichTextFontPage::OnRichtextfontpageSizeUnitsSelected( wxCommandEvent& WX
 }
 
 /*!
- * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS
+ * wxEVT_SPINCTRL event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS
  */
 
 void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& WXUNUSED(event) )
@@ -1044,7 +1088,7 @@ void wxRichTextFontPage::OnIdle( wxIdleEvent& WXUNUSED(event) )
 {
     if (!m_sizeUnitsCtrl)
         return;
-        
+
     if (m_sizeUnitsCtrl->GetSelection() == 1 && m_sizeListBox->IsShown())
     {
         m_fontListBoxParent->Show(m_sizeListBox, false);