EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_CAPSCTRL, wxRichTextFontPage::OnCapsctrlClick )
+ EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_SUPERSCRIPT, wxRichTextFontPage::OnRichtextfontpageSuperscriptClick )
+
+ EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_SUBSCRIPT, wxRichTextFontPage::OnRichtextfontpageSubscriptClick )
+
////@end wxRichTextFontPage event table entries
END_EVENT_TABLE()
m_colourCtrl = NULL;
m_strikethroughCtrl = NULL;
m_capitalsCtrl = NULL;
+ m_superscriptCtrl = NULL;
+ m_subscriptCtrl = NULL;
m_previewCtrl = NULL;
////@end wxRichTextFontPage member initialisation
}
m_capitalsCtrl->SetToolTip(_("Check to show the text in capitals."));
itemBoxSizer26->Add(m_capitalsCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+ m_superscriptCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTFONTPAGE_SUPERSCRIPT, _("Supe&rscript"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
+ m_superscriptCtrl->SetValue(false);
+ m_superscriptCtrl->SetHelpText(_("Check to show the text in superscript."));
+ if (wxRichTextFontPage::ShowToolTips())
+ m_superscriptCtrl->SetToolTip(_("Check to show the text in superscript."));
+ itemBoxSizer26->Add(m_superscriptCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ m_subscriptCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTFONTPAGE_SUBSCRIPT, _("Subscrip&t"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
+ m_subscriptCtrl->SetValue(false);
+ m_subscriptCtrl->SetHelpText(_("Check to show the text in subscript."));
+ if (wxRichTextFontPage::ShowToolTips())
+ m_subscriptCtrl->SetToolTip(_("Check to show the text in subscript."));
+ itemBoxSizer26->Add(m_subscriptCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
m_previewCtrl = new wxRichTextFontPreviewCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_PREVIEWCTRL, wxDefaultPosition, wxSize(100, 60), 0 );
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);
}
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);
}
attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_CAPITALS);
}
+ if (m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
+ {
+ attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
+ attr->SetTextEffects(attr->GetTextEffects() | wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
+ attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_SUBSCRIPT);
+ }
+ else if (m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
+ {
+ attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_SUBSCRIPT);
+ attr->SetTextEffects(attr->GetTextEffects() | wxTEXT_ATTR_EFFECT_SUBSCRIPT);
+ attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
+ }
+ else
+ {
+ // 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;
}
}
else
m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);
+
+ if ( attr->GetTextEffectFlags() & (wxTEXT_ATTR_EFFECT_SUPERSCRIPT | wxTEXT_ATTR_EFFECT_SUBSCRIPT) )
+ {
+ if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT)
+ {
+ m_superscriptCtrl->Set3StateValue(wxCHK_CHECKED);
+ m_subscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
+ }
+ else if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT)
+ {
+ m_superscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
+ m_subscriptCtrl->Set3StateValue(wxCHK_CHECKED);
+ }
+ else
+ {
+ m_superscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
+ m_subscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
+ }
+ }
+ else
+ {
+ 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_UNDETERMINED);
+ m_subscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
}
UpdatePreview();
textEffects |= wxTEXT_ATTR_EFFECT_CAPITALS;
}
+ if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED )
+ textEffects |= wxTEXT_ATTR_EFFECT_SUPERSCRIPT;
+ else if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED )
+ textEffects |= wxTEXT_ATTR_EFFECT_SUBSCRIPT;
+
m_previewCtrl->SetFont(font);
m_previewCtrl->SetTextEffects(textEffects);
m_previewCtrl->Refresh();
UpdatePreview();
}
+/*!
+ * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT
+ */
+
+void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXUNUSED(event) )
+{
+ if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
+ m_subscriptCtrl->Set3StateValue( wxCHK_UNCHECKED );
+
+ UpdatePreview();
+}
+
+/*!
+ * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT
+ */
+
+void wxRichTextFontPage::OnRichtextfontpageSubscriptClick( wxCommandEvent& WXUNUSED(event) )
+{
+ if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
+ m_superscriptCtrl->Set3StateValue( wxCHK_UNCHECKED );
+ UpdatePreview();
+}