Corrected wxRTC font dialog spin button behaviour
This commit is contained in:
		| @@ -2075,7 +2075,7 @@ public: | |||||||
|         list (ok, newPos). |         list (ok, newPos). | ||||||
|         @endWxPerlOnly |         @endWxPerlOnly | ||||||
|     */ |     */ | ||||||
|     bool DeleteSelectedContent(long* newPos= NULL); |     virtual bool DeleteSelectedContent(long* newPos= NULL); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|         Transforms logical (unscrolled) position to physical window position. |         Transforms logical (unscrolled) position to physical window position. | ||||||
|   | |||||||
| @@ -2021,7 +2021,7 @@ public: | |||||||
|         list (ok, newPos). |         list (ok, newPos). | ||||||
|         @endWxPerlOnly |         @endWxPerlOnly | ||||||
|     */ |     */ | ||||||
|     bool DeleteSelectedContent(long* newPos= NULL); |     virtual bool DeleteSelectedContent(long* newPos= NULL); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|         Transforms logical (unscrolled) position to physical window position. |         Transforms logical (unscrolled) position to physical window position. | ||||||
|   | |||||||
| @@ -334,6 +334,8 @@ void wxRichTextFontPage::CreateControls() | |||||||
|  |  | ||||||
| ////@end wxRichTextFontPage content construction | ////@end wxRichTextFontPage content construction | ||||||
|  |  | ||||||
|  |     m_fontSizeSpinButtons->SetRange(0, 999); | ||||||
|  |  | ||||||
|     if ((GetAllowedTextEffects() & wxTEXT_ATTR_EFFECT_RTL) == 0) |     if ((GetAllowedTextEffects() & wxTEXT_ATTR_EFFECT_RTL) == 0) | ||||||
|         m_rtlParentSizer->Show(m_rtlCtrl, false); |         m_rtlParentSizer->Show(m_rtlCtrl, false); | ||||||
|     if ((GetAllowedTextEffects() & wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION) == 0) |     if ((GetAllowedTextEffects() & wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION) == 0) | ||||||
| @@ -579,6 +581,7 @@ bool wxRichTextFontPage::TransferDataToWindow() | |||||||
|     { |     { | ||||||
|         wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize()); |         wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize()); | ||||||
|         m_sizeTextCtrl->SetValue(strSize); |         m_sizeTextCtrl->SetValue(strSize); | ||||||
|  |         m_fontSizeSpinButtons->SetValue(attr->GetFontSize()); | ||||||
|         m_sizeUnitsCtrl->SetSelection(0); |         m_sizeUnitsCtrl->SetSelection(0); | ||||||
|         if (m_sizeListBox->FindString(strSize) != wxNOT_FOUND) |         if (m_sizeListBox->FindString(strSize) != wxNOT_FOUND) | ||||||
|             m_sizeListBox->SetStringSelection(strSize); |             m_sizeListBox->SetStringSelection(strSize); | ||||||
| @@ -587,6 +590,7 @@ bool wxRichTextFontPage::TransferDataToWindow() | |||||||
|     { |     { | ||||||
|         wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize()); |         wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize()); | ||||||
|         m_sizeTextCtrl->SetValue(strSize); |         m_sizeTextCtrl->SetValue(strSize); | ||||||
|  |         m_fontSizeSpinButtons->SetValue(attr->GetFontSize()); | ||||||
|         m_sizeUnitsCtrl->SetSelection(1); |         m_sizeUnitsCtrl->SetSelection(1); | ||||||
|         m_sizeListBox->SetSelection(wxNOT_FOUND); |         m_sizeListBox->SetSelection(wxNOT_FOUND); | ||||||
|     } |     } | ||||||
| @@ -950,9 +954,16 @@ void wxRichTextFontPage::OnSizeTextCtrlUpdated( wxCommandEvent& WXUNUSED(event) | |||||||
|     if (m_dontUpdate) |     if (m_dontUpdate) | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
|  |     m_dontUpdate = true; | ||||||
|  |  | ||||||
|     wxString strSize = m_sizeTextCtrl->GetValue(); |     wxString strSize = m_sizeTextCtrl->GetValue(); | ||||||
|     if (!strSize.IsEmpty() && m_sizeListBox->FindString(strSize) != wxNOT_FOUND) |     if (!strSize.IsEmpty() && m_sizeListBox->FindString(strSize) != wxNOT_FOUND) | ||||||
|         m_sizeListBox->SetStringSelection(strSize); |         m_sizeListBox->SetStringSelection(strSize); | ||||||
|  |     if (!strSize.IsEmpty()) | ||||||
|  |         m_fontSizeSpinButtons->SetValue(wxAtoi(strSize)); | ||||||
|  |  | ||||||
|  |     m_dontUpdate = false; | ||||||
|  |  | ||||||
|     UpdatePreview(); |     UpdatePreview(); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -967,6 +978,8 @@ void wxRichTextFontPage::OnSizeListBoxSelected( wxCommandEvent& event ) | |||||||
|     m_dontUpdate = true; |     m_dontUpdate = true; | ||||||
|  |  | ||||||
|     m_sizeTextCtrl->SetValue(event.GetString()); |     m_sizeTextCtrl->SetValue(event.GetString()); | ||||||
|  |     if (!event.GetString().IsEmpty()) | ||||||
|  |         m_fontSizeSpinButtons->SetValue(wxAtoi(event.GetString())); | ||||||
|  |  | ||||||
|     m_dontUpdate = oldDontUpdate; |     m_dontUpdate = oldDontUpdate; | ||||||
|  |  | ||||||
| @@ -1127,17 +1140,33 @@ void wxRichTextFontPage::OnRichtextfontpageSizeUnitsSelected( wxCommandEvent& WX | |||||||
|  |  | ||||||
| void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& WXUNUSED(event) ) | void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& WXUNUSED(event) ) | ||||||
| { | { | ||||||
|  |     if (m_dontUpdate) | ||||||
|  |         return; | ||||||
|  |  | ||||||
|  |     m_dontUpdate = true; | ||||||
|  |  | ||||||
|     wxString text = m_sizeTextCtrl->GetValue(); |     wxString text = m_sizeTextCtrl->GetValue(); | ||||||
|  |     int size = 12; | ||||||
|     if (!text.IsEmpty()) |     if (!text.IsEmpty()) | ||||||
|     { |     { | ||||||
|         int size = wxAtoi(text); |         size = wxAtoi(text); | ||||||
|         if (size > 0) |  | ||||||
|         { |  | ||||||
|         size ++; |         size ++; | ||||||
|             m_sizeTextCtrl->SetValue(wxString::Format(wxT("%d"), 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(); |     UpdatePreview(); | ||||||
|         } |  | ||||||
|     } |     m_dontUpdate = false; | ||||||
| } | } | ||||||
|  |  | ||||||
| /*! | /*! | ||||||
| @@ -1146,17 +1175,34 @@ void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& WXUNUSED( | |||||||
|  |  | ||||||
| void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsDown( wxSpinEvent& WXUNUSED(event) ) | void wxRichTextFontPage::OnRichtextfontpageSpinbuttonsDown( wxSpinEvent& WXUNUSED(event) ) | ||||||
| { | { | ||||||
|  |     if (m_dontUpdate) | ||||||
|  |         return; | ||||||
|  |  | ||||||
|  |     m_dontUpdate = true; | ||||||
|  |  | ||||||
|     wxString text = m_sizeTextCtrl->GetValue(); |     wxString text = m_sizeTextCtrl->GetValue(); | ||||||
|  |     int size = 12; | ||||||
|     if (!text.IsEmpty()) |     if (!text.IsEmpty()) | ||||||
|     { |     { | ||||||
|         int size = wxAtoi(text); |         size = wxAtoi(text); | ||||||
|         if (size > 0) |         if (size > 1) | ||||||
|         { |  | ||||||
|             size --; |             size --; | ||||||
|             m_sizeTextCtrl->SetValue(wxString::Format(wxT("%d"), 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(); |     UpdatePreview(); | ||||||
|         } |  | ||||||
|     } |     m_dontUpdate = false; | ||||||
| } | } | ||||||
|  |  | ||||||
| /*! | /*! | ||||||
|   | |||||||
| @@ -535,7 +535,10 @@ bool wxRichTextPlainText::ExportXML(wxOutputStream& stream, int indent, wxRichTe | |||||||
| #else | #else | ||||||
|         int c = (int) wxUChar(text[i]); |         int c = (int) wxUChar(text[i]); | ||||||
| #endif | #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) |             if (i > 0) | ||||||
|             { |             { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user