]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtextindentspage.cpp
Added option to TIFF handler for specifying the photometric interpretation.
[wxWidgets.git] / src / richtext / richtextindentspage.cpp
CommitLineData
97ff49b3 1/////////////////////////////////////////////////////////////////////////////
b68603d5 2// Name: src/richtext/richtextindentspage.cpp
97ff49b3
JS
3// Purpose:
4// Author: Julian Smart
5// Modified by:
6// Created: 10/3/2006 2:28:21 PM
b68603d5 7// RCS-ID: $Id$
97ff49b3 8// Copyright: (c) Julian Smart
b68603d5 9// Licence: wxWindows licence
97ff49b3
JS
10/////////////////////////////////////////////////////////////////////////////
11
b68603d5
WS
12#if wxUSE_RICHTEXT
13
14#include "wx/richtext/richtextindentspage.h"
15
97ff49b3
JS
16/*!
17 * wxRichTextIndentsSpacingPage type definition
18 */
19
603f702b 20IMPLEMENT_DYNAMIC_CLASS( wxRichTextIndentsSpacingPage, wxRichTextDialogPage )
97ff49b3
JS
21
22/*!
23 * wxRichTextIndentsSpacingPage event table definition
24 */
25
603f702b 26BEGIN_EVENT_TABLE( wxRichTextIndentsSpacingPage, wxRichTextDialogPage )
97ff49b3
JS
27
28////@begin wxRichTextIndentsSpacingPage event table entries
29 EVT_RADIOBUTTON( ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT, wxRichTextIndentsSpacingPage::OnAlignmentLeftSelected )
30
31 EVT_RADIOBUTTON( ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT, wxRichTextIndentsSpacingPage::OnAlignmentRightSelected )
32
33 EVT_RADIOBUTTON( ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED, wxRichTextIndentsSpacingPage::OnAlignmentJustifiedSelected )
34
35 EVT_RADIOBUTTON( ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED, wxRichTextIndentsSpacingPage::OnAlignmentCentredSelected )
36
37 EVT_RADIOBUTTON( ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE, wxRichTextIndentsSpacingPage::OnAlignmentIndeterminateSelected )
38
39 EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, wxRichTextIndentsSpacingPage::OnIndentLeftUpdated )
40
41 EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, wxRichTextIndentsSpacingPage::OnIndentLeftFirstUpdated )
42
43 EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxRichTextIndentsSpacingPage::OnIndentRightUpdated )
44
4d6d8bf4
JS
45 EVT_COMBOBOX( ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL, wxRichTextIndentsSpacingPage::OnRichtextOutlinelevelSelected )
46
97ff49b3
JS
47 EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxRichTextIndentsSpacingPage::OnSpacingBeforeUpdated )
48
49 EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxRichTextIndentsSpacingPage::OnSpacingAfterUpdated )
50
51 EVT_COMBOBOX( ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE, wxRichTextIndentsSpacingPage::OnSpacingLineSelected )
52
53////@end wxRichTextIndentsSpacingPage event table entries
54
55END_EVENT_TABLE()
56
603f702b
JS
57IMPLEMENT_HELP_PROVISION(wxRichTextIndentsSpacingPage)
58
97ff49b3
JS
59/*!
60 * wxRichTextIndentsSpacingPage constructors
61 */
62
63wxRichTextIndentsSpacingPage::wxRichTextIndentsSpacingPage( )
64{
65 Init();
66}
67
68wxRichTextIndentsSpacingPage::wxRichTextIndentsSpacingPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
69{
70 Init();
71 Create(parent, id, pos, size, style);
72}
73
74/*!
75 * Initialise members
76 */
5778b3c8 77
97ff49b3
JS
78void wxRichTextIndentsSpacingPage::Init()
79{
80 m_dontUpdate = false;
81
82////@begin wxRichTextIndentsSpacingPage member initialisation
83 m_alignmentLeft = NULL;
84 m_alignmentRight = NULL;
85 m_alignmentJustified = NULL;
86 m_alignmentCentred = NULL;
87 m_alignmentIndeterminate = NULL;
88 m_indentLeft = NULL;
89 m_indentLeftFirst = NULL;
90 m_indentRight = NULL;
4d6d8bf4 91 m_outlineLevelCtrl = NULL;
97ff49b3
JS
92 m_spacingBefore = NULL;
93 m_spacingAfter = NULL;
94 m_spacingLine = NULL;
4c7d9d88 95 m_pageBreakCtrl = NULL;
97ff49b3
JS
96 m_previewCtrl = NULL;
97////@end wxRichTextIndentsSpacingPage member initialisation
98
99}
100
101/*!
102 * wxRichTextIndentsSpacingPage creator
103 */
104
105bool wxRichTextIndentsSpacingPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
106{
107////@begin wxRichTextIndentsSpacingPage creation
603f702b 108 wxRichTextDialogPage::Create( parent, id, pos, size, style );
97ff49b3
JS
109
110 CreateControls();
111 if (GetSizer())
112 {
113 GetSizer()->SetSizeHints(this);
114 }
115 Centre();
116////@end wxRichTextIndentsSpacingPage creation
117 return true;
118}
119
120/*!
121 * Control creation for wxRichTextIndentsSpacingPage
122 */
123
124void wxRichTextIndentsSpacingPage::CreateControls()
125{
126////@begin wxRichTextIndentsSpacingPage content construction
603f702b 127 wxRichTextIndentsSpacingPage* itemRichTextDialogPage1 = this;
97ff49b3
JS
128
129 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
603f702b 130 itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
97ff49b3
JS
131
132 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
133 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
134
135 wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
136 itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW, 5);
137
138 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
139 itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW, 5);
140
603f702b 141 wxStaticText* itemStaticText6 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Alignment"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 142 itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
97ff49b3
JS
143
144 wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
145 itemBoxSizer5->Add(itemBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
146
147 itemBoxSizer7->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
148
149 wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL);
150 itemBoxSizer7->Add(itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5);
151
603f702b 152 m_alignmentLeft = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT, _("&Left"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
97ff49b3 153 m_alignmentLeft->SetValue(false);
dadd4f55 154 m_alignmentLeft->SetHelpText(_("Left-align text."));
6103234e 155 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 156 m_alignmentLeft->SetToolTip(_("Left-align text."));
97ff49b3
JS
157 itemBoxSizer9->Add(m_alignmentLeft, 0, wxALIGN_LEFT|wxALL, 5);
158
603f702b 159 m_alignmentRight = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT, _("&Right"), wxDefaultPosition, wxDefaultSize, 0 );
97ff49b3 160 m_alignmentRight->SetValue(false);
dadd4f55 161 m_alignmentRight->SetHelpText(_("Right-align text."));
6103234e 162 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 163 m_alignmentRight->SetToolTip(_("Right-align text."));
97ff49b3
JS
164 itemBoxSizer9->Add(m_alignmentRight, 0, wxALIGN_LEFT|wxALL, 5);
165
603f702b 166 m_alignmentJustified = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED, _("&Justified"), wxDefaultPosition, wxDefaultSize, 0 );
97ff49b3 167 m_alignmentJustified->SetValue(false);
dadd4f55 168 m_alignmentJustified->SetHelpText(_("Justify text left and right."));
6103234e 169 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 170 m_alignmentJustified->SetToolTip(_("Justify text left and right."));
97ff49b3
JS
171 itemBoxSizer9->Add(m_alignmentJustified, 0, wxALIGN_LEFT|wxALL, 5);
172
603f702b 173 m_alignmentCentred = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED, _("Cen&tred"), wxDefaultPosition, wxDefaultSize, 0 );
97ff49b3 174 m_alignmentCentred->SetValue(false);
dadd4f55 175 m_alignmentCentred->SetHelpText(_("Centre text."));
6103234e 176 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 177 m_alignmentCentred->SetToolTip(_("Centre text."));
97ff49b3
JS
178 itemBoxSizer9->Add(m_alignmentCentred, 0, wxALIGN_LEFT|wxALL, 5);
179
603f702b 180 m_alignmentIndeterminate = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE, _("&Indeterminate"), wxDefaultPosition, wxDefaultSize, 0 );
97ff49b3 181 m_alignmentIndeterminate->SetValue(false);
dadd4f55 182 m_alignmentIndeterminate->SetHelpText(_("Use the current alignment setting."));
6103234e 183 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 184 m_alignmentIndeterminate->SetToolTip(_("Use the current alignment setting."));
97ff49b3
JS
185 itemBoxSizer9->Add(m_alignmentIndeterminate, 0, wxALIGN_LEFT|wxALL, 5);
186
187 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
188
603f702b 189 wxStaticLine* itemStaticLine16 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
97ff49b3
JS
190 itemBoxSizer4->Add(itemStaticLine16, 0, wxGROW|wxLEFT|wxBOTTOM, 5);
191
192 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
193
194 wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxVERTICAL);
195 itemBoxSizer4->Add(itemBoxSizer18, 0, wxGROW, 5);
196
603f702b 197 wxStaticText* itemStaticText19 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Indentation (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 198 itemBoxSizer18->Add(itemStaticText19, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
97ff49b3
JS
199
200 wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
201 itemBoxSizer18->Add(itemBoxSizer20, 0, wxALIGN_LEFT|wxALL, 5);
202
203 itemBoxSizer20->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
204
706465df 205 wxFlexGridSizer* itemFlexGridSizer22 = new wxFlexGridSizer(0, 2, 0, 0);
97ff49b3
JS
206 itemBoxSizer20->Add(itemFlexGridSizer22, 0, wxALIGN_CENTER_VERTICAL, 5);
207
603f702b 208 wxStaticText* itemStaticText23 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 209 itemFlexGridSizer22->Add(itemStaticText23, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 210
603f702b 211 m_indentLeft = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 212 m_indentLeft->SetHelpText(_("The left indent."));
6103234e 213 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 214 m_indentLeft->SetToolTip(_("The left indent."));
41d9dcbc 215 itemFlexGridSizer22->Add(m_indentLeft, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 216
41d9dcbc
JS
217 wxStaticText* itemStaticText25 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Left (&first line):"), wxDefaultPosition, wxDefaultSize, 0 );
218 itemFlexGridSizer22->Add(itemStaticText25, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 219
603f702b 220 m_indentLeftFirst = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 221 m_indentLeftFirst->SetHelpText(_("The first line indent."));
6103234e 222 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 223 m_indentLeftFirst->SetToolTip(_("The first line indent."));
41d9dcbc 224 itemFlexGridSizer22->Add(m_indentLeftFirst, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 225
41d9dcbc
JS
226 wxStaticText* itemStaticText27 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 );
227 itemFlexGridSizer22->Add(itemStaticText27, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 228
603f702b 229 m_indentRight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 230 m_indentRight->SetHelpText(_("The right indent."));
6103234e 231 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 232 m_indentRight->SetToolTip(_("The right indent."));
41d9dcbc 233 itemFlexGridSizer22->Add(m_indentRight, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
4d6d8bf4 234
41d9dcbc
JS
235 wxStaticText* itemStaticText29 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Outline level:"), wxDefaultPosition, wxDefaultSize, 0 );
236 itemFlexGridSizer22->Add(itemStaticText29, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
4d6d8bf4 237
6103234e 238 wxArrayString m_outlineLevelCtrlStrings;
41d9dcbc 239 m_outlineLevelCtrlStrings.Add(_("(none)"));
6103234e
JS
240 m_outlineLevelCtrlStrings.Add(_("1"));
241 m_outlineLevelCtrlStrings.Add(_("2"));
242 m_outlineLevelCtrlStrings.Add(_("3"));
243 m_outlineLevelCtrlStrings.Add(_("4"));
244 m_outlineLevelCtrlStrings.Add(_("5"));
245 m_outlineLevelCtrlStrings.Add(_("6"));
246 m_outlineLevelCtrlStrings.Add(_("7"));
247 m_outlineLevelCtrlStrings.Add(_("8"));
248 m_outlineLevelCtrlStrings.Add(_("9"));
41d9dcbc
JS
249 m_outlineLevelCtrlStrings.Add(_("10"));
250 m_outlineLevelCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL, _("(none)"), wxDefaultPosition, wxSize(85, -1), m_outlineLevelCtrlStrings, wxCB_READONLY );
251 m_outlineLevelCtrl->SetStringSelection(_("(none)"));
4d6d8bf4 252 m_outlineLevelCtrl->SetHelpText(_("The outline level."));
6103234e 253 if (wxRichTextIndentsSpacingPage::ShowToolTips())
4d6d8bf4 254 m_outlineLevelCtrl->SetToolTip(_("The outline level."));
41d9dcbc 255 itemFlexGridSizer22->Add(m_outlineLevelCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3
JS
256
257 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
258
41d9dcbc
JS
259 wxStaticLine* itemStaticLine32 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
260 itemBoxSizer4->Add(itemStaticLine32, 0, wxGROW|wxTOP|wxBOTTOM, 5);
97ff49b3
JS
261
262 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
263
41d9dcbc
JS
264 wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL);
265 itemBoxSizer4->Add(itemBoxSizer34, 0, wxGROW, 5);
97ff49b3 266
41d9dcbc
JS
267 wxStaticText* itemStaticText35 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Spacing (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 );
268 itemBoxSizer34->Add(itemStaticText35, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
97ff49b3 269
41d9dcbc
JS
270 wxBoxSizer* itemBoxSizer36 = new wxBoxSizer(wxHORIZONTAL);
271 itemBoxSizer34->Add(itemBoxSizer36, 0, wxALIGN_LEFT|wxALL, 5);
97ff49b3 272
41d9dcbc 273 itemBoxSizer36->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
97ff49b3 274
41d9dcbc
JS
275 wxFlexGridSizer* itemFlexGridSizer38 = new wxFlexGridSizer(30, 2, 0, 0);
276 itemBoxSizer36->Add(itemFlexGridSizer38, 0, wxALIGN_CENTER_VERTICAL, 5);
97ff49b3 277
41d9dcbc
JS
278 wxStaticText* itemStaticText39 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
279 itemFlexGridSizer38->Add(itemStaticText39, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 280
603f702b 281 m_spacingBefore = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 282 m_spacingBefore->SetHelpText(_("The spacing before the paragraph."));
6103234e 283 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 284 m_spacingBefore->SetToolTip(_("The spacing before the paragraph."));
41d9dcbc 285 itemFlexGridSizer38->Add(m_spacingBefore, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 286
41d9dcbc
JS
287 wxStaticText* itemStaticText41 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
288 itemFlexGridSizer38->Add(itemStaticText41, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 289
603f702b 290 m_spacingAfter = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
6103234e 291 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 292 m_spacingAfter->SetToolTip(_("The spacing after the paragraph."));
41d9dcbc 293 itemFlexGridSizer38->Add(m_spacingAfter, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 294
41d9dcbc
JS
295 wxStaticText* itemStaticText43 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("L&ine spacing:"), wxDefaultPosition, wxDefaultSize, 0 );
296 itemFlexGridSizer38->Add(itemStaticText43, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 297
6103234e 298 wxArrayString m_spacingLineStrings;
41d9dcbc 299 m_spacingLineStrings.Add(_("(none)"));
6103234e 300 m_spacingLineStrings.Add(_("Single"));
02aa812c
JS
301 m_spacingLineStrings.Add(_("1.1"));
302 m_spacingLineStrings.Add(_("1.2"));
303 m_spacingLineStrings.Add(_("1.3"));
304 m_spacingLineStrings.Add(_("1.4"));
6103234e 305 m_spacingLineStrings.Add(_("1.5"));
02aa812c
JS
306 m_spacingLineStrings.Add(_("1.6"));
307 m_spacingLineStrings.Add(_("1.7"));
308 m_spacingLineStrings.Add(_("1.8"));
309 m_spacingLineStrings.Add(_("1.9"));
6103234e 310 m_spacingLineStrings.Add(_("2"));
41d9dcbc
JS
311 m_spacingLine = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE, _("(none)"), wxDefaultPosition, wxSize(85, -1), m_spacingLineStrings, wxCB_READONLY );
312 m_spacingLine->SetStringSelection(_("(none)"));
dadd4f55 313 m_spacingLine->SetHelpText(_("The line spacing."));
6103234e 314 if (wxRichTextIndentsSpacingPage::ShowToolTips())
dadd4f55 315 m_spacingLine->SetToolTip(_("The line spacing."));
41d9dcbc 316 itemFlexGridSizer38->Add(m_spacingLine, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 317
4c7d9d88
JS
318 m_pageBreakCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_PAGEBREAK, _("&Page Break"), wxDefaultPosition, wxDefaultSize, 0 );
319 m_pageBreakCtrl->SetValue(false);
320 m_pageBreakCtrl->SetHelpText(_("Inserts a page break before the paragraph."));
321 if (wxRichTextIndentsSpacingPage::ShowToolTips())
322 m_pageBreakCtrl->SetToolTip(_("Inserts a page break before the paragraph."));
323 itemBoxSizer34->Add(m_pageBreakCtrl, 0, wxALIGN_LEFT|wxALL, 5);
324
2fce6547 325 itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
97ff49b3 326
603f702b 327 m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 100), wxVSCROLL|wxTE_READONLY );
97ff49b3 328 m_previewCtrl->SetHelpText(_("Shows a preview of the paragraph settings."));
6103234e 329 if (wxRichTextIndentsSpacingPage::ShowToolTips())
97ff49b3 330 m_previewCtrl->SetToolTip(_("Shows a preview of the paragraph settings."));
2fce6547 331 itemBoxSizer3->Add(m_previewCtrl, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
97ff49b3
JS
332
333////@end wxRichTextIndentsSpacingPage content construction
334}
335
24777478 336wxRichTextAttr* wxRichTextIndentsSpacingPage::GetAttributes()
97ff49b3
JS
337{
338 return wxRichTextFormattingDialog::GetDialogAttributes(this);
339}
340
341/// Updates the font preview
342void wxRichTextIndentsSpacingPage::UpdatePreview()
343{
344 static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
2a94806c 345Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.\n");
97ff49b3 346
2a94806c
JS
347 static const wxChar* s_para2 = wxT("Duis pharetra consequat dui. Cum sociis natoque penatibus \
348et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum.\n");
97ff49b3 349
2a94806c 350 static const wxChar* s_para3 = wxT("Integer convallis dolor at augue \
97ff49b3
JS
351iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
352
353 TransferDataFromWindow();
24777478 354 wxRichTextAttr attr(*GetAttributes());
97ff49b3
JS
355 attr.SetFlags(attr.GetFlags() &
356 (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
357 wxTEXT_ATTR_LINE_SPACING|
d2d0adc7 358 wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT));
97ff49b3
JS
359
360 wxFont font(m_previewCtrl->GetFont());
361 font.SetPointSize(9);
362 m_previewCtrl->SetFont(font);
363
24777478 364 wxRichTextAttr normalParaAttr;
dadd4f55
JS
365 normalParaAttr.SetFont(font);
366 normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
97ff49b3 367
dadd4f55 368 m_previewCtrl->Freeze();
97ff49b3
JS
369 m_previewCtrl->Clear();
370
dadd4f55 371 m_previewCtrl->BeginStyle(normalParaAttr);
97ff49b3 372 m_previewCtrl->WriteText(s_para1);
dadd4f55
JS
373 m_previewCtrl->EndStyle();
374
97ff49b3
JS
375 m_previewCtrl->BeginStyle(attr);
376 m_previewCtrl->WriteText(s_para2);
377 m_previewCtrl->EndStyle();
dadd4f55
JS
378
379 m_previewCtrl->BeginStyle(normalParaAttr);
97ff49b3 380 m_previewCtrl->WriteText(s_para3);
dadd4f55
JS
381 m_previewCtrl->EndStyle();
382
383 m_previewCtrl->Thaw();
97ff49b3
JS
384}
385
386/// Transfer data from/to window
387bool wxRichTextIndentsSpacingPage::TransferDataFromWindow()
388{
389 wxPanel::TransferDataFromWindow();
390
24777478 391 wxRichTextAttr* attr = GetAttributes();
97ff49b3
JS
392
393 if (m_alignmentLeft->GetValue())
394 attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT);
395 else if (m_alignmentCentred->GetValue())
396 attr->SetAlignment(wxTEXT_ALIGNMENT_CENTRE);
397 else if (m_alignmentRight->GetValue())
398 attr->SetAlignment(wxTEXT_ALIGNMENT_RIGHT);
399 else if (m_alignmentJustified->GetValue())
400 attr->SetAlignment(wxTEXT_ALIGNMENT_JUSTIFIED);
401 else
402 {
403 attr->SetAlignment(wxTEXT_ALIGNMENT_DEFAULT);
404 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_ALIGNMENT));
405 }
406
407 wxString leftIndent(m_indentLeft->GetValue());
408 wxString leftFirstIndent(m_indentLeftFirst->GetValue());
6607ee15 409 if (!leftIndent.empty() || !leftFirstIndent.empty())
97ff49b3 410 {
6607ee15
JS
411 int visualLeftIndent = 0;
412 if (!leftIndent.empty())
413 visualLeftIndent = wxAtoi(leftIndent);
414
97ff49b3
JS
415 int visualLeftFirstIndent = wxAtoi(leftFirstIndent);
416 int actualLeftIndent = visualLeftFirstIndent;
417 int actualLeftSubIndent = visualLeftIndent - visualLeftFirstIndent;
418
419 attr->SetLeftIndent(actualLeftIndent, actualLeftSubIndent);
420 }
421 else
422 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LEFT_INDENT));
423
424 wxString rightIndent(m_indentRight->GetValue());
b68603d5 425 if (!rightIndent.empty())
97ff49b3
JS
426 attr->SetRightIndent(wxAtoi(rightIndent));
427 else
428 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_RIGHT_INDENT));
429
430 wxString spacingAfter(m_spacingAfter->GetValue());
b68603d5 431 if (!spacingAfter.empty())
97ff49b3
JS
432 attr->SetParagraphSpacingAfter(wxAtoi(spacingAfter));
433 else
434 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_AFTER));
435
436 wxString spacingBefore(m_spacingBefore->GetValue());
b68603d5 437 if (!spacingBefore.empty())
97ff49b3
JS
438 attr->SetParagraphSpacingBefore(wxAtoi(spacingBefore));
439 else
440 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_BEFORE));
441
41d9dcbc 442 int spacingIndex = m_spacingLine->GetSelection() - 1;
97ff49b3 443 int lineSpacing = 0;
41d9dcbc 444 if (spacingIndex > -1)
02aa812c 445 lineSpacing = 10 + spacingIndex;
97ff49b3
JS
446
447 if (lineSpacing == 0)
448 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING));
449 else
450 attr->SetLineSpacing(lineSpacing);
44cc96a8 451
4d6d8bf4 452 int outlineLevel = m_outlineLevelCtrl->GetSelection();
41d9dcbc
JS
453 if (outlineLevel == wxNOT_FOUND || outlineLevel == 0)
454 {
455 attr->SetOutlineLevel(-1);
456 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_OUTLINE_LEVEL));
457 }
458 else
459 attr->SetOutlineLevel(outlineLevel-1);
97ff49b3 460
4c7d9d88
JS
461 attr->SetPageBreak(m_pageBreakCtrl->GetValue());
462
97ff49b3
JS
463 return true;
464}
465
466bool wxRichTextIndentsSpacingPage::TransferDataToWindow()
467{
468 m_dontUpdate = true;
469
470 wxPanel::TransferDataToWindow();
471
24777478 472 wxRichTextAttr* attr = GetAttributes();
97ff49b3
JS
473
474 if (attr->HasAlignment())
475 {
476 if (attr->GetAlignment() == wxTEXT_ALIGNMENT_LEFT)
477 m_alignmentLeft->SetValue(true);
478 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
479 m_alignmentRight->SetValue(true);
480 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
481 m_alignmentCentred->SetValue(true);
482 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED)
483 m_alignmentJustified->SetValue(true);
484 else
485 m_alignmentIndeterminate->SetValue(true);
486 }
487 else
488 m_alignmentIndeterminate->SetValue(true);
489
490 if (attr->HasLeftIndent())
491 {
e79322ef
VZ
492 wxString leftIndent(wxString::Format(wxT("%ld"), attr->GetLeftIndent() + attr->GetLeftSubIndent()));
493 wxString leftFirstIndent(wxString::Format(wxT("%ld"), attr->GetLeftIndent()));
97ff49b3
JS
494
495 m_indentLeft->SetValue(leftIndent);
496 m_indentLeftFirst->SetValue(leftFirstIndent);
497 }
498 else
499 {
500 m_indentLeft->SetValue(wxEmptyString);
501 m_indentLeftFirst->SetValue(wxEmptyString);
502 }
503
504 if (attr->HasRightIndent())
505 {
e79322ef 506 wxString rightIndent(wxString::Format(wxT("%ld"), attr->GetRightIndent()));
97ff49b3
JS
507
508 m_indentRight->SetValue(rightIndent);
509 }
510 else
511 m_indentRight->SetValue(wxEmptyString);
512
513 if (attr->HasParagraphSpacingAfter())
514 {
515 wxString spacingAfter(wxString::Format(wxT("%d"), attr->GetParagraphSpacingAfter()));
516
517 m_spacingAfter->SetValue(spacingAfter);
518 }
519 else
520 m_spacingAfter->SetValue(wxEmptyString);
521
522 if (attr->HasParagraphSpacingBefore())
523 {
524 wxString spacingBefore(wxString::Format(wxT("%d"), attr->GetParagraphSpacingBefore()));
525
526 m_spacingBefore->SetValue(spacingBefore);
527 }
528 else
529 m_spacingBefore->SetValue(wxEmptyString);
530
531 if (attr->HasLineSpacing())
532 {
533 int index = 0;
534
535 int lineSpacing = attr->GetLineSpacing();
02aa812c 536 if (lineSpacing >= 10 && lineSpacing <= 20)
41d9dcbc 537 index = (lineSpacing - 10) + 1;
97ff49b3 538 else
41d9dcbc 539 index = 0;
97ff49b3
JS
540
541 m_spacingLine->SetSelection(index);
542 }
543 else
41d9dcbc 544 m_spacingLine->SetSelection(0);
97ff49b3 545
4d6d8bf4
JS
546 if (attr->HasOutlineLevel())
547 {
548 int outlineLevel = attr->GetOutlineLevel();
549 if (outlineLevel < 0)
550 outlineLevel = 0;
551 if (outlineLevel > 9)
44cc96a8 552 outlineLevel = 9;
4d6d8bf4 553
41d9dcbc 554 m_outlineLevelCtrl->SetSelection(outlineLevel+1);
4d6d8bf4
JS
555 }
556 else
41d9dcbc 557 m_outlineLevelCtrl->SetSelection(0);
4d6d8bf4 558
4c7d9d88
JS
559 m_pageBreakCtrl->SetValue(attr->HasPageBreak());
560
97ff49b3
JS
561 UpdatePreview();
562
563 m_dontUpdate = false;
564
565 return true;
566}
567
568
569/*!
570 * Should we show tooltips?
571 */
572
573bool wxRichTextIndentsSpacingPage::ShowToolTips()
574{
dadd4f55 575 return wxRichTextFormattingDialog::ShowToolTips();
97ff49b3
JS
576}
577
578/*!
579 * Get bitmap resources
580 */
581
582wxBitmap wxRichTextIndentsSpacingPage::GetBitmapResource( const wxString& name )
583{
584 // Bitmap retrieval
585////@begin wxRichTextIndentsSpacingPage bitmap retrieval
586 wxUnusedVar(name);
587 return wxNullBitmap;
588////@end wxRichTextIndentsSpacingPage bitmap retrieval
589}
590
591/*!
592 * Get icon resources
593 */
594
595wxIcon wxRichTextIndentsSpacingPage::GetIconResource( const wxString& name )
596{
597 // Icon retrieval
598////@begin wxRichTextIndentsSpacingPage icon retrieval
599 wxUnusedVar(name);
600 return wxNullIcon;
601////@end wxRichTextIndentsSpacingPage icon retrieval
602}
603/*!
604 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT
605 */
606
607void wxRichTextIndentsSpacingPage::OnAlignmentLeftSelected( wxCommandEvent& WXUNUSED(event) )
608{
609 if (!m_dontUpdate)
610 UpdatePreview();
611}
612
613
614/*!
615 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT
616 */
617
618void wxRichTextIndentsSpacingPage::OnAlignmentRightSelected( wxCommandEvent& WXUNUSED(event) )
619{
620 if (!m_dontUpdate)
621 UpdatePreview();
622}
623
624
625/*!
626 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED
627 */
628
629void wxRichTextIndentsSpacingPage::OnAlignmentJustifiedSelected( wxCommandEvent& WXUNUSED(event) )
630{
631 if (!m_dontUpdate)
632 UpdatePreview();
633}
634
635
636/*!
637 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED
638 */
639
640void wxRichTextIndentsSpacingPage::OnAlignmentCentredSelected( wxCommandEvent& WXUNUSED(event) )
641{
642 if (!m_dontUpdate)
643 UpdatePreview();
644}
645
646
647/*!
648 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE
649 */
650
651void wxRichTextIndentsSpacingPage::OnAlignmentIndeterminateSelected( wxCommandEvent& WXUNUSED(event) )
652{
653 if (!m_dontUpdate)
654 UpdatePreview();
655}
656
657
658/*!
659 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT
660 */
661
662void wxRichTextIndentsSpacingPage::OnIndentLeftUpdated( wxCommandEvent& WXUNUSED(event) )
663{
664 if (!m_dontUpdate)
665 UpdatePreview();
666}
667
668
669/*!
670 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST
671 */
672
673void wxRichTextIndentsSpacingPage::OnIndentLeftFirstUpdated( wxCommandEvent& WXUNUSED(event) )
674{
675 if (!m_dontUpdate)
676 UpdatePreview();
677}
678
679
680/*!
681 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT
682 */
683
684void wxRichTextIndentsSpacingPage::OnIndentRightUpdated( wxCommandEvent& WXUNUSED(event) )
685{
686 if (!m_dontUpdate)
687 UpdatePreview();
688}
689
690
691/*!
692 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE
693 */
694
695void wxRichTextIndentsSpacingPage::OnSpacingBeforeUpdated( wxCommandEvent& WXUNUSED(event) )
696{
697 if (!m_dontUpdate)
698 UpdatePreview();
699}
700
701
702/*!
703 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER
704 */
705
706void wxRichTextIndentsSpacingPage::OnSpacingAfterUpdated( wxCommandEvent& WXUNUSED(event) )
707{
708 if (!m_dontUpdate)
709 UpdatePreview();
710}
711
712/*!
713 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE
714 */
715
716void wxRichTextIndentsSpacingPage::OnSpacingLineSelected( wxCommandEvent& WXUNUSED(event) )
717{
718 if (!m_dontUpdate)
719 UpdatePreview();
720}
721
4d6d8bf4
JS
722/*!
723 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL
724 */
725
726void wxRichTextIndentsSpacingPage::OnRichtextOutlinelevelSelected( wxCommandEvent& WXUNUSED(event) )
727{
728 if (!m_dontUpdate)
729 UpdatePreview();
730}
731
b68603d5 732#endif // wxUSE_RICHTEXT