1 /*
2 Copyright (C) 2019-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: WxdkdrawFrameEvents.cpt
12 */
13 
14 /**	@file WxdkdrawFrameEvents.cpp The WxdkdrawFrameEvents module.
15 */
16 
17 
18 #include <wxdkdraw/wxdkdraw.h>
19 
20 #ifndef	DK4WXYESNODIALOG_H_INCLUDED
21 #include <libdk4wx/Dk4WxYesNoDialog.h>
22 #endif
23 
24 #ifndef	WXDKDRAWAPPH_INCLUDED
25 #include <wxdkdraw/WxdkdrawApp.h>
26 #endif
27 
28 #ifndef	WXDKDRAWFRAME_H_INCLUDED
29 #include <wxdkdraw/WxdkdrawFrame.h>
30 #endif
31 
32 #ifndef	WXDKDRAWDLGLINESTYLE_H_INCLUDED
33 #include <wxdkdraw/WxdkdrawDlgLineStyle.h>
34 #endif
35 
36 #ifndef	WXDKDRAWDLGSTYLELENGTH_H_INCLUDED
37 #include <wxdkdraw/WxdkdrawDlgStyleLength.h>
38 #endif
39 
40 #ifndef	WXDKDRAWDLGLINEJOIN_H_INCLUDED
41 #include <wxdkdraw/WxdkdrawDlgLineJoin.h>
42 #endif
43 
44 #ifndef	WXDKDRAWDLGMITERLIMIT_H_INCLUDED
45 #include <wxdkdraw/WxdkdrawDlgMiterLimit.h>
46 #endif
47 
48 #ifndef	WXDKDRAWDLGLINECAP_H_INCLUDED
49 #include <wxdkdraw/WxdkdrawDlgLineCap.h>
50 #endif
51 
52 #ifndef	WXDKDRAWDLGARROWTYPE_H_INCLUDED
53 #include <wxdkdraw/WxdkdrawDlgArrowType.h>
54 #endif
55 
56 #ifndef WXDKDRAWDLGARROWSIZE_H_INCLUDED
57 #include <wxdkdraw/WxdkdrawDlgArrowSize.h>
58 #endif
59 
60 #ifndef	WXDKDRAWDLGFILLSTYLE_H_INCLUDED
61 #include <wxdkdraw/WxdkdrawDlgFillStyle.h>
62 #endif
63 
64 #ifndef	WXDKDRAWDLGTEXTALIGN_H_INCLUDED
65 #include <wxdkdraw/WxdkdrawDlgTextAlign.h>
66 #endif
67 
68 #ifndef	WXDKDRAWDLGFONTNAME_H_INCLUDED
69 #include <wxdkdraw/WxdkdrawDlgFontName.h>
70 #endif
71 
72 #ifndef	WXDKDRAWDLGLAYERMANAGER_H_INCLUDED
73 #include <wxdkdraw/WxdkdrawDlgLayerManager.h>
74 #endif
75 
76 #ifndef	WXDKDRAWDLGTEXTINPUT_H_INCLUDED
77 #include <wxdkdraw/WxdkdrawDlgTextInput.h>
78 #endif
79 
80 #ifndef	WXDKDRAWDLGSPLINEVALUE_H_INCLUDED
81 #include <wxdkdraw/WxdkdrawDlgSplineValue.h>
82 #endif
83 
84 #ifndef	WXDKDRAWDLGOPTIONSNEWOBJECTS_H_INCLUDED
85 #include <wxdkdraw/WxdkdrawDlgOptionsNewObjects.h>
86 #endif
87 
88 #ifndef	WXDKDRAWDLGOPTIONSSCREEN_H_INCLUDED
89 #include <wxdkdraw/WxdkdrawDlgOptionsScreen.h>
90 #endif
91 
92 #ifndef	WXDKDRAWDLGPAPERSIZE_H_INCLUDED
93 #include <wxdkdraw/WxdkdrawDlgPaperSize.h>
94 #endif
95 
96 
97 
98 
99 
100 
101 
102 /**	Events the frame must handle.
103 */
104 #if	wxCHECK_VERSION(3,0,0)
105 wxBEGIN_EVENT_TABLE(WxdkdrawFrame,wxFrame)
106 #else
107 BEGIN_EVENT_TABLE(WxdkdrawFrame,wxFrame)
108 #endif
109 	EVT_MENU(\
110 		wxID_EXIT,\
111 		WxdkdrawFrame::OnQuit\
112 	)
113 	EVT_MENU(\
114 		WxdkdrawFrame::ID_HELP_ABOUT,\
115 		WxdkdrawFrame::OnAbout\
116 	)
117 	EVT_MENU(\
118 		WxdkdrawFrame::ID_HELP_CONTENTS,\
119 		WxdkdrawFrame::OnHelpContents\
120 	)
121 	EVT_MENU(\
122 		wxID_NEW,\
123 		WxdkdrawFrame::OnFileNew\
124 	)
125 	EVT_MENU(\
126 		wxID_OPEN,\
127 		WxdkdrawFrame::OnFileOpen\
128 	)
129 	EVT_BUTTON(\
130 		wxID_OPEN,\
131 		WxdkdrawFrame::OnFileOpen\
132 	)
133 	EVT_MENU(\
134 		wxID_SAVE,\
135 		WxdkdrawFrame::OnFileSave\
136 	)
137 	EVT_BUTTON(\
138 		wxID_SAVE,\
139 		WxdkdrawFrame::OnFileSave\
140 	)
141 	EVT_MENU(\
142 		wxID_SAVEAS,\
143 		WxdkdrawFrame::OnFileSaveAs\
144 	)
145 	EVT_MENU(\
146 		wxID_ZOOM_IN,\
147 		WxdkdrawFrame::OnZoomIn\
148 	)
149 	EVT_BUTTON(\
150 		wxID_ZOOM_IN,\
151 		WxdkdrawFrame::OnZoomIn\
152 	)
153 	EVT_MENU(\
154 		wxID_ZOOM_OUT,\
155 		WxdkdrawFrame::OnZoomOut\
156 	)
157 	EVT_BUTTON(\
158 		wxID_ZOOM_OUT,\
159 		WxdkdrawFrame::OnZoomOut\
160 	)
161 	EVT_MENU(\
162 		wxID_ZOOM_100,\
163 		WxdkdrawFrame::OnZoom100\
164 	)
165 	EVT_BUTTON(\
166 		wxID_ZOOM_100,\
167 		WxdkdrawFrame::OnZoom100\
168 	)
169 	EVT_MENU(\
170 		WxdkdrawFrame::ID_ADD_POLYINE,\
171 		WxdkdrawFrame::OnAddPolyline\
172 	)
173 	EVT_BUTTON(\
174 		WxdkdrawFrame::ID_ADD_POLYINE,\
175 		WxdkdrawFrame::OnAddPolyline\
176 	)
177 	EVT_MENU(\
178 		WxdkdrawFrame::ID_ADD_POLYGON,\
179 		WxdkdrawFrame::OnAddPolygon\
180 	)
181 	EVT_BUTTON(\
182 		WxdkdrawFrame::ID_ADD_POLYGON,\
183 		WxdkdrawFrame::OnAddPolygon\
184 	)
185 	EVT_MENU(\
186 		WxdkdrawFrame::ID_ADD_RECT,\
187 		WxdkdrawFrame::OnAddRectangle\
188 	)
189 	EVT_BUTTON(\
190 		WxdkdrawFrame::ID_ADD_RECT,\
191 		WxdkdrawFrame::OnAddRectangle\
192 	)
193 	EVT_MENU(\
194 		WxdkdrawFrame::ID_ADD_BOX,\
195 		WxdkdrawFrame::OnAddBox\
196 	)
197 	EVT_BUTTON(\
198 		WxdkdrawFrame::ID_ADD_BOX,\
199 		WxdkdrawFrame::OnAddBox\
200 	)
201 	EVT_MENU(\
202 		WxdkdrawFrame::ID_ADD_CIRCLE,\
203 		WxdkdrawFrame::OnAddCircle\
204 	)
205 	EVT_BUTTON(\
206 		WxdkdrawFrame::ID_ADD_CIRCLE,\
207 		WxdkdrawFrame::OnAddCircle\
208 	)
209 	EVT_MENU(\
210 		WxdkdrawFrame::ID_ADD_ELLIPSE,\
211 		WxdkdrawFrame::OnAddEllipse\
212 	)
213 	EVT_BUTTON(\
214 		WxdkdrawFrame::ID_ADD_ELLIPSE,\
215 		WxdkdrawFrame::OnAddEllipse\
216 	)
217 	EVT_MENU(\
218 		WxdkdrawFrame::ID_ADD_ARC_O,\
219 		WxdkdrawFrame::OnAddArcOpen\
220 	)
221 	EVT_BUTTON(\
222 		WxdkdrawFrame::ID_ADD_ARC_O,\
223 		WxdkdrawFrame::OnAddArcOpen\
224 	)
225 	EVT_MENU(\
226 		WxdkdrawFrame::ID_ADD_ARC_C,\
227 		WxdkdrawFrame::OnAddArcClosed\
228 	)
229 	EVT_BUTTON(\
230 		WxdkdrawFrame::ID_ADD_ARC_C,\
231 		WxdkdrawFrame::OnAddArcClosed\
232 	)
233 	EVT_MENU(\
234 		WxdkdrawFrame::ID_ADD_SPL_AO,\
235 		WxdkdrawFrame::OnAddSplineAO\
236 	)
237 	EVT_BUTTON(\
238 		WxdkdrawFrame::ID_ADD_SPL_AO,\
239 		WxdkdrawFrame::OnAddSplineAO\
240 	)
241 	EVT_MENU(\
242 		WxdkdrawFrame::ID_ADD_SPL_AC,\
243 		WxdkdrawFrame::OnAddSplineAC\
244 	)
245 	EVT_BUTTON(\
246 		WxdkdrawFrame::ID_ADD_SPL_AC,\
247 		WxdkdrawFrame::OnAddSplineAC\
248 	)
249 	EVT_MENU(\
250 		WxdkdrawFrame::ID_ADD_SPL_IO,\
251 		WxdkdrawFrame::OnAddSplineIO\
252 	)
253 	EVT_BUTTON(\
254 		WxdkdrawFrame::ID_ADD_SPL_IO,\
255 		WxdkdrawFrame::OnAddSplineIO\
256 	)
257 	EVT_MENU(\
258 		WxdkdrawFrame::ID_ADD_SPL_IC,\
259 		WxdkdrawFrame::OnAddSplineIC\
260 	)
261 	EVT_BUTTON(\
262 		WxdkdrawFrame::ID_ADD_SPL_IC,\
263 		WxdkdrawFrame::OnAddSplineIC\
264 	)
265 	EVT_MENU(\
266 		WxdkdrawFrame::ID_ADD_DOT_C,\
267 		WxdkdrawFrame::OnAddDot\
268 	)
269 	EVT_BUTTON(\
270 		WxdkdrawFrame::ID_ADD_DOT_C,\
271 		WxdkdrawFrame::OnAddDot\
272 	)
273 	EVT_MENU(\
274 		WxdkdrawFrame::ID_ADD_DOT_W,\
275 		WxdkdrawFrame::OnAddWhiteDot\
276 	)
277 	EVT_BUTTON(\
278 		WxdkdrawFrame::ID_ADD_DOT_W,\
279 		WxdkdrawFrame::OnAddWhiteDot\
280 	)
281 	EVT_MENU(\
282 		WxdkdrawFrame::ID_ADD_TEXT,\
283 		WxdkdrawFrame::OnAddTextlabel\
284 	)
285 	EVT_BUTTON(\
286 		WxdkdrawFrame::ID_ADD_TEXT,\
287 		WxdkdrawFrame::OnAddTextlabel\
288 	)
289 	EVT_MENU(\
290 		WxdkdrawFrame::ID_ADD_IMG,\
291 		WxdkdrawFrame::OnAddImage\
292 	)
293 	EVT_BUTTON(\
294 		WxdkdrawFrame::ID_ADD_IMG,\
295 		WxdkdrawFrame::OnAddImage\
296 	)
297 	EVT_MENU(\
298 		WxdkdrawFrame::ID_ADD_LIBELEM,\
299 		WxdkdrawFrame::OnAddLibelem\
300 	)
301 	EVT_BUTTON(\
302 		WxdkdrawFrame::ID_ADD_LIBELEM,\
303 		WxdkdrawFrame::OnAddLibelem\
304 	)
305 	EVT_MENU(\
306 		WxdkdrawFrame::ID_EDIT_COPY,\
307 		WxdkdrawFrame::OnEditCopy\
308 	)
309 	EVT_BUTTON(\
310 		WxdkdrawFrame::ID_EDIT_COPY,\
311 		WxdkdrawFrame::OnEditCopy\
312 	)
313 	EVT_MENU(\
314 		WxdkdrawFrame::ID_EDIT_MOVE,\
315 		WxdkdrawFrame::OnEditMove\
316 	)
317 	EVT_BUTTON(\
318 		WxdkdrawFrame::ID_EDIT_MOVE,\
319 		WxdkdrawFrame::OnEditMove\
320 	)
321 	EVT_MENU(\
322 		WxdkdrawFrame::ID_EDIT_DEL,\
323 		WxdkdrawFrame::OnEditDelete\
324 	)
325 	EVT_BUTTON(\
326 		WxdkdrawFrame::ID_EDIT_DEL,\
327 		WxdkdrawFrame::OnEditDelete\
328 	)
329 	EVT_MENU(\
330 		WxdkdrawFrame::ID_EDIT_PT_MOVE,\
331 		WxdkdrawFrame::OnEditPointMove\
332 	)
333 	EVT_BUTTON(\
334 		WxdkdrawFrame::ID_EDIT_PT_MOVE,\
335 		WxdkdrawFrame::OnEditPointMove\
336 	)
337 	EVT_MENU(\
338 		WxdkdrawFrame::ID_EDIT_PT_ADD,\
339 		WxdkdrawFrame::OnEditPointAdd\
340 	)
341 	EVT_BUTTON(\
342 		WxdkdrawFrame::ID_EDIT_PT_ADD,\
343 		WxdkdrawFrame::OnEditPointAdd\
344 	)
345 	EVT_MENU(\
346 		WxdkdrawFrame::ID_EDIT_PT_DEL,\
347 		WxdkdrawFrame::OnEditPointDelete\
348 	)
349 	EVT_BUTTON(\
350 		WxdkdrawFrame::ID_EDIT_PT_DEL,\
351 		WxdkdrawFrame::OnEditPointDelete\
352 	)
353 	EVT_MENU(\
354 		WxdkdrawFrame::ID_EDIT_DET,\
355 		WxdkdrawFrame::OnEditDetails\
356 	)
357 	EVT_BUTTON(\
358 		WxdkdrawFrame::ID_EDIT_DET,\
359 		WxdkdrawFrame::OnEditDetails\
360 	)
361 	EVT_MENU(\
362 		WxdkdrawFrame::ID_EDIT_GRP1,\
363 		WxdkdrawFrame::OnEditGroup\
364 	)
365 	EVT_MENU(\
366 		WxdkdrawFrame::ID_EDIT_GRP13,\
367 		WxdkdrawFrame::OnEditGroup3\
368 	)
369 	EVT_BUTTON(\
370 		WxdkdrawFrame::ID_EDIT_GRP1,\
371 		WxdkdrawFrame::OnEditGroup\
372 	)
373 	EVT_BUTTON(\
374 		WxdkdrawFrame::ID_EDIT_GRP13,\
375 		WxdkdrawFrame::OnEditGroup3\
376 	)
377 	EVT_MENU(\
378 		WxdkdrawFrame::ID_EDIT_UNGRP,\
379 		WxdkdrawFrame::OnEditUngroup\
380 	)
381 	EVT_BUTTON(\
382 		WxdkdrawFrame::ID_EDIT_UNGRP,\
383 		WxdkdrawFrame::OnEditUngroup\
384 	)
385 	EVT_MENU(\
386 		WxdkdrawFrame::ID_EDIT_FLIPH,\
387 		WxdkdrawFrame::OnEditFlipH\
388 	)
389 	EVT_BUTTON(\
390 		WxdkdrawFrame::ID_EDIT_FLIPH,\
391 		WxdkdrawFrame::OnEditFlipH\
392 	)
393 	EVT_MENU(\
394 		WxdkdrawFrame::ID_EDIT_FLIPV,\
395 		WxdkdrawFrame::OnEditFlipV\
396 	)
397 	EVT_BUTTON(\
398 		WxdkdrawFrame::ID_EDIT_FLIPV,\
399 		WxdkdrawFrame::OnEditFlipV\
400 	)
401 	EVT_BUTTON(\
402 		WxdkdrawFrame::ID_EDIT_ROTLEFT,\
403 		WxdkdrawFrame::OnEditRotateLeft\
404 	)
405 	EVT_BUTTON(\
406 		WxdkdrawFrame::ID_EDIT_ROTLEFT,\
407 		WxdkdrawFrame::OnEditRotateLeft\
408 	)
409 	EVT_BUTTON(\
410 		WxdkdrawFrame::ID_EDIT_ROTRIGHT,\
411 		WxdkdrawFrame::OnEditRotateRight\
412 	)
413 	EVT_BUTTON(\
414 		WxdkdrawFrame::ID_EDIT_ROTRIGHT,\
415 		WxdkdrawFrame::OnEditRotateRight\
416 	)
417 	EVT_MENU(\
418 		WxdkdrawFrame::ID_EDIT_DRSZ,\
419 		WxdkdrawFrame::OnEditChangeSize\
420 	)
421 	EVT_MENU(\
422 		WxdkdrawFrame::ID_EDIT_SDRSZ,\
423 		WxdkdrawFrame::OnEditSetSize\
424 	)
425 	EVT_BUTTON(\
426 		WxdkdrawFrame::ID_EDIT_DRSZ,\
427 		WxdkdrawFrame::OnEditChangeSize\
428 	)
429 	EVT_MENU(\
430 		WxdkdrawFrame::ID_LAYERS_ALL,\
431 		WxdkdrawFrame::OnLayersAll\
432 	)
433 	EVT_BUTTON(\
434 		WxdkdrawFrame::ID_LAYERS_ALL,\
435 		WxdkdrawFrame::OnLayersAll\
436 	)
437 	EVT_MENU(\
438 		WxdkdrawFrame::ID_LAYERS_MGR,\
439 		WxdkdrawFrame::OnLayerManager\
440 	)
441 	EVT_BUTTON(\
442 		WxdkdrawFrame::ID_LAYERS_MGR,\
443 		WxdkdrawFrame::OnLayerManager\
444 	)
445 	EVT_MENU(\
446 		WxdkdrawFrame::ID_ZOOM_CENTER,\
447 		WxdkdrawFrame::OnCenterView\
448 	)
449 	EVT_MENU(\
450 		WxdkdrawFrame::ID_EDIT_CONVERT_1,\
451 		WxdkdrawFrame::OnConvert1\
452 	)
453 	EVT_MENU(\
454 		WxdkdrawFrame::ID_EDIT_CONVERT_2,\
455 		WxdkdrawFrame::OnConvert2\
456 	)
457 	EVT_MENU(\
458 		WxdkdrawFrame::ID_EDIT_CONVERT_3,\
459 		WxdkdrawFrame::OnConvert3\
460 	)
461 	EVT_MENU(\
462 		WxdkdrawFrame::ID_EDIT_CONVERT_4,\
463 		WxdkdrawFrame::OnConvert4\
464 	)
465 	EVT_MENU(\
466 		WxdkdrawFrame::ID_EDIT_CONVERT_5,\
467 		WxdkdrawFrame::OnConvert5\
468 	)
469 	EVT_MENU(\
470 		WxdkdrawFrame::ID_EDIT_CONVERT_6,\
471 		WxdkdrawFrame::OnConvert6\
472 	)
473 	EVT_MENU(\
474 		WxdkdrawFrame::ID_EDIT_CONVERT_7,\
475 		WxdkdrawFrame::OnConvert7\
476 	)
477 	EVT_MENU(\
478 		WxdkdrawFrame::ID_EDIT_CONVERT_8,\
479 		WxdkdrawFrame::OnConvert8\
480 	)
481 	EVT_MENU(\
482 		WxdkdrawFrame::ID_EDIT_CONVERT_9,\
483 		WxdkdrawFrame::OnConvert9\
484 	)
485 	EVT_MENU(\
486 		WxdkdrawFrame::ID_EDIT_CONVERT_A,\
487 		WxdkdrawFrame::OnConvertA\
488 	)
489 	EVT_MENU(\
490 		WxdkdrawFrame::ID_COL_MOD_BORDER,\
491 		WxdkdrawFrame::OnColourBorderModify\
492 	)
493 	EVT_MENU(\
494 		WxdkdrawFrame::ID_COL_RES_BORDER,\
495 		WxdkdrawFrame::OnColourBorderReset\
496 	)
497 	EVT_MENU(\
498 		WxdkdrawFrame::ID_COL_MOD_BACKGROUND,\
499 		WxdkdrawFrame::OnColourBackgroundModify\
500 	)
501 	EVT_MENU(\
502 		WxdkdrawFrame::ID_COL_RES_BACKGROUND,\
503 		WxdkdrawFrame::OnColourBackgroundReset\
504 	)
505 	EVT_MENU(\
506 		WxdkdrawFrame::ID_COL_MOD_GRID,\
507 		WxdkdrawFrame::OnColourGridModify\
508 	)
509 	EVT_MENU(\
510 		WxdkdrawFrame::ID_COL_RES_GRID,\
511 		WxdkdrawFrame::OnColourGridReset\
512 	)
513 	EVT_MENU(\
514 		WxdkdrawFrame::ID_COL_MOD_PH,\
515 		WxdkdrawFrame::OnColourPlacementModify\
516 	)
517 	EVT_MENU(\
518 		WxdkdrawFrame::ID_COL_RES_PH,\
519 		WxdkdrawFrame::OnColourPlacementReset\
520 	)
521 	EVT_MENU(\
522 		WxdkdrawFrame::ID_COL_MOD_COPY,\
523 		WxdkdrawFrame::OnColourCopyModify\
524 	)
525 	EVT_MENU(\
526 		WxdkdrawFrame::ID_COL_RES_COPY,\
527 		WxdkdrawFrame::OnColourCopyReset\
528 	)
529 	EVT_MENU(\
530 		WxdkdrawFrame::ID_COL_MOD_MOVE,\
531 		WxdkdrawFrame::OnColourMoveModify\
532 	)
533 	EVT_MENU(\
534 		WxdkdrawFrame::ID_COL_RES_MOVE,\
535 		WxdkdrawFrame::OnColourMoveReset\
536 	)
537 	EVT_MENU(\
538 		WxdkdrawFrame::ID_COL_MOD_DELETE,\
539 		WxdkdrawFrame::OnColourDeleteModify\
540 	)
541 	EVT_MENU(\
542 		WxdkdrawFrame::ID_COL_RES_DELETE,\
543 		WxdkdrawFrame::OnColourDeleteReset\
544 	)
545 	EVT_MENU(\
546 		WxdkdrawFrame::ID_COL_MOD_GROUP,\
547 		WxdkdrawFrame::OnColourGroupModify\
548 	)
549 	EVT_MENU(\
550 		WxdkdrawFrame::ID_COL_RES_GROUP,\
551 		WxdkdrawFrame::OnColourGroupReset\
552 	)
553 	EVT_MENU(\
554 		WxdkdrawFrame::ID_COL_MOD_MISSING,\
555 		WxdkdrawFrame::OnColourMissingModify\
556 	)
557 	EVT_MENU(\
558 		WxdkdrawFrame::ID_COL_RES_MISSING,\
559 		WxdkdrawFrame::OnColourMissingReset\
560 	)
561 	EVT_MENU(\
562 		WxdkdrawFrame::ID_RESET_OPTIONS,\
563 		WxdkdrawFrame::OnResetOptions\
564 	)
565 	EVT_MENU(\
566 		WxdkdrawFrame::ID_MOD_SPLINE,\
567 		WxdkdrawFrame::OnModifySplineValue\
568 	)
569 	EVT_BUTTON(\
570 		WxdkdrawFrame::ID_MOD_SPLINE,\
571 		WxdkdrawFrame::OnModifySplineValue\
572 	)
573 	EVT_MENU(\
574 		WxdkdrawFrame::ID_OPT_NEW_OBJECTS,\
575 		WxdkdrawFrame::OnOptionsNewObjects\
576 	)
577 	EVT_MENU(\
578 		WxdkdrawFrame::ID_OPT_SCREEN,\
579 		WxdkdrawFrame::OnOptionsScreenRepresentation\
580 	)
581 	EVT_BUTTON(\
582 		WxdkdrawFrame::ID_ZOOM_CENTER,\
583 		WxdkdrawFrame::OnCenterView\
584 	)
585 	EVT_CHECKBOX(\
586 		WxdkdrawFrame::ID_GRID_ON_OFF,\
587 		WxdkdrawFrame::OnGridOnOff\
588 	)
589 	EVT_CHOICE(\
590 		WxdkdrawFrame::ID_GRID_UNIT,\
591 		WxdkdrawFrame::OnGridUnit\
592 	)
593 	EVT_CHOICE(\
594 		WxdkdrawFrame::ID_GRID_BASE,\
595 		WxdkdrawFrame::OnGridBase\
596 	)
597 	EVT_CHECKBOX(\
598 		WxdkdrawFrame::ID_PLACEMENT,\
599 		WxdkdrawFrame::OnPlacementHelp\
600 	)
601 	EVT_COMMAND(\
602 		WxdkdrawFrame::ID_STYLE_LINE_COL,\
603 		wxEVT_DK4_COLOUR_VIEW_EVENT,WxdkdrawFrame::OnStyleLineColour\
604 	)
605 	EVT_SPINCTRL(\
606 		WxdkdrawFrame::ID_STYLE_LAYER,\
607 		WxdkdrawFrame::OnStyleLayer\
608 	)
609 	EVT_SPINCTRL(\
610 		WxdkdrawFrame::ID_STYLE_LINE_WIDTH,\
611 		WxdkdrawFrame::OnStyleLineWidth\
612 	)
613 	EVT_SPINCTRL(\
614 		WxdkdrawFrame::ID_SPIN_ROTATION,\
615 		WxdkdrawFrame::OnSpinRotation\
616 	)
617 	EVT_BUTTON(\
618 		WxdkdrawFrame::ID_STYLE_LINE_STYLE,\
619 		WxdkdrawFrame::OnStyleLineStyle\
620 	)
621 	EVT_BUTTON(\
622 		WxdkdrawFrame::ID_STYLE_LINE_CAP,\
623 		WxdkdrawFrame::OnStyleLineCap\
624 	)
625 	EVT_BUTTON(\
626 		WxdkdrawFrame::ID_STYLE_LINE_JOIN,\
627 		WxdkdrawFrame::OnStyleLineJoin\
628 	)
629 	EVT_BUTTON(\
630 		WxdkdrawFrame::ID_STYLE_ARROW_F,\
631 		WxdkdrawFrame::OnStyleLineArrowF\
632 	)
633 	EVT_BUTTON(\
634 		WxdkdrawFrame::ID_STYLE_ARROW_B,\
635 		WxdkdrawFrame::OnStyleLineArrowB\
636 	)
637 	EVT_COMMAND(\
638 		WxdkdrawFrame::ID_STYLE_FILL_COL,\
639 		wxEVT_DK4_COLOUR_VIEW_EVENT,WxdkdrawFrame::OnStyleFillColour\
640 	)
641 	EVT_BUTTON(\
642 		WxdkdrawFrame::ID_STYLE_FILL_PATT,\
643 		WxdkdrawFrame::OnStyleFillPattern\
644 	)
645 	EVT_CHECKBOX(\
646 		WxdkdrawFrame::ID_STYLE_TEXT_LATEX,\
647 		WxdkdrawFrame::OnStyleTextLatex\
648 	)
649 	EVT_BUTTON(\
650 		WxdkdrawFrame::ID_STYLE_TEXT_ALIGN,\
651 		WxdkdrawFrame::OnStyleTextAlign\
652 	)
653 	EVT_BUTTON(\
654 		WxdkdrawFrame::ID_STYLE_TEXT_FONT,\
655 		WxdkdrawFrame::OnStyleTextFont\
656 	)
657 	EVT_SPINCTRL(\
658 		WxdkdrawFrame::ID_STYLE_TEXT_SIZE,\
659 		WxdkdrawFrame::OnStyleTextSize\
660 	)
661 	EVT_COMMAND_SCROLL(\
662 		WxdkdrawFrame::ID_SCROLL_H,\
663 		WxdkdrawFrame::OnScrollH\
664 	)
665 	EVT_COMMAND_SCROLL(\
666 		WxdkdrawFrame::ID_SCROLL_V,\
667 		WxdkdrawFrame::OnScrollV\
668 	)
669 #if	wxCHECK_VERSION(3,0,0)
670 wxEND_EVENT_TABLE()
671 #else
672 END_EVENT_TABLE()
673 #endif
674 
675 
676 
677 /**	DK tools and libraries version number as wxChar text.
678 */
679 static const wxChar versno[] = { DKT_VERSION_WX };
680 
681 
682 
683 /**	Files to open in dialog box.
684 */
685 static const wxChar wxd_file_type_suffix[] = {
686 	wxT("WXD files (*.wxd)|*.wxd")
687 };
688 
689 
690 
691 bool
BeginEventHandling(void)692 WxdkdrawFrame::BeginEventHandling(void)
693 {
694 	bool		back	= false;
695 	dk4error_init(&m_oErrorReport);
696 	if ((NULL != m_pDrw) && (m_bActive) && (NULL != drawco)) {
697 		back = true;
698 		m_bUpdate = false;
699 	}
700 	return back;
701 }
702 
703 
704 
705 void
ErrorReportingAtEventEnd(void)706 WxdkdrawFrame::ErrorReportingAtEventEnd(void)
707 {
708 	wxString		msgText(sTexts[506]);
709 	int				msgflags;
710 	bool			usetp;
711 
712 	if (DK4_E_NONE != m_oErrorReport.ec) {
713 		msgflags = (wxOK | wxCENTRE | wxICON_ERROR);
714 		usetp	 = false;
715 		switch (m_oErrorReport.ec) {
716 			case DK4_E_MEMORY_ALLOCATION_FAILED : {
717 				wxMessageBox(sTexts[346], sTexts[345], msgflags);
718 			} break;
719 			case DK4_E_MATH_OVERFLOW : {
720 				wxMessageBox(sTexts[348], sTexts[347], msgflags);
721 			} break;
722 			case WXD_E_FAILED_TO_OPEN_FILE : {
723 				wxMessageBox(sTexts[508], sTexts[507], msgflags);
724 			} break;
725 			case WXD_E_MOUSE_POS_NOT_AVAILABLE : {
726 				wxMessageBox(sTexts[510], sTexts[509], msgflags);
727 			} break;
728 			case WXD_E_NO_EXPORT_TEXT : {
729 				wxMessageBox(sTexts[512], sTexts[511], msgflags);
730 			} break;
731 			case WXD_E_NO_FILENAME : {
732 				wxMessageBox(sTexts[514], sTexts[513], msgflags);
733 			} break;
734 			case WXD_E_GET_CONTROL_POINT : {
735 				wxMessageBox(sTexts[516], sTexts[515], msgflags);
736 			} break;
737 			case WXD_E_SET_CONTROL_POINT : {
738 				wxMessageBox(sTexts[518], sTexts[517], msgflags);
739 			} break;
740 			case WXD_E_OVERFLOW_COORDINATES : {
741 				wxMessageBox(sTexts[520], sTexts[519], msgflags);
742 			} break;
743 			case WXD_E_MOVE_TO_GROUP : {
744 				wxMessageBox(sTexts[522], sTexts[521], msgflags);
745 			} break;
746 			case WXD_E_UNGROUP_OBJECT : {
747 				wxMessageBox(sTexts[524], sTexts[523], msgflags);
748 			} break;
749 			case WXD_E_BOX_TOO_SMALL : {
750 				wxMessageBox(sTexts[526], sTexts[525], msgflags);
751 			} break;
752 			case WXD_E_BUG_POINT_OOR : {
753 				wxMessageBox(sTexts[528], sTexts[527], msgflags);
754 			} break;
755 			case WXD_E_TOO_MANY_POINTS : {
756 				wxMessageBox(sTexts[530], sTexts[529], msgflags);
757 			} break;
758 			case WXD_E_CANNOT_CONVERT : {
759 				wxMessageBox(sTexts[557], sTexts[556], msgflags);
760 			} break;
761 			case WXD_E_CWD_TOO_LONG : {
762 				wxMessageBox(sTexts[559], sTexts[558], msgflags);
763 			} break;
764 			case WXD_E_NO_CWD : {
765 				wxMessageBox(sTexts[561], sTexts[560], msgflags);
766 			} break;
767 			case WXD_E_OUTPUT_FN_TOO_LONG : {
768 				wxMessageBox(sTexts[563], sTexts[562], msgflags);
769 			} break;
770 			case WXD_E_OUTPUT_DIRNAME : {
771 				wxMessageBox(sTexts[565], sTexts[564], msgflags);
772 			} break;
773 			case WXD_E_FAILED_TO_READ_FILE : {
774 				if (
775 					(WXDRD_E_MEMORY <= m_oStatusReader.ec)
776 					&& (WXDRD_E_BOX_NO_AREA >= m_oStatusReader.ec)
777 				) {
778 					switch (m_oStatusReader.ec) {
779 						case WXDRD_E_NUM_CONV :
780 						case WXDRD_E_COORD_OVERFLOW :
781 						case WXDRD_E_BOX_NO_AREA :
782 						{
783 							usetp = true;
784 						} break;
785 					}
786 					msgText.Append(sTexts[575 + m_oStatusReader.ec]);
787 				}
788 				else {
789 					msgText.Append(sTexts[575]);
790 				}
791 				if (0UL < m_oStatusReader.ln) {
792 					wxString	strLineno;
793 					strLineno.Printf(wxT("%lu"), m_oStatusReader.ln);
794 					msgText.Append(sTexts[596]);
795 					msgText.Append(strLineno);
796 					if (usetp) {
797 						wxString strTextno;
798 						strTextno.Printf(
799 							wxT("%lu"),
800 							((unsigned long)(m_oStatusReader.te) + 1UL)
801 						);
802 						msgText.Append(sTexts[597]);
803 						msgText.Append(strTextno);
804 					}
805 					msgText.Append(sTexts[598]);
806 				}
807 				wxMessageBox(msgText, sTexts[505], msgflags);
808 			} break;
809 			default : {
810 				wxMessageBox(sTexts[350], sTexts[349], msgflags);
811 			} break;
812 		}
813 	}
814 }
815 
816 
817 
818 void
EndEventHandling(void)819 WxdkdrawFrame::EndEventHandling(void)
820 {
821 	if ((NULL != m_pDrw) && (m_bActive) && (NULL != drawco)) {
822 		if (WXD_REFRESH_NONE < m_pDrw->redraw) {
823 			drawco->Refresh();
824 			m_bUpdate = true;
825 		}
826 	}
827 	if (m_bUpdate) {
828 		Update();
829 	}
830 	ErrorReportingAtEventEnd();
831 	dk4error_init(&m_oErrorReport);
832 }
833 
834 
835 
836 bool
CanClose(bool isLast)837 WxdkdrawFrame::CanClose(bool isLast)
838 {
839 	int					res;			/* Result from message box */
840 	bool				back	= true;	/* Function result */
841 
842 
843 	/*	__CHANGE__ 013: Check for unsaved data.
844 	*/
845 	if (isLast) {
846 		SaveConfiguration();
847 	}
848 	if ((NULL != m_pDrw) && (NULL != drawco) && (m_bActive)) {
849 		if (m_bModified) {
850 			Dk4WxYesNoDialog	dlg(
851 				this, pAppHelp, sTexts[169], sTexts[168]
852 			);
853 #if	VERSION_BEFORE_2020_08_23
854 			res =
855 			wxMessageBox(sTexts[169],sTexts[168],(wxYES_NO | wxICON_QUESTION));
856 #else
857 			res = dlg.ShowModal();
858 #endif
859 			if (wxID_YES == res) {
860 				if (!(SaveToFile())) {
861 					back = false;
862 				}
863 			}
864 		}
865 		if (back) {
866 			m_bActive = false;
867 			if (NULL != m_pDrw) {
868 				wxdobj_drw_delete(m_pDrw);
869 			}
870 			m_pDrw = NULL;
871 		}
872 	}
873 
874 	return back;
875 }
876 
877 
878 
879 void
UpdatePositionLabels(bool havepos,int32_t x,int32_t y)880 WxdkdrawFrame::UpdatePositionLabels(bool havepos, int32_t x, int32_t y)
881 {
882 	double	res;
883 
884 	if (havepos) {
885 		wxString	s1 = wxString(sTexts[16]);
886 		wxString	s2 = wxString(sTexts[17]);
887 		wxString	sx = wxEmptyString;
888 		wxString	sy = wxEmptyString;
889 		if (0 != cbGridUnit->GetSelection())	{ res =  6400000.0; }
890 		else									{ res = 16256000.0; }
891 		sx.Printf(wxT("%g"), ((double)x / res));
892 		sy.Printf(wxT("%g"), ((double)y / res));
893 		s1.Append(sx);
894 		s2.Append(sy);
895 		tlPosX->SetLabel(s1);
896 		tlPosY->SetLabel(s2);
897 	}
898 	else {
899 		tlPosX->SetLabel(sTexts[16]);
900 		tlPosY->SetLabel(sTexts[17]);
901 	}
902 	tlPosX->Refresh();
903 	tlPosY->Refresh();
904 	m_bUpdate = true;
905 }
906 
907 
908 
909 bool
UpdateGridPosition(void)910 WxdkdrawFrame::UpdateGridPosition(void)
911 {
912 	dk4_er_t		 er;					/* Error report */
913 	int32_t			 xdraw;				/* Raw x position (not grid-snapped) */
914 	int32_t			 ydraw;				/* Raw y position (not grid-snapped) */
915 	int32_t			 xgrid;				/* Corrected x position (grid-snap) */
916 	int32_t			 ygrid;				/* Corrected y position (grid-snap) */
917 	bool			 ok		= true;		/* Flag: No errors occured */
918 	bool			 back	= false;	/* Function result */
919 
920 	xdraw = drawco->InvX((double)(m_szMousePosPix.GetWidth()), ok);
921 	ydraw = drawco->InvY((double)(m_szMousePosPix.GetHeight()), ok);
922 	if (ok) {
923 		if ((m_ptMousePosRaw.x != xdraw) || (m_ptMousePosRaw.y != ydraw)) {
924 			m_ptMousePosRaw.x = xdraw;
925 			m_ptMousePosRaw.y = ydraw;
926 			back = true;
927 		}
928 	}
929 #if	TRACE_DEBUG
930 	else {
931 	}
932 #endif
933 	xgrid = drawco->GridRoundNearest(xdraw, drawco->m_uGridSnap, ok);
934 	ygrid = drawco->GridRoundNearest(ydraw, drawco->m_uGridSnap, ok);
935 	if (ok) {
936 		if ((m_ptMousePosGrid.x != xgrid) || (m_ptMousePosGrid.y != ygrid)) {
937 			m_ptMousePosGrid.x = xgrid;
938 			m_ptMousePosGrid.y = ygrid;
939 			back = true;
940 		}
941 		if (!(m_bMousePos)) {
942 			back = true;
943 		}
944 		if (back) {
945 			UpdatePositionLabels(true, xgrid, ygrid);
946 		}
947 		m_bMousePos = true;
948 		m_bMouseDiff = false;
949 		switch (m_iState) {
950 			/*
951 				_STATE_	For some states we need to calculate the difference
952 						between move/copy origin point and current point.
953 			*/
954 			case S_MOVE_PLACE :
955 			case S_COPY_PLACE :
956 			case S_LIBELEM_PLACE :
957 			case S_MOVEPT_PLACE :
958 			case S_DRWSZ_PLACE :
959 			{
960 				dk4error_init(&er);
961 				m_ptMouseMoveDiff.x = dk4ma_int32_t_sub(
962 					m_ptMousePosGrid.x, m_ptMouseMoveStart.x, &er
963 				);
964 				m_ptMouseMoveDiff.y = dk4ma_int32_t_sub(
965 					m_ptMousePosGrid.y, m_ptMouseMoveStart.y, &er
966 				);
967 				if (DK4_E_NONE == er.ec) {
968 					m_bMouseDiff = true;
969 				}
970 #if	TRACE_DEBUG
971 				else {
972 				}
973 #endif
974 			} break;
975 #if	TRACE_DEBUG
976 			default : {
977 			} break;
978 #endif
979 		}
980 	}
981 	else {
982 		if (m_bMousePos) {
983 			UpdatePositionLabels(false, (int32_t)0L, (int32_t)0L);
984 			back = true;
985 		}
986 		m_bMousePos = false;
987 		m_bMouseDiff = false;
988 	}
989 	return back;
990 }
991 
992 
993 
994 bool
UpdateMousePosition(wxMouseEvent & event)995 WxdkdrawFrame::UpdateMousePosition(wxMouseEvent & event)
996 {
997 	int		xpos	= 0;		/* Mouse x position in pixels */
998 	int		ypos	= 0;		/* Mouse y position in pixels */
999 	bool	back	= false;	/* Function result */
1000 
1001 	event.GetPosition(&xpos, &ypos);
1002 	if (
1003 		(m_szMousePosPix.GetWidth() != xpos)
1004 		|| (m_szMousePosPix.GetHeight() != ypos)
1005 	)
1006 	{
1007 		m_szMousePosPix.SetWidth(xpos);
1008 		m_szMousePosPix.SetHeight(ypos);
1009 		back = UpdateGridPosition();
1010 	}
1011 
1012 	return back;
1013 }
1014 
1015 
1016 
1017 void
ControlMouseEnter(wxMouseEvent & event)1018 WxdkdrawFrame::ControlMouseEnter(wxMouseEvent & event)
1019 {
1020 #if	0
1021 
1022 	StartEventHandling();
1023 	if (UpdateMousePosition(event)) {
1024 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
1025 	}
1026 
1027 	EndEventHandling();
1028 #endif
1029 
1030 	ControlMouseMove(event);
1031 
1032 }
1033 
1034 
1035 
1036 void
ControlMouseLeave(wxMouseEvent & WXUNUSED (event))1037 WxdkdrawFrame::ControlMouseLeave(wxMouseEvent & WXUNUSED(event))
1038 {
1039 
1040 	StartEventHandling();
1041 	if (m_bMousePos) {
1042 		UpdatePositionLabels(false, (int32_t)0L, (int32_t)0L);
1043 	}
1044 	m_bMousePos = false;
1045 	if ((S_NOOP == m_iState) && (NULL != m_pCurrent)) {
1046 		m_pCurrent->mark = (uint8_t)((m_pCurrent->mark) & (~(OBJ_MARKER_1)));
1047 		m_pCurrent = NULL;
1048 	}
1049 	wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
1050 
1051 	EndEventHandling();
1052 }
1053 
1054 
1055 
1056 void
ControlMouseMove(wxMouseEvent & event)1057 WxdkdrawFrame::ControlMouseMove(wxMouseEvent & event)
1058 {
1059 
1060 	StartEventHandling();
1061 	if (UpdateMousePosition(event)) {
1062 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
1063 	}
1064 	/*
1065 		_STATE_	Call mouse move method.
1066 	*/
1067 	switch (m_iState) {
1068 		case S_NOOP : {
1069 			MouseMoveNoop();
1070 		} break;
1071 		case S_DELETE : {
1072 			MouseMoveDelete();
1073 		} break;
1074 		case S_REGION_DELETE : {
1075 			MouseMoveRegionDelete();
1076 		} break;
1077 		case S_MOVE_SELECT : {
1078 			MouseMoveMoveSelect();
1079 		} break;
1080 		case S_MOVE_PLACE : {
1081 			MouseMoveMovePlace();
1082 		} break;
1083 		case S_COPY_SELECT : {
1084 			MouseMoveCopySelect();
1085 		} break;
1086 		case S_COPY_PLACE : {
1087 			MouseMoveCopyPlace();
1088 		} break;
1089 		case S_POLY_FIRST : {
1090 			MouseMovePolyFirst();
1091 		} break;
1092 		case S_POLY_FURTHER : {
1093 			MouseMovePolyFurther();
1094 		} break;
1095 		case S_SPLINE_FIRST : {
1096 			MouseMoveSplineFirst();
1097 		} break;
1098 		case S_SPLINE_FURTHER : {
1099 			MouseMoveSplineFurther();
1100 		} break;
1101 		case S_BOX_FIRST : {
1102 			MouseMoveBoxFirst();
1103 		} break;
1104 		case S_BOX_OPPOSITE : {
1105 			MouseMoveBoxOpposite();
1106 		} break;
1107 		case S_CIRCLE_CENTER : {
1108 			MouseMoveCircleCenter();
1109 		} break;
1110 		case S_CIRCLE_RADIUS : {
1111 			MouseMoveCircleRadius();
1112 		} break;
1113 		case S_ELLIPSE_CENTER : {
1114 			MouseMoveEllipseCenter();
1115 		} break;
1116 		case S_ELLIPSE_CORNER : {
1117 			MouseMoveEllipseCorner();
1118 		} break;
1119 		case S_ARC_1 : {
1120 			MouseMoveArc1();
1121 		} break;
1122 		case S_ARC_2 : {
1123 			MouseMoveArc2();
1124 		} break;
1125 		case S_ARC_3 : {
1126 			MouseMoveArc3();
1127 		} break;
1128 		case S_DOT : {
1129 			MouseMoveDot();
1130 		} break;
1131 		case S_TEXT : {
1132 			MouseMoveText();
1133 		} break;
1134 		case S_IMG_1 : {
1135 			MouseMoveImage1();
1136 		} break;
1137 		case S_IMG_2 : {
1138 			MouseMoveImage2();
1139 		} break;
1140 		case S_LIBELEM_PLACE : {
1141 			MouseMoveLibelemPlace();
1142 		} break;
1143 		case S_MOVEPT_SELECT : {
1144 			MouseMovePointMoveSelect();
1145 		} break;
1146 		case S_MOVEPT_PLACE : {
1147 			MouseMovePointMovePlace();
1148 		} break;
1149 		case S_DELPT : {
1150 			MouseMovePointDelete();
1151 		} break;
1152 		case S_ADDPT_SELECT : {
1153 			MouseMovePointAddSelect();
1154 		} break;
1155 		case S_ADDPT_PLACE : {
1156 			MouseMovePointAddPlace();
1157 		} break;
1158 		case S_DRWSZ_SELECT : {
1159 			MouseMoveDrawingSizeSelect();
1160 		} break;
1161 		case S_DRWSZ_PLACE : {
1162 			MouseMoveDrawingSizePlace();
1163 		} break;
1164 		case S_FLIP : {
1165 			MouseMoveFlip();
1166 		} break;
1167 		case S_GROUP_ONE : {
1168 			MouseMoveGroupOne();
1169 		} break;
1170 		case S_GROUP_RECT_1 : {
1171 			MouseMoveGroupRect1();
1172 		} break;
1173 		case S_GROUP_RECT_2 : {
1174 			MouseMoveGroupRect2();
1175 		} break;
1176 		case S_UNGROUP : {
1177 			MouseMoveUngroup();
1178 		} break;
1179 		case S_DETAILS : {
1180 			MouseMoveDetails();
1181 		} break;
1182 		case S_DETAILS_2 : {
1183 		} break;
1184 		case S_CONVERT : {
1185 			MouseMoveConvert();
1186 		} break;
1187 		case S_ROTATE : {
1188 			MouseMoveRotate();
1189 		} break;
1190 		case S_MOD_SPLINE : {
1191 			MouseMoveModspline();
1192 		} break;
1193 	}
1194 
1195 	EndEventHandling();
1196 }
1197 
1198 
1199 
1200 void
ControlLeftMouseButton(wxMouseEvent & event)1201 WxdkdrawFrame::ControlLeftMouseButton(wxMouseEvent & event)
1202 {
1203 
1204 	StartEventHandling();
1205 	if (UpdateMousePosition(event)) {
1206 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
1207 	}
1208 	/*
1209 		_STATE_	Call mouse button method.
1210 	*/
1211 	switch (m_iState) {
1212 		case S_NOOP : {
1213 			MouseLeftNoop();
1214 		} break;
1215 		case S_DELETE : {
1216 			MouseLeftDelete();
1217 		} break;
1218 		case S_REGION_DELETE : {
1219 			MouseLeftRegionDelete();
1220 		} break;
1221 		case S_MOVE_SELECT : {
1222 			MouseLeftMoveSelect();
1223 		} break;
1224 		case S_MOVE_PLACE : {
1225 			MouseLeftMovePlace();
1226 		} break;
1227 		case S_COPY_SELECT : {
1228 			MouseLeftCopySelect();
1229 		} break;
1230 		case S_COPY_PLACE : {
1231 			MouseLeftCopyPlace();
1232 		} break;
1233 		case S_POLY_FIRST : {
1234 			MouseLeftPolyFirst();
1235 		} break;
1236 		case S_POLY_FURTHER : {
1237 			MouseLeftPolyFurther();
1238 		} break;
1239 		case S_SPLINE_FIRST : {
1240 			MouseLeftSplineFirst();
1241 		} break;
1242 		case S_SPLINE_FURTHER : {
1243 			MouseLeftSplineFurther();
1244 		} break;
1245 		case S_BOX_FIRST : {
1246 			MouseLeftBoxFirst();
1247 		} break;
1248 		case S_BOX_OPPOSITE : {
1249 			MouseLeftBoxOpposite();
1250 		} break;
1251 		case S_CIRCLE_CENTER : {
1252 			MouseLeftCircleCenter();
1253 		} break;
1254 		case S_CIRCLE_RADIUS : {
1255 			MouseLeftCircleRadius();
1256 		} break;
1257 		case S_ELLIPSE_CENTER : {
1258 			MouseLeftEllipseCenter();
1259 		} break;
1260 		case S_ELLIPSE_CORNER : {
1261 			MouseLeftEllipseCorner();
1262 		} break;
1263 		case S_ARC_1 : {
1264 			MouseLeftArc1();
1265 		} break;
1266 		case S_ARC_2 : {
1267 			MouseLeftArc2();
1268 		} break;
1269 		case S_ARC_3 : {
1270 			MouseLeftArc3();
1271 		} break;
1272 		case S_DOT : {
1273 			MouseLeftDot();
1274 		} break;
1275 		case S_TEXT : {
1276 			MouseLeftText();
1277 		} break;
1278 		case S_IMG_1 : {
1279 			MouseLeftImage1();
1280 		} break;
1281 		case S_IMG_2 : {
1282 			MouseLeftImage2();
1283 		} break;
1284 		case S_LIBELEM_PLACE : {
1285 			MouseLeftLibelemPlace();
1286 		} break;
1287 		case S_MOVEPT_SELECT : {
1288 			MouseLeftPointMoveSelect();
1289 		} break;
1290 		case S_MOVEPT_PLACE : {
1291 			MouseLeftPointMovePlace();
1292 		} break;
1293 		case S_DELPT : {
1294 			MouseLeftPointDelete();
1295 		} break;
1296 		case S_ADDPT_SELECT : {
1297 			MouseLeftPointAddSelect();
1298 		} break;
1299 		case S_ADDPT_PLACE : {
1300 			MouseLeftPointAddPlace();
1301 		} break;
1302 		case S_DRWSZ_SELECT : {
1303 			MouseLeftDrawingSizeSelect();
1304 		} break;
1305 		case S_DRWSZ_PLACE : {
1306 			MouseLeftDrawingSizePlace();
1307 		} break;
1308 		case S_FLIP : {
1309 			MouseLeftFlip();
1310 		} break;
1311 		case S_GROUP_ONE : {
1312 			MouseLeftGroupOne();
1313 		} break;
1314 		case S_GROUP_RECT_1 : {
1315 			MouseLeftGroupRect1();
1316 		} break;
1317 		case S_GROUP_RECT_2 : {
1318 			MouseLeftGroupRect2();
1319 		} break;
1320 		case S_UNGROUP : {
1321 			MouseLeftUngroup();
1322 		} break;
1323 		case S_DETAILS : {
1324 			MouseLeftDetails();
1325 		} break;
1326 		case S_DETAILS_2 : {
1327 		} break;
1328 		case S_CONVERT : {
1329 			MouseLeftConvert();
1330 		} break;
1331 		case S_ROTATE : {
1332 			MouseLeftRotate();
1333 		} break;
1334 		case S_MOD_SPLINE : {
1335 			MouseLeftModspline();
1336 		} break;
1337 	}
1338 
1339 	EndEventHandling();
1340 }
1341 
1342 
1343 
1344 void
RightMouseOrEscape(void)1345 WxdkdrawFrame::RightMouseOrEscape(void)
1346 {
1347 	Wxd_object_t	*pCurrent;
1348 	uint16_t		 uCurrent;
1349 
1350 	switch (m_iState) {
1351 		case S_MOVEPT_PLACE : {
1352 			pCurrent = NULL;
1353 			uCurrent = 0U;
1354 			if (
1355 				(NULL != m_pCurrent)
1356 				&& (
1357 					(WXD_OT_O_SPLINE == m_pCurrent->ot)
1358 					|| (WXD_OT_C_SPLINE == m_pCurrent->ot)
1359 				)
1360 				&& (m_uCurrent < (m_pCurrent->det).s.n)
1361 			) {
1362 				pCurrent = m_pCurrent;
1363 				uCurrent = m_uCurrent;
1364 			}
1365 			EndOperation();
1366 			if (NULL != pCurrent) {
1367 				wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
1368 				drawco->Refresh();
1369 				Update();
1370 				ModifySplineValue(pCurrent, uCurrent);
1371 				m_iState = S_MOVEPT_SELECT;
1372         		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
1373 				SetMouseAndStatusTexts(m_iState);
1374 			}
1375 		} break;
1376 		case S_NOOP :
1377 		case S_DELETE :
1378 		case S_REGION_DELETE :
1379 		case S_MOVE_SELECT :
1380 		case S_MOVE_PLACE :
1381 		case S_COPY_SELECT :
1382 		case S_COPY_PLACE :
1383 		case S_POLY_FIRST :
1384 		case S_POLY_FURTHER :
1385 		case S_SPLINE_FIRST :
1386 		case S_SPLINE_FURTHER :
1387 		case S_BOX_FIRST :
1388 		case S_BOX_OPPOSITE :
1389 		case S_CIRCLE_CENTER :
1390 		case S_CIRCLE_RADIUS :
1391 		case S_ELLIPSE_CENTER :
1392 		case S_ELLIPSE_CORNER :
1393 		case S_ARC_1 :
1394 		case S_ARC_2 :
1395 		case S_ARC_3 :
1396 		case S_DOT :
1397 		case S_TEXT :
1398 		case S_IMG_1 :
1399 		case S_IMG_2 :
1400 		case S_LIBELEM_PLACE :
1401 		case S_MOVEPT_SELECT :
1402 		case S_DELPT :
1403 		case S_DRWSZ_SELECT :
1404 		case S_DRWSZ_PLACE :
1405 		case S_GROUP_ONE :
1406 		case S_GROUP_RECT_1 :
1407 		case S_GROUP_RECT_2 :
1408 		case S_DETAILS :
1409 		case S_DETAILS_2 :
1410 		case S_CONVERT :
1411 		case S_ROTATE :
1412 		case S_MOD_SPLINE :
1413 		default : {
1414 			EndOperation();
1415 		} break;
1416 	}
1417 
1418 }
1419 
1420 
1421 
1422 void
ControlRightMouseButton(wxMouseEvent & event)1423 WxdkdrawFrame::ControlRightMouseButton(wxMouseEvent & event)
1424 {
1425 
1426 	StartEventHandling();
1427 	if (UpdateMousePosition(event)) {
1428 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
1429 	}
1430 	/*
1431 		_STATE_	Call right mouse button method.
1432 	*/
1433 	RightMouseOrEscape();
1434 
1435 	EndEventHandling();
1436 }
1437 
1438 
1439 
1440 void
ControlMiddleMouseButton(wxMouseEvent & event)1441 WxdkdrawFrame::ControlMiddleMouseButton(wxMouseEvent & event)
1442 {
1443 
1444 	StartEventHandling();
1445 	if (UpdateMousePosition(event)) {
1446 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
1447 	}
1448 	switch (m_iState) {
1449 		case S_DELETE : {
1450 			MouseMiddleDelete();
1451 		} break;
1452 	}
1453 
1454 	EndEventHandling();
1455 }
1456 
1457 
1458 
1459 
1460 void
OnQuit(wxCommandEvent & WXUNUSED (event))1461 WxdkdrawFrame::OnQuit(wxCommandEvent & WXUNUSED(event))
1462 {
1463 
1464 	EndOperation(true);
1465 
1466 	Close();
1467 }
1468 
1469 
1470 
1471 void
OnAbout(wxCommandEvent & WXUNUSED (event))1472 WxdkdrawFrame::OnAbout(wxCommandEvent & WXUNUSED(event))
1473 {
1474 	wxString	text(wxT(""));
1475 	wxString	title(wxT(""));
1476 
1477 	/* Construct message text. */
1478 	text.Append(sNlWx[0]);
1479 #if	0
1480 	/*	Do not show a separated version number for wxdkdraw as it is
1481 		a part of DK tools and libraries.
1482 	*/
1483 	text.Append(sNlWx[7]);
1484 	text.Append(sNlWx[1]);
1485 #endif
1486 	text.Append(sNlWx[8]);
1487 	text.Append(sTexts[19]);
1488 	text.Append(versno);
1489 	text.Append(sNlWx[8]);
1490 	text.Append(sTexts[9]);
1491 	text.Append(sNlWx[2]);
1492 	text.Append(sNlWx[8]);
1493 	text.Append(sNlWx[8]);
1494 	text.Append(sTexts[11]);
1495 	text.Append(sNlWx[8]);
1496 	text.Append(sNlWx[9]);
1497 	text.Append(sNlWx[8]);
1498 	text.Append(sNlWx[8]);
1499 	text.Append(sTexts[12]);
1500 	text.Append(sNlWx[8]);
1501 	text.Append(sNlWx[10]);
1502 	text.Append(sNlWx[8]);
1503 	text.Append(sNlWx[11]);
1504 	text.Append(sNlWx[8]);
1505 	text.Append(sNlWx[12]);
1506 	text.Append(sNlWx[8]);
1507 	text.Append(sNlWx[13]);
1508 	text.Append(sNlWx[8]);
1509 	text.Append(sNlWx[14]);
1510 	text.Append(sNlWx[8]);
1511 	text.Append(sNlWx[15]);
1512 	text.Append(sNlWx[8]);
1513 
1514 	/* Construct dialog box title. */
1515 	title.Append(sTexts[10]);
1516 	title.Append(sNlWx[0]);
1517 
1518 	/* Show dialog box. */
1519 	wxMessageBox(text, title);
1520 
1521 
1522 }
1523 
1524 
1525 
1526 void
OnHelpContents(wxCommandEvent & WXUNUSED (event))1527 WxdkdrawFrame::OnHelpContents(wxCommandEvent & WXUNUSED(event))
1528 {
1529 
1530 #if	1
1531 	DisplayContents();
1532 #else
1533     if (!(FindFileAndLaunch(dkT("wxdkdraw.pdf"), true))) {
1534 		DisplayContents();
1535 	}
1536 #endif
1537 
1538 }
1539 
1540 
1541 
1542 void
OnIdle(wxIdleEvent & event)1543 WxdkdrawFrame::OnIdle(wxIdleEvent & event)
1544 {
1545 	bool	isFirstIdleEvent = true;
1546 
1547 	/*
1548 		Check whether we really have the first idle event.
1549 	*/
1550 	{
1551 		wxCriticalSectionLocker	lock(csIsFirstIdle);
1552 		isFirstIdleEvent = m_bIsFirstIdle;
1553 		m_bIsFirstIdle = false;
1554 	}
1555 	if (isFirstIdleEvent) {
1556 
1557 		Disconnect(wxEVT_IDLE, wxIdleEventHandler(WxdkdrawFrame::OnIdle));
1558 
1559 		OnFirstIdle();
1560 
1561 		Update();
1562 	}
1563 
1564 	event.Skip();
1565 }
1566 
1567 
1568 
1569 void
OnFileNew(wxCommandEvent & WXUNUSED (event))1570 WxdkdrawFrame::OnFileNew(wxCommandEvent & WXUNUSED(event))
1571 {
1572 	Wxd_drawing_t	*pDrw	= NULL;				/* New drawing */
1573 	int				 res;						/* Operation result */
1574 	bool			 bLoadNew	= true;			/* Can load new empty drawing */
1575 
1576 	if (BeginEventHandling()) {
1577 		EndOperation(true);
1578 		EndEventHandling();
1579 		if (m_bModified) {
1580 			Dk4WxYesNoDialog	dlg(
1581 				this, pAppHelp, sTexts[169], sTexts[168]
1582 			);
1583 #if	VERSION_BEFORE_2020_08_23
1584 			res =
1585 			wxMessageBox(sTexts[169],sTexts[168],(wxYES_NO | wxICON_QUESTION));
1586 #else
1587 			res = dlg.ShowModal();
1588 #endif
1589 			if (wxID_YES == res) {
1590 				if (!(SaveToFile())) {
1591 					bLoadNew = false;
1592 				}
1593 			}
1594 		}
1595 		if (bLoadNew) {
1596 			pDrw = wxdobj_drw_new();
1597 			if (NULL != pDrw) {
1598 				wxdobj_drw_delete(m_pDrw);
1599 				m_pDrw = pDrw;
1600 				m_sFileFull		= wxEmptyString;
1601 				m_sFileDir		= wxEmptyString;
1602 				m_sFileShort	= wxEmptyString;
1603 				m_bHaveName		= false;
1604 				SetTitle(sTexts[18]);
1605 				DrawingLoaded();
1606 				szTopBar->Layout();
1607 				m_bUpdate = true;
1608 			}
1609 			else {
1610 			}
1611 		}
1612 	}
1613 
1614 }
1615 
1616 
1617 
1618 void
OnFileOpen(wxCommandEvent & WXUNUSED (event))1619 WxdkdrawFrame::OnFileOpen(wxCommandEvent & WXUNUSED(event))
1620 {
1621 	wxString		 sDialogTitle(sTexts[339]);	/* Dialog box title */
1622 	wxString		 sFileTypes(sTexts[172]);	/* File type suffixes */
1623 	Wxd_drawing_t	*pDrw	= NULL;				/* New drawing */
1624 	int				 res;						/* Intermediate result */
1625 	bool			 bLoadNew	= true;			/* Flag: Can load new file */
1626 
1627 
1628 	wxdrd_status_init(&m_oStatusReader);
1629 	if (BeginEventHandling()) {
1630 		EndOperation(true);
1631 		if (m_bModified) {
1632 			Dk4WxYesNoDialog	dlg(
1633 				this, pAppHelp, sTexts[169], sTexts[168]
1634 			);
1635 #if	VERSION_BEFORE_2020_08_23
1636 			res =
1637 			wxMessageBox(sTexts[169],sTexts[168],(wxYES_NO | wxICON_QUESTION));
1638 #else
1639 			res = dlg.ShowModal();
1640 #endif
1641 			if (wxID_YES == res) {
1642 				if (!(SaveToFile())) {
1643 					bLoadNew = false;
1644 				}
1645 			}
1646 		}
1647 		if (bLoadNew) {
1648 #if	wxCHECK_VERSION(2, 9, 0)
1649 			wxFileDialog dlg(
1650 				this, sDialogTitle, m_sFileDir, m_sFileShort,
1651 				sFileTypes, (wxFD_OPEN | wxFD_FILE_MUST_EXIST)
1652 			);
1653 #else
1654 			wxFileDialog dlg(
1655 				this, sDialogTitle, m_sFileDir, m_sFileShort,
1656 				sFileTypes, wxOPEN
1657 			);
1658 #endif
1659 			if(wxID_OK == dlg.ShowModal()) {
1660 				wxString pa = dlg.GetPath();
1661 				pDrw = ReadDrawingFromFile(pa);
1662 				if (NULL != pDrw) {
1663 					wxdobj_drw_delete(m_pDrw);
1664 					m_pDrw = pDrw;
1665 					m_sFileFull  = pa;
1666 					m_sFileDir   = dlg.GetDirectory();
1667 					m_sFileShort = dlg.GetFilename();
1668 					m_bHaveName  = true;
1669 					SetTitle(m_sFileShort);
1670 					DrawingLoaded();
1671 					szTopBar->Layout();
1672 					m_bUpdate = true;
1673 				}
1674 				else {
1675 					/* ERROR: Failed to read file, already reported */
1676 				}
1677 			}
1678 		}
1679 		ModificationReportingAtEventEnd();
1680 		EndEventHandling();
1681 
1682 		wxdrd_status_init(&m_oStatusReader);
1683 	}
1684 
1685 }
1686 
1687 
1688 
1689 void
OnFileSave(wxCommandEvent & WXUNUSED (event))1690 WxdkdrawFrame::OnFileSave(wxCommandEvent & WXUNUSED(event))
1691 {
1692 
1693 	wxdwr_status_init(&m_oStatusWriter, pAppHelp->GetWxEncoding());
1694 	if (BeginEventHandling()) {
1695 		EndOperation(true);
1696 		SaveToFile();
1697 		EndEventHandling();
1698 	}
1699 
1700 }
1701 
1702 
1703 
1704 void
OnFileSaveAs(wxCommandEvent & WXUNUSED (event))1705 WxdkdrawFrame::OnFileSaveAs(wxCommandEvent & WXUNUSED(event))
1706 {
1707 	wxString	sNewTitle = wxEmptyString;	/* New program window title */
1708 	wxString	sDlgTitle(sTexts[171]);		/* Dialog title */
1709 	wxString	sDlgTypes(sTexts[172]);		/* File type suffixes */
1710 
1711 	wxdwr_status_init(&m_oStatusWriter, pAppHelp->GetWxEncoding());
1712 	if (BeginEventHandling()) {
1713 		EndOperation(true);
1714 #if wxCHECK_VERSION(2, 9, 0)
1715 		wxFileDialog dlg(
1716 			this, sDlgTitle, m_sFileDir, m_sFileShort,
1717 			sDlgTypes, (wxFD_SAVE | wxFD_OVERWRITE_PROMPT)
1718 		);
1719 #else
1720 		wxFileDialog dlg(
1721 			this, sDlgTitle, m_sFileDir, m_sFileShort,
1722 			sDlgTypes, wxSAVE
1723 		);
1724 #endif
1725 		if(wxID_OK == dlg.ShowModal()) {
1726 			m_sFileFull = dlg.GetPath();
1727 			m_sFileDir = dlg.GetDirectory();
1728 			m_sFileShort = dlg.GetFilename();
1729 			m_bHaveName = true;
1730 			if (m_bModified) {
1731 				sNewTitle.Append(sTexts[170]);
1732 				sNewTitle.Append(m_sFileShort);
1733 				SetTitle(sNewTitle);
1734 			}
1735 			else {
1736 				SetTitle(m_sFileShort);
1737 			}
1738 			m_bUpdate = true;
1739 			SaveToFile();
1740 		}
1741 		EndEventHandling();
1742 	}
1743 
1744 }
1745 
1746 
1747 
1748 void
OnZoomIn(wxCommandEvent & WXUNUSED (event))1749 WxdkdrawFrame::OnZoomIn(wxCommandEvent & WXUNUSED(event))
1750 {
1751 
1752 	if (BeginEventHandling()) {
1753 		if ((int8_t)14 > m_pDrw->zl) {
1754 			m_pDrw->zl = (int8_t)(m_pDrw->zl + 1);
1755 			ZoomChanged(false);
1756 		}
1757 		EndEventHandling();
1758 	}
1759 
1760 }
1761 
1762 
1763 
1764 void
OnZoomOut(wxCommandEvent & WXUNUSED (event))1765 WxdkdrawFrame::OnZoomOut(wxCommandEvent & WXUNUSED(event))
1766 {
1767 
1768 	if (BeginEventHandling()) {
1769 		if ((int8_t)(-14) < m_pDrw->zl) {
1770 			m_pDrw->zl = (int8_t)(m_pDrw->zl - 1);
1771 			ZoomChanged(true);
1772 		}
1773 		EndEventHandling();
1774 	}
1775 
1776 }
1777 
1778 
1779 
1780 void
OnZoom100(wxCommandEvent & WXUNUSED (event))1781 WxdkdrawFrame::OnZoom100(wxCommandEvent & WXUNUSED(event))
1782 {
1783 	bool	bZoomOut;
1784 
1785 	if (BeginEventHandling()) {
1786 		if ((int8_t)0 != m_pDrw->zl) {
1787 			bZoomOut = ((int8_t)0 < m_pDrw->zl);
1788 			m_pDrw->zl = (int8_t)0;
1789 			ZoomChanged(bZoomOut);
1790 		}
1791 		EndEventHandling();
1792 	}
1793 
1794 }
1795 
1796 
1797 
1798 void
OnPolygonPolyline(int8_t ot)1799 WxdkdrawFrame::OnPolygonPolyline(int8_t ot)
1800 {
1801 	m_iObjToCreate = ot;
1802 	m_iState = S_POLY_FIRST;
1803 	SetMouseAndStatusTexts(S_POLY_FIRST);
1804 	m_bAcceptablePoint = false;
1805 }
1806 
1807 
1808 
1809 void
OnAddPolyline(wxCommandEvent & WXUNUSED (event))1810 WxdkdrawFrame::OnAddPolyline(wxCommandEvent & WXUNUSED(event))
1811 {
1812 
1813 	if (BeginEventHandling()) {
1814 		EndOperation(true);
1815 		OnPolygonPolyline(WXD_OT_POLYLINE);
1816 		EndEventHandling();
1817 	}
1818 
1819 }
1820 
1821 
1822 
1823 void
OnAddPolygon(wxCommandEvent & WXUNUSED (event))1824 WxdkdrawFrame::OnAddPolygon(wxCommandEvent & WXUNUSED(event))
1825 {
1826 
1827 	if (BeginEventHandling()) {
1828 		EndOperation(true);
1829 		OnPolygonPolyline(WXD_OT_POLYGON);
1830 		EndEventHandling();
1831 	}
1832 
1833 }
1834 
1835 
1836 
1837 void
OnRectangleBox(bool bRounded)1838 WxdkdrawFrame::OnRectangleBox(bool bRounded)
1839 {
1840 	m_iState				= S_BOX_FIRST;
1841 	m_bSplineInterpolated	= bRounded;
1842 	m_bAcceptablePoint		= false;
1843 	SetMouseAndStatusTexts(S_BOX_FIRST);
1844 }
1845 
1846 
1847 
1848 void
OnAddRectangle(wxCommandEvent & WXUNUSED (event))1849 WxdkdrawFrame::OnAddRectangle(wxCommandEvent & WXUNUSED(event))
1850 {
1851 
1852 	if (BeginEventHandling()) {
1853 		EndOperation(true);
1854 		OnRectangleBox(false);
1855 		EndEventHandling();
1856 	}
1857 
1858 }
1859 
1860 
1861 
1862 void
OnAddBox(wxCommandEvent & WXUNUSED (event))1863 WxdkdrawFrame::OnAddBox(wxCommandEvent & WXUNUSED(event))
1864 {
1865 
1866 	if (BeginEventHandling()) {
1867 		EndOperation(true);
1868 		OnRectangleBox(true);
1869 		EndEventHandling();
1870 	}
1871 
1872 }
1873 
1874 
1875 
1876 void
OnAddCircle(wxCommandEvent & WXUNUSED (event))1877 WxdkdrawFrame::OnAddCircle(wxCommandEvent & WXUNUSED(event))
1878 {
1879 
1880 	if (BeginEventHandling()) {
1881 		EndOperation(true);
1882 		m_iState = S_CIRCLE_CENTER;
1883 		SetMouseAndStatusTexts(S_CIRCLE_CENTER);
1884 		m_bAcceptablePoint = false;
1885 		EndEventHandling();
1886 	}
1887 
1888 }
1889 
1890 
1891 
1892 void
OnAddEllipse(wxCommandEvent & WXUNUSED (event))1893 WxdkdrawFrame::OnAddEllipse(wxCommandEvent & WXUNUSED(event))
1894 {
1895 
1896 	if (BeginEventHandling()) {
1897 		EndOperation(true);
1898 		m_iState = S_ELLIPSE_CENTER;
1899 		SetMouseAndStatusTexts(m_iState);
1900 		m_bAcceptablePoint = false;
1901 		EndEventHandling();
1902 	}
1903 
1904 }
1905 
1906 
1907 
1908 void
OnAddArcOpen(wxCommandEvent & WXUNUSED (event))1909 WxdkdrawFrame::OnAddArcOpen(wxCommandEvent & WXUNUSED(event))
1910 {
1911 
1912 	if (BeginEventHandling()) {
1913 		EndOperation(true);
1914 		m_iObjToCreate = WXD_OT_O_ARC;
1915 		m_iState = S_ARC_1;
1916 		SetMouseAndStatusTexts(m_iState);
1917 		m_bAcceptablePoint = false;
1918 		EndEventHandling();
1919 	}
1920 
1921 }
1922 
1923 
1924 
1925 void
OnAddArcClosed(wxCommandEvent & WXUNUSED (event))1926 WxdkdrawFrame::OnAddArcClosed(wxCommandEvent & WXUNUSED(event))
1927 {
1928 
1929 	if (BeginEventHandling()) {
1930 		EndOperation(true);
1931 		m_iObjToCreate = WXD_OT_C_ARC;
1932 		m_iState = S_ARC_1;
1933 		SetMouseAndStatusTexts(m_iState);
1934 		m_bAcceptablePoint = false;
1935 		EndEventHandling();
1936 	}
1937 
1938 }
1939 
1940 
1941 
1942 void
OnSpline(int8_t ot,bool bInterpolated)1943 WxdkdrawFrame::OnSpline(int8_t ot, bool bInterpolated)
1944 {
1945 	m_iObjToCreate			= ot;
1946 	m_bSplineInterpolated	= bInterpolated;
1947 	m_iState				= S_SPLINE_FIRST;
1948 	m_bAcceptablePoint		= false;
1949 	SetMouseAndStatusTexts(S_SPLINE_FIRST);
1950 }
1951 
1952 
1953 
1954 void
OnAddSplineAO(wxCommandEvent & WXUNUSED (event))1955 WxdkdrawFrame::OnAddSplineAO(wxCommandEvent & WXUNUSED(event))
1956 {
1957 
1958 	if (BeginEventHandling()) {
1959 		EndOperation(true);
1960 		OnSpline(WXD_OT_O_SPLINE, false);
1961 		EndEventHandling();
1962 	}
1963 
1964 }
1965 
1966 
1967 
1968 void
OnAddSplineAC(wxCommandEvent & WXUNUSED (event))1969 WxdkdrawFrame::OnAddSplineAC(wxCommandEvent & WXUNUSED(event))
1970 {
1971 
1972 	if (BeginEventHandling()) {
1973 		EndOperation(true);
1974 		OnSpline(WXD_OT_C_SPLINE, false);
1975 		EndEventHandling();
1976 	}
1977 
1978 }
1979 
1980 
1981 
1982 void
OnAddSplineIO(wxCommandEvent & WXUNUSED (event))1983 WxdkdrawFrame::OnAddSplineIO(wxCommandEvent & WXUNUSED(event))
1984 {
1985 
1986 	if (BeginEventHandling()) {
1987 		EndOperation(true);
1988 		OnSpline(WXD_OT_O_SPLINE, true);
1989 		EndEventHandling();
1990 	}
1991 
1992 }
1993 
1994 
1995 
1996 void
OnAddSplineIC(wxCommandEvent & WXUNUSED (event))1997 WxdkdrawFrame::OnAddSplineIC(wxCommandEvent & WXUNUSED(event))
1998 {
1999 
2000 	if (BeginEventHandling()) {
2001 		EndOperation(true);
2002 		OnSpline(WXD_OT_C_SPLINE, true);
2003 		EndEventHandling();
2004 	}
2005 
2006 }
2007 
2008 
2009 
2010 void
OnAddDot(wxCommandEvent & WXUNUSED (event))2011 WxdkdrawFrame::OnAddDot(wxCommandEvent & WXUNUSED(event))
2012 {
2013 
2014 	if (BeginEventHandling()) {
2015 		EndOperation(true);
2016 		m_iObjToCreate = WXD_OT_DOT_FILLED;
2017 		m_iState = S_DOT;
2018 		SetMouseAndStatusTexts(m_iState);
2019 		EndEventHandling();
2020 	}
2021 
2022 }
2023 
2024 
2025 
2026 void
OnAddWhiteDot(wxCommandEvent & WXUNUSED (event))2027 WxdkdrawFrame::OnAddWhiteDot(wxCommandEvent & WXUNUSED(event))
2028 {
2029 
2030 	if (BeginEventHandling()) {
2031 		EndOperation(true);
2032 		m_iObjToCreate = WXD_OT_DOT_WHITE;
2033 		m_iState = S_DOT;
2034 		SetMouseAndStatusTexts(m_iState);
2035 		EndEventHandling();
2036 	}
2037 
2038 }
2039 
2040 
2041 
2042 void
OnAddTextlabel(wxCommandEvent & WXUNUSED (event))2043 WxdkdrawFrame::OnAddTextlabel(wxCommandEvent & WXUNUSED(event))
2044 {
2045 
2046 	if (BeginEventHandling()) {
2047 		EndOperation(true);
2048 		m_iState = S_TEXT;
2049 		SetMouseAndStatusTexts(m_iState);
2050 		EndEventHandling();
2051 	}
2052 
2053 }
2054 
2055 
2056 
2057 void
OnAddImage(wxCommandEvent & WXUNUSED (event))2058 WxdkdrawFrame::OnAddImage(wxCommandEvent & WXUNUSED(event))
2059 {
2060 
2061 	if (BeginEventHandling()) {
2062 		EndOperation(true);
2063 		m_iState = S_IMG_1;
2064 		SetMouseAndStatusTexts(m_iState);
2065 		DK4_MEMCPY(&m_ptMouseMoveStart,&m_ptMousePosGrid,sizeof(Wxd_point_t));
2066 		m_bAcceptablePoint = false;
2067 		EndEventHandling();
2068 	}
2069 
2070 }
2071 
2072 
2073 
2074 void
AddLibelem(void)2075 WxdkdrawFrame::AddLibelem(void)
2076 {
2077 	wxString		 sDialogTitle(sTexts[410]);
2078 	wxString		 sFileTypes(wxd_file_type_suffix);
2079 	dk4_er_t		 er;
2080 	FILE			*fp	= NULL;
2081 
2082 	m_iState = S_NOOP;
2083 #if	wxCHECK_VERSION(2, 9, 0)
2084 	wxFileDialog dlg(
2085 		this, sDialogTitle, m_sLibraryDir, m_sLibraryShort,
2086 		sFileTypes, (wxFD_OPEN | wxFD_FILE_MUST_EXIST)
2087 	);
2088 #else
2089 	wxFileDialog dlg(
2090 		this, sDialogTitle, m_sLibraryDir, m_sLibraryShort,
2091 		sFileTypes, wxOPEN
2092 	);
2093 #endif
2094 	if(wxID_OK == dlg.ShowModal()) {
2095 		wxString	pa	= dlg.GetPath();
2096 		m_sLibraryDir	= dlg.GetDirectory();
2097 		m_sLibraryShort	= dlg.GetFilename();
2098 		{
2099 			wxFFile	wxff(pa);
2100 			if (wxff.IsOpened()) {
2101 				fp = wxff.Detach();
2102 				if (NULL != fp) {
2103 
2104 					wxdrd_status_init(&m_oStatusReader);
2105 					m_pCurrent = wxdrd_read_symbol(m_pDrw,fp,&m_oStatusReader);
2106 					if (NULL != m_pCurrent) {
2107 						UpdateStipples();
2108 						UpdateFonts();
2109 						UpdateImages();
2110 						m_iState = S_LIBELEM_PLACE;
2111 						wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2112 						wxdobj_mark_recursively(m_pCurrent, OBJ_MARKER_1);
2113 						m_ptMouseMoveStart.x = m_oStatusReader.bb.xl;
2114 						m_ptMouseMoveStart.y = m_oStatusReader.bb.yb;
2115 						dk4error_init(&er);
2116 						m_ptMouseMoveDiff.x	 = dk4ma_int32_t_sub(
2117 							m_ptMousePosGrid.x, m_oStatusReader.bb.xl, &er
2118 						);
2119 						m_ptMouseMoveDiff.y	 = dk4ma_int32_t_sub(
2120 							m_ptMousePosGrid.y, m_oStatusReader.bb.yb, &er
2121 						);
2122 						m_bMouseDiff = (DK4_E_NONE == er.ec);
2123 						m_iState = S_LIBELEM_PLACE;
2124 						wxdobj_drw_require_redraw(
2125 							m_pDrw, WXD_REFRESH_MARKUP
2126 						);
2127 					}
2128 					else {
2129 						/* ERROR: Failed to read file */
2130 						dk4error_set_simple_error_code(
2131 							&m_oErrorReport, WXD_E_FAILED_TO_READ_FILE
2132 						);
2133 						m_iState = S_NOOP;
2134 					}
2135 					fclose(fp);
2136 				}
2137 				else {
2138 					/* ERROR: Failed to open file */
2139 					dk4error_set_simple_error_code(
2140 						&m_oErrorReport, WXD_E_FAILED_TO_OPEN_FILE
2141 					);
2142 					m_iState = S_NOOP;
2143 				}
2144 			}
2145 			else {
2146 				/* ERROR: Failed to open file */
2147 				dk4error_set_simple_error_code(
2148 					&m_oErrorReport, WXD_E_FAILED_TO_OPEN_FILE
2149 				);
2150 				m_iState = S_NOOP;
2151 			}
2152 		}
2153 	}
2154 	else {
2155 		m_iState = S_NOOP;
2156 	}
2157 }
2158 
2159 
2160 
2161 void
OnAddLibelem(wxCommandEvent & WXUNUSED (event))2162 WxdkdrawFrame::OnAddLibelem(wxCommandEvent & WXUNUSED(event))
2163 {
2164 
2165 
2166 	wxdrd_status_init(&m_oStatusReader);
2167 	if (BeginEventHandling()) {
2168 		EndOperation(true);
2169 		m_pCurrent = NULL;
2170 		AddLibelem();
2171 		SetMouseAndStatusTexts(m_iState);
2172 		EndEventHandling();
2173 	}
2174 
2175 }
2176 
2177 
2178 
2179 void
OnEditCopy(wxCommandEvent & WXUNUSED (event))2180 WxdkdrawFrame::OnEditCopy(wxCommandEvent & WXUNUSED(event))
2181 {
2182 
2183 	if (BeginEventHandling()) {
2184 		EndOperation(true);
2185 		DK4_MEMCPY(&m_ptMouseMoveStart,&m_ptMousePosGrid,sizeof(Wxd_point_t));
2186 		m_ptMouseMoveDiff.x = (int32_t)0L;
2187 		m_ptMouseMoveDiff.y = (int32_t)0L;
2188 		m_bMouseDiff = true;
2189 		m_iState = S_COPY_SELECT;
2190 		SetMouseAndStatusTexts(S_COPY_SELECT);
2191 		EndEventHandling();
2192 	}
2193 
2194 }
2195 
2196 
2197 
2198 void
OnEditMove(wxCommandEvent & WXUNUSED (event))2199 WxdkdrawFrame::OnEditMove(wxCommandEvent & WXUNUSED(event))
2200 {
2201 
2202 	if (BeginEventHandling()) {
2203 		EndOperation(true);
2204 		DK4_MEMCPY(&m_ptMouseMoveStart,&m_ptMousePosGrid,sizeof(Wxd_point_t));
2205 		m_ptMouseMoveDiff.x = (int32_t)0L;
2206 		m_ptMouseMoveDiff.y = (int32_t)0L;
2207 		m_bMouseDiff = true;
2208 		m_iState = S_MOVE_SELECT;
2209 		SetMouseAndStatusTexts(S_MOVE_SELECT);
2210 		EndEventHandling();
2211 	}
2212 
2213 }
2214 
2215 
2216 
2217 void
OnEditDelete(wxCommandEvent & WXUNUSED (event))2218 WxdkdrawFrame::OnEditDelete(wxCommandEvent & WXUNUSED(event))
2219 {
2220 
2221 	if (BeginEventHandling()) {
2222 		EndOperation(true);
2223 		m_iState = S_DELETE;
2224 		SetMouseAndStatusTexts(S_DELETE);
2225 		EndEventHandling();
2226 	}
2227 
2228 }
2229 
2230 
2231 
2232 void
OnEditPointMove(wxCommandEvent & WXUNUSED (event))2233 WxdkdrawFrame::OnEditPointMove(wxCommandEvent & WXUNUSED(event))
2234 {
2235 
2236 	if (BeginEventHandling()) {
2237 		EndOperation(true);
2238 		m_iState = S_MOVEPT_SELECT;
2239 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2240 		SetMouseAndStatusTexts(m_iState);
2241 		EndEventHandling();
2242 	}
2243 
2244 }
2245 
2246 
2247 
2248 void
OnEditPointAdd(wxCommandEvent & WXUNUSED (event))2249 WxdkdrawFrame::OnEditPointAdd(wxCommandEvent & WXUNUSED(event))
2250 {
2251 
2252 	if (BeginEventHandling()) {
2253 		EndOperation(true);
2254 		m_iState = S_ADDPT_SELECT;
2255 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2256 		SetMouseAndStatusTexts(m_iState);
2257 		EndEventHandling();
2258 	}
2259 
2260 }
2261 
2262 
2263 
2264 void
OnEditPointDelete(wxCommandEvent & WXUNUSED (event))2265 WxdkdrawFrame::OnEditPointDelete(wxCommandEvent & WXUNUSED(event))
2266 {
2267 
2268 	if (BeginEventHandling()) {
2269 		EndOperation(true);
2270 		m_iState = S_DELPT;
2271 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2272 		SetMouseAndStatusTexts(m_iState);
2273 		EndEventHandling();
2274 	}
2275 
2276 }
2277 
2278 
2279 
2280 void
OnEditDetails(wxCommandEvent & WXUNUSED (event))2281 WxdkdrawFrame::OnEditDetails(wxCommandEvent & WXUNUSED(event))
2282 {
2283 
2284 	if (BeginEventHandling()) {
2285 		EndOperation(true);
2286 		m_iState = S_DETAILS;
2287 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2288 		SetMouseAndStatusTexts(m_iState);
2289 		EndEventHandling();
2290 	}
2291 
2292 }
2293 
2294 
2295 
2296 void
OnEditGroup(wxCommandEvent & WXUNUSED (event))2297 WxdkdrawFrame::OnEditGroup(wxCommandEvent & WXUNUSED(event))
2298 {
2299 
2300 	if (BeginEventHandling()) {
2301 		EndOperation(true);
2302 		m_iState = S_GROUP_ONE;
2303 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2304 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_2);
2305 		SetMouseAndStatusTexts(m_iState);
2306 		EndEventHandling();
2307 	}
2308 
2309 }
2310 
2311 
2312 
2313 void
OnEditGroup3(wxCommandEvent & WXUNUSED (event))2314 WxdkdrawFrame::OnEditGroup3(wxCommandEvent & WXUNUSED(event))
2315 {
2316 
2317 	if (BeginEventHandling()) {
2318 		EndOperation(true);
2319 		m_iState = S_GROUP_RECT_1;
2320 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2321 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_2);
2322 		SetMouseAndStatusTexts(m_iState);
2323 		EndEventHandling();
2324 	}
2325 
2326 }
2327 
2328 
2329 void
OnEditUngroup(wxCommandEvent & WXUNUSED (event))2330 WxdkdrawFrame::OnEditUngroup(wxCommandEvent & WXUNUSED(event))
2331 {
2332 
2333 	if (BeginEventHandling()) {
2334 		EndOperation(true);
2335 		m_iState = S_UNGROUP;
2336 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2337 		SetMouseAndStatusTexts(m_iState);
2338 		EndEventHandling();
2339 	}
2340 
2341 }
2342 
2343 
2344 
2345 void
OnEditFlipH(wxCommandEvent & WXUNUSED (event))2346 WxdkdrawFrame::OnEditFlipH(wxCommandEvent & WXUNUSED(event))
2347 {
2348 
2349 	if (BeginEventHandling()) {
2350 		EndOperation(true);
2351 		m_bVerticalFlip = false;
2352 		m_iState = S_FLIP;
2353 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2354 		m_pCurrent = NULL;
2355 		SetMouseAndStatusTexts(m_iState);
2356 		EndEventHandling();
2357 	}
2358 
2359 }
2360 
2361 
2362 
2363 void
OnEditFlipV(wxCommandEvent & WXUNUSED (event))2364 WxdkdrawFrame::OnEditFlipV(wxCommandEvent & WXUNUSED(event))
2365 {
2366 
2367 	if (BeginEventHandling()) {
2368 		EndOperation(true);
2369 		m_bVerticalFlip = true;
2370 		m_iState = S_FLIP;
2371 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2372 		m_pCurrent = NULL;
2373 		SetMouseAndStatusTexts(m_iState);
2374 		EndEventHandling();
2375 	}
2376 
2377 }
2378 
2379 
2380 
2381 void
OnEditRotateLeft(wxCommandEvent & WXUNUSED (event))2382 WxdkdrawFrame::OnEditRotateLeft(wxCommandEvent & WXUNUSED(event))
2383 {
2384 
2385 	if (BeginEventHandling()) {
2386 		EndOperation(true);
2387 		m_bSplineInterpolated = false;
2388 		m_iState = S_ROTATE;
2389 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2390 		m_pCurrent = NULL;
2391 		m_uCurrent = (uint16_t)0U;
2392 		SetMouseAndStatusTexts(m_iState);
2393 		EndEventHandling();
2394 	}
2395 
2396 }
2397 
2398 
2399 
2400 void
OnEditRotateRight(wxCommandEvent & WXUNUSED (event))2401 WxdkdrawFrame::OnEditRotateRight(wxCommandEvent & WXUNUSED(event))
2402 {
2403 
2404 	if (BeginEventHandling()) {
2405 		EndOperation(true);
2406 		m_bSplineInterpolated = true;
2407 		m_iState = S_ROTATE;
2408 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2409 		m_pCurrent = NULL;
2410 		m_uCurrent = (uint16_t)0U;
2411 		SetMouseAndStatusTexts(m_iState);
2412 		EndEventHandling();
2413 	}
2414 
2415 }
2416 
2417 
2418 
2419 void
OnEditChangeSize(wxCommandEvent & WXUNUSED (event))2420 WxdkdrawFrame::OnEditChangeSize(wxCommandEvent & WXUNUSED(event))
2421 {
2422 
2423 	if (BeginEventHandling()) {
2424 		EndOperation(true);
2425 		m_iState = S_DRWSZ_SELECT;
2426 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
2427 		SetMouseAndStatusTexts(m_iState);
2428 		m_bHaveCornerPoint = false;
2429 		m_uCurrent = 0U;
2430 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP);
2431 		DK4_MEMCPY(&m_oOldSize,&(m_pDrw->bb),sizeof(Wxd_bb_t));
2432 		DK4_MEMCPY(&(m_oBorder.det.b.b),&(m_pDrw->bb),sizeof(Wxd_bb_t));
2433 		EndEventHandling();
2434 	}
2435 
2436 }
2437 
2438 
2439 
2440 void
OnEditSetSize(wxCommandEvent & WXUNUSED (event))2441 WxdkdrawFrame::OnEditSetSize(wxCommandEvent & WXUNUSED(event))
2442 {
2443 	dk4_er_t	er;
2444 	int32_t		xr;
2445 	int32_t		yt;
2446 	int			res;
2447 
2448 	if (BeginEventHandling()) {
2449 		WxdkdrawDlgPaperSize	dlg(this, sTexts);
2450 #if 0
2451 		Dk4WxApplicationHelper::ChooseChildPosition(*mbMain, dlg);
2452 #endif
2453 #if	0
2454 		Dk4WxApplicationHelper::ChooseChildPosition(*this, dlg);
2455 #else
2456 		{
2457 			wxRect	re	= dkctGUIContentsPanel->GetScreenRect();
2458 			int		x	= 0;
2459 			int		y	= 0;
2460 			int		w	= 0;
2461 			int		h	= 0;
2462 			dlg.GetSize(&w, &h);
2463 			x = re.GetX();
2464 			y = re.GetY();
2465 			Dk4WxApplicationHelper::CorrectPosition(x, y, w, h);
2466 			dlg.SetSize(x, y, w, h);
2467 		}
2468 #endif
2469 		res = dlg.ShowModal();
2470 		switch (res) {
2471 			case wxID_OK : {
2472 				if (NULL != m_pDrw) {
2473 					dk4error_init(&er);
2474 					xr = dk4ma_int32_t_add((m_pDrw->bb).xl,dlg.GetWidth(),&er);
2475 					yt = dk4ma_int32_t_add((m_pDrw->bb).yb,dlg.GetHeight(),&er);
2476 					if (DK4_E_NONE == er.ec) {
2477 						if (
2478 							((m_pDrw->bb).xr != xr)
2479 							|| ((m_pDrw->bb).yt != yt)
2480 						) {
2481 							SetModified();
2482 							RequireRedraw(WXD_REFRESH_DRAWING);
2483 						}
2484 						(m_pDrw->bb).xr = xr;
2485 						(m_pDrw->bb).yt = yt;
2486 						OnCenterViewFunction();
2487 					}
2488 				}
2489 			} break;
2490 			case wxID_CANCEL : {
2491 			} break;
2492 		}
2493 		EndEventHandling();
2494 	}
2495 
2496 }
2497 
2498 
2499 
2500 void
OnLayersAll(wxCommandEvent & WXUNUSED (event))2501 WxdkdrawFrame::OnLayersAll(wxCommandEvent & WXUNUSED(event))
2502 {
2503 	Wxd_layer_t		*play;
2504 
2505 	if (BeginEventHandling()) {
2506 		dk4sto_it_reset(m_pDrw->i_layers);
2507 		do {
2508 			play = (Wxd_layer_t *)dk4sto_it_next(m_pDrw->i_layers);
2509 			if (NULL != play) {
2510 				if (0x00 == play->active) {
2511 					play->active = 0x01;
2512 					wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
2513 				}
2514 			}
2515 		} while (NULL != play);
2516 		EndEventHandling();
2517 	}
2518 
2519 }
2520 
2521 
2522 
2523 void
OnLayerManager(wxCommandEvent & WXUNUSED (event))2524 WxdkdrawFrame::OnLayerManager(wxCommandEvent & WXUNUSED(event))
2525 {
2526 	Wxd_layer_cb_t	*pLayerCb;
2527 	Wxd_layer_t		*pLayer;
2528 	size_t			 nl;
2529 	size_t			 i;
2530 	bool			 changed;
2531 
2532 	if (BeginEventHandling()) {
2533 		nl = wxdobj_get_number_of_layers(m_pDrw);
2534 
2535 		if ((size_t)0U < nl) {
2536 			pLayerCb = dk4mem_new(Wxd_layer_cb_t,nl,NULL);
2537 			if (NULL != pLayerCb) {
2538 				for (i = 0; i < nl; i++) {
2539 
2540 					pLayerCb[i].lay = NULL;
2541 					pLayerCb[i].cb  = NULL;
2542 					pLayerCb[i].oa  = 0x00;
2543 				}
2544 				i = 0;
2545 				dk4sto_it_reset(m_pDrw->i_layers);
2546 				do {
2547 					pLayer = (Wxd_layer_t *)dk4sto_it_next(m_pDrw->i_layers);
2548 					if (NULL != pLayer) {
2549 						if (i < nl) {
2550 
2551 							pLayerCb[i].lay = pLayer;
2552 							pLayerCb[i].oa  = pLayer->active;
2553 							i++;
2554 						}
2555 					}
2556 				} while (NULL != pLayer);
2557 				WxdkdrawDlgLayerManager	dlg(this, m_pDrw, sTexts, pLayerCb, nl);
2558 				if (wxID_OK != dlg.ShowModal()) {
2559 					changed = false;
2560 					for (i = 0; i < nl; i++) {
2561 						if (NULL != pLayerCb[i].lay) {
2562 							if (0x00 != pLayerCb[i].oa) {
2563 								if (0x00 == (pLayerCb[i].lay)->active) {
2564 									(pLayerCb[i].lay)->active = 0x01;
2565 									changed = true;
2566 								}
2567 							}
2568 							else {
2569 								if (0x00 != (pLayerCb[i].lay)->active) {
2570 									(pLayerCb[i].lay)->active = 0x01;
2571 									changed = true;
2572 								}
2573 							}
2574 						}
2575 					}
2576 					if (changed) {
2577 						wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
2578 					}
2579 				}
2580 #if	TRACE_DEBUG
2581 				else {
2582 				}
2583 #endif
2584 				for (i = 0; i < nl; i++) {
2585 					pLayerCb[i].lay = NULL;
2586 					pLayerCb[i].cb  = NULL;
2587 					pLayerCb[i].oa  = 0x00;
2588 				}
2589 				dk4mem_free(pLayerCb);
2590 			}
2591 			else {
2592 				/* ERROR: Memory */
2593 				dk4error_set_simple_error_code(
2594 					&m_oErrorReport, DK4_E_MEMORY_ALLOCATION_FAILED
2595 				);
2596 			}
2597 		}
2598 		else {
2599 			/* NOTICE: No layer currently in use */
2600 			wxMessageBox(
2601 				sTexts[368], sTexts[369],
2602 				(wxOK | wxCENTRE | wxICON_INFORMATION)
2603 			);
2604 		}
2605 		EndEventHandling();
2606 	}
2607 
2608 }
2609 
2610 
2611 
2612 void
OnCenterViewFunction(void)2613 WxdkdrawFrame::OnCenterViewFunction(void)
2614 {
2615 	dk4_er_t	er;			/* Error report */
2616 
2617 	if (BeginEventHandling()) {
2618 		dk4error_init(&er);
2619 		m_pDrw->cx =
2620 		dk4ma_int32_t_add((m_pDrw->bb).xl, (m_pDrw->bb).xr, &er) / (int32_t)2L;
2621 		if (DK4_E_NONE != er.ec) {
2622 			m_pDrw->cx =
2623 			(m_pDrw->bb).xl / (int32_t)2L + (m_pDrw->bb).xr / (int32_t)2L;
2624 		}
2625 		dk4error_init(&er);
2626 		m_pDrw->cy =
2627 		dk4ma_int32_t_add((m_pDrw->bb).yb, (m_pDrw->bb).yt, &er) / (int32_t)2L;
2628 		if (DK4_E_NONE != er.ec) {
2629 			m_pDrw->cy =
2630 			(m_pDrw->bb).yb / (int32_t)2L + (m_pDrw->bb).yt / (int32_t)2L;
2631 		}
2632 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID);
2633 		drawco->Refresh();
2634 		m_bUpdate = true;
2635 		AdjustScrollbars();
2636 		EndEventHandling();
2637 	}
2638 
2639 }
2640 
2641 
2642 
2643 void
OnCenterView(wxCommandEvent & WXUNUSED (event))2644 WxdkdrawFrame::OnCenterView(wxCommandEvent & WXUNUSED(event))
2645 {
2646 	OnCenterViewFunction();
2647 }
2648 
2649 
2650 
2651 void
OnGridOnOff(wxCommandEvent & WXUNUSED (event))2652 WxdkdrawFrame::OnGridOnOff(wxCommandEvent & WXUNUSED(event))
2653 {
2654 
2655 	if (BeginEventHandling()) {
2656 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID);
2657 		drawco->Refresh();
2658 		m_bUpdate = true;
2659 		EndEventHandling();
2660 	}
2661 
2662 }
2663 
2664 
2665 
2666 void
OnGridUnit(wxCommandEvent & WXUNUSED (event))2667 WxdkdrawFrame::OnGridUnit(wxCommandEvent & WXUNUSED(event))
2668 {
2669 	int		seli;			/* Selected index */
2670 
2671 	if (BeginEventHandling()) {
2672 		seli = cbGridUnit->GetSelection();
2673 		switch (seli) {
2674 			case 0: {
2675 				m_pDrw->gridunit = (uint8_t)0U;
2676 			} break;
2677 			default : {
2678 				m_pDrw->gridunit = (uint8_t)1U;
2679 			} break;
2680 		}
2681 		drawco->CalculateGridDistances();
2682 		if (cbGridOnOff->GetValue()) {
2683 			wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID);
2684 			drawco->Refresh();
2685 			m_bUpdate = true;
2686 		}
2687 		EndEventHandling();
2688 	}
2689 
2690 }
2691 
2692 
2693 
2694 void
OnGridBase(wxCommandEvent & WXUNUSED (event))2695 WxdkdrawFrame::OnGridBase(wxCommandEvent & WXUNUSED(event))
2696 {
2697 	int		seli;		/* Selected index */
2698 
2699 	if (BeginEventHandling()) {
2700 		seli = cbGridBase->GetSelection();
2701 		switch (seli) {
2702 			case 0: {
2703 				m_pDrw->gridbase = (uint8_t)0U;
2704 			} break;
2705 			default : {
2706 				m_pDrw->gridbase = (uint8_t)1U;
2707 			} break;
2708 		}
2709 		drawco->CalculateGridDistances();
2710 		if (cbGridOnOff->GetValue()) {
2711 			wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID);
2712 			drawco->Refresh();
2713 			m_bUpdate = true;
2714 		}
2715 		EndEventHandling();
2716 	}
2717 
2718 }
2719 
2720 
2721 
2722 void
OnPlacementHelp(wxCommandEvent & WXUNUSED (event))2723 WxdkdrawFrame::OnPlacementHelp(wxCommandEvent & WXUNUSED(event))
2724 {
2725 
2726 	if (BeginEventHandling()) {
2727 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID);
2728 		drawco->Refresh();
2729 		m_bUpdate = true;
2730 		EndEventHandling();
2731 	}
2732 
2733 }
2734 
2735 
2736 
2737 void
OnStyleLineColour(wxCommandEvent & WXUNUSED (event))2738 WxdkdrawFrame::OnStyleLineColour(wxCommandEvent & WXUNUSED(event))
2739 {
2740 	int		r;
2741 	int		g;
2742 	int		b;
2743 
2744 	if (BeginEventHandling()) {
2745 		r = ccLineColour->Red();
2746 		g = ccLineColour->Green();
2747 		b = ccLineColour->Blue();
2748 		if (NULL != m_pStyle) {
2749 			if (
2750 				((uint8_t)r != m_pStyle->sc[0])
2751 				|| ((uint8_t)g != m_pStyle->sc[1])
2752 				|| ((uint8_t)b != m_pStyle->sc[2])
2753 			) {
2754 				switch (m_pStyle->ot) {
2755 					case WXD_OT_TEXT :
2756 					case WXD_OT_DOT_FILLED :
2757 					case WXD_OT_DOT_WHITE : {
2758 						m_pStyle->sc[0] = (uint8_t)r;
2759 						m_pStyle->sc[1] = (uint8_t)g;
2760 						m_pStyle->sc[2] = (uint8_t)b;
2761 #if	0
2762 						m_pStyle->fc[0] = (uint8_t)r;
2763 						m_pStyle->fc[1] = (uint8_t)g;
2764 						m_pStyle->fc[2] = (uint8_t)b;
2765 #endif
2766 					} break;
2767 					default : {
2768 						m_pStyle->sc[0] = (uint8_t)r;
2769 						m_pStyle->sc[1] = (uint8_t)g;
2770 						m_pStyle->sc[2] = (uint8_t)b;
2771 					} break;
2772 				}
2773 				wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
2774 				SetModified();
2775 			}
2776 		}
2777 		else {
2778 			m_oStyle.sc[0] = (uint8_t)r;
2779 			m_oStyle.sc[1] = (uint8_t)g;
2780 			m_oStyle.sc[2] = (uint8_t)b;
2781 		}
2782 		EndEventHandling();
2783 	}
2784 
2785 }
2786 
2787 
2788 
2789 void
OnStyleLayer(wxSpinEvent & WXUNUSED (event))2790 WxdkdrawFrame::OnStyleLayer(wxSpinEvent & WXUNUSED(event))
2791 {
2792 	int			nl;
2793 
2794 	if (BeginEventHandling()) {
2795 		nl = spLayerNumber->GetValue();
2796 		if (NULL != m_pStyle) {
2797 			if (nl != m_pStyle->lay) {
2798 				SetModified();
2799 				if (0 == wxdobj_modify_layer(m_pDrw, m_pStyle, (int16_t)nl)) {
2800 					m_pStyle = NULL;
2801 					RequireRedraw(WXD_REFRESH_DRAWING);
2802 					/* ERROR: Memory */
2803 					dk4error_set_simple_error_code(
2804 						&m_oErrorReport, DK4_E_MEMORY_ALLOCATION_FAILED
2805 					);
2806 				}
2807 			}
2808 		}
2809 		else {
2810 			m_oStyle.lay = (int16_t)nl;
2811 		}
2812 		EndEventHandling();
2813 	}
2814 
2815 }
2816 
2817 
2818 
2819 void
OnStyleLineWidth(wxSpinEvent & WXUNUSED (event))2820 WxdkdrawFrame::OnStyleLineWidth(wxSpinEvent & WXUNUSED(event))
2821 {
2822 	int		lw;
2823 
2824 	if (BeginEventHandling()) {
2825 		lw = spLineWidth->GetValue();
2826 		if (NULL != m_pStyle) {
2827 			if ((uint16_t)lw != m_pStyle->lw) {
2828 				m_pStyle->lw = (uint16_t)lw;
2829 				wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
2830 				SetModified();
2831 			}
2832 		}
2833 		else {
2834 			m_oStyle.lw = (uint16_t)lw;
2835 		}
2836 		EndEventHandling();
2837 	}
2838 
2839 }
2840 
2841 
2842 
2843 void
OnStyleLineStyle(wxCommandEvent & WXUNUSED (event))2844 WxdkdrawFrame::OnStyleLineStyle(wxCommandEvent & WXUNUSED(event))
2845 {
2846 	Wxd_object_t	*pobj;		/* Object to modify */
2847 	int				 res;		/* Result from showing dialog */
2848 	uint8_t			 ols;		/* Old line style */
2849 	uint8_t			 osv;		/* Old style value */
2850 	uint8_t			 nls;		/* New line style */
2851 	uint8_t			 nsv;		/* New style value */
2852 	bool			 bDrwElem;	/* Object is drawing element */
2853 	bool			 bRefresh;	/* Refresh draw control */
2854 
2855 	pobj = ((NULL != m_pStyle) ? (m_pStyle) : (&m_oStyle));
2856 	bDrwElem = ((NULL != m_pStyle) ? (true) : (false));
2857 	if (BeginEventHandling()) {
2858 		WxdkdrawDlgLineStyle		dlg(
2859 			this, pobj, sTexts, ms_ls_images, bDrwElem
2860 		);
2861 		Dk4WxApplicationHelper::ChooseChildPosition(*bStyleLineStyle, dlg);
2862 		ols	= pobj->ls;
2863 #if	0
2864 		/*	2020-03-24	Modification
2865 			Line below removed due to clang static analyzers complaints
2866 			about dead assignment.
2867 		*/
2868 		nls = ols;
2869 #endif
2870 		osv = pobj->sl;
2871 #if	0
2872 		/*	2020-03-24	Modification
2873 			Line below removed due to clang static analyzers complaints
2874 			about dead assignment.
2875 		*/
2876 		nsv = osv;
2877 #endif
2878 		res = dlg.ShowModal();
2879 		switch (res) {
2880 			case wxID_OK : {
2881 				nls = pobj->ls;
2882 				if (nls != ols) {
2883 					if (NULL != m_pStyle) {
2884 						if (WXD_LS_SOLID == ols) {
2885 							pobj->sl = (uint8_t)(m_iv[IVI_STYLE_VALUE]);
2886 						}
2887 						wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
2888 						SetModified();
2889 						drawco->Refresh();
2890 						drawco->Update();
2891 					}
2892 					bStyleLineStyle->SetBitmap(ms_ls_images[nls]);
2893 					bStyleLineStyle->Refresh();
2894 					m_bUpdate = true;
2895 				}
2896 				switch (nls) {
2897 					case WXD_LS_DASH :
2898 					case WXD_LS_DASH_DOT :
2899 					case WXD_LS_DASH_DOT_DOT :
2900 					case WXD_LS_DASH_DOT_DOT_DOT : {
2901 
2902 						WxdkdrawDlgStyleLength	dlh(
2903 							this, pobj, bDrwElem, sTexts
2904 						);
2905 
2906 						Dk4WxApplicationHelper::ChooseChildPosition(
2907 							*bStyleLineStyle, dlh
2908 						);
2909 
2910 						res = dlh.ShowModal();
2911 
2912 						switch (res) {
2913 							case wxID_OK :
2914 							case wxID_CANCEL : {
2915 
2916 								bRefresh = true;
2917 								nsv = pobj->sl;
2918 								if (wxID_OK == res) {
2919 									m_iv[IVI_STYLE_VALUE ] = nsv;
2920 								}
2921 								if (nsv == pobj->sl) {
2922 									bRefresh = false;
2923 								}
2924 								else {
2925 								}
2926 								if (osv != nsv) {
2927 									SetModified();
2928 								}
2929 								if (bRefresh) {
2930 									wxdobj_drw_require_redraw(
2931 										m_pDrw, WXD_REFRESH_DRAWING
2932 									);
2933 								}
2934 
2935 							} break;
2936 						}
2937 					} break;
2938 				}
2939 			} break;
2940 			case wxID_CANCEL : {
2941 			} break;
2942 		}
2943 		EndEventHandling();
2944 	}
2945 
2946 }
2947 
2948 
2949 
2950 void
OnStyleLineCap(wxCommandEvent & WXUNUSED (event))2951 WxdkdrawFrame::OnStyleLineCap(wxCommandEvent & WXUNUSED(event))
2952 {
2953 	Wxd_object_t		*pobj;
2954 	int					 res;
2955 	uint8_t				 ocs;
2956 	uint8_t				 ncs;
2957 	bool				 bDrwElem;
2958 
2959 	pobj = ((NULL != m_pStyle) ? (m_pStyle) : (&m_oStyle));
2960 	bDrwElem = (NULL != m_pStyle);
2961 	ocs  = ncs = pobj->cs;
2962 	if (BeginEventHandling()) {
2963 		WxdkdrawDlgLineCap	dlg(this, pobj, sTexts, ms_lc_images, bDrwElem);
2964 		Dk4WxApplicationHelper::ChooseChildPosition(*bStyleLineEnds, dlg);
2965 		res = dlg.ShowModal();
2966 		if (wxID_OK == res) {
2967 			ncs = pobj->cs;
2968 			if (ocs != ncs) {
2969 				if (NULL != m_pStyle) {
2970 					wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
2971 					SetModified();
2972 				}
2973 				bStyleLineEnds->SetBitmap(ms_lc_images[ncs]);
2974 				bStyleLineEnds->Refresh();
2975 				m_bUpdate = true;
2976 			}
2977 		}
2978 		EndEventHandling();
2979 	}
2980 
2981 }
2982 
2983 
2984 
2985 void
OnStyleLineJoin(wxCommandEvent & WXUNUSED (event))2986 WxdkdrawFrame::OnStyleLineJoin(wxCommandEvent & WXUNUSED(event))
2987 {
2988 	Wxd_object_t	*pobj;
2989 	int				 res;
2990 	uint8_t			 ojs;
2991 	uint8_t			 njs;
2992 	uint8_t			 oml;
2993 	uint8_t			 nml;
2994 	bool			 bDrwElem;
2995 
2996 	pobj		= ((NULL != m_pStyle) ? (m_pStyle) : (&m_oStyle));
2997 	bDrwElem	=	(NULL != m_pStyle);
2998 	ojs  		= njs = pobj->js;
2999 	oml  		= nml = pobj->ml;
3000 	if (BeginEventHandling()) {
3001 		WxdkdrawDlgLineJoin		dlg(this, pobj, sTexts, ms_lj_images, bDrwElem);
3002 		Dk4WxApplicationHelper::ChooseChildPosition(*bStyleLineJoins, dlg);
3003 		res = dlg.ShowModal();
3004 		if (wxID_OK == res) {
3005 			njs = pobj->js;
3006 			if (ojs != njs) {
3007 				if (NULL != m_pStyle) {
3008 					wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3009 					SetModified();
3010 					if (WXD_LJ_MITERED == njs) {
3011 						pobj->ml = (uint8_t)(m_iv[IVI_MITER_LIMIT]);
3012 						drawco->Refresh();
3013 						drawco->Update();
3014 					}
3015 				}
3016 				bStyleLineJoins->SetBitmap(ms_lj_images[njs]);
3017 				bStyleLineJoins->Refresh();
3018 				m_bUpdate = true;
3019 			}
3020 			if (WXD_LJ_MITERED == njs) {
3021 				WxdkdrawDlgMiterLimit dlh(this, pobj, sTexts, bDrwElem);
3022 				Dk4WxApplicationHelper::ChooseChildPosition(
3023 					*bStyleLineJoins, dlh
3024 				);
3025 				res = dlh.ShowModal();
3026 				if (wxID_OK == res) {
3027 					nml = pobj->ml;
3028 					m_iv[IVI_MITER_LIMIT] = nml;
3029 					if (oml != nml) {
3030 						SetModified();
3031 					}
3032 				}
3033 			}
3034 		}
3035 		EndEventHandling();
3036 	}
3037 
3038 }
3039 
3040 
3041 
3042 void
OnStyleLineArrowF(wxCommandEvent & WXUNUSED (event))3043 WxdkdrawFrame::OnStyleLineArrowF(wxCommandEvent & WXUNUSED(event))
3044 {
3045 	Wxd_object_t		*pobj;
3046 	int					 res;
3047 	uint8_t				 oat;
3048 	uint8_t				 nat;
3049 	uint8_t				 oal;
3050 	uint8_t				 nal;
3051 	uint8_t				 oaw;
3052 	uint8_t				 naw;
3053 	bool				 bDrwElem;
3054 	pobj = ((NULL != m_pStyle) ? (m_pStyle) : (&m_oStyle));
3055 	bDrwElem = (NULL != m_pStyle);
3056 	oat  = nat = pobj->aft;
3057 	oal  = nal = pobj->afl;
3058 	oaw  = naw = pobj->afw;
3059 
3060 	if (BeginEventHandling()) {
3061 		WxdkdrawDlgArrowType		dlg(
3062 			this, pobj, sTexts, ms_arrow_images, bDrwElem, false
3063 		);
3064 		Dk4WxApplicationHelper::ChooseChildPosition(*bStyleArrowForward, dlg);
3065 		res = dlg.ShowModal();
3066 		if (wxID_OK == res) {
3067 			nat = pobj->aft;
3068 			if (oat != nat) {
3069 				if (NULL != m_pStyle) {
3070 					wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3071 					SetModified();
3072 					/*
3073 						2020-03-20	Show new arrow style immediately
3074 					*/
3075 					if (0 == oat) {
3076 						pobj->afl = (uint8_t)(m_iv[IVI_ARROWHEAD_LENGTH]);
3077 						pobj->afw = (uint8_t)(m_iv[IVI_ARROWHEAD_WIDTH]);
3078 					}
3079 					drawco->Refresh();
3080 					drawco->Update();
3081 				}
3082 				bStyleArrowForward->SetBitmap(ms_arrow_images[nat]);
3083 				bStyleArrowForward->Refresh();
3084 				m_bUpdate = true;
3085 			}
3086 			if (0U != nat) {
3087 				WxdkdrawDlgArrowSize dlh(this, pobj, sTexts, bDrwElem, false);
3088 				Dk4WxApplicationHelper::ChooseChildPosition(
3089 					*bStyleArrowForward, dlh
3090 				);
3091 				res = dlh.ShowModal();
3092 				if (wxID_OK == res) {
3093 					nal = pobj->afl;
3094 					naw = pobj->afw;
3095 					m_iv[IVI_ARROWHEAD_LENGTH] = nal;
3096 					m_iv[IVI_ARROWHEAD_WIDTH] = naw;
3097 					if ((oal != nal) || (oaw != naw)) {
3098 						if (NULL != m_pStyle) {
3099 							SetModified();
3100 							wxdobj_drw_require_redraw(
3101 								m_pDrw, WXD_REFRESH_DRAWING
3102 							);
3103 						}
3104 					}
3105 				}
3106 			}
3107 		}
3108 		EndEventHandling();
3109 	}
3110 
3111 }
3112 
3113 
3114 
3115 void
OnStyleLineArrowB(wxCommandEvent & WXUNUSED (event))3116 WxdkdrawFrame::OnStyleLineArrowB(wxCommandEvent & WXUNUSED(event))
3117 {
3118 	Wxd_object_t		*pobj;
3119 	int					 res;
3120 	uint8_t				 oat;
3121 	uint8_t				 nat;
3122 	uint8_t				 oal;
3123 	uint8_t				 nal;
3124 	uint8_t				 oaw;
3125 	uint8_t				 naw;
3126 	bool				 bDrwElem;
3127 	pobj = ((NULL != m_pStyle) ? (m_pStyle) : (&m_oStyle));
3128 	bDrwElem = (NULL != m_pStyle);
3129 	oat  = nat = pobj->abt;
3130 	oal  = nal = pobj->abl;
3131 	oaw  = naw = pobj->abw;
3132 
3133 	if (BeginEventHandling()) {
3134 		WxdkdrawDlgArrowType		dlg(
3135 			this, pobj, sTexts, ms_arrow_images, bDrwElem, true
3136 		);
3137 		Dk4WxApplicationHelper::ChooseChildPosition(*bStyleArrowBackward, dlg);
3138 		res = dlg.ShowModal();
3139 		if (wxID_OK == res) {
3140 			nat = pobj->abt;
3141 			if (oat != nat) {
3142 				if (NULL != m_pStyle) {
3143 					wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3144 					SetModified();
3145 					if (0 == oat) {
3146 						pobj->abl = (uint8_t)(m_iv[IVI_ARROWHEAD_LENGTH]);
3147 						pobj->abw = (uint8_t)(m_iv[IVI_ARROWHEAD_WIDTH]);
3148 					}
3149 					drawco->Refresh();
3150 					drawco->Update();
3151 				}
3152 				bStyleArrowBackward->SetBitmap(ms_arrow_images[nat]);
3153 				bStyleArrowBackward->Refresh();
3154 				m_bUpdate = true;
3155 			}
3156 			if (0U != nat) {
3157 				WxdkdrawDlgArrowSize dlh(this, pobj, sTexts, bDrwElem, true);
3158 				Dk4WxApplicationHelper::ChooseChildPosition(
3159 					*bStyleArrowForward, dlh
3160 				);
3161 				res = dlh.ShowModal();
3162 				if (wxID_OK == res) {
3163 					nal = pobj->abl;
3164 					naw = pobj->abw;
3165 					m_iv[IVI_ARROWHEAD_LENGTH] = nal;
3166 					m_iv[IVI_ARROWHEAD_WIDTH] = naw;
3167 					if ((oal != nal) || (oaw != naw)) {
3168 						if (NULL != m_pStyle) {
3169 							SetModified();
3170 							wxdobj_drw_require_redraw(
3171 								m_pDrw, WXD_REFRESH_DRAWING
3172 							);
3173 						}
3174 					}
3175 				}
3176 			}
3177 		}
3178 		EndEventHandling();
3179 	}
3180 
3181 }
3182 
3183 
3184 
3185 void
OnStyleFillColour(wxCommandEvent & WXUNUSED (event))3186 WxdkdrawFrame::OnStyleFillColour(wxCommandEvent & WXUNUSED(event))
3187 {
3188 	Wxd_stipple_t	*pstip;
3189 	int				 r;
3190 	int				 g;
3191 	int				 b;
3192 	bool			 hsti;
3193 
3194 	if (BeginEventHandling()) {
3195 		r = ccFillColour->Red();
3196 		g = ccFillColour->Green();
3197 		b = ccFillColour->Blue();
3198 		if (NULL != m_pStyle) {
3199 			if (
3200 				((uint8_t)r != m_pStyle->fc[0])
3201 				|| ((uint8_t)g != m_pStyle->fc[1])
3202 				|| ((uint8_t)b != m_pStyle->fc[2])
3203 			) {
3204 				m_pStyle->fc[0] = (uint8_t)r;
3205 				m_pStyle->fc[1] = (uint8_t)g;
3206 				m_pStyle->fc[2] = (uint8_t)b;
3207 				wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3208 				SetModified();
3209 				hsti = (NULL != m_pStyle->psti);
3210 				if (WXD_FS_PURE < m_pStyle->fs) {
3211 					pstip = wxdobj_find_stipple_structure(m_pDrw, m_pStyle);
3212 					m_pStyle->psti = pstip;
3213 				}
3214 				else {
3215 					m_pStyle->psti = NULL;
3216 				}
3217 				if (hsti) {
3218 					wxdobj_remove_unused_stipples(m_pDrw);
3219 				}
3220 				if (NULL != m_pStyle->psti) {
3221 					if (NULL == (m_pStyle->psti)->bm) {
3222 						UpdateOneStipple(m_pStyle->psti);
3223 					}
3224 				}
3225 			}
3226 		}
3227 		else {
3228 			m_oStyle.fc[0] = (uint8_t)r;
3229 			m_oStyle.fc[1] = (uint8_t)g;
3230 			m_oStyle.fc[2] = (uint8_t)b;
3231 		}
3232 		EndEventHandling();
3233 	}
3234 
3235 }
3236 
3237 
3238 
3239 void
OnStyleFillPattern(wxCommandEvent & WXUNUSED (event))3240 WxdkdrawFrame::OnStyleFillPattern(wxCommandEvent & WXUNUSED(event))
3241 {
3242 	Wxd_object_t		*pobj;
3243 	Wxd_stipple_t		*pstip;
3244 	int					 res;
3245 	uint8_t				 ofs;
3246 	uint8_t				 nfs;
3247 	bool				 hsti;
3248 	bool				 bDrwElem;
3249 
3250 	pobj = ((NULL != m_pStyle) ? (m_pStyle) : (&m_oStyle));
3251 	bDrwElem = (NULL != m_pStyle);
3252 	ofs  = nfs = pobj->fs;
3253 	if (BeginEventHandling()) {
3254 		WxdkdrawDlgFillStyle	dlg(this, pobj, sTexts, ms_fs_images, bDrwElem);
3255 		Dk4WxApplicationHelper::ChooseChildPosition(*bStyleFillPattern, dlg);
3256 		res = dlg.ShowModal();
3257 		if (wxID_OK == res) {
3258 			nfs = pobj->fs;
3259 			if (ofs != nfs) {
3260 				if (NULL != m_pStyle) {
3261 					wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3262 					SetModified();
3263 					hsti = (NULL != m_pStyle->psti);
3264 					if (WXD_FS_PURE < m_pStyle->fs) {
3265 						pstip = wxdobj_find_stipple_structure(m_pDrw, m_pStyle);
3266 						m_pStyle->psti = pstip;
3267 					}
3268 					else {
3269 						m_pStyle->psti = NULL;
3270 					}
3271 					if (hsti) {
3272 						wxdobj_remove_unused_stipples(m_pDrw);
3273 					}
3274 					if (NULL != m_pStyle->psti) {
3275 						if (NULL == (m_pStyle->psti)->bm) {
3276 							UpdateOneStipple(m_pStyle->psti);
3277 						}
3278 					}
3279 				}
3280 				bStyleFillPattern->SetBitmap(ms_fs_images[nfs]);
3281 				bStyleFillPattern->Refresh();
3282 				m_bUpdate = true;
3283 			}
3284 		}
3285 		EndEventHandling();
3286 	}
3287 
3288 }
3289 
3290 
3291 void
OnStyleTextLatex(wxCommandEvent & WXUNUSED (event))3292 WxdkdrawFrame::OnStyleTextLatex(wxCommandEvent & WXUNUSED(event))
3293 {
3294 
3295 	if (BeginEventHandling()) {
3296 		if (cbStyleTextLaTeX->GetValue()) {
3297 			if (NULL != m_pStyle) {
3298 				(m_pStyle->det).t.fl |= WXD_TEXT_FLAG_LATEX;
3299 			}
3300 			else {
3301 				m_oStyle.det.t.fl |= WXD_TEXT_FLAG_LATEX;
3302 			}
3303 		}
3304 		else {
3305 			if (NULL != m_pStyle) {
3306 				(m_pStyle->det).t.fl =
3307 				(uint8_t)(((m_pStyle->det).t.fl) & (~(WXD_TEXT_FLAG_LATEX)));
3308 			}
3309 			else {
3310 				m_oStyle.det.t.fl =
3311 				(uint8_t)((m_oStyle.det.t.fl) & (~(WXD_TEXT_FLAG_LATEX)));
3312 			}
3313 		}
3314 		if (NULL != m_pStyle) {
3315 			SetModified();
3316 			wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3317 		}
3318 		EndEventHandling();
3319 	}
3320 
3321 }
3322 
3323 
3324 
3325 void
OnStyleTextAlign(wxCommandEvent & WXUNUSED (event))3326 WxdkdrawFrame::OnStyleTextAlign(wxCommandEvent & WXUNUSED(event))
3327 {
3328 	Wxd_object_t		*pobj;
3329 	int					 res;
3330 	uint8_t				 oal;
3331 	uint8_t				 nal;
3332 	bool				 bDrwElem;
3333 
3334 	pobj = ((NULL != m_pStyle) ? (m_pStyle) : (&m_oStyle));
3335 	bDrwElem = (NULL != m_pStyle);
3336 	oal  = nal = WXD_TA_LEFT;
3337 	if (WXD_OT_TEXT == pobj->ot) { oal = nal = (pobj->det).t.al; }
3338 	if (BeginEventHandling()) {
3339 		WxdkdrawDlgTextAlign	dlg(this, pobj, sTexts, ms_ta_images, bDrwElem);
3340 		Dk4WxApplicationHelper::ChooseChildPosition(*bStyleTextAlign, dlg);
3341 		res = dlg.ShowModal();
3342 		if (wxID_OK == res) {
3343 			nal = (pobj->det).t.al;
3344 			if (oal != nal) {
3345 				if (WXD_OT_TEXT == pobj->ot) {
3346 					if (NULL != m_pStyle) {
3347 						wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3348 						SetModified();
3349 					}
3350 					bStyleTextAlign->SetBitmap(ms_ta_images[nal]);
3351 					bStyleLineEnds->Refresh();
3352 					m_bUpdate = true;
3353 				}
3354 				else {
3355 					if (NULL == m_pStyle) {
3356 						bStyleTextAlign->SetBitmap(ms_ta_images[nal]);
3357 						bStyleLineEnds->Refresh();
3358 						m_bUpdate = true;
3359 					}
3360 				}
3361 			}
3362 		}
3363 		EndEventHandling();
3364 	}
3365 
3366 }
3367 
3368 
3369 
3370 void
OnStyleTextFont(wxCommandEvent & WXUNUSED (event))3371 WxdkdrawFrame::OnStyleTextFont(wxCommandEvent & WXUNUSED(event))
3372 {
3373 	Wxd_object_t		*pobj;
3374 	int					 res;
3375 	uint8_t				 ofind;
3376 	bool				 isobj;
3377 
3378 	if (NULL != m_pStyle) {
3379 		pobj = m_pStyle;
3380 		isobj = true;
3381 	}
3382 	else {
3383 		pobj = &m_oStyle;
3384 		isobj = false;
3385 	}
3386 	ofind = (pobj->det).t.find;
3387 	if (DK4_FONT_MAX < ofind) { ofind = DK4_FONT_MAX; }
3388 	if (BeginEventHandling()) {
3389 		WxdkdrawDlgFontName	dlg(this, pobj, isobj, sTexts, ms_fn_images);
3390 		Dk4WxApplicationHelper::ChooseChildPosition(*bStyleFontName, dlg);
3391 		res = dlg.ShowModal();
3392 		if (wxID_OK != res) {
3393 			UpdateTextForFont(pobj, false);
3394 		}
3395 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3396 		if (ofind != (pobj->det).t.find) {
3397 			SetModified();
3398 			bStyleFontName->SetBitmap(ms_fn_images[(pobj->det).t.find]);
3399 			bStyleFontName->Refresh();
3400 			m_bUpdate = true;
3401 		}
3402 		EndEventHandling();
3403 	}
3404 }
3405 
3406 
3407 
3408 void
OnStyleTextSize(wxSpinEvent & WXUNUSED (event))3409 WxdkdrawFrame::OnStyleTextSize(wxSpinEvent & WXUNUSED(event))
3410 {
3411 	Wxd_font_t		*pfont;
3412 	uint16_t		 ofs;
3413 	uint16_t		 nfs;
3414 	bool			 hasf;
3415 
3416 	if (BeginEventHandling()) {
3417 		if (NULL != m_pStyle) {
3418 			if (WXD_OT_TEXT == m_pStyle->ot) {
3419 				ofs = nfs = (m_pStyle->det).t.fsz;
3420 				nfs = (uint16_t)(spFontSize->GetValue());
3421 				if (ofs != nfs) {
3422 					(m_pStyle->det).t.fsz = nfs;
3423 					hasf = (NULL != (m_pStyle->det).t.font);
3424 					pfont = FindFont((m_pStyle->det).t.find, nfs);
3425 					(m_pStyle->det).t.font = pfont;
3426 					if (NULL != pfont) { UpdateOneFont(pfont); }
3427 					if (hasf) { wxdobj_remove_unused_fonts(m_pDrw); }
3428 					wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3429 					SetModified();
3430 				}
3431 			}
3432 		}
3433 		else {
3434 			m_oStyle.det.t.fsz = (uint16_t)(spFontSize->GetValue());
3435 		}
3436 		EndEventHandling();
3437 	}
3438 
3439 }
3440 
3441 
3442 
3443 void
OnSpinRotation(wxSpinEvent & WXUNUSED (event))3444 WxdkdrawFrame::OnSpinRotation(wxSpinEvent & WXUNUSED(event))
3445 {
3446 
3447 	if (BeginEventHandling()) {
3448 		if (NULL != m_pStyle) {
3449 			switch ( (int)(m_pStyle->ot) ) {
3450 				case WXD_OT_TEXT : {
3451 					(m_pStyle->det).t.a = (int16_t)(spRotation->GetValue());
3452 					SetModified();
3453 					RequireRedraw(WXD_REFRESH_DRAWING);
3454 				} break;
3455 				case WXD_OT_ELLIPSE : {
3456 					(m_pStyle->det).e.a = (int16_t)(spRotation->GetValue());
3457 					SetModified();
3458 					RequireRedraw(WXD_REFRESH_DRAWING);
3459 				} break;
3460 			}
3461 		}
3462 		EndEventHandling();
3463 	}
3464 
3465 }
3466 
3467 
3468 
3469 void
OnScrollH(wxScrollEvent & WXUNUSED (event))3470 WxdkdrawFrame::OnScrollH(wxScrollEvent & WXUNUSED(event))
3471 {
3472 
3473 	if (BeginEventHandling()) {
3474 		UseScrollH();
3475 		EndEventHandling();
3476 	}
3477 
3478 }
3479 
3480 
3481 
3482 void
OnScrollV(wxScrollEvent & WXUNUSED (event))3483 WxdkdrawFrame::OnScrollV(wxScrollEvent & WXUNUSED(event))
3484 {
3485 
3486 	if (BeginEventHandling()) {
3487 		UseScrollV();
3488 		EndEventHandling();
3489 	}
3490 
3491 }
3492 
3493 
3494 
3495 void
OnConvert1(wxCommandEvent & WXUNUSED (event))3496 WxdkdrawFrame::OnConvert1(wxCommandEvent & WXUNUSED(event))
3497 {
3498 
3499 	if (BeginEventHandling()) {
3500 		m_bSplineInterpolated	=	false;
3501 		m_iObjToCreate			=	WXD_OT_POLYGON;
3502 		m_iState				=	S_CONVERT;
3503 		m_pCurrent				=	NULL;
3504 		SetMouseAndStatusTexts(m_iState);
3505 		EndEventHandling();
3506 	}
3507 
3508 }
3509 
3510 
3511 
3512 void
OnConvert2(wxCommandEvent & WXUNUSED (event))3513 WxdkdrawFrame::OnConvert2(wxCommandEvent & WXUNUSED(event))
3514 {
3515 
3516 	if (BeginEventHandling()) {
3517 		m_bSplineInterpolated	=	false;
3518 		m_iObjToCreate			=	WXD_OT_POLYLINE;
3519 		m_iState				=	S_CONVERT;
3520 		m_pCurrent				=	NULL;
3521 		SetMouseAndStatusTexts(m_iState);
3522 		EndEventHandling();
3523 	}
3524 
3525 }
3526 
3527 
3528 
3529 void
OnConvert3(wxCommandEvent & WXUNUSED (event))3530 WxdkdrawFrame::OnConvert3(wxCommandEvent & WXUNUSED(event))
3531 {
3532 
3533 	if (BeginEventHandling()) {
3534 		m_bSplineInterpolated	=	true;
3535 		m_iObjToCreate			=	WXD_OT_O_SPLINE;
3536 		m_iState				=	S_CONVERT;
3537 		m_pCurrent				=	NULL;
3538 		SetMouseAndStatusTexts(m_iState);
3539 		EndEventHandling();
3540 	}
3541 
3542 }
3543 
3544 
3545 void
OnConvert4(wxCommandEvent & WXUNUSED (event))3546 WxdkdrawFrame::OnConvert4(wxCommandEvent & WXUNUSED(event))
3547 {
3548 
3549 	if (BeginEventHandling()) {
3550 		m_bSplineInterpolated	=	false;
3551 		m_iObjToCreate			=	WXD_OT_C_ARC;
3552 		m_iState				=	S_CONVERT;
3553 		m_pCurrent				=	NULL;
3554 		SetMouseAndStatusTexts(m_iState);
3555 		EndEventHandling();
3556 	}
3557 
3558 }
3559 
3560 
3561 
3562 void
OnConvert5(wxCommandEvent & WXUNUSED (event))3563 WxdkdrawFrame::OnConvert5(wxCommandEvent & WXUNUSED(event))
3564 {
3565 
3566 	if (BeginEventHandling()) {
3567 		m_bSplineInterpolated	=	false;
3568 		m_iObjToCreate			=	WXD_OT_O_ARC;
3569 		m_iState				=	S_CONVERT;
3570 		m_pCurrent				=	NULL;
3571 		SetMouseAndStatusTexts(m_iState);
3572 		EndEventHandling();
3573 	}
3574 
3575 }
3576 
3577 
3578 
3579 void
OnConvert6(wxCommandEvent & WXUNUSED (event))3580 WxdkdrawFrame::OnConvert6(wxCommandEvent & WXUNUSED(event))
3581 {
3582 
3583 	if (BeginEventHandling()) {
3584 		m_bSplineInterpolated	=	false;
3585 		m_iObjToCreate			=	WXD_OT_C_SPLINE;
3586 		m_iState				=	S_CONVERT;
3587 		m_pCurrent				=	NULL;
3588 		SetMouseAndStatusTexts(m_iState);
3589 		EndEventHandling();
3590 	}
3591 
3592 }
3593 
3594 
3595 
3596 void
OnConvert7(wxCommandEvent & WXUNUSED (event))3597 WxdkdrawFrame::OnConvert7(wxCommandEvent & WXUNUSED(event))
3598 {
3599 
3600 	if (BeginEventHandling()) {
3601 		m_bSplineInterpolated	=	false;
3602 		m_iObjToCreate			=	WXD_OT_O_SPLINE;
3603 		m_iState				=	S_CONVERT;
3604 		m_pCurrent				=	NULL;
3605 		SetMouseAndStatusTexts(m_iState);
3606 		EndEventHandling();
3607 	}
3608 
3609 }
3610 
3611 
3612 
3613 void
OnConvert8(wxCommandEvent & WXUNUSED (event))3614 WxdkdrawFrame::OnConvert8(wxCommandEvent & WXUNUSED(event))
3615 {
3616 
3617 	if (BeginEventHandling()) {
3618 		m_bSplineInterpolated	=	false;
3619 		m_iObjToCreate			=	WXD_OT_DOT_WHITE;
3620 		m_iState				=	S_CONVERT;
3621 		m_pCurrent				=	NULL;
3622 		SetMouseAndStatusTexts(m_iState);
3623 		EndEventHandling();
3624 	}
3625 
3626 }
3627 
3628 
3629 
3630 void
OnConvert9(wxCommandEvent & WXUNUSED (event))3631 WxdkdrawFrame::OnConvert9(wxCommandEvent & WXUNUSED(event))
3632 {
3633 
3634 	if (BeginEventHandling()) {
3635 		m_bSplineInterpolated	=	false;
3636 		m_iObjToCreate			=	WXD_OT_DOT_FILLED;
3637 		m_iState				=	S_CONVERT;
3638 		m_pCurrent				=	NULL;
3639 		SetMouseAndStatusTexts(m_iState);
3640 		EndEventHandling();
3641 	}
3642 
3643 }
3644 
3645 
3646 
3647 void
OnConvertA(wxCommandEvent & WXUNUSED (event))3648 WxdkdrawFrame::OnConvertA(wxCommandEvent & WXUNUSED(event))
3649 {
3650 
3651 	if (BeginEventHandling()) {
3652 		m_bSplineInterpolated	=	true;
3653 		m_iObjToCreate			=	WXD_OT_C_SPLINE;
3654 		m_iState				=	S_CONVERT;
3655 		m_pCurrent				=	NULL;
3656 		SetMouseAndStatusTexts(m_iState);
3657 		EndEventHandling();
3658 	}
3659 
3660 }
3661 
3662 
3663 
3664 void
OnColourBorderModify(wxCommandEvent & WXUNUSED (event))3665 WxdkdrawFrame::OnColourBorderModify(wxCommandEvent & WXUNUSED(event))
3666 {
3667 	if (BeginEventHandling()) {
3668 		ColorModify(IVI_BORDER_RED, WXD_REFRESH_GRID);
3669 		EndEventHandling();
3670 	}
3671 }
3672 
3673 
3674 
3675 void
OnColourBorderReset(wxCommandEvent & WXUNUSED (event))3676 WxdkdrawFrame::OnColourBorderReset(wxCommandEvent & WXUNUSED(event))
3677 {
3678 	if (BeginEventHandling()) {
3679 		ColorReset(IVI_BORDER_RED, WXD_REFRESH_GRID);
3680 		EndEventHandling();
3681 	}
3682 }
3683 
3684 
3685 
3686 void
OnColourBackgroundModify(wxCommandEvent & WXUNUSED (event))3687 WxdkdrawFrame::OnColourBackgroundModify(wxCommandEvent & WXUNUSED(event))
3688 {
3689 	if (BeginEventHandling()) {
3690 		ColorModify(IVI_BG_RED, WXD_REFRESH_GRID);
3691 		EndEventHandling();
3692 	}
3693 }
3694 
3695 
3696 
3697 void
OnColourBackgroundReset(wxCommandEvent & WXUNUSED (event))3698 WxdkdrawFrame::OnColourBackgroundReset(wxCommandEvent & WXUNUSED(event))
3699 {
3700 	if (BeginEventHandling()) {
3701 		ColorReset(IVI_BG_RED, WXD_REFRESH_GRID);
3702 		EndEventHandling();
3703 	}
3704 }
3705 
3706 
3707 
3708 void
OnColourGridModify(wxCommandEvent & WXUNUSED (event))3709 WxdkdrawFrame::OnColourGridModify(wxCommandEvent & WXUNUSED(event))
3710 {
3711 	if (BeginEventHandling()) {
3712 		ColorModify(IVI_GRID_RED, WXD_REFRESH_GRID);
3713 		EndEventHandling();
3714 	}
3715 }
3716 
3717 
3718 
3719 void
OnColourGridReset(wxCommandEvent & WXUNUSED (event))3720 WxdkdrawFrame::OnColourGridReset(wxCommandEvent & WXUNUSED(event))
3721 {
3722 	if (BeginEventHandling()) {
3723 		ColorReset(IVI_GRID_RED, WXD_REFRESH_GRID);
3724 		EndEventHandling();
3725 	}
3726 }
3727 
3728 
3729 
3730 void
OnColourPlacementModify(wxCommandEvent & WXUNUSED (event))3731 WxdkdrawFrame::OnColourPlacementModify(wxCommandEvent & WXUNUSED(event))
3732 {
3733 	if (BeginEventHandling()) {
3734 		ColorModify(IVI_PH_RED, WXD_REFRESH_MARKUP);
3735 		EndEventHandling();
3736 	}
3737 }
3738 
3739 
3740 
3741 void
OnColourPlacementReset(wxCommandEvent & WXUNUSED (event))3742 WxdkdrawFrame::OnColourPlacementReset(wxCommandEvent & WXUNUSED(event))
3743 {
3744 	if (BeginEventHandling()) {
3745 		ColorReset(IVI_PH_RED, WXD_REFRESH_MARKUP);
3746 		EndEventHandling();
3747 	}
3748 }
3749 
3750 
3751 
3752 void
OnColourCopyModify(wxCommandEvent & WXUNUSED (event))3753 WxdkdrawFrame::OnColourCopyModify(wxCommandEvent & WXUNUSED(event))
3754 {
3755 	if (BeginEventHandling()) {
3756 		ColorModify(IVI_M_COPY_RED, WXD_REFRESH_MARKUP);
3757 		EndEventHandling();
3758 	}
3759 }
3760 
3761 
3762 
3763 void
OnColourCopyReset(wxCommandEvent & WXUNUSED (event))3764 WxdkdrawFrame::OnColourCopyReset(wxCommandEvent & WXUNUSED(event))
3765 {
3766 	if (BeginEventHandling()) {
3767 		ColorReset(IVI_M_COPY_RED, WXD_REFRESH_MARKUP);
3768 		EndEventHandling();
3769 	}
3770 }
3771 
3772 
3773 
3774 void
OnColourMoveModify(wxCommandEvent & WXUNUSED (event))3775 WxdkdrawFrame::OnColourMoveModify(wxCommandEvent & WXUNUSED(event))
3776 {
3777 	if (BeginEventHandling()) {
3778 		ColorModify(IVI_M_MOVE_RED, WXD_REFRESH_MARKUP);
3779 		EndEventHandling();
3780 	}
3781 }
3782 
3783 
3784 
3785 void
OnColourMoveReset(wxCommandEvent & WXUNUSED (event))3786 WxdkdrawFrame::OnColourMoveReset(wxCommandEvent & WXUNUSED(event))
3787 {
3788 	if (BeginEventHandling()) {
3789 		ColorReset(IVI_M_MOVE_RED, WXD_REFRESH_MARKUP);
3790 		EndEventHandling();
3791 	}
3792 }
3793 
3794 
3795 
3796 void
OnColourDeleteModify(wxCommandEvent & WXUNUSED (event))3797 WxdkdrawFrame::OnColourDeleteModify(wxCommandEvent & WXUNUSED(event))
3798 {
3799 	if (BeginEventHandling()) {
3800 		ColorModify(IVI_M_DEL_RED, WXD_REFRESH_MARKUP);
3801 		EndEventHandling();
3802 	}
3803 }
3804 
3805 
3806 
3807 void
OnColourDeleteReset(wxCommandEvent & WXUNUSED (event))3808 WxdkdrawFrame::OnColourDeleteReset(wxCommandEvent & WXUNUSED(event))
3809 {
3810 	if (BeginEventHandling()) {
3811 		ColorReset(IVI_M_DEL_RED, WXD_REFRESH_MARKUP);
3812 		EndEventHandling();
3813 	}
3814 }
3815 
3816 
3817 
3818 void
OnColourGroupModify(wxCommandEvent & WXUNUSED (event))3819 WxdkdrawFrame::OnColourGroupModify(wxCommandEvent & WXUNUSED(event))
3820 {
3821 	if (BeginEventHandling()) {
3822 		ColorModify(IVI_M_GROUP_RED, WXD_REFRESH_MARKUP);
3823 		EndEventHandling();
3824 	}
3825 }
3826 
3827 
3828 
3829 void
OnColourGroupReset(wxCommandEvent & WXUNUSED (event))3830 WxdkdrawFrame::OnColourGroupReset(wxCommandEvent & WXUNUSED(event))
3831 {
3832 	if (BeginEventHandling()) {
3833 		ColorReset(IVI_M_GROUP_RED, WXD_REFRESH_MARKUP);
3834 		EndEventHandling();
3835 	}
3836 }
3837 
3838 
3839 
3840 void
OnColourMissingModify(wxCommandEvent & WXUNUSED (event))3841 WxdkdrawFrame::OnColourMissingModify(wxCommandEvent & WXUNUSED(event))
3842 {
3843 	if (BeginEventHandling()) {
3844 		ColorModify(IVI_MISSIMG_RED, WXD_REFRESH_DRAWING);
3845 		EndEventHandling();
3846 	}
3847 }
3848 
3849 
3850 
3851 void
OnColourMissingReset(wxCommandEvent & WXUNUSED (event))3852 WxdkdrawFrame::OnColourMissingReset(wxCommandEvent & WXUNUSED(event))
3853 {
3854 	if (BeginEventHandling()) {
3855 		ColorReset(IVI_MISSIMG_RED, WXD_REFRESH_DRAWING);
3856 		EndEventHandling();
3857 	}
3858 }
3859 
3860 
3861 
3862 
3863 void
OnResetOptions(wxCommandEvent & WXUNUSED (event))3864 WxdkdrawFrame::OnResetOptions(wxCommandEvent & WXUNUSED(event))
3865 {
3866 	int		res;			/* Message box result */
3867 
3868 	if (m_bActive) {
3869 		Dk4WxYesNoDialog	dlg(
3870 			this, pAppHelp, sTexts[605], sTexts[604]
3871 		);
3872 		StartEventHandling();
3873 #if	VERSION_BEFORE_2020_08_23
3874 		res = wxMessageBox(
3875 			sTexts[605], sTexts[604], (wxYES_NO | wxICON_QUESTION)
3876 		);
3877 #else
3878 		res = dlg.ShowModal();
3879 #endif
3880 		if (wxID_YES == res) {
3881 			ResetConfiguration();
3882 			cbGridOnOff->SetValue(true);
3883 			cbPH->SetValue(false);
3884 			if (
3885 				(S_NOOP != m_iState) || (NULL == m_pStyle)
3886 				|| (&m_oStyle == m_pStyle)
3887 			) {
3888 				StyleToGUI();
3889 			}
3890 			cbGridOnOff->Refresh();
3891 			cbPH->Refresh();
3892 			if ((NULL != m_pDrw) && (NULL != drawco)) {
3893 				wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID);
3894 				drawco->Refresh();
3895 			}
3896 			m_bUpdate = true;
3897 		}
3898 		EndEventHandling();
3899 	}
3900 
3901 }
3902 
3903 
3904 
3905 void
OnModifySplineValue(wxCommandEvent & WXUNUSED (event))3906 WxdkdrawFrame::OnModifySplineValue(wxCommandEvent & WXUNUSED(event))
3907 {
3908 
3909 	if (BeginEventHandling()) {
3910 		EndOperation(true);
3911 		m_iState = S_MOD_SPLINE;
3912 		wxdobj_unmark_all(m_pDrw, OBJ_MARKER_1);
3913 		m_pCurrent = NULL;
3914 		SetMouseAndStatusTexts(m_iState);
3915 		EndEventHandling();
3916 	}
3917 
3918 }
3919 
3920 
3921 
3922 void
OnOptionsNewObjects(wxCommandEvent & WXUNUSED (event))3923 WxdkdrawFrame::OnOptionsNewObjects(wxCommandEvent & WXUNUSED(event))
3924 {
3925 
3926 	if (BeginEventHandling()) {
3927 		EndOperation(true);
3928 		WxdkdrawDlgOptionsNewObjects	dlg(
3929 			this,
3930 			&(m_iv[IVI_DOT_DIAMETER_FILLED]),
3931 			&(m_iv[IVI_DOT_DIAMETER_WHITE]),
3932 			sTexts
3933 		);
3934 		dlg.ShowModal();
3935 		EndEventHandling();
3936 	}
3937 
3938 }
3939 
3940 
3941 
3942 void
OnOptionsScreenRepresentation(wxCommandEvent & WXUNUSED (event))3943 WxdkdrawFrame::OnOptionsScreenRepresentation(wxCommandEvent & WXUNUSED(event))
3944 {
3945 
3946 	if (BeginEventHandling()) {
3947 		EndOperation(true);
3948 		WxdkdrawDlgOptionsScreen	dlg(
3949 			this, drawco, m_pDrw,
3950 			&(m_iv[IVI_XS_SUBSEGS]), &(m_iv[IVI_FONT_EXACT]),
3951 			&(m_iv[IVI_REDUCE_MARKUP_POINTS]), sTexts
3952 		);
3953 		dlg.ShowModal();
3954 		UpdateFonts();
3955 		wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_DRAWING);
3956 		drawco->Refresh();
3957 		m_bUpdate = true;
3958 		EndEventHandling();
3959 	}
3960 
3961 }
3962 
3963 
3964 
3965 /* vim: set ai sw=4 ts=4 : */
3966 
3967