From 4f24610ee9f8a67dc3bf15e2e2a16adce9153509 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sat, 12 Oct 2013 06:15:07 +0000 Subject: [PATCH] Fixed image insertion in the wxRTC sample git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/richtext/richtext.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/richtext/richtext.cpp b/samples/richtext/richtext.cpp index dd5bd73d14..3609e3c3fc 100644 --- a/samples/richtext/richtext.cpp +++ b/samples/richtext/richtext.cpp @@ -2060,11 +2060,13 @@ void MyFrame::OnInsertURL(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnInsertImage(wxCommandEvent& WXUNUSED(event)) { - wxFileDialog dialog(this, _("Choose an image"), "", "", "BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|PNG files (*.png)|*.png"); + wxFileDialog dialog(this, _("Choose an image"), "", "", "BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|PNG files (*.png)|*.png|JPEG files (*.jpg;*.jpeg)|*.jpg;*.jpeg"); if (dialog.ShowModal() == wxID_OK) { wxString path = dialog.GetPath(); - m_richTextCtrl->WriteImage(path, wxBITMAP_TYPE_ANY); + wxImage image; + if (image.LoadFile(path) && image.GetType() != wxBITMAP_TYPE_INVALID) + m_richTextCtrl->WriteImage(path, image.GetType()); } }