1 /*
2 Copyright 2020, Dirk Krause. All rights reserved.
3 SPDX-License-Identifier:	BSD-3-Clause
4 */
5 
6 #ifndef H_INCLUDED_wxdkdraw
7 /**	Include file only once.
8 */
9 #define	H_INCLUDED_wxdkdraw 1
10 
11 #ifndef DK4CONF_H_INCLUDED
12 #include "dk4conf.h"
13 #endif
14 
15 #ifndef DK4TYPES_H_INCLUDED
16 #include <libdk4base/dk4types.h>
17 #endif
18 
19 #ifndef	DK4MEM_H_INCLUDED
20 #include <libdk4base/dk4mem.h>
21 #endif
22 
23 #ifndef	DK4STR8_H_INCLUDED
24 #include <libdk4base/dk4str8.h>
25 #endif
26 
27 #ifndef	DK4ENC_H_INCLUDED
28 #include <libdk4c/dk4enc.h>
29 #endif
30 
31 #ifndef	DK4LOC_H_INCLUDED
32 #include <libdk4c/dk4loc.h>
33 #endif
34 
35 #ifndef	DK4MATH_H_INCLUDED
36 #include <libdk4c/dk4math.h>
37 #endif
38 
39 #ifndef	DK4MAAI_H_INCLUDED
40 #include <libdk4ma/dk4maai.h>
41 #endif
42 
43 #ifndef	DK4MAAI16_H_INCLUDED
44 #include <libdk4ma/dk4maai16.h>
45 #endif
46 
47 #ifndef	DK4MAAU16_H_INCLUDED
48 #include <libdk4ma/dk4maau16.h>
49 #endif
50 
51 #ifndef	DK4MAAI32_H_INCLUDED
52 #include <libdk4ma/dk4maai32.h>
53 #endif
54 
55 #ifndef	DK4MAAU32_H_INCLUDED
56 #include <libdk4ma/dk4maau32.h>
57 #endif
58 
59 #ifndef	DK4MAI8DI8_H_INCLUDED
60 #include <libdk4maio8d/dk4mai8di8.h>
61 #endif
62 
63 #ifndef	DK4MAI8DU8_H_INCLUDED
64 #include <libdk4maio8d/dk4mai8du8.h>
65 #endif
66 
67 #ifndef	DK4MAI8DI16_H_INCLUDED
68 #include <libdk4maio8d/dk4mai8di16.h>
69 #endif
70 
71 #ifndef	DK4MAI8DU16_H_INCLUDED
72 #include <libdk4maio8d/dk4mai8du16.h>
73 #endif
74 
75 #ifndef	DK4MAI8DI32_H_INCLUDED
76 #include <libdk4maio8d/dk4mai8di32.h>
77 #endif
78 
79 #ifndef	DK4MAI8DU32_H_INCLUDED
80 #include <libdk4maio8d/dk4mai8du32.h>
81 #endif
82 
83 #ifndef	DK4MAI8DBL_H_INCLUDED
84 #include <libdk4maio8d/dk4mai8dbl.h>
85 #endif
86 
87 #ifndef	DK4MAO8D_H_INCLUDED
88 #include <libdk4maio8d/dk4mao8d.h>
89 #endif
90 
91 #ifndef	DK4MAO8DBL_H_INCLUDED
92 #include <libdk4maio8d/dk4mao8dbl.h>
93 #endif
94 
95 #ifndef	DK4GRA_H_INCLUDED
96 #include <libdk4gra/dk4gra.h>
97 #endif
98 
99 #ifndef	DK4GRAT_H_INCLUDED
100 #include <libdk4gra/dk4grat.h>
101 #endif
102 
103 #ifndef	DK4XSP_H_INCLUDED
104 #include <libdk4gra/dk4xsp.h>
105 #endif
106 
107 #ifndef	DK4VERSWX_H_INCLUDED
108 #include <libdk4wx/dk4verswx.h>
109 #endif
110 
111 #ifndef	DK4UNUSED_H_INCLUDED
112 #include <libdk4base/dk4unused.h>
113 #endif
114 
115 #ifndef WX_WXPREC_H_INCLUDED
116 #include <wx/wxprec.h>
117 #define	WX_WXPREC_H_INCLUDED 1
118 #endif
119 
120 #ifdef __BORLANDC__
121 #pragma hdrstop
122 #endif
123 
124 #ifndef WX_PRECOMP
125 #ifndef WX_WX_H_INCLUDED
126 #include <wx/wx.h>
127 #define	WX_WX_H_INCLUDED 1
128 #endif
129 #endif
130 
131 #ifndef WX_ARRSTR_H_INCLUDED
132 #include <wx/arrstr.h>
133 #define	WX_ARRSTR_H_INCLUDED 1
134 #endif
135 
136 #ifndef WX_CONFIG_H_INCLUDED
137 #include <wx/config.h>
138 #define	WX_CONFIG_H_INCLUDED 1
139 #endif
140 
141 #ifndef WX_FILENAME_H_INCLUDED
142 #include <wx/filename.h>
143 #define	WX_FILENAME_H_INCLUDED 1
144 #endif
145 
146 #ifndef	WX_FFILE_H_INCLUDED
147 #include <wx/ffile.h>
148 #define	WX_FFILE_H_INCLUDED 1
149 #endif
150 
151 #ifndef WX_GBSIZER_H_INCLUDED
152 #include <wx/gbsizer.h>
153 #define	WX_GBSIZER_H_INCLUDED 1
154 #endif
155 
156 #ifndef WX_THREAD_H_INCLUDED
157 #include <wx/thread.h>
158 #define	WX_THREAD_H_INCLUDED 1
159 #endif
160 
161 #ifndef WX_GAUGE_H_INCLUDED
162 #include <wx/gauge.h>
163 #define	WX_GAUGE_H_INCLUDED 1
164 #endif
165 
166 #ifndef	WX_SPINCTRL_H_INCLUDED
167 #include <wx/spinctrl.h>
168 #define	WX_SPINCTRL_H_INCLUDED 1
169 #endif
170 
171 #ifndef	WX_DCBUFFER_H_INCLUDED
172 #include <wx/dcbuffer.h>
173 #endif
174 
175 #ifndef WX_HELP_H_INCLUDED
176 #include <wx/help.h>
177 #define	WX_HELP_H_INCLUDED 1
178 #endif
179 
180 #ifndef WX_FS_ZIP_H_INCLUDED
181 #include <wx/fs_zip.h>
182 #define	WX_FS_ZIP_H_INCLUDED 1
183 #endif
184 
185 #ifndef WX_CMDLINE_H_INCLUDED
186 #include <wx/cmdline.h>
187 #define	WX_CMDLINE_H_INCLUDED 1
188 #endif
189 
190 #ifndef WX_DIR_H_INCLUDED
191 #include <wx/dir.h>
192 #define	WX_DIR_H_INCLUDED 1
193 #endif
194 
195 #ifndef	WX_GRAPHICS_H_INCLUDED
196 #include <wx/graphics.h>
197 #define	WX_GRAPHICS_H_INCLUDED	1
198 #endif
199 
200 #ifndef	WX_COLORDLG_H_INCLUDED
201 #include <wx/colordlg.h>
202 #define	WX_COLORDLG_H_INCLUDED 1
203 #endif
204 
205 
206 
207 /*	__CHANGE__ 018:	Add further wxWidgets header files.
208 */
209 
210 #ifndef	WXDKDRAWTYPES_H_INCLUDED
211 #include <wxdkdraw/WxdkdrawTypes.h>
212 #endif
213 
214 #ifndef	WXDENUM_H_INCLUDED
215 #include <wxdkdraw/wxdenum.h>
216 #endif
217 
218 #ifndef	WXDARC_H_INCLUDED
219 #include <wxdkdraw/wxdarc.h>
220 #endif
221 
222 #ifndef	WXDKDRAWOBJ_H_INCLUDED
223 #include <wxdkdraw/WxdkdrawObj.h>
224 #endif
225 
226 #ifndef	WXDKDRAWFONT_H_INCLUDED
227 #include <wxdkdraw/WxdkdrawFont.h>
228 #endif
229 
230 #ifndef	WXDKDRAWCOMP_H_INCLUDED
231 #include <wxdkdraw/WxdkdrawComp.h>
232 #endif
233 
234 #ifndef	WXDKDRAWREAD_H_INCLUDED
235 #include <wxdkdraw/WxdkdrawRead.h>
236 #endif
237 
238 #ifndef	WXDKDRAWWRITE_H_INCLUDED
239 #include <wxdkdraw/WxdkdrawWrite.h>
240 #endif
241 
242 #ifndef	DK4STRX_H_INCLUDED
243 #include <libdk4wx/dk4strx.h>
244 #endif
245 
246 #ifndef	DK4RECWX_H_INCLUDED
247 #include <libdk4wx/dk4recwx.h>
248 #endif
249 
250 #ifndef	DK4MPL_H_INCLUDED
251 #include <libdk4base/dk4mpl.h>
252 #endif
253 
254 #ifndef DK4WXAPPLICTIONHELPER_H_INCLUDED
255 #include <libdk4wx/Dk4WxApplicationHelper.h>
256 #endif
257 
258 #ifndef DK4WXFRAME_H_INCLUDED
259 #include <libdk4wx/Dk4WxFrame.h>
260 #endif
261 
262 #ifndef DK4WXPROGRESSDIALOG_H_INCLUDED
263 #include <libdk4wx/Dk4WxProgressDialog.h>
264 #endif
265 
266 #ifndef DK4WXHELPCONTROLLER_H_INCLUDED
267 #include <libdk4wx/Dk4WxHelpController.h>
268 #endif
269 
270 /*	__CHANGE__ 018:	Add header files for further classes and modules.
271 */
272 
273 
274 /**	Current operation or processing state, stored
275 	in the m_iState member of the frame.
276 */
277 enum {
278 	S_NOOP			= 0 ,	/**< No operation. */
279 	S_DELETE ,				/**< Delete objects. */
280 	S_REGION_DELETE ,		/**< Delete region. */
281 	S_MOVE_SELECT ,			/**< Select objects to move. */
282 	S_MOVE_PLACE ,			/**< Place objects when moving. */
283 	S_COPY_SELECT ,			/**< Select objects to copy. */
284 	S_COPY_PLACE ,			/**< Place objects when copying. */
285 	S_POLY_FIRST ,			/**< Place first polygon/polyline point. */
286 	S_POLY_FURTHER ,		/**< Place further polygon/polyline point. */
287 	S_SPLINE_FIRST ,		/**< Place first spline point. */
288 	S_SPLINE_FURTHER ,		/**< Place further spline point. */
289 	S_BOX_FIRST ,			/**< Place first box corner. */
290 	S_BOX_OPPOSITE ,		/**< Place opposite box corner. */
291 	S_CIRCLE_CENTER ,		/**< Place circle center point. */
292 	S_CIRCLE_RADIUS ,		/**< Place any circle point for radius. */
293 	S_ELLIPSE_CENTER ,		/**< Place ellipse center point. */
294 	S_ELLIPSE_CORNER ,		/**< Place ellipse bounding box corner point. */
295 	S_ARC_1 ,				/**< Place arc start point. */
296 	S_ARC_2 ,				/**< Place arc intermediate point. */
297 	S_ARC_3 ,				/**< Place arc end point. */
298 	S_DOT ,					/**< Place dot. */
299 	S_TEXT ,				/**< Place text. */
300 	S_IMG_1 ,				/**< Place first image point. */
301 	S_IMG_2 ,				/**< Place opposite image point. */
302 	S_LIBELEM_PLACE ,		/**< Place library element. */
303 	S_MOVEPT_SELECT ,		/**< Move point, select point to move. */
304 	S_MOVEPT_PLACE ,		/**< Move point, place at new position. */
305 	S_DELPT ,				/**< Delete point from spline or polyline. */
306 	S_ADDPT_SELECT ,		/**< Add point, select neightbour. */
307 	S_ADDPT_PLACE ,			/**< Add point, place new point. */
308 	S_DRWSZ_SELECT ,		/**< Change drawing size, select point. */
309 	S_DRWSZ_PLACE ,			/**< Change drawing size, place point. */
310 	S_FLIP ,				/**< File elements vertically or horizontally. */
311 	S_GROUP_ONE ,			/**< Group elements one by one. */
312 	S_GROUP_RECT_1 ,		/**< Group elements by bounding box rectangle. */
313 	S_GROUP_RECT_2 ,		/**< Group elements by bounding box stage 2. */
314 	S_UNGROUP ,				/**< Ungroup elements. */
315 	S_DETAILS ,				/**< Edit object details. */
316 	S_DETAILS_2 ,			/**< Edit object details, step 2. */
317 	S_CONVERT ,				/**< Convert to other object types. */
318 	S_ROTATE ,				/**< Rotate object 90 degree. */
319 	S_MOD_SPLINE ,			/**< Modify spline s value. */
320 };
321 
322 
323 
324 /**	Error codes for wxdkdraw.
325 */
326 enum {
327 								/**	Failed to read file (syntax or other).
328 								*/
329 	WXD_E_FAILED_TO_READ_FILE = (DK4_E_HIGHEST_NUMBER + 1),
330 
331 								/**	Failed to open file for reading.
332 								*/
333 	WXD_E_FAILED_TO_OPEN_FILE ,
334 
335 								/**	Mouse position not available.
336 								*/
337 	WXD_E_MOUSE_POS_NOT_AVAILABLE ,
338 
339 								/**	Missing export text.
340 								*/
341 	WXD_E_NO_EXPORT_TEXT ,
342 
343 								/**	No file name specified for image.
344 								*/
345 	WXD_E_NO_FILENAME ,
346 
347 								/**	Failed to retrieve coordinates from object.
348 								*/
349 	WXD_E_GET_CONTROL_POINT ,
350 
351 								/**	Failed to set coordinates on object.
352 								*/
353 	WXD_E_SET_CONTROL_POINT ,
354 
355 								/**	Numeric overflow in coordinates calculation.
356 								*/
357 	WXD_E_OVERFLOW_COORDINATES ,
358 
359 								/**	Failed to move an object to a group.
360 								*/
361 	WXD_E_MOVE_TO_GROUP ,
362 
363 								/**	Failed to ungroup an object.
364 								*/
365 	WXD_E_UNGROUP_OBJECT ,
366 
367 								/**	Box is too small to calculate corner radius.
368 								*/
369 	WXD_E_BOX_TOO_SMALL ,
370 
371 								/**	New point out of index range.
372 								*/
373 	WXD_E_BUG_POINT_OOR ,
374 
375 								/**	Too many points.
376 								*/
377 	WXD_E_TOO_MANY_POINTS ,
378 
379 								/**	Can not convert this object.
380 								*/
381 	WXD_E_CANNOT_CONVERT ,
382 
383 								/**	Current working directory too long.
384 								*/
385 	WXD_E_CWD_TOO_LONG ,
386 
387 								/**	Failed to find current working directory.
388 								*/
389 	WXD_E_NO_CWD ,
390 
391 								/**	Output file name too long.
392 								*/
393 	WXD_E_OUTPUT_FN_TOO_LONG ,
394 
395 								/**	Failed to find output directory name.
396 								*/
397 	WXD_E_OUTPUT_DIRNAME ,
398 
399 
400 };
401 
402 
403 /**	Resolution as double value.
404 	16256000 wxd units make up one inch.
405 	 6400000 wxd units make up one centimeter.
406 */
407 #define	RESWXD	16256000.0
408 #define	CMWXD	 6400000.0
409 
410 
411 /**	Layer manager checkbox structure.
412 */
413 typedef struct {
414 	Wxd_layer_t		*lay;	/**< Layer controlled by element. */
415 	wxCheckBox		*cb;	/**< Checkbox for that layer. */
416 	uint8_t			 oa;	/**< Old active value. */
417 } Wxd_layer_cb_t;
418 
419 
420 
421 #endif
422 
423 /* vim: set ai sw=4 ts=4 : */
424 
425