]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/richtext/richtextsizepage.cpp | |
3 | // Purpose: | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 20/10/2010 10:23:24 | |
7 | // RCS-ID: | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/richtext/richtextsizepage.h" | |
13 | ||
14 | ////@begin XPM images | |
15 | ////@end XPM images | |
16 | ||
17 | ||
18 | /*! | |
19 | * wxRichTextSizePage type definition | |
20 | */ | |
21 | ||
22 | IMPLEMENT_DYNAMIC_CLASS( wxRichTextSizePage, wxRichTextDialogPage ) | |
23 | ||
24 | ||
25 | /*! | |
26 | * wxRichTextSizePage event table definition | |
27 | */ | |
28 | ||
29 | BEGIN_EVENT_TABLE( wxRichTextSizePage, wxRichTextDialogPage ) | |
30 | ||
31 | ////@begin wxRichTextSizePage event table entries | |
32 | EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate ) | |
33 | EVT_UPDATE_UI( ID_RICHTEXT_WIDTH, wxRichTextSizePage::OnRichtextWidthUpdate ) | |
34 | EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W, wxRichTextSizePage::OnRichtextWidthUnitsUpdate ) | |
35 | EVT_UPDATE_UI( ID_RICHTEXT_HEIGHT, wxRichTextSizePage::OnRichtextHeightUpdate ) | |
36 | EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H, wxRichTextSizePage::OnRichtextHeightUnitsUpdate ) | |
37 | EVT_UPDATE_UI( ID_RICHTEXT_MIN_WIDTH, wxRichTextSizePage::OnRichtextMinWidthUpdate ) | |
38 | EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_W, wxRichTextSizePage::OnRichtextMinWidthUpdate ) | |
39 | EVT_UPDATE_UI( ID_RICHTEXT_MIN_HEIGHT, wxRichTextSizePage::OnRichtextMinHeightUpdate ) | |
40 | EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_H, wxRichTextSizePage::OnRichtextMinHeightUpdate ) | |
41 | EVT_UPDATE_UI( ID_RICHTEXT_MAX_WIDTH, wxRichTextSizePage::OnRichtextMaxWidthUpdate ) | |
42 | EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_W, wxRichTextSizePage::OnRichtextMaxWidthUpdate ) | |
43 | EVT_UPDATE_UI( ID_RICHTEXT_MAX_HEIGHT, wxRichTextSizePage::OnRichtextMaxHeightUpdate ) | |
44 | EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_H, wxRichTextSizePage::OnRichtextMaxHeightUpdate ) | |
45 | EVT_UPDATE_UI( ID_RICHTEXT_LEFT, wxRichTextSizePage::OnRichtextLeftUpdate ) | |
46 | EVT_UPDATE_UI( ID_RICHTEXT_LEFT_UNITS, wxRichTextSizePage::OnRichtextLeftUnitsUpdate ) | |
47 | EVT_UPDATE_UI( ID_RICHTEXT_TOP, wxRichTextSizePage::OnRichtextTopUpdate ) | |
48 | EVT_UPDATE_UI( ID_RICHTEXT_TOP_UNITS, wxRichTextSizePage::OnRichtextTopUnitsUpdate ) | |
49 | EVT_UPDATE_UI( ID_RICHTEXT_RIGHT, wxRichTextSizePage::OnRichtextRightUpdate ) | |
50 | EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_UNITS, wxRichTextSizePage::OnRichtextRightUnitsUpdate ) | |
51 | EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM, wxRichTextSizePage::OnRichtextBottomUpdate ) | |
52 | EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_UNITS, wxRichTextSizePage::OnRichtextBottomUnitsUpdate ) | |
53 | EVT_BUTTON( ID_RICHTEXT_PARA_UP, wxRichTextSizePage::OnRichtextParaUpClick ) | |
54 | EVT_BUTTON( ID_RICHTEXT_PARA_DOWN, wxRichTextSizePage::OnRichtextParaDownClick ) | |
55 | ////@end wxRichTextSizePage event table entries | |
56 | ||
57 | END_EVENT_TABLE() | |
58 | ||
59 | IMPLEMENT_HELP_PROVISION(wxRichTextSizePage) | |
60 | ||
61 | bool wxRichTextSizePage::sm_showFloatingControls = true; | |
62 | bool wxRichTextSizePage::sm_showMinMaxSizeControls = true; | |
63 | bool wxRichTextSizePage::sm_showPositionControls = true; | |
64 | bool wxRichTextSizePage::sm_showPositionModeControls = true; | |
65 | bool wxRichTextSizePage::sm_showRightBottomPositionControls = true; | |
66 | bool wxRichTextSizePage::sm_showAlignmentControls = true; | |
67 | bool wxRichTextSizePage::sm_showFloatingAndAlignmentControls = true; | |
68 | bool wxRichTextSizePage::sm_enablePositionAndSizeUnits = true; | |
69 | bool wxRichTextSizePage::sm_enablePositionAndSizeCheckboxes = true; | |
70 | ||
71 | /*! | |
72 | * wxRichTextSizePage constructors | |
73 | */ | |
74 | ||
75 | wxRichTextSizePage::wxRichTextSizePage() | |
76 | { | |
77 | Init(); | |
78 | } | |
79 | ||
80 | wxRichTextSizePage::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 | ||
91 | bool 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 | ||
111 | wxRichTextSizePage::~wxRichTextSizePage() | |
112 | { | |
113 | sm_showFloatingControls = true; | |
114 | sm_showPositionControls = true; | |
115 | sm_showPositionModeControls = true; | |
116 | sm_showRightBottomPositionControls = true; | |
117 | sm_showAlignmentControls = true; | |
118 | sm_showFloatingAndAlignmentControls = true; | |
119 | sm_showMinMaxSizeControls = true; | |
120 | sm_showMinMaxSizeControls = true; | |
121 | sm_enablePositionAndSizeCheckboxes = true; | |
122 | ||
123 | ////@begin wxRichTextSizePage destruction | |
124 | ////@end wxRichTextSizePage destruction | |
125 | } | |
126 | ||
127 | ||
128 | /*! | |
129 | * Member initialisation | |
130 | */ | |
131 | ||
132 | void wxRichTextSizePage::Init() | |
133 | { | |
134 | ////@begin wxRichTextSizePage member initialisation | |
135 | m_positionMode = 0; | |
136 | m_parentSizer = NULL; | |
137 | m_floatingAlignmentSizer = NULL; | |
138 | m_floatingSizer = NULL; | |
139 | m_float = NULL; | |
140 | m_alignmentSizer = NULL; | |
141 | m_verticalAlignmentCheckbox = NULL; | |
142 | m_verticalAlignmentComboBox = NULL; | |
143 | m_sizeSizer = NULL; | |
144 | m_widthSizer = NULL; | |
145 | m_widthCheckbox = NULL; | |
146 | m_widthLabel = NULL; | |
147 | m_width = NULL; | |
148 | m_unitsW = NULL; | |
149 | m_heightSizer = NULL; | |
150 | m_heightCheckbox = NULL; | |
151 | m_heightLabel = NULL; | |
152 | m_height = NULL; | |
153 | m_unitsH = NULL; | |
154 | m_minWidthCheckbox = NULL; | |
155 | m_minWidthSizer = NULL; | |
156 | m_minWidth = NULL; | |
157 | m_unitsMinW = NULL; | |
158 | m_minHeightCheckbox = NULL; | |
159 | m_minHeightSizer = NULL; | |
160 | m_minHeight = NULL; | |
161 | m_unitsMinH = NULL; | |
162 | m_maxWidthCheckbox = NULL; | |
163 | m_maxWidthSizer = NULL; | |
164 | m_maxWidth = NULL; | |
165 | m_unitsMaxW = NULL; | |
166 | m_maxHeightCheckbox = NULL; | |
167 | m_maxHeightSizer = NULL; | |
168 | m_maxHeight = NULL; | |
169 | m_unitsMaxH = NULL; | |
170 | m_positionControls = NULL; | |
171 | m_moveObjectParentSizer = NULL; | |
172 | m_positionModeSizer = NULL; | |
173 | m_positionModeCtrl = NULL; | |
174 | m_positionGridSizer = NULL; | |
175 | m_leftSizer = NULL; | |
176 | m_positionLeftCheckbox = NULL; | |
177 | m_leftLabel = NULL; | |
178 | m_left = NULL; | |
179 | m_unitsLeft = NULL; | |
180 | m_topSizer = NULL; | |
181 | m_positionTopCheckbox = NULL; | |
182 | m_topLabel = NULL; | |
183 | m_top = NULL; | |
184 | m_unitsTop = NULL; | |
185 | m_rightSizer = NULL; | |
186 | m_positionRightCheckbox = NULL; | |
187 | m_rightLabel = NULL; | |
188 | m_rightPositionSizer = NULL; | |
189 | m_right = NULL; | |
190 | m_unitsRight = NULL; | |
191 | m_bottomSizer = NULL; | |
192 | m_positionBottomCheckbox = NULL; | |
193 | m_bottomLabel = NULL; | |
194 | m_bottomPositionSizer = NULL; | |
195 | m_bottom = NULL; | |
196 | m_unitsBottom = NULL; | |
197 | m_moveObjectSizer = NULL; | |
198 | ////@end wxRichTextSizePage member initialisation | |
199 | } | |
200 | ||
201 | ||
202 | /*! | |
203 | * Control creation for wxRichTextSizePage | |
204 | */ | |
205 | ||
206 | void wxRichTextSizePage::CreateControls() | |
207 | { | |
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 | ||
217 | m_floatingAlignmentSizer = new wxBoxSizer(wxHORIZONTAL); | |
218 | m_parentSizer->Add(m_floatingAlignmentSizer, 0, wxGROW, 5); | |
219 | ||
220 | m_floatingSizer = new wxBoxSizer(wxVERTICAL); | |
221 | m_floatingAlignmentSizer->Add(m_floatingSizer, 0, wxALIGN_CENTER_VERTICAL, 5); | |
222 | ||
223 | wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL); | |
224 | m_floatingSizer->Add(itemBoxSizer6, 0, wxGROW, 5); | |
225 | ||
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); | |
229 | ||
230 | wxStaticLine* itemStaticLine8 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); | |
231 | itemBoxSizer6->Add(itemStaticLine8, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
232 | ||
233 | wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL); | |
234 | m_floatingSizer->Add(itemBoxSizer9, 0, wxGROW, 5); | |
235 | ||
236 | itemBoxSizer9->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
237 | ||
238 | wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(0, 2, 0, 0); | |
239 | itemBoxSizer9->Add(itemFlexGridSizer11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); | |
240 | ||
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); | |
243 | ||
244 | wxArrayString m_floatStrings; | |
245 | m_floatStrings.Add(_("None")); | |
246 | m_floatStrings.Add(_("Left")); | |
247 | m_floatStrings.Add(_("Right")); | |
248 | m_float = new wxChoice( itemRichTextDialogPage1, ID_RICHTEXT_FLOATING_MODE, wxDefaultPosition, wxSize(80, -1), m_floatStrings, 0 ); | |
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.")); | |
253 | itemFlexGridSizer11->Add(m_float, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
254 | ||
255 | m_floatingAlignmentSizer->Add(0, 0, 1, wxALIGN_CENTER_VERTICAL, 5); | |
256 | ||
257 | m_alignmentSizer = new wxBoxSizer(wxVERTICAL); | |
258 | m_floatingAlignmentSizer->Add(m_alignmentSizer, 0, wxALIGN_CENTER_VERTICAL, 5); | |
259 | ||
260 | wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL); | |
261 | m_alignmentSizer->Add(itemBoxSizer16, 0, wxGROW, 5); | |
262 | ||
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); | |
266 | ||
267 | wxStaticLine* itemStaticLine18 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); | |
268 | itemBoxSizer16->Add(itemStaticLine18, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
269 | ||
270 | wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxHORIZONTAL); | |
271 | m_alignmentSizer->Add(itemBoxSizer19, 0, wxGROW, 5); | |
272 | ||
273 | itemBoxSizer19->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
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.")); | |
280 | itemBoxSizer19->Add(m_verticalAlignmentCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
281 | ||
282 | wxArrayString m_verticalAlignmentComboBoxStrings; | |
283 | m_verticalAlignmentComboBoxStrings.Add(_("Top")); | |
284 | m_verticalAlignmentComboBoxStrings.Add(_("Centred")); | |
285 | m_verticalAlignmentComboBoxStrings.Add(_("Bottom")); | |
286 | m_verticalAlignmentComboBox = new wxChoice( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, wxDefaultPosition, wxDefaultSize, m_verticalAlignmentComboBoxStrings, 0 ); | |
287 | m_verticalAlignmentComboBox->SetStringSelection(_("Top")); | |
288 | m_verticalAlignmentComboBox->SetHelpText(_("Vertical alignment.")); | |
289 | if (wxRichTextSizePage::ShowToolTips()) | |
290 | m_verticalAlignmentComboBox->SetToolTip(_("Vertical alignment.")); | |
291 | itemBoxSizer19->Add(m_verticalAlignmentComboBox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
292 | ||
293 | wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL); | |
294 | m_parentSizer->Add(itemBoxSizer23, 0, wxGROW, 5); | |
295 | ||
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); | |
299 | ||
300 | wxStaticLine* itemStaticLine25 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); | |
301 | itemBoxSizer23->Add(itemStaticLine25, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
302 | ||
303 | wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxHORIZONTAL); | |
304 | m_parentSizer->Add(itemBoxSizer26, 0, wxGROW, 5); | |
305 | ||
306 | itemBoxSizer26->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
307 | ||
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); | |
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.")); | |
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); | |
324 | ||
325 | wxBoxSizer* itemBoxSizer32 = new wxBoxSizer(wxHORIZONTAL); | |
326 | m_sizeSizer->Add(itemBoxSizer32, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); | |
327 | ||
328 | m_width = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); | |
329 | m_width->SetHelpText(_("The object width.")); | |
330 | if (wxRichTextSizePage::ShowToolTips()) | |
331 | m_width->SetToolTip(_("The object width.")); | |
332 | itemBoxSizer32->Add(m_width, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
333 | ||
334 | wxArrayString m_unitsWStrings; | |
335 | m_unitsWStrings.Add(_("px")); | |
336 | m_unitsWStrings.Add(_("cm")); | |
337 | m_unitsWStrings.Add(_("percent")); | |
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.")); | |
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); | |
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.")); | |
353 | m_heightSizer->Add(m_heightCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
354 | ||
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); | |
361 | ||
362 | m_height = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); | |
363 | m_height->SetHelpText(_("The object height.")); | |
364 | if (wxRichTextSizePage::ShowToolTips()) | |
365 | m_height->SetToolTip(_("The object height.")); | |
366 | itemBoxSizer38->Add(m_height, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
367 | ||
368 | wxArrayString m_unitsHStrings; | |
369 | m_unitsHStrings.Add(_("px")); | |
370 | m_unitsHStrings.Add(_("cm")); | |
371 | m_unitsHStrings.Add(_("percent")); | |
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.")); | |
377 | itemBoxSizer38->Add(m_unitsH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
378 | ||
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.")); | |
384 | m_sizeSizer->Add(m_minWidthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
385 | ||
386 | m_minWidthSizer = new wxBoxSizer(wxHORIZONTAL); | |
387 | m_sizeSizer->Add(m_minWidthSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); | |
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.")); | |
393 | m_minWidthSizer->Add(m_minWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
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.")); | |
404 | m_minWidthSizer->Add(m_unitsMinW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
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.")); | |
411 | m_sizeSizer->Add(m_minHeightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
412 | ||
413 | m_minHeightSizer = new wxBoxSizer(wxHORIZONTAL); | |
414 | m_sizeSizer->Add(m_minHeightSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); | |
415 | ||
416 | m_minHeight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MIN_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); | |
417 | m_minHeight->SetHelpText(_("The object minimum height.")); | |
418 | if (wxRichTextSizePage::ShowToolTips()) | |
419 | m_minHeight->SetToolTip(_("The object minimum height.")); | |
420 | m_minHeightSizer->Add(m_minHeight, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
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.")); | |
431 | m_minHeightSizer->Add(m_unitsMinH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
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.")); | |
438 | m_sizeSizer->Add(m_maxWidthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
439 | ||
440 | m_maxWidthSizer = new wxBoxSizer(wxHORIZONTAL); | |
441 | m_sizeSizer->Add(m_maxWidthSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); | |
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.")); | |
447 | m_maxWidthSizer->Add(m_maxWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
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.")); | |
458 | m_maxWidthSizer->Add(m_unitsMaxW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
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.")); | |
465 | m_sizeSizer->Add(m_maxHeightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
466 | ||
467 | m_maxHeightSizer = new wxBoxSizer(wxHORIZONTAL); | |
468 | m_sizeSizer->Add(m_maxHeightSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); | |
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.")); | |
474 | m_maxHeightSizer->Add(m_maxHeight, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
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.")); | |
485 | m_maxHeightSizer->Add(m_unitsMaxH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
486 | ||
487 | m_positionControls = new wxBoxSizer(wxVERTICAL); | |
488 | m_parentSizer->Add(m_positionControls, 0, wxGROW, 5); | |
489 | ||
490 | wxBoxSizer* itemBoxSizer58 = new wxBoxSizer(wxHORIZONTAL); | |
491 | m_positionControls->Add(itemBoxSizer58, 0, wxGROW, 5); | |
492 | ||
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); | |
496 | ||
497 | wxStaticLine* itemStaticLine60 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); | |
498 | itemBoxSizer58->Add(itemStaticLine60, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
499 | ||
500 | wxBoxSizer* itemBoxSizer61 = new wxBoxSizer(wxHORIZONTAL); | |
501 | m_positionControls->Add(itemBoxSizer61, 0, wxGROW, 5); | |
502 | ||
503 | itemBoxSizer61->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
504 | ||
505 | m_moveObjectParentSizer = new wxBoxSizer(wxVERTICAL); | |
506 | itemBoxSizer61->Add(m_moveObjectParentSizer, 0, wxALIGN_TOP, 5); | |
507 | ||
508 | m_positionModeSizer = new wxBoxSizer(wxHORIZONTAL); | |
509 | m_moveObjectParentSizer->Add(m_positionModeSizer, 0, wxALIGN_LEFT, 5); | |
510 | ||
511 | wxStaticText* itemStaticText65 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Position mode:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
512 | m_positionModeSizer->Add(itemStaticText65, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
513 | ||
514 | wxArrayString m_positionModeCtrlStrings; | |
515 | m_positionModeCtrlStrings.Add(_("Static")); | |
516 | m_positionModeCtrlStrings.Add(_("Relative")); | |
517 | m_positionModeCtrlStrings.Add(_("Absolute")); | |
518 | m_positionModeCtrlStrings.Add(_("Fixed")); | |
519 | m_positionModeCtrl = new wxChoice( itemRichTextDialogPage1, ID_RICHTEXT_POSITION_MODE, wxDefaultPosition, wxDefaultSize, m_positionModeCtrlStrings, 0 ); | |
520 | m_positionModeCtrl->SetStringSelection(_("Static")); | |
521 | m_positionModeSizer->Add(m_positionModeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
522 | ||
523 | m_positionGridSizer = new wxFlexGridSizer(0, 4, 0, 0); | |
524 | m_moveObjectParentSizer->Add(m_positionGridSizer, 0, wxGROW, 5); | |
525 | ||
526 | m_leftSizer = new wxBoxSizer(wxHORIZONTAL); | |
527 | m_positionGridSizer->Add(m_leftSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); | |
528 | ||
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.")); | |
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); | |
539 | ||
540 | wxBoxSizer* itemBoxSizer71 = new wxBoxSizer(wxHORIZONTAL); | |
541 | m_positionGridSizer->Add(itemBoxSizer71, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); | |
542 | ||
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.")); | |
548 | itemBoxSizer71->Add(m_left, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
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.")); | |
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); | |
563 | ||
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.")); | |
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); | |
574 | ||
575 | wxBoxSizer* itemBoxSizer77 = new wxBoxSizer(wxHORIZONTAL); | |
576 | m_positionGridSizer->Add(itemBoxSizer77, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); | |
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.")); | |
583 | itemBoxSizer77->Add(m_top, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
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.")); | |
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); | |
598 | ||
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.")); | |
602 | if (wxRichTextSizePage::ShowToolTips()) | |
603 | m_positionRightCheckbox->SetToolTip(_("The right position.")); | |
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); | |
609 | ||
610 | m_rightPositionSizer = new wxBoxSizer(wxHORIZONTAL); | |
611 | m_positionGridSizer->Add(m_rightPositionSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); | |
612 | ||
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.")); | |
616 | if (wxRichTextSizePage::ShowToolTips()) | |
617 | m_right->SetToolTip(_("The right position.")); | |
618 | m_rightPositionSizer->Add(m_right, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
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.")); | |
629 | m_rightPositionSizer->Add(m_unitsRight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
630 | ||
631 | m_bottomSizer = new wxBoxSizer(wxHORIZONTAL); | |
632 | m_positionGridSizer->Add(m_bottomSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); | |
633 | ||
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.")); | |
637 | if (wxRichTextSizePage::ShowToolTips()) | |
638 | m_positionBottomCheckbox->SetToolTip(_("The bottom position.")); | |
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); | |
644 | ||
645 | m_bottomPositionSizer = new wxBoxSizer(wxHORIZONTAL); | |
646 | m_positionGridSizer->Add(m_bottomPositionSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); | |
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.")); | |
653 | m_bottomPositionSizer->Add(m_bottom, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | |
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.")); | |
664 | m_bottomPositionSizer->Add(m_unitsBottom, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
665 | ||
666 | m_moveObjectSizer = new wxBoxSizer(wxHORIZONTAL); | |
667 | m_moveObjectParentSizer->Add(m_moveObjectSizer, 0, wxGROW, 5); | |
668 | ||
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); | |
671 | ||
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.")); | |
674 | if (wxRichTextSizePage::ShowToolTips()) | |
675 | itemButton94->SetToolTip(_("Moves the object to the previous paragraph.")); | |
676 | m_moveObjectSizer->Add(itemButton94, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
677 | ||
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.")); | |
680 | if (wxRichTextSizePage::ShowToolTips()) | |
681 | itemButton95->SetToolTip(_("Moves the object to the next paragraph.")); | |
682 | m_moveObjectSizer->Add(itemButton95, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5); | |
683 | ||
684 | // Set validators | |
685 | m_positionModeCtrl->SetValidator( wxGenericValidator(& m_positionMode) ); | |
686 | ////@end wxRichTextSizePage content construction | |
687 | ||
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 | ||
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); | |
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 | } | |
732 | ||
733 | if (!sm_showRightBottomPositionControls) | |
734 | { | |
735 | m_positionGridSizer->Show(m_rightSizer, false); | |
736 | m_positionGridSizer->Show(m_rightPositionSizer, false); | |
737 | m_positionGridSizer->Show(m_bottomSizer, false); | |
738 | m_positionGridSizer->Show(m_bottomPositionSizer, false); | |
739 | } | |
740 | ||
741 | if (!sm_showPositionModeControls) | |
742 | m_moveObjectParentSizer->Show(m_positionModeSizer, false); | |
743 | } | |
744 | ||
745 | wxRichTextAttr* wxRichTextSizePage::GetAttributes() | |
746 | { | |
747 | return wxRichTextFormattingDialog::GetDialogAttributes(this); | |
748 | } | |
749 | ||
750 | /*! | |
751 | * Should we show tooltips? | |
752 | */ | |
753 | ||
754 | bool wxRichTextSizePage::ShowToolTips() | |
755 | { | |
756 | return true; | |
757 | } | |
758 | ||
759 | bool 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 | ||
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)) | |
793 | { | |
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); | |
805 | } | |
806 | ||
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); | |
811 | ||
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; | |
842 | ||
843 | return wxPanel::TransferDataToWindow(); | |
844 | } | |
845 | ||
846 | bool wxRichTextSizePage::TransferDataFromWindow() | |
847 | { | |
848 | wxPanel::TransferDataFromWindow(); | |
849 | ||
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); | |
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); | |
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); | |
892 | ||
893 | return true; | |
894 | } | |
895 | ||
896 | /*! | |
897 | * Get bitmap resources | |
898 | */ | |
899 | ||
900 | wxBitmap 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 | ||
913 | wxIcon 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 | ||
927 | void 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 | ||
936 | void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent& event ) | |
937 | { | |
938 | event.Enable(m_heightCheckbox->GetValue()); | |
939 | } | |
940 | ||
941 | /*! | |
942 | * wxEVT_BUTTON event handler for ID_RICHTEXT_PARA_UP | |
943 | */ | |
944 | ||
945 | void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event) ) | |
946 | { | |
947 | wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this); | |
948 | if (!dialog || !dialog->GetObject()) | |
949 | return; | |
950 | ||
951 | // Make sure object attributes are up-to-date | |
952 | dialog->TransferDataFromWindow(); | |
953 | ||
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 | ||
985 | wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart(), tempObj, buffer->GetRichTextCtrl(), 0); | |
986 | dialog->SetObject(obj2); | |
987 | } | |
988 | ||
989 | /*! | |
990 | * wxEVT_BUTTON event handler for ID_RICHTEXT_DOWN | |
991 | */ | |
992 | ||
993 | void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent& WXUNUSED(event) ) | |
994 | { | |
995 | wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this); | |
996 | if (!dialog || !dialog->GetObject()) | |
997 | return; | |
998 | ||
999 | // Make sure object attributes are up-to-date | |
1000 | dialog->TransferDataFromWindow(); | |
1001 | ||
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 | |
1034 | wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart()-1, tempObj, buffer->GetRichTextCtrl(), 0); | |
1035 | dialog->SetObject(obj2); | |
1036 | } | |
1037 | ||
1038 | /*! | |
1039 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX | |
1040 | */ | |
1041 | ||
1042 | void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event ) | |
1043 | { | |
1044 | event.Enable(m_verticalAlignmentCheckbox->GetValue()); | |
1045 | } | |
1046 | ||
1047 | /*! | |
1048 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH | |
1049 | */ | |
1050 | ||
1051 | void 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 | ||
1060 | void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent& event ) | |
1061 | { | |
1062 | event.Enable(m_minHeightCheckbox->GetValue()); | |
1063 | } | |
1064 | ||
1065 | /*! | |
1066 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH | |
1067 | */ | |
1068 | ||
1069 | void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event ) | |
1070 | { | |
1071 | event.Enable(m_maxWidthCheckbox->GetValue()); | |
1072 | } | |
1073 | ||
1074 | /*! | |
1075 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT | |
1076 | */ | |
1077 | ||
1078 | void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event ) | |
1079 | { | |
1080 | event.Enable(m_maxHeightCheckbox->GetValue()); | |
1081 | } | |
1082 | ||
1083 | /*! | |
1084 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT | |
1085 | */ | |
1086 | ||
1087 | void wxRichTextSizePage::OnRichtextLeftUpdate( wxUpdateUIEvent& event ) | |
1088 | { | |
1089 | event.Enable(m_positionLeftCheckbox->GetValue()); | |
1090 | } | |
1091 | ||
1092 | /*! | |
1093 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT | |
1094 | */ | |
1095 | ||
1096 | void wxRichTextSizePage::OnRichtextRightUpdate( wxUpdateUIEvent& event ) | |
1097 | { | |
1098 | event.Enable(m_positionRightCheckbox->GetValue()); | |
1099 | } | |
1100 | ||
1101 | /*! | |
1102 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP | |
1103 | */ | |
1104 | ||
1105 | void wxRichTextSizePage::OnRichtextTopUpdate( wxUpdateUIEvent& event ) | |
1106 | { | |
1107 | event.Enable(m_positionTopCheckbox->GetValue()); | |
1108 | } | |
1109 | ||
1110 | /*! | |
1111 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM | |
1112 | */ | |
1113 | ||
1114 | void wxRichTextSizePage::OnRichtextBottomUpdate( wxUpdateUIEvent& event ) | |
1115 | { | |
1116 | event.Enable(m_positionBottomCheckbox->GetValue()); | |
1117 | } | |
1118 | ||
1119 | /*! | |
1120 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH_UNITS | |
1121 | */ | |
1122 | ||
1123 | void 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 | ||
1132 | void 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 | ||
1141 | void 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 | ||
1150 | void 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 | ||
1159 | void 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 | ||
1168 | void wxRichTextSizePage::OnRichtextBottomUnitsUpdate( wxUpdateUIEvent& event ) | |
1169 | { | |
1170 | event.Enable(m_positionBottomCheckbox->GetValue() && sm_enablePositionAndSizeUnits); | |
1171 | } |