]> git.saurik.com Git - wxWidgets.git/blob - src/richtext/richtextbulletspage.cpp
Allow absent checkbox when transferring dimension data
[wxWidgets.git] / src / richtext / richtextbulletspage.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextbulletspage.cpp
3 // Purpose:
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 10/4/2006 10:32:31 AM
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #if wxUSE_RICHTEXT
12
13 #include "wx/spinctrl.h"
14 #include "wx/utils.h"
15 #include "wx/richtext/richtextbulletspage.h"
16 #include "wx/richtext/richtextsymboldlg.h"
17
18 /*!
19 * wxRichTextBulletsPage type definition
20 */
21
22 IMPLEMENT_DYNAMIC_CLASS( wxRichTextBulletsPage, wxRichTextDialogPage )
23
24 /*!
25 * wxRichTextBulletsPage event table definition
26 */
27
28 BEGIN_EVENT_TABLE( wxRichTextBulletsPage, wxRichTextDialogPage )
29
30 ////@begin wxRichTextBulletsPage event table entries
31 EVT_LISTBOX( ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxRichTextBulletsPage::OnStylelistboxSelected )
32
33 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PERIODCTRL, wxRichTextBulletsPage::OnPeriodctrlClick )
34 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PERIODCTRL, wxRichTextBulletsPage::OnPeriodctrlUpdate )
35
36 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, wxRichTextBulletsPage::OnParenthesesctrlClick )
37 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, wxRichTextBulletsPage::OnParenthesesctrlUpdate )
38
39 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, wxRichTextBulletsPage::OnRightParenthesisCtrlClick )
40 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, wxRichTextBulletsPage::OnRightParenthesisCtrlUpdate )
41
42 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL, wxRichTextBulletsPage::OnBulletAlignmentCtrlSelected )
43
44 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, wxRichTextBulletsPage::OnSymbolstaticUpdate )
45
46 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlSelected )
47 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlUpdated )
48 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlUpdate )
49
50 EVT_BUTTON( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextBulletsPage::OnChooseSymbolClick )
51 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextBulletsPage::OnChooseSymbolUpdate )
52
53 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlSelected )
54 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlUpdated )
55 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate )
56
57 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NAMESTATIC, wxRichTextBulletsPage::OnNamestaticUpdate )
58
59 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlSelected )
60 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlUpdated )
61 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlUIUpdate )
62
63 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, wxRichTextBulletsPage::OnNumberstaticUpdate )
64
65 EVT_SPINCTRL( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUpdated )
66 EVT_SPIN_UP( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUp )
67 EVT_SPIN_DOWN( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlDown )
68 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlTextUpdated )
69 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUpdate )
70
71 ////@end wxRichTextBulletsPage event table entries
72
73 END_EVENT_TABLE()
74
75 IMPLEMENT_HELP_PROVISION(wxRichTextBulletsPage)
76
77 /*!
78 * wxRichTextBulletsPage constructors
79 */
80
81 wxRichTextBulletsPage::wxRichTextBulletsPage( )
82 {
83 Init();
84 }
85
86 wxRichTextBulletsPage::wxRichTextBulletsPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
87 {
88 Init();
89 Create(parent, id, pos, size, style);
90 }
91
92 /*!
93 * Initialise members
94 */
95
96 void wxRichTextBulletsPage::Init()
97 {
98 m_hasBulletStyle = false;
99 m_hasBulletNumber = false;
100 m_hasBulletSymbol = false;
101 m_dontUpdate = false;
102
103 ////@begin wxRichTextBulletsPage member initialisation
104 m_styleListBox = NULL;
105 m_periodCtrl = NULL;
106 m_parenthesesCtrl = NULL;
107 m_rightParenthesisCtrl = NULL;
108 m_bulletAlignmentCtrl = NULL;
109 m_symbolCtrl = NULL;
110 m_symbolFontCtrl = NULL;
111 m_bulletNameCtrl = NULL;
112 m_numberCtrl = NULL;
113 m_previewCtrl = NULL;
114 ////@end wxRichTextBulletsPage member initialisation
115 }
116
117 /*!
118 * wxRichTextBulletsPage creator
119 */
120
121 bool wxRichTextBulletsPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
122 {
123 ////@begin wxRichTextBulletsPage creation
124 wxRichTextDialogPage::Create( parent, id, pos, size, style );
125
126 CreateControls();
127 if (GetSizer())
128 {
129 GetSizer()->SetSizeHints(this);
130 }
131 Centre();
132 ////@end wxRichTextBulletsPage creation
133 return true;
134 }
135
136 /*!
137 * Control creation for wxRichTextBulletsPage
138 */
139
140 void wxRichTextBulletsPage::CreateControls()
141 {
142 m_dontUpdate = true;
143
144 ////@begin wxRichTextBulletsPage content construction
145 wxRichTextBulletsPage* itemRichTextDialogPage1 = this;
146
147 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
148 itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
149
150 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
151 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
152
153 wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
154 itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW, 5);
155
156 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
157 itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW, 5);
158
159 wxStaticText* itemStaticText6 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Bullet style:"), wxDefaultPosition, wxDefaultSize, 0 );
160 itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
161
162 wxArrayString m_styleListBoxStrings;
163 m_styleListBox = new wxListBox( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxDefaultPosition, wxSize(-1, 90), m_styleListBoxStrings, wxLB_SINGLE );
164 m_styleListBox->SetHelpText(_("The available bullet styles."));
165 if (wxRichTextBulletsPage::ShowToolTips())
166 m_styleListBox->SetToolTip(_("The available bullet styles."));
167 itemBoxSizer5->Add(m_styleListBox, 1, wxGROW|wxALL, 5);
168
169 wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
170 itemBoxSizer5->Add(itemBoxSizer8, 0, wxGROW, 5);
171
172 m_periodCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_PERIODCTRL, _("Peri&od"), wxDefaultPosition, wxDefaultSize, 0 );
173 m_periodCtrl->SetValue(false);
174 m_periodCtrl->SetHelpText(_("Check to add a period after the bullet."));
175 if (wxRichTextBulletsPage::ShowToolTips())
176 m_periodCtrl->SetToolTip(_("Check to add a period after the bullet."));
177 itemBoxSizer8->Add(m_periodCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
178
179 m_parenthesesCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, _("(*)"), wxDefaultPosition, wxDefaultSize, 0 );
180 m_parenthesesCtrl->SetValue(false);
181 m_parenthesesCtrl->SetHelpText(_("Check to enclose the bullet in parentheses."));
182 if (wxRichTextBulletsPage::ShowToolTips())
183 m_parenthesesCtrl->SetToolTip(_("Check to enclose the bullet in parentheses."));
184 itemBoxSizer8->Add(m_parenthesesCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
185
186 m_rightParenthesisCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, _("*)"), wxDefaultPosition, wxDefaultSize, 0 );
187 m_rightParenthesisCtrl->SetValue(false);
188 m_rightParenthesisCtrl->SetHelpText(_("Check to add a right parenthesis."));
189 if (wxRichTextBulletsPage::ShowToolTips())
190 m_rightParenthesisCtrl->SetToolTip(_("Check to add a right parenthesis."));
191 itemBoxSizer8->Add(m_rightParenthesisCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
192
193 itemBoxSizer5->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
194
195 wxStaticText* itemStaticText13 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Bullet &Alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
196 itemBoxSizer5->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
197
198 wxArrayString m_bulletAlignmentCtrlStrings;
199 m_bulletAlignmentCtrlStrings.Add(_("Left"));
200 m_bulletAlignmentCtrlStrings.Add(_("Centre"));
201 m_bulletAlignmentCtrlStrings.Add(_("Right"));
202 m_bulletAlignmentCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL, _("Left"), wxDefaultPosition, wxSize(60, -1), m_bulletAlignmentCtrlStrings, wxCB_READONLY );
203 m_bulletAlignmentCtrl->SetStringSelection(_("Left"));
204 m_bulletAlignmentCtrl->SetHelpText(_("The bullet character."));
205 if (wxRichTextBulletsPage::ShowToolTips())
206 m_bulletAlignmentCtrl->SetToolTip(_("The bullet character."));
207 itemBoxSizer5->Add(m_bulletAlignmentCtrl, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5);
208
209 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
210
211 wxStaticLine* itemStaticLine16 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
212 itemBoxSizer4->Add(itemStaticLine16, 0, wxGROW|wxLEFT|wxRIGHT, 5);
213
214 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
215
216 wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxVERTICAL);
217 itemBoxSizer4->Add(itemBoxSizer18, 0, wxGROW, 5);
218
219 wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxHORIZONTAL);
220 itemBoxSizer18->Add(itemBoxSizer19, 0, wxGROW, 5);
221
222 wxStaticText* itemStaticText20 = new wxStaticText( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, _("&Symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
223 itemBoxSizer19->Add(itemStaticText20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
224
225 wxArrayString m_symbolCtrlStrings;
226 m_symbolCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxEmptyString, wxDefaultPosition, wxSize(60, -1), m_symbolCtrlStrings, wxCB_DROPDOWN );
227 m_symbolCtrl->SetHelpText(_("The bullet character."));
228 if (wxRichTextBulletsPage::ShowToolTips())
229 m_symbolCtrl->SetToolTip(_("The bullet character."));
230 itemBoxSizer19->Add(m_symbolCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
231
232 wxButton* itemButton22 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, _("Ch&oose..."), wxDefaultPosition, wxDefaultSize, 0 );
233 itemButton22->SetHelpText(_("Click to browse for a symbol."));
234 if (wxRichTextBulletsPage::ShowToolTips())
235 itemButton22->SetToolTip(_("Click to browse for a symbol."));
236 itemBoxSizer19->Add(itemButton22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
237
238 itemBoxSizer18->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
239
240 wxStaticText* itemStaticText24 = new wxStaticText( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, _("Symbol &font:"), wxDefaultPosition, wxDefaultSize, 0 );
241 itemBoxSizer18->Add(itemStaticText24, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
242
243 wxArrayString m_symbolFontCtrlStrings;
244 m_symbolFontCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
245 m_symbolFontCtrl->SetHelpText(_("Available fonts."));
246 if (wxRichTextBulletsPage::ShowToolTips())
247 m_symbolFontCtrl->SetToolTip(_("Available fonts."));
248 itemBoxSizer18->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5);
249
250 itemBoxSizer18->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL, 5);
251
252 wxStaticText* itemStaticText27 = new wxStaticText( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_NAMESTATIC, _("S&tandard bullet name:"), wxDefaultPosition, wxDefaultSize, 0 );
253 itemBoxSizer18->Add(itemStaticText27, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
254
255 wxArrayString m_bulletNameCtrlStrings;
256 m_bulletNameCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_bulletNameCtrlStrings, wxCB_DROPDOWN );
257 m_bulletNameCtrl->SetHelpText(_("A standard bullet name."));
258 if (wxRichTextBulletsPage::ShowToolTips())
259 m_bulletNameCtrl->SetToolTip(_("A standard bullet name."));
260 itemBoxSizer18->Add(m_bulletNameCtrl, 0, wxGROW|wxALL, 5);
261
262 itemBoxSizer18->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL, 5);
263
264 wxStaticText* itemStaticText30 = new wxStaticText( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, _("&Number:"), wxDefaultPosition, wxDefaultSize, 0 );
265 itemBoxSizer18->Add(itemStaticText30, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
266
267 m_numberCtrl = new wxSpinCtrl( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxT("0"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 100000, 0 );
268 m_numberCtrl->SetHelpText(_("The list item number."));
269 if (wxRichTextBulletsPage::ShowToolTips())
270 m_numberCtrl->SetToolTip(_("The list item number."));
271 itemBoxSizer18->Add(m_numberCtrl, 0, wxGROW|wxALL, 5);
272
273 itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
274
275 m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 100), wxBORDER_THEME|wxVSCROLL|wxTE_READONLY );
276 m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings."));
277 if (wxRichTextBulletsPage::ShowToolTips())
278 m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings."));
279 itemBoxSizer3->Add(m_previewCtrl, 1, wxGROW|wxALL, 5);
280
281 ////@end wxRichTextBulletsPage content construction
282
283 if (wxGetDisplaySize().y < 600)
284 m_previewCtrl->SetMinSize(wxSize(350, 50));
285
286 m_styleListBox->Append(_("(None)"));
287 m_styleListBox->Append(_("Arabic"));
288 m_styleListBox->Append(_("Upper case letters"));
289 m_styleListBox->Append(_("Lower case letters"));
290 m_styleListBox->Append(_("Upper case roman numerals"));
291 m_styleListBox->Append(_("Lower case roman numerals"));
292 m_styleListBox->Append(_("Numbered outline"));
293 m_styleListBox->Append(_("Symbol"));
294 m_styleListBox->Append(_("Bitmap"));
295 m_styleListBox->Append(_("Standard"));
296
297 m_symbolCtrl->Append(_("*"));
298 m_symbolCtrl->Append(_("-"));
299 m_symbolCtrl->Append(_(">"));
300 m_symbolCtrl->Append(_("+"));
301 m_symbolCtrl->Append(_("~"));
302
303 wxArrayString standardBulletNames;
304 if (wxRichTextBuffer::GetRenderer())
305 wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
306
307 size_t i;
308 for (i = 0; i < standardBulletNames.GetCount(); i++)
309 m_bulletNameCtrl->Append(wxGetTranslation(standardBulletNames[i]));
310
311 wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
312 facenames.Sort();
313
314 m_symbolFontCtrl->Append(facenames);
315
316 m_dontUpdate = false;
317 }
318
319 /// Transfer data from/to window
320 bool wxRichTextBulletsPage::TransferDataFromWindow()
321 {
322 wxPanel::TransferDataFromWindow();
323
324 wxRichTextAttr* attr = GetAttributes();
325
326 int index = m_styleListBox->GetSelection();
327 if (index < 1)
328 {
329 m_hasBulletStyle = false;
330 m_hasBulletNumber = false;
331 m_hasBulletSymbol = false;
332 attr->SetBulletStyle(wxTEXT_ATTR_BULLET_STYLE_NONE);
333 attr->SetFlags(attr->GetFlags() & ~(wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME));
334 }
335 else
336 {
337 m_hasBulletStyle = true;
338 }
339
340 if (m_hasBulletStyle)
341 {
342 long bulletStyle = wxRICHTEXT_BULLETINDEX_NONE;
343
344 if (index == wxRICHTEXT_BULLETINDEX_ARABIC)
345 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ARABIC;
346
347 else if (index == wxRICHTEXT_BULLETINDEX_UPPER_CASE)
348 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER;
349
350 else if (index == wxRICHTEXT_BULLETINDEX_LOWER_CASE)
351 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER;
352
353 else if (index == wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN)
354 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER;
355
356 else if (index == wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN)
357 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER;
358
359 else if (index == wxRICHTEXT_BULLETINDEX_OUTLINE)
360 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_OUTLINE;
361
362 else if (index == wxRICHTEXT_BULLETINDEX_SYMBOL)
363 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_SYMBOL;
364
365 else if (index == wxRICHTEXT_BULLETINDEX_BITMAP)
366 {
367 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_BITMAP;
368 if (m_bulletNameCtrl->GetValue().IsEmpty())
369 attr->SetFlags(attr->GetFlags() & ~wxTEXT_ATTR_BULLET_NAME);
370 else
371 attr->SetBulletName(m_bulletNameCtrl->GetValue());
372 }
373
374 else if (index == wxRICHTEXT_BULLETINDEX_STANDARD)
375 {
376 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_STANDARD;
377 wxArrayString standardBulletNames;
378 if (wxRichTextBuffer::GetRenderer() && m_bulletNameCtrl->GetSelection() != wxNOT_FOUND)
379 {
380 int sel = m_bulletNameCtrl->GetSelection();
381 wxString selName = m_bulletNameCtrl->GetString(sel);
382
383 // Try to get the untranslated name using the current selection index of the combobox.
384 // into account.
385 wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
386 if (sel < (int) standardBulletNames.GetCount() && m_bulletNameCtrl->GetValue() == selName)
387 attr->SetBulletName(standardBulletNames[sel]);
388 else
389 attr->SetBulletName(m_bulletNameCtrl->GetValue());
390 }
391 else
392 attr->SetBulletName(m_bulletNameCtrl->GetValue());
393 }
394
395 if (m_parenthesesCtrl->GetValue())
396 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES;
397 if (m_rightParenthesisCtrl->GetValue())
398 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS;
399 if (m_periodCtrl->GetValue())
400 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PERIOD;
401
402 if (m_bulletAlignmentCtrl->GetSelection() == 1)
403 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE;
404 else if (m_bulletAlignmentCtrl->GetSelection() == 2)
405 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT;
406 // Left is implied
407
408 attr->SetBulletStyle(bulletStyle);
409 }
410
411 if (m_hasBulletNumber)
412 {
413 attr->SetBulletNumber(m_numberCtrl->GetValue());
414 }
415
416 if (m_hasBulletSymbol)
417 {
418 attr->SetBulletText(m_symbolCtrl->GetValue());
419 attr->SetBulletFont(m_symbolFontCtrl->GetValue());
420 }
421
422 return true;
423 }
424
425 bool wxRichTextBulletsPage::TransferDataToWindow()
426 {
427 m_dontUpdate = true;
428
429 wxPanel::TransferDataToWindow();
430
431 wxRichTextAttr* attr = GetAttributes();
432
433 if (attr->HasBulletStyle())
434 {
435 m_hasBulletStyle = true;
436 int index = wxRICHTEXT_BULLETINDEX_NONE;
437
438 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC)
439 index = wxRICHTEXT_BULLETINDEX_ARABIC;
440
441 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER)
442 index = wxRICHTEXT_BULLETINDEX_UPPER_CASE;
443
444 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER)
445 index = wxRICHTEXT_BULLETINDEX_LOWER_CASE;
446
447 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER)
448 index = wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN;
449
450 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER)
451 index = wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN;
452
453 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_OUTLINE)
454 index = wxRICHTEXT_BULLETINDEX_OUTLINE;
455
456 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
457 index = wxRICHTEXT_BULLETINDEX_SYMBOL;
458
459 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP)
460 index = wxRICHTEXT_BULLETINDEX_BITMAP;
461
462 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD)
463 index = wxRICHTEXT_BULLETINDEX_STANDARD;
464
465 m_styleListBox->SetSelection(index);
466
467 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES)
468 m_parenthesesCtrl->SetValue(true);
469 else
470 m_parenthesesCtrl->SetValue(false);
471
472 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS)
473 m_rightParenthesisCtrl->SetValue(true);
474 else
475 m_rightParenthesisCtrl->SetValue(false);
476
477 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD)
478 m_periodCtrl->SetValue(true);
479 else
480 m_periodCtrl->SetValue(false);
481
482 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE)
483 m_bulletAlignmentCtrl->SetSelection(1);
484 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT)
485 m_bulletAlignmentCtrl->SetSelection(2);
486 else
487 m_bulletAlignmentCtrl->SetSelection(0);
488 }
489 else
490 {
491 m_hasBulletStyle = false;
492 m_styleListBox->SetSelection(-1);
493 m_bulletAlignmentCtrl->SetSelection(-1);
494 }
495
496 if (attr->HasBulletText())
497 {
498 m_symbolCtrl->SetValue(attr->GetBulletText());
499 m_symbolFontCtrl->SetValue(attr->GetBulletFont());
500 }
501 else
502 m_symbolCtrl->SetValue(wxEmptyString);
503
504 if (attr->HasBulletNumber())
505 m_numberCtrl->SetValue(attr->GetBulletNumber());
506 else
507 m_numberCtrl->SetValue(0);
508
509 if (attr->HasBulletName())
510 {
511 wxArrayString standardBulletNames;
512 if (wxRichTextBuffer::GetRenderer())
513 {
514 // Try to set the control by index in order to take translated combo control strings
515 // into account.
516 wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
517 int idx = standardBulletNames.Index(attr->GetBulletName());
518 if (idx != -1 && idx < (int) m_bulletNameCtrl->GetCount())
519 m_bulletNameCtrl->SetSelection(idx);
520 else
521 m_bulletNameCtrl->SetValue(attr->GetBulletName());
522 }
523 else
524 m_bulletNameCtrl->SetValue(attr->GetBulletName());
525 }
526 else
527 m_bulletNameCtrl->SetValue(wxEmptyString);
528
529 UpdatePreview();
530
531 m_dontUpdate = false;
532
533 return true;
534 }
535
536 /// Updates the bullet preview
537 void wxRichTextBulletsPage::UpdatePreview()
538 {
539 static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
540 Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.\n");
541
542 static const wxChar* s_para2 = wxT("Duis pharetra consequat dui. Cum sociis natoque penatibus \
543 et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum.\n");
544
545 static const wxChar* s_para3 = wxT("Integer convallis dolor at augue \
546 iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
547
548 TransferDataFromWindow();
549 wxRichTextAttr attr(*GetAttributes());
550 attr.SetFlags(attr.GetFlags() &
551 (wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|
552 wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
553 wxTEXT_ATTR_LINE_SPACING));
554
555 wxFont font(m_previewCtrl->GetFont());
556 font.SetPointSize(9);
557 m_previewCtrl->SetFont(font);
558
559 wxRichTextAttr normalParaAttr;
560 normalParaAttr.SetFont(font);
561 normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
562
563 m_previewCtrl->Freeze();
564 m_previewCtrl->Clear();
565
566 m_previewCtrl->BeginStyle(normalParaAttr);
567 m_previewCtrl->WriteText(s_para1);
568 m_previewCtrl->EndStyle();
569
570 m_previewCtrl->BeginStyle(attr);
571 m_previewCtrl->WriteText(s_para2);
572 m_previewCtrl->EndStyle();
573
574 m_previewCtrl->BeginStyle(normalParaAttr);
575 m_previewCtrl->WriteText(s_para3);
576 m_previewCtrl->EndStyle();
577
578 m_previewCtrl->NumberList(wxRichTextRange(0, m_previewCtrl->GetLastPosition()+1));
579
580 m_previewCtrl->Thaw();
581 }
582
583 wxRichTextAttr* wxRichTextBulletsPage::GetAttributes()
584 {
585 return wxRichTextFormattingDialog::GetDialogAttributes(this);
586 }
587
588 /*!
589 * Should we show tooltips?
590 */
591
592 bool wxRichTextBulletsPage::ShowToolTips()
593 {
594 return wxRichTextFormattingDialog::ShowToolTips();
595 }
596
597 /*!
598 * Get bitmap resources
599 */
600
601 wxBitmap wxRichTextBulletsPage::GetBitmapResource( const wxString& name )
602 {
603 // Bitmap retrieval
604 ////@begin wxRichTextBulletsPage bitmap retrieval
605 wxUnusedVar(name);
606 return wxNullBitmap;
607 ////@end wxRichTextBulletsPage bitmap retrieval
608 }
609
610 /*!
611 * Get icon resources
612 */
613
614 wxIcon wxRichTextBulletsPage::GetIconResource( const wxString& name )
615 {
616 // Icon retrieval
617 ////@begin wxRichTextBulletsPage icon retrieval
618 wxUnusedVar(name);
619 return wxNullIcon;
620 ////@end wxRichTextBulletsPage icon retrieval
621 }
622
623 /*!
624 * wxEVT_LISTBOX event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX
625 */
626
627 void wxRichTextBulletsPage::OnStylelistboxSelected( wxCommandEvent& WXUNUSED(event) )
628 {
629 if (!m_dontUpdate)
630 {
631 m_hasBulletStyle = true;
632
633 if (m_styleListBox->GetSelection() == wxRICHTEXT_BULLETINDEX_SYMBOL)
634 m_hasBulletSymbol = true;
635
636 UpdatePreview();
637 }
638 }
639
640 /*!
641 * wxEVT_COMBOBOX event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
642 */
643
644 void wxRichTextBulletsPage::OnSymbolctrlSelected( wxCommandEvent& WXUNUSED(event) )
645 {
646 if (!m_dontUpdate)
647 {
648 m_hasBulletSymbol = true;
649 UpdatePreview();
650 }
651 }
652
653 /*!
654 * wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
655 */
656
657 void wxRichTextBulletsPage::OnSymbolctrlUpdated( wxCommandEvent& WXUNUSED(event) )
658 {
659 if (!m_dontUpdate)
660 {
661 m_hasBulletSymbol = true;
662 UpdatePreview();
663 }
664 }
665
666 /*!
667 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
668 */
669
670 void wxRichTextBulletsPage::OnSymbolctrlUpdate( wxUpdateUIEvent& event )
671 {
672 OnSymbolUpdate(event);
673 }
674
675 /*!
676 * wxEVT_SPINCTRL event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
677 */
678
679 void wxRichTextBulletsPage::OnNumberctrlUpdated( wxSpinEvent& WXUNUSED(event) )
680 {
681 if (!m_dontUpdate)
682 {
683 m_hasBulletNumber = true;
684 UpdatePreview();
685 }
686 }
687
688 /*!
689 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
690 */
691
692 void wxRichTextBulletsPage::OnNumberctrlUp( wxSpinEvent& WXUNUSED(event) )
693 {
694 if (!m_dontUpdate)
695 {
696 m_hasBulletNumber = true;
697 UpdatePreview();
698 }
699 }
700
701 /*!
702 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
703 */
704
705 void wxRichTextBulletsPage::OnNumberctrlDown( wxSpinEvent& WXUNUSED(event) )
706 {
707 if (!m_dontUpdate)
708 {
709 m_hasBulletNumber = true;
710 UpdatePreview();
711 }
712 }
713
714 /*!
715 * wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
716 */
717
718 void wxRichTextBulletsPage::OnNumberctrlTextUpdated( wxCommandEvent& WXUNUSED(event) )
719 {
720 if (!m_dontUpdate)
721 {
722 m_hasBulletNumber = true;
723 UpdatePreview();
724 }
725 }
726
727 /*!
728 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
729 */
730
731 void wxRichTextBulletsPage::OnNumberctrlUpdate( wxUpdateUIEvent& event )
732 {
733 OnNumberUpdate(event);
734 }
735
736 /*!
737 * wxEVT_CHECKBOX event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
738 */
739
740 void wxRichTextBulletsPage::OnParenthesesctrlClick( wxCommandEvent& WXUNUSED(event) )
741 {
742 if (!m_dontUpdate)
743 {
744 m_hasBulletStyle = true;
745 UpdatePreview();
746 }
747 }
748
749 /*!
750 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
751 */
752
753 void wxRichTextBulletsPage::OnParenthesesctrlUpdate( wxUpdateUIEvent& event )
754 {
755 int sel = m_styleListBox->GetSelection();
756 event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
757 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
758 sel != wxRICHTEXT_BULLETINDEX_NONE));
759 }
760
761 /*!
762 * wxEVT_CHECKBOX event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
763 */
764
765 void wxRichTextBulletsPage::OnPeriodctrlClick( wxCommandEvent& WXUNUSED(event) )
766 {
767 if (!m_dontUpdate)
768 {
769 m_hasBulletStyle = true;
770 UpdatePreview();
771 }
772 }
773
774 /*!
775 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
776 */
777
778 void wxRichTextBulletsPage::OnPeriodctrlUpdate( wxUpdateUIEvent& event )
779 {
780 int sel = m_styleListBox->GetSelection();
781 event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
782 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
783 sel != wxRICHTEXT_BULLETINDEX_NONE));
784 }
785
786 /*!
787 * wxEVT_BUTTON event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
788 */
789
790 void wxRichTextBulletsPage::OnChooseSymbolClick( wxCommandEvent& WXUNUSED(event) )
791 {
792 int sel = m_styleListBox->GetSelection();
793 if (m_hasBulletStyle && sel == wxRICHTEXT_BULLETINDEX_SYMBOL)
794 {
795 wxString symbol = m_symbolCtrl->GetValue();
796 wxString fontName = m_symbolFontCtrl->GetValue();
797 wxSymbolPickerDialog dlg(symbol, fontName, fontName, this);
798
799 if (dlg.ShowModal() == wxID_OK)
800 {
801 m_dontUpdate = true;
802
803 m_symbolCtrl->SetValue(dlg.GetSymbol());
804 m_symbolFontCtrl->SetValue(dlg.GetFontName());
805
806 UpdatePreview();
807
808 m_dontUpdate = false;
809 }
810 }
811 }
812
813 /*!
814 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
815 */
816
817 void wxRichTextBulletsPage::OnChooseSymbolUpdate( wxUpdateUIEvent& event )
818 {
819 OnSymbolUpdate(event);
820 }
821 /*!
822 * wxEVT_COMBOBOX event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
823 */
824
825 void wxRichTextBulletsPage::OnSymbolfontctrlSelected( wxCommandEvent& WXUNUSED(event) )
826 {
827 if (m_dontUpdate)
828 return;
829 UpdatePreview();
830 }
831
832 /*!
833 * wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
834 */
835
836 void wxRichTextBulletsPage::OnSymbolfontctrlUpdated( wxCommandEvent& WXUNUSED(event) )
837 {
838 if (m_dontUpdate)
839 return;
840 UpdatePreview();
841 }
842
843
844 /*!
845 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
846 */
847
848 void wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event )
849 {
850 OnSymbolUpdate(event);
851 }
852
853 /// Update for symbol-related controls
854 void wxRichTextBulletsPage::OnSymbolUpdate( wxUpdateUIEvent& event )
855 {
856 int sel = m_styleListBox->GetSelection();
857 event.Enable(m_hasBulletStyle && (sel == wxRICHTEXT_BULLETINDEX_SYMBOL));
858 }
859
860 /// Update for number-related controls
861 void wxRichTextBulletsPage::OnNumberUpdate( wxUpdateUIEvent& event )
862 {
863 int sel = m_styleListBox->GetSelection();
864 event.Enable( m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
865 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
866 sel != wxRICHTEXT_BULLETINDEX_STANDARD &&
867 sel != wxRICHTEXT_BULLETINDEX_NONE));
868 }
869
870 /// Update for standard bullet-related controls
871 void wxRichTextBulletsPage::OnStandardBulletUpdate( wxUpdateUIEvent& event )
872 {
873 int sel = m_styleListBox->GetSelection();
874 event.Enable( sel == wxRICHTEXT_BULLETINDEX_STANDARD || sel == wxRICHTEXT_BULLETINDEX_BITMAP );
875 }
876
877
878 /*!
879 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
880 */
881
882 void wxRichTextBulletsPage::OnSymbolstaticUpdate( wxUpdateUIEvent& event )
883 {
884 OnSymbolUpdate(event);
885 }
886
887
888 /*!
889 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC
890 */
891
892 void wxRichTextBulletsPage::OnNumberstaticUpdate( wxUpdateUIEvent& event )
893 {
894 OnNumberUpdate(event);
895 }
896
897 /*!
898 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC
899 */
900
901 void wxRichTextBulletsPage::OnNamestaticUpdate( wxUpdateUIEvent& event )
902 {
903 OnStandardBulletUpdate(event);
904 }
905
906
907 /*!
908 * wxEVT_COMBOBOX event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
909 */
910
911 void wxRichTextBulletsPage::OnNamectrlSelected( wxCommandEvent& WXUNUSED(event) )
912 {
913 if (m_dontUpdate)
914 return;
915 UpdatePreview();
916 }
917
918 /*!
919 * wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
920 */
921
922 void wxRichTextBulletsPage::OnNamectrlUpdated( wxCommandEvent& WXUNUSED(event) )
923 {
924 if (m_dontUpdate)
925 return;
926 UpdatePreview();
927 }
928
929 /*!
930 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
931 */
932
933 void wxRichTextBulletsPage::OnNamectrlUIUpdate( wxUpdateUIEvent& event )
934 {
935 OnStandardBulletUpdate(event);
936 }
937
938 #endif // wxUSE_RICHTEXT
939 /*!
940 * wxEVT_CHECKBOX event handler for ID_RICHTEXTBULLETSPAGE_RIGHT_PARENTHESIS_CTRL
941 */
942
943 void wxRichTextBulletsPage::OnRightParenthesisCtrlClick( wxCommandEvent& WXUNUSED(event) )
944 {
945 if (!m_dontUpdate)
946 {
947 m_hasBulletStyle = true;
948 UpdatePreview();
949 }
950 }
951
952 /*!
953 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_RIGHT_PARENTHESIS_CTRL
954 */
955
956 void wxRichTextBulletsPage::OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event )
957 {
958 int sel = m_styleListBox->GetSelection();
959 event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
960 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
961 sel != wxRICHTEXT_BULLETINDEX_NONE));
962 }
963
964 /*!
965 * wxEVT_COMBOBOX event handler for ID_COMBOBOX
966 */
967
968 void wxRichTextBulletsPage::OnBulletAlignmentCtrlSelected( wxCommandEvent& WXUNUSED(event) )
969 {
970 if (m_dontUpdate)
971 return;
972 UpdatePreview();
973 }
974
975