]> git.saurik.com Git - wxWidgets.git/blob - src/richtext/richtextliststylepage.cpp
8497d52a05880f92856c2a98d4edfb16d352fbd5
[wxWidgets.git] / src / richtext / richtextliststylepage.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtextliststylepage.cpp
3 // Purpose:
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 10/18/2006 11:36:37 AM
7 // RCS-ID:
8 // Copyright: (c) Julian Smart
9 // Licence:
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "../../include/wx/richtext/richtextliststylepage.h"
13
14 ////@begin XPM images
15 ////@end XPM images
16
17 /*!
18 * wxRichTextListStylePage type definition
19 */
20
21 IMPLEMENT_DYNAMIC_CLASS( wxRichTextListStylePage, wxPanel )
22
23 /*!
24 * wxRichTextListStylePage event table definition
25 */
26
27 BEGIN_EVENT_TABLE( wxRichTextListStylePage, wxPanel )
28
29 ////@begin wxRichTextListStylePage event table entries
30 EVT_SPINCTRL( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUpdated )
31 EVT_SPIN_UP( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUp )
32 EVT_SPIN_DOWN( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelDown )
33 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelTextUpdated )
34 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUIUpdate )
35
36 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT, wxRichTextListStylePage::OnChooseFontClick )
37
38 EVT_LISTBOX( ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX, wxRichTextListStylePage::OnStylelistboxSelected )
39
40 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, wxRichTextListStylePage::OnSymbolstaticUpdate )
41
42 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlSelected )
43 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlUpdated )
44 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlUIUpdate )
45
46 EVT_BUTTON( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextListStylePage::OnChooseSymbolClick )
47 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextListStylePage::OnChooseSymbolUpdate )
48
49 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlSelected )
50 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlUpdated )
51 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlUIUpdate )
52
53 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL, wxRichTextListStylePage::OnParenthesesctrlClick )
54 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL, wxRichTextListStylePage::OnParenthesesctrlUpdate )
55
56 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL, wxRichTextListStylePage::OnPeriodctrlClick )
57 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL, wxRichTextListStylePage::OnPeriodctrlUpdate )
58
59 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT, wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected )
60
61 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT, wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected )
62
63 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED, wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected )
64
65 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_CENTERED, wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected )
66
67 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE, wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected )
68
69 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, wxRichTextListStylePage::OnIndentLeftUpdated )
70
71 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, wxRichTextListStylePage::OnIndentFirstLineUpdated )
72
73 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, wxRichTextListStylePage::OnIndentRightUpdated )
74
75 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, wxRichTextListStylePage::OnSpacingBeforeUpdated )
76
77 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, wxRichTextListStylePage::OnSpacingAfterUpdated )
78
79 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_LINESPACING, wxRichTextListStylePage::OnLineSpacingSelected )
80
81 ////@end wxRichTextListStylePage event table entries
82
83 END_EVENT_TABLE()
84
85 /*!
86 * wxRichTextListStylePage constructors
87 */
88
89 wxRichTextListStylePage::wxRichTextListStylePage( )
90 {
91 Init();
92 }
93
94 wxRichTextListStylePage::wxRichTextListStylePage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
95 {
96 Init();
97 Create(parent, id, pos, size, style);
98 }
99
100 /*!
101 * wxRichTextListStylePage creator
102 */
103
104 bool wxRichTextListStylePage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
105 {
106 ////@begin wxRichTextListStylePage creation
107 wxPanel::Create( parent, id, pos, size, style );
108
109 CreateControls();
110 if (GetSizer())
111 {
112 GetSizer()->SetSizeHints(this);
113 }
114 Centre();
115 ////@end wxRichTextListStylePage creation
116 return true;
117 }
118
119 /*!
120 * Member initialisation
121 */
122
123 void wxRichTextListStylePage::Init()
124 {
125 m_dontUpdate = false;
126 m_currentLevel = 1;
127
128 ////@begin wxRichTextListStylePage member initialisation
129 m_levelCtrl = NULL;
130 m_styleListBox = NULL;
131 m_symbolCtrl = NULL;
132 m_symbolFontCtrl = NULL;
133 m_parenthesesCtrl = NULL;
134 m_periodCtrl = NULL;
135 m_alignmentLeft = NULL;
136 m_alignmentRight = NULL;
137 m_alignmentJustified = NULL;
138 m_alignmentCentred = NULL;
139 m_alignmentIndeterminate = NULL;
140 m_indentLeft = NULL;
141 m_indentLeftFirst = NULL;
142 m_indentRight = NULL;
143 m_spacingBefore = NULL;
144 m_spacingAfter = NULL;
145 m_spacingLine = NULL;
146 m_previewCtrl = NULL;
147 ////@end wxRichTextListStylePage member initialisation
148 }
149 /*!
150 * Control creation for wxRichTextListStylePage
151 */
152
153 void wxRichTextListStylePage::CreateControls()
154 {
155 ////@begin wxRichTextListStylePage content construction
156 wxRichTextListStylePage* itemPanel1 = this;
157
158 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
159 itemPanel1->SetSizer(itemBoxSizer2);
160
161 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
162 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
163
164 wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
165 itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL, 5);
166
167 wxStaticText* itemStaticText5 = new wxStaticText( itemPanel1, wxID_STATIC, _("&List level:"), wxDefaultPosition, wxDefaultSize, 0 );
168 itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
169
170 m_levelCtrl = new wxSpinCtrl( itemPanel1, ID_RICHTEXTLISTSTYLEPAGE_LEVEL, _T("1"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 1, 10, 1 );
171 m_levelCtrl->SetHelpText(_("Selects the list level to edit."));
172 if (ShowToolTips())
173 m_levelCtrl->SetToolTip(_("Selects the list level to edit."));
174 itemBoxSizer4->Add(m_levelCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
175
176 itemBoxSizer4->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
177
178 wxButton* itemButton8 = new wxButton( itemPanel1, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT, _("&Font for Level..."), wxDefaultPosition, wxDefaultSize, 0 );
179 itemButton8->SetHelpText(_("Click to choose the font for this level."));
180 if (ShowToolTips())
181 itemButton8->SetToolTip(_("Click to choose the font for this level."));
182 itemBoxSizer4->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
183
184 wxNotebook* itemNotebook9 = new wxNotebook( itemPanel1, ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_TOP );
185
186 wxPanel* itemPanel10 = new wxPanel( itemNotebook9, ID_RICHTEXTLISTSTYLEPAGE_BULLETS, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
187 wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
188 itemPanel10->SetSizer(itemBoxSizer11);
189
190 wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
191 itemBoxSizer11->Add(itemBoxSizer12, 1, wxGROW, 5);
192 wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL);
193 itemBoxSizer12->Add(itemBoxSizer13, 0, wxGROW, 5);
194 wxStaticText* itemStaticText14 = new wxStaticText( itemPanel10, wxID_STATIC, _("&Bullet style:"), wxDefaultPosition, wxDefaultSize, 0 );
195 itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
196
197 wxString* m_styleListBoxStrings = NULL;
198 m_styleListBox = new wxListBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX, wxDefaultPosition, wxDefaultSize, 0, m_styleListBoxStrings, wxLB_SINGLE );
199 m_styleListBox->SetHelpText(_("The available bullet styles."));
200 if (ShowToolTips())
201 m_styleListBox->SetToolTip(_("The available bullet styles."));
202 itemBoxSizer13->Add(m_styleListBox, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
203
204 itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
205
206 wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
207 itemBoxSizer12->Add(itemStaticLine17, 0, wxGROW|wxALL, 5);
208
209 itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
210
211 wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxVERTICAL);
212 itemBoxSizer12->Add(itemBoxSizer19, 0, wxGROW, 5);
213 wxStaticText* itemStaticText20 = new wxStaticText( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, _("&Symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
214 itemBoxSizer19->Add(itemStaticText20, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
215
216 wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxHORIZONTAL);
217 itemBoxSizer19->Add(itemBoxSizer21, 0, wxGROW, 5);
218 wxString* m_symbolCtrlStrings = NULL;
219 m_symbolCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, _T(""), wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN );
220 m_symbolCtrl->SetHelpText(_("The bullet character."));
221 if (ShowToolTips())
222 m_symbolCtrl->SetToolTip(_("The bullet character."));
223 itemBoxSizer21->Add(m_symbolCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
224
225 wxButton* itemButton23 = new wxButton( itemPanel10, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, _("Ch&oose..."), wxDefaultPosition, wxDefaultSize, 0 );
226 itemButton23->SetHelpText(_("Click to browse for a symbol."));
227 if (ShowToolTips())
228 itemButton23->SetToolTip(_("Click to browse for a symbol."));
229 itemBoxSizer21->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
230
231 itemBoxSizer19->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
232
233 wxStaticText* itemStaticText25 = new wxStaticText( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, _("Symbol &font:"), wxDefaultPosition, wxDefaultSize, 0 );
234 itemBoxSizer19->Add(itemStaticText25, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
235
236 wxString* m_symbolFontCtrlStrings = NULL;
237 m_symbolFontCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
238 if (ShowToolTips())
239 m_symbolFontCtrl->SetToolTip(_("Available fonts."));
240 itemBoxSizer19->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5);
241
242 itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
243
244 wxStaticLine* itemStaticLine28 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
245 itemBoxSizer12->Add(itemStaticLine28, 0, wxGROW|wxALL, 5);
246
247 itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
248
249 wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL);
250 itemBoxSizer12->Add(itemBoxSizer30, 0, wxALIGN_TOP|wxRIGHT|wxTOP|wxBOTTOM, 5);
251 m_parenthesesCtrl = new wxCheckBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL, _("&Parentheses"), wxDefaultPosition, wxDefaultSize, 0 );
252 m_parenthesesCtrl->SetValue(false);
253 m_parenthesesCtrl->SetHelpText(_("Check to enclose the bullet in parentheses."));
254 if (ShowToolTips())
255 m_parenthesesCtrl->SetToolTip(_("Check to enclose the bullet in parentheses."));
256 itemBoxSizer30->Add(m_parenthesesCtrl, 0, wxALIGN_LEFT|wxALL, 5);
257
258 m_periodCtrl = new wxCheckBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL, _("Peri&od"), wxDefaultPosition, wxDefaultSize, 0 );
259 m_periodCtrl->SetValue(false);
260 m_periodCtrl->SetHelpText(_("Check to add a period after the bullet."));
261 if (ShowToolTips())
262 m_periodCtrl->SetToolTip(_("Check to add a period after the bullet."));
263 itemBoxSizer30->Add(m_periodCtrl, 0, wxALIGN_LEFT|wxALL, 5);
264
265 itemNotebook9->AddPage(itemPanel10, _("Bullet style"));
266
267 wxPanel* itemPanel33 = new wxPanel( itemNotebook9, ID_RICHTEXTLISTSTYLEPAGE_SPACING, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
268 wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL);
269 itemPanel33->SetSizer(itemBoxSizer34);
270
271 wxBoxSizer* itemBoxSizer35 = new wxBoxSizer(wxHORIZONTAL);
272 itemBoxSizer34->Add(itemBoxSizer35, 0, wxGROW, 5);
273 wxBoxSizer* itemBoxSizer36 = new wxBoxSizer(wxVERTICAL);
274 itemBoxSizer35->Add(itemBoxSizer36, 0, wxGROW, 5);
275 wxStaticText* itemStaticText37 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Alignment"), wxDefaultPosition, wxDefaultSize, 0 );
276 itemBoxSizer36->Add(itemStaticText37, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
277
278 wxBoxSizer* itemBoxSizer38 = new wxBoxSizer(wxHORIZONTAL);
279 itemBoxSizer36->Add(itemBoxSizer38, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
280 itemBoxSizer38->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
281
282 wxBoxSizer* itemBoxSizer40 = new wxBoxSizer(wxVERTICAL);
283 itemBoxSizer38->Add(itemBoxSizer40, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5);
284 m_alignmentLeft = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT, _("&Left"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
285 m_alignmentLeft->SetValue(false);
286 m_alignmentLeft->SetHelpText(_("Left-align text."));
287 if (ShowToolTips())
288 m_alignmentLeft->SetToolTip(_("Left-align text."));
289 itemBoxSizer40->Add(m_alignmentLeft, 0, wxALIGN_LEFT|wxALL, 5);
290
291 m_alignmentRight = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT, _("&Right"), wxDefaultPosition, wxDefaultSize, 0 );
292 m_alignmentRight->SetValue(false);
293 m_alignmentRight->SetHelpText(_("Right-align text."));
294 if (ShowToolTips())
295 m_alignmentRight->SetToolTip(_("Right-align text."));
296 itemBoxSizer40->Add(m_alignmentRight, 0, wxALIGN_LEFT|wxALL, 5);
297
298 m_alignmentJustified = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED, _("&Justified"), wxDefaultPosition, wxDefaultSize, 0 );
299 m_alignmentJustified->SetValue(false);
300 m_alignmentJustified->SetHelpText(_("Justify text left and right."));
301 if (ShowToolTips())
302 m_alignmentJustified->SetToolTip(_("Justify text left and right."));
303 itemBoxSizer40->Add(m_alignmentJustified, 0, wxALIGN_LEFT|wxALL, 5);
304
305 m_alignmentCentred = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_CENTERED, _("Cen&tred"), wxDefaultPosition, wxDefaultSize, 0 );
306 m_alignmentCentred->SetValue(false);
307 m_alignmentCentred->SetHelpText(_("Centre text."));
308 if (ShowToolTips())
309 m_alignmentCentred->SetToolTip(_("Centre text."));
310 itemBoxSizer40->Add(m_alignmentCentred, 0, wxALIGN_LEFT|wxALL, 5);
311
312 m_alignmentIndeterminate = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE, _("&Indeterminate"), wxDefaultPosition, wxDefaultSize, 0 );
313 m_alignmentIndeterminate->SetValue(false);
314 m_alignmentIndeterminate->SetHelpText(_("Use the current alignment setting."));
315 if (ShowToolTips())
316 m_alignmentIndeterminate->SetToolTip(_("Use the current alignment setting."));
317 itemBoxSizer40->Add(m_alignmentIndeterminate, 0, wxALIGN_LEFT|wxALL, 5);
318
319 itemBoxSizer35->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
320
321 wxStaticLine* itemStaticLine47 = new wxStaticLine( itemPanel33, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
322 itemBoxSizer35->Add(itemStaticLine47, 0, wxGROW|wxLEFT|wxBOTTOM, 5);
323
324 itemBoxSizer35->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
325
326 wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxVERTICAL);
327 itemBoxSizer35->Add(itemBoxSizer49, 0, wxGROW, 5);
328 wxStaticText* itemStaticText50 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Indentation (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 );
329 itemBoxSizer49->Add(itemStaticText50, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
330
331 wxBoxSizer* itemBoxSizer51 = new wxBoxSizer(wxHORIZONTAL);
332 itemBoxSizer49->Add(itemBoxSizer51, 0, wxALIGN_LEFT|wxALL, 5);
333 itemBoxSizer51->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
334
335 wxFlexGridSizer* itemFlexGridSizer53 = new wxFlexGridSizer(2, 2, 0, 0);
336 itemBoxSizer51->Add(itemFlexGridSizer53, 0, wxALIGN_CENTER_VERTICAL, 5);
337 wxStaticText* itemStaticText54 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 );
338 itemFlexGridSizer53->Add(itemStaticText54, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
339
340 wxBoxSizer* itemBoxSizer55 = new wxBoxSizer(wxHORIZONTAL);
341 itemFlexGridSizer53->Add(itemBoxSizer55, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
342 m_indentLeft = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
343 m_indentLeft->SetHelpText(_("The left indent."));
344 if (ShowToolTips())
345 m_indentLeft->SetToolTip(_("The left indent."));
346 itemBoxSizer55->Add(m_indentLeft, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
347
348 wxStaticText* itemStaticText57 = new wxStaticText( itemPanel33, wxID_STATIC, _("Left (&first line):"), wxDefaultPosition, wxDefaultSize, 0 );
349 itemFlexGridSizer53->Add(itemStaticText57, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
350
351 wxBoxSizer* itemBoxSizer58 = new wxBoxSizer(wxHORIZONTAL);
352 itemFlexGridSizer53->Add(itemBoxSizer58, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
353 m_indentLeftFirst = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
354 m_indentLeftFirst->SetHelpText(_("The first line indent."));
355 if (ShowToolTips())
356 m_indentLeftFirst->SetToolTip(_("The first line indent."));
357 itemBoxSizer58->Add(m_indentLeftFirst, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
358
359 wxStaticText* itemStaticText60 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 );
360 itemFlexGridSizer53->Add(itemStaticText60, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
361
362 wxBoxSizer* itemBoxSizer61 = new wxBoxSizer(wxHORIZONTAL);
363 itemFlexGridSizer53->Add(itemBoxSizer61, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
364 m_indentRight = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
365 m_indentRight->SetHelpText(_("The right indent."));
366 if (ShowToolTips())
367 m_indentRight->SetToolTip(_("The right indent."));
368 itemBoxSizer61->Add(m_indentRight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
369
370 itemBoxSizer35->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
371
372 wxStaticLine* itemStaticLine64 = new wxStaticLine( itemPanel33, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
373 itemBoxSizer35->Add(itemStaticLine64, 0, wxGROW|wxTOP|wxBOTTOM, 5);
374
375 itemBoxSizer35->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
376
377 wxBoxSizer* itemBoxSizer66 = new wxBoxSizer(wxVERTICAL);
378 itemBoxSizer35->Add(itemBoxSizer66, 0, wxGROW, 5);
379 wxStaticText* itemStaticText67 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Spacing (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 );
380 itemBoxSizer66->Add(itemStaticText67, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
381
382 wxBoxSizer* itemBoxSizer68 = new wxBoxSizer(wxHORIZONTAL);
383 itemBoxSizer66->Add(itemBoxSizer68, 0, wxALIGN_LEFT|wxALL, 5);
384 itemBoxSizer68->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
385
386 wxFlexGridSizer* itemFlexGridSizer70 = new wxFlexGridSizer(2, 2, 0, 0);
387 itemBoxSizer68->Add(itemFlexGridSizer70, 0, wxALIGN_CENTER_VERTICAL, 5);
388 wxStaticText* itemStaticText71 = new wxStaticText( itemPanel33, wxID_STATIC, _("Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
389 itemFlexGridSizer70->Add(itemStaticText71, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
390
391 wxBoxSizer* itemBoxSizer72 = new wxBoxSizer(wxHORIZONTAL);
392 itemFlexGridSizer70->Add(itemBoxSizer72, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
393 m_spacingBefore = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
394 m_spacingBefore->SetHelpText(_("The spacing before the paragraph."));
395 if (ShowToolTips())
396 m_spacingBefore->SetToolTip(_("The spacing before the paragraph."));
397 itemBoxSizer72->Add(m_spacingBefore, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
398
399 wxStaticText* itemStaticText74 = new wxStaticText( itemPanel33, wxID_STATIC, _("After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
400 itemFlexGridSizer70->Add(itemStaticText74, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
401
402 wxBoxSizer* itemBoxSizer75 = new wxBoxSizer(wxHORIZONTAL);
403 itemFlexGridSizer70->Add(itemBoxSizer75, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
404 m_spacingAfter = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
405 m_spacingAfter->SetHelpText(_("The spacing after the paragraph."));
406 if (ShowToolTips())
407 m_spacingAfter->SetToolTip(_("The spacing after the paragraph."));
408 itemBoxSizer75->Add(m_spacingAfter, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
409
410 wxStaticText* itemStaticText77 = new wxStaticText( itemPanel33, wxID_STATIC, _("Line spacing:"), wxDefaultPosition, wxDefaultSize, 0 );
411 itemFlexGridSizer70->Add(itemStaticText77, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
412
413 wxBoxSizer* itemBoxSizer78 = new wxBoxSizer(wxHORIZONTAL);
414 itemFlexGridSizer70->Add(itemBoxSizer78, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
415 wxString m_spacingLineStrings[] = {
416 _("Single"),
417 _("1.5"),
418 _("2")
419 };
420 m_spacingLine = new wxComboBox( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_LINESPACING, _("Single"), wxDefaultPosition, wxDefaultSize, 3, m_spacingLineStrings, wxCB_READONLY );
421 m_spacingLine->SetStringSelection(_("Single"));
422 m_spacingLine->SetHelpText(_("The line spacing."));
423 if (ShowToolTips())
424 m_spacingLine->SetToolTip(_("The line spacing."));
425 itemBoxSizer78->Add(m_spacingLine, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
426
427 itemNotebook9->AddPage(itemPanel33, _("Spacing"));
428
429 itemBoxSizer3->Add(itemNotebook9, 0, wxGROW|wxALL, 5);
430
431 m_previewCtrl = new wxRichTextCtrl( itemPanel1, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 180), wxSUNKEN_BORDER );
432 m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings."));
433 if (ShowToolTips())
434 m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings."));
435 itemBoxSizer3->Add(m_previewCtrl, 0, wxGROW|wxALL, 5);
436
437 ////@end wxRichTextListStylePage content construction
438
439 m_styleListBox->Append(_("(None)"));
440 m_styleListBox->Append(_("Arabic"));
441 m_styleListBox->Append(_("Upper case letters"));
442 m_styleListBox->Append(_("Lower case letters"));
443 m_styleListBox->Append(_("Upper case roman numerals"));
444 m_styleListBox->Append(_("Lower case roman numerals"));
445 m_styleListBox->Append(_("Symbol"));
446 m_styleListBox->Append(_("Bitmap"));
447
448 m_symbolCtrl->Append(_("*"));
449 m_symbolCtrl->Append(_("-"));
450 m_symbolCtrl->Append(_(">"));
451 m_symbolCtrl->Append(_("+"));
452 m_symbolCtrl->Append(_("~"));
453
454 wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
455 facenames.Sort();
456
457 m_symbolFontCtrl->Append(facenames);
458 }
459
460 /// Updates the font preview
461 void wxRichTextListStylePage::UpdatePreview()
462 {
463 static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
464 Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.");
465
466 static const wxChar* s_para2 = wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.");
467
468 static const wxChar* s_para3 = wxT("\nInteger convallis dolor at augue \
469 iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
470
471 wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
472 wxRichTextListStyleDefinition);
473
474 wxTextAttrEx attr(def->GetStyle());
475 attr.SetFlags(attr.GetFlags() &
476 (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
477 wxTEXT_ATTR_LINE_SPACING|
478 wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_SYMBOL));
479
480 wxFont font(m_previewCtrl->GetFont());
481 font.SetPointSize(9);
482 m_previewCtrl->SetFont(font);
483
484 wxTextAttrEx normalParaAttr;
485 normalParaAttr.SetFont(font);
486 normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
487
488 m_previewCtrl->Freeze();
489 m_previewCtrl->Clear();
490
491 m_previewCtrl->BeginStyle(normalParaAttr);
492 m_previewCtrl->WriteText(s_para1);
493 m_previewCtrl->EndStyle();
494
495 m_previewCtrl->BeginStyle(attr);
496
497 int i;
498 for (i = 0; i < 10; i++)
499 {
500 wxTextAttrEx levelAttr = * def->GetLevelAttributes(i);
501 levelAttr.SetBulletNumber(1);
502 m_previewCtrl->BeginStyle(levelAttr);
503 m_previewCtrl->WriteText(wxString::Format(wxT("\nList level %d. "), i+1) + s_para2);
504 m_previewCtrl->EndStyle();
505 }
506 m_previewCtrl->EndStyle();
507
508 m_previewCtrl->BeginStyle(normalParaAttr);
509 m_previewCtrl->WriteText(s_para3);
510 m_previewCtrl->EndStyle();
511
512 m_previewCtrl->Thaw();
513 }
514
515 /// Transfer data from/to window
516 bool wxRichTextListStylePage::TransferDataFromWindow()
517 {
518 wxPanel::TransferDataFromWindow();
519
520 m_currentLevel = m_levelCtrl->GetValue();
521
522 wxTextAttrEx* attr = GetAttributesForSelection();
523
524 if (m_alignmentLeft->GetValue())
525 attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT);
526 else if (m_alignmentCentred->GetValue())
527 attr->SetAlignment(wxTEXT_ALIGNMENT_CENTRE);
528 else if (m_alignmentRight->GetValue())
529 attr->SetAlignment(wxTEXT_ALIGNMENT_RIGHT);
530 else if (m_alignmentJustified->GetValue())
531 attr->SetAlignment(wxTEXT_ALIGNMENT_JUSTIFIED);
532 else
533 {
534 attr->SetAlignment(wxTEXT_ALIGNMENT_DEFAULT);
535 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_ALIGNMENT));
536 }
537
538 wxString leftIndent(m_indentLeft->GetValue());
539 wxString leftFirstIndent(m_indentLeftFirst->GetValue());
540 if (!leftIndent.empty())
541 {
542 int visualLeftIndent = wxAtoi(leftIndent);
543 int visualLeftFirstIndent = wxAtoi(leftFirstIndent);
544 int actualLeftIndent = visualLeftFirstIndent;
545 int actualLeftSubIndent = visualLeftIndent - visualLeftFirstIndent;
546
547 attr->SetLeftIndent(actualLeftIndent, actualLeftSubIndent);
548 }
549 else
550 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LEFT_INDENT));
551
552 wxString rightIndent(m_indentRight->GetValue());
553 if (!rightIndent.empty())
554 attr->SetRightIndent(wxAtoi(rightIndent));
555 else
556 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_RIGHT_INDENT));
557
558 wxString spacingAfter(m_spacingAfter->GetValue());
559 if (!spacingAfter.empty())
560 attr->SetParagraphSpacingAfter(wxAtoi(spacingAfter));
561 else
562 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_AFTER));
563
564 wxString spacingBefore(m_spacingBefore->GetValue());
565 if (!spacingBefore.empty())
566 attr->SetParagraphSpacingBefore(wxAtoi(spacingBefore));
567 else
568 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_BEFORE));
569
570 int spacingIndex = m_spacingLine->GetSelection();
571 int lineSpacing = 0;
572 if (spacingIndex == 0)
573 lineSpacing = 10;
574 else if (spacingIndex == 1)
575 lineSpacing = 15;
576 else if (spacingIndex == 2)
577 lineSpacing = 20;
578
579 if (lineSpacing == 0)
580 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING));
581 else
582 attr->SetLineSpacing(lineSpacing);
583
584 /// BULLETS
585 if (true) // m_hasBulletStyle)
586 {
587 long bulletStyle = 0;
588
589 int index = m_styleListBox->GetSelection();
590 if (index == 1)
591 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ARABIC;
592 else if (index == 2)
593 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER;
594 else if (index == 3)
595 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER;
596 else if (index == 4)
597 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER;
598 else if (index == 5)
599 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER;
600 else if (index == 6)
601 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_SYMBOL;
602 else if (index == 7)
603 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_BITMAP;
604
605 if (m_parenthesesCtrl->GetValue())
606 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES;
607 if (m_periodCtrl->GetValue())
608 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PERIOD;
609
610 attr->SetBulletStyle(bulletStyle);
611 }
612
613 // if (m_hasBulletSymbol)
614 {
615 wxChar c(wxT('*'));
616 if (m_symbolCtrl->GetValue().length() > 0)
617 c = m_symbolCtrl->GetValue()[0];
618 attr->SetBulletSymbol(c);
619 attr->SetBulletFont(m_symbolFontCtrl->GetValue());
620 }
621
622 return true;
623 }
624
625 bool wxRichTextListStylePage::TransferDataToWindow()
626 {
627 DoTransferDataToWindow();
628 UpdatePreview();
629
630 return true;
631 }
632
633 /// Just transfer to the window
634 void wxRichTextListStylePage::DoTransferDataToWindow()
635 {
636 m_dontUpdate = true;
637
638 wxPanel::TransferDataToWindow();
639
640 m_levelCtrl->SetValue(m_currentLevel);
641
642 wxTextAttrEx* attr = GetAttributesForSelection();
643
644 if (attr->HasAlignment())
645 {
646 if (attr->GetAlignment() == wxTEXT_ALIGNMENT_LEFT)
647 m_alignmentLeft->SetValue(true);
648 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
649 m_alignmentRight->SetValue(true);
650 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
651 m_alignmentCentred->SetValue(true);
652 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED)
653 m_alignmentJustified->SetValue(true);
654 else
655 m_alignmentIndeterminate->SetValue(true);
656 }
657 else
658 m_alignmentIndeterminate->SetValue(true);
659
660 if (attr->HasLeftIndent())
661 {
662 wxString leftIndent(wxString::Format(wxT("%ld"), attr->GetLeftIndent() + attr->GetLeftSubIndent()));
663 wxString leftFirstIndent(wxString::Format(wxT("%ld"), attr->GetLeftIndent()));
664
665 m_indentLeft->SetValue(leftIndent);
666 m_indentLeftFirst->SetValue(leftFirstIndent);
667 }
668 else
669 {
670 m_indentLeft->SetValue(wxEmptyString);
671 m_indentLeftFirst->SetValue(wxEmptyString);
672 }
673
674 if (attr->HasRightIndent())
675 {
676 wxString rightIndent(wxString::Format(wxT("%ld"), attr->GetRightIndent()));
677
678 m_indentRight->SetValue(rightIndent);
679 }
680 else
681 m_indentRight->SetValue(wxEmptyString);
682
683 if (attr->HasParagraphSpacingAfter())
684 {
685 wxString spacingAfter(wxString::Format(wxT("%d"), attr->GetParagraphSpacingAfter()));
686
687 m_spacingAfter->SetValue(spacingAfter);
688 }
689 else
690 m_spacingAfter->SetValue(wxEmptyString);
691
692 if (attr->HasParagraphSpacingBefore())
693 {
694 wxString spacingBefore(wxString::Format(wxT("%d"), attr->GetParagraphSpacingBefore()));
695
696 m_spacingBefore->SetValue(spacingBefore);
697 }
698 else
699 m_spacingBefore->SetValue(wxEmptyString);
700
701 if (attr->HasLineSpacing())
702 {
703 int index = 0;
704
705 int lineSpacing = attr->GetLineSpacing();
706 if (lineSpacing == 10)
707 index = 0;
708 else if (lineSpacing == 15)
709 index = 1;
710 else if (lineSpacing == 20)
711 index = 2;
712 else
713 index = -1;
714
715 m_spacingLine->SetSelection(index);
716 }
717 else
718 m_spacingLine->SetSelection(-1);
719
720 /// BULLETS
721 if (attr->HasBulletStyle())
722 {
723 int index = -1;
724 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC)
725 index = 1;
726 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER)
727 index = 2;
728 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER)
729 index = 3;
730 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER)
731 index = 4;
732 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER)
733 index = 5;
734 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
735 index = 6;
736 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP)
737 index = 7;
738 m_styleListBox->SetSelection(index);
739
740 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES)
741 m_parenthesesCtrl->SetValue(true);
742 else
743 m_parenthesesCtrl->SetValue(false);
744
745 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD)
746 m_periodCtrl->SetValue(true);
747 else
748 m_periodCtrl->SetValue(false);
749 }
750 else
751 m_styleListBox->SetSelection(-1);
752
753 if (attr->HasBulletSymbol())
754 {
755 wxChar c = attr->GetBulletSymbol();
756 wxString s;
757 s << c;
758 m_symbolCtrl->SetValue(s);
759 m_symbolFontCtrl->SetValue(attr->GetBulletFont());
760 }
761 else
762 m_symbolCtrl->SetValue(wxEmptyString);
763
764 m_dontUpdate = false;
765 }
766
767 /// Get attributes for selected level
768 wxTextAttrEx* wxRichTextListStylePage::GetAttributesForSelection()
769 {
770 wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
771 wxRichTextListStyleDefinition);
772
773 int value = m_levelCtrl->GetValue();
774
775 if (def)
776 return def->GetLevelAttributes(value-1);
777 else
778 return NULL;
779 }
780
781 /// Just transfer from the window and update the preview
782 void wxRichTextListStylePage::TransferAndPreview()
783 {
784 if (!m_dontUpdate)
785 {
786 TransferDataFromWindow();
787 UpdatePreview();
788 }
789 }
790
791
792 /*!
793 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
794 */
795
796 void wxRichTextListStylePage::OnLevelUpdated( wxSpinEvent& WXUNUSED(event) )
797 {
798 if (!m_dontUpdate)
799 {
800 m_currentLevel = m_levelCtrl->GetValue();
801 TransferDataToWindow();
802 }
803 }
804
805 /*!
806 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
807 */
808
809 void wxRichTextListStylePage::OnLevelUp( wxSpinEvent& event )
810 {
811 if (!m_dontUpdate)
812 {
813 m_currentLevel = event.GetPosition();
814 TransferDataToWindow();
815 }
816 }
817
818 /*!
819 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
820 */
821
822 void wxRichTextListStylePage::OnLevelDown( wxSpinEvent& event )
823 {
824 if (!m_dontUpdate)
825 {
826 m_currentLevel = event.GetPosition();
827 TransferDataToWindow();
828 }
829 }
830
831 /*!
832 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
833 */
834
835 void wxRichTextListStylePage::OnLevelTextUpdated( wxCommandEvent& event )
836 {
837 // Can cause problems
838 #if 0
839 if (!m_dontUpdate)
840 {
841 m_currentLevel = event.GetInt();
842 TransferDataToWindow();
843 }
844 #endif
845 }
846
847 /*!
848 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
849 */
850
851 void wxRichTextListStylePage::OnLevelUIUpdate( wxUpdateUIEvent& event )
852 {
853 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
854 // Before editing this code, remove the block markers.
855 event.Skip();
856 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
857 }
858
859 /*!
860 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
861 */
862
863 void wxRichTextListStylePage::OnStylelistboxSelected( wxCommandEvent& WXUNUSED(event) )
864 {
865 TransferAndPreview();
866 }
867
868 /*!
869 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
870 */
871
872 void wxRichTextListStylePage::OnSymbolstaticUpdate( wxUpdateUIEvent& event )
873 {
874 OnSymbolUpdate(event);
875 }
876
877 /*!
878 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
879 */
880
881 void wxRichTextListStylePage::OnSymbolctrlSelected( wxCommandEvent& WXUNUSED(event) )
882 {
883 TransferAndPreview();
884 }
885
886 /*!
887 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
888 */
889
890 void wxRichTextListStylePage::OnSymbolctrlUpdated( wxCommandEvent& WXUNUSED(event) )
891 {
892 TransferAndPreview();
893 }
894
895 /*!
896 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
897 */
898
899 void wxRichTextListStylePage::OnSymbolctrlUIUpdate( wxUpdateUIEvent& event )
900 {
901 OnSymbolUpdate(event);
902 }
903
904 /*!
905 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
906 */
907
908 void wxRichTextListStylePage::OnChooseSymbolClick( wxCommandEvent& WXUNUSED(event) )
909 {
910 int sel = m_styleListBox->GetSelection();
911 if (sel == 6)
912 {
913 wxString symbol = m_symbolCtrl->GetValue();
914 wxString fontName = m_symbolFontCtrl->GetValue();
915 wxSymbolPickerDialog dlg(symbol, fontName, fontName, this);
916
917 if (dlg.ShowModal() == wxID_OK)
918 {
919 m_dontUpdate = true;
920
921 m_symbolCtrl->SetValue(dlg.GetSymbol());
922 m_symbolFontCtrl->SetValue(dlg.GetFontName());
923
924 TransferAndPreview();
925
926 m_dontUpdate = false;
927 }
928 }
929 }
930
931 /*!
932 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
933 */
934
935 void wxRichTextListStylePage::OnChooseSymbolUpdate( wxUpdateUIEvent& event )
936 {
937 OnSymbolUpdate(event);
938 }
939
940 /*!
941 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
942 */
943
944 void wxRichTextListStylePage::OnSymbolfontctrlSelected( wxCommandEvent& WXUNUSED(event) )
945 {
946 TransferAndPreview();
947 }
948
949 /*!
950 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
951 */
952
953 void wxRichTextListStylePage::OnSymbolfontctrlUpdated( wxCommandEvent& WXUNUSED(event) )
954 {
955 TransferAndPreview();
956 }
957
958 /*!
959 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
960 */
961
962 void wxRichTextListStylePage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event )
963 {
964 OnSymbolUpdate(event);
965 }
966
967 /*!
968 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
969 */
970
971 void wxRichTextListStylePage::OnParenthesesctrlClick( wxCommandEvent& WXUNUSED(event) )
972 {
973 TransferAndPreview();
974 }
975
976 /*!
977 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
978 */
979
980 void wxRichTextListStylePage::OnParenthesesctrlUpdate( wxUpdateUIEvent& event )
981 {
982 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
983 // Before editing this code, remove the block markers.
984 event.Skip();
985 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
986 }
987
988 /*!
989 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
990 */
991
992 void wxRichTextListStylePage::OnPeriodctrlClick( wxCommandEvent& WXUNUSED(event) )
993 {
994 TransferAndPreview();
995 }
996
997 /*!
998 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
999 */
1000
1001 void wxRichTextListStylePage::OnPeriodctrlUpdate( wxUpdateUIEvent& event )
1002 {
1003 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
1004 // Before editing this code, remove the block markers.
1005 event.Skip();
1006 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
1007 }
1008
1009 /*!
1010 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
1011 */
1012
1013 void wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected( wxCommandEvent& WXUNUSED(event) )
1014 {
1015 TransferAndPreview();
1016 }
1017
1018 /*!
1019 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
1020 */
1021
1022 void wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected( wxCommandEvent& WXUNUSED(event) )
1023 {
1024 TransferAndPreview();
1025 }
1026
1027 /*!
1028 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
1029 */
1030
1031 void wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected( wxCommandEvent& WXUNUSED(event) )
1032 {
1033 TransferAndPreview();
1034 }
1035
1036 /*!
1037 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
1038 */
1039
1040 void wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected( wxCommandEvent& WXUNUSED(event) )
1041 {
1042 TransferAndPreview();
1043 }
1044
1045 /*!
1046 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
1047 */
1048
1049 void wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& WXUNUSED(event) )
1050 {
1051 TransferAndPreview();
1052 }
1053
1054 /*!
1055 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
1056 */
1057
1058 void wxRichTextListStylePage::OnIndentLeftUpdated( wxCommandEvent& WXUNUSED(event) )
1059 {
1060 TransferAndPreview();
1061 }
1062
1063 /*!
1064 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
1065 */
1066
1067 void wxRichTextListStylePage::OnIndentFirstLineUpdated( wxCommandEvent& WXUNUSED(event) )
1068 {
1069 TransferAndPreview();
1070 }
1071
1072 /*!
1073 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
1074 */
1075
1076 void wxRichTextListStylePage::OnIndentRightUpdated( wxCommandEvent& WXUNUSED(event) )
1077 {
1078 TransferAndPreview();
1079 }
1080
1081 /*!
1082 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
1083 */
1084
1085 void wxRichTextListStylePage::OnSpacingBeforeUpdated( wxCommandEvent& WXUNUSED(event) )
1086 {
1087 TransferAndPreview();
1088 }
1089
1090 /*!
1091 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
1092 */
1093
1094 void wxRichTextListStylePage::OnSpacingAfterUpdated( wxCommandEvent& WXUNUSED(event) )
1095 {
1096 TransferAndPreview();
1097 }
1098
1099 /*!
1100 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
1101 */
1102
1103 void wxRichTextListStylePage::OnLineSpacingSelected( wxCommandEvent& WXUNUSED(event) )
1104 {
1105 TransferAndPreview();
1106 }
1107
1108 /*!
1109 * Should we show tooltips?
1110 */
1111
1112 bool wxRichTextListStylePage::ShowToolTips()
1113 {
1114 return wxRichTextFormattingDialog::ShowToolTips();
1115 }
1116
1117 /*!
1118 * Get bitmap resources
1119 */
1120
1121 wxBitmap wxRichTextListStylePage::GetBitmapResource( const wxString& name )
1122 {
1123 // Bitmap retrieval
1124 ////@begin wxRichTextListStylePage bitmap retrieval
1125 wxUnusedVar(name);
1126 return wxNullBitmap;
1127 ////@end wxRichTextListStylePage bitmap retrieval
1128 }
1129
1130 /*!
1131 * Get icon resources
1132 */
1133
1134 wxIcon wxRichTextListStylePage::GetIconResource( const wxString& name )
1135 {
1136 // Icon retrieval
1137 ////@begin wxRichTextListStylePage icon retrieval
1138 wxUnusedVar(name);
1139 return wxNullIcon;
1140 ////@end wxRichTextListStylePage icon retrieval
1141 }
1142
1143 /// Update for symbol-related controls
1144 void wxRichTextListStylePage::OnSymbolUpdate( wxUpdateUIEvent& event )
1145 {
1146 int sel = m_styleListBox->GetSelection();
1147 event.Enable(sel == 6);
1148 }
1149
1150 /// Update for number-related controls
1151 void wxRichTextListStylePage::OnNumberUpdate( wxUpdateUIEvent& event )
1152 {
1153 int sel = m_styleListBox->GetSelection();
1154 event.Enable((sel != 6 && sel != 7 && sel != 0));
1155 }
1156
1157 /*!
1158 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
1159 */
1160
1161 void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent& WXUNUSED(event) )
1162 {
1163 wxTextAttrEx* attr = GetAttributesForSelection();
1164
1165 int pages = wxRICHTEXT_FORMAT_FONT;
1166 wxRichTextFormattingDialog formatDlg;
1167 formatDlg.SetStyle(*attr, false);
1168 formatDlg.Create(pages, this);
1169
1170 if (formatDlg.ShowModal() == wxID_OK)
1171 {
1172 (*attr) = formatDlg.GetAttributes();
1173 TransferAndPreview();
1174 }
1175 }
1176
1177