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