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