1 /*
2 Copyright (C) 2020-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5
6 /*
7 WARNING: This file was generated by the dkct program (see
8 http://dktools.sourceforge.net/ for details).
9 Changes you make here will be lost if dkct is run again!
10 You should modify the original source and run dkct on it.
11 Original source: WxdkdrawDlgOptionsScreen.wxc
12 */
13
14 /** @file WxdkdrawDlgOptionsScreen.cpp The WxdkdrawDlgOptionsScreen module.
15 */
16
17
18 #ifndef WXDKDRAWDLGDOTFILLED_H_INCLUDED
19 #include <wxdkdraw/WxdkdrawDlgOptionsScreen.h>
20 #endif
21
22
23
24
25
26 /** Events to process in this dialog.
27 */
28 #if wxCHECK_VERSION(3,0,0)
wxBEGIN_EVENT_TABLE(WxdkdrawDlgOptionsScreen,wxDialog)29 wxBEGIN_EVENT_TABLE(WxdkdrawDlgOptionsScreen,wxDialog)
30 #else
31 BEGIN_EVENT_TABLE(WxdkdrawDlgOptionsScreen,wxDialog)
32 #endif
33 EVT_BUTTON(\
34 wxID_OK,\
35 WxdkdrawDlgOptionsScreen::OnOK\
36 )
37 EVT_BUTTON(\
38 wxID_CANCEL,\
39 WxdkdrawDlgOptionsScreen::OnCancel\
40 )
41 EVT_SPINCTRL(\
42 WxdkdrawDlgOptionsScreen::WXD_ID_SUBSEGS,\
43 WxdkdrawDlgOptionsScreen::OnSubsegs\
44 )
45 EVT_CHECKBOX(\
46 WxdkdrawDlgOptionsScreen::WXD_ID_EXACT,\
47 WxdkdrawDlgOptionsScreen::OnFontExact\
48 )
49 EVT_CHECKBOX(\
50 WxdkdrawDlgOptionsScreen::WXD_ID_POINT_OPS,\
51 WxdkdrawDlgOptionsScreen::OnMarkupReduce\
52 )
53 #if wxCHECK_VERSION(3,0,0)
54 wxEND_EVENT_TABLE()
55 #else
56 END_EVENT_TABLE()
57 #endif
58
59
60
61 WxdkdrawDlgOptionsScreen::WxdkdrawDlgOptionsScreen(
62 WxdkdrawFrame *pParent,
63 wxControl *pControl,
64 Wxd_drawing_t *pDrw,
65 int *pSubsegs,
66 int *pExact,
67 int *pReduce,
68 wxChar const * const *pTexts
69 ) : wxDialog(
70 pParent, wxID_ANY, pTexts[635],
71 wxDefaultPosition, wxDefaultSize,
72 (
73 (wxDEFAULT_DIALOG_STYLE)
74 & (~(wxRESIZE_BORDER))
75 & (~(wxCLOSE_BOX))
76 & (~(wxSYSTEM_MENU))
77 )
78 ),
79 #if defined(__WXMSW__)
80 m_oColourRed(127, 0, 0)
81 #else
82 m_oColourRed(191, 0, 0)
83 #endif
84 {
85 m_pParent = pParent;
86 m_pControl = pControl;
87 m_pDrw = pDrw;
88 m_sTexts = pTexts;
89 m_pSubsegs = pSubsegs;
90 m_pExact = pExact;
91 m_pReduceMarkup = pReduce;
92 m_iSubsegments = *pSubsegs;
93 m_iExact = *pExact;
94 m_iReduceMarkup = *pReduce;
95
96 dkctGUILayoutOK = false;
97 sizerHorizontal = NULL;
98 sizerVertical = NULL;
99 sizerContents = NULL;
100 sizerButtons = NULL;
101 lTexts = NULL;
102 cbTexts = NULL;
103 lSplines = NULL;
104 lSubsegs = NULL;
105 spSubsegs = NULL;
106 lPointMoveOps = NULL;
107 cbPointMoveOps = NULL;
108 buttonOK = NULL;
109 buttonCancel = NULL;
110 sizerHorizontal = new wxBoxSizer(
111 wxHORIZONTAL
112 );
113 if(!(sizerHorizontal)) {
114 goto dkctGUILayoutFinished;
115 }
116 sizerHorizontal->Add(10, 10, 0);
117 sizerVertical = new wxBoxSizer(
118 wxVERTICAL
119 );
120 if(!(sizerVertical)) {
121 goto dkctGUILayoutFinished;
122 }
123 sizerVertical->Add(10, 10, 0);
124 sizerContents = new wxGridBagSizer(
125 5, 5
126 );
127 if(!(sizerContents)) {
128 goto dkctGUILayoutFinished;
129 }
130 lTexts = new wxStaticText(
131 this,
132 wxID_ANY,
133 pTexts[636]
134 );
135 if(!(lTexts)) {
136 goto dkctGUILayoutFinished;
137 }
138 sizerContents->Add(
139 lTexts,
140 wxGBPosition(0, 0),
141 wxGBSpan(1, 2),
142 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
143 );
144 cbTexts = new wxCheckBox(
145 this,
146 WXD_ID_EXACT,
147 pTexts[637]
148 );
149 if(!(cbTexts)) {
150 goto dkctGUILayoutFinished;
151 }
152 cbTexts->SetToolTip(pTexts[638]);
153 sizerContents->Add(
154 cbTexts,
155 wxGBPosition(1, 0),
156 wxGBSpan(1, 2),
157 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
158 );
159 sizerContents->Add(10, 10, wxGBPosition(2, 0), wxGBSpan(1, 2));
160 lSplines = new wxStaticText(
161 this,
162 wxID_ANY,
163 pTexts[632]
164 );
165 if(!(lSplines)) {
166 goto dkctGUILayoutFinished;
167 }
168 sizerContents->Add(
169 lSplines,
170 wxGBPosition(3, 0),
171 wxGBSpan(1, 2),
172 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
173 );
174 lSubsegs = new wxStaticText(
175 this,
176 wxID_ANY,
177 pTexts[633]
178 );
179 if(!(lSubsegs)) {
180 goto dkctGUILayoutFinished;
181 }
182 sizerContents->Add(
183 lSubsegs,
184 wxGBPosition(4, 0),
185 wxGBSpan(1, 1),
186 wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL
187 );
188 spSubsegs = new wxSpinCtrl(
189 this,
190 WXD_ID_SUBSEGS,
191 wxEmptyString,
192 wxDefaultPosition,
193 wxDefaultSize,
194 0,
195 2,
196 32,
197 4
198 );
199 if(!(spSubsegs)) {
200 goto dkctGUILayoutFinished;
201 }
202 spSubsegs->SetToolTip(pTexts[634]);
203 sizerContents->Add(
204 spSubsegs,
205 wxGBPosition(4, 1),
206 wxGBSpan(1, 1),
207 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
208 );
209 sizerContents->Add(10, 10, wxGBPosition(5, 0), wxGBSpan(1, 2));
210 lPointMoveOps = new wxStaticText(
211 this,
212 wxID_ANY,
213 pTexts[639]
214 );
215 if(!(lPointMoveOps)) {
216 goto dkctGUILayoutFinished;
217 }
218 sizerContents->Add(
219 lPointMoveOps,
220 wxGBPosition(6, 0),
221 wxGBSpan(1, 2),
222 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
223 );
224 cbPointMoveOps = new wxCheckBox(
225 this,
226 WXD_ID_POINT_OPS,
227 pTexts[640]
228 );
229 if(!(cbPointMoveOps)) {
230 goto dkctGUILayoutFinished;
231 }
232 cbPointMoveOps->SetToolTip(pTexts[641]);
233 sizerContents->Add(
234 cbPointMoveOps,
235 wxGBPosition(7, 0),
236 wxGBSpan(1, 2),
237 wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL
238 );
239 sizerVertical->Add(
240 sizerContents,
241 0,
242 wxALIGN_CENTER_HORIZONTAL|wxGROW
243 );
244 sizerVertical->Add(10, 10, 0);
245 sizerButtons = new wxStdDialogButtonSizer(
246 );
247 if(!(sizerButtons)) {
248 goto dkctGUILayoutFinished;
249 }
250 buttonOK = new wxButton(
251 this,
252 wxID_OK,
253 pTexts[476]
254 );
255 if(!(buttonOK)) {
256 goto dkctGUILayoutFinished;
257 }
258 buttonOK->SetToolTip(pTexts[478]);
259 sizerButtons->AddButton(
260 buttonOK
261 );
262 buttonCancel = new wxButton(
263 this,
264 wxID_CANCEL,
265 pTexts[477]
266 );
267 if(!(buttonCancel)) {
268 goto dkctGUILayoutFinished;
269 }
270 buttonCancel->SetToolTip(pTexts[479]);
271 sizerButtons->AddButton(
272 buttonCancel
273 );
274 sizerButtons->Realize();
275 sizerVertical->Add(
276 sizerButtons,
277 0,
278 wxALIGN_CENTER_HORIZONTAL|wxGROW
279 );
280 sizerVertical->Add(10, 10, 0);
281 sizerHorizontal->Add(
282 sizerVertical
283 );
284 sizerHorizontal->Add(10, 10, 0);
285 SetSizer(sizerHorizontal);
286 dkctGUILayoutOK = true;
287 dkctGUILayoutFinished:
288 if(dkctGUILayoutOK) {
289 sizerHorizontal->Fit(this);
290 sizerHorizontal->SetSizeHints(this);
291 }
292 if (dkctGUILayoutOK) {
293 /*
294 Fix dialog size
295 */
296 wxSize minsize = GetMinSize();
297 SetMaxSize(minsize);
298 /*
299 Retrieve object attributes
300 */
301 lSplines->SetForegroundColour(m_oColourRed);
302 lTexts->SetForegroundColour(m_oColourRed);
303 lPointMoveOps->SetForegroundColour(m_oColourRed);
304 cbTexts->SetValue((0 != *m_pExact));
305 spSubsegs->SetValue(*m_pSubsegs);
306 cbPointMoveOps->SetValue((0 != *m_pReduceMarkup));
307 }
308 }
309
310
311
312
313 void
OnOK(wxCommandEvent & WXUNUSED (event))314 WxdkdrawDlgOptionsScreen::OnOK(wxCommandEvent & WXUNUSED(event))
315 {
316 *m_pSubsegs = m_iSubsegments = spSubsegs->GetValue();
317 *m_pExact = m_iExact = (((cbTexts->GetValue()) ? 1 : 0));
318 *m_pReduceMarkup = m_iReduceMarkup =
319 (((cbPointMoveOps->GetValue()) ? 1 : 0));
320 if(IsModal()) {
321 EndModal(wxID_OK);
322 }
323 else {
324 SetReturnCode(wxID_OK);
325 Show(false);
326 }
327 }
328
329
330
331 void
OnCancel(wxCommandEvent & WXUNUSED (event))332 WxdkdrawDlgOptionsScreen::OnCancel(wxCommandEvent & WXUNUSED(event))
333 {
334 *m_pSubsegs = m_iSubsegments;
335 *m_pExact = m_iExact;
336 *m_pReduceMarkup = m_iReduceMarkup;
337 if(IsModal()) {
338 EndModal(wxID_CANCEL);
339 }
340 else {
341 SetReturnCode(wxID_CANCEL);
342 Show(false);
343 }
344 }
345
346
347
348 void
OnSubsegs(wxSpinEvent & WXUNUSED (event))349 WxdkdrawDlgOptionsScreen::OnSubsegs(wxSpinEvent & WXUNUSED(event))
350 {
351
352 *m_pSubsegs = spSubsegs->GetValue();
353 wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
354 m_pControl->Refresh();
355 m_pParent->Update();
356
357 }
358
359
360
361 void
OnFontExact(wxCommandEvent & WXUNUSED (event))362 WxdkdrawDlgOptionsScreen::OnFontExact(wxCommandEvent & WXUNUSED(event))
363 {
364
365 *m_pExact = ((cbTexts->GetValue()) ? 1 : 0);
366 m_pParent->UpdateFonts();
367 wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
368 m_pControl->Refresh();
369 m_pParent->Refresh();
370 m_pParent->Update();
371
372 }
373
374
375
376 void
OnMarkupReduce(wxCommandEvent & WXUNUSED (event))377 WxdkdrawDlgOptionsScreen::OnMarkupReduce(wxCommandEvent & WXUNUSED(event))
378 {
379
380 *m_pReduceMarkup = (((cbPointMoveOps->GetValue()) ? 1 : 0));
381 wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
382 m_pControl->Refresh();
383 m_pParent->Refresh();
384 m_pParent->Update();
385
386
387 }
388
389
390
391 /* vim: set ai sw=4 ts=4 : */
392
393