]> git.saurik.com Git - wxWidgets.git/blob - src/richtext/richtextimagedlg.cpp
ac2b023c447f35f4cd75fa417e4d73b9474b41f5
[wxWidgets.git] / src / richtext / richtextimagedlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextimagedlg.cpp
3 // Purpose:
4 // Author: Mingquan Yang
5 // Modified by:
6 // Created: Wed 02 Jun 2010 11:27:23 CST
7 // RCS-ID:
8 // Copyright: (c) Mingquan Yang
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #ifndef WX_PRECOMP
20 #include "wx/button.h"
21 #include "wx/combobox.h"
22 #include "wx/textctrl.h"
23 #endif
24
25 #include "wx/statline.h"
26
27 #include "wx/richtext/richtextimagedlg.h"
28 #include "wx/richtext/richtextctrl.h"
29
30 ////@begin XPM images
31 ////@end XPM images
32
33
34 /*!
35 * wxRichTextImageDialog type definition
36 */
37
38 IMPLEMENT_DYNAMIC_CLASS( wxRichTextImageDialog, wxDialog )
39
40
41 /*!
42 * wxRichTextImageDialog event table definition
43 */
44
45 BEGIN_EVENT_TABLE( wxRichTextImageDialog, wxDialog )
46
47 ////@begin wxRichTextImageDialog event table entries
48 EVT_BUTTON( ID_RICHTEXTIMAGEDIALOG_PARA_UP, wxRichTextImageDialog::OnRichtextimagedialogParaUpClick )
49
50 EVT_BUTTON( ID_RICHTEXTIMAGEDIALOG_DOWN, wxRichTextImageDialog::OnRichtextimagedialogDownClick )
51
52 ////@end wxRichTextImageDialog event table entries
53
54 END_EVENT_TABLE()
55
56
57 /*!
58 * wxRichTextImageDialog constructors
59 */
60
61 wxRichTextImageDialog::wxRichTextImageDialog()
62 {
63 Init();
64 }
65
66 wxRichTextImageDialog::wxRichTextImageDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
67 {
68 Init();
69 Create(parent, id, caption, pos, size, style);
70 }
71
72
73 /*!
74 * wxRichTextImageDlg creator
75 */
76
77 bool wxRichTextImageDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
78 {
79 ////@begin wxRichTextImageDialog creation
80 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
81 wxDialog::Create( parent, id, caption, pos, size, style );
82
83 CreateControls();
84 if (GetSizer())
85 {
86 GetSizer()->SetSizeHints(this);
87 }
88 Centre();
89 ////@end wxRichTextImageDialog creation
90 return true;
91 }
92
93
94 /*!
95 * wxRichTextImageDialog destructor
96 */
97
98 wxRichTextImageDialog::~wxRichTextImageDialog()
99 {
100 ////@begin wxRichTextImageDialog destruction
101 ////@end wxRichTextImageDialog destruction
102 }
103
104
105 /*!
106 * Member initialisation
107 */
108
109 void wxRichTextImageDialog::Init()
110 {
111 ////@begin wxRichTextImageDialog member initialisation
112 m_alignment = NULL;
113 m_float = NULL;
114 m_width = NULL;
115 m_unitsW = NULL;
116 m_height = NULL;
117 m_unitsH = NULL;
118 m_offset = NULL;
119 m_unitsOffset = NULL;
120 m_saveButton = NULL;
121 m_cancelButton = NULL;
122 ////@end wxRichTextImageDialog member initialisation
123 }
124
125
126 /*!
127 * Control creation for wxRichTextImageDlg
128 */
129
130 void wxRichTextImageDialog::CreateControls()
131 {
132 #ifdef __WXMAC__
133 SetWindowVariant(wxWINDOW_VARIANT_SMALL);
134 #endif
135
136 ////@begin wxRichTextImageDialog content construction
137 wxRichTextImageDialog* itemDialog1 = this;
138
139 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
140 itemDialog1->SetSizer(itemBoxSizer2);
141
142 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
143 itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
144
145 wxFlexGridSizer* itemFlexGridSizer4 = new wxFlexGridSizer(0, 2, 0, 0);
146 itemBoxSizer3->Add(itemFlexGridSizer4, 0, wxALIGN_TOP|wxRIGHT, 5);
147
148 wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
149 itemStaticText5->Show(false);
150 itemFlexGridSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
151
152 wxArrayString m_alignmentStrings;
153 m_alignmentStrings.Add(_("Left"));
154 m_alignmentStrings.Add(_("Centre"));
155 m_alignmentStrings.Add(_("Right"));
156 m_alignment = new wxComboBox( itemDialog1, ID_COMBOBOX_ALIGN, _("Left"), wxDefaultPosition, wxSize(80, -1), m_alignmentStrings, wxCB_READONLY );
157 m_alignment->SetStringSelection(_("Left"));
158 m_alignment->Show(false);
159 itemFlexGridSizer4->Add(m_alignment, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
160
161 wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Floating mode:"), wxDefaultPosition, wxDefaultSize, 0 );
162 itemFlexGridSizer4->Add(itemStaticText7, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
163
164 wxArrayString m_floatStrings;
165 m_floatStrings.Add(_("None"));
166 m_floatStrings.Add(_("Left"));
167 m_floatStrings.Add(_("Right"));
168 m_float = new wxComboBox( itemDialog1, ID_RICHTEXTIMAGEDIALOG_FLOATING_MODE, _("None"), wxDefaultPosition, wxSize(80, -1), m_floatStrings, wxCB_READONLY );
169 m_float->SetStringSelection(_("None"));
170 m_float->SetHelpText(_("How the image will float relative to the text."));
171 if (wxRichTextImageDialog::ShowToolTips())
172 m_float->SetToolTip(_("How the image will float relative to the text."));
173 itemFlexGridSizer4->Add(m_float, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
174
175 wxStaticText* itemStaticText9 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Width:"), wxDefaultPosition, wxDefaultSize, 0 );
176 itemFlexGridSizer4->Add(itemStaticText9, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
177
178 wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxHORIZONTAL);
179 itemFlexGridSizer4->Add(itemBoxSizer10, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
180
181 m_width = new wxTextCtrl( itemDialog1, ID_RICHTEXTIMAGEDIALOG_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
182 m_width->SetHelpText(_("The image width to be shown - does not change the source image width."));
183 if (wxRichTextImageDialog::ShowToolTips())
184 m_width->SetToolTip(_("The image width to be shown - does not change the source image width."));
185 itemBoxSizer10->Add(m_width, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
186
187 wxArrayString m_unitsWStrings;
188 m_unitsWStrings.Add(_("px"));
189 m_unitsWStrings.Add(_("cm"));
190 m_unitsW = new wxComboBox( itemDialog1, ID_RICHTEXTIMAGEDIALOG_UNITS_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsWStrings, wxCB_READONLY );
191 m_unitsW->SetStringSelection(_("px"));
192 m_unitsW->SetHelpText(_("Units for the image width."));
193 if (wxRichTextImageDialog::ShowToolTips())
194 m_unitsW->SetToolTip(_("Units for the image width."));
195 itemBoxSizer10->Add(m_unitsW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
196
197 wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Height:"), wxDefaultPosition, wxDefaultSize, 0 );
198 itemFlexGridSizer4->Add(itemStaticText13, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
199
200 wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxHORIZONTAL);
201 itemFlexGridSizer4->Add(itemBoxSizer14, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
202
203 m_height = new wxTextCtrl( itemDialog1, ID_RICHTEXTIMAGEDIALOG_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
204 m_height->SetHelpText(_("The image height to be shown - does not change the source image height."));
205 if (wxRichTextImageDialog::ShowToolTips())
206 m_height->SetToolTip(_("The image height to be shown - does not change the source image height."));
207 itemBoxSizer14->Add(m_height, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
208
209 wxArrayString m_unitsHStrings;
210 m_unitsHStrings.Add(_("px"));
211 m_unitsHStrings.Add(_("cm"));
212 m_unitsH = new wxComboBox( itemDialog1, ID_RICHTEXTIMAGEDIALOG_UNITS_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsHStrings, wxCB_READONLY );
213 m_unitsH->SetStringSelection(_("px"));
214 m_unitsH->SetHelpText(_("Units for the image height."));
215 if (wxRichTextImageDialog::ShowToolTips())
216 m_unitsH->SetToolTip(_("Units for the image height."));
217 itemBoxSizer14->Add(m_unitsH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
218
219 wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Image Vertical &Offset:"), wxDefaultPosition, wxDefaultSize, 0 );
220 itemFlexGridSizer4->Add(itemStaticText17, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
221
222 wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL);
223 itemFlexGridSizer4->Add(itemBoxSizer18, 1, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
224
225 m_offset = new wxTextCtrl( itemDialog1, ID_RICHTEXTIMAGEDIALOG_OFFSET, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
226 m_offset->SetMaxLength(10);
227 m_offset->SetHelpText(_("The vertical offset relative to the paragraph."));
228 if (wxRichTextImageDialog::ShowToolTips())
229 m_offset->SetToolTip(_("The vertical offset relative to the paragraph."));
230 itemBoxSizer18->Add(m_offset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
231
232 wxArrayString m_unitsOffsetStrings;
233 m_unitsOffsetStrings.Add(_("px"));
234 m_unitsOffsetStrings.Add(_("cm"));
235 m_unitsOffset = new wxComboBox( itemDialog1, ID_RICHTEXTIMAGEDIALOG_OFFSET_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsOffsetStrings, wxCB_READONLY );
236 m_unitsOffset->SetStringSelection(_("px"));
237 m_unitsOffset->SetHelpText(_("Units for the image offset."));
238 if (wxRichTextImageDialog::ShowToolTips())
239 m_unitsOffset->SetToolTip(_("Units for the image offset."));
240 itemBoxSizer18->Add(m_unitsOffset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
241
242 wxStaticText* itemStaticText21 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Move the image to:"), wxDefaultPosition, wxDefaultSize, 0 );
243 itemFlexGridSizer4->Add(itemStaticText21, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
244
245 wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL);
246 itemFlexGridSizer4->Add(itemBoxSizer22, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
247
248 wxButton* itemButton23 = new wxButton( itemDialog1, ID_RICHTEXTIMAGEDIALOG_PARA_UP, _("&Previous Paragraph"), wxDefaultPosition, wxDefaultSize, 0 );
249 itemButton23->SetHelpText(_("Moves the image to the previous paragraph."));
250 if (wxRichTextImageDialog::ShowToolTips())
251 itemButton23->SetToolTip(_("Moves the image to the previous paragraph."));
252 itemBoxSizer22->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
253
254 wxButton* itemButton24 = new wxButton( itemDialog1, ID_RICHTEXTIMAGEDIALOG_DOWN, _("&Next Paragraph"), wxDefaultPosition, wxDefaultSize, 0 );
255 itemButton24->SetHelpText(_("Moves the image to the next paragraph."));
256 if (wxRichTextImageDialog::ShowToolTips())
257 itemButton24->SetToolTip(_("Moves the image to the next paragraph."));
258 itemBoxSizer22->Add(itemButton24, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
259
260 wxStaticLine* itemStaticLine25 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
261 itemBoxSizer2->Add(itemStaticLine25, 0, wxGROW|wxALL, 5);
262
263 wxStdDialogButtonSizer* itemStdDialogButtonSizer26 = new wxStdDialogButtonSizer;
264
265 itemBoxSizer2->Add(itemStdDialogButtonSizer26, 0, wxGROW|wxALL, 5);
266 m_saveButton = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
267 m_saveButton->SetHelpText(_("Click to confirm your changes."));
268 if (wxRichTextImageDialog::ShowToolTips())
269 m_saveButton->SetToolTip(_("Click to confirm your changes."));
270 itemStdDialogButtonSizer26->AddButton(m_saveButton);
271
272 m_cancelButton = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
273 m_cancelButton->SetHelpText(_("Click to discard your changes."));
274 if (wxRichTextImageDialog::ShowToolTips())
275 m_cancelButton->SetToolTip(_("Click to discard your changes."));
276 itemStdDialogButtonSizer26->AddButton(m_cancelButton);
277
278 itemStdDialogButtonSizer26->Realize();
279
280 ////@end wxRichTextImageDialog content construction
281 }
282
283
284 /*!
285 * Should we show tooltips?
286 */
287
288 bool wxRichTextImageDialog::ShowToolTips()
289 {
290 return true;
291 }
292
293 /*!
294 * Get bitmap resources
295 */
296
297 wxBitmap wxRichTextImageDialog::GetBitmapResource( const wxString& name )
298 {
299 // Bitmap retrieval
300 ////@begin wxRichTextImageDialog bitmap retrieval
301 wxUnusedVar(name);
302 return wxNullBitmap;
303 ////@end wxRichTextImageDialog bitmap retrieval
304 }
305
306 /*!
307 * Get icon resources
308 */
309
310 wxIcon wxRichTextImageDialog::GetIconResource( const wxString& name )
311 {
312 // Icon retrieval
313 ////@begin wxRichTextImageDialog icon retrieval
314 wxUnusedVar(name);
315 return wxNullIcon;
316 ////@end wxRichTextImageDialog icon retrieval
317 }
318
319 /*!
320 * Set the image attribute
321 */
322 void wxRichTextImageDialog::SetImageAttr(const wxRichTextAnchoredObjectAttr& attr)
323 {
324 m_attr = attr;
325 TransferDataToWindow();
326 }
327
328 /*!
329 * Apply the new style
330 */
331 wxRichTextImage* wxRichTextImageDialog::ApplyImageAttr()
332 {
333 wxRichTextImage* image = wxDynamicCast(m_image, wxRichTextImage);
334
335 TransferDataFromWindow();
336 if (m_buffer->GetRichTextCtrl())
337 {
338 m_buffer->GetRichTextCtrl()->SetImageStyle(image, m_attr);
339 }
340 return image;
341 }
342
343 void wxRichTextImageDialog::SetImageObject(wxRichTextImage* image, wxRichTextBuffer* buffer)
344 {
345 wxRichTextObject* parent = image->GetParent();
346
347 m_buffer = buffer;
348 m_image = image;
349 m_parent = parent;
350 SetImageAttr(image->GetAnchoredAttr());
351 if (image->GetImageCache().IsOk())
352 {
353 if (m_attr.m_width == -1)
354 {
355 m_attr.m_width = image->GetImageCache().GetWidth();
356 wxASSERT(m_attr.m_unitsW == wxRICHTEXT_PX);
357
358 m_attr.m_unitsW = wxRICHTEXT_PX;
359 }
360 if (m_attr.m_height == -1)
361 {
362 m_attr.m_height = image->GetImageCache().GetHeight();
363 wxASSERT(m_attr.m_unitsH == wxRICHTEXT_PX);
364
365 m_attr.m_unitsH = wxRICHTEXT_PX;
366 }
367 }
368 }
369
370 bool wxRichTextImageDialog::TransferDataToWindow()
371 {
372 int remain = 100;
373
374 m_alignment->SetSelection(m_attr.m_align);
375 m_float->SetSelection(m_attr.m_floating);
376
377 // Update scale
378 m_unitsW->SetSelection(m_attr.m_unitsW);
379 m_unitsH->SetSelection(m_attr.m_unitsH);
380 m_unitsOffset->SetSelection(m_attr.m_unitsOffset);
381
382 // Update metric
383 m_width->Clear();
384 if (m_attr.m_unitsW == wxRICHTEXT_MM)
385 {
386 int remainder = m_attr.m_width % remain;
387 *m_width << m_attr.m_width / remain;
388 if (remainder)
389 {
390 *m_width << '.' << remainder;
391 }
392 }
393 else
394 {
395 *m_width << m_attr.m_width;
396 }
397
398 m_height->Clear();
399 if (m_attr.m_unitsH == wxRICHTEXT_MM)
400 {
401 int remainder = m_attr.m_height % remain;
402 *m_height << m_attr.m_height / remain;
403 if (remainder)
404 {
405 *m_height << '.' << remainder;
406 }
407 }
408 else
409 {
410 *m_height << m_attr.m_height;
411 }
412
413 m_offset->Clear();
414 if (m_attr.m_unitsOffset == wxRICHTEXT_MM)
415 {
416 int remainder = m_attr.m_offset % remain;
417 *m_offset << m_attr.m_offset / remain;
418 if (remainder)
419 {
420 *m_offset << '.' << remainder;
421 }
422 }
423 else
424 {
425 *m_offset << m_attr.m_offset;
426 }
427
428 return true;
429 }
430
431 bool wxRichTextImageDialog::TransferDataFromWindow()
432 {
433 wxString width = m_width->GetValue();
434 wxString height = m_height->GetValue();
435 wxString offset = m_offset->GetValue();
436 int w, h, o;
437
438 m_attr.m_align = m_alignment->GetSelection();
439 m_attr.m_floating = m_float->GetSelection();
440
441 m_attr.m_unitsW = m_unitsW->GetSelection();
442 m_attr.m_unitsH = m_unitsH->GetSelection();
443 m_attr.m_unitsOffset = m_unitsOffset->GetSelection();
444
445 if (ConvertFromString(width, w, m_attr.m_unitsW))
446 m_attr.m_width = w;
447 if (ConvertFromString(height, h, m_attr.m_unitsH))
448 m_attr.m_height = h;
449 if (ConvertFromString(offset, o, m_attr.m_unitsOffset))
450 m_attr.m_offset = o;
451
452 return true;
453 }
454
455 bool wxRichTextImageDialog::ConvertFromString(const wxString& string, int& ret, int scale)
456 {
457 const wxChar* chars = string.GetData();
458 int remain = 2;
459 bool dot = false;
460 ret = 0;
461
462 for (unsigned int i = 0; i < string.Len() && remain; i++)
463 {
464 if (!(chars[i] >= '0' && chars[i] <= '9') && !(scale == wxRICHTEXT_MM && chars[i] == '.'))
465 return false;
466
467 if (chars[i] == '.')
468 {
469 dot = true;
470 continue;
471 }
472
473 if (dot)
474 remain--;
475
476 ret = ret * 10 + chars[i] - '0';
477 }
478
479 while (remain-- > 0 && scale == wxRICHTEXT_MM)
480 ret *= 10;
481
482 return true;
483 }
484
485
486 /*!
487 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_PARA_UP
488 */
489 void wxRichTextImageDialog::OnRichtextimagedialogParaUpClick( wxCommandEvent& WXUNUSED(event))
490 {
491 // Before editing this code, remove the block markers.
492 wxRichTextRange range = m_image->GetRange();
493 wxRichTextObjectList::compatibility_iterator iter = m_buffer->GetChildren().GetFirst();
494 if (iter == NULL)
495 return;
496
497 while (iter)
498 {
499 if (iter->GetData() == m_parent)
500 break;
501 iter = iter->GetNext();
502 }
503
504 iter = iter->GetPrevious();
505 if (iter == NULL)
506 return;
507
508 wxRichTextObject *obj = iter->GetData();
509 wxRichTextRange rg = obj->GetRange();
510 m_image = m_image->Clone();
511
512 m_buffer->DeleteRangeWithUndo(range, m_buffer->GetRichTextCtrl());
513 m_buffer->InsertObjectWithUndo(rg.GetEnd(), m_image, m_buffer->GetRichTextCtrl(), 0);
514 m_parent = obj;
515 m_image->SetRange(wxRichTextRange(rg.GetEnd(), rg.GetEnd()));
516 }
517
518
519 /*!
520 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_PARA_DOWN
521 */
522
523 void wxRichTextImageDialog::OnRichtextimagedialogDownClick( wxCommandEvent& WXUNUSED(event))
524 {
525 // Before editing this code, remove the block markers.
526 wxRichTextRange range = m_image->GetRange();
527 wxRichTextObjectList::compatibility_iterator iter = m_buffer->GetChildren().GetFirst();
528 if (iter == NULL)
529 return;
530
531 while (iter)
532 {
533 if (iter->GetData() == m_parent)
534 break;
535 iter = iter->GetNext();
536 }
537
538 iter = iter->GetNext();
539 if (iter == NULL)
540 return;
541
542 wxRichTextObject *obj = iter->GetData();
543 wxRichTextRange rg = obj->GetRange();
544 m_image = m_image->Clone();
545
546 m_buffer->DeleteRangeWithUndo(range, m_buffer->GetRichTextCtrl());
547 m_buffer->InsertObjectWithUndo(rg.GetEnd(), m_image, m_buffer->GetRichTextCtrl(), 0);
548 m_parent = obj;
549 m_image->SetRange(wxRichTextRange(rg.GetEnd(), rg.GetEnd()));
550 }
551