summaryrefslogtreecommitdiff
path: root/support/dktools/wxdkdraw.h
blob: f7c1746719fbb886a0d25b8983e680098d8f642f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
/*
Copyright 2020, Dirk Krause. All rights reserved.
SPDX-License-Identifier:	BSD-3-Clause
*/

#ifndef H_INCLUDED_wxdkdraw
/**	Include file only once.
*/
#define	H_INCLUDED_wxdkdraw 1

#ifndef DK4CONF_H_INCLUDED
#include <dk4conf.h>
#endif

#ifndef DK4TYPES_H_INCLUDED
#include <dk4types.h>
#endif

#ifndef	DK4MEM_H_INCLUDED
#include <dk4mem.h>
#endif

#ifndef	DK4STR8_H_INCLUDED
#include <dk4str8.h>
#endif

#ifndef	DK4ENC_H_INCLUDED
#include <dk4enc.h>
#endif

#ifndef	DK4LOC_H_INCLUDED
#include <dk4loc.h>
#endif

#ifndef	DK4MATH_H_INCLUDED
#include <dk4math.h>
#endif

#ifndef	DK4MAAI_H_INCLUDED
#include <dk4maai.h>
#endif

#ifndef	DK4MAAI16_H_INCLUDED
#include <dk4maai16.h>
#endif

#ifndef	DK4MAAU16_H_INCLUDED
#include <dk4maau16.h>
#endif

#ifndef	DK4MAAI32_H_INCLUDED
#include <dk4maai32.h>
#endif

#ifndef	DK4MAAU32_H_INCLUDED
#include <dk4maau32.h>
#endif

#ifndef	DK4MAI8DI8_H_INCLUDED
#include <dk4mai8di8.h>
#endif

#ifndef	DK4MAI8DU8_H_INCLUDED
#include <dk4mai8du8.h>
#endif

#ifndef	DK4MAI8DI16_H_INCLUDED
#include <dk4mai8di16.h>
#endif

#ifndef	DK4MAI8DU16_H_INCLUDED
#include <dk4mai8du16.h>
#endif

#ifndef	DK4MAI8DI32_H_INCLUDED
#include <dk4mai8di32.h>
#endif

#ifndef	DK4MAI8DU32_H_INCLUDED
#include <dk4mai8du32.h>
#endif

#ifndef	DK4MAI8DBL_H_INCLUDED
#include <dk4mai8dbl.h>
#endif

#ifndef	DK4MAO8D_H_INCLUDED
#include <dk4mao8d.h>
#endif

#ifndef	DK4MAO8DBL_H_INCLUDED
#include <dk4mao8dbl.h>
#endif

#ifndef	DK4GRA_H_INCLUDED
#include <dk4gra.h>
#endif

#ifndef	DK4GRAT_H_INCLUDED
#include <dk4grat.h>
#endif

#ifndef	DK4XSP_H_INCLUDED
#include <dk4xsp.h>
#endif

#ifndef	DK4VERSWX_H_INCLUDED
#include <dk4verswx.h>
#endif

#ifndef	DK4UNUSED_H_INCLUDED
#include <dk4unused.h>
#endif

#ifndef WX_WXPREC_H_INCLUDED
#include <wx/wxprec.h>
#define	WX_WXPREC_H_INCLUDED 1
#endif

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#ifndef WX_WX_H_INCLUDED
#include <wx/wx.h>
#define	WX_WX_H_INCLUDED 1
#endif
#endif

#ifndef WX_ARRSTR_H_INCLUDED
#include <wx/arrstr.h>
#define	WX_ARRSTR_H_INCLUDED 1
#endif

#ifndef WX_CONFIG_H_INCLUDED
#include <wx/config.h>
#define	WX_CONFIG_H_INCLUDED 1
#endif

#ifndef WX_FILENAME_H_INCLUDED
#include <wx/filename.h>
#define	WX_FILENAME_H_INCLUDED 1
#endif

#ifndef	WX_FFILE_H_INCLUDED
#include <wx/ffile.h>
#define	WX_FFILE_H_INCLUDED 1
#endif

#ifndef WX_GBSIZER_H_INCLUDED
#include <wx/gbsizer.h>
#define	WX_GBSIZER_H_INCLUDED 1
#endif

#ifndef WX_THREAD_H_INCLUDED
#include <wx/thread.h>
#define	WX_THREAD_H_INCLUDED 1
#endif

#ifndef WX_GAUGE_H_INCLUDED
#include <wx/gauge.h>
#define	WX_GAUGE_H_INCLUDED 1
#endif

#ifndef	WX_SPINCTRL_H_INCLUDED
#include <wx/spinctrl.h>
#define	WX_SPINCTRL_H_INCLUDED 1
#endif

#ifndef	WX_DCBUFFER_H_INCLUDED
#include <wx/dcbuffer.h>
#endif

#ifndef WX_HELP_H_INCLUDED
#include <wx/help.h>
#define	WX_HELP_H_INCLUDED 1
#endif

#ifndef WX_FS_ZIP_H_INCLUDED
#include <wx/fs_zip.h>
#define	WX_FS_ZIP_H_INCLUDED 1
#endif

#ifndef WX_CMDLINE_H_INCLUDED
#include <wx/cmdline.h>
#define	WX_CMDLINE_H_INCLUDED 1
#endif

#ifndef WX_DIR_H_INCLUDED
#include <wx/dir.h>
#define	WX_DIR_H_INCLUDED 1
#endif

#ifndef	WX_GRAPHICS_H_INCLUDED
#include <wx/graphics.h>
#define	WX_GRAPHICS_H_INCLUDED	1
#endif

#ifndef	WX_COLORDLG_H_INCLUDED
#include <wx/colordlg.h>
#define	WX_COLORDLG_H_INCLUDED 1
#endif



/*	__CHANGE__ 018:	Add further wxWidgets header files.
*/

#ifndef	WXDKDRAWTYPES_H_INCLUDED
#include "WxdkdrawTypes.h"
#endif

#ifndef	WXDENUM_H_INCLUDED
#include "wxdenum.h"
#endif

#ifndef	WXDARC_H_INCLUDED
#include "wxdarc.h"
#endif

#ifndef	WXDKDRAWOBJ_H_INCLUDED
#include "WxdkdrawObj.h"
#endif

#ifndef	WXDKDRAWFONT_H_INCLUDED
#include "WxdkdrawFont.h"
#endif

#ifndef	WXDKDRAWCOMP_H_INCLUDED
#include "WxdkdrawComp.h"
#endif

#ifndef	WXDKDRAWREAD_H_INCLUDED
#include "WxdkdrawRead.h"
#endif

#ifndef	WXDKDRAWWRITE_H_INCLUDED
#include "WxdkdrawWrite.h"
#endif

#ifndef	DK4STRX_H_INCLUDED
#include <dk4strx.h>
#endif

#ifndef	DK4RECWX_H_INCLUDED
#include <dk4recwx.h>
#endif

#ifndef	DK4MPL_H_INCLUDED
#include <dk4mpl.h>
#endif

#ifndef DK4WXAPPLICTIONHELPER_H_INCLUDED
#include <Dk4WxApplicationHelper.h>
#endif

#ifndef DK4WXFRAME_H_INCLUDED
#include <Dk4WxFrame.h>
#endif

#ifndef DK4WXPROGRESSDIALOG_H_INCLUDED
#include <Dk4WxProgressDialog.h>
#endif

#ifndef DK4WXHELPCONTROLLER_H_INCLUDED
#include <Dk4WxHelpController.h>
#endif

/*	__CHANGE__ 018:	Add header files for further classes and modules.
*/


/**	Current operation or processing state, stored
	in the m_iState member of the frame.
*/
enum {
	S_NOOP			= 0 ,	/**< No operation. */
	S_DELETE ,				/**< Delete objects. */
	S_REGION_DELETE ,		/**< Delete region. */
	S_MOVE_SELECT ,			/**< Select objects to move. */
	S_MOVE_PLACE ,			/**< Place objects when moving. */
	S_COPY_SELECT ,			/**< Select objects to copy. */
	S_COPY_PLACE ,			/**< Place objects when copying. */
	S_POLY_FIRST ,			/**< Place first polygon/polyline point. */
	S_POLY_FURTHER ,		/**< Place further polygon/polyline point. */
	S_SPLINE_FIRST ,		/**< Place first spline point. */
	S_SPLINE_FURTHER ,		/**< Place further spline point. */
	S_BOX_FIRST ,			/**< Place first box corner. */
	S_BOX_OPPOSITE ,		/**< Place opposite box corner. */
	S_CIRCLE_CENTER ,		/**< Place circle center point. */
	S_CIRCLE_RADIUS ,		/**< Place any circle point for radius. */
	S_ELLIPSE_CENTER ,		/**< Place ellipse center point. */
	S_ELLIPSE_CORNER ,		/**< Place ellipse bounding box corner point. */
	S_ARC_1 ,				/**< Place arc start point. */
	S_ARC_2 ,				/**< Place arc intermediate point. */
	S_ARC_3 ,				/**< Place arc end point. */
	S_DOT ,					/**< Place dot. */
	S_TEXT ,				/**< Place text. */
	S_IMG_1 ,				/**< Place first image point. */
	S_IMG_2 ,				/**< Place opposite image point. */
	S_LIBELEM_PLACE ,		/**< Place library element. */
	S_MOVEPT_SELECT ,		/**< Move point, select point to move. */
	S_MOVEPT_PLACE ,		/**< Move point, place at new position. */
	S_DELPT ,				/**< Delete point from spline or polyline. */
	S_ADDPT_SELECT ,		/**< Add point, select neightbour. */
	S_ADDPT_PLACE ,			/**< Add point, place new point. */
	S_DRWSZ_SELECT ,		/**< Change drawing size, select point. */
	S_DRWSZ_PLACE ,			/**< Change drawing size, place point. */
	S_FLIP ,				/**< File elements vertically or horizontally. */
	S_GROUP_ONE ,			/**< Group elements one by one. */
	S_GROUP_RECT_1 ,		/**< Group elements by bounding box rectangle. */
	S_GROUP_RECT_2 ,		/**< Group elements by bounding box stage 2. */
	S_UNGROUP ,				/**< Ungroup elements. */
	S_DETAILS ,				/**< Edit object details. */
	S_DETAILS_2 ,			/**< Edit object details, step 2. */
	S_CONVERT ,				/**< Convert to other object types. */
	S_ROTATE ,				/**< Rotate object 90 degree. */
	S_MOD_SPLINE ,			/**< Modify spline s value. */
};



/**	Error codes for wxdkdraw.
*/
enum {
								/**	Failed to read file (syntax or other).
								*/
	WXD_E_FAILED_TO_READ_FILE = (DK4_E_HIGHEST_NUMBER + 1),

								/**	Failed to open file for reading.
								*/
	WXD_E_FAILED_TO_OPEN_FILE ,

								/**	Mouse position not available.
								*/
	WXD_E_MOUSE_POS_NOT_AVAILABLE ,

								/**	Missing export text.
								*/
	WXD_E_NO_EXPORT_TEXT ,

								/**	No file name specified for image.
								*/
	WXD_E_NO_FILENAME ,

								/**	Failed to retrieve coordinates from object.
								*/
	WXD_E_GET_CONTROL_POINT ,

								/**	Failed to set coordinates on object.
								*/
	WXD_E_SET_CONTROL_POINT ,

								/**	Numeric overflow in coordinates calculation.
								*/
	WXD_E_OVERFLOW_COORDINATES ,

								/**	Failed to move an object to a group.
								*/
	WXD_E_MOVE_TO_GROUP ,

								/**	Failed to ungroup an object.
								*/
	WXD_E_UNGROUP_OBJECT ,

								/**	Box is too small to calculate corner radius.
								*/
	WXD_E_BOX_TOO_SMALL ,

								/**	New point out of index range.
								*/
	WXD_E_BUG_POINT_OOR ,

								/**	Too many points.
								*/
	WXD_E_TOO_MANY_POINTS ,

								/**	Can not convert this object.
								*/
	WXD_E_CANNOT_CONVERT ,

								/**	Current working directory too long.
								*/
	WXD_E_CWD_TOO_LONG ,

								/**	Failed to find current working directory.
								*/
	WXD_E_NO_CWD ,

								/**	Output file name too long.
								*/
	WXD_E_OUTPUT_FN_TOO_LONG ,

								/**	Failed to find output directory name.
								*/
	WXD_E_OUTPUT_DIRNAME ,


};


/**	Resolution as double value.
	16256000 wxd units make up one inch.
	 6400000 wxd units make up one centimeter.
*/
#define	RESWXD	16256000.0
#define	CMWXD	 6400000.0


/**	Layer manager checkbox structure.
*/
typedef struct {
	Wxd_layer_t		*lay;	/**< Layer controlled by element. */
	wxCheckBox		*cb;	/**< Checkbox for that layer. */
	uint8_t			 oa;	/**< Old active value. */
} Wxd_layer_cb_t;



#endif

/* vim: set ai sw=4 ts=4 : */