X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/32423dd8248d13625e8eedd10298601e5313a393..7be2a7af39888b264eb0c5787fb2914005633d1b:/src/richtext/richtextfontpage.cpp diff --git a/src/richtext/richtextfontpage.cpp b/src/richtext/richtextfontpage.cpp index 89c9f1e023..d90e5024b6 100644 --- a/src/richtext/richtextfontpage.cpp +++ b/src/richtext/richtextfontpage.cpp @@ -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; } @@ -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 ) @@ -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);