1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
%% options
copyright owner = Dirk Krause
copyright year = 2020-xxxx
SPDX-License-Identifier: BSD-3-Clause
%% wx-gui
type = dialog
contents = sizerHorizontal
[wxBoxSizer sizerHorizontal]
direction = horizontal
contents = $space(10)
contents = sizerVertical
contents = $space(10)
[wxBoxSizer sizerVertical]
direction = vertical
contents = $space(10)
contents = sizerContents centered-x
contents = $space(10)
contents = sizerButtons centered-x
contents = $space(10)
[wxGridBagSizer sizerContents]
grid = 5 5
grow = yes
contents = lTexts 0 0 1 2 left centered-y
contents = cbTexts +1 0 1 2 left centered-y
contents = $space(10) +1 0 1 2 left centered-y
contents = lSplines +1 0 1 2 left centered-y
contents = lSubsegs +1 0 1 1 right centered-y
contents = spSubsegs . +1 1 1 left centered-y
contents = $space(10) +1 0 1 2 left centered-y
contents = lPointMoveOps +1 0 1 2 left centered-y
contents = cbPointMoveOps +1 0 1 2 left centered-y
[wxStaticText lTexts]
text = pTexts[636]
[wxCheckBox cbTexts]
text = pTexts[637]
tip = pTexts[638]
id = WXD_ID_EXACT
[wxStaticText lSplines]
text = pTexts[632]
[wxStaticText lSubsegs]
text = pTexts[633]
[wxSpinCtrl spSubsegs]
id = WXD_ID_SUBSEGS
range = 2 32
value = 4
tip = pTexts[634]
[wxStaticText lPointMoveOps]
text = pTexts[639]
[wxCheckBox cbPointMoveOps]
text = pTexts[640]
tip = pTexts[641]
id = WXD_ID_POINT_OPS
[wxStdDialogButtonSizer sizerButtons]
grow = yes
contents = buttonOK
contents = buttonCancel
[wxButton buttonOK]
id = wxID_OK
text = pTexts[476]
tip = pTexts[478]
[wxButton buttonCancel]
id = wxID_CANCEL
text = pTexts[477]
tip = pTexts[479]
%% header start
#ifndef WXDKDRAW_H_INCLUDED
#include "wxdkdraw.h"
#endif
#ifndef WXDKDRAWFRAME_H_INCLUDED
#include "WxdkdrawFrame.h"
#endif
%% class start
/** Dialog to change dot details.
*/
class WxdkdrawDlgOptionsScreen : public wxDialog
{
private:
/** Events to process.
*/
#if wxCHECK_VERSION(3,0,0)
wxDECLARE_EVENT_TABLE();
#else
DECLARE_EVENT_TABLE()
#endif
%% class end
protected:
/** Red colour for group titles.
*/
wxColour m_oColourRed;
/** Parent frame.
*/
WxdkdrawFrame *m_pParent;
/** Drawing control to refresh on changes.
*/
wxControl *m_pControl;
/** Entire drawing.
*/
Wxd_drawing_t *m_pDrw;
/** Localized text fragments.
*/
wxChar const * const *m_sTexts;
/** Address of subsegments variable.
*/
int *m_pSubsegs;
/** Address of exact fonts variable.
*/
int *m_pExact;
/** Address of variable for markup reduction.
*/
int *m_pReduceMarkup;
/** Initial value for number of subsegments.
*/
int m_iSubsegments;
/** Initial value for exact font flag.
*/
int m_iExact;
/** Initial value for markup reduction.
*/
int m_iReduceMarkup;
public:
/** Control events.
*/
enum {
WXD_ID_SUBSEGS = (wxID_HIGHEST + 1), /**< Subsegs changed. */
WXD_ID_EXACT , /**< Use exact fonts. */
WXD_ID_POINT_OPS , /**< Reduce markup. */
};
/** Constructor.
@param pParent Parent frame (programs main window).
@param pControl Drawing control.
@param pDrw Drawing.
@param pSubsegs Address of sub-segments variable.
@param pExact Address of exact font variables.
@param pReduce Address of variable to reduce markup.
@param pTexts Localized text fragments.
*/
WxdkdrawDlgOptionsScreen(
WxdkdrawFrame *pParent,
wxControl *pControl,
Wxd_drawing_t *pDrw,
int *pSubsegs,
int *pExact,
int *pReduce,
wxChar const * const *pTexts
);
/** OK button handler.
@param event Event to process.
*/
void
OnOK(wxCommandEvent & event);
/** Cancel button handler.
@param event Event to process.
*/
void
OnCancel(wxCommandEvent & event);
/** Subsegs spin control handler.
@param event Event to process.
*/
void
OnSubsegs(wxSpinEvent & event);
/** Handler for checkbox change.
@param event Event to process.
*/
void
OnFontExact(wxCommandEvent & event);
/** Handler for reduce markup checkbox change.
@param event Event to process.
*/
void
OnMarkupReduce(wxCommandEvent & event);
};
%% header end
%% module start
#ifndef WXDKDRAWDLGDOTFILLED_H_INCLUDED
#include "WxdkdrawDlgOptionsScreen.h"
#endif
$!trace-include
/** Events to process in this dialog.
*/
#if wxCHECK_VERSION(3,0,0)
wxBEGIN_EVENT_TABLE(WxdkdrawDlgOptionsScreen,wxDialog)
#else
BEGIN_EVENT_TABLE(WxdkdrawDlgOptionsScreen,wxDialog)
#endif
EVT_BUTTON(\
wxID_OK,\
WxdkdrawDlgOptionsScreen::OnOK\
)
EVT_BUTTON(\
wxID_CANCEL,\
WxdkdrawDlgOptionsScreen::OnCancel\
)
EVT_SPINCTRL(\
WxdkdrawDlgOptionsScreen::WXD_ID_SUBSEGS,\
WxdkdrawDlgOptionsScreen::OnSubsegs\
)
EVT_CHECKBOX(\
WxdkdrawDlgOptionsScreen::WXD_ID_EXACT,\
WxdkdrawDlgOptionsScreen::OnFontExact\
)
EVT_CHECKBOX(\
WxdkdrawDlgOptionsScreen::WXD_ID_POINT_OPS,\
WxdkdrawDlgOptionsScreen::OnMarkupReduce\
)
#if wxCHECK_VERSION(3,0,0)
wxEND_EVENT_TABLE()
#else
END_EVENT_TABLE()
#endif
%% constructor start
WxdkdrawDlgOptionsScreen::WxdkdrawDlgOptionsScreen(
WxdkdrawFrame *pParent,
wxControl *pControl,
Wxd_drawing_t *pDrw,
int *pSubsegs,
int *pExact,
int *pReduce,
wxChar const * const *pTexts
) : wxDialog(
pParent, wxID_ANY, pTexts[635],
wxDefaultPosition, wxDefaultSize,
(
(wxDEFAULT_DIALOG_STYLE)
& (~(wxRESIZE_BORDER))
& (~(wxCLOSE_BOX))
& (~(wxSYSTEM_MENU))
)
),
#if defined(__WXMSW__)
m_oColourRed(127, 0, 0)
#else
m_oColourRed(191, 0, 0)
#endif
{
m_pParent = pParent;
m_pControl = pControl;
m_pDrw = pDrw;
m_sTexts = pTexts;
m_pSubsegs = pSubsegs;
m_pExact = pExact;
m_pReduceMarkup = pReduce;
m_iSubsegments = *pSubsegs;
m_iExact = *pExact;
m_iReduceMarkup = *pReduce;
%% constructor end
if (dkctGUILayoutOK) {
/*
Fix dialog size
*/
wxSize minsize = GetMinSize();
SetMaxSize(minsize);
/*
Retrieve object attributes
*/
lSplines->SetForegroundColour(m_oColourRed);
lTexts->SetForegroundColour(m_oColourRed);
lPointMoveOps->SetForegroundColour(m_oColourRed);
cbTexts->SetValue((0 != *m_pExact));
spSubsegs->SetValue(*m_pSubsegs);
cbPointMoveOps->SetValue((0 != *m_pReduceMarkup));
}
}
%% module end
void
WxdkdrawDlgOptionsScreen::OnOK(wxCommandEvent & WXUNUSED(event))
{
*m_pSubsegs = m_iSubsegments = spSubsegs->GetValue();
*m_pExact = m_iExact = (((cbTexts->GetValue()) ? 1 : 0));
*m_pReduceMarkup = m_iReduceMarkup =
(((cbPointMoveOps->GetValue()) ? 1 : 0));
if(IsModal()) {
EndModal(wxID_OK);
}
else {
SetReturnCode(wxID_OK);
Show(false);
}
}
void
WxdkdrawDlgOptionsScreen::OnCancel(wxCommandEvent & WXUNUSED(event))
{
*m_pSubsegs = m_iSubsegments;
*m_pExact = m_iExact;
*m_pReduceMarkup = m_iReduceMarkup;
if(IsModal()) {
EndModal(wxID_CANCEL);
}
else {
SetReturnCode(wxID_CANCEL);
Show(false);
}
}
void
WxdkdrawDlgOptionsScreen::OnSubsegs(wxSpinEvent & WXUNUSED(event))
{
$? "+ OnSubsegs"
*m_pSubsegs = spSubsegs->GetValue();
wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
m_pControl->Refresh();
m_pParent->Update();
$? "- OnSubsegs"
}
void
WxdkdrawDlgOptionsScreen::OnFontExact(wxCommandEvent & WXUNUSED(event))
{
$? "+ OnFontExact"
*m_pExact = ((cbTexts->GetValue()) ? 1 : 0);
m_pParent->UpdateFonts();
wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
m_pControl->Refresh();
m_pParent->Refresh();
m_pParent->Update();
$? "- OnFontExact"
}
void
WxdkdrawDlgOptionsScreen::OnMarkupReduce(wxCommandEvent & WXUNUSED(event))
{
$? "+ OnMarkupReduce"
*m_pReduceMarkup = (((cbPointMoveOps->GetValue()) ? 1 : 0));
wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
m_pControl->Refresh();
m_pParent->Refresh();
m_pParent->Update();
$? "- OnFontExact"
$? "- OnMarkupReduce"
}
/* vim: set ai sw=4 ts=4 : */
|