Added the ability to deselect attributes in the font dialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68619 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ee7553e935
commit
3c6cc33082
@ -134,7 +134,9 @@ public:
|
||||
wxComboBox* m_styleCtrl;
|
||||
wxComboBox* m_weightCtrl;
|
||||
wxComboBox* m_underliningCtrl;
|
||||
wxCheckBox* m_textColourLabel;
|
||||
wxRichTextColourSwatchCtrl* m_colourCtrl;
|
||||
wxCheckBox* m_bgColourLabel;
|
||||
wxRichTextColourSwatchCtrl* m_bgColourCtrl;
|
||||
wxCheckBox* m_strikethroughCtrl;
|
||||
wxCheckBox* m_capitalsCtrl;
|
||||
@ -151,7 +153,9 @@ public:
|
||||
ID_RICHTEXTFONTPAGE_STYLECTRL = 10007,
|
||||
ID_RICHTEXTFONTPAGE_WEIGHTCTRL = 10004,
|
||||
ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL = 10008,
|
||||
ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL = 10015,
|
||||
ID_RICHTEXTFONTPAGE_COLOURCTRL = 10009,
|
||||
ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL = 10016,
|
||||
ID_RICHTEXTFONTPAGE_BGCOLOURCTRL = 10014,
|
||||
ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL = 10010,
|
||||
ID_RICHTEXTFONTPAGE_CAPSCTRL = 10011,
|
||||
|
@ -306,14 +306,6 @@
|
||||
<string name="proxy-type">"wbBoxSizerProxy"</string>
|
||||
<string name="proxy-Orientation">"Vertical"</string>
|
||||
<string name="proxy-Member variable name">""</string>
|
||||
<string name="proxy-AlignH">"Centre"</string>
|
||||
<string name="proxy-AlignV">"Centre"</string>
|
||||
<long name="proxy-Stretch factor">0</long>
|
||||
<long name="proxy-Border">5</long>
|
||||
<bool name="proxy-wxLEFT">1</bool>
|
||||
<bool name="proxy-wxRIGHT">1</bool>
|
||||
<bool name="proxy-wxTOP">1</bool>
|
||||
<bool name="proxy-wxBOTTOM">1</bool>
|
||||
<bool name="proxy-wxSHAPED">0</bool>
|
||||
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
|
||||
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
|
||||
@ -1442,36 +1434,30 @@
|
||||
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
|
||||
<string name="proxy-Platform">"<Any platform>"</string>
|
||||
<document>
|
||||
<string name="title">"wxStaticText: wxID_STATIC"</string>
|
||||
<string name="title">"wxCheckBox: ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL"</string>
|
||||
<string name="type">"dialog-control-document"</string>
|
||||
<string name="filename">""</string>
|
||||
<string name="icon-name">"statictext"</string>
|
||||
<string name="icon-name">"checkbox"</string>
|
||||
<long name="is-transient">0</long>
|
||||
<long name="owns-file">1</long>
|
||||
<long name="title-mode">0</long>
|
||||
<long name="locked">0</long>
|
||||
<string name="created">"2/10/2006"</string>
|
||||
<string name="proxy-type">"wbStaticTextProxy"</string>
|
||||
<string name="proxy-Id name">"wxID_STATIC"</string>
|
||||
<long name="proxy-Id value">5105</long>
|
||||
<string name="proxy-type">"wbCheckBoxProxy"</string>
|
||||
<string name="event-handler-0">"wxEVT_COMMAND_CHECKBOX_CLICKED|OnUnderliningCtrlSelected|NONE||wxRichTextFontPage"</string>
|
||||
<string name="proxy-Id name">"ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL"</string>
|
||||
<long name="proxy-Id value">10015</long>
|
||||
<string name="proxy-Name">""</string>
|
||||
<string name="proxy-Class">"wxStaticText"</string>
|
||||
<string name="proxy-Base class">"wxStaticText"</string>
|
||||
<string name="proxy-Class">"wxCheckBox"</string>
|
||||
<string name="proxy-Base class">"wxCheckBox"</string>
|
||||
<bool name="proxy-External implementation">1</bool>
|
||||
<bool name="proxy-Separate files">0</bool>
|
||||
<string name="proxy-Implementation filename">""</string>
|
||||
<string name="proxy-Header filename">""</string>
|
||||
<string name="proxy-Member variable name">""</string>
|
||||
<string name="proxy-Member variable name">"m_textColourLabel"</string>
|
||||
<string name="proxy-Label">"&Colour:"</string>
|
||||
<long name="proxy-Wrapping width">-1</long>
|
||||
<bool name="proxy-Initial value">0</bool>
|
||||
<string name="proxy-Help text">""</string>
|
||||
<string name="proxy-Tooltip text">""</string>
|
||||
<string name="proxy-Background colour">""</string>
|
||||
<string name="proxy-Foreground colour">""</string>
|
||||
<string name="proxy-Font">""</string>
|
||||
<bool name="proxy-Hidden">0</bool>
|
||||
<bool name="proxy-Enabled">1</bool>
|
||||
<string name="proxy-Platform">"<Any platform>"</string>
|
||||
<string name="proxy-Data variable">""</string>
|
||||
<string name="proxy-Data validator">""</string>
|
||||
<string name="proxy-Data source">""</string>
|
||||
@ -1479,17 +1465,16 @@
|
||||
<string name="proxy-Data class implementation filename">""</string>
|
||||
<string name="proxy-Data class header filename">""</string>
|
||||
<string name="proxy-Data class manager window">""</string>
|
||||
<bool name="proxy-wxALIGN_LEFT">0</bool>
|
||||
<string name="proxy-Background colour">""</string>
|
||||
<string name="proxy-Foreground colour">""</string>
|
||||
<string name="proxy-Font">""</string>
|
||||
<bool name="proxy-Hidden">0</bool>
|
||||
<bool name="proxy-Enabled">1</bool>
|
||||
<string name="proxy-Platform">"<Any platform>"</string>
|
||||
<bool name="proxy-wxALIGN_RIGHT">0</bool>
|
||||
<bool name="proxy-wxALIGN_CENTRE">0</bool>
|
||||
<bool name="proxy-wxST_NO_AUTORESIZE">0</bool>
|
||||
<bool name="proxy-wxNO_BORDER">0</bool>
|
||||
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
|
||||
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
|
||||
<bool name="proxy-wxBORDER_THEME">0</bool>
|
||||
<bool name="proxy-wxSUNKEN_BORDER">0</bool>
|
||||
<bool name="proxy-wxRAISED_BORDER">0</bool>
|
||||
<bool name="proxy-wxSTATIC_BORDER">0</bool>
|
||||
<bool name="proxy-wxCHK_2STATE">0</bool>
|
||||
<bool name="proxy-wxCHK_3STATE">0</bool>
|
||||
<bool name="proxy-wxCHK_ALLOW_3RD_STATE_FOR_USER">0</bool>
|
||||
<bool name="proxy-wxWANTS_CHARS">0</bool>
|
||||
<bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool>
|
||||
<bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool>
|
||||
@ -1498,7 +1483,7 @@
|
||||
<long name="proxy-Y">-1</long>
|
||||
<long name="proxy-Width">-1</long>
|
||||
<long name="proxy-Height">-1</long>
|
||||
<string name="proxy-AlignH">"Left"</string>
|
||||
<string name="proxy-AlignH">"Centre"</string>
|
||||
<string name="proxy-AlignV">"Centre"</string>
|
||||
<long name="proxy-Stretch factor">0</long>
|
||||
<long name="proxy-Border">5</long>
|
||||
@ -1609,35 +1594,30 @@
|
||||
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
|
||||
<string name="proxy-Platform">"<Any platform>"</string>
|
||||
<document>
|
||||
<string name="title">"wxStaticText: wxID_STATIC"</string>
|
||||
<string name="title">"wxCheckBox: ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL"</string>
|
||||
<string name="type">"dialog-control-document"</string>
|
||||
<string name="filename">""</string>
|
||||
<string name="icon-name">"statictext"</string>
|
||||
<string name="icon-name">"checkbox"</string>
|
||||
<long name="is-transient">0</long>
|
||||
<long name="owns-file">1</long>
|
||||
<long name="title-mode">0</long>
|
||||
<long name="locked">0</long>
|
||||
<string name="proxy-type">"wbStaticTextProxy"</string>
|
||||
<string name="proxy-Id name">"wxID_STATIC"</string>
|
||||
<long name="proxy-Id value">5105</long>
|
||||
<string name="proxy-type">"wbCheckBoxProxy"</string>
|
||||
<string name="event-handler-0">"wxEVT_COMMAND_CHECKBOX_CLICKED|OnUnderliningCtrlSelected|NONE||wxRichTextFontPage"</string>
|
||||
<string name="proxy-Id name">"ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL"</string>
|
||||
<long name="proxy-Id value">10016</long>
|
||||
<string name="proxy-Name">""</string>
|
||||
<string name="proxy-Class">"wxStaticText"</string>
|
||||
<string name="proxy-Base class">"wxStaticText"</string>
|
||||
<string name="proxy-Class">"wxCheckBox"</string>
|
||||
<string name="proxy-Base class">"wxCheckBox"</string>
|
||||
<bool name="proxy-External implementation">1</bool>
|
||||
<bool name="proxy-Separate files">0</bool>
|
||||
<string name="proxy-Implementation filename">""</string>
|
||||
<string name="proxy-Header filename">""</string>
|
||||
<string name="proxy-Member variable name">""</string>
|
||||
<string name="proxy-Member variable name">"m_bgColourLabel"</string>
|
||||
<string name="proxy-Label">"&Bg colour:"</string>
|
||||
<long name="proxy-Wrapping width">-1</long>
|
||||
<bool name="proxy-Initial value">0</bool>
|
||||
<string name="proxy-Help text">""</string>
|
||||
<string name="proxy-Tooltip text">""</string>
|
||||
<string name="proxy-Background colour">""</string>
|
||||
<string name="proxy-Foreground colour">""</string>
|
||||
<string name="proxy-Font">""</string>
|
||||
<bool name="proxy-Hidden">0</bool>
|
||||
<bool name="proxy-Enabled">1</bool>
|
||||
<string name="proxy-Platform">"<Any platform>"</string>
|
||||
<string name="proxy-Data variable">""</string>
|
||||
<string name="proxy-Data validator">""</string>
|
||||
<string name="proxy-Data source">""</string>
|
||||
@ -1645,17 +1625,16 @@
|
||||
<string name="proxy-Data class implementation filename">""</string>
|
||||
<string name="proxy-Data class header filename">""</string>
|
||||
<string name="proxy-Data class manager window">""</string>
|
||||
<bool name="proxy-wxALIGN_LEFT">0</bool>
|
||||
<string name="proxy-Background colour">""</string>
|
||||
<string name="proxy-Foreground colour">""</string>
|
||||
<string name="proxy-Font">""</string>
|
||||
<bool name="proxy-Hidden">0</bool>
|
||||
<bool name="proxy-Enabled">1</bool>
|
||||
<string name="proxy-Platform">"<Any platform>"</string>
|
||||
<bool name="proxy-wxALIGN_RIGHT">0</bool>
|
||||
<bool name="proxy-wxALIGN_CENTRE">0</bool>
|
||||
<bool name="proxy-wxST_NO_AUTORESIZE">0</bool>
|
||||
<bool name="proxy-wxNO_BORDER">0</bool>
|
||||
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
|
||||
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
|
||||
<bool name="proxy-wxBORDER_THEME">0</bool>
|
||||
<bool name="proxy-wxSUNKEN_BORDER">0</bool>
|
||||
<bool name="proxy-wxRAISED_BORDER">0</bool>
|
||||
<bool name="proxy-wxSTATIC_BORDER">0</bool>
|
||||
<bool name="proxy-wxCHK_2STATE">0</bool>
|
||||
<bool name="proxy-wxCHK_3STATE">0</bool>
|
||||
<bool name="proxy-wxCHK_ALLOW_3RD_STATE_FOR_USER">0</bool>
|
||||
<bool name="proxy-wxWANTS_CHARS">0</bool>
|
||||
<bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool>
|
||||
<bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool>
|
||||
@ -1664,7 +1643,7 @@
|
||||
<long name="proxy-Y">-1</long>
|
||||
<long name="proxy-Width">-1</long>
|
||||
<long name="proxy-Height">-1</long>
|
||||
<string name="proxy-AlignH">"Left"</string>
|
||||
<string name="proxy-AlignH">"Centre"</string>
|
||||
<string name="proxy-AlignV">"Centre"</string>
|
||||
<long name="proxy-Stretch factor">0</long>
|
||||
<long name="proxy-Border">5</long>
|
||||
@ -2229,6 +2208,14 @@
|
||||
<string name="proxy-type">"wbBoxSizerProxy"</string>
|
||||
<string name="proxy-Orientation">"Vertical"</string>
|
||||
<string name="proxy-Member variable name">""</string>
|
||||
<string name="proxy-AlignH">"Centre"</string>
|
||||
<string name="proxy-AlignV">"Centre"</string>
|
||||
<long name="proxy-Stretch factor">0</long>
|
||||
<long name="proxy-Border">5</long>
|
||||
<bool name="proxy-wxLEFT">1</bool>
|
||||
<bool name="proxy-wxRIGHT">1</bool>
|
||||
<bool name="proxy-wxTOP">1</bool>
|
||||
<bool name="proxy-wxBOTTOM">1</bool>
|
||||
<bool name="proxy-wxSHAPED">0</bool>
|
||||
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
|
||||
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
|
||||
|
@ -39,6 +39,10 @@ BEGIN_EVENT_TABLE( wxRichTextFontPage, wxRichTextDialogPage )
|
||||
|
||||
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 )
|
||||
@ -85,7 +89,9 @@ void wxRichTextFontPage::Init()
|
||||
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;
|
||||
@ -216,8 +222,9 @@ void wxRichTextFontPage::CreateControls()
|
||||
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."));
|
||||
@ -228,8 +235,9 @@ void wxRichTextFontPage::CreateControls()
|
||||
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."));
|
||||
@ -280,12 +288,15 @@ void wxRichTextFontPage::CreateControls()
|
||||
|
||||
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"));
|
||||
|
||||
@ -327,10 +338,10 @@ bool wxRichTextFontPage::TransferDataFromWindow()
|
||||
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;
|
||||
@ -340,10 +351,10 @@ bool wxRichTextFontPage::TransferDataFromWindow()
|
||||
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;
|
||||
@ -353,10 +364,10 @@ bool wxRichTextFontPage::TransferDataFromWindow()
|
||||
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;
|
||||
@ -366,14 +377,14 @@ bool wxRichTextFontPage::TransferDataFromWindow()
|
||||
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());
|
||||
}
|
||||
@ -456,50 +467,62 @@ bool wxRichTextFontPage::TransferDataToWindow()
|
||||
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())
|
||||
{
|
||||
@ -572,11 +595,30 @@ void wxRichTextFontPage::UpdatePreview()
|
||||
{
|
||||
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_bgColourPresent)
|
||||
m_previewCtrl->SetBackgroundColour(m_bgColourCtrl->GetBackgroundColour());
|
||||
if (m_bgColourLabel->GetValue())
|
||||
m_previewCtrl->SetBackgroundColour(m_bgColourCtrl->GetColour());
|
||||
else
|
||||
{
|
||||
m_previewCtrl->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
if (!(m_bgColourCtrl->GetColour() == *wxWHITE))
|
||||
{
|
||||
m_bgColourCtrl->SetColour(*wxWHITE);
|
||||
m_bgColourCtrl->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_faceListBox->GetSelection() != wxNOT_FOUND)
|
||||
{
|
||||
@ -592,10 +634,10 @@ void wxRichTextFontPage::UpdatePreview()
|
||||
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;
|
||||
@ -603,10 +645,10 @@ void wxRichTextFontPage::UpdatePreview()
|
||||
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;
|
||||
@ -614,10 +656,10 @@ void wxRichTextFontPage::UpdatePreview()
|
||||
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;
|
||||
@ -740,11 +782,15 @@ void wxRichTextFontPage::OnSizeTextCtrlUpdated( wxCommandEvent& WXUNUSED(event)
|
||||
|
||||
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();
|
||||
}
|
||||
@ -755,11 +801,15 @@ void wxRichTextFontPage::OnSizeListBoxSelected( wxCommandEvent& event )
|
||||
|
||||
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();
|
||||
}
|
||||
@ -770,6 +820,9 @@ void wxRichTextFontPage::OnFaceListBoxSelected( wxCommandEvent& WXUNUSED(event)
|
||||
|
||||
void wxRichTextFontPage::OnStyleCtrlSelected( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (m_dontUpdate)
|
||||
return;
|
||||
|
||||
UpdatePreview();
|
||||
}
|
||||
|
||||
@ -780,6 +833,9 @@ void wxRichTextFontPage::OnStyleCtrlSelected( wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
void wxRichTextFontPage::OnUnderliningCtrlSelected( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (m_dontUpdate)
|
||||
return;
|
||||
|
||||
UpdatePreview();
|
||||
}
|
||||
|
||||
@ -790,6 +846,9 @@ void wxRichTextFontPage::OnUnderliningCtrlSelected( wxCommandEvent& WXUNUSED(eve
|
||||
|
||||
void wxRichTextFontPage::OnWeightCtrlSelected( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (m_dontUpdate)
|
||||
return;
|
||||
|
||||
UpdatePreview();
|
||||
}
|
||||
|
||||
@ -800,6 +859,19 @@ void wxRichTextFontPage::OnColourClicked( wxCommandEvent& event )
|
||||
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();
|
||||
}
|
||||
/*!
|
||||
@ -808,6 +880,9 @@ void wxRichTextFontPage::OnColourClicked( wxCommandEvent& event )
|
||||
|
||||
void wxRichTextFontPage::OnStrikethroughctrlClick( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (m_dontUpdate)
|
||||
return;
|
||||
|
||||
UpdatePreview();
|
||||
}
|
||||
|
||||
@ -817,6 +892,9 @@ void wxRichTextFontPage::OnStrikethroughctrlClick( wxCommandEvent& WXUNUSED(even
|
||||
|
||||
void wxRichTextFontPage::OnCapsctrlClick( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (m_dontUpdate)
|
||||
return;
|
||||
|
||||
UpdatePreview();
|
||||
}
|
||||
|
||||
@ -826,6 +904,9 @@ void wxRichTextFontPage::OnCapsctrlClick( wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (m_dontUpdate)
|
||||
return;
|
||||
|
||||
if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
|
||||
m_subscriptCtrl->Set3StateValue( wxCHK_UNCHECKED );
|
||||
|
||||
@ -838,6 +919,9 @@ void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXU
|
||||
|
||||
void wxRichTextFontPage::OnRichtextfontpageSubscriptClick( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (m_dontUpdate)
|
||||
return;
|
||||
|
||||
if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED)
|
||||
m_superscriptCtrl->Set3StateValue( wxCHK_UNCHECKED );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user