EVT_COMBOBOX( ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL, wxRichTextFontPage::OnUnderliningCtrlSelected )
+ EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL, wxRichTextFontPage::OnUnderliningCtrlSelected )
+
+ EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL, wxRichTextFontPage::OnUnderliningCtrlSelected )
+
EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL, wxRichTextFontPage::OnStrikethroughctrlClick )
EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_CAPSCTRL, wxRichTextFontPage::OnCapsctrlClick )
m_styleCtrl = NULL;
m_weightCtrl = NULL;
m_underliningCtrl = NULL;
+ m_textColourLabel = NULL;
m_colourCtrl = NULL;
+ m_bgColourLabel = NULL;
m_bgColourCtrl = NULL;
m_strikethroughCtrl = NULL;
m_capitalsCtrl = NULL;
wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer13->Add(itemBoxSizer24, 0, wxGROW, 5);
- wxStaticText* itemStaticText25 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Colour:"), wxDefaultPosition, wxDefaultSize, 0 );
- itemBoxSizer24->Add(itemStaticText25, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
+ m_textColourLabel = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL, _("&Colour:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_textColourLabel->SetValue(false);
+ itemBoxSizer24->Add(m_textColourLabel, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5);
m_colourCtrl = new wxRichTextColourSwatchCtrl( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_COLOURCTRL, wxDefaultPosition, wxSize(40, 20), 0 );
m_colourCtrl->SetHelpText(_("Click to change the text colour."));
wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer13->Add(itemBoxSizer27, 0, wxGROW, 5);
- wxStaticText* itemStaticText28 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Bg colour:"), wxDefaultPosition, wxDefaultSize, 0 );
- itemBoxSizer27->Add(itemStaticText28, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
+ m_bgColourLabel = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL, _("&Bg colour:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_bgColourLabel->SetValue(false);
+ itemBoxSizer27->Add(m_bgColourLabel, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5);
m_bgColourCtrl = new wxRichTextColourSwatchCtrl( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_BGCOLOURCTRL, wxDefaultPosition, wxSize(40, 20), 0 );
m_bgColourCtrl->SetHelpText(_("Click to change the text background colour."));
wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer3->Add(itemBoxSizer30, 0, wxGROW, 5);
- m_strikethroughCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL, _("&Strikethrough"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
+ m_strikethroughCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL, _("&Strikethrough"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
m_strikethroughCtrl->SetValue(false);
m_strikethroughCtrl->SetHelpText(_("Check to show a line through the text."));
if (wxRichTextFontPage::ShowToolTips())
m_strikethroughCtrl->SetToolTip(_("Check to show a line through the text."));
itemBoxSizer30->Add(m_strikethroughCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
- m_capitalsCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_CAPSCTRL, _("Ca&pitals"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
+ m_capitalsCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_CAPSCTRL, _("Ca&pitals"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
m_capitalsCtrl->SetValue(false);
m_capitalsCtrl->SetHelpText(_("Check to show the text in capitals."));
if (wxRichTextFontPage::ShowToolTips())
m_capitalsCtrl->SetToolTip(_("Check to show the text in capitals."));
itemBoxSizer30->Add(m_capitalsCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
- m_superscriptCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SUPERSCRIPT, _("Supe&rscript"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
+ 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."));
if (wxRichTextFontPage::ShowToolTips())
m_superscriptCtrl->SetToolTip(_("Check to show the text in superscript."));
itemBoxSizer30->Add(m_superscriptCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
- m_subscriptCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SUBSCRIPT, _("Subscrip&t"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
+ m_subscriptCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SUBSCRIPT, _("Subscrip&t"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
m_subscriptCtrl->SetValue(false);
m_subscriptCtrl->SetHelpText(_("Check to show the text in subscript."));
if (wxRichTextFontPage::ShowToolTips())
m_faceListBox->UpdateFonts();
+ m_styleCtrl->Append(_("(none)"));
m_styleCtrl->Append(_("Regular"));
m_styleCtrl->Append(_("Italic"));
+ m_weightCtrl->Append(_("(none)"));
m_weightCtrl->Append(_("Regular"));
m_weightCtrl->Append(_("Bold"));
+ m_underliningCtrl->Append(_("(none)"));
m_underliningCtrl->Append(_("Not underlined"));
m_underliningCtrl->Append(_("Underlined"));
else
attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_SIZE));
- if (m_styleCtrl->GetSelection() != wxNOT_FOUND)
+ if (m_styleCtrl->GetSelection() != wxNOT_FOUND && m_styleCtrl->GetSelection() != 0)
{
wxFontStyle style;
- if (m_styleCtrl->GetStringSelection() == _("Italic"))
+ if (m_styleCtrl->GetSelection() == 2)
style = wxFONTSTYLE_ITALIC;
else
style = wxFONTSTYLE_NORMAL;
else
attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_ITALIC));
- if (m_weightCtrl->GetSelection() != wxNOT_FOUND)
+ if (m_weightCtrl->GetSelection() != wxNOT_FOUND && m_weightCtrl->GetSelection() != 0)
{
wxFontWeight weight;
- if (m_weightCtrl->GetStringSelection() == _("Bold"))
+ if (m_weightCtrl->GetSelection() == 2)
weight = wxFONTWEIGHT_BOLD;
else
weight = wxFONTWEIGHT_NORMAL;
else
attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_WEIGHT));
- if (m_underliningCtrl->GetSelection() != wxNOT_FOUND)
+ if (m_underliningCtrl->GetSelection() != wxNOT_FOUND && m_underliningCtrl->GetSelection() != 0)
{
bool underlined;
- if (m_underliningCtrl->GetStringSelection() == _("Underlined"))
+ if (m_underliningCtrl->GetSelection() == 2)
underlined = true;
else
underlined = false;
else
attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_UNDERLINE));
- if (m_colourPresent)
+ if (m_textColourLabel->GetValue())
{
attr->SetTextColour(m_colourCtrl->GetColour());
}
else
attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_TEXT_COLOUR));
- if (m_bgColourPresent)
+ if (m_bgColourLabel->GetValue())
{
attr->SetBackgroundColour(m_bgColourCtrl->GetColour());
}
else
attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_STRIKETHROUGH);
}
+ else
+ {
+ attr->SetTextEffectFlags(attr->GetTextEffectFlags() & ~wxTEXT_ATTR_EFFECT_STRIKETHROUGH);
+ attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_STRIKETHROUGH);
+ }
if (m_capitalsCtrl->Get3StateValue() != wxCHK_UNDETERMINED)
{
else
attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_CAPITALS);
}
+ else
+ {
+ attr->SetTextEffectFlags(attr->GetTextEffectFlags() & ~wxTEXT_ATTR_EFFECT_CAPITALS);
+ attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_CAPITALS);
+ }
if (m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
{
// 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) );
+ attr->SetTextEffects(attr->GetTextEffects() & ~(wxTEXT_ATTR_EFFECT_SUBSCRIPT|wxTEXT_ATTR_EFFECT_SUPERSCRIPT) );
}
return true;
if (attr->HasFontWeight())
{
if (attr->GetFontWeight() == wxBOLD)
- m_weightCtrl->SetSelection(1);
+ m_weightCtrl->SetSelection(2);
else
- m_weightCtrl->SetSelection(0);
+ m_weightCtrl->SetSelection(1);
}
else
{
- m_weightCtrl->SetSelection(wxNOT_FOUND);
+ m_weightCtrl->SetSelection(0);
}
if (attr->HasFontItalic())
{
if (attr->GetFontStyle() == wxITALIC)
- m_styleCtrl->SetSelection(1);
+ m_styleCtrl->SetSelection(2);
else
- m_styleCtrl->SetSelection(0);
+ m_styleCtrl->SetSelection(1);
}
else
{
- m_styleCtrl->SetSelection(wxNOT_FOUND);
+ m_styleCtrl->SetSelection(0);
}
if (attr->HasFontUnderlined())
{
if (attr->GetFontUnderlined())
- m_underliningCtrl->SetSelection(1);
+ m_underliningCtrl->SetSelection(2);
else
- m_underliningCtrl->SetSelection(0);
+ m_underliningCtrl->SetSelection(1);
}
else
{
- m_underliningCtrl->SetSelection(wxNOT_FOUND);
+ m_underliningCtrl->SetSelection(0);
}
if (attr->HasTextColour())
{
m_colourCtrl->SetColour(attr->GetTextColour());
+ m_textColourLabel->SetValue(true);
m_colourPresent = true;
}
+ else
+ {
+ m_colourCtrl->SetColour(*wxBLACK);
+ m_textColourLabel->SetValue(false);
+ }
if (attr->HasBackgroundColour())
{
m_bgColourCtrl->SetColour(attr->GetBackgroundColour());
+ m_bgColourLabel->SetValue(true);
m_bgColourPresent = true;
}
+ else
+ {
+ m_bgColourCtrl->SetColour(*wxWHITE);
+ m_bgColourLabel->SetValue(false);
+ }
if (attr->HasTextEffects())
{
{
wxRichTextAttr attr;
- if (m_colourPresent)
- m_previewCtrl->SetForegroundColour(m_colourCtrl->GetBackgroundColour());
+ if (m_textColourLabel->GetValue())
+ m_previewCtrl->SetForegroundColour(m_colourCtrl->GetColour());
+ else
+ {
+ m_previewCtrl->SetForegroundColour(*wxBLACK);
+ if (!(m_colourCtrl->GetColour() == *wxBLACK))
+ {
+ m_colourCtrl->SetColour(*wxBLACK);
+ m_colourCtrl->Refresh();
+ }
+ }
+
+ if (m_bgColourLabel->GetValue())
+ m_previewCtrl->SetBackgroundColour(m_bgColourCtrl->GetColour());
+ else
+ {
+ m_previewCtrl->SetBackgroundColour(*wxWHITE);
- if (m_bgColourPresent)
- m_previewCtrl->SetBackgroundColour(m_bgColourCtrl->GetBackgroundColour());
+ if (!(m_bgColourCtrl->GetColour() == *wxWHITE))
+ {
+ m_bgColourCtrl->SetColour(*wxWHITE);
+ m_bgColourCtrl->Refresh();
+ }
+ }
if (m_faceListBox->GetSelection() != wxNOT_FOUND)
{
attr.SetFontSize(sz);
}
- if (m_styleCtrl->GetSelection() != wxNOT_FOUND)
+ if (m_styleCtrl->GetSelection() != wxNOT_FOUND && m_styleCtrl->GetSelection() != 0)
{
wxFontStyle style;
- if (m_styleCtrl->GetStringSelection() == _("Italic"))
+ if (m_styleCtrl->GetSelection() == 2)
style = wxFONTSTYLE_ITALIC;
else
style = wxFONTSTYLE_NORMAL;
attr.SetFontStyle(style);
}
- if (m_weightCtrl->GetSelection() != wxNOT_FOUND)
+ if (m_weightCtrl->GetSelection() != wxNOT_FOUND && m_weightCtrl->GetSelection() != 0)
{
wxFontWeight weight;
- if (m_weightCtrl->GetStringSelection() == _("Bold"))
+ if (m_weightCtrl->GetSelection() == 2)
weight = wxFONTWEIGHT_BOLD;
else
weight = wxFONTWEIGHT_NORMAL;
attr.SetFontWeight(weight);
}
- if (m_underliningCtrl->GetSelection() != wxNOT_FOUND)
+ if (m_underliningCtrl->GetSelection() != wxNOT_FOUND && m_underliningCtrl->GetSelection() != 0)
{
bool underlined;
- if (m_underliningCtrl->GetStringSelection() == _("Underlined"))
+ if (m_underliningCtrl->GetSelection() == 2)
underlined = true;
else
underlined = false;
void wxRichTextFontPage::OnSizeListBoxSelected( wxCommandEvent& event )
{
+ bool oldDontUpdate = m_dontUpdate;
m_dontUpdate = true;
m_sizeTextCtrl->SetValue(event.GetString());
- m_dontUpdate = false;
+ m_dontUpdate = oldDontUpdate;
+
+ if (m_dontUpdate)
+ return;
UpdatePreview();
}
void wxRichTextFontPage::OnFaceListBoxSelected( wxCommandEvent& WXUNUSED(event) )
{
+ bool oldDontUpdate = m_dontUpdate;
m_dontUpdate = true;
m_faceTextCtrl->SetValue(m_faceListBox->GetFaceName(m_faceListBox->GetSelection()));
- m_dontUpdate = false;
+ m_dontUpdate = oldDontUpdate;
+
+ if (m_dontUpdate)
+ return;
UpdatePreview();
}
void wxRichTextFontPage::OnStyleCtrlSelected( wxCommandEvent& WXUNUSED(event) )
{
+ if (m_dontUpdate)
+ return;
+
UpdatePreview();
}
void wxRichTextFontPage::OnUnderliningCtrlSelected( wxCommandEvent& WXUNUSED(event) )
{
+ if (m_dontUpdate)
+ return;
+
UpdatePreview();
}
void wxRichTextFontPage::OnWeightCtrlSelected( wxCommandEvent& WXUNUSED(event) )
{
+ if (m_dontUpdate)
+ return;
+
UpdatePreview();
}
else if (event.GetId() == m_bgColourCtrl->GetId())
m_bgColourPresent = true;
+ m_dontUpdate = true;
+
+ if (event.GetId() == m_colourCtrl->GetId())
+ {
+ m_textColourLabel->SetValue(true);
+ }
+ else if (event.GetId() == m_bgColourCtrl->GetId())
+ {
+ m_bgColourLabel->SetValue(true);
+ }
+
+ m_dontUpdate = false;
+
UpdatePreview();
}
/*!
void wxRichTextFontPage::OnStrikethroughctrlClick( wxCommandEvent& WXUNUSED(event) )
{
+ if (m_dontUpdate)
+ return;
+
UpdatePreview();
}
void wxRichTextFontPage::OnCapsctrlClick( wxCommandEvent& WXUNUSED(event) )
{
+ if (m_dontUpdate)
+ return;
+
UpdatePreview();
}
void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXUNUSED(event) )
{
+ if (m_dontUpdate)
+ return;
+
if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
m_subscriptCtrl->Set3StateValue( wxCHK_UNCHECKED );
void wxRichTextFontPage::OnRichtextfontpageSubscriptClick( wxCommandEvent& WXUNUSED(event) )
{
+ if (m_dontUpdate)
+ return;
+
if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
m_superscriptCtrl->Set3StateValue( wxCHK_UNCHECKED );