]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtextsizepage.cpp
Disable wxUSE_ENH_METAFILE for wxGTK builds.
[wxWidgets.git] / src / richtext / richtextsizepage.cpp
CommitLineData
603f702b 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/richtext/richtextsizepage.cpp
4e63bfb9 3// Purpose:
603f702b 4// Author: Julian Smart
4e63bfb9 5// Modified by:
603f702b 6// Created: 20/10/2010 10:23:24
4e63bfb9 7// RCS-ID:
603f702b 8// Copyright: (c) Julian Smart
4e63bfb9 9// Licence:
603f702b
JS
10/////////////////////////////////////////////////////////////////////////////
11
603f702b
JS
12#include "wx/richtext/richtextsizepage.h"
13
14////@begin XPM images
15////@end XPM images
16
17
18/*!
19 * wxRichTextSizePage type definition
20 */
21
22IMPLEMENT_DYNAMIC_CLASS( wxRichTextSizePage, wxRichTextDialogPage )
23
24
25/*!
26 * wxRichTextSizePage event table definition
27 */
28
29BEGIN_EVENT_TABLE( wxRichTextSizePage, wxRichTextDialogPage )
30
31////@begin wxRichTextSizePage event table entries
d87098c0 32 EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate )
603f702b 33 EVT_UPDATE_UI( ID_RICHTEXT_WIDTH, wxRichTextSizePage::OnRichtextWidthUpdate )
507a6cd6 34 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W, wxRichTextSizePage::OnRichtextWidthUnitsUpdate )
603f702b 35 EVT_UPDATE_UI( ID_RICHTEXT_HEIGHT, wxRichTextSizePage::OnRichtextHeightUpdate )
507a6cd6 36 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H, wxRichTextSizePage::OnRichtextHeightUnitsUpdate )
303f0be7 37 EVT_UPDATE_UI( ID_RICHTEXT_MIN_WIDTH, wxRichTextSizePage::OnRichtextMinWidthUpdate )
303f0be7 38 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_W, wxRichTextSizePage::OnRichtextMinWidthUpdate )
303f0be7 39 EVT_UPDATE_UI( ID_RICHTEXT_MIN_HEIGHT, wxRichTextSizePage::OnRichtextMinHeightUpdate )
303f0be7 40 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_H, wxRichTextSizePage::OnRichtextMinHeightUpdate )
303f0be7 41 EVT_UPDATE_UI( ID_RICHTEXT_MAX_WIDTH, wxRichTextSizePage::OnRichtextMaxWidthUpdate )
303f0be7 42 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_W, wxRichTextSizePage::OnRichtextMaxWidthUpdate )
303f0be7 43 EVT_UPDATE_UI( ID_RICHTEXT_MAX_HEIGHT, wxRichTextSizePage::OnRichtextMaxHeightUpdate )
303f0be7 44 EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_H, wxRichTextSizePage::OnRichtextMaxHeightUpdate )
d87098c0 45 EVT_UPDATE_UI( ID_RICHTEXT_LEFT, wxRichTextSizePage::OnRichtextLeftUpdate )
507a6cd6 46 EVT_UPDATE_UI( ID_RICHTEXT_LEFT_UNITS, wxRichTextSizePage::OnRichtextLeftUnitsUpdate )
d87098c0 47 EVT_UPDATE_UI( ID_RICHTEXT_TOP, wxRichTextSizePage::OnRichtextTopUpdate )
507a6cd6 48 EVT_UPDATE_UI( ID_RICHTEXT_TOP_UNITS, wxRichTextSizePage::OnRichtextTopUnitsUpdate )
d87098c0 49 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT, wxRichTextSizePage::OnRichtextRightUpdate )
507a6cd6 50 EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_UNITS, wxRichTextSizePage::OnRichtextRightUnitsUpdate )
d87098c0 51 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM, wxRichTextSizePage::OnRichtextBottomUpdate )
507a6cd6 52 EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_UNITS, wxRichTextSizePage::OnRichtextBottomUnitsUpdate )
603f702b 53 EVT_BUTTON( ID_RICHTEXT_PARA_UP, wxRichTextSizePage::OnRichtextParaUpClick )
603f702b 54 EVT_BUTTON( ID_RICHTEXT_PARA_DOWN, wxRichTextSizePage::OnRichtextParaDownClick )
603f702b
JS
55////@end wxRichTextSizePage event table entries
56
57END_EVENT_TABLE()
58
59IMPLEMENT_HELP_PROVISION(wxRichTextSizePage)
60
17e0cd88 61bool wxRichTextSizePage::sm_showFloatingControls = true;
507a6cd6 62bool wxRichTextSizePage::sm_showMinMaxSizeControls = true;
17e0cd88
JS
63bool wxRichTextSizePage::sm_showPositionControls = true;
64bool wxRichTextSizePage::sm_showPositionModeControls = true;
65bool wxRichTextSizePage::sm_showRightBottomPositionControls = true;
66bool wxRichTextSizePage::sm_showAlignmentControls = true;
67bool wxRichTextSizePage::sm_showFloatingAndAlignmentControls = true;
507a6cd6
JS
68bool wxRichTextSizePage::sm_enablePositionAndSizeUnits = true;
69bool wxRichTextSizePage::sm_enablePositionAndSizeCheckboxes = true;
17e0cd88 70
603f702b
JS
71/*!
72 * wxRichTextSizePage constructors
73 */
74
75wxRichTextSizePage::wxRichTextSizePage()
76{
77 Init();
78}
79
80wxRichTextSizePage::wxRichTextSizePage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
81{
82 Init();
83 Create(parent, id, pos, size, style);
84}
85
86
87/*!
88 * wxRichTextSizePage creator
89 */
90
91bool wxRichTextSizePage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
92{
93////@begin wxRichTextSizePage creation
94 wxRichTextDialogPage::Create( parent, id, pos, size, style );
95
96 CreateControls();
97 if (GetSizer())
98 {
99 GetSizer()->SetSizeHints(this);
100 }
101 Centre();
102////@end wxRichTextSizePage creation
103 return true;
104}
105
106
107/*!
108 * wxRichTextSizePage destructor
109 */
110
111wxRichTextSizePage::~wxRichTextSizePage()
112{
17e0cd88
JS
113 sm_showFloatingControls = true;
114 sm_showPositionControls = true;
115 sm_showPositionModeControls = true;
116 sm_showRightBottomPositionControls = true;
117 sm_showAlignmentControls = true;
118 sm_showFloatingAndAlignmentControls = true;
507a6cd6
JS
119 sm_showMinMaxSizeControls = true;
120 sm_showMinMaxSizeControls = true;
121 sm_enablePositionAndSizeCheckboxes = true;
17e0cd88 122
603f702b
JS
123////@begin wxRichTextSizePage destruction
124////@end wxRichTextSizePage destruction
125}
126
127
128/*!
129 * Member initialisation
130 */
131
132void wxRichTextSizePage::Init()
133{
134////@begin wxRichTextSizePage member initialisation
d87098c0 135 m_positionMode = 0;
603f702b 136 m_parentSizer = NULL;
404b319a
JS
137 m_floatingAlignmentSizer = NULL;
138 m_floatingSizer = NULL;
603f702b 139 m_float = NULL;
404b319a 140 m_alignmentSizer = NULL;
d87098c0
JS
141 m_verticalAlignmentCheckbox = NULL;
142 m_verticalAlignmentComboBox = NULL;
507a6cd6
JS
143 m_sizeSizer = NULL;
144 m_widthSizer = NULL;
603f702b 145 m_widthCheckbox = NULL;
507a6cd6 146 m_widthLabel = NULL;
603f702b
JS
147 m_width = NULL;
148 m_unitsW = NULL;
507a6cd6 149 m_heightSizer = NULL;
603f702b 150 m_heightCheckbox = NULL;
507a6cd6 151 m_heightLabel = NULL;
603f702b
JS
152 m_height = NULL;
153 m_unitsH = NULL;
303f0be7 154 m_minWidthCheckbox = NULL;
507a6cd6 155 m_minWidthSizer = NULL;
303f0be7
JS
156 m_minWidth = NULL;
157 m_unitsMinW = NULL;
158 m_minHeightCheckbox = NULL;
507a6cd6 159 m_minHeightSizer = NULL;
303f0be7
JS
160 m_minHeight = NULL;
161 m_unitsMinH = NULL;
162 m_maxWidthCheckbox = NULL;
507a6cd6 163 m_maxWidthSizer = NULL;
303f0be7
JS
164 m_maxWidth = NULL;
165 m_unitsMaxW = NULL;
166 m_maxHeightCheckbox = NULL;
507a6cd6 167 m_maxHeightSizer = NULL;
303f0be7
JS
168 m_maxHeight = NULL;
169 m_unitsMaxH = NULL;
603f702b
JS
170 m_positionControls = NULL;
171 m_moveObjectParentSizer = NULL;
404b319a 172 m_positionModeSizer = NULL;
d87098c0 173 m_positionModeCtrl = NULL;
404b319a 174 m_positionGridSizer = NULL;
507a6cd6 175 m_leftSizer = NULL;
d87098c0 176 m_positionLeftCheckbox = NULL;
507a6cd6 177 m_leftLabel = NULL;
d87098c0
JS
178 m_left = NULL;
179 m_unitsLeft = NULL;
507a6cd6 180 m_topSizer = NULL;
d87098c0 181 m_positionTopCheckbox = NULL;
507a6cd6 182 m_topLabel = NULL;
d87098c0
JS
183 m_top = NULL;
184 m_unitsTop = NULL;
507a6cd6 185 m_rightSizer = NULL;
d87098c0 186 m_positionRightCheckbox = NULL;
507a6cd6 187 m_rightLabel = NULL;
404b319a 188 m_rightPositionSizer = NULL;
d87098c0
JS
189 m_right = NULL;
190 m_unitsRight = NULL;
507a6cd6 191 m_bottomSizer = NULL;
d87098c0 192 m_positionBottomCheckbox = NULL;
507a6cd6 193 m_bottomLabel = NULL;
404b319a 194 m_bottomPositionSizer = NULL;
d87098c0
JS
195 m_bottom = NULL;
196 m_unitsBottom = NULL;
603f702b
JS
197 m_moveObjectSizer = NULL;
198////@end wxRichTextSizePage member initialisation
199}
200
201
202/*!
203 * Control creation for wxRichTextSizePage
204 */
205
206void wxRichTextSizePage::CreateControls()
4e63bfb9 207{
603f702b
JS
208////@begin wxRichTextSizePage content construction
209 wxRichTextSizePage* itemRichTextDialogPage1 = this;
210
211 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
212 itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
213
214 m_parentSizer = new wxBoxSizer(wxVERTICAL);
215 itemBoxSizer2->Add(m_parentSizer, 0, wxGROW|wxALL, 5);
216
404b319a
JS
217 m_floatingAlignmentSizer = new wxBoxSizer(wxHORIZONTAL);
218 m_parentSizer->Add(m_floatingAlignmentSizer, 0, wxGROW, 5);
d87098c0 219
404b319a 220 m_floatingSizer = new wxBoxSizer(wxVERTICAL);
17e0cd88 221 m_floatingAlignmentSizer->Add(m_floatingSizer, 0, wxALIGN_CENTER_VERTICAL, 5);
603f702b 222
d87098c0 223 wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
404b319a 224 m_floatingSizer->Add(itemBoxSizer6, 0, wxGROW, 5);
603f702b 225
d87098c0
JS
226 wxStaticText* itemStaticText7 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Floating"), wxDefaultPosition, wxDefaultSize, 0 );
227 itemStaticText7->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT("")));
228 itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 229
d87098c0
JS
230 wxStaticLine* itemStaticLine8 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
231 itemBoxSizer6->Add(itemStaticLine8, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 232
d87098c0 233 wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
404b319a 234 m_floatingSizer->Add(itemBoxSizer9, 0, wxGROW, 5);
603f702b 235
d87098c0 236 itemBoxSizer9->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 237
d87098c0
JS
238 wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(0, 2, 0, 0);
239 itemBoxSizer9->Add(itemFlexGridSizer11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5);
603f702b 240
d87098c0
JS
241 wxStaticText* itemStaticText12 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Floating mode:"), wxDefaultPosition, wxDefaultSize, 0 );
242 itemFlexGridSizer11->Add(itemStaticText12, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b
JS
243
244 wxArrayString m_floatStrings;
245 m_floatStrings.Add(_("None"));
246 m_floatStrings.Add(_("Left"));
247 m_floatStrings.Add(_("Right"));
17e0cd88 248 m_float = new wxChoice( itemRichTextDialogPage1, ID_RICHTEXT_FLOATING_MODE, wxDefaultPosition, wxSize(80, -1), m_floatStrings, 0 );
603f702b
JS
249 m_float->SetStringSelection(_("None"));
250 m_float->SetHelpText(_("How the object will float relative to the text."));
251 if (wxRichTextSizePage::ShowToolTips())
252 m_float->SetToolTip(_("How the object will float relative to the text."));
d87098c0 253 itemFlexGridSizer11->Add(m_float, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 254
17e0cd88
JS
255 m_floatingAlignmentSizer->Add(0, 0, 1, wxALIGN_CENTER_VERTICAL, 5);
256
404b319a 257 m_alignmentSizer = new wxBoxSizer(wxVERTICAL);
17e0cd88 258 m_floatingAlignmentSizer->Add(m_alignmentSizer, 0, wxALIGN_CENTER_VERTICAL, 5);
603f702b 259
17e0cd88
JS
260 wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL);
261 m_alignmentSizer->Add(itemBoxSizer16, 0, wxGROW, 5);
603f702b 262
17e0cd88
JS
263 wxStaticText* itemStaticText17 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Alignment"), wxDefaultPosition, wxDefaultSize, 0 );
264 itemStaticText17->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT("")));
265 itemBoxSizer16->Add(itemStaticText17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 266
17e0cd88
JS
267 wxStaticLine* itemStaticLine18 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
268 itemBoxSizer16->Add(itemStaticLine18, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 269
17e0cd88
JS
270 wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxHORIZONTAL);
271 m_alignmentSizer->Add(itemBoxSizer19, 0, wxGROW, 5);
603f702b 272
17e0cd88 273 itemBoxSizer19->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
d87098c0
JS
274
275 m_verticalAlignmentCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX, _("&Vertical alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
276 m_verticalAlignmentCheckbox->SetValue(false);
277 m_verticalAlignmentCheckbox->SetHelpText(_("Enable vertical alignment."));
278 if (wxRichTextSizePage::ShowToolTips())
279 m_verticalAlignmentCheckbox->SetToolTip(_("Enable vertical alignment."));
17e0cd88 280 itemBoxSizer19->Add(m_verticalAlignmentCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
d87098c0
JS
281
282 wxArrayString m_verticalAlignmentComboBoxStrings;
283 m_verticalAlignmentComboBoxStrings.Add(_("Top"));
284 m_verticalAlignmentComboBoxStrings.Add(_("Centred"));
285 m_verticalAlignmentComboBoxStrings.Add(_("Bottom"));
17e0cd88 286 m_verticalAlignmentComboBox = new wxChoice( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, wxDefaultPosition, wxDefaultSize, m_verticalAlignmentComboBoxStrings, 0 );
d87098c0
JS
287 m_verticalAlignmentComboBox->SetStringSelection(_("Top"));
288 m_verticalAlignmentComboBox->SetHelpText(_("Vertical alignment."));
289 if (wxRichTextSizePage::ShowToolTips())
290 m_verticalAlignmentComboBox->SetToolTip(_("Vertical alignment."));
17e0cd88 291 itemBoxSizer19->Add(m_verticalAlignmentComboBox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
d87098c0 292
17e0cd88
JS
293 wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL);
294 m_parentSizer->Add(itemBoxSizer23, 0, wxGROW, 5);
d87098c0 295
17e0cd88
JS
296 wxStaticText* itemStaticText24 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
297 itemStaticText24->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT("")));
298 itemBoxSizer23->Add(itemStaticText24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
d87098c0 299
17e0cd88
JS
300 wxStaticLine* itemStaticLine25 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
301 itemBoxSizer23->Add(itemStaticLine25, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
d87098c0 302
17e0cd88
JS
303 wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxHORIZONTAL);
304 m_parentSizer->Add(itemBoxSizer26, 0, wxGROW, 5);
d87098c0 305
17e0cd88 306 itemBoxSizer26->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
d87098c0 307
507a6cd6
JS
308 m_sizeSizer = new wxFlexGridSizer(0, 4, 0, 0);
309 itemBoxSizer26->Add(m_sizeSizer, 0, wxALIGN_CENTER_VERTICAL, 5);
310
311 m_widthSizer = new wxBoxSizer(wxHORIZONTAL);
312 m_sizeSizer->Add(m_widthSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
603f702b
JS
313
314 m_widthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_WIDTH_CHECKBOX, _("&Width:"), wxDefaultPosition, wxDefaultSize, 0 );
315 m_widthCheckbox->SetValue(false);
316 m_widthCheckbox->SetHelpText(_("Enable the width value."));
317 if (wxRichTextSizePage::ShowToolTips())
318 m_widthCheckbox->SetToolTip(_("Enable the width value."));
507a6cd6
JS
319 m_widthSizer->Add(m_widthCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
320
321 m_widthLabel = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Width:"), wxDefaultPosition, wxDefaultSize, 0 );
322 m_widthLabel->Show(false);
323 m_widthSizer->Add(m_widthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 324
507a6cd6
JS
325 wxBoxSizer* itemBoxSizer32 = new wxBoxSizer(wxHORIZONTAL);
326 m_sizeSizer->Add(itemBoxSizer32, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
603f702b 327
303f0be7 328 m_width = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
603f702b
JS
329 m_width->SetHelpText(_("The object width."));
330 if (wxRichTextSizePage::ShowToolTips())
331 m_width->SetToolTip(_("The object width."));
507a6cd6 332 itemBoxSizer32->Add(m_width, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
603f702b
JS
333
334 wxArrayString m_unitsWStrings;
335 m_unitsWStrings.Add(_("px"));
336 m_unitsWStrings.Add(_("cm"));
706465df 337 m_unitsWStrings.Add(_("percent"));
603f702b
JS
338 m_unitsW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsWStrings, wxCB_READONLY );
339 m_unitsW->SetStringSelection(_("px"));
340 m_unitsW->SetHelpText(_("Units for the object width."));
341 if (wxRichTextSizePage::ShowToolTips())
342 m_unitsW->SetToolTip(_("Units for the object width."));
507a6cd6
JS
343 itemBoxSizer32->Add(m_unitsW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
344
345 m_heightSizer = new wxBoxSizer(wxHORIZONTAL);
346 m_sizeSizer->Add(m_heightSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
603f702b
JS
347
348 m_heightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_HEIGHT_CHECKBOX, _("&Height:"), wxDefaultPosition, wxDefaultSize, 0 );
349 m_heightCheckbox->SetValue(false);
350 m_heightCheckbox->SetHelpText(_("Enable the height value."));
351 if (wxRichTextSizePage::ShowToolTips())
352 m_heightCheckbox->SetToolTip(_("Enable the height value."));
507a6cd6 353 m_heightSizer->Add(m_heightCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
603f702b 354
507a6cd6
JS
355 m_heightLabel = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Height:"), wxDefaultPosition, wxDefaultSize, 0 );
356 m_heightLabel->Show(false);
357 m_heightSizer->Add(m_heightLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
358
359 wxBoxSizer* itemBoxSizer38 = new wxBoxSizer(wxHORIZONTAL);
360 m_sizeSizer->Add(itemBoxSizer38, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
603f702b 361
303f0be7 362 m_height = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
603f702b
JS
363 m_height->SetHelpText(_("The object height."));
364 if (wxRichTextSizePage::ShowToolTips())
365 m_height->SetToolTip(_("The object height."));
507a6cd6 366 itemBoxSizer38->Add(m_height, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
603f702b
JS
367
368 wxArrayString m_unitsHStrings;
369 m_unitsHStrings.Add(_("px"));
370 m_unitsHStrings.Add(_("cm"));
706465df 371 m_unitsHStrings.Add(_("percent"));
603f702b
JS
372 m_unitsH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsHStrings, wxCB_READONLY );
373 m_unitsH->SetStringSelection(_("px"));
374 m_unitsH->SetHelpText(_("Units for the object height."));
375 if (wxRichTextSizePage::ShowToolTips())
376 m_unitsH->SetToolTip(_("Units for the object height."));
507a6cd6 377 itemBoxSizer38->Add(m_unitsH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 378
303f0be7
JS
379 m_minWidthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MIN_WIDTH_CHECKBOX, _("Min width:"), wxDefaultPosition, wxDefaultSize, 0 );
380 m_minWidthCheckbox->SetValue(false);
381 m_minWidthCheckbox->SetHelpText(_("Enable the minimum width value."));
382 if (wxRichTextSizePage::ShowToolTips())
383 m_minWidthCheckbox->SetToolTip(_("Enable the minimum width value."));
507a6cd6 384 m_sizeSizer->Add(m_minWidthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
303f0be7 385
507a6cd6
JS
386 m_minWidthSizer = new wxBoxSizer(wxHORIZONTAL);
387 m_sizeSizer->Add(m_minWidthSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
303f0be7
JS
388
389 m_minWidth = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MIN_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
390 m_minWidth->SetHelpText(_("The object minimum width."));
391 if (wxRichTextSizePage::ShowToolTips())
392 m_minWidth->SetToolTip(_("The object minimum width."));
507a6cd6 393 m_minWidthSizer->Add(m_minWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
303f0be7
JS
394
395 wxArrayString m_unitsMinWStrings;
396 m_unitsMinWStrings.Add(_("px"));
397 m_unitsMinWStrings.Add(_("cm"));
398 m_unitsMinWStrings.Add(_("percent"));
399 m_unitsMinW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MIN_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMinWStrings, wxCB_READONLY );
400 m_unitsMinW->SetStringSelection(_("px"));
401 m_unitsMinW->SetHelpText(_("Units for the minimum object width."));
402 if (wxRichTextSizePage::ShowToolTips())
403 m_unitsMinW->SetToolTip(_("Units for the minimum object width."));
507a6cd6 404 m_minWidthSizer->Add(m_unitsMinW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
303f0be7
JS
405
406 m_minHeightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MIN_HEIGHT_CHECKBOX, _("Min height:"), wxDefaultPosition, wxDefaultSize, 0 );
407 m_minHeightCheckbox->SetValue(false);
408 m_minHeightCheckbox->SetHelpText(_("Enable the minimum height value."));
409 if (wxRichTextSizePage::ShowToolTips())
410 m_minHeightCheckbox->SetToolTip(_("Enable the minimum height value."));
507a6cd6 411 m_sizeSizer->Add(m_minHeightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
303f0be7 412
507a6cd6
JS
413 m_minHeightSizer = new wxBoxSizer(wxHORIZONTAL);
414 m_sizeSizer->Add(m_minHeightSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
303f0be7
JS
415
416 m_minHeight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MIN_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
a1d6c5df 417 m_minHeight->SetHelpText(_("The object minimum height."));
303f0be7 418 if (wxRichTextSizePage::ShowToolTips())
a1d6c5df 419 m_minHeight->SetToolTip(_("The object minimum height."));
507a6cd6 420 m_minHeightSizer->Add(m_minHeight, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
303f0be7
JS
421
422 wxArrayString m_unitsMinHStrings;
423 m_unitsMinHStrings.Add(_("px"));
424 m_unitsMinHStrings.Add(_("cm"));
425 m_unitsMinHStrings.Add(_("percent"));
426 m_unitsMinH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MIN_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMinHStrings, wxCB_READONLY );
427 m_unitsMinH->SetStringSelection(_("px"));
428 m_unitsMinH->SetHelpText(_("Units for the minimum object height."));
429 if (wxRichTextSizePage::ShowToolTips())
430 m_unitsMinH->SetToolTip(_("Units for the minimum object height."));
507a6cd6 431 m_minHeightSizer->Add(m_unitsMinH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
303f0be7
JS
432
433 m_maxWidthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MAX_WIDTH_CHECKBOX, _("Max width:"), wxDefaultPosition, wxDefaultSize, 0 );
434 m_maxWidthCheckbox->SetValue(false);
435 m_maxWidthCheckbox->SetHelpText(_("Enable the maximum width value."));
436 if (wxRichTextSizePage::ShowToolTips())
437 m_maxWidthCheckbox->SetToolTip(_("Enable the maximum width value."));
507a6cd6 438 m_sizeSizer->Add(m_maxWidthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
303f0be7 439
507a6cd6
JS
440 m_maxWidthSizer = new wxBoxSizer(wxHORIZONTAL);
441 m_sizeSizer->Add(m_maxWidthSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
303f0be7
JS
442
443 m_maxWidth = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MAX_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
444 m_maxWidth->SetHelpText(_("The object maximum width."));
445 if (wxRichTextSizePage::ShowToolTips())
446 m_maxWidth->SetToolTip(_("The object maximum width."));
507a6cd6 447 m_maxWidthSizer->Add(m_maxWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
303f0be7
JS
448
449 wxArrayString m_unitsMaxWStrings;
450 m_unitsMaxWStrings.Add(_("px"));
451 m_unitsMaxWStrings.Add(_("cm"));
452 m_unitsMaxWStrings.Add(_("percent"));
453 m_unitsMaxW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MAX_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMaxWStrings, wxCB_READONLY );
454 m_unitsMaxW->SetStringSelection(_("px"));
455 m_unitsMaxW->SetHelpText(_("Units for the maximum object width."));
456 if (wxRichTextSizePage::ShowToolTips())
457 m_unitsMaxW->SetToolTip(_("Units for the maximum object width."));
507a6cd6 458 m_maxWidthSizer->Add(m_unitsMaxW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
303f0be7
JS
459
460 m_maxHeightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MAX_HEIGHT_CHECKBOX, _("Max height:"), wxDefaultPosition, wxDefaultSize, 0 );
461 m_maxHeightCheckbox->SetValue(false);
462 m_maxHeightCheckbox->SetHelpText(_("Enable the height value."));
463 if (wxRichTextSizePage::ShowToolTips())
464 m_maxHeightCheckbox->SetToolTip(_("Enable the height value."));
507a6cd6 465 m_sizeSizer->Add(m_maxHeightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
303f0be7 466
507a6cd6
JS
467 m_maxHeightSizer = new wxBoxSizer(wxHORIZONTAL);
468 m_sizeSizer->Add(m_maxHeightSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
303f0be7
JS
469
470 m_maxHeight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MAX_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
471 m_maxHeight->SetHelpText(_("The object maximum height."));
472 if (wxRichTextSizePage::ShowToolTips())
473 m_maxHeight->SetToolTip(_("The object maximum height."));
507a6cd6 474 m_maxHeightSizer->Add(m_maxHeight, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
303f0be7
JS
475
476 wxArrayString m_unitsMaxHStrings;
477 m_unitsMaxHStrings.Add(_("px"));
478 m_unitsMaxHStrings.Add(_("cm"));
479 m_unitsMaxHStrings.Add(_("percent"));
480 m_unitsMaxH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MAX_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMaxHStrings, wxCB_READONLY );
481 m_unitsMaxH->SetStringSelection(_("px"));
482 m_unitsMaxH->SetHelpText(_("Units for the maximum object height."));
483 if (wxRichTextSizePage::ShowToolTips())
484 m_unitsMaxH->SetToolTip(_("Units for the maximum object height."));
507a6cd6 485 m_maxHeightSizer->Add(m_unitsMaxH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
303f0be7 486
d87098c0
JS
487 m_positionControls = new wxBoxSizer(wxVERTICAL);
488 m_parentSizer->Add(m_positionControls, 0, wxGROW, 5);
603f702b 489
507a6cd6
JS
490 wxBoxSizer* itemBoxSizer58 = new wxBoxSizer(wxHORIZONTAL);
491 m_positionControls->Add(itemBoxSizer58, 0, wxGROW, 5);
603f702b 492
507a6cd6
JS
493 wxStaticText* itemStaticText59 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Position"), wxDefaultPosition, wxDefaultSize, 0 );
494 itemStaticText59->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT("")));
495 itemBoxSizer58->Add(itemStaticText59, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 496
507a6cd6
JS
497 wxStaticLine* itemStaticLine60 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
498 itemBoxSizer58->Add(itemStaticLine60, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 499
507a6cd6
JS
500 wxBoxSizer* itemBoxSizer61 = new wxBoxSizer(wxHORIZONTAL);
501 m_positionControls->Add(itemBoxSizer61, 0, wxGROW, 5);
603f702b 502
507a6cd6 503 itemBoxSizer61->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 504
d87098c0 505 m_moveObjectParentSizer = new wxBoxSizer(wxVERTICAL);
507a6cd6 506 itemBoxSizer61->Add(m_moveObjectParentSizer, 0, wxALIGN_TOP, 5);
603f702b 507
404b319a
JS
508 m_positionModeSizer = new wxBoxSizer(wxHORIZONTAL);
509 m_moveObjectParentSizer->Add(m_positionModeSizer, 0, wxALIGN_LEFT, 5);
603f702b 510
507a6cd6
JS
511 wxStaticText* itemStaticText65 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Position mode:"), wxDefaultPosition, wxDefaultSize, 0 );
512 m_positionModeSizer->Add(itemStaticText65, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 513
d87098c0
JS
514 wxArrayString m_positionModeCtrlStrings;
515 m_positionModeCtrlStrings.Add(_("Static"));
516 m_positionModeCtrlStrings.Add(_("Relative"));
517 m_positionModeCtrlStrings.Add(_("Absolute"));
518 m_positionModeCtrlStrings.Add(_("Fixed"));
507a6cd6 519 m_positionModeCtrl = new wxChoice( itemRichTextDialogPage1, ID_RICHTEXT_POSITION_MODE, wxDefaultPosition, wxDefaultSize, m_positionModeCtrlStrings, 0 );
d87098c0 520 m_positionModeCtrl->SetStringSelection(_("Static"));
404b319a 521 m_positionModeSizer->Add(m_positionModeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 522
404b319a
JS
523 m_positionGridSizer = new wxFlexGridSizer(0, 4, 0, 0);
524 m_moveObjectParentSizer->Add(m_positionGridSizer, 0, wxGROW, 5);
603f702b 525
507a6cd6
JS
526 m_leftSizer = new wxBoxSizer(wxHORIZONTAL);
527 m_positionGridSizer->Add(m_leftSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
528
d87098c0
JS
529 m_positionLeftCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_LEFT_CHECKBOX, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 );
530 m_positionLeftCheckbox->SetValue(false);
531 m_positionLeftCheckbox->SetHelpText(_("The left position."));
532 if (wxRichTextSizePage::ShowToolTips())
533 m_positionLeftCheckbox->SetToolTip(_("The left position."));
507a6cd6
JS
534 m_leftSizer->Add(m_positionLeftCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
535
536 m_leftLabel = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 );
537 m_leftLabel->Show(false);
538 m_leftSizer->Add(m_leftLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 539
507a6cd6
JS
540 wxBoxSizer* itemBoxSizer71 = new wxBoxSizer(wxHORIZONTAL);
541 m_positionGridSizer->Add(itemBoxSizer71, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
603f702b 542
d87098c0
JS
543 m_left = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_LEFT, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
544 m_left->SetMaxLength(10);
545 m_left->SetHelpText(_("The left position."));
546 if (wxRichTextSizePage::ShowToolTips())
547 m_left->SetToolTip(_("The left position."));
507a6cd6 548 itemBoxSizer71->Add(m_left, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
d87098c0
JS
549
550 wxArrayString m_unitsLeftStrings;
551 m_unitsLeftStrings.Add(_("px"));
552 m_unitsLeftStrings.Add(_("cm"));
553 m_unitsLeftStrings.Add(_("percent"));
554 m_unitsLeft = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_LEFT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsLeftStrings, wxCB_READONLY );
555 m_unitsLeft->SetStringSelection(_("px"));
556 m_unitsLeft->SetHelpText(_("Units for the left position."));
557 if (wxRichTextSizePage::ShowToolTips())
558 m_unitsLeft->SetToolTip(_("Units for the left position."));
507a6cd6
JS
559 itemBoxSizer71->Add(m_unitsLeft, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
560
561 m_topSizer = new wxBoxSizer(wxHORIZONTAL);
562 m_positionGridSizer->Add(m_topSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
603f702b 563
d87098c0
JS
564 m_positionTopCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_TOP_CHECKBOX, _("&Top:"), wxDefaultPosition, wxDefaultSize, 0 );
565 m_positionTopCheckbox->SetValue(false);
566 m_positionTopCheckbox->SetHelpText(_("The top position."));
567 if (wxRichTextSizePage::ShowToolTips())
568 m_positionTopCheckbox->SetToolTip(_("The top position."));
507a6cd6
JS
569 m_topSizer->Add(m_positionTopCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
570
571 m_topLabel = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Top:"), wxDefaultPosition, wxDefaultSize, 0 );
572 m_topLabel->Show(false);
573 m_topSizer->Add(m_topLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 574
507a6cd6
JS
575 wxBoxSizer* itemBoxSizer77 = new wxBoxSizer(wxHORIZONTAL);
576 m_positionGridSizer->Add(itemBoxSizer77, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
d87098c0
JS
577
578 m_top = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_TOP, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
579 m_top->SetMaxLength(10);
580 m_top->SetHelpText(_("The top position."));
581 if (wxRichTextSizePage::ShowToolTips())
582 m_top->SetToolTip(_("The top position."));
507a6cd6 583 itemBoxSizer77->Add(m_top, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
d87098c0
JS
584
585 wxArrayString m_unitsTopStrings;
586 m_unitsTopStrings.Add(_("px"));
587 m_unitsTopStrings.Add(_("cm"));
588 m_unitsTopStrings.Add(_("percent"));
589 m_unitsTop = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_TOP_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsTopStrings, wxCB_READONLY );
590 m_unitsTop->SetStringSelection(_("px"));
591 m_unitsTop->SetHelpText(_("Units for the top position."));
592 if (wxRichTextSizePage::ShowToolTips())
593 m_unitsTop->SetToolTip(_("Units for the top position."));
507a6cd6
JS
594 itemBoxSizer77->Add(m_unitsTop, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
595
596 m_rightSizer = new wxBoxSizer(wxHORIZONTAL);
597 m_positionGridSizer->Add(m_rightSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
603f702b 598
d87098c0
JS
599 m_positionRightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_RIGHT_CHECKBOX, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 );
600 m_positionRightCheckbox->SetValue(false);
601 m_positionRightCheckbox->SetHelpText(_("The right position."));
603f702b 602 if (wxRichTextSizePage::ShowToolTips())
d87098c0 603 m_positionRightCheckbox->SetToolTip(_("The right position."));
507a6cd6
JS
604 m_rightSizer->Add(m_positionRightCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
605
606 m_rightLabel = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 );
607 m_rightLabel->Show(false);
608 m_rightSizer->Add(m_rightLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
d87098c0 609
404b319a
JS
610 m_rightPositionSizer = new wxBoxSizer(wxHORIZONTAL);
611 m_positionGridSizer->Add(m_rightPositionSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
603f702b 612
d87098c0
JS
613 m_right = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
614 m_right->SetMaxLength(10);
615 m_right->SetHelpText(_("The right position."));
603f702b 616 if (wxRichTextSizePage::ShowToolTips())
d87098c0 617 m_right->SetToolTip(_("The right position."));
404b319a 618 m_rightPositionSizer->Add(m_right, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
d87098c0
JS
619
620 wxArrayString m_unitsRightStrings;
621 m_unitsRightStrings.Add(_("px"));
622 m_unitsRightStrings.Add(_("cm"));
623 m_unitsRightStrings.Add(_("percent"));
624 m_unitsRight = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_RIGHT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsRightStrings, wxCB_READONLY );
625 m_unitsRight->SetStringSelection(_("px"));
626 m_unitsRight->SetHelpText(_("Units for the right position."));
627 if (wxRichTextSizePage::ShowToolTips())
628 m_unitsRight->SetToolTip(_("Units for the right position."));
404b319a 629 m_rightPositionSizer->Add(m_unitsRight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 630
507a6cd6
JS
631 m_bottomSizer = new wxBoxSizer(wxHORIZONTAL);
632 m_positionGridSizer->Add(m_bottomSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
633
d87098c0
JS
634 m_positionBottomCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_BOTTOM_CHECKBOX, _("&Bottom:"), wxDefaultPosition, wxDefaultSize, 0 );
635 m_positionBottomCheckbox->SetValue(false);
636 m_positionBottomCheckbox->SetHelpText(_("The bottom position."));
603f702b 637 if (wxRichTextSizePage::ShowToolTips())
d87098c0 638 m_positionBottomCheckbox->SetToolTip(_("The bottom position."));
507a6cd6
JS
639 m_bottomSizer->Add(m_positionBottomCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
640
641 m_bottomLabel = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Bottom:"), wxDefaultPosition, wxDefaultSize, 0 );
642 m_bottomLabel->Show(false);
643 m_bottomSizer->Add(m_bottomLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
d87098c0 644
404b319a
JS
645 m_bottomPositionSizer = new wxBoxSizer(wxHORIZONTAL);
646 m_positionGridSizer->Add(m_bottomPositionSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
d87098c0
JS
647
648 m_bottom = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_BOTTOM, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
649 m_bottom->SetMaxLength(10);
650 m_bottom->SetHelpText(_("The bottom position."));
651 if (wxRichTextSizePage::ShowToolTips())
652 m_bottom->SetToolTip(_("The bottom position."));
404b319a 653 m_bottomPositionSizer->Add(m_bottom, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
d87098c0
JS
654
655 wxArrayString m_unitsBottomStrings;
656 m_unitsBottomStrings.Add(_("px"));
657 m_unitsBottomStrings.Add(_("cm"));
658 m_unitsBottomStrings.Add(_("percent"));
659 m_unitsBottom = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_BOTTOM_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsBottomStrings, wxCB_READONLY );
660 m_unitsBottom->SetStringSelection(_("px"));
661 m_unitsBottom->SetHelpText(_("Units for the bottom position."));
662 if (wxRichTextSizePage::ShowToolTips())
663 m_unitsBottom->SetToolTip(_("Units for the bottom position."));
404b319a 664 m_bottomPositionSizer->Add(m_unitsBottom, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b
JS
665
666 m_moveObjectSizer = new wxBoxSizer(wxHORIZONTAL);
667 m_moveObjectParentSizer->Add(m_moveObjectSizer, 0, wxGROW, 5);
668
507a6cd6
JS
669 wxStaticText* itemStaticText93 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Move the object to:"), wxDefaultPosition, wxDefaultSize, 0 );
670 m_moveObjectSizer->Add(itemStaticText93, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 671
507a6cd6
JS
672 wxButton* itemButton94 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXT_PARA_UP, _("&Previous Paragraph"), wxDefaultPosition, wxDefaultSize, 0 );
673 itemButton94->SetHelpText(_("Moves the object to the previous paragraph."));
603f702b 674 if (wxRichTextSizePage::ShowToolTips())
507a6cd6
JS
675 itemButton94->SetToolTip(_("Moves the object to the previous paragraph."));
676 m_moveObjectSizer->Add(itemButton94, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
603f702b 677
507a6cd6
JS
678 wxButton* itemButton95 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXT_PARA_DOWN, _("&Next Paragraph"), wxDefaultPosition, wxDefaultSize, 0 );
679 itemButton95->SetHelpText(_("Moves the object to the next paragraph."));
603f702b 680 if (wxRichTextSizePage::ShowToolTips())
507a6cd6
JS
681 itemButton95->SetToolTip(_("Moves the object to the next paragraph."));
682 m_moveObjectSizer->Add(itemButton95, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
603f702b 683
d87098c0
JS
684 // Set validators
685 m_positionModeCtrl->SetValidator( wxGenericValidator(& m_positionMode) );
603f702b 686////@end wxRichTextSizePage content construction
17e0cd88 687
507a6cd6
JS
688 if (!sm_enablePositionAndSizeCheckboxes)
689 {
690 m_widthSizer->Show(m_widthCheckbox, false);
691 m_widthSizer->Show(m_widthLabel, true);
692 m_heightSizer->Show(m_heightCheckbox, false);
693 m_heightSizer->Show(m_heightLabel, true);
694
695 m_leftSizer->Show(m_positionLeftCheckbox, false);
696 m_leftSizer->Show(m_leftLabel, true);
697 m_topSizer->Show(m_positionTopCheckbox, false);
698 m_topSizer->Show(m_topLabel, true);
699
700 if (sm_showRightBottomPositionControls)
701 {
702 m_rightSizer->Show(m_positionRightCheckbox, false);
703 m_rightSizer->Show(m_rightLabel, true);
704 m_bottomSizer->Show(m_positionBottomCheckbox, false);
705 m_bottomSizer->Show(m_bottomLabel, true);
706 }
707 }
708
17e0cd88
JS
709 if (!sm_showFloatingAndAlignmentControls)
710 m_parentSizer->Show(m_floatingAlignmentSizer, false);
711
712 if (!sm_showFloatingControls)
713 m_floatingAlignmentSizer->Show(m_floatingSizer, false);
714
715 if (!sm_showAlignmentControls)
716 m_floatingAlignmentSizer->Show(m_alignmentSizer, false);
717
718 if (!sm_showPositionControls)
719 m_parentSizer->Show(m_positionControls, false);
507a6cd6
JS
720
721 if (!sm_showMinMaxSizeControls)
722 {
723 m_sizeSizer->Show(m_minWidthCheckbox, false);
724 m_sizeSizer->Show(m_minWidthSizer, false);
725 m_sizeSizer->Show(m_minHeightCheckbox, false);
726 m_sizeSizer->Show(m_minHeightSizer, false);
727 m_sizeSizer->Show(m_maxWidthCheckbox, false);
728 m_sizeSizer->Show(m_maxWidthSizer, false);
729 m_sizeSizer->Show(m_maxHeightCheckbox, false);
730 m_sizeSizer->Show(m_maxHeightSizer, false);
731 }
17e0cd88
JS
732
733 if (!sm_showRightBottomPositionControls)
734 {
507a6cd6 735 m_positionGridSizer->Show(m_rightSizer, false);
17e0cd88 736 m_positionGridSizer->Show(m_rightPositionSizer, false);
507a6cd6 737 m_positionGridSizer->Show(m_bottomSizer, false);
17e0cd88
JS
738 m_positionGridSizer->Show(m_bottomPositionSizer, false);
739 }
740
741 if (!sm_showPositionModeControls)
742 m_moveObjectParentSizer->Show(m_positionModeSizer, false);
603f702b
JS
743}
744
745wxRichTextAttr* wxRichTextSizePage::GetAttributes()
746{
747 return wxRichTextFormattingDialog::GetDialogAttributes(this);
748}
749
750/*!
751 * Should we show tooltips?
752 */
753
754bool wxRichTextSizePage::ShowToolTips()
755{
756 return true;
757}
758
759bool wxRichTextSizePage::TransferDataToWindow()
760{
761 m_float->SetSelection(GetAttributes()->GetTextBoxAttr().GetFloatMode());
762 m_verticalAlignmentCheckbox->SetValue(GetAttributes()->GetTextBoxAttr().HasVerticalAlignment());
763 if (GetAttributes()->GetTextBoxAttr().HasVerticalAlignment())
764 {
765 if ((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() > 0 &&
766 (int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() < 4)
767 {
768 m_verticalAlignmentComboBox->SetSelection(((int) GetAttributes()->GetTextBoxAttr().GetVerticalAlignment() - 1));
769 }
770 else
771 m_verticalAlignmentComboBox->SetSelection(0);
772 }
773
774 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
775
776 if (dialog)
777 {
778 // Only show the Move Object controls if there's an object.
779 if (!dialog->GetObject())
780 {
781 m_moveObjectParentSizer->Show(m_moveObjectSizer, false);
782 GetSizer()->Layout();
783 }
784 }
785
23698b12
JS
786 wxRichTextImage* imageObj = NULL;
787 if (dialog)
788 imageObj = wxDynamicCast(dialog->GetObject(), wxRichTextImage);
789
790 // For an image, show the original width and height if the size is not explicitly specified.
791 if (imageObj && !GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() && !GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() &&
792 imageObj->GetOriginalImageSize() != wxSize(-1, -1))
603f702b 793 {
23698b12
JS
794 m_widthCheckbox->SetValue(false);
795 m_heightCheckbox->SetValue(false);
796 m_unitsW->SetSelection(0);
797 m_unitsH->SetSelection(0);
798 m_width->SetValue(wxString::Format(wxT("%d"), (int) imageObj->GetOriginalImageSize().GetWidth()));
799 m_height->SetValue(wxString::Format(wxT("%d"), (int) imageObj->GetOriginalImageSize().GetHeight()));
800 }
801 else
802 {
803 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox);
804 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox);
603f702b
JS
805 }
806
303f0be7
JS
807 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth, m_unitsMinW, m_minWidthCheckbox);
808 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight, m_unitsMinH, m_minHeightCheckbox);
809 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth, m_unitsMaxW, m_maxWidthCheckbox);
810 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight, m_unitsMaxH, m_maxHeightCheckbox);
507a6cd6 811
d87098c0
JS
812 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetLeft(), m_left, m_unitsLeft, m_positionLeftCheckbox);
813 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_top, m_unitsTop, m_positionTopCheckbox);
814 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetRight(), m_right, m_unitsRight, m_positionRightCheckbox);
815 wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetBottom(), m_bottom, m_unitsBottom, m_positionBottomCheckbox);
816
817 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED) ||
818 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED) ||
819 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED) ||
820 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED))
821 {
822 m_positionMode = 3;
823 }
824 else
825 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE) ||
826 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE) ||
827 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE) ||
828 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE))
829 {
830 m_positionMode = 2;
831 }
832 else
833 if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE) ||
834 (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE) ||
835 (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE) ||
836 (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE))
837 {
838 m_positionMode = 1;
839 }
840 else
841 m_positionMode = 0;
603f702b 842
d87098c0 843 return wxPanel::TransferDataToWindow();
603f702b
JS
844}
845
846bool wxRichTextSizePage::TransferDataFromWindow()
847{
d87098c0
JS
848 wxPanel::TransferDataFromWindow();
849
603f702b
JS
850 GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle) m_float->GetSelection());
851 if (m_float->GetSelection() == 0)
852 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT);
853
854 if (m_verticalAlignmentCheckbox->GetValue())
855 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment((wxTextBoxAttrVerticalAlignment) (m_verticalAlignmentComboBox->GetSelection() + 1));
856 else
857 {
858 GetAttributes()->GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE);
859 GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT);
860 }
861
862 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox);
863 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox);
303f0be7
JS
864 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth, m_unitsMinW, m_minWidthCheckbox);
865 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight, m_unitsMinH, m_minHeightCheckbox);
866 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth, m_unitsMaxW, m_maxWidthCheckbox);
867 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight, m_unitsMaxH, m_maxHeightCheckbox);
d87098c0
JS
868
869 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetLeft(), m_left, m_unitsLeft, m_positionLeftCheckbox);
870 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_top, m_unitsTop, m_positionTopCheckbox);
871 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetRight(), m_right, m_unitsRight, m_positionRightCheckbox);
872 wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetBottom(), m_bottom, m_unitsBottom, m_positionBottomCheckbox);
873
874 wxTextBoxAttrPosition flags;
875 if (m_positionMode == 3)
876 flags = wxTEXT_BOX_ATTR_POSITION_FIXED;
877 else if (m_positionMode == 2)
878 flags = wxTEXT_BOX_ATTR_POSITION_ABSOLUTE;
879 else if (m_positionMode == 1)
880 flags = wxTEXT_BOX_ATTR_POSITION_RELATIVE;
881 else
882 flags = wxTEXT_BOX_ATTR_POSITION_STATIC;
883
884 if (GetAttributes()->GetTextBoxAttr().GetLeft().IsValid())
885 GetAttributes()->GetTextBoxAttr().GetLeft().SetPosition(flags);
886 if (GetAttributes()->GetTextBoxAttr().GetTop().IsValid())
887 GetAttributes()->GetTextBoxAttr().GetTop().SetPosition(flags);
888 if (GetAttributes()->GetTextBoxAttr().GetRight().IsValid())
889 GetAttributes()->GetTextBoxAttr().GetRight().SetPosition(flags);
890 if (GetAttributes()->GetTextBoxAttr().GetBottom().IsValid())
891 GetAttributes()->GetTextBoxAttr().GetBottom().SetPosition(flags);
603f702b
JS
892
893 return true;
894}
895
603f702b
JS
896/*!
897 * Get bitmap resources
898 */
899
900wxBitmap wxRichTextSizePage::GetBitmapResource( const wxString& name )
901{
902 // Bitmap retrieval
903////@begin wxRichTextSizePage bitmap retrieval
904 wxUnusedVar(name);
905 return wxNullBitmap;
906////@end wxRichTextSizePage bitmap retrieval
907}
908
909/*!
910 * Get icon resources
911 */
912
913wxIcon wxRichTextSizePage::GetIconResource( const wxString& name )
914{
915 // Icon retrieval
916////@begin wxRichTextSizePage icon retrieval
917 wxUnusedVar(name);
918 return wxNullIcon;
919////@end wxRichTextSizePage icon retrieval
920}
921
922
923/*!
924 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
925 */
926
927void wxRichTextSizePage::OnRichtextWidthUpdate( wxUpdateUIEvent& event )
928{
929 event.Enable(m_widthCheckbox->GetValue());
930}
931
932/*!
933 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
934 */
935
936void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent& event )
937{
938 event.Enable(m_heightCheckbox->GetValue());
939}
940
603f702b 941/*!
ce7fe42e 942 * wxEVT_BUTTON event handler for ID_RICHTEXT_PARA_UP
603f702b
JS
943 */
944
945void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event) )
946{
947 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
948 if (!dialog || !dialog->GetObject())
949 return;
4e63bfb9 950
603f702b
JS
951 // Make sure object attributes are up-to-date
952 dialog->TransferDataFromWindow();
4e63bfb9 953
603f702b
JS
954 wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer();
955 wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer();
956 wxRichTextObject* parent = dialog->GetObject()->GetParent();
957 if (!container || !parent || !buffer)
958 return;
959
960 wxRichTextRange range = dialog->GetObject()->GetRange();
961 wxRichTextObjectList::compatibility_iterator iter = container->GetChildren().GetFirst();
962 if (!iter)
963 return;
964
965 while (iter)
966 {
967 if (iter->GetData() == parent)
968 break;
969 iter = iter->GetNext();
970 }
971 if (!iter)
972 return;
973 iter = iter->GetPrevious();
974 if (!iter)
975 return;
976
977 wxRichTextObject *obj = iter->GetData();
978 wxRichTextRange rg = obj->GetRange();
979 // tempObj will be deleted along with the undo object, and a clone of it will be
980 // returned by InsertObjectWithUndo
981 wxRichTextObject* tempObj = dialog->GetObject()->Clone();
982
983 container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer);
984
4e63bfb9 985 wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart(), tempObj, buffer->GetRichTextCtrl(), 0);
603f702b
JS
986 dialog->SetObject(obj2);
987}
988
989/*!
ce7fe42e 990 * wxEVT_BUTTON event handler for ID_RICHTEXT_DOWN
603f702b
JS
991 */
992
993void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent& WXUNUSED(event) )
994{
995 wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this);
996 if (!dialog || !dialog->GetObject())
997 return;
4e63bfb9 998
603f702b
JS
999 // Make sure object attributes are up-to-date
1000 dialog->TransferDataFromWindow();
4e63bfb9 1001
603f702b
JS
1002 wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer();
1003 wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer();
1004 wxRichTextObject* parent = dialog->GetObject()->GetParent();
1005 if (!container || !parent || !buffer)
1006 return;
1007
1008 wxRichTextRange range = dialog->GetObject()->GetRange();
1009
1010 wxRichTextObjectList::compatibility_iterator iter = buffer->GetChildren().GetFirst();
1011 if (!iter)
1012 return;
1013
1014 while (iter)
1015 {
1016 if (iter->GetData() == parent)
1017 break;
1018 iter = iter->GetNext();
1019 }
1020
1021 iter = iter->GetNext();
1022 if (!iter)
1023 return;
1024
1025 wxRichTextObject *obj = iter->GetData();
1026 wxRichTextRange rg = obj->GetRange();
1027 // tempObj will be deleted along with the undo object, and a clone of it will be
1028 // returned by InsertObjectWithUndo
1029 wxRichTextObject* tempObj = dialog->GetObject()->Clone();
1030
1031 container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer);
1032
1033 // Minus one because we deleted an object
4e63bfb9 1034 wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart()-1, tempObj, buffer->GetRichTextCtrl(), 0);
603f702b
JS
1035 dialog->SetObject(obj2);
1036}
1037
603f702b
JS
1038/*!
1039 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
1040 */
1041
1042void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event )
1043{
1044 event.Enable(m_verticalAlignmentCheckbox->GetValue());
1045}
1046
303f0be7
JS
1047/*!
1048 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH
1049 */
1050
1051void wxRichTextSizePage::OnRichtextMinWidthUpdate( wxUpdateUIEvent& event )
1052{
1053 event.Enable(m_minWidthCheckbox->GetValue());
1054}
1055
1056/*!
1057 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT
1058 */
1059
1060void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent& event )
1061{
1062 event.Enable(m_minHeightCheckbox->GetValue());
1063}
1064
303f0be7
JS
1065/*!
1066 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH
1067 */
1068
1069void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event )
1070{
1071 event.Enable(m_maxWidthCheckbox->GetValue());
1072}
1073
303f0be7
JS
1074/*!
1075 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT
1076 */
1077
1078void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event )
1079{
1080 event.Enable(m_maxHeightCheckbox->GetValue());
1081}
d87098c0 1082
d87098c0
JS
1083/*!
1084 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT
1085 */
1086
1087void wxRichTextSizePage::OnRichtextLeftUpdate( wxUpdateUIEvent& event )
1088{
1089 event.Enable(m_positionLeftCheckbox->GetValue());
1090}
1091
1092/*!
507a6cd6 1093 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT
d87098c0
JS
1094 */
1095
507a6cd6 1096void wxRichTextSizePage::OnRichtextRightUpdate( wxUpdateUIEvent& event )
d87098c0 1097{
507a6cd6 1098 event.Enable(m_positionRightCheckbox->GetValue());
d87098c0
JS
1099}
1100
1101/*!
507a6cd6 1102 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP
d87098c0
JS
1103 */
1104
507a6cd6 1105void wxRichTextSizePage::OnRichtextTopUpdate( wxUpdateUIEvent& event )
d87098c0 1106{
507a6cd6 1107 event.Enable(m_positionTopCheckbox->GetValue());
d87098c0
JS
1108}
1109
d87098c0
JS
1110/*!
1111 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM
1112 */
1113
1114void wxRichTextSizePage::OnRichtextBottomUpdate( wxUpdateUIEvent& event )
1115{
1116 event.Enable(m_positionBottomCheckbox->GetValue());
1117}
1118
507a6cd6
JS
1119/*!
1120 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH_UNITS
1121 */
1122
1123void wxRichTextSizePage::OnRichtextWidthUnitsUpdate( wxUpdateUIEvent& event )
1124{
1125 event.Enable(m_widthCheckbox->GetValue() && sm_enablePositionAndSizeUnits);
1126}
1127
1128/*!
1129 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT_UNITS
1130 */
1131
1132void wxRichTextSizePage::OnRichtextHeightUnitsUpdate( wxUpdateUIEvent& event )
1133{
1134 event.Enable(m_heightCheckbox->GetValue() && sm_enablePositionAndSizeUnits);
1135}
1136
1137/*!
1138 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS
1139 */
1140
1141void wxRichTextSizePage::OnRichtextLeftUnitsUpdate( wxUpdateUIEvent& event )
1142{
1143 event.Enable(m_positionLeftCheckbox->GetValue() && sm_enablePositionAndSizeUnits);
1144}
1145
1146/*!
1147 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_UNITS
1148 */
1149
1150void wxRichTextSizePage::OnRichtextRightUnitsUpdate( wxUpdateUIEvent& event )
1151{
1152 event.Enable(m_positionRightCheckbox->GetValue() && sm_enablePositionAndSizeUnits);
1153}
1154
1155/*!
1156 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_UNITS
1157 */
1158
1159void wxRichTextSizePage::OnRichtextTopUnitsUpdate( wxUpdateUIEvent& event )
1160{
1161 event.Enable(m_positionTopCheckbox->GetValue() && sm_enablePositionAndSizeUnits);
1162}
1163
1164/*!
1165 * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_UNITS
1166 */
1167
1168void wxRichTextSizePage::OnRichtextBottomUnitsUpdate( wxUpdateUIEvent& event )
1169{
1170 event.Enable(m_positionBottomCheckbox->GetValue() && sm_enablePositionAndSizeUnits);
1171}