diff --git a/include/wx/richtext/richtextctrl.h b/include/wx/richtext/richtextctrl.h index d83fbbcf31..9cbf4f50dc 100644 --- a/include/wx/richtext/richtextctrl.h +++ b/include/wx/richtext/richtextctrl.h @@ -2075,7 +2075,7 @@ public: list (ok, newPos). @endWxPerlOnly */ - bool DeleteSelectedContent(long* newPos= NULL); + virtual bool DeleteSelectedContent(long* newPos= NULL); /** Transforms logical (unscrolled) position to physical window position. diff --git a/interface/wx/richtext/richtextctrl.h b/interface/wx/richtext/richtextctrl.h index 72649229ab..da43e12720 100644 --- a/interface/wx/richtext/richtextctrl.h +++ b/interface/wx/richtext/richtextctrl.h @@ -2021,7 +2021,7 @@ public: list (ok, newPos). @endWxPerlOnly */ - bool DeleteSelectedContent(long* newPos= NULL); + virtual bool DeleteSelectedContent(long* newPos= NULL); /** Transforms logical (unscrolled) position to physical window position. diff --git a/src/richtext/richtextfontpage.cpp b/src/richtext/richtextfontpage.cpp index c3ae39eb03..c93a8a8f79 100644 --- a/src/richtext/richtextfontpage.cpp +++ b/src/richtext/richtextfontpage.cpp @@ -334,6 +334,8 @@ void wxRichTextFontPage::CreateControls() ////@end wxRichTextFontPage content construction + m_fontSizeSpinButtons->SetRange(0, 999); + if ((GetAllowedTextEffects() & wxTEXT_ATTR_EFFECT_RTL) == 0) m_rtlParentSizer->Show(m_rtlCtrl, false); if ((GetAllowedTextEffects() & wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION) == 0) @@ -579,6 +581,7 @@ bool wxRichTextFontPage::TransferDataToWindow() { wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize()); m_sizeTextCtrl->SetValue(strSize); + m_fontSizeSpinButtons->SetValue(attr->GetFontSize()); m_sizeUnitsCtrl->SetSelection(0); if (m_sizeListBox->FindString(strSize) != wxNOT_FOUND) m_sizeListBox->SetStringSelection(strSize); @@ -587,6 +590,7 @@ bool wxRichTextFontPage::TransferDataToWindow() { wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize()); m_sizeTextCtrl->SetValue(strSize); + m_fontSizeSpinButtons->SetValue(attr->GetFontSize()); m_sizeUnitsCtrl->SetSelection(1); m_sizeListBox->SetSelection(wxNOT_FOUND); } @@ -950,9 +954,16 @@ void wxRichTextFontPage::OnSizeTextCtrlUpdated( wxCommandEvent& WXUNUSED(event) if (m_dontUpdate) return; + m_dontUpdate = true; + wxString strSize = m_sizeTextCtrl->GetValue(); if (!strSize.IsEmpty() && m_sizeListBox->FindString(strSize) != wxNOT_FOUND) m_sizeListBox->SetStringSelection(strSize); + if (!strSize.IsEmpty()) + m_fontSizeSpinButtons->SetValue(wxAtoi(strSize)); + + m_dontUpdate = false; + UpdatePreview(); } @@ -967,6 +978,8 @@ void wxRichTextFontPage::OnSizeListBoxSelected( wxCommandEvent& event ) m_dontUpdate = true; m_sizeTextCtrl->SetValue(event.GetString()); + if (!event.GetString().IsEmpty()) + m_fontSizeSpinButtons->SetValue(wxAtoi(event.GetString())); m_dontUpdate = oldDontUpdate; @@ -1127,17 +1140,33 @@ void wxRichTextFontPage::OnRichtextfontpageSizeUnitsSelected( wxCommandEvent& WX void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& WXUNUSED(event) ) { + if (m_dontUpdate) + return; + + m_dontUpdate = true; + wxString text = m_sizeTextCtrl->GetValue(); + int size = 12; if (!text.IsEmpty()) { - int size = wxAtoi(text); - if (size > 0) - { - size ++; - m_sizeTextCtrl->SetValue(wxString::Format(wxT("%d"), size)); - UpdatePreview(); - } + size = wxAtoi(text); + size ++; } + + if (size < 1 || size > 999) + size = 12; + + if (m_fontSizeSpinButtons->GetValue() != size) + m_fontSizeSpinButtons->SetValue(size); + + wxString newText(wxString::Format(wxT("%d"), size)); + + m_sizeTextCtrl->SetValue(newText); + if (!newText.IsEmpty() && m_sizeListBox->FindString(newText) != wxNOT_FOUND) + m_sizeListBox->SetStringSelection(newText); + UpdatePreview(); + + m_dontUpdate = false; } /*! @@ -1146,17 +1175,34 @@ void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& WXUNUSED( void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsDown( wxSpinEvent& WXUNUSED(event) ) { + if (m_dontUpdate) + return; + + m_dontUpdate = true; + wxString text = m_sizeTextCtrl->GetValue(); + int size = 12; if (!text.IsEmpty()) { - int size = wxAtoi(text); - if (size > 0) - { + size = wxAtoi(text); + if (size > 1) size --; - m_sizeTextCtrl->SetValue(wxString::Format(wxT("%d"), size)); - UpdatePreview(); - } } + + if (size < 1 || size > 999) + size = 12; + + if (m_fontSizeSpinButtons->GetValue() != size) + m_fontSizeSpinButtons->SetValue(size); + + wxString newText(wxString::Format(wxT("%d"), size)); + + m_sizeTextCtrl->SetValue(newText); + if (!newText.IsEmpty() && m_sizeListBox->FindString(newText) != wxNOT_FOUND) + m_sizeListBox->SetStringSelection(newText); + UpdatePreview(); + + m_dontUpdate = false; } /*! diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index 9a3af28a2e..03995ef9f2 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -535,7 +535,10 @@ bool wxRichTextPlainText::ExportXML(wxOutputStream& stream, int indent, wxRichTe #else int c = (int) wxUChar(text[i]); #endif - if ((c < 32 || c == 34) && /* c != 9 && */ c != 10 && c != 13) + if (((c < 32 || c == 34) && /* c != 9 && */ c != 10 && c != 13) + // XML ranges + || (!(c >= 32 && c <= 55295) && !(c >= 57344 && c <= 65533)) + ) { if (i > 0) {