/* Copyright (C) 2018-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: WxdkdrawTypes.cpt */ #ifndef WXDKDRAWTYPES_H_INCLUDED /** Avoid multiple inclusions. */ #define WXDKDRAWTYPES_H_INCLUDED 1 #line 8 "WxdkdrawTypes.cpt" /** @file WxdkdrawTypes.h Data types for the wxd2lat program. Here we have Wxd_... structures corresponding to the wxd_... structures from the wxd2lat/wxdtypes.h file. */ #ifndef DK4CONF_H_INCLUDED #include "dk4conf.h" #endif #ifndef DK4TYPES_H_INCLUDED #include "dk4types.h" #endif #ifndef DK4BB_H_INCLUDED #include "dk4bb.h" #endif #if (DK4_HAVE_WXWIDGETS) && (defined(__cplusplus)) #ifndef WX_WXPREC_H_INCLUDED #include #define WX_WXPREC_H_INCLUDED 1 #endif #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #if DK4_HAVE_WX_CHARTYPE_H #ifndef WX_CHARTYPE_H_INCLUDED #include #define WX_CHARTYPE_H_INCLUDED 1 #endif #else #if DK4_HAVE_WX_WXCHAR_H #ifndef WX_WXCHAR_H_INCLUDED #include #define WX_WXCHAR_H_INCLUDED 1 #endif #else #ifndef WX_WX_H_INCLUDED #include #define WX_WX_H_INCLUDED #endif #endif #endif #endif #ifndef WX_BITMAP_H_INCLUDED #include #define WX_BITMAP_H_INCLUDED 1 #endif #ifndef DK4STO_H_INCLUDED #include "dk4sto.h" #endif /** Marker 1: Mouse moved over object or object selected for copy/move/delete. Indicated by coloured markup. */ #define OBJ_MARKER_1 ((uint8_t)1U) /** Marker 2: Object selected for grouping or style editing. Indicated by black markup. */ #define OBJ_MARKER_2 ((uint8_t)2U) /** WXD font description. */ typedef struct { wxFont *font; /**< Font to be used for drawing. */ uint16_t fsz; /**< Font size in pt. */ uint8_t find; /**< Font index. */ bool used; /**< Font is used by drawing. */ bool attempted; /**< Already attempted to find font. */ } Wxd_font_t; /** Association of file name suffix and image type. */ typedef struct { wxChar const *suffix; /**< File name suffix. */ wxBitmapType t; /**< Corresponding image type. */ } Wxd_suffix_and_type_t; /** Polygon or polyline point. */ typedef struct { int32_t x; /**< X position. */ int32_t y; /**< Y position. */ } Wxd_point_t; /** X-Spline point. */ typedef struct { double s; /**< S parameter. */ int32_t x; /**< X position. */ int32_t y; /**< Y position. */ } Wxd_spline_point_t; /** Bounding box values. */ typedef struct { int32_t xl; /**< Left x. */ int32_t xr; /**< Right x. */ int32_t yb; /**< Bottom y. */ int32_t yt; /**< Top y. */ } Wxd_bb_t; #define WXD_TEXT_FLAG_NONE ((uint8_t)0U) #define WXD_TEXT_FLAG_LATEX ((uint8_t)1U) #define WXD_TEXT_ALIGN_LEFT ((uint8_t)0U) #define WXD_TEXT_ALIGN_CENTERED ((uint8_t)1U) #define WXD_TEXT_ALIGN_RIGHT ((uint8_t)2U) /** Details for a text. The 4 most significant bits in al represent the vertical text alignment, the 4 least significant bits represent the horizontal alignment. */ typedef struct { wxChar *t; /**< Text to export. */ wxChar *tsc; /**< Text to show on screen. */ Wxd_font_t *font; /**< WXD font structure. */ int32_t x; /**< X position. */ int32_t y; /**< Y position. */ uint16_t fsz; /**< Font size. */ int16_t a; /**< Rotation counterclockwise in degree. */ uint8_t find; /**< Font index. */ uint8_t al; /**< Horizontal and vertical align. */ uint8_t fl; /**< Text flags. */ } Wxd_det_text_t; /** Polygon and polyline details. */ typedef struct { Wxd_point_t *p; /**< Points. */ uint16_t n; /**< Number of points. */ } Wxd_det_pl_t; /** X-Spline details (opened and closed). */ typedef struct { Wxd_spline_point_t *p; /**< Points. */ uint16_t n; /**< Number of points. */ } Wxd_det_xs_t; #define WXD_ARC_DIRECTION_POSITIVE ((int8_t)1) #define WXD_ARC_DIRECTION_NEGATIVE ((int8_t)-1) #define WXD_ARC_DIRECTION_UNKNOWN ((int8_t)0) /** Details for arcs (opened and closed). The x1, y1, x2, y2, x3, y3 components are read from file, the other values are calculated from the 3 points after reading the file and after each point modification. */ typedef struct { double a; /**< Start angle alpha counterclockwise in degree. */ double b; /**< Angle range beta counterclockwise in degree. */ double x; /**< X position of center point. */ double y; /**< Y position of center point. */ double r; /**< Radius. */ int32_t x1; /**< X position of point 1. */ int32_t y1; /**< Y position of point 1. */ int32_t x2; /**< X position of point 2. */ int32_t y2; /**< Y position of point 2. */ int32_t x3; /**< X position of point 3. */ int32_t y3; /**< Y position of point 3. */ int8_t d; /**< Direction, 1=positive, -1=negative, 0=unknown. */ } Wxd_det_arc_t; /** Details for dot. */ typedef struct { int32_t x; /**< X position of center point. */ int32_t y; /**< Y position of center point. */ uint16_t d; /**< Diameter in multiples of the base line width. */ } Wxd_det_dot_t; /** Details for an ellipse or circle. For a circle ry and a are ignored. */ typedef struct { int32_t x; /**< X position of center point. */ int32_t y; /**< Y position of center point. */ uint32_t rx; /**< X radius for ellipse, radius for circle. */ uint32_t ry; /**< Y radius for ellipse. */ int16_t a; /**< Rotation counterclockwise in degree. */ } Wxd_det_ellipse_t; /** Radius value to indicate corner is not rounded. */ #define WXD_BOX_CORNER_NONE ((uint32_t)0UL) /** Details for a box. */ typedef struct { Wxd_bb_t b; /**< Box rectangle. */ uint32_t r; /**< Corner radius, 0 for no rounded corner. */ } Wxd_det_box_t; /** Details for an embedded image. */ typedef struct { wxChar *fn; /**< File name for image. */ wxBitmap *bm; /**< Bitmap to draw on screen. */ dk4_bb_t pl; /**< Calculated coordinates for placement. */ Wxd_bb_t br; /**< Box rectangle from file. */ double xres; /**< Image x resolution. */ double yres; /**< Image y resolution. */ uint16_t fl; /**< Image flags. */ int8_t r2g; /**< RGB to gray conversion method. */ int8_t r2c; /**< RGB to CMYK conversion method (unused). */ wxBitmapType t; /**< Bitmap type. */ } Wxd_det_image_t; /** Details for a group of objects. */ typedef struct Wxd_det_group__t { dk4_sto_t *s_e; /**< Elements storage. */ dk4_sto_it_t *i_e; /**< Elements iterator. */ } Wxd_det_group_t; /** Union of different details. */ typedef union { Wxd_det_text_t t; /**< Text details. */ Wxd_det_pl_t p; /**< Polygon and polyline details. */ Wxd_det_xs_t s; /**< Spline details. */ Wxd_det_arc_t a; /**< Arc and circle details. */ Wxd_det_dot_t d; /**< Details for a dot. */ Wxd_det_ellipse_t e; /**< Ellipse details. */ Wxd_det_box_t b; /**< Box details. */ Wxd_det_image_t i; /**< Image details. */ Wxd_det_group_t g; /**< Group details. */ } Wxd_det_t; /** Stipple bitmap (fill pattern). */ typedef struct Wxd__stipple__t { uint8_t cd[8]; /**< Color data. */ wxBitmap *bm; /**< Stipple bit map. */ } Wxd_stipple_t; /* The color data array cd contains the following data: 0 fill style (pattern number) 1 fill red 2 fill green 3 fill blue 4 stroke red 5 stroke green 6 stroke blue 7 Flag: Stipple is in use */ /** Information about a layer. */ typedef struct Wxd__layer__t { int16_t lay; /**< Layer number. */ uint8_t active; /**< Flag: Layer is active. */ uint8_t used; /**< Flag: Layer is used. */ } Wxd_layer_t; /** One drawing element. The forward arrow and backward arrow components are ignored for closed objects. */ typedef struct Wxd__object__t { Wxd_det_t det; /**< Graphics element details. */ dk4_bb_t bb; /**< Object bounding box. */ struct Wxd__object__t *pa; /**< Parent group. */ Wxd_stipple_t *psti; /**< Stipple for some fill patterns. */ Wxd_layer_t *play; /**< Layer management information. */ int16_t lay; /**< Layer number. */ uint16_t lw; /**< Line width, multiples of base width. */ uint8_t fc[3]; /**< Fill color. */ uint8_t sc[3]; /**< Stroke and text color. */ uint8_t cs; /**< Cap style. */ uint8_t fs; /**< Fill style. */ uint8_t ls; /**< Line style. */ uint8_t sl; /**< Style length. */ uint8_t js; /**< Line join style. */ uint8_t ml; /**< Miter limit for mitered line join. */ uint8_t aft; /**< Arrowhead forward type. */ uint8_t afl; /**< Length of arrowhead forward. */ uint8_t afw; /**< Width of arrowhead forward. */ uint8_t abt; /**< Arrowhead backward type. */ uint8_t abl; /**< Length of arrowhead backward. */ uint8_t abw; /**< Width of arrowhead backward. */ uint8_t mark; /**< Markers or-combined. */ int8_t ot; /**< Object type. */ } Wxd_object_t; /** Entire drawing. The flattened container contains all objects of the drawing without any group structure. Elements are sorted by layer number. A second container s_stru contains the group structure. */ typedef struct { dk4_sto_t *s_stru; /**< Structured container of all objects. */ dk4_sto_it_t *i_stru; /**< Iterator for structured container. */ dk4_sto_t *s_flat; /**< Flattened container of all objects. */ dk4_sto_it_t *i_flat; /**< Iterator for flattened container. */ dk4_sto_t *s_stip; /**< Stipples container. */ dk4_sto_it_t *i_stip; /**< Stipples iterator. */ dk4_sto_t *s_layers; /**< Layer management storage. */ dk4_sto_it_t *i_layers; /**< Layer management iterator. */ dk4_sto_t *s_fonts; /**< Fonts storage. */ dk4_sto_it_t *i_fonts; /**< Fonts storage iterator. */ Wxd_bb_t bb; /**< Bounding box. */ size_t xsubs; /**< Sub segments per X-spline segment. */ int32_t cx; /**< X coordinate in center of control. */ int32_t cy; /**< Y coordinate in center of control. */ uint32_t baselw; /**< Base line width in wxd units. */ uint32_t bleft; /**< Left border. */ uint32_t bright; /**< Right border. */ uint32_t bbottom; /**< Bottom border. */ uint32_t btop; /**< Top border. */ int redraw; /**< Required redraw level. */ uint16_t fv_maj; /**< Format version major number. */ uint16_t fv_min; /**< Format version minor number. */ int8_t zl; /**< Zoom level. */ uint8_t gridunit; /**< Grid unit (0=inch, 1=cm). */ uint8_t gridbase; /**< Grid base (0=powers of 2, 1=of 10). */ } Wxd_drawing_t; /** Error codes for reader module. */ enum { WXDRD_E_NONE = 0, /**< No error occured. */ WXDRD_E_MEMORY , /**< Not enough memory. */ WXDRD_E_TEXT_PARTS , /**< Expected number of texts ot found. */ WXDRD_E_NUM_CONV , /**< Conversion of text to number failed. */ WXDRD_E_RECODE_TEXT , /**< Recoding failed for text label. */ WXDRD_E_RECODE_FILENAME , /**< Recoding failed for file name. */ WXDRD_E_INVALID_ARGS , /**< Invalid function arguments. */ WXDRD_E_NO_VERSION , /**< File format information not found. */ WXDRD_E_NO_BB , /**< No bounding box information found. */ WXDRD_E_NO_WXD , /**< Not a WXD file. */ WXDRD_E_WRONG_VERSION , /**< File format too new. */ WXDRD_E_EXPECTED_OBJSTART , /**< Object start line expected. */ WXDRD_E_EXPECTED_DETAILS , /**< Details line expected. */ WXDRD_E_READER_STATE , /**< Wrong reader state. */ WXDRD_E_OBJTYPE , /**< Illegal object or subobject type. */ WXDRD_E_COORD_OVERFLOW , /**< Mathematical overflow in coordinates. */ WXDRD_E_NO_GROUP_TO_END , /**< No open group to end. */ WXDRD_E_TOO_FEW_POINTS , /**< Too few points. */ WXDRD_E_EMPTY_FILENAME , /**< Empty image file name. */ WXDRD_E_FILENAME_TOO_LONG , /**< Image file name too long. */ WXDRD_E_BOX_NO_AREA , /**< Box does not span an area. */ }; /** Reader status. */ typedef struct { Wxd_bb_t bb; /**< Drawing bounding box. */ wxChar *dirn; /**< Directory file resides in. */ unsigned long ln; /**< Line number error occured in. */ size_t te; /**< Number of text element not convertable. */ int ec; /**< Error code from module. */ int wxe; /**< Encoding used for wxChar. */ int mod; /**< Flag: Modified by corrections. */ } wxdrd_status_t; /** Errors occuring in write operations. */ enum { WXDWR_E_NONE = 0, /**< No error occured. */ WXDWR_E_WRITE , /**< Error in write operation. */ WXDWR_E_STRING_TOO_LONG , /**< String is too long. */ WXDWR_E_RECODE_TEXT , /**< Failed to recode a text. */ WXDWR_E_RECODE_FILENAME , /**< Failed to recode a file name. */ WXDWR_E_STRING_EMPTY , /**< Empty string. */ }; /** Writer status. */ typedef struct { int ec; /**< Error code. */ int wxe; /**< Encoding used for wxChar strings. */ wxChar *str; /**< String for which conversion failed. */ wxChar *dirn; /**< Directory name for output file. */ } wxdwr_status_t; #endif /* if (DK4_HAVE_WXWIDGETS) && (defined(__cplusplus)) */ /* vim: set ai sw=4 ts=4 : */ #endif