//------------------------------------------------------------------------------------------------------
// Name       : toso40.h
//
// Purpose    : Prototypes and definitions of the TommySoftware Open Software Interface Version 4.0.
//              All prototypes and definitions stated in this file are subject to change without notice.
//              Errors excepted. Be sure to check the interface's version (as passed to TosoModuleInit)
//              before accessing ANY of the interface procedures!
//
//              Modules using this interface may be distributed without any license fee. If you would
//              like to offer your module in a bundle including the serving application, please contact
//              TommySoftware at one of the addresses stated below:
//
//                      TommySoftware,                 TommySoftware
//                      North America, Inc.             Deutschland
//                      648 Ashbury Street              Selchower Strasse 32
//                      San Franciso, CA 94117          D-12049 Berlin
//                      U.S.A.                          Germany
//
//                      Phone (415) 522 0612            Phone +49 30 621 5931
//                      Fax   (415) 522 0287            Fax   +49 30 621 4064
//
//                      CompuServe GO TOSOENG           CompuServe GO TOSOGER
//
//                      Internet
//                      sales@tommysoftware.com         (Sales)
//                      support@tommysoftware.com       (Technical Support)
//                      http://www.tommysoftware.com    (World Wide Web)
//
//              For further information on how to create modules based on the TommySoftware Open
//              Software Interface Version 4.0, see the interface documentation in the file TOSO40.HLP
//              which is included in all applications supporting this interface.
//
// Date       : 31.05.1996     Author : SM / OK      System : Win32
//------------------------------------------------------------------------------------------------------

#define TOSO_INTERFACE_VERSION  400             // Current version of Toso Interface

//------------------------------------------------------------------------------------------------------

#define DLL_EXPORT      __declspec( dllexport )
#define DLL_IMPORT      __declspec( dllimport )

//------ Dialog Control Messages -----------------------------------------------------------------------

#define Dialog_SetDefID(hwndCtl, id)            ((void) SendMessage((hwndCtl), DM_SETDEFID, (WPARAM) (id), 0L ))
#define Edit_SendChar(hwndCtl, ch)              ((void) SendMessage((hwndCtl), WM_CHAR, (WPARAM) ((int) (ch) & 0xff), 0L ))
#define Control_SetFont(hwndCtl, hFont)         ((void) SendMessage((hwndCtl), WM_SETFONT, (WPARAM) (hFont), 0L ))
#define ComboBox_GetSelFieldHeight(hwndCtl)     ((int) (DWORD) SendMessage((hwndCtl), CB_GETITEMHEIGHT, (WPARAM) (int) -1, 0L ))

//------ Message Crackers ------------------------------------------------------------------------------

#define GET_WM_ACTIVATEAPP_ACTIVE(wp,lp)        (BOOL)(wp)
#define GET_WM_ACTIVATEAPP_TASK(wp,lp)          (DWORD)(lp)

#define GET_WM_DROPFILES_HANDLE(wp,lp)          (HANDLE)(wp)

#define GET_WM_ENTERIDLE_SOURCE(wp,lp)          (wp)
#define GET_WM_ENTERIDLE_HWND(wp,lp)            (HWND)(lp)

#define GET_WM_INITMENU_HMENU(wp,lp)            (HMENU)(wp)

#define GET_WM_KEY_VKEY(wp,lp)                  (int)(wp)
#define GET_WM_KEY_DATA(wp,lp)                  (lp)
#define GET_WM_KEY_MPS(vkey,data)               (WPARAM)(vkey),(LPARAM)(data)

#define GET_WM_MOUSE_BUTTONS(wp,lp)             (wp)
#define GET_WM_MOUSE_XPOS(wp,lp)                (int)LOWORD(lp)
#define GET_WM_MOUSE_YPOS(wp,lp)                (int)HIWORD(lp)
#define GET_WM_MOUSE_MPS(button,xp,yp)          (WPARAM)(button),(LPARAM)MAKELONG(xp,yp)

#define GET_WM_SETCURSOR_HWND(wp,lp)            (HWND)(wp)
#define GET_WM_SETCURSOR_HITTEST(wp,lp)         LOWORD(lp)
#define GET_WM_SETCURSOR_MSG(wp,lp)             HIWORD(lp)

#define GET_WM_WINDOWPOSCHANGING_PTR(wp,lp)     (LPWINDOWPOS)(lp)
#define GET_WM_GETMINMAXINFO_PTR(wp,lp)         (LPMINMAXINFO)(lp)
#define GET_WM_PALETTECHANGED_HWND(wp,lp)       (HWND)(wp)

//------ System-independent Macros ---------------------------------------------------------------------

#define round(a)                (int) ( floor( (a) + 0.5 ) )    // Rounding of a DOUBLE value
#define fixed(a)                (( (a).value < 0 ) ?                                    \
                                 ( (double) (a).value - (double) (a).fract / 65536.0 ): \
                                 ( (double) (a).value + (double) (a).fract / 65536.0 ))
#define lstrclr(a)              (a)[0] = '\0'                   // Erasing a string

#define int_loword(a)           (int) ( (a) & 0xffff )
#define int_hiword(a)           (int) ( ( (a) >> 16 ) & 0xffff )
#define int_makelong(a,b)       (int) ( ( ( (b) & 0xffff ) << 16 ) | ( (a) & 0xffff ) )

//------ Matrix Handling -------------------------------------------------------------------------------

#define mat_x(m,x,y)            ( (m)->m11 * (x) + (m)->m21 * (y) + (m)->m31 )
#define mat_y(m,x,y)            ( (m)->m12 * (x) + (m)->m22 * (y) + (m)->m32 )
#define mat_dx(m,x,y)           ( (m)->m11 * (x) + (m)->m21 * (y) )
#define mat_dy(m,x,y)           ( (m)->m12 * (x) + (m)->m22 * (y) )
#define mat_sx(m,x)             ( (m)->m11 * (x) + (m)->m31 )
#define mat_sy(m,y)             ( (m)->m22 * (y) + (m)->m32 )

//------ Data Block Handling ---------------------------------------------------------------------------

#define db_alignsize(s)         ( ( (s) + 7 ) & (~7) )
#define db_textsize(t)          ( ( lstrlen( t ) + 8 ) & (~7) )

#define DB_SIZE_POINT           ( db_alignsize( sizeof( BLOCK_POINT ) + sizeof( DPOINT ) ) )
#define DB_SIZE_CONSTANT        ( db_alignsize( sizeof( BLOCK_DOUBLE ) + sizeof( double ) ) )
#define DB_SIZE_ARC             ( db_alignsize( sizeof( BLOCK_DOUBLE ) + sizeof( double ) ) )
#define DB_SIZE_CURVE           ( db_alignsize( sizeof( BLOCK_DOUBLE ) + sizeof( double ) + sizeof( double ) ) )
#define DB_SIZE_TEXT            ( db_alignsize( sizeof( BLOCK_TEXT ) ) )
#define DB_SIZE_END             ( db_alignsize( sizeof( BLOCK_ANY ) ) )
#define DB_SIZE_ANY             ( db_alignsize( sizeof( BLOCK_ANY ) ) )

#define db_offset(b,x)          ( (BLOCK_PTR) ( (b)->Data + (x) ) )
#define db_first(b)             ( (BLOCK_PTR) ( (b)->Data ) )
#define db_next(b)              ( (BLOCK_PTR) ( (LPBYTE) (b) + (b)->Header.Size ) )
#define db_difference(b,p)      ( (OFFSET) ( (BYTE*) (p) - (BYTE*) ( (b)->Data ) ) )

#define db_point(b)             ( ( (BLOCK_POINT_PTR)  (b) )->Data[0] )
#define db_constant(b)          ( ( (BLOCK_DOUBLE_PTR) (b) )->Data[0] )
#define db_orient(b)            ( ( (BLOCK_DOUBLE_PTR) (b) )->Data[0] )
#define db_curve(b)             ( ( (BLOCK_DOUBLE_PTR) (b) )->Data[1] )
#define db_attribute_name(b)    ( ( (BLOCK_ATTRIBUTE_PTR) (b) )->Name )
#define db_attribute_text(b)    ( ( (BLOCK_ATTRIBUTE_PTR) (b) )->Text )

#define db_data_long(b)         ( ( (BLOCK_LONG_PTR)          (b) )->Data )
#define db_data_double(b)       ( ( (BLOCK_DOUBLE_PTR)        (b) )->Data )
#define db_data_point(b)        ( ( (BLOCK_POINT_PTR)         (b) )->Data )
#define db_data_colorref(b)     ( ( (BLOCK_COLORREF_PTR)      (b) )->Data )
#define db_data_property(b)     ( ( (BLOCK_PROPERTY_PTR)      (b) )->Data )
#define db_data_xproperty(b)    ( ( (BLOCK_XPROPERTY_PTR)     (b) )->Data )
#define db_data_fontdef(b)      ( ( (BLOCK_FONTDEF_PTR)       (b) )->Data )
#define db_data_text(b)         ( ( (BLOCK_TEXT_PTR)          (b) )->Text )
#define db_data_binary(b)       ( ( (BLOCK_BINARY_PTR)        (b) )->Data )

#define db_data_dimline(b)      ( ( (BLOCK_DIMLINE_PTR)       (b) )->Data )
#define db_data_dimlarge(b)     ( ( (BLOCK_DIMLARGE_PTR)      (b) )->Data )
#define db_data_dimsmall(b)     ( ( (BLOCK_DIMSMALL_PTR)      (b) )->Data )
#define db_data_textstandard(b) ( ( (BLOCK_TEXTSTANDARD_PTR)  (b) )->Data )
#define db_data_textframe(b)    ( ( (BLOCK_TEXTFRAME_PTR)     (b) )->Data )
#define db_data_textreference(b)( ( (BLOCK_TEXTREFERENCE_PTR) (b) )->Data )
#define db_data_clipsurface(b)  ( ( (BLOCK_CLIPSURFACE_PTR)   (b) )->Data )
#define db_data_bitmapref(b)    ( ( (BLOCK_BITMAPREF_PTR)     (b) )->Data )

#if TOSO_SERVER

#define db_init_punkt(b,t)      inline_db_init_punkt    ( (BLOCK_PTR) (b), (short) (t) )
#define db_init_constant(b)     inline_db_init_constant ( (BLOCK_PTR) (b) )
#define db_init_arc(b)          inline_db_init_arc      ( (BLOCK_PTR) (b) )
#define db_init_curve(b)        inline_db_init_curve    ( (BLOCK_PTR) (b) )
#define db_init_text(b,c)       inline_db_init_text     ( (BLOCK_PTR) (b), (short) (c) )
#define db_init_end(b)          inline_db_init_end      ( (BLOCK_PTR) (b) )
#define db_init_attribute(b,t)  inline_db_init_attribute( (BLOCK_PTR) (b), (short) (t) )
#define db_init_any(b,t)        inline_db_init_any      ( (BLOCK_PTR) (b), (short) (t) )

#else

#define db_init_punkt(b,t)      {                                                                       \
                                  ((BLOCK_PTR)(b))->Header.Size  = DB_SIZE_POINT;                       \
                                  ((BLOCK_PTR)(b))->Header.Ident = ((BLOCK_PTR)(b))->Header.Flag = 0;   \
                                  ((BLOCK_PTR)(b))->Header.BlockOwner = 0;                              \
                                  ((BLOCK_PTR)(b))->Header.BlockType  = ((short) (t));                  \
                                  ((BLOCK_PTR)(b))->Header.ElemType   = DB_TYPE_POINT;                  \
                                  ((BLOCK_PTR)(b))->Header.ElemCount  = 1;                              \
                                }

#define db_init_constant(b)     {                                                                       \
                                  ((BLOCK_PTR)(b))->Header.Size  = DB_SIZE_CONSTANT;                    \
                                  ((BLOCK_PTR)(b))->Header.Ident = ((BLOCK_PTR)(b))->Header.Flag = 0;   \
                                  ((BLOCK_PTR)(b))->Header.BlockOwner = 0;                              \
                                  ((BLOCK_PTR)(b))->Header.BlockType  = DB_ALL_CONSTANT;                \
                                  ((BLOCK_PTR)(b))->Header.ElemType   = DB_TYPE_DOUBLE;                 \
                                  ((BLOCK_PTR)(b))->Header.ElemCount  = 1;                              \
                                }

#define db_init_arc(b)          {                                                                       \
                                  ((BLOCK_PTR)(b))->Header.Size  = DB_SIZE_ARC;                         \
                                  ((BLOCK_PTR)(b))->Header.Ident = ((BLOCK_PTR)(b))->Header.Flag = 0;   \
                                  ((BLOCK_PTR)(b))->Header.BlockOwner = 0;                              \
                                  ((BLOCK_PTR)(b))->Header.BlockType  = DB_ALL_ARC;                     \
                                  ((BLOCK_PTR)(b))->Header.ElemType   = DB_TYPE_DOUBLE;                 \
                                  ((BLOCK_PTR)(b))->Header.ElemCount  = 1;                              \
                                }

#define db_init_curve(b)        {                                                                       \
                                  ((BLOCK_PTR)(b))->Header.Size  = DB_SIZE_CURVE;                       \
                                  ((BLOCK_PTR)(b))->Header.Ident = ((BLOCK_PTR)(b))->Header.Flag = 0;   \
                                  ((BLOCK_PTR)(b))->Header.BlockOwner = 0;                              \
                                  ((BLOCK_PTR)(b))->Header.BlockType  = DB_ALL_CURVE;                   \
                                  ((BLOCK_PTR)(b))->Header.ElemType   = DB_TYPE_DOUBLE;                 \
                                  ((BLOCK_PTR)(b))->Header.ElemCount  = 2;                              \
                                }

#define db_init_text(b,c)       {                                                                       \
                                  ((BLOCK_PTR)(b))->Header.Size  = db_alignsize( DB_SIZE_TEXT + abs( (short) (c) ) );   \
                                  ((BLOCK_PTR)(b))->Header.Ident = ((BLOCK_PTR)(b))->Header.Flag = 0;   \
                                  ((BLOCK_PTR)(b))->Header.BlockOwner = 0;                              \
                                  ((BLOCK_PTR)(b))->Header.BlockType  = DB_ALL_TEXT;                    \
                                  ((BLOCK_PTR)(b))->Header.ElemType   = DB_TYPE_TEXT;                   \
                                  ((BLOCK_PTR)(b))->Header.ElemCount  = (short) (c);                    \
                                }

#define db_init_end(b)          {                                                                       \
                                  ((BLOCK_PTR)(b))->Header.Size  = DB_SIZE_END;                         \
                                  ((BLOCK_PTR)(b))->Header.Ident = ((BLOCK_PTR)(b))->Header.Flag = 0;   \
                                  ((BLOCK_PTR)(b))->Header.BlockOwner = 0;                              \
                                  ((BLOCK_PTR)(b))->Header.BlockType  = DB_END;                         \
                                  ((BLOCK_PTR)(b))->Header.ElemType   = DB_TYPE_NATIVE;                 \
                                  ((BLOCK_PTR)(b))->Header.ElemCount  = 0;                              \
                                }

#define db_init_attribute(b,t)  {                                                                       \
                                  ((BLOCK_PTR)(b))->Header.Size  = db_alignsize( sizeof( BLOCK_ATTRIBUTE ) + NAME_LENGTH_TEXTSHORT );   \
                                  ((BLOCK_PTR)(b))->Header.Ident = ((BLOCK_PTR)(b))->Header.Flag = 0;   \
                                  ((BLOCK_PTR)(b))->Header.BlockOwner = 0;                              \
                                  ((BLOCK_PTR)(b))->Header.BlockType  = (short) (t);                    \
                                  ((BLOCK_PTR)(b))->Header.ElemType   = DB_TYPE_NATIVE;                 \
                                  ((BLOCK_PTR)(b))->Header.ElemCount  = NAME_LENGTH_TEXTSHORT;          \
                                }

#define db_init_any(b,t)        {                                                                       \
                                  ((BLOCK_PTR)(b))->Header.Size  = DB_SIZE_ANY;                         \
                                  ((BLOCK_PTR)(b))->Header.Ident = ((BLOCK_PTR)(b))->Header.Flag = 0;   \
                                  ((BLOCK_PTR)(b))->Header.BlockOwner = 0;                              \
                                  ((BLOCK_PTR)(b))->Header.BlockType  = (short) (t);                    \
                                  ((BLOCK_PTR)(b))->Header.ElemType   = DB_TYPE_NATIVE;                 \
                                  ((BLOCK_PTR)(b))->Header.ElemCount  = 0;                              \
                                }

#endif

//------ Determination of Standard Data Block Pointers for Complex Objects -----------------------------

#define DB_PTR_DECLARATION      BLOCK_PTR               b1 = NULL,      \
                                                        b2 = NULL,      \
                                                        b3 = NULL,      \
                                                        b4 = NULL,      \
                                                        b5 = NULL,      \
                                                        b6 = NULL,      \
                                                        b7 = NULL,      \
                                                        b8 = NULL,      \
                                                        b999 = NULL;    \
                                BLOCK_TEXT_PTR          a110 = NULL,    \
                                                        b110 = NULL,    \
                                                        c110 = NULL,    \
                                                        d110 = NULL,    \
                                                        e110 = NULL,    \
                                                        f110 = NULL,    \
                                                        g110 = NULL;    \
                                BLOCK_DIMLINE_PTR       b220 = NULL;    \
                                BLOCK_DIMLARGE_PTR      b225 = NULL;    \
                                BLOCK_DIMSMALL_PTR      b230 = NULL;    \
                                BLOCK_TEXTSTANDARD_PTR  b235 = NULL;    \
                                BLOCK_TEXTFRAME_PTR     b236 = NULL;    \
                                BLOCK_TEXTREFERENCE_PTR b237 = NULL;    \
                                BLOCK_CLIPSURFACE_PTR   b242 = NULL;    \
                                BLOCK_BITMAPREF_PTR     b243 = NULL;    \
                                BLOCK_T001_PTR          t001 = NULL;    \
                                BLOCK_T002_PTR          t002 = NULL;    \
                                BLOCK_T003_PTR          t003 = NULL;    \
                                BLOCK_T004_PTR          t004 = NULL;    \
                                BLOCK_T005_PTR          t005 = NULL;    \
                                BLOCK_T006_PTR          t006 = NULL;    \
                                BLOCK_T007_PTR          t007 = NULL;    \
                                BLOCK_T008_PTR          t008 = NULL;

#define db_ptr_dline(p)         {                                               \
                                  b1   = db_first( p );                         \
                                  b2   = db_next( b1 );                         \
                                  b220 = (BLOCK_DIMLINE_PTR) db_next( b2 );     \
                                  t003 = (BLOCK_T003_PTR) db_next( b220 );      \
                                }

#define db_ptr_darc(p)          {                                               \
                                  b1   = db_first( p );                         \
                                  b2   = db_next( b1 );                         \
                                  b3   = db_next( b2 );                         \
                                  b4   = db_next( b3 );                         \
                                  b5   = db_next( b4 );                         \
                                  b220 = (BLOCK_DIMLINE_PTR) db_next( b5 );     \
                                  t004 = (BLOCK_T004_PTR) db_next( b220 );      \
                                }

#define db_ptr_ddistance(p)     {                                               \
                                  b1 = db_first( p );                           \
                                  b2 = db_next( b1 );                           \
                                  b3 = db_next( b2 );                           \
                                  b4 = db_next( b3 );                           \
                                  b5 = db_next( b4 );                           \
                                  b6 = db_next( b5 );                           \
                                  b7 = db_next( b6 );                           \
                                  a110 = (BLOCK_TEXT_PTR) db_next( b7 );        \
                                  b110 = (BLOCK_TEXT_PTR) db_next( a110 );      \
                                  c110 = (BLOCK_TEXT_PTR) db_next( b110 );      \
                                  d110 = (BLOCK_TEXT_PTR) db_next( c110 );      \
                                  e110 = (BLOCK_TEXT_PTR) db_next( d110 );      \
                                  b225 = (BLOCK_DIMLARGE_PTR) db_next( e110 );  \
                                  t005 = (BLOCK_T005_PTR) db_next( b225 );      \
                                }

#define db_ptr_dradius(p)       {                                               \
                                  b1 = db_first( p );                           \
                                  b2 = db_next( b1 );                           \
                                  b3 = db_next( b2 );                           \
                                  b4 = db_next( b3 );                           \
                                  b5 = db_next( b4 );                           \
                                  b6 = db_next( b5 );                           \
                                  a110 = (BLOCK_TEXT_PTR) db_next( b6 );        \
                                  b110 = (BLOCK_TEXT_PTR) db_next( a110 );      \
                                  c110 = (BLOCK_TEXT_PTR) db_next( b110 );      \
                                  d110 = (BLOCK_TEXT_PTR) db_next( c110 );      \
                                  e110 = (BLOCK_TEXT_PTR) db_next( d110 );      \
                                  b225 = (BLOCK_DIMLARGE_PTR) db_next( e110 );  \
                                  t005 = (BLOCK_T005_PTR) db_next( b225 );      \
                                }

#define db_ptr_dangle(p)        {                                               \
                                  b1 = db_first( p );                           \
                                  b2 = db_next( b1 );                           \
                                  b3 = db_next( b2 );                           \
                                  b4 = db_next( b3 );                           \
                                  b5 = db_next( b4 );                           \
                                  b6 = db_next( b5 );                           \
                                  b7 = db_next( b6 );                           \
                                  a110 = (BLOCK_TEXT_PTR) db_next( b7 );        \
                                  b110 = (BLOCK_TEXT_PTR) db_next( a110 );      \
                                  c110 = (BLOCK_TEXT_PTR) db_next( b110 );      \
                                  d110 = (BLOCK_TEXT_PTR) db_next( c110 );      \
                                  e110 = (BLOCK_TEXT_PTR) db_next( d110 );      \
                                  b225 = (BLOCK_DIMLARGE_PTR) db_next( e110 );  \
                                  t006 = (BLOCK_T006_PTR) db_next( b225 );      \
                                }

#define db_ptr_darclength(p)    {                                               \
                                  b1 = db_first( p );                           \
                                  b2 = db_next( b1 );                           \
                                  b3 = db_next( b2 );                           \
                                  b4 = db_next( b3 );                           \
                                  b8 = db_next( b4 );                           \
                                  b5 = db_next( b8 );                           \
                                  b6 = db_next( b5 );                           \
                                  b7 = db_next( b6 );                           \
                                  a110 = (BLOCK_TEXT_PTR) db_next( b7 );        \
                                  b110 = (BLOCK_TEXT_PTR) db_next( a110 );      \
                                  c110 = (BLOCK_TEXT_PTR) db_next( b110 );      \
                                  d110 = (BLOCK_TEXT_PTR) db_next( c110 );      \
                                  e110 = (BLOCK_TEXT_PTR) db_next( d110 );      \
                                  b225 = (BLOCK_DIMLARGE_PTR) db_next( e110 );  \
                                  t006 = (BLOCK_T006_PTR) db_next( b225 );      \
                                }

#define db_ptr_dcoordinate(p)   {                                               \
                                  b1 = db_first( p );                           \
                                  b2 = db_next( b1 );                           \
                                  b3 = db_next( b2 );                           \
                                  a110 = (BLOCK_TEXT_PTR) db_next( b3 );        \
                                  b110 = (BLOCK_TEXT_PTR) db_next( a110 );      \
                                  c110 = (BLOCK_TEXT_PTR) db_next( b110 );      \
                                  d110 = (BLOCK_TEXT_PTR) db_next( c110 );      \
                                  e110 = (BLOCK_TEXT_PTR) db_next( d110 );      \
                                  f110 = (BLOCK_TEXT_PTR) db_next( e110 );      \
                                  g110 = (BLOCK_TEXT_PTR) db_next( f110 );      \
                                  b230 = (BLOCK_DIMSMALL_PTR) db_next( g110 );  \
                                  t007 = (BLOCK_T007_PTR) db_next( b230 );      \
                                }

#define db_ptr_darea(p)         {                                               \
                                  b1 = db_first( p );                           \
                                  b2 = db_next( b1 );                           \
                                  b3 = db_next( b2 );                           \
                                  a110 = (BLOCK_TEXT_PTR) db_next( b3 );        \
                                  b110 = (BLOCK_TEXT_PTR) db_next( a110 );      \
                                  c110 = (BLOCK_TEXT_PTR) db_next( b110 );      \
                                  d110 = (BLOCK_TEXT_PTR) db_next( c110 );      \
                                  e110 = (BLOCK_TEXT_PTR) db_next( d110 );      \
                                  b230 = (BLOCK_DIMSMALL_PTR) db_next( e110 );  \
                                  t007 = (BLOCK_T007_PTR) db_next( b230 );      \
                                }

#define db_ptr_textstandard(p)  {                                               \
                                  b110 = (BLOCK_TEXT_PTR) db_first( p );        \
                                  b235 = (BLOCK_TEXTSTANDARD_PTR) db_next( b110 );  \
                                }

#define db_ptr_textframe(p)     {                                               \
                                  b1 = db_first( p );                           \
                                  b2 = db_next( b1 );                           \
                                  b3 = db_next( b2 );                           \
                                  b110 = (BLOCK_TEXT_PTR) db_next( b3 );        \
                                  b236 = (BLOCK_TEXTFRAME_PTR) db_next( b110 ); \
                                }

#define db_ptr_textreference(p) {                                               \
                                  b1   = db_first( p );                         \
                                  b2   = db_next( b1 );                         \
                                  b110 = (BLOCK_TEXT_PTR) db_next( b2 );        \
                                  b235 = (BLOCK_TEXTSTANDARD_PTR) db_next( b110 );  \
                                  b237 = (BLOCK_TEXTREFERENCE_PTR) db_next( b235 ); \
                                  t008 = (BLOCK_T008_PTR) db_next( b237 );      \
                                }

#define db_ptr_comment(p)       {                                               \
                                  b1   = db_first( p );                         \
                                  b2   = db_next( b1 );                         \
                                  b110 = (BLOCK_TEXT_PTR) db_next( b2 );        \
                                }

#define db_ptr_clipsurface(p)   {                                               \
                                  b242 = (BLOCK_CLIPSURFACE_PTR) db_first( p ); \
                                }

#define db_ptr_bitmapref(p)     {                                               \
                                  b243 = (BLOCK_BITMAPREF_PTR) db_first( p );   \
                                }

//------ Command IDs -----------------------------------------------------------------------------------

#define IDM_BASE                        0x0000ffff              // Bits containing the command ID
#define IDM_FLAG                        0x00ff0000              // Bits containing the commang flags

#define IDM_LABEL                       0x00010000              // Flag for a main menu label
#define IDM_ENTRY                       0x00020000              // Flag for a main menu entry
#define IDM_POPUP_LABEL                 0x00040000              // Flag for a submenu label
#define IDM_POPUP_ENTRY                 0x00080000              // Flag for a submenu entry

#define IDM_DEFAULT                     0x01000000              // Flag for a default entry
#define IDM_MODULE                      0x02000000              // Flag for a module insertion point
#define IDM_CUSTOM                      0x04000000              // Flag for a custom menu or menu entry
#define IDM_SEPARATOR                   0x08000000              // Flag for separating line
#define IDM_END                         0x80000000              // Flag for end-of-list

#define IDM_FIRST_ENTRY                 100

#define IDM_FILE_FIRST                  100
#define IDM_FILE_NEW                            100
#define IDM_FILE_OPEN                           101
#define IDM_FILE_SAVE                           102
#define IDM_FILE_SAVE_AS                        103
#define IDM_FILE_LIST                           104
#define IDM_FILE_IMPORT_SUB                     105
#define IDM_FILE_IMPORT_T4G                     106
#define IDM_FILE_IMPORT_EMF                     107
#define IDM_FILE_IMPORT_WMF                     108
#define IDM_FILE_IMPORT_BMP                     109
#define IDM_FILE_IMPORT_BMP_UPDATE              110
#define IDM_FILE_EXPORT_SUB                     111
#define IDM_FILE_EXPORT_T4G                     112
#define IDM_FILE_EXPORT_EMF                     113
#define IDM_FILE_EXPORT_WMF                     114
#define IDM_FILE_EXPORT_BMP                     115
#define IDM_FILE_EXPORT_BMP_AREA                116
#define IDM_FILE_EXTRA_SUB                      117
#define IDM_FILE_EXTRA_ERASE                    118
#define IDM_FILE_EXTRA_SAVE_DUP                 119
#define IDM_FILE_EXTRA_LOAD_DUP                 120
#define IDM_FILE_EXTRA_ARCHIVE                  121
#define IDM_FILE_EXTRA_AUTOSAVE                 122
#define IDM_FILE_PRINT                          123
#define IDM_FILE_PRINT_AREA                     124
#define IDM_FILE_EXIT                           125
#define IDM_FILE_LAST                   126

#define IDM_EDIT_FIRST                  200
#define IDM_EDIT_UNDO                           200
#define IDM_EDIT_REDO                           201
#define IDM_EDIT_UNDO_ERASE                     202
#define IDM_EDIT_CUT                            203
#define IDM_EDIT_COPY                           204
#define IDM_EDIT_PASTE                          205
#define IDM_EDIT_COMMENT_SUB                    206
#define IDM_EDIT_COMMENT                        207
#define IDM_EDIT_COMMENT_PARAM                  208
#define IDM_EDIT_TVG_DETAILS                    209
#define IDM_EDIT_QUEUE                          210
#define IDM_EDIT_LAST                   211

#define IDM_CONFIG_FIRST                300
#define IDM_CONFIG_PAGE_FORMAT                  300
#define IDM_CONFIG_LAYER_SUB                    301
#define IDM_CONFIG_LAYER_LIST                   302
#define IDM_CONFIG_LAYER_EDIT                   303
#define IDM_CONFIG_LAYER_DEFAULT                304
#define IDM_CONFIG_LAYER_RESET                  305
#define IDM_CONFIG_XLAYER_SUB                   306
#define IDM_CONFIG_XLAYER_SELECT                307
#define IDM_CONFIG_XLAYER_EDIT                  308
#define IDM_CONFIG_XLAYER_ASSIGN                309
#define IDM_CONFIG_XLAYER_DISABLE               310
#define IDM_CONFIG_XLAYER_ENABLE                311
#define IDM_CONFIG_XLAYER_FREEZE                312
#define IDM_CONFIG_XLAYER_MELT                  313
#define IDM_CONFIG_XLAYER_IGNORE                314
#define IDM_CONFIG_XLAYER_USE                   315
#define IDM_CONFIG_XLAYER_SHADE                 316
#define IDM_CONFIG_XLAYER_LIGHT                 317
#define IDM_CONFIG_XLAYER_HIDE                  318
#define IDM_CONFIG_XLAYER_CONCENTRATE           319
#define IDM_CONFIG_XLAYER_UNDO                  320
#define IDM_CONFIG_SYSTEM_SUB                   321
#define IDM_CONFIG_SYSTEM_LIST                  322
#define IDM_CONFIG_SYSTEM_EDIT                  323
#define IDM_CONFIG_SYSTEM_ORIGIN                324
#define IDM_CONFIG_SYSTEM_SHOW_DISPLAY          325
#define IDM_CONFIG_SYSTEM_EDIT_DISPLAY          326
#define IDM_CONFIG_SYSTEM_SHOW_POSITION         327
#define IDM_CONFIG_SYSTEM_EDIT_POSITION         328
#define IDM_CONFIG_PEN_SUB                      329
#define IDM_CONFIG_PEN_LIST                     330
#define IDM_CONFIG_PEN_EDIT                     331
#define IDM_CONFIG_PEN_DEFAULT                  332
#define IDM_CONFIG_PEN_LINE                     333
#define IDM_CONFIG_ZOOM_SUB                     334
#define IDM_CONFIG_ZOOM_AREA                    335
#define IDM_CONFIG_ZOOM_OBJECTS                 336
#define IDM_CONFIG_ZOOM_PAGE                    337
#define IDM_CONFIG_ZOOM_ORIGINAL                338
#define IDM_CONFIG_ZOOM_FACTOR                  339
#define IDM_CONFIG_ZOOM_UNDO                    340
#define IDM_CONFIG_ZOOM_PAN                     341
#define IDM_CONFIG_ZOOM_PLUS                    342
#define IDM_CONFIG_ZOOM_MINUS                   343
#define IDM_CONFIG_SAVE_DEFAULT                 344
#define IDM_CONFIG_WINDOW_SUB                   345
#define IDM_CONFIG_WINDOW_ARRANGE               346
#define IDM_CONFIG_WINDOW2                      347
#define IDM_CONFIG_WINDOW3                      348
#define IDM_CONFIG_WINDOW4                      349
#define IDM_CONFIG_WINDOW_VIEW                  350
#define IDM_CONFIG_WINDOW_PANEL                 351
#define IDM_CONFIG_WINDOW_PEN                   352
#define IDM_CONFIG_WINDOW_LAYER                 353
#define IDM_CONFIG_WINDOW_STATUS                354
#define IDM_CONFIG_WINDOW_TOOLBOX               355
#define IDM_CONFIG_WINDOW_PROPERTY              356
#define IDM_CONFIG_WINDOW_BLOCK                 357
#define IDM_CONFIG_WINDOW_GUIDE                 358
#define IDM_CONFIG_PROGSTATUS                   359
#define IDM_CONFIG_PROFILE_SUB                  360
#define IDM_CONFIG_PROFILE_WINDOW               361
#define IDM_CONFIG_PROFILE_GENERAL              362
#define IDM_CONFIG_PROFILE_PATHS                363
#define IDM_CONFIG_PROFILE_LOADSAVE             364
#define IDM_CONFIG_TVI_SUB                      365
#define IDM_CONFIG_TVI_SCREEN                   366
#define IDM_CONFIG_TVI_OUTPUT                   367
#define IDM_CONFIG_TVI_PLOTTER                  368
#define IDM_CONFIG_TVI_ACCURACY                 369
#define IDM_CONFIG_TVI_COLORS                   370
#define IDM_CONFIG_TVI_TIME                     371
#define IDM_CONFIG_TVI_BLOCK                    372
#define IDM_CONFIG_TVI_KEY_CHANGE               373
#define IDM_CONFIG_TVI_KEY_DISPLAY              374
#define IDM_CONFIG_TVI_MOUSE                    375
#define IDM_CONFIG_TVI_LOAD                     376
#define IDM_CONFIG_TVI_SAVE_AS                  377
#define IDM_CONFIG_TVI_DETAILS                  378
#define IDM_CONFIG_TVI_SAVE_DEFAULT             379
#define IDM_CONFIG_TVI_SAVEONEXIT               380
#define IDM_CONFIG_LAST                 381

#define IDM_SHAPE_FIRST                 400
#define IDM_SHAPE_EDIT_PARAM                    400
#define IDM_SHAPE_EDIT_TEXT                     401
#define IDM_SHAPE_ERASE                         402
#define IDM_SHAPE_MODIFY                        403
#define IDM_SHAPE_MOVE_SUB                      404
#define IDM_SHAPE_MOVE_STANDARD                 405
#define IDM_SHAPE_MOVE_PERP                     406
#define IDM_SHAPE_MOVE_PARALLEL                 407
#define IDM_SHAPE_MOVE_RELATIVE                 408
#define IDM_SHAPE_SCALE_SUB                     409
#define IDM_SHAPE_SCALE_FACTOR                  410
#define IDM_SHAPE_SCALE_PROP                    411
#define IDM_SHAPE_SCALE_ANY                     412
#define IDM_SHAPE_SCALE_REFERENCE               413
#define IDM_SHAPE_ROTATE_SUB                    414
#define IDM_SHAPE_ROTATE_CENTER                 415
#define IDM_SHAPE_ROTATE_ANY                    416
#define IDM_SHAPE_ROTATE_REFERENCE              417
#define IDM_SHAPE_REFLECT_SUB                   418
#define IDM_SHAPE_REFLECT_H                     419
#define IDM_SHAPE_REFLECT_V                     420
#define IDM_SHAPE_REFLECT_LINE                  421
#define IDM_SHAPE_DISTORT_SUB                   422
#define IDM_SHAPE_DISTORT_H                     423
#define IDM_SHAPE_DISTORT_V                     424
#define IDM_SHAPE_ALIGN_SUB                     425
#define IDM_SHAPE_ALIGN_C_PAGE_H                426
#define IDM_SHAPE_ALIGN_C_PAGE_V                427
#define IDM_SHAPE_ALIGN_C_PAGE_BOTH             428
#define IDM_SHAPE_ALIGN_C_RECT_H                429
#define IDM_SHAPE_ALIGN_C_RECT_V                430
#define IDM_SHAPE_ALIGN_C_RECT_BOTH             431
#define IDM_SHAPE_ALIGN_H_LEFT                  432
#define IDM_SHAPE_ALIGN_H_CENTER                433
#define IDM_SHAPE_ALIGN_H_RIGHT                 434
#define IDM_SHAPE_ALIGN_V_TOP                   435
#define IDM_SHAPE_ALIGN_V_CENTER                436
#define IDM_SHAPE_ALIGN_V_BOTTOM                437
#define IDM_SHAPE_PMOVE_SINGLE                  438
#define IDM_SHAPE_PMOVE_SUB                     439
#define IDM_SHAPE_PMOVE_STANDARD                440
#define IDM_SHAPE_PMOVE_PERP                    441
#define IDM_SHAPE_PMOVE_PARALLEL                442
#define IDM_SHAPE_PMOVE_RELATIVE                443
#define IDM_SHAPE_GROUP_SUB                     444
#define IDM_SHAPE_GROUP_LINK                    445
#define IDM_SHAPE_GROUP_UNLINK                  446
#define IDM_SHAPE_ORDER_SUB                     447
#define IDM_SHAPE_ORDER_BACK                    448
#define IDM_SHAPE_ORDER_BEHIND                  449
#define IDM_SHAPE_ORDER_BEFORE                  450
#define IDM_SHAPE_ORDER_FRONT                   451
#define IDM_SHAPE_LAST                  452

#define IDM_DRAW_FIRST                  500
#define IDM_DRAW_LINE_SUB                       500
#define IDM_DRAW_LINE_STANDARD                  501
#define IDM_DRAW_LINE_LINE                      502
#define IDM_DRAW_LINE_H                         503
#define IDM_DRAW_LINE_V                         504
#define IDM_DRAW_LINE_MIDPERP                   505
#define IDM_DRAW_LINE_PERP                      506
#define IDM_DRAW_LINE_PARALLEL                  507
#define IDM_DRAW_LINE_PARALLEL_NUM              508
#define IDM_DRAW_LINE_ANGLE                     509
#define IDM_DRAW_LINE_BISECTOR                  510
#define IDM_DRAW_LINE_CROSS                     511
#define IDM_DRAW_LINE_POLY                      512
#define IDM_DRAW_LINE_DISTANT                   513
#define IDM_DRAW_LINE_ZIGZAG                    514
#define IDM_DRAW_TANGENT_SUB                    515
#define IDM_DRAW_TANGENT_OP                     516
#define IDM_DRAW_TANGENT_OPH                    517
#define IDM_DRAW_TANGENT_OPV                    518
#define IDM_DRAW_TANGENT_OPE                    519
#define IDM_DRAW_TANGENT_OAE                    520
#define IDM_DRAW_TANGENT_OO                     521
#define IDM_DRAW_POLYGON_SUB                    522
#define IDM_DRAW_POLYGON_TRIANGLE               523
#define IDM_DRAW_POLYGON_QUADRANGLE             524
#define IDM_DRAW_POLYGON_PARALLEL               525
#define IDM_DRAW_POLYGON_RECTANGLE              526
#define IDM_DRAW_POLYGON_ANY                    527
#define IDM_DRAW_POLYEDER_SUB                   528
#define IDM_DRAW_POLYEDER_STANDARD              529
#define IDM_DRAW_POLYEDER_CIRCLE                530
#define IDM_DRAW_POLYEDER_CIRCUMCIRCLE          531
#define IDM_DRAW_POLYEDER_DIAMETER              532
#define IDM_DRAW_POLYEDER_SIDELENGTH            533
#define IDM_DRAW_POLYEDER_INNERRADIUS           534
#define IDM_DRAW_CIRCLE_SUB                     535
#define IDM_DRAW_CIRCLE_STANDARD                536
#define IDM_DRAW_CIRCLE_CIRCLE                  537
#define IDM_DRAW_CIRCLE_CIRCUMCIRCLE            538
#define IDM_DRAW_CIRCLE_DIAMETER                539
#define IDM_DRAW_CIRCLE_INCIRCLE                540
#define IDM_DRAW_CIRCLE_CONC                    541
#define IDM_DRAW_CIRCLE_PERP                    542
#define IDM_DRAW_CIRCLE_LLL                     543
#define IDM_DRAW_CIRCLE_PPR                     544
#define IDM_DRAW_CIRCLE_OPR                     545
#define IDM_DRAW_CIRCLE_OOR                     546
#define IDM_DRAW_ARC_SUB                        547
#define IDM_DRAW_ARC_STANDARD                   548
#define IDM_DRAW_ARC_CIRCLE                     549
#define IDM_DRAW_ARC_CIRCUMCIRCLE               550
#define IDM_DRAW_ARC_DIAMETER                   551
#define IDM_DRAW_ARC_CONC_CIRCLE                552
#define IDM_DRAW_ARC_CONC_ARC                   553
#define IDM_DRAW_ARC_PPR                        554
#define IDM_DRAW_ARC_OPR                        555
#define IDM_DRAW_ARC_OOR                        556
#define IDM_DRAW_ELLIPSE_SUB                    557
#define IDM_DRAW_ELLIPSE_STANDARD               558
#define IDM_DRAW_ELLIPSE_ROTATED                559
#define IDM_DRAW_ELLIPSE_ANY                    560
#define IDM_DRAW_ELLIPSE_ELLIPSE                561
#define IDM_DRAW_EARC_SUB                       562
#define IDM_DRAW_EARC_STANDARD                  563
#define IDM_DRAW_EARC_ANY                       564
#define IDM_DRAW_EARC_ELLIPSE                   565
#define IDM_DRAW_ARCMODE_SUB                    566
#define IDM_DRAW_ARCMODE_ARC                    567
#define IDM_DRAW_ARCMODE_SECTOR                 568
#define IDM_DRAW_ARCMODE_SEGMENT                569
#define IDM_DRAW_ARCMODE_TOGGLE                 570
#define IDM_DRAW_ARCMODE_DIRECTION              571
#define IDM_DRAW_FREEHAND                       572
#define IDM_DRAW_SPLINE                         573
#define IDM_DRAW_CURVE                          574
#define IDM_DRAW_SURFACE                        575
#define IDM_DRAW_HATCH_SUB                      576
#define IDM_DRAW_HATCH_OBJ                      577
#define IDM_DRAW_HATCH_SURFACE                  578
#define IDM_DRAW_HATCH_TYPE_LIST                579
#define IDM_DRAW_HATCH_TYPE_EDIT                580
#define IDM_DRAW_HATCH_TYPE_LINE                581
#define IDM_DRAW_HATCH_ORIGIN                   582
#define IDM_DRAW_LAST                   583

#define IDM_GEO_FIRST                   600
#define IDM_GEO_LINE_SUB                        600
#define IDM_GEO_LINE_STANDARD                   601
#define IDM_GEO_LINE_LINE                       602
#define IDM_GEO_LINE_H                          603
#define IDM_GEO_LINE_V                          604
#define IDM_GEO_LINE_MIDPERP                    605
#define IDM_GEO_LINE_PERP                       606
#define IDM_GEO_LINE_PARALLEL                   607
#define IDM_GEO_LINE_PARALLEL_NUM               608
#define IDM_GEO_LINE_ANGLE                      609
#define IDM_GEO_LINE_BISECTOR                   610
#define IDM_GEO_LINE_CROSS                      611
#define IDM_GEO_TANGENT_SUB                     612
#define IDM_GEO_TANGENT_OP                      613
#define IDM_GEO_TANGENT_H                       614
#define IDM_GEO_TANGENT_V                       615
#define IDM_GEO_TANGENT_OA                      616
#define IDM_GEO_TANGENT_OO                      617
#define IDM_GEO_CIRCLE_SUB                      618
#define IDM_GEO_CIRCLE_STANDARD                 619
#define IDM_GEO_CIRCLE_CIRCLE                   620
#define IDM_GEO_CIRCLE_CIRCUMCIRCLE             621
#define IDM_GEO_CIRCLE_DIAMETER                 622
#define IDM_GEO_CIRCLE_INCIRCLE                 623
#define IDM_GEO_CIRCLE_CONC                     624
#define IDM_GEO_CIRCLE_PERP                     625
#define IDM_GEO_CIRCLE_LLL                      626
#define IDM_GEO_CIRCLE_PPR                      627
#define IDM_GEO_CIRCLE_OPR                      628
#define IDM_GEO_CIRCLE_OOR                      629
#define IDM_GEO_ELLIPSE_SUB                     630
#define IDM_GEO_ELLIPSE_STANDARD                631
#define IDM_GEO_ELLIPSE_ROTATED                 632
#define IDM_GEO_ELLIPSE_ANY                     633
#define IDM_GEO_ELLIPSE_ELLIPSE                 634
#define IDM_GEO_DISPLAY                         635
#define IDM_GEO_FREEZE                          636
#define IDM_GEO_MARK                            637
#define IDM_GEO_DIVIDE_SUB                      638
#define IDM_GEO_DIVIDE_DISTANCE                 639
#define IDM_GEO_DIVIDE_OBJECT                   640
#define IDM_GEO_DIVIDE_ARRAY                    641
#define IDM_GEO_COPY_SUB                        642
#define IDM_GEO_COPY_MARK                       643
#define IDM_GEO_COPY_ROTATE                     644
#define IDM_GEO_COPY_STEP                       645
#define IDM_GEO_COPY_DISTANCE                   646
#define IDM_GEO_COPY_OBJECT                     647
#define IDM_GEO_COPY_ARRAY                      648
#define IDM_GEO_LAST                    649

#define IDM_TRIM_FIRST                  700
#define IDM_TRIM_TRIM_SUB                       700
#define IDM_TRIM_TRIM_CUTOUT                    701
#define IDM_TRIM_TRIM_SPLIT                     702
#define IDM_TRIM_TRIM_RESOLVE                   703
#define IDM_TRIM_TRIM_LENGTH_P                  704
#define IDM_TRIM_TRIM_LENGTH_OBJ                705
#define IDM_TRIM_TRIM_ANGLE_P                   706
#define IDM_TRIM_TRIM_ANGLE_OBJ                 707
#define IDM_TRIM_CURVE_SUB                      708
#define IDM_TRIM_CURVE_EDIT                     709
#define IDM_TRIM_CURVE_EXTENT                   710
#define IDM_TRIM_CURVE_CUT                      711
#define IDM_TRIM_SURFACE_SUB                    712
#define IDM_TRIM_SURFACE_GENERATE               713
#define IDM_TRIM_SURFACE_OR                     714
#define IDM_TRIM_SURFACE_AND                    715
#define IDM_TRIM_SURFACE_MINUS                  716
#define IDM_TRIM_SURFACE_COMBINE                717
#define IDM_TRIM_SURFACE_CUT                    718
#define IDM_TRIM_CORNER                         719
#define IDM_TRIM_CHAMFER_SUB                    720
#define IDM_TRIM_CHAMFER_OO                     721
#define IDM_TRIM_CHAMFER_CORNER                 722
#define IDM_TRIM_CHAMFER_ALL                    723
#define IDM_TRIM_ROUNDOUT_SUB                   724
#define IDM_TRIM_ROUNDOUT_OO                    725
#define IDM_TRIM_ROUNDOUT_CORNER                726
#define IDM_TRIM_ROUNDOUT_ALL                   727
#define IDM_TRIM_ROUNDIN_SUB                    728
#define IDM_TRIM_ROUNDIN_OO                     729
#define IDM_TRIM_ROUNDIN_CORNER                 730
#define IDM_TRIM_ROUNDIN_ALL                    731
#define IDM_TRIM_TRANSFORM_SUB                  732
#define IDM_TRIM_TRANSFORM_INVERT               733
#define IDM_TRIM_TRANSFORM_ZIGZAG               734
#define IDM_TRIM_TRANSFORM_CIRCLE               735
#define IDM_TRIM_TRANSFORM_ARC                  736
#define IDM_TRIM_TRANSFORM_SECTOR               737
#define IDM_TRIM_TRANSFORM_SEGMENT              738
#define IDM_TRIM_TRANSFORM_ELLIPSE              739
#define IDM_TRIM_TRANSFORM_EARC                 740
#define IDM_TRIM_TRANSFORM_ESECTOR              741
#define IDM_TRIM_TRANSFORM_ESEGMENT             742
#define IDM_TRIM_TRANSFORM_CURVE                743
#define IDM_TRIM_TRANSFORM_SURFACE              744
#define IDM_TRIM_CLIP_SUB                       745
#define IDM_TRIM_CLIP_CREATE_INSIDE             746
#define IDM_TRIM_CLIP_CREATE_OUTSIDE            747
#define IDM_TRIM_CLIP_RESOLVE                   748
#define IDM_TRIM_LAST                   749

#define IDM_DIM_FIRST                   800
#define IDM_DIM_TEXT_SUB                        800
#define IDM_DIM_TEXT_STANDARD                   801
#define IDM_DIM_TEXT_FRAME                      802
#define IDM_DIM_TEXT_REFERENCE                  803
#define IDM_DIM_TEXT_FLAT                       804
#define IDM_DIM_LINE_SUB                        805
#define IDM_DIM_LINE_LINE                       806
#define IDM_DIM_LINE_ARC                        807
#define IDM_DIM_SUB1                            808
#define IDM_DIM_LENGTH_P                        809
#define IDM_DIM_LENGTH_OBJ                      810
#define IDM_DIM_DISTANCE_P                      811
#define IDM_DIM_DISTANCE_OBJ                    812
#define IDM_DIM_RADIUS_P                        813
#define IDM_DIM_RADIUS_OBJ                      814
#define IDM_DIM_DIAMETER_P                      815
#define IDM_DIM_DIAMETER_OBJ                    816
#define IDM_DIM_ANGLE_P                         817
#define IDM_DIM_ANGLE_LL                        818
#define IDM_DIM_ANGLE_OBJ                       819
#define IDM_DIM_ARCLENGTH_P                     820
#define IDM_DIM_ARCLENGTH_OBJ                   821
#define IDM_DIM_COORDINATE                      822
#define IDM_DIM_SUB2                            823
#define IDM_DIM_AREA                            824
#define IDM_DIM_PERIMETER                       825
#define IDM_DIM_PARAMETER                       826
#define IDM_DIM_EDIT_LINE_SUB                   827
#define IDM_DIM_EDIT_LINE_ANGLE                 828
#define IDM_DIM_EDIT_LINE_POSITION              829
#define IDM_DIM_EDIT_NUM_SUB                    830
#define IDM_DIM_EDIT_NUM_ANGLE                  831
#define IDM_DIM_EDIT_NUM_POSITION               832
#define IDM_DIM_EDIT_NUM_UPDATE                 833
#define IDM_DIM_FONT                            834
#define IDM_DIM_LAST                    835

#define IDM_LIBRARY_FIRST               900
#define IDM_LIBRARY_BLOCK_SUB                   900
#define IDM_LIBRARY_BLOCK_INSERT                901
#define IDM_LIBRARY_BLOCK_READ                  902
#define IDM_LIBRARY_BLOCK_READ_FRAME            903
#define IDM_LIBRARY_BLOCK_EDIT                  904
#define IDM_LIBRARY_POSNO_SUB                   905
#define IDM_LIBRARY_POSNO_ASSIGN                906
#define IDM_LIBRARY_POSNO_DELETE                907
#define IDM_LIBRARY_POSNO_REORDER               908
#define IDM_LIBRARY_LIST                        909
#define IDM_LIBRARY_CLEAN                       910
#define IDM_LIBRARY_CONVERT                     911
#define IDM_LIBRARY_SPLIT                       912
#define IDM_LIBRARY_REPLACE_BLOCK               913
#define IDM_LIBRARY_REPLACE_LIBRARY             914
#define IDM_LIBRARY_TVL                         915
#define IDM_LIBRARY_LAST                916

#define IDM_EXTRA_FIRST                 1000
#define IDM_EXTRA_KEY_F10                       1000
#define IDM_EXTRA_KEY_F11                       1001
#define IDM_EXTRA_KEY_F12                       1002
#define IDM_EXTRA_SEL_SUB                       1003
#define IDM_EXTRA_SEL_SET                       1004
#define IDM_EXTRA_SEL_CLEAR                     1005
#define IDM_EXTRA_SEL_INVERT                    1006
#define IDM_EXTRA_KEY_F6_SHIFT                  1007
#define IDM_EXTRA_KEY_F8                        1008
#define IDM_EXTRA_KEY_ESC                       1009
#define IDM_EXTRA_KEY_ESC_SHIFT                 1010
#define IDM_EXTRA_KEY_F7                        1011
#define IDM_EXTRA_KEY_F5                        1012
#define IDM_EXTRA_KEY_F5_SHIFT                  1013
#define IDM_EXTRA_SNAP_SUB                      1014
#define IDM_EXTRA_SNAP_GLOBAL                   1015
#define IDM_EXTRA_SNAP_CENTER                   1016
#define IDM_EXTRA_SNAP_QUADRANT                 1017
#define IDM_EXTRA_SNAP_EDGE                     1018
#define IDM_EXTRA_SNAP_CORNER                   1019
#define IDM_EXTRA_SNAP_INTERSECTION             1020
#define IDM_EXTRA_SNAP_GEO                      1021
#define IDM_EXTRA_SNAP_MARK                     1022
#define IDM_EXTRA_SNAP_OTHERS                   1023
#define IDM_EXTRA_SNAP_RELATIVE                 1024
#define IDM_EXTRA_SNAP_RADIUS                   1025
#define IDM_EXTRA_KEY_SUB                       1026
#define IDM_EXTRA_KEY_SPACE                     1027
#define IDM_EXTRA_KEY_LBUTTON                   1028
#define IDM_EXTRA_KEY_MBUTTON                   1029
#define IDM_EXTRA_KEY_RBUTTON                   1030
#define IDM_EXTRA_KEY_ALT                       1031
#define IDM_EXTRA_KEY_LEFT                      1032
#define IDM_EXTRA_KEY_RIGHT                     1033
#define IDM_EXTRA_KEY_UP                        1034
#define IDM_EXTRA_KEY_DOWN                      1035
#define IDM_EXTRA_KEY_HOME                      1036
#define IDM_EXTRA_KEY_END                       1037
#define IDM_EXTRA_KEY_PGUP                      1038
#define IDM_EXTRA_KEY_PGDN                      1039
#define IDM_EXTRA_KEY_EDIT_STEP                 1040
#define IDM_EXTRA_LAST                  1041

#define IDM_HELP_FIRST                  1100
#define IDM_HELP_INDEX                          1100
#define IDM_HELP_COMMAND                        1101
#define IDM_HELP_CLICK                          1102
#define IDM_HELP_ON_HELP                        1103
#define IDM_HELP_REGISTER                       1104
#define IDM_HELP_QA                             1105
#define IDM_HELP_TOSONEWS                       1106
#define IDM_HELP_PUZZLE                         1107
#define IDM_HELP_ABOUT                          1108
#define IDM_HELP_LAST                   1109

#define IDM_TABLET_FIRST                1200
#define IDM_TABLET_SUB                          1200
#define IDM_TABLET_BUTTON                       1201
#define IDM_TABLET_CALIBRATE                    1202
#define IDM_TABLET_ORIGIN                       1203
#define IDM_TABLET_LOAD                         1204
#define IDM_TABLET_SAVE_AS                      1205
#define IDM_TABLET_INFO                         1206
#define IDM_TABLET_OPTIONS                      1207
#define IDM_TABLET_EDIT                         1208
#define IDM_TABLET_DELETE                       1209
#define IDM_TABLET_LAST                 1210

#define IDM_EXTERN_FIRST                1300
#define IDM_EXTERN_MODULE_MIN                   IDM_EXTERN_FIRST
#define IDM_EXTERN_MODULE_MAX                   ( IDM_EXTERN_MODULE_MIN + TVG_MODULE_MAX * TVG_MODULE_MENU_MAX )
#define IDM_EXTERN_IMPORT_MIN                   IDM_EXTERN_MODULE_MAX
#define IDM_EXTERN_IMPORT_MAX                   ( IDM_EXTERN_MODULE_MAX + TVG_FILTER_MAX )
#define IDM_EXTERN_EXPORT_MIN                   IDM_EXTERN_IMPORT_MAX
#define IDM_EXTERN_EXPORT_MAX                   ( IDM_EXTERN_EXPORT_MIN + TVG_FILTER_MAX )
#define IDM_EXTERN_LAST                 IDM_EXTERN_EXPORT_MAX

#define IDM_LAST_ENTRY                  IDM_EXTERN_LAST

//------ Internal Command IDs --------------------------------------------------------------------------

#define IDM_INTERN_FIRST                IDM_LAST_ENTRY

#define IDM_INTERN_BLOCK_INSERT_MIN             IDM_INTERN_FIRST
#define IDM_INTERN_BLOCK_INSERT_MAX             ( IDM_INTERN_BLOCK_INSERT_MIN + TVG_BLOCKLIST_MAX )
#define IDM_INTERN_BLOCK_EDIT_MIN               IDM_INTERN_BLOCK_INSERT_MAX
#define IDM_INTERN_BLOCK_EDIT_MAX               ( IDM_INTERN_BLOCK_EDIT_MIN + TVG_BLOCKLIST_MAX )

#define IDM_INTERN_FILE_OPEN_MIN                IDM_INTERN_BLOCK_EDIT_MAX
#define IDM_INTERN_FILE_OPEN_MAX                ( IDM_INTERN_FILE_OPEN_MIN + TVG_FILE_MAX )

#define IDM_INTERN_SYSTEM_SELECT_MIN            IDM_INTERN_FILE_OPEN_MAX
#define IDM_INTERN_SYSTEM_SELECT_MAX            ( IDM_INTERN_SYSTEM_SELECT_MIN + TVG_SYSTEM_MAX + 1 )
#define IDM_INTERN_SYSTEM_EDIT_MIN              IDM_INTERN_SYSTEM_SELECT_MAX
#define IDM_INTERN_SYSTEM_EDIT_MAX              ( IDM_INTERN_SYSTEM_EDIT_MIN + TVG_SYSTEM_MAX + 1 )

#define IDM_INTERN_HATCH_SELECT_MIN             IDM_INTERN_SYSTEM_EDIT_MAX
#define IDM_INTERN_HATCH_SELECT_MAX             ( IDM_INTERN_HATCH_SELECT_MIN + TVG_HATCH_MAX + 1 )
#define IDM_INTERN_HATCH_EDIT_MIN               IDM_INTERN_HATCH_SELECT_MAX
#define IDM_INTERN_HATCH_EDIT_MAX               ( IDM_INTERN_HATCH_EDIT_MIN + TVG_HATCH_MAX + 1 )

#define IDM_INTERN_LAYER_SELECT_MIN             IDM_INTERN_HATCH_EDIT_MAX
#define IDM_INTERN_LAYER_SELECT_MAX             ( IDM_INTERN_LAYER_SELECT_MIN + TVG_LAYER_MAX + 1 )
#define IDM_INTERN_LAYER_EDIT_MIN               IDM_INTERN_LAYER_SELECT_MAX
#define IDM_INTERN_LAYER_EDIT_MAX               ( IDM_INTERN_LAYER_EDIT_MIN + TVG_LAYER_MAX + 1 )

#define IDM_INTERN_PEN_SELECT_MIN               IDM_INTERN_LAYER_EDIT_MAX
#define IDM_INTERN_PEN_SELECT_MAX               ( IDM_INTERN_PEN_SELECT_MIN + TVG_PEN_MAX + 1 )
#define IDM_INTERN_PEN_EDIT_MIN                 IDM_INTERN_PEN_SELECT_MAX
#define IDM_INTERN_PEN_EDIT_MAX                 ( IDM_INTERN_PEN_EDIT_MIN + TVG_PEN_MAX + 1 )

#define IDM_INTERN_ZOOM_AREA_MIN                IDM_INTERN_PEN_EDIT_MAX
#define IDM_INTERN_ZOOM_AREA_MAX                ( IDM_INTERN_ZOOM_AREA_MIN + TVG_WINDOW_MAX + 1 )
#define IDM_INTERN_ZOOM_OBJECTS_MIN             IDM_INTERN_ZOOM_AREA_MAX
#define IDM_INTERN_ZOOM_OBJECTS_MAX             ( IDM_INTERN_ZOOM_OBJECTS_MIN + TVG_WINDOW_MAX + 1 )
#define IDM_INTERN_ZOOM_PAGE_MIN                IDM_INTERN_ZOOM_OBJECTS_MAX
#define IDM_INTERN_ZOOM_PAGE_MAX                ( IDM_INTERN_ZOOM_PAGE_MIN + TVG_WINDOW_MAX + 1 )
#define IDM_INTERN_ZOOM_ORIGINAL_MIN            IDM_INTERN_ZOOM_PAGE_MAX
#define IDM_INTERN_ZOOM_ORIGINAL_MAX            ( IDM_INTERN_ZOOM_ORIGINAL_MIN + TVG_WINDOW_MAX + 1 )
#define IDM_INTERN_ZOOM_FACTOR_MIN              IDM_INTERN_ZOOM_ORIGINAL_MAX
#define IDM_INTERN_ZOOM_FACTOR_MAX              ( IDM_INTERN_ZOOM_FACTOR_MIN + TVG_WINDOW_MAX + 1 )
#define IDM_INTERN_ZOOM_UNDO_MIN                IDM_INTERN_ZOOM_FACTOR_MAX
#define IDM_INTERN_ZOOM_UNDO_MAX                ( IDM_INTERN_ZOOM_UNDO_MIN + TVG_WINDOW_MAX + 1 )

#define IDM_INTERN_STARTUP_DIALOG       IDM_INTERN_ZOOM_UNDO_MAX        

#define IDM_INTERN_LAST                 ( IDM_INTERN_STARTUP_DIALOG + 1 )

//------ Context Identifiers for Electronic Reference --------------------------------------------------

#define IDH_CONTENTS                    10000   // Index
#define IDH_HOTSPOT_HELP                10001   // Help on Usage of Hotspot Dialog Windows

#define IDH_TOPIC_REFERENCE             11000   // Introduction, Support & Information
#define IDH_TOPIC_CONVENTIONS           11001   // Conventions used in the Reference
#define IDH_TOPIC_REQUIREMENTS          11002   // System Requirements
#define IDH_TOPIC_PLOTTER               11003   // Notes on Plotter Output
#define IDH_TOPIC_DIGITIZER             11004   // Using Digitizers
#define IDH_TOPIC_WINDOWS95             11005   // Notes for Windows 95 Users

#define IDH_TOPIC_WINDOW_MAIN           12000   // Main Window
#define IDH_TOPIC_WINDOW_DRAW           12001   // Drawing Window
#define IDH_TOPIC_WINDOW_VIEW           12002   // View Window
#define IDH_TOPIC_WINDOW_PANEL          12003   // Panel
#define IDH_TOPIC_WINDOW_PROP           12004   // Property Window
#define IDH_TOPIC_WINDOW_PEN            12005   // Pen List
#define IDH_TOPIC_WINDOW_LAYER          12006   // Layer List
#define IDH_TOPIC_WINDOW_SCALE          12007   // Ruler
#define IDH_TOPIC_WINDOW_STATUS         12008   // Status Line
#define IDH_TOPIC_WINDOW_BLOCK          12009   // Block List Window
#define IDH_TOPIC_WINDOW_TOOLBOX        12010   // Toolbox
#define IDH_TOPIC_WINDOW_GUIDE          12011   // Guide Windows
#define IDH_TOPIC_WINDOW_POPUP          12012   // Popup Men
#define IDH_TOPIC_WINDOW_CHOOSE         12013   // Multi-Object Selection

#define IDH_TOPIC_TRANSMISSION          13000   // Layers, Pens, and Transmission
#define IDH_TOPIC_SYSTEMS               13001   // Coordinate Systems, Scales, Grids, etc.
#define IDH_TOPIC_OPTIONS               13002   // Snapping, Duplicate, and other Options
#define IDH_TOPIC_BLOCKS                13003   // Libraries, Blocks and Instances
#define IDH_TOPIC_FILEOPT               13004   // TVG 4.0 File Format
#define IDH_TOPIC_MODULE                13005   // The Module Concept

#define IDH_INTERN_BLOCK_INSERT	        14000   // Internal Commands
#define IDH_INTERN_BLOCK_EDIT           14001
#define IDH_INTERN_FILE_OPEN            14002
#define IDH_INTERN_SYSTEM_SELECT        14003
#define IDH_INTERN_SYSTEM_EDIT          14004
#define IDH_INTERN_HATCH_SELECT         14005
#define IDH_INTERN_HATCH_EDIT           14006
#define IDH_INTERN_LAYER_SELECT         14007
#define IDH_INTERN_LAYER_EDIT           14008
#define IDH_INTERN_PEN_SELECT           14009
#define IDH_INTERN_PEN_EDIT             14010
#define IDH_INTERN_ZOOM_AREA            14011
#define IDH_INTERN_ZOOM_OBJECTS         14012
#define IDH_INTERN_ZOOM_PAGE            14013
#define IDH_INTERN_ZOOM_ORIGINAL        14014
#define IDH_INTERN_ZOOM_FACTOR          14015
#define IDH_INTERN_ZOOM_UNDO            14016

#define IDW_MULTIPROP                   15000   // Edit Properties
#define IDW_TEXTSTANDARD                15001   // Standard Text
#define IDW_TEXTFRAME                   15002   // Frame Text
#define IDW_ZIGZAG                      15003   // Zig Zag Line
#define IDW_DIMPARAM0                   15004   // Dimension Line
#define IDW_DIMDATA                     15005   // General Dimension Parameters
#define IDW_DIMPARAM1                   15006   // Dimension with Line
#define IDW_DIMPARAM2                   15007   // Dimension without Line
#define IDW_CHOOSECOLOR                 15008   // Color Selection
#define IDW_FILESELECT                  15009   // File Selection
#define IDW_CHOOSECOLOR2                15010   // Standard Color Selection
#define IDW_PRINTLAYOUT                 15011   // Print Drawing
#define IDW_FILEOPTIONS                 15012   // Edit File Options
#define IDW_CHOOSESECTIONS              15013   // Edit Single File Options
#define IDW_AUTOSAVE                    15014   // Auotsave Parameters
#define IDW_BITMAPEDIT                  15015   // Bitmap Reference
#define IDW_EXPORTBITMAP                15016   // Export Bitmap
#define IDW_COMMENTLAYOUT               15017   // Command Parameters
#define IDW_DETAILSEDIT                 15018   // Edit Details
#define IDW_PAGEFORMAT                  15019   // Page Format
#define IDW_LAYEREDIT                   15020   // Edit Layers
#define IDW_DETAILSVIEW                 15021   // View Details
#define IDW_LAYERDEFAULT                15022   // Layer Defaults
#define IDW_SYSTEMEDIT                  15023   // Edit Coordinate Systems
#define IDW_SYSTEMDISPLAY               15024   // Coordinate Systems View
#define IDW_SYSTEMORIGIN                15025   // Coordinate Systems Origin
#define IDW_SYSTEMUNIT                  15026   // Coordinate Systems Units
#define IDW_SYSTEMNUMBER                15027   // Coordinate Systems Numbers
#define IDW_SYSTEMGRID                  15028   // Coordinate Systems Display Grid
#define IDW_SYSTEMSNAP                  15029   // Coordinate Systems Position Grid
#define IDW_PENEDIT                     15030   // Edit Pens
#define IDW_PENDEFAULT                  15031   // Pen Defaults
#define IDW_LINEEDIT                    15032   // Edit Line Patterns
#define IDW_LINETYPE                    15033   // Edit Single Line Pattern
#define IDW_PROPERTY                    15034   // Simple Properties
#define IDW_DIMLAYOUT                   15035   // Global Dimension Parameters
#define IDW_PROGSTATUS                  15036   // Program Status
#define IDW_SYSTEMMEMORY                15037   // Memory and Monitor
#define IDW_PATHSYSTEM                  15038   // Standard Paths
#define IDW_ORTHOLAYOUT                 15039   // Orthogonal Mode
#define IDW_SCREENLAYOUT                15040   // Settings Display
#define IDW_ACCURACYLAYOUT              15041   // Settings Accuracy
#define IDW_OUTPUTLAYOUT                15042   // Settings Output
#define IDW_SYSTEMCOLORS                15043   // Settings Colors
#define IDW_KEYASSIGN                   15044   // Display Keybaord Assignment
#define IDW_MOUSEASSIGNMENT             15045   // Einstellung Maustastenfunktion
#define IDW_KEYEDIT                     15046   // Edit Key Assignment
#define IDW_CONSTRUCTION                15047   // Division
#define IDW_FONTHANDLING                15048   // Fonts
#define IDW_INSTANCEEDIT                15049   // Instance
#define IDW_TEXTSTANDARDINSERT          15050   // Create Standard Text
#define IDW_TEXTFRAMEINSERT             15051   // Create Frame Text
#define IDW_FONTDEF                     15052   // Select Font
#define IDW_CURVE                       15053   // Curve / Surface Entry
#define IDW_CONDSEL                     15054   // Selection Parameters
#define IDW_CHANGETEXT                  15055   // Edit Text
#define IDW_TEXTREFERENCE               15056   // Reference Text
#define IDW_DIMTEXT1                    15057   // Edit Dimension and Tolerances
#define IDW_DIMTEXT2                    15058   // Edit Coordinates and Tolerances
#define IDW_HATCHEDIT                   15059   // Edit Hatching Types
#define IDW_HATCHTYPE                   15060   // Edit Single Hatching Type
#define IDW_MULTILINEEDIT               15061   // Edit Line Sequences
#define IDW_MULTILINEPARAM              15062   // Edit Single Line Sequence
#define IDW_BLOCKINSERT                 15063   // Insert Block
#define IDW_BLOCKREAD                   15064   // Create Block
#define IDW_BLOCKEDIT                   15065   // Edit Block
#define IDW_BLOCKCOPY                   15066   // Copy Block
#define IDW_BLOCKATTRIB                 15067   // Edit Attributes
#define IDW_BLOCKATTRIBSINGLE           15068   // Edit Single Attribute
#define IDW_PARTSLIST1                  15069   // Generate Parts List, Part 1
#define IDW_PARTSLIST2                  15070   // Generate Parts List, Part 2
#define IDW_BLOCKCONVERT                15071   // External Blocks to Internal
#define IDW_BLOCKREPLACE                15072   // Replace Block
#define IDW_LIBRARYREPLACE              15073   // Replace Library
#define IDW_LIBRARYHANDLING             15074   // Libraries
#define IDW_BLOCKSELECT                 15075   // Select Block
#define IDW_BLOCKWINDOW                 15076   // Settings Block List
#define IDW_PLOTTERLAYOUT               15077   // Settings Plotter
#define IDW_CURVEEDIT                   15078   // Edit Curve
#define IDW_ALERT                       15079   // General Message
//                                      15080   // Multi-Object Selection
#define IDW_EDIT                        15081   // General Entry, Part 1
//                                      15082   // General Entry, Part 2
#define IDW_TABLETBUTTON                15083   // Digitizer Buttons
#define IDW_PARTSLISTOPTION             15084   // Generate Parts List Options
#define IDW_FILEINFO                    15085   // File Infos
#define IDW_WINDOWLAYOUT                15086   // Window Layout
#define IDW_CODE                        15087   // Code Entry
#define IDW_TIMELAYOUT                  15088   // Time Layout
#define IDW_LISTBOXFILTER               15089   // List box filter

//------ Point Descriptions for User Input -------------------------------------------------------------

#ifndef TOSO_RESOURCE

#define POINT_NO                0
#define POINT_COMMAND           1
#define POINT_HELP              2
#define POINT_ANY               3
#define POINT_ANY1              4
#define POINT_ANY2              5
#define POINT_START             6
#define POINT_START1            7
#define POINT_START2            8
#define POINT_END               9
#define POINT_END1              10
#define POINT_END2              11
#define POINT_REFERENCE         12
#define POINT_DESTINATION       13
#define POINT_CORNER1           14
#define POINT_CORNER2           15
#define POINT_CORNER3           16
#define POINT_CORNER4           17
#define POINT_CIRCLE1           18
#define POINT_CIRCLE2           19
#define POINT_CIRCLE3           20
#define POINT_ELLIPSE1          21
#define POINT_ELLIPSE2          22
#define POINT_FRAME             23
#define POINT_CENTER            24
#define POINT_RADIUS            25
#define POINT_ANGLE             26
#define POINT_ANGLE1            27
#define POINT_ANGLE2            28
#define POINT_LINE_RELATIVE     29
#define POINT_PIVOT1            30
#define POINT_PIVOT2            31
#define POINT_CURVE_END         32
#define POINT_ARC               33
#define POINT_ARC_END1          34
#define POINT_ARC_END2          35
#define POINT_ARC_RELATIVE      36
#define POINT_POSITION          37
#define POINT_SECTION1          38
#define POINT_SECTION2          39
#define POINT_DIM_LINE1         40
#define POINT_DIM_LINE2         41
#define POINT_DIM_LINE3         42
#define POINT_DIM_NUM1          43
#define POINT_DIM_NUM2          44

#define POINT_ID_SINGLE_FIRST   45              // First ID that requires identification resolving

#define POINT_PL                45
#define POINT_PL1               46
#define POINT_PL2               47
#define POINT_PL3               48
#define POINT_PC                49
#define POINT_PA                50
#define POINT_PE                51
#define POINT_PCE               52
#define POINT_PCE1              53
#define POINT_PCE2              54
#define POINT_PLC               55
#define POINT_PLC1              56
#define POINT_PLC2              57
#define POINT_PLC3              58
#define POINT_PLE               59
#define POINT_PLCEA             60

#define POINT_ID_ALL            61
#define POINT_ID_OBJECT         62
#define POINT_ID_INSTANCE       63
#define POINT_ID_TRIM           64
#define POINT_ID_TRIM1          65
#define POINT_ID_TRIM2          66
#define POINT_ID_LINE           67
#define POINT_ID_LINE1          68
#define POINT_ID_LINE2          69
#define POINT_ID_CIRCLE         70
#define POINT_ID_CIRCLE1        71
#define POINT_ID_CIRCLE2        72
#define POINT_ID_ARC            73
#define POINT_ID_ELLIPSE        74
#define POINT_ID_EARC           75
#define POINT_ID_CURVE          76
#define POINT_ID_SURFACE        77
#define POINT_ID_CURVE_SURFACE  78
#define POINT_ID_FILLED         79
#define POINT_ID_FILLED1        80
#define POINT_ID_FILLED2        81
#define POINT_ID_TEXT           82
#define POINT_ID_DIMENSION1     83
#define POINT_ID_DIMENSION2     84
#define POINT_ID_CLIP           85
#define POINT_ID_POINT          86

#define POINT_ID_MULTI_FIRST    87              // First ID that enables multi-object identification

#define POINT_ID_MULTITEXT1     87
#define POINT_ID_MULTITEXT2     88
#define POINT_ID_MULTIDIM1      89
#define POINT_ID_MULTIDIM2      90
#define POINT_ID_MULTIINST      91
#define POINT_ID_MULTIOBJ       92
#define POINT_ID_MULTIALL       93
#define POINT_ID_MULTIPOINT     94

#define POINT_TOTAL             95

//------ Guide Options ---------------------------------------------------------------------------------

#define GUIDE_NULL              0x00000000      // No guide
#define GUIDE_SINGLE_OBJ        0x00000001      // Single object identification
#define GUIDE_MULTI_OBJ         0x00000002      // Multiple object choosing
#define GUIDE_SINGLE_POINT      0x00000004      // Single point identification
#define GUIDE_MULTI_POINT       0x00000008      // Multiple point choosing
#define GUIDE_PARAMETER         0x00000010      // Parameters are available
#define GUIDE_ARC_DIRECTION     0x00000020      // Arc direction has effect
#define GUIDE_ARC_MODE          0x00000040      // Arc mode has effect
#define GUIDE_COORDINATES       0x00000080      // Coordinate entry makes sense
#define GUIDE_SNAP              0x00000100      // Snapping has effect
#define GUIDE_GRID              0x00000200      // Grid has effect
#define GUIDE_DUPLICATE         0x00000400      // Duplicate has effect
#define GUIDE_MULTILINE         0x00000800      // Multiline has effect
#define GUIDE_ESC               0x00001000      // Last point entry may be reversed
#define GUIDE_RBUTTON1          0x00002000      // Right mouse button cancels command
#define GUIDE_RBUTTON2          0x00004000      // Right mouse button finishes entry
#define GUIDE_ENTRY             0x00008000      // Description of point entry
#define GUIDE_RESET             0x20000000      // Resets guide content to empty
#define GUIDE_DEFAULT           0x40000000      // Default descriptions
#define GUIDE_EXTERNAL          0x80000000      // Additional external text

//------ Command Types ---------------------------------------------------------------------------------

#define MODULECTRL_ALL          0x0fff          // Module may run on any program version
#define MODULECTRL_DEMO         0x0001          // Module may run on a demo version
#define MODULECTRL_TEST         0x0002          // Module may run on a trial version
#define MODULECTRL_LEVEL1       0x0010          // Module may run on a level 1 version
#define MODULECTRL_LEVEL2       0x0020          // Module may run on a level 2 version
#define MODULECTRL_LEVEL3       0x0040          // Module may run on a level 3 version
#define MODULECTRL_LEVEL4       0x0080          // Module may run on a level 4 version
#define MODULECTRL_CHECKED      0x1000          // Module will only run if it has been registered

#define MODULETYPE_FILE         0               // Module contains commands for menu "File"
#define MODULETYPE_EDIT         1               // Module contains commands for menu "Edit"
#define MODULETYPE_CONFIG       2               // Module contains commands for menu "Configure"
#define MODULETYPE_SHAPE        3               // Module contains commands for menu "Shape"
#define MODULETYPE_DRAW         4               // Module contains commands for menu "Draw"
#define MODULETYPE_GEO          5               // Module contains commands for menu "Geometry"
#define MODULETYPE_TRIM         6               // Module contains commands for menu "Trimming"
#define MODULETYPE_DIM          7               // Module contains commands for menu "Dimension"
#define MODULETYPE_LIB          8               // Module contains commands for menu "Library"
#define MODULETYPE_EXTRA        9               // Module contains commands for menu "Extra"
#define MODULETYPE_HELP         10              // Module contains commands for menu "Help"
#define MODULETYPE_CUSTOM       97              // Module contains commands for custom menu
#define MODULETYPE_IMPORT       98              // Module contains import filters
#define MODULETYPE_EXPORT       99              // Module contains export filters

#define MODULEEXEC_USER         0               // Command was selected by the user
#define MODULEEXEC_SYSTEM       1               // Command is restarted by the system
#define MODULEEXEC_HELP         2               // The help for this command shall be displayed

#define COMMAND_DIRECT          0               // Directly executed command (no mouse input required)
#define COMMAND_DIGITIZER       1               // Modification of digitizer assignment (local)
#define COMMAND_KEY             2               // Modification of keybaord assignment (local)
#define COMMAND_HELP            3               // Help by clicking (local)
#define COMMAND_LOCAL           4               // Local command with a fixed number of point entries
#define COMMAND_FIXED           5               // Global command with a fixed number of point entries
#define COMMAND_VARIABLE        6               // Global command with a variable number of point entries

//------ Data Block Types ------------------------------------------------------------------------------

#define DB_OWNER_TOSO           0

#define DB_TYPE_NATIVE          0
#define DB_TYPE_LONG            1
#define DB_TYPE_DOUBLE          2
#define DB_TYPE_POINT           3
#define DB_TYPE_COLORREF        4
#define DB_TYPE_PROPERTY        5
#define DB_TYPE_XPROPERTY       6
#define DB_TYPE_FONTDEF         7
#define DB_TYPE_TEXT            8
#define DB_TYPE_BINARY          9

//------ Data Block Numbers ----------------------------------------------------------------------------

#define DB_TEMP_MIN             (-100)          // First number of a temporary data block
#define DB_TEMP_MAX             0               // First number of a non-temporary data block

#define DB_TEMP_T001            (-1)
#define DB_TEMP_T002            (-2)
#define DB_TEMP_T003            (-3)
#define DB_TEMP_T004            (-4)
#define DB_TEMP_T005            (-5)
#define DB_TEMP_T006            (-6)
#define DB_TEMP_T007            (-7)
#define DB_TEMP_T008            (-8)

#define DB_POINT_MIN            0               // First number of a point data block
#define DB_POINT_MAX            100             // First number of a non-point data block

#define DB_POINT_ANY            0
#define DB_POINT_START          1
#define DB_POINT_END            2
#define DB_POINT_CENTER         3
#define DB_POINT_RADIUS         4
#define DB_POINT_ANGLE          5
#define DB_POINT_VECTOR         6
#define DB_POINT_PIVOT1         7
#define DB_POINT_PIVOT2         8
#define DB_POINT_ARC            9
#define DB_POINT_MARK           10

#define DB_ALL_MIN              100             // First number of a standard data block
#define DB_ALL_MAX              200             // First number of a non-standard data block

#define DB_ALL_CONSTANT         100
#define DB_ALL_ARC              101
#define DB_ALL_CURVE            102
#define DB_ALL_TEXT             110

#define DB_INFO_MIN             200             // First number of an object-specific data block
#define DB_INFO_MAX             300             // Frist number of an non-object-specific data block

#define DB_INFO_DIMLINE         220
#define DB_INFO_DIMLARGE        225
#define DB_INFO_DIMSMALL        230
#define DB_INFO_TEXTSTANDARD    235
#define DB_INFO_TEXTFRAME       236
#define DB_INFO_TEXTREFERENCE   237
#define DB_INFO_CLIPSURFACE     242
#define DB_INFO_BITMAPREF       243

#define DB_ATTRIB_MIN           300             // First number of an attribute data block
#define DB_ATTRIB_MAX           500             // First number of a non-attribute data block

#define DB_ATTRIB_GLOBAL_MIN    300
#define DB_ATTRIB_GLOBAL_MAX    400

#define DB_ATTRIB_GLOBAL_TEXT   300
#define DB_ATTRIB_GLOBAL_NUM    301

#define DB_ATTRIB_LOCAL_MIN     400
#define DB_ATTRIB_LOCAL_MAX     500

#define DB_ATTRIB_LOCAL_TEXT    400
#define DB_ATTRIB_LOCAL_NUM     401

#define DB_END                  999

//------ Entity Types ----------------------------------------------------------------------------------

#define TYPE_OBJECT             0
#define TYPE_INSTANCE           1
#define TYPE_BLOCK              2
#define TYPE_USER               9

#define TYPE_END                999

//------ Object Types ----------------------------------------------------------------------------------

#define OBJ_LINE                0
#define OBJ_HATCH               1

#define OBJ_CIRCLE              5
#define OBJ_ARC                 6
#define OBJ_SECTOR              7
#define OBJ_SEGMENT             8

#define OBJ_ZIGZAG              10
#define OBJ_SPLINE              11
#define OBJ_CURVE               12
#define OBJ_SURFACE             13

#define OBJ_ELLIPSE             15
#define OBJ_EARC                16
#define OBJ_ESECTOR             17
#define OBJ_ESEGMENT            18

#define OBJ_DLINE               20
#define OBJ_DARC                21

#define OBJ_DDISTANCE           25
#define OBJ_DRADIUS             26
#define OBJ_DDIAMETER           27
#define OBJ_DANGLE              28
#define OBJ_DARCLENGTH          29
#define OBJ_DCOORDINATE         30
#define OBJ_DAREA               31
#define OBJ_DPERIMETER          32

#define OBJ_TEXTSTANDARD        35
#define OBJ_TEXTFRAME           36
#define OBJ_TEXTREFERENCE       37

#define OBJ_COMMENT             40
#define OBJ_MARK                41
#define OBJ_CLIPSURFACE         42
#define OBJ_BITMAPREF           43

#define OBJ_GEOLINE             45
#define OBJ_GEOCIRCLE           46
#define OBJ_GEOELLIPSE          47

#define OBJ_TOTAL               50              // Number of "known" object types

#define OBJ_END                 999

//------ Special Identification Characters -------------------------------------------------------------

#define ID_CHAR_SYSTEM          '*'             // Identification character for system names
#define ID_CHAR_INTERN          '#'             // Identification character for internal definitions
#define ID_CHAR_VARIABLE        '~'             // Identification character for variables
#define ID_CHAR_GROUP           'G'             // Identification character for groups
#define ID_CHAR_POSNO           'P'             // Identification character for position numbers

#define END_TEXT                "\x04"          // End-of-list identification in text lists (string)
#define END_CHAR                '\x04'          // End-of-list identification in text lists (char)

//------ Constant for TVG and TVL Handling -------------------------------------------------------------

#define FONTTYPE_TOSO           0x0000          // Font Types
#define FONTTYPE_TRUETYPE       0x0001
#define FONTTYPE_DEVICE         0x0002

#define FONTSTYLE_REGULAR       0x0000          // Font Styles
#define FONTSTYLE_ITALIC        0x0001
#define FONTSTYLE_UNDERLINE     0x0002
#define FONTSTYLE_OVERLINE      0x0004
#define FONTSTYLE_STRIKEOUT     0x0008
#define FONTSTYLE_SYMBOL        0x0100
#define FONTSTYLE_BASIC         0xff01

#define DIMMODE_NUMREFRESH      0x0001          // Dimension Parameter Flags
#define DIMMODE_NUMCENTERED     0x0002
#define DIMMODE_NUMTIGHT        0x0004
#define DIMMODE_NUMROTATE       0x0008
#define DIMMODE_ARROWSTARTFORM  0x0010
#define DIMMODE_ARROWSTARTMODE  0x0020
#define DIMMODE_ARROWENDFORM    0x0040
#define DIMMODE_ARROWENDMODE    0x0080
#define DIMMODE_EXTSTARTDISPLAY 0x0100
#define DIMMODE_EXTENDDISPLAY   0x0200
#define DIMMODE_LINEDISPLAY     0x0400
#define DIMMODE_LINEORIENTATION 0x0800
#define DIMMODE_LINETYPE        0x1000
#define DIMMODE_LINEDISTMODE    0x2000
#define DIMMODE_LINEDISTANCE    0x4000
#define DIMMODE_GLOBALPARAM     0x8000
#define DIMMODE_ALL             0xffff

#define FILLMODE_FRAMED         0x0000          // Filling Modes
#define FILLMODE_FILLED         0x0001
#define FILLMODE_FILLED_FRAMED  0x0002
#define FILLMODE_ERASER         0x0003
#define FILLMODE_ERASER_FRAMED  0x0004

#define LAYERMODE_DISPLAY       0x0001          // Layer Modes
#define LAYERMODE_OUTPUT        0x0002
#define LAYERMODE_FREEZE        0x0004
#define LAYERMODE_IDLE          0x0008
#define LAYERMODE_GRAY          0x0010
#define LAYERMODE_DEFAULT       0x0003

#define GRID_OFF                0x0000          // Grid Modes
#define GRID_CARTESIAN          0x0001
#define GRID_ISOMETRIC          0x0002
#define GRID_DIMETRIC1          0x0003
#define GRID_DIMETRIC2          0x0004

#define USE_NULL                0x0000          // Transmission Flags
#define USE_PEN                 0x0001
#define USE_FILLMODE            0x0002
#define USE_FILLCOLOR           0x0004
#define USE_LINECOLOR           0x0008
#define USE_LINEWIDTH           0x0010
#define USE_LINETYPE            0x0020
#define USE_LAYER               0x0040

#define USE_PROPERTY            0x003e
#define USE_PROP_PEN            0x003f
#define USE_PROP_PEN_LAYER      0x007f

#define DEFPEN_DIMLINE          0x0000          // Default Pen Indexes
#define DEFPEN_DIMTEXT          0x0001
#define DEFPEN_TEXT             0x0002
#define DEFPEN_REFLINE          0x0003
#define DEFPEN_GEOMETRY         0x0004

#define DEFLAYER_MARK           0x0000          // Default Layer Index
#define DEFLAYER_OUTLINE        0x0001
#define DEFLAYER_DIM            0x0002
#define DEFLAYER_TEXT           0x0003
#define DEFLAYER_HATCH          0x0004
#define DEFLAYER_BLOCK          0x0005
#define DEFLAYER_GEOMETRY       0x0006

#define SNAPMODE_CENTER         0x0001          // Snapping modes
#define SNAPMODE_QUADRANT       0x0002
#define SNAPMODE_EDGE           0x0004
#define SNAPMODE_CORNER         0x0008
#define SNAPMODE_INTERSECTION   0x0010
#define SNAPMODE_GEO            0x0020
#define SNAPMODE_MARK           0x0040
#define SNAPMODE_OTHERS         0x0080
#define SNAPMODE_RELATIVE       0x0100

#define SNAPMODE_SINGLE         0x0007          // Snapping modes that cannot be combined with others
#define SNAPMODE_MULTI          0x00f8          // Snapping modes that can be combined using bitwise-or
#define SNAPMODE_EXTRA          0x0f00          // Snapping modes that are additional to normal modes

#define SNAPMODE_TOTAL          9               // Number of snapping modes

//------ System Settings -------------------------------------------------------------------------------

#define SETTING_DUPLICATE       0x0001          // Duplicate status (TRUE = Active, FALSE = Inactive)
#define SETTING_SNAPACTIVE      0x0002          // Snap status (TRUE = Active, FALSE = Inactive)
#define SETTING_SNAPMODE        0x0003          // Snap modes (combination of SNAPMODE_???)
#define SETTING_SNAPRADIUS      0x0004          // Snap radius (5..50)
#define SETTING_SNAPTOLERANCE   0x0005          // Snap tolerance (0..10)
#define SETTING_ORTHO           0x0006          // Orthogonal mode (TRUE = Active, FALSE = Disabled)
#define SETTING_ARCDIRECTION    0x0007          // Arc direction (TRUE = Positive, FALSE = Negative)
#define SETTING_ARCMODE         0x0008          // Arc mode (0 = Arc, 1 = Sector, 2 = Segment)
#define SETTING_AREAMODE        0x0009          // Area mode (TRUE = Inside, FALSE = Overlapping)
#define SETTING_GEODISPLAY      0x000a          // Geometry display (TRUE = Visible, FALSE = Invisible)
#define SETTING_GEOFROZEN       0x000b          // Geometry status (TRUE = Frozen, FALSE = Editable)

#define SETTING_COLOR_LAYER     0x1000          // Color of grayed layers
#define SETTING_COLOR_GEOMETRY  0x1001          // Color of default geometry objects
#define SETTING_COLOR_BLOCKS    0x1002          // Color of block text display
#define SETTING_COLOR_ERASER    0x1003          // Color of erasers
#define SETTING_COLOR_POINT     0x1004          // Color of standard points
#define SETTING_COLOR_MARK      0x1005          // Color of markings
#define SETTING_COLOR_INPUT     0x1006          // Color of input rubber lines
#define SETTING_COLOR_OBJSEL    0x1007          // Color of permanently selected objects
#define SETTING_COLOR_OBJUSE    0x1008          // Color of identified objects
#define SETTING_COLOR_OBJIDENT  0x1009          // Color of object highlight when identification is inaccurate
#define SETTING_COLOR_POINTUSE  0x100a          // Color of selected points
#define SETTING_COLOR_CURSOR1   0x100b          // Color of "large" cursor cross (active window)
#define SETTING_COLOR_CURSOR2   0x100c          // Color of "small" cursor cross (inactive windows)
#define SETTING_COLOR_PAGEFRAME 0x100d          // Color of page frame and zoom / layer / system display
#define SETTING_COLOR_DRAWAREA  0x100e          // Color of drawing area background
#define SETTING_COLOR_COLORTEXT 0x100f          // Color of colored texts
#define SETTING_COLOR_SUBMENU   0x1010          // Color of submenu icons
#define SETTING_COLOR_COMMAND   0x1011          // Color of command icons

//------ Input Processing ------------------------------------------------------------------------------

#define INPUT_ERROR             0               // Error during input processing
#define INPUT_OVERFLOW          1               // Too many points entered
#define INPUT_IGNORE            2               // Ignore this point!
#define INPUT_OK                3               // OK
#define INPUT_CANCEL            4               // Cancel current command
#define INPUT_FINISH            5               // Finsih current command
#define INPUT_NEXT              6               // Continue with next point
#define INPUT_UNUSED            7               // This point is not required

//------ File Options ----------------------------------------------------------------------------------

#define LOADSAVE_HEADER         0x00000001
#define LOADSAVE_TOOLBOX        0x00000002
#define LOADSAVE_BLOCKLIST      0x00000004
#define LOADSAVE_KEYBOARD       0x00000008
#define LOADSAVE_WINDOW         0x00000010
#define LOADSAVE_DEFAULT        0x00000020
#define LOADSAVE_USER           0x00000040
#define LOADSAVE_MODULE         0x00000080
#define LOADSAVE_PAGE           0x00000100
#define LOADSAVE_COLOR          0x00000200
#define LOADSAVE_HATCH          0x00000400
#define LOADSAVE_MULTILINE      0x00000800
#define LOADSAVE_SYSTEM         0x00001000
#define LOADSAVE_PEN            0x00002000
#define LOADSAVE_LINE           0x00004000
#define LOADSAVE_LAYER          0x00008000

#define LOADSAVE_ATTRIB         0x00080000

#define LOADSAVE_BLOCK          0x00100000
#define LOADSAVE_OBJECT         0x00200000

#define LOADSAVE_USERSECTIONS   0x10000000      // Save all previously loaded sections plus...
#define LOADSAVE_IDENTIFIED     0x20000000      // Do only save identified objects
#define LOADSAVE_REPLACE        0x40000000      // Replace elements when loading
#define LOADSAVE_NODIALOG       0x80000000      // Do not display a progress indicator

//------ Window Arrangement ----------------------------------------------------------------------------

#define WINMODE_1               0x00            // 1 windows
#define WINMODE_2X              0x01            // 2 windows (equally sized, left and right)
#define WINMODE_2Y              0x02            // 2 windows (euqally sized, top and bottom)
#define WINMODE_3X              0x03            // 3 windows (1 large one, 2 small ones right to it)
#define WINMODE_3Y              0x04            // 3 windows (1 large one, 2 small ones below it)
#define WINMODE_4               0x05            // 4 windows (equally sized)
#define WINMODE_4X              0x06            // 4 windows (1 large one, 3 small ones right ot it)
#define WINMODE_4Y              0x07            // 4 windows (1 large one, 3 small ones below it)

//------ Flags for Unit Enumeration --------------------------------------------------------------------

#define ENUMMODE_LINES          0x00000000      // Curves / surfaces may neither be nested nor filled
#define ENUMMODE_FILLS          0x00000001      // Curves / surfaces may be nested and filled
#define ENUMMODE_ARCS           0x00000002      // Curves / surfaces may contain circular arcs
#define ENUMMODE_BEZIERS        0x00000004      // Curves / surfaces may contain Bzier curves
#define ENUMMODE_LINETYPES      0x00000008      // Curves / surfaces may use line patterns (instead of resolving)
#define ENUMMODE_SOLID_CHARS    0x00000010      // Solid texts will be passed as separate characters (plus a matrix)
#define ENUMMODE_OTHER_CHARS    0x00000020      // Non-solid texts will be passed as separate characters (plus a matrix)
#define ENUMMODE_SOLID_TEXTS    0x00000040      // Solid texts will be passed in complete strings (format plus matrix)
#define ENUMMODE_OTHER_TEXTS    0x00000080      // Non-solid texts will be passed in complete strings (format plus matrix)
#define ENUMMODE_MATRIX         0x00000100      // Display matrixes will be passed (instead of applied directly)
#define ENUMMODE_NATIVE         0x00000200      // All units will be passed in native format only (address)

#define ENUMMODE_PLAIN          0x00001000      // Instances will be resolved
#define ENUMMODE_STRUCTURED     0x00002000      // Instances will not be resolved

#define ENUMMODE_USED_BLOCKS    0x00010000      // Enumerate all referenced blocks
#define ENUMMODE_USED_FONTS     0x00020000      // Enumerate all referenced fonts

#define ENUMMODE_NO_OBJECTS     0x00100000      // Do NOT enumerate objects
#define ENUMMODE_NO_BLOCKS      0x00200000      // Do NOT enumerate blocks
#define ENUMMODE_NO_FONTS       0x00400000      // Do NOT enumerate fonts

#define ENUMMODE_SCREEN_PROP    0x01000000      // Use screen settings to calculate properties
#define ENUMMODE_OUTPUT_PROP    0x02000000      // Use output settings to calculate properties (default)

#define ENUMDATA_INVALID        0x00000000      // EnumData contains no valid data
#define ENUMDATA_CURVE          0x00000001      // EnumData contains an open curve
#define ENUMDATA_AREA           0x00000002      // EnumData contains a closed surface
#define ENUMDATA_MARK           0x00000003      // EnumData contains a list of markings
#define ENUMDATA_CHAR           0x00000004      // EnumData contains a list of characters plus matrixes
#define ENUMDATA_TEXT           0x00000005      // EnumData contains a complete line of text
#define ENUMDATA_INST           0x00000006      // EnumData contains an instance

#define ENUMDATA_USED_BLOCK     0x00000010      // EnumData contains information about used blocks
#define ENUMDATA_USED_FONT      0x00000011      // EnumData contains information about used fonts

#define ENUMDATA_NATIVE_OBJ     0x00000020      // EnumData contains pointer to an object
#define ENUMDATA_NATIVE_INST    0x00000021      // EnumData contains pointer to an instance
#define ENUMDATA_NATIVE_BLOCK   0x00000022      // EnumData contains pointer to a block
#define ENUMDATA_NATIVE_USER    0x00000023      // EnumData contains pointer to a module-defined object

//------ Flags for Unit Modification -------------------------------------------------------------------

#define MODIFY_INIT             0x00000001      // UserObj is to be initialised
#define MODIFY_MATRIX           0x00000002      // UserObj is to be multiplied with a matrix

//------ Internal Flags for Entities and Data Blocks ---------------------------------------------------

#define FLAG_SELECT             0x0001          // Unit is permanently selected
#define FLAG_IDENT              0x0002          // Unit is temporarily selected
#define FLAG_USE                0x0004          // Unit is identified
#define FLAG_POINT              0x0008          // At least one point is identified

#define FLAG_SELCHANGE          0x0010          // The permanent selection has changed
#define FLAG_USECHANGE          0x0020          // The temporary selection has changed
#define FLAG_PREVIOUS           0x0040          // Unit was previously selected
#define FLAG_INTERNAL           0x0080          // Unit is used for internal affairs

#define FLAG_TEMP1              0x0100          // Temporary multi-purpose flag 1
#define FLAG_TEMP2              0x0200          // Temporary multi-purpose flag 2
#define FLAG_TEMP3              0x0400          // Temporary multi-purpose flag 3
#define FLAG_TEMP4              0x0800          // Temporary multi-purpose flag 4
#define FLAG_TEMP_ALL           0x0f00

#define FLAG_NODISPLAY          0x1000          // Unit's layer will not be displayed
#define FLAG_NOOUTPUT           0x2000          // Unit's layer will not be output
#define FLAG_FROZEN             0x4000          // Unit's layer is frozen
#define FLAG_IDLE               0x8000          // Unit's layer is idle

#define FLAG_GROUP_COPY         ( FLAG_PREVIOUS  | FLAG_SELECT )
#define FLAG_GROUP_NO_USE       ( FLAG_NODISPLAY | FLAG_FROZEN )
#define FLAG_GROUP_NO_SNAP      ( FLAG_NODISPLAY | FLAG_IDLE )

//------ Definitions for TVG File Handling -------------------------------------------------------------

#define TVG_COMMA               ','
#define TVG_SEMI                ';'
#define TVG_COLOR               '/'
#define TVG_ESCAPE              '\\'
#define TVG_STRING              '"'
#define TVG_KEYWORD             '='
#define TVG_COMMENT             '|'

#define TVG_NEWLINE             "\x0d\x0a"

#define TVG_KEY_UNKNOWN         -1
#define TVG_KEY_EXIT            0
#define TVG_KEY_END             1
#define TVG_KEY_DRAWING         2
#define TVG_KEY_LIBRARY         3
#define TVG_KEY_ATTRIB          4
#define TVG_KEY_PAGE            5
#define TVG_KEY_DEFAULT         6
#define TVG_KEY_SYSTEM          7
#define TVG_KEY_PEN             8
#define TVG_KEY_LINE            9
#define TVG_KEY_LAYER           10
#define TVG_KEY_HATCH           11
#define TVG_KEY_BLOCK           12
#define TVG_KEY_OBJECT          13
#define TVG_KEY_COLOR           14
#define TVG_KEY_KEYBOARD        15
#define TVG_KEY_TOOLBOX         16
#define TVG_KEY_SYMBOL          17
#define TVG_KEY_USER            18
#define TVG_KEY_MODULE          19
#define TVG_KEY_WINDOW          20
#define TVG_KEY_MULTILINE       21
#define TVG_KEY_MAX             22

//------ Constants for Drawing and Library Elements ----------------------------------------------------

#define ENTRIES_PER_DRAWING     10000           // Maximum number of blocks per drawing
#define ENTRIES_PER_LIBRARY     1000000         // Maximum number of blocks per library
#define ENTRIES_PER_LEVEL       1000            // Maximum number of blocks pro folder in a library
#define ENTRIES_PER_FONT        224             // Maximum number of characters per font (Ansi 32..255)

#define ATTRIBS_PER_OBJECT      200             // Maximum number of attributes per block / instance
#define POINTS_PER_OBJECT       2000            // Maximum number of point data blocks per object

#define NAME_LENGTH_SHORT       32              // Maximum length of short definition names
#define NAME_LENGTH_LONG        64              // Maximum length of long definition names
#define NAME_LENGTH_TITLE       64              // Maximum length of library and drawing titles
#define NAME_LENGTH_BLOCK       64              // Maximum length of block names
#define NAME_LENGTH_FONT        64              // Maximum length of font names
#define NAME_LENGTH_TEXTSHORT   250             // Maximum length of "short" texts
#define NAME_LENGTH_TEXTLONG    8000            // Maximum length of "long" texts
#define NAME_LENGTH_EDIT        250             // Maximum text length retrieves from edit controls

#define DATA_PER_OBJECT         128000          // Maximum size of a unit's data area in bytes

#define TVG_ID_LENGTH           22              // Length of TommySoftware file identifications
#define TVG_40_HEADER           "TommySoftware TVG 4.00"
#define TVG_30_HEADER           "TommySoftware TVG 3.00"
#define TVL_30_HEADER           "TommySoftware TVL 3.00"

#define TVG_BLOCK_ID            "*"             // Library name of blocks
#define TVG_BLOCK_INDEX         999             // Library index of blocks

#define TVG_TOOLBOX_MAX         100                             // Number of toolbox buttons
#define TVG_BLOCKLIST_MAX       100                             // Number of block list buttons
#define TVG_CUSTOMKEY_MAX       76                              // Number of keys

#define TVG_SYSTEMCOLOR_MAX     32                              // Number of system colors
#define TVG_CUSTOMCOLOR_MAX     500                             // Number of custom colors
#define TVG_TOTALCOLOR_MAX      (TVG_SYSTEMCOLOR_MAX + TVG_CUSTOMCOLOR_MAX)
#define TVG_DEFAULT_MAX         8                               // Number of defaults           (pens & layers)
#define TVG_SYSTEM_MAX          50                              // Number of coordinate systems (plus STANDARD)
#define TVG_MULTILINE_MAX       50                              // Number of line sequences     (plus STANDARD)
#define TVG_MULTILINEPART_MAX   8                               // Number of lines per line sequence
#define TVG_HATCH_MAX           100                             // Number of hatch types        (plus STANDARD)
#define TVG_LINE_MAX            100                             // Number of line patterns      (plus STANDARD)
#define TVG_LINEPART_MAX        16                              // Number of line parts per line pattern
#define TVG_PEN_MAX             500                             // Number of pens               (plus NULL)
#define TVG_LAYER_MAX           500                             // Number of layers             (plus STANDARD)

#define TVG_DRAWING_MAX         1               // Maximum number of concurrently opened drawing files
#define TVG_WINDOW_MAX          4               // Maximum number of concurrent drawing windows
#define TVG_WINDOW_VIEW         999             // Window index of view window
#define TVG_FILE_MAX            20              // Maximum number of drawings memorised
#define TVG_FONT_MAX            10              // Maximum number of fonts opened
#define TVG_LIBRARY_MAX         50              // Maximum number of libraries opened
#define TVG_CACHE_MAX           10000           // Maximum number of blocks in the cache

#define TVG_BITMAP_MIN          50              // Minimum number of bitmaps opened
#define TVG_BITMAP_MAX          1000            // Maximum number of bitmaps opened

#define TVG_DEFPATH_MAX         8               // Number of standard paths per file type
#define TVG_PLOTTER_MAX         8               // Number of plotter pens

#define TVG_FILTER_MAX          20              // Maximum number of loaded filters
#define TVG_MODULE_MAX          40              // Maximum number of loaded modules
#define TVG_MODULE_MENU_MAX     100             // Maximum number of items in a module's menu
#define TVG_MODULE_SUBMENU_MAX  20              // Maximum number of items in a module's submenu

#define TVG_INPUT_MAX           2000            // Maximum number of points to be entered
#define TVG_INPUT_DEF_MAX       8               // Maximum number of predefined point entries
#define TVG_POLYGON_MAX         16000           // Maximum number of lines at polygon output
#define TVG_POLYPOLY_MAX        1000            // Maximum number of nested sub-polygons

#define PAGEDEF_SIZE            sizeof( PAGEDEF )
#define DEFAULTDEF_SIZE         sizeof( DEFAULTDEF )
#define WINDOWDEF_SIZE          sizeof( WINDOWDEF )
#define SYSTEMDEF_SIZE          sizeof( SYSTEMDEF )
#define LINEDEF_SIZE            sizeof( LINEDEF )
#define PROPERTY_SIZE           sizeof( PROPERTY )
#define PENDEF_SIZE             sizeof( PENDEF )
#define XPROPERTY_SIZE          sizeof( XPROPERTY )
#define LAYERDEF_SIZE           sizeof( LAYERDEF )
#define MULTILINEDEF_SIZE       sizeof( MULTILINEDEF )
#define HATCHDEF_SIZE           sizeof( HATCHDEF )
#define COLORDEF_SIZE           sizeof( COLORDEF )

#define UNIT_ANY_SIZE           sizeof( UNIT_ANY )
#define UNIT_OBJECT_SIZE        sizeof( UNIT_OBJECT )
#define UNIT_BLOCK_SIZE         sizeof( UNIT_BLOCK )
#define UNIT_INSTANCE_SIZE      sizeof( UNIT_INSTANCE )
#define UNIT_USER_SIZE          sizeof( UNIT_USER )

//------ Color definitions -----------------------------------------------------------------------------

#define RGB_WHITE       RGB( 255, 255, 255 )  // RGB for White        #0
#define RGB_GRAY5       RGB( 242, 242, 242 )  // RGB for Gray      5%
#define RGB_GRAY12      RGB( 224, 224, 224 )  // RGB for Gray     12,5%
#define RGB_GRAY25      RGB( 192, 192, 192 )  // RGB for Gray     25%
#define RGB_GRAY50      RGB( 128, 128, 128 )  // RGB for Gray     50%
#define RGB_GRAY62      RGB(  96,  96,  96 )  // RGB for Gray     62,5%
#define RGB_GRAY75      RGB(  64,  64,  64 )  // RGB for Gray     75%
#define RGB_BLACK       RGB(   0,   0,   0 )  // RGB for Black
#define RGB_RED100      RGB( 255,   0,   0 )  // RGB for Red     100% #8
#define RGB_RED75       RGB( 192,   0,   0 )  // RGB for Red      75%
#define RGB_RED50       RGB( 128,   0,   0 )  // RGB for Red      50%
#define RGB_RED25       RGB(  64,   0,   0 )  // RGB for Red      25%
#define RGB_YELLOW100   RGB( 255, 255,   0 )  // RGB for Yellow  100%
#define RGB_YELLOW75    RGB( 192, 192,   0 )  // RGB for Yellow   75%
#define RGB_YELLOW50    RGB( 128, 128,   0 )  // RGB for Yellow   50%
#define RGB_YELLOW25    RGB(  64,  64,   0 )  // RGB for Yellow   25%
#define RGB_GREEN100    RGB(   0, 255,   0 )  // RGB for Green   100% #16
#define RGB_GREEN75     RGB(   0, 192,   0 )  // RGB for Green    75%
#define RGB_GREEN50     RGB(   0, 128,   0 )  // RGB for Green    50%
#define RGB_GREEN25     RGB(   0,  64,   0 )  // RGB for Green    25%
#define RGB_CYAN100     RGB(   0, 255, 255 )  // RGB for Cyan    100%
#define RGB_CYAN75      RGB(   0, 192, 192 )  // RGB for Cyan     75%
#define RGB_CYAN50      RGB(   0, 128, 128 )  // RGB for Cyan     50%
#define RGB_CYAN25      RGB(   0,  64,  64 )  // RGB for Cyan     25%
#define RGB_BLUE100     RGB(   0,   0, 255 )  // RGB for Blue    100% #24
#define RGB_BLUE75      RGB(   0,   0, 192 )  // RGB for Blue     75%
#define RGB_BLUE50      RGB(   0,   0, 128 )  // RGB for Blue     50%
#define RGB_BLUE25      RGB(   0,   0,  64 )  // RGB for Blue     25%
#define RGB_MAGENTA100  RGB( 255,   0, 255 )  // RGB for Magenta 100%
#define RGB_MAGENTA75   RGB( 192,   0, 192 )  // RGB for Magenta  75%
#define RGB_MAGENTA50   RGB( 128,   0, 128 )  // RGB for Magenta  50%
#define RGB_MAGENTA25   RGB(  64,   0,  64 )  // RGB for Magenta  25% #31

#define RGB_BROWN       RGB( 128,  64,   0 )  // RGB for Brown   100%
#define RGB_ORANGE      RGB( 255, 128,   0 )  // RGB for Orange  100%

//------ Mathematical Constants ------------------------------------------------------------------------

#define REAL_SIN_15             0.2588190451025         // sin( 15 )
#define REAL_COS_15             0.9659258262891         // cos( 15 )
#define REAL_TAN_15             0.2679491924311         // tan( 15 )
#define REAL_SIN_7              0.1218693434051         // sin( 7 )
#define REAL_COS_7              0.9925461516413         // cos( 7 )
#define REAL_TAN_7              0.1227845609029         // tan( 7 )
#define REAL_SIN_30             0.5                     // sin( 30 )
#define REAL_COS_30             0.8660254037844         // cos( 30 )
#define REAL_TAN_30             0.5773502691896         // tan( 30 )
#define REAL_SIN_42             0.6626200482157         // sin( 41.5 )
#define REAL_COS_42             0.7489555720789         // cos( 41.5 )
#define REAL_TAN_42             0.8847252645559         // tan( 41.5 )

#define REAL_01PI               0.3141592653589793      // 0.1 pi
#define REAL_05PI               1.5707963267948965      // 0.5 pi
#define REAL_PI                 3.141592653589793       // 1.0 pi
#define REAL_15PI               4.7123889803846895      // 1.5 pi
#define REAL_2PI                6.283185307179586       // 2.0 pi
#define REAL_25PI               7.8539816339744825      // 2.5 pi
#define REAL_3PI                9.424777960769379       // 3.0 pi
#define REAL_35PI              10.9955742875642755      // 3.5 pi
#define REAL_4PI               12.566370614359172       // 4.0 pi

#define REAL_DEG_RAD            0.01745329251994        // pi / 180
#define REAL_GRA_RAD            0.01570796326795        // pi / 200
#define REAL_REL_RAD            6.283185307179586       // 2.0 * pi
#define REAL_RAD_DEG           57.29577951308           // 180 / pi
#define REAL_RAD_GRA           63.66197723676           // 200 / pi
#define REAL_RAD_REL            0.1591549430919         // 0.5 / pi

#define REAL_INCH_MM           25.4                     // Inch -> MM
#define REAL_MM_INCH            0.03937007874016        // MM -> Inch

#define REAL_ROOT_3             1.732050807569          // sqrt( 3.0 )
#define REAL_ROOT_2             1.414213562373          // sqrt( 2.0 )
#define REAL_ROOT_05            0.7071067811865         // sqrt( 0.5 )

//------ "Invalid" Values ------------------------------------------------------------------------------

#define REAL_NOVAL              (1.0e+300)              // Invalid double value
#define FLOAT_NOVAL             (1.0e+32)               // Invalid float value
#define INT_NOVAL               (-2147483647)           // Invalid int value
#define LONG_NOVAL              (-2147483647)           // Invalid long value

#define NOPARAM                 0                       // Unused parameter

//------ Value Ranges for Input and Output -------------------------------------------------------------

#define COORD_MIN               (-1.0e100)      // Allowed coordinate range
#define COORD_MAX               (1.0e100)

#define EDIT_MIN                (1.0e-10)       // Allowed input range
#define EDIT_MAX                (1.0e10)

//------ Basic Types -----------------------------------------------------------------------------------

typedef void*           OBJPTR;                 // Universal object pointer
typedef unsigned int    OFFSET;                 // Offset pointer for data block enumeration

typedef char            FILENAME[MAX_PATH];     // Standard file name
typedef char            DUMMYSTR[MAX_PATH+256]; // Standard message text (text + one file name)

typedef char            STR32   [32],           // Standard text sizes
                        STR64   [64],
                        STR256  [256],
                        STR8192 [8192];

typedef struct {                                // Matrix
  double        m11, m12,
                m21, m22,
                m31, m32;
} MATRIX;

typedef struct {                                // Point in internal [mm]
  double        x, y;
} DPOINT;

typedef struct {                                // Rectangle in internal [mm]
  double        x1, y1, x2, y2;
} DRECT;

typedef struct {                                // Font description
  int           Type,
                Style,
                Weight;
  STR64         Name;
} FONTDEF;

//------ File Header Elements --------------------------------------------------------------------------

typedef struct {
  int           PageType,
                PageOrient;
  double        PageXSize,
                PageYSize;
} PAGEDEF;

typedef struct {
  int           Pens    [TVG_DEFAULT_MAX],
                Layers  [TVG_DEFAULT_MAX];
} DEFAULTDEF;

typedef struct {
  int           WindowSystem;
  BOOL          WindowGrid,
                WindowSnap;
  double        WindowXCenter,
                WindowYCenter,
                WindowZoom;
} WINDOWDEF;

typedef struct {
  STR32         SystemName;

  double        SystemRotate,
                SystemScale;
  int           SystemOption;

  int           SystemOrgMode;
  double        SystemXOrg,
                SystemYOrg;

  int           SystemLenUnit,
                SystemLineUnit,
                SystemAngleUnit,
                SystemFraction,
                SystemAccuracy;

  int           SystemGridMode;
  double        SystemXGrid,
                SystemYGrid;

  int           SystemSnapMode;
  double        SystemXSnap,
                SystemYSnap;

  MATRIX        SystemMMToUnit,
                SystemUnitToMM;
} SYSTEMDEF;

typedef struct {
  STR32         LineName;

  int           LineNum,
                LineMode;
  int           LineData[TVG_LINEPART_MAX];
} LINEDEF;

typedef struct {
  int           FillMode;
  COLORREF      FillColor,
                LineColor;
  int           LineType;
  double        LineWidth;
} PROPERTY;

typedef struct {
  STR64         PenName;

  PROPERTY      PenIntern,
                PenExtern;

  int           PenLayer;
} PENDEF;

typedef struct {
  int           Flag,
                Pen;

  int           FillMode;
  COLORREF      FillColor,
                LineColor;
  int           LineType;
  double        LineWidth;

  int           Layer;
} XPROPERTY;

typedef struct {
  STR64         LayerName;

  XPROPERTY     LayerIntern,
                LayerExtern;

  int           LayerMode;
} LAYERDEF;

typedef struct {
  double        Distance;
  XPROPERTY     XProperty;
  BOOL          Use;
} MULTILINE;

typedef struct {
  STR32         MultiLineName;
  MULTILINE     MultiLineData[TVG_MULTILINEPART_MAX];
} MULTILINEDEF;

typedef struct {
  STR64         HatchName;

  BOOL          HatchLine1Active;
  int           HatchLine1;
  double        HatchLine1Rotate;

  BOOL          HatchLine2Active;
  int           HatchLine2;
  double        HatchLine2Rotate;

  BOOL          HatchBlockActive;
  STR64         HatchLibraryName,
                HatchBlockName;
  double        HatchBlockRotate,
                HatchBlockScale,
                HatchXStep1,
                HatchXStep2,
                HatchYStep1,
                HatchYStep2,
                HatchLineStep1,
                HatchLineStep2;

  double        HatchRotate,
                HatchOffset1,
                HatchOffset2;
} HATCHDEF;

typedef struct {
  STR32         ColorName;
  COLORREF      ColorValue;
} COLORDEF;

typedef union {
  PROPERTY      Property;
  PAGEDEF       Page;
  DEFAULTDEF    Default;
  SYSTEMDEF     System;
  HATCHDEF      Hatch;
  MULTILINEDEF  MultiLine;
  PENDEF        Pen;
  LINEDEF       Line;
  LAYERDEF      Layer;
  COLORDEF      Color;
} UNIONDEF;

//------ File Handling ---------------------------------------------------------------------------------

typedef struct {
  STR64         Title,
                Theme,
                Author1,
                Date1,
                Author2,
                Date2;
  STR256        Comment;
} FILE_HEADER;

typedef struct {
  char          Newline[4],
                Comma,
                Semi,
                Color,
                Escape,
                String,
                Keyword,
                Comment;
} TOKEN_DATA;

//------ Data Block Elements ---------------------------------------------------------------------------

typedef struct {
  int           ArrowStartForm,
                ArrowStartMode,
                ArrowEndForm,
                ArrowEndMode;
} DIMLINE;

typedef struct {
  FONTDEF       TextFont;
  XPROPERTY     TextXProperty;
  double        TextSize1,
                TextSize2;

  int           NumAccuracy;
  BOOL          NumRefresh,
                NumRotate;
  int           System;
} DIMSMALL;

typedef struct {
  FONTDEF       TextFont;
  XPROPERTY     TextXProperty;
  double        TextSize1,
                TextSize2;

  int           NumAccuracy;
  BOOL          NumRefresh,
                NumCentered,
                NumTight,
                NumRotate;

  int           ArrowStartForm,
                ArrowStartMode,
                ArrowEndForm,
                ArrowEndMode;

  BOOL          ExtStartDisplay,
                ExtEndDisplay,
                LineDisplay;
  int           LineOrientation,
                LineType,
                LineDistMode;
  double        LineDistance;
  int           System;
} DIMLARGE;

typedef struct {
  FONTDEF       TextFont;
  XPROPERTY     TextXProperty;
  MATRIX        TextMatrix;

  double        CharDistance,
                TabDistance,
                LineDistance;
  int           TextMode;
} TEXTSTANDARD;

typedef struct {
  FONTDEF       TextFont;
  XPROPERTY     TextXProperty;
  double        TextSize;

  double        CharDistance,
                TabDistance,
                LineDistance;
  int           TextMode;
} TEXTFRAME;

typedef struct {
  int           ArrowForm,
                ArrowMode,
                FrameForm;
  double        FrameOffset;
} TEXTREFERENCE;

typedef struct {
  XPROPERTY     XProperty;
  STR64         LibraryName,
                BlockName;
  MATRIX        DisplayMatrix;
  int           IgnoreBlock;

  int           LibraryNum,
                BlockNum;
  BOOL          NotFound;
} CLIPSURFACE;

typedef struct {
  STR256        BitmapName;
  MATRIX        DisplayMatrix;
} BITMAPREF;

//------ Generic Data Blocks ---------------------------------------------------------------------------

typedef struct {
  int           Size;
  short         Ident,
                Flag;

  short         BlockOwner,
                BlockType,

                ElemType,
                ElemCount;
} BLOCK_HEADER;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0..9, ElemCount = ???
} BLOCK_ANY;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 1, ElemCount = Number of LONGs ( >0 )
  long          Data[];
} BLOCK_LONG;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 2, ElemCount = Number of DOUBLEs ( >0 )
  double        Data[];
} BLOCK_DOUBLE;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 3, ElemCount = Number of DPOINTs ( >0 )
  DPOINT        Data[];
} BLOCK_POINT;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 4, ElemCount = Number of COLORREFs ( >0 )
  COLORREF      Data[];
} BLOCK_COLORREF;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 5, ElemCount = Number of PROPERTYs ( >0 )
  PROPERTY      Data[];
} BLOCK_PROPERTY;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 6, ElemCount = Number of XPROPERTYs ( >0 )
  XPROPERTY     Data[];
} BLOCK_XPROPERTY;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 7, ElemCount = Number of FONTDEFs ( >0 )
  FONTDEF       Data[];
} BLOCK_FONTDEF;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 8, ElemCount = Text length ( <0 static, >0 dynamic )
  char          Text[];
} BLOCK_TEXT;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 9, ElemCount = Data length ( >0 )
  BYTE          Data[];
} BLOCK_BINARY;

typedef BLOCK_ANY       *BLOCK_PTR;
typedef BLOCK_LONG      *BLOCK_LONG_PTR;
typedef BLOCK_DOUBLE    *BLOCK_DOUBLE_PTR;
typedef BLOCK_POINT     *BLOCK_POINT_PTR;
typedef BLOCK_COLORREF  *BLOCK_COLORREF_PTR;
typedef BLOCK_PROPERTY  *BLOCK_PROPERTY_PTR;
typedef BLOCK_XPROPERTY *BLOCK_XPROPERTY_PTR;
typedef BLOCK_FONTDEF   *BLOCK_FONTDEF_PTR;
typedef BLOCK_TEXT      *BLOCK_TEXT_PTR;
typedef BLOCK_BINARY    *BLOCK_BINARY_PTR;

//------ Native Data Blocks ----------------------------------------------------------------------------

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = Attribute length ( <0 static, >0 dynamic )
  STR32         Name;
  char          Text[];
} BLOCK_ATTRIBUTE;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  DIMLINE       Data;
} BLOCK_DIMLINE;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  DIMSMALL      Data;
} BLOCK_DIMSMALL;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  DIMLARGE      Data;
} BLOCK_DIMLARGE;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  TEXTSTANDARD  Data;
} BLOCK_TEXTSTANDARD;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  TEXTFRAME     Data;
} BLOCK_TEXTFRAME;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  TEXTREFERENCE Data;
} BLOCK_TEXTREFERENCE;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  CLIPSURFACE   Data;
} BLOCK_CLIPSURFACE;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  BITMAPREF     Data;
} BLOCK_BITMAPREF;

typedef BLOCK_ATTRIBUTE         *BLOCK_ATTRIBUTE_PTR;
typedef BLOCK_DIMLINE           *BLOCK_DIMLINE_PTR;
typedef BLOCK_DIMSMALL          *BLOCK_DIMSMALL_PTR;
typedef BLOCK_DIMLARGE          *BLOCK_DIMLARGE_PTR;
typedef BLOCK_TEXTSTANDARD      *BLOCK_TEXTSTANDARD_PTR;
typedef BLOCK_TEXTFRAME         *BLOCK_TEXTFRAME_PTR;
typedef BLOCK_TEXTREFERENCE     *BLOCK_TEXTREFERENCE_PTR;
typedef BLOCK_CLIPSURFACE       *BLOCK_CLIPSURFACE_PTR;
typedef BLOCK_BITMAPREF         *BLOCK_BITMAPREF_PTR;

//------ Internal Data Blocks --------------------------------------------------------------------------

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  double        ArcAngle;
} BLOCK_T001;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  double        StartAngle,
                ArcAngle;
} BLOCK_T002;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  double        ArrowStartAngle,
                ArrowEndAngle;
} BLOCK_T003;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  double        ArcAngle,
                StartAngle,
                EndAngle,
                ArrowStartAngle,
                ArrowEndAngle;
} BLOCK_T004;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  int           ArrowStartForm,
                ArrowEndForm;
  double        ArrowStartAngle,
                ArrowEndAngle,
                NumberAngle;
  BOOL          ExtStartDisplay,
                ExtEndDisplay,
                LineDisplay;
  double        x1, y1,         // Position of arrow 1 / start-point of dimension
                x2, y2,         // Position of arrow 2 / end-point of dimension
                x3, y3,         // End-point of extension line 1 (x1,y1)
                x4, y4,         // End-point of extension line 2 (x2,y2)
                x7, y7;         // Insertion point of number
} BLOCK_T005;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  int           ArrowStartForm,
                ArrowEndForm;
  double        ArcAngle,
                StartAngle,
                EndAngle,
                ArrowStartAngle,
                ArrowEndAngle,
                NumberAngle;
  BOOL          ExtStartDisplay,
                ExtEndDisplay,
                LineDisplay;
  double        x1, y1,         // Position of arrow 1 / start-point of dimension
                x2, y2,         // Position of arrow 2 / end-point of dimension
                x3, y3,         // End-point of extension line 1 (x1,y1)
                x4, y4,         // End-point of extension line 2 (x2,y2)
                x5, y5,         // Center-point of dimension line arc
                x6, y6,         // Radius-point of dimension line arc
                x7, y7;         // Insertion point of number
} BLOCK_T006;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  double        NumberAngle;
  double        x7, y7;         // Insertion point of number
} BLOCK_T007;

typedef struct {
  BLOCK_HEADER  Header;         // ElemType = 0, ElemCount = 0
  int           ArrowForm,
                ArrowMode;
  double        ArrowAngle;
  int           FrameForm;
  double        FrameOffset;
  double        x1, y1,         // Corner-point 1 / Center-point
                x2, y2,         // Corner-point 2 / Radius-point / Vector 1
                x3, y3,         // Corner-point 3                / Vector 2
                x4, y4,         // Corner-point 4
                x5, y5,         // Start-point of reference line
                x6, y6,         // Bending-point of reference line
                x7, y7;         // Insertion point of number
} BLOCK_T008;

typedef BLOCK_T001      *BLOCK_T001_PTR;
typedef BLOCK_T002      *BLOCK_T002_PTR;
typedef BLOCK_T003      *BLOCK_T003_PTR;
typedef BLOCK_T004      *BLOCK_T004_PTR;
typedef BLOCK_T005      *BLOCK_T005_PTR;
typedef BLOCK_T006      *BLOCK_T006_PTR;
typedef BLOCK_T007      *BLOCK_T007_PTR;
typedef BLOCK_T008      *BLOCK_T008_PTR;

//------ Unit headers ----------------------------------------------------------------------------------

typedef struct {
  long          Units,          // Internal Data - do not modify!
                Bytes;          // Internal Data - do not modify!
  OBJPTR        Prev,           // Internal Data - do not modify!
                Next;           // Internal Data - do not modify!
} UNIT_MEMORY;

typedef struct {
  DRECT         Rect;           // Internal Data - do not modify!

  int           Ident,          // Internal Data - do not modify!
                Flag,           // Internal Data - do not modify!

                Undo1,          // Internal Data - do not modify!
                Undo2;          // Internal Data - do not modify!

  int           UnitOwner,
                UnitType;
} UNIT_HEADER;

typedef struct {
  UNIT_MEMORY   Memory;
  UNIT_HEADER   Header;         // UnitType = ?

  char          Data[];
} UNIT_ANY;

typedef struct {
  UNIT_MEMORY   Memory;
  UNIT_HEADER   Header;         // UnitType = 0

  XPROPERTY     XProperty;
  int           ObjectType;

  int           FontNum;        // Internal Data - do not modify!

  char          Data[];
} UNIT_OBJECT;

typedef struct {
  UNIT_MEMORY   Memory;
  UNIT_HEADER   Header;         // UnitType = 2

  XPROPERTY     XProperty;
  STR64         BlockName;
  DRECT         BlockRect;

  OBJPTR        BlockFirst,     // Internal Data - do not modify!
                BlockLast;      // Internal Data - do not modify!

  char          Data[];
} UNIT_BLOCK;

typedef struct {
  UNIT_MEMORY   Memory;
  UNIT_HEADER   Header;         // UnitType = 3

  XPROPERTY     XProperty;
  STR64         LibraryName,
                BlockName;
  MATRIX        DisplayMatrix;

  int           LibraryNum,     // Internal Data - do not modify!
                BlockNum;       // Internal Data - do not modify!
  BOOL          NotFound;       // Internal Data - do not modify!

  char          Data[];
} UNIT_INSTANCE;

typedef struct {
  UNIT_MEMORY   Memory;
  UNIT_HEADER   Header;         // UnitType = 9

  XPROPERTY     XProperty;
  STR64         LibraryName,
                BlockName;
  MATRIX        DisplayMatrix;
  int           UserType;

  int           LibraryNum,     // Internal Data - do not modify!
                BlockNum;       // Internal Data - do not modify!
  BOOL          NotFound;       // Internal Data - do not modify!

  char          Data[];
} UNIT_USER;

typedef UNIT_ANY        *UNIT_PTR;
typedef UNIT_OBJECT     *UNIT_OBJECT_PTR;
typedef UNIT_BLOCK      *UNIT_BLOCK_PTR;
typedef UNIT_INSTANCE   *UNIT_INSTANCE_PTR;
typedef UNIT_USER       *UNIT_USER_PTR;

//------ Definitions for Unit Enumeration --------------------------------------------------------------

typedef struct {
  DPOINT        p1,
                p2,
                p3,
                p4,
                p5;

  int           Pen,
                Layer;

  double        Len,
                Start,
                Bogen;

  DRECT         Rect;

  int           Type,
                Flag,
                Count;

  BOOL          Orient,
                Valid;
} GEO_OBJECT;

typedef struct {
  int                   EnumData,
                        EnumCount,

                        EnumFlag1,
                        EnumFlag2,
                        EnumMode;

  BOOL                  EnumStopped;

  XPROPERTY             XProperty;

  FONTDEF               Font;
  double                CharDistance,
                        TabDistance,
                        LineDistance;
  int                   TextMode;

  DPOINT*               PointPtr;
  int*                  TypePtr;
  MATRIX*               MatrixPtr;
  LPSTR                 TextPtr,
                        NamePtr;

  UNIT_OBJECT_PTR       ObjPtr;
  UNIT_INSTANCE_PTR     InstPtr;
  UNIT_BLOCK_PTR        BlockPtr;
  UNIT_USER_PTR         UserPtr;
} ENUMDEF_DATA;

typedef BOOL (*TOSOENUMOBJECT_PROC)( const ENUMDEF_DATA* EnumData );

typedef BOOL (*TOSOENUMATTRIB_PROC)( int AttribType, const LPSTR AttribName, const LPSTR AttribValue );

typedef BOOL (*TOSOENUMIDENT_PROC) ( UNIT_PTR UnitPtr );

typedef BOOL (*TOSOENUMPOINTS_PROC) ( UNIT_PTR UnitPtr, BLOCK_PTR BlockPtr );

//------ Definitions for Hooks -------------------------------------------------------------------------

typedef void (*TOSOHOOKPOSITION_PROC)( int WindowNum, DPOINT* Position );

typedef void (*TOSOHOOKMOUSE_PROC)( int WindowNum, UINT Message, UINT Buttons, int XPos, int YPos );

typedef void (*TOSOHOOKKEY_PROC)( int WindowNum, UINT Message, int Key, long Data );

//------ Definitions for Module-To-Server Communication ------------------------------------------------

typedef BOOL (*TOSOMODULECOMMAND_PROC)( int CommandID, int ExecMode );

typedef BOOL (*TOSOMODULEMODIFY_PROC)( UNIT_USER_PTR UserObj, int ModifyMode, const MATRIX* Matrix );

typedef int (*TOSOINPUTPOINTINIT_PROC)( int CommandID, int PointIndex, double XPos, double YPos );

typedef BOOL (*TOSOINPUTPOINTMOVE_PROC)( int CommandID, int PointIndex, double XPos, double YPos );

typedef int (*TOSOINPUTPOINTEXIT_PROC)( int CommandID, int PointIndex, double XPos, double YPos );

typedef void (*TOSOINPUTDISPLAY_PROC)( int CommandID, int PointIndex, HDC hDrawDC, BOOL DrawFixed, BOOL DrawVariable );

typedef BOOL (*TOSOINPUTPARAMETER_PROC)( int CommandID );

typedef int (*TOSOINPUTCANCEL_PROC)( int CommandID, int PointCount );

typedef void (*TOSOINPUTFINISH_PROC)( int CommandID, int PointCount );

typedef struct {                                // Menu entry and its description
  LPSTR                 Description,
                        MenuEntry;
} MENU_DATA;

typedef struct {                                // Input Information for indirect command
  int                   CommandMode,
                        PointNumber,
                        PointTypes   [TVG_INPUT_DEF_MAX],
                        PointRelative[TVG_INPUT_DEF_MAX];
  LPSTR                 PointNames   [TVG_INPUT_DEF_MAX];
} COMMAND_DATA;

typedef struct {                                // Icon definition for a command
  int                   Type;
  MENU_DATA             MenuData;
  COMMAND_DATA          InputData;
  HBITMAP               IconHandle;
  int                   IconXOffset,
                        IconYOffset,
                        IconMode;
} MODULE_COMMAND_DATA;

typedef struct {                                // Module-internal callback procedures
  TOSOINPUTPOINTINIT_PROC       InputPointInitProc;
  TOSOINPUTPOINTMOVE_PROC       InputPointMoveProc;
  TOSOINPUTPOINTEXIT_PROC       InputPointExitProc;
  TOSOINPUTDISPLAY_PROC         InputDisplayProc;
  TOSOINPUTPARAMETER_PROC       InputParameterProc;
  TOSOINPUTCANCEL_PROC          InputCancelProc;
  TOSOINPUTFINISH_PROC          InputFinishProc;
} MODULE_PROC;

typedef struct {                                // Module identification structure
  short                 OwnerID,
                        ModuleID;
  int                   ModuleCTRL;
  MODULE_PROC           ModuleProc;
  MODULE_COMMAND_DATA   ModuleData;
  MODULE_COMMAND_DATA*  CommandData;
} MODULE_ID;

typedef struct {                                // Module data
  MODULE_ID                     ID;
  HINSTANCE                     Handle;
  TOSOMODULECOMMAND_PROC        ProcCommand;
  TOSOMODULEMODIFY_PROC         ProcModify;
} MODULE_DATA;

typedef BOOL (*TOSOMODULEINIT_PROC)( const LPSTR SerialNumber, HINSTANCE hMainInst, HWND hMainWnd,
                                                               int InterfaceVersion, MODULE_ID* ModuleID );

typedef BOOL (*TOSOMODULEEXIT_PROC)( void );

//------ Toso Interface Prototypes ---------------------------------------------------------------------

#ifndef TOSO_SERVER                             // Only visible outside the serving application!

DLL_IMPORT BOOL TosoCreationStart( void );

DLL_IMPORT void TosoCreationEnd( void );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT UNIT_OBJECT_PTR TosoObjectOpen( int Type );

DLL_IMPORT UNIT_OBJECT_PTR TosoObjectGetAddress( void );

DLL_IMPORT BOOL TosoObjectAddPoint( int Type, double x, double y );

DLL_IMPORT BOOL TosoObjectAddConstant( double Value );

DLL_IMPORT BOOL TosoObjectAddOrient( double Orient );

DLL_IMPORT BOOL TosoObjectAddCurve( double Orient, double Curve );

DLL_IMPORT BOOL TosoObjectAddTextShort( const LPSTR Text, BOOL StaticLength );

DLL_IMPORT BOOL TosoObjectAddTextLong( const LPSTR Text, BOOL StaticLength );

DLL_IMPORT XPROPERTY* TosoObjectAddDimLine( const DIMLINE* Data );

DLL_IMPORT XPROPERTY* TosoObjectAddDimSmall( const DIMSMALL* Data, BOOL UseGlobal );

DLL_IMPORT XPROPERTY* TosoObjectAddDimLarge( const DIMLARGE* Data, BOOL UseGlobal );

DLL_IMPORT XPROPERTY* TosoObjectAddTextStandard( const TEXTSTANDARD* Data );

DLL_IMPORT XPROPERTY* TosoObjectAddTextFrame( const TEXTFRAME* Data );

DLL_IMPORT BOOL TosoObjectAddTextReference( const TEXTREFERENCE* Data );

DLL_IMPORT XPROPERTY* TosoObjectAddClipSurface( const CLIPSURFACE* Data );

DLL_IMPORT BOOL TosoObjectAddBitmapRef( const BITMAPREF* Data );

DLL_IMPORT BOOL TosoObjectAddEnd( void );

DLL_IMPORT BOOL TosoObjectCopyDataBlocks( const UNIT_OBJECT_PTR RefObj );

DLL_IMPORT UNIT_OBJECT_PTR TosoObjectInsert( int DrawingNum, const UNIT_PTR RefObj );

DLL_IMPORT void TosoObjectClose( void );

DLL_IMPORT BOOL TosoObjectFastInsert( void );

DLL_IMPORT UNIT_USER_PTR TosoUserOpen( int OwnerID, int Type );

DLL_IMPORT UNIT_USER_PTR TosoUserGetAddress( void );

DLL_IMPORT BOOL TosoUserAddDataBlock( int Type, int ElemType, int ElemCount, const LPVOID Data, int Bytes );

DLL_IMPORT BOOL TosoUserAddEnd( void );

DLL_IMPORT UNIT_USER_PTR TosoUserInsert( int DrawingNum, const UNIT_PTR RefObj );

DLL_IMPORT void TosoUserClose( void );

DLL_IMPORT BOOL TosoUserFastInsert( void );

DLL_IMPORT UNIT_INSTANCE_PTR TosoInstanceOpen( void );

DLL_IMPORT UNIT_INSTANCE_PTR TosoInstanceGetAddress( void );

DLL_IMPORT BOOL TosoInstanceAddAttribute( int Type, const LPSTR Name, const LPSTR Text );

DLL_IMPORT BOOL TosoInstanceAddEnd( void );

DLL_IMPORT UNIT_INSTANCE_PTR TosoInstanceInsert( int DrawingNum, const UNIT_PTR RefObj );

DLL_IMPORT void TosoInstanceClose( void );

DLL_IMPORT BOOL TosoInstanceFastInsert( void );

DLL_IMPORT UNIT_BLOCK_PTR TosoBlockOpen( void );

DLL_IMPORT UNIT_BLOCK_PTR TosoBlockGetAddress( void );

DLL_IMPORT BOOL TosoBlockAddAttribute( int Type, const LPSTR Name, const LPSTR Text );

DLL_IMPORT BOOL TosoBlockAddEnd( void );

DLL_IMPORT UNIT_BLOCK_PTR TosoBlockInsert( int DrawingNum, const LPSTR LibraryName );

DLL_IMPORT void TosoBlockClose( void );

DLL_IMPORT XPROPERTY* TosoBlockFastInsert( BOOL CreateInstance, const MATRIX* Matrix );

DLL_IMPORT UNIT_BLOCK_PTR TosoGroupOpen( void );

DLL_IMPORT UNIT_BLOCK_PTR TosoGroupGetAddress( void );

DLL_IMPORT BOOL TosoGroupAddEnd( void );

DLL_IMPORT UNIT_BLOCK_PTR TosoGroupInsert( int DrawingNum );

DLL_IMPORT void TosoGroupClose( void );

DLL_IMPORT XPROPERTY* TosoGroupFastInsert( BOOL CreateInstance, const MATRIX* Matrix );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoPageGetDef( int DrawingNum, PAGEDEF* Data );

DLL_IMPORT BOOL TosoPageSetDef( int DrawingNum, const PAGEDEF* Data );

DLL_IMPORT BOOL TosoHatchGetCurrentDef( HATCHDEF* Data );

DLL_IMPORT BOOL TosoHatchGetOrigin( int DrawingNum, DPOINT* Data );

DLL_IMPORT BOOL TosoHatchGetDef( int DrawingNum, int Index, HATCHDEF* Data );

DLL_IMPORT BOOL TosoHatchSetDef( int DrawingNum, int Index, const HATCHDEF* Data );

DLL_IMPORT int TosoHatchGetActive( int DrawingNum );

DLL_IMPORT BOOL TosoHatchSetActive( int DrawingNum, int Index );

DLL_IMPORT BOOL TosoMultiLineGetDef( int DrawingNum, int Index, MULTILINEDEF* Data );

DLL_IMPORT BOOL TosoMultiLineSetDef( int DrawingNum, int Index, const MULTILINEDEF* Data );

DLL_IMPORT BOOL TosoSystemGetCurrentDef( SYSTEMDEF* Data );

DLL_IMPORT BOOL TosoSystemGetDef( int DrawingNum, int Index, SYSTEMDEF* Data );

DLL_IMPORT BOOL TosoSystemSetDef( int DrawingNum, int Index, const SYSTEMDEF* Data );

DLL_IMPORT int TosoSystemGetActive( int DrawingNum, int WindowNum );

DLL_IMPORT BOOL TosoSystemSetActive( int DrawingNum, int WindowNum, int Index );

DLL_IMPORT BOOL TosoPenGetCurrentDef( PENDEF* Data );

DLL_IMPORT BOOL TosoPenGetDef( int DrawingNum, int Index, PENDEF* Data );

DLL_IMPORT BOOL TosoPenSetDef( int DrawingNum, int Index, const PENDEF* Data );

DLL_IMPORT int TosoPenGetActive( int DrawingNum );

DLL_IMPORT BOOL TosoPenSetActive( int DrawingNum, int Index );

DLL_IMPORT BOOL TosoLineGetDef( int DrawingNum, int Index, LINEDEF* Data );

DLL_IMPORT BOOL TosoLineSetDef( int DrawingNum, int Index, const LINEDEF* Data );

DLL_IMPORT BOOL TosoLayerGetCurrentDef( LAYERDEF* Data );

DLL_IMPORT BOOL TosoLayerGetDef( int DrawingNum, int Index, LAYERDEF* Data );

DLL_IMPORT BOOL TosoLayerSetDef( int DrawingNum, int Index, const LAYERDEF* Data );

DLL_IMPORT int TosoLayerGetActive( int DrawingNum );

DLL_IMPORT BOOL TosoLayerSetActive( int DrawingNum, int Index );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT int TosoImportGetNumber( void );

DLL_IMPORT BOOL TosoImportGetData( int Index, MODULE_DATA* ModuleData );

DLL_IMPORT int TosoExportGetNumber( void );

DLL_IMPORT BOOL TosoExportGetData( int Index, MODULE_DATA* ModuleData );

DLL_IMPORT int TosoModuleGetNumber( void );

DLL_IMPORT BOOL TosoModuleGetData( int Index, MODULE_DATA* ModuleData );

DLL_IMPORT void TosoCommandInternal( int CommandID );

DLL_IMPORT void TosoUndoInitProcess( void );

DLL_IMPORT void TosoUndoCancelProcess( void );

DLL_IMPORT void TosoUndoFinishProcess( void );

DLL_IMPORT void TosoUndoUpdateLinks( void );

DLL_IMPORT void TosoUndoSetPrevious( void );

DLL_IMPORT BOOL TosoHookPositionStart( TOSOHOOKPOSITION_PROC CallBack );

DLL_IMPORT void TosoHookPositionEnd( TOSOHOOKPOSITION_PROC CallBack );

DLL_IMPORT BOOL TosoHookMouseStart( TOSOHOOKMOUSE_PROC CallBack );

DLL_IMPORT void TosoHookMouseEnd( TOSOHOOKMOUSE_PROC CallBack );

DLL_IMPORT BOOL TosoHookKeyStart( TOSOHOOKKEY_PROC CallBack );

DLL_IMPORT void TosoHookKeyEnd( TOSOHOOKKEY_PROC CallBack );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoProfileReadKeyOpen( const LPSTR KeyName, BOOL Common );

DLL_IMPORT BOOL TosoProfileReadInt( const LPSTR ValueName, int* Value );

DLL_IMPORT BOOL TosoProfileReadString( const LPSTR ValueName, LPSTR Value );

DLL_IMPORT BOOL TosoProfileReadData( const LPSTR ValueName, LPBYTE Value, int Size );

DLL_IMPORT void TosoProfileReadKeyClose( void );

DLL_IMPORT BOOL TosoProfileWriteKeyOpen( const LPSTR KeyName, BOOL Common );

DLL_IMPORT BOOL TosoProfileWriteInt( const LPSTR ValueName, int Value );

DLL_IMPORT BOOL TosoProfileWriteString( const LPSTR ValueName, const LPSTR Value );

DLL_IMPORT BOOL TosoProfileWriteData( const LPSTR ValueName, const LPBYTE Value, int Size );

DLL_IMPORT void TosoProfileWriteKeyClose( void );

DLL_IMPORT BOOL TosoProfileDeleteKey( const LPSTR KeyName, BOOL Common );

DLL_IMPORT int TosoProfileGetDrawing( int DrawingNum, short OwnerID, int ProfileID, LPVOID ProfileData, int Size );

DLL_IMPORT BOOL TosoProfileSetDrawing( int DrawingNum, short OwnerID, int ProfileID, const LPVOID ProfileData, int Size );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT int TosoSettingGet( int Mode );

DLL_IMPORT void TosoSettingSet( int Mode, int Value );

DLL_IMPORT BOOL TosoDrawingNewFile( int DrawingNum, BOOL Prompt );

DLL_IMPORT BOOL TosoDrawingOpenFile( int DrawingNum, const LPSTR FileName, LONG OpenFlags, BOOL Prompt );

DLL_IMPORT BOOL TosoDrawingSaveFile( int DrawingNum, const LPSTR FileName, LONG SaveFlags, BOOL Prompt );

DLL_IMPORT int TosoDrawingGetActive( void );

DLL_IMPORT BOOL TosoDrawingSetActive( int DrawingNum );

DLL_IMPORT int TosoDrawingGetNumber( void );

DLL_IMPORT BOOL TosoDrawingGetInfo( int DrawingNum, LPSTR FileName, FILE_HEADER* FileHeader );

DLL_IMPORT int TosoLibraryGetNumber( void );

DLL_IMPORT BOOL TosoLibraryGetInfo( int LibraryNum, LPSTR FileName, FILE_HEADER* FileHeader );

DLL_IMPORT int TosoWindowGetMode( int DrawingNum );

DLL_IMPORT BOOL TosoWindowSetMode( int DrawingNum, int Mode );

DLL_IMPORT int TosoWindowGetActive( int DrawingNum );

DLL_IMPORT BOOL TosoWindowSetActive( int DrawingNum, int WindowNum );

DLL_IMPORT BOOL TosoWindowGetView( int DrawingNum, int WindowNum, DPOINT* Center, double* Zoom );

DLL_IMPORT BOOL TosoWindowSetViewAll( int DrawingNum, int WindowNum );

DLL_IMPORT BOOL TosoWindowSetViewPage( int DrawingNum, int WindowNum );

DLL_IMPORT BOOL TosoWindowSetViewScale( int DrawingNum, int WindowNum, const DPOINT* Center, double Zoom );

DLL_IMPORT BOOL TosoWindowSetViewArea( int DrawingNum, int WindowNum, const DPOINT* Point1, const DPOINT* Point2 );

DLL_IMPORT void TosoDrawWindowAll( void );

DLL_IMPORT void TosoDrawWindowArea( const DRECT* Data );

DLL_IMPORT void TosoDrawWindowSelection( BOOL ClearFlag );

DLL_IMPORT void TosoDrawNewObjects( void );

DLL_IMPORT void TosoDrawBlock( HWND hWindow, int DrawingNum, const LPSTR BlockName, const LPSTR LibraryName );

DLL_IMPORT void TosoDrawLineDef( HWND hWindow, LINEDEF* LineDef );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT void TosoInitProperty( PROPERTY* Data );

DLL_IMPORT void TosoInitXProperty( XPROPERTY* Data );

DLL_IMPORT void TosoInitFontDef( FONTDEF* Data );

DLL_IMPORT void TosoInitDimLine( DIMLINE* Data );

DLL_IMPORT void TosoInitDimSmall( DIMSMALL* Data, BOOL UseGlobal );

DLL_IMPORT void TosoInitDimLarge( DIMLARGE* Data, BOOL UseGlobal );

DLL_IMPORT void TosoInitTextStandard( TEXTSTANDARD* Data1, TEXTREFERENCE* Data2 );

DLL_IMPORT void TosoInitTextFrame( TEXTFRAME* Data );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT UINT TosoDialogHelpMessage( void );

DLL_IMPORT BOOL TosoDialogEnterIdle( HWND hDlg, WPARAM wParam, LPARAM lParam );

DLL_IMPORT void TosoDialogComboboxAdjust( HWND hDlg, int CtlID );

DLL_IMPORT void TosoDialogCustomButtonColor( const LPDRAWITEMSTRUCT DrawItem, COLORREF Color, BOOL Active );

DLL_IMPORT void TosoDialogCustomButtonText( const LPDRAWITEMSTRUCT DrawItem, const LPSTR Text, BOOL Active );

DLL_IMPORT void TosoDialogCustomButtonIcon( const LPDRAWITEMSTRUCT DrawItem, HICON hIcon, BOOL Active );

DLL_IMPORT void TosoDialogCustomListboxColor( const LPDRAWITEMSTRUCT DrawItem, COLORREF Color, const LPSTR Text );

DLL_IMPORT void TosoDialogCenter( HWND hWindow );

DLL_IMPORT BOOL TosoDialogSelection( HWND hWindow, const LPSTR Caption );

DLL_IMPORT BOOL TosoDialogColor( HWND hWindow, const LPSTR Caption, COLORREF* Data );

DLL_IMPORT BOOL TosoDialogProperty( HWND hWindow, const LPSTR Caption, PROPERTY* Data );

DLL_IMPORT BOOL TosoDialogXProperty( HWND hWindow, const LPSTR Caption, XPROPERTY* Data );

DLL_IMPORT BOOL TosoDialogFontDef( HWND hWindow, const LPSTR Caption, FONTDEF* Data );

DLL_IMPORT BOOL TosoDialogDimLine( HWND hWindow, const LPSTR Caption, DIMLINE* Data, int UseFlag );

DLL_IMPORT BOOL TosoDialogDimSmall( HWND hWindow, const LPSTR Caption, DIMSMALL* Data, BOOL UseGlobal, int UseFlag );

DLL_IMPORT BOOL TosoDialogDimLarge( HWND hWindow, const LPSTR Caption, DIMLARGE* Data, BOOL UseGlobal, int UseFlag );

DLL_IMPORT BOOL TosoDialogTextStandard( HWND hWindow, const LPSTR Caption,
                                        TEXTSTANDARD* Data1, TEXTREFERENCE* Data2, LPSTR EditText );

DLL_IMPORT BOOL TosoDialogTextFrame( HWND hWindow, const LPSTR Caption, TEXTFRAME* Data, LPSTR EditText );

DLL_IMPORT BOOL TosoDialogBlock( HWND hWindow, const LPSTR Caption,
                                 LPSTR BlockName, LPSTR LibraryName, BOOL LibChangePossible );

DLL_IMPORT void TosoDialogSelectLine( HWND hWnd, const RECT* ButtonRect,
                                      int Current, int BasicID, int ExtraID, int EditID );

DLL_IMPORT void TosoDialogSelectMultiLine( HWND hWnd, const RECT* ButtonRect,
                                           int Current, int BasicID, int ExtraID, int EditID );

DLL_IMPORT void TosoDialogSelectSystem( HWND hWnd, const RECT* ButtonRect,
                                        int Current, int BasicID, int ExtraID, int EditID );

DLL_IMPORT void TosoDialogSelectHatch( HWND hWnd, const RECT* ButtonRect,
                                       int Current, int BasicID, int ExtraID, int EditID );

DLL_IMPORT void TosoDialogSelectLayer( HWND hWnd, const RECT* ButtonRect,
                                      int Current, int BasicID, int ExtraID, int EditID );

DLL_IMPORT void TosoDialogSelectPen( HWND hWnd, const RECT* ButtonRect,
                                     int Current, int BasicID, int ExtraID, int EditID );

DLL_IMPORT void TosoDialogUpdateGuide( int GuideMode, LPSTR GuideText );

DLL_IMPORT BOOL TosoDialogShowProgress( const LPSTR Title, const LPSTR Text, BOOL HasPercentBar );

DLL_IMPORT void TosoDialogUpdateProgress( const LPSTR Text1, const LPSTR Text2, long Done, long Total );

DLL_IMPORT void TosoDialogHideProgress( void );

DLL_IMPORT BOOL TosoDialogIsCanceled( void );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoConvertIntString( LPSTR Text, int Value );

DLL_IMPORT BOOL TosoConvertDoubleString( LPSTR Text, double Value );

DLL_IMPORT BOOL TosoConvertDoubleStringEx( LPSTR Text, double Value, int TotalLen, int FractionLen );

DLL_IMPORT BOOL TosoConvertLengthString( LPSTR Text, double Value, LPSTR Unit );

DLL_IMPORT BOOL TosoConvertWidthString( LPSTR Text, double Value, LPSTR Unit );

DLL_IMPORT BOOL TosoConvertAngleString( LPSTR Text, double Value, LPSTR Unit );

DLL_IMPORT BOOL TosoConvertStringInt( int* Value, const LPSTR Text );

DLL_IMPORT BOOL TosoConvertStringDouble( double* Value, const LPSTR Text, HWND hParentWindow );

DLL_IMPORT BOOL TosoConvertStringDoubleEx( double* Value, const LPSTR Text, HWND hParentWindow,
                                           double LenMMPerUnit, double AngleRadPerUnit );

DLL_IMPORT BOOL TosoConvertStringLength( double* Value, const LPSTR Text, HWND hParentWindow );

DLL_IMPORT BOOL TosoConvertStringWidth( double* Value, const LPSTR Text, HWND hParentWindow );

DLL_IMPORT BOOL TosoConvertStringAngle( double* Value, const LPSTR Text, HWND hParentWindow );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoGetCommandTitle( LPSTR Text, int CommandID );

DLL_IMPORT HBITMAP TosoGetCommandIcon( int CommandID );

DLL_IMPORT HICON TosoGetStandardIcon( const LPSTR IconID );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoMatrixSeparate( const MATRIX* Matrix, double* ScaleX,   double* ScaleY,
                                                          double* Rotation, double* Distortion,
                                                          double* MoveX,    double* MoveY );

DLL_IMPORT BOOL TosoMatrixAssemble( MATRIX* Matrix, double ScaleX,   double ScaleY,
                                                    double Rotation, double Distortion,
                                                    double MoveX,    double MoveY );

DLL_IMPORT BOOL TosoMatrixInvert( const MATRIX* Matrix, MATRIX* InvertMatrix );

DLL_IMPORT void TosoMatrixInit( MATRIX* Matrix );

DLL_IMPORT void TosoMatrixRotate( MATRIX* Matrix, double Angle );

DLL_IMPORT void TosoMatrixMove( MATRIX* Matrix, double OffsetX, double OffsetY );

DLL_IMPORT void TosoMatrixScale( MATRIX* Matrix, double FactorX, double FactorY );

DLL_IMPORT void TosoMatrixSheer( MATRIX* Matrix, double FactorX, double FactorY );

DLL_IMPORT void TosoMatrixMultiply( MATRIX* Matrix, const MATRIX* Factor );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoCalcTextFrame( const TEXTSTANDARD* Data, const LPSTR Text, DRECT* Frame );

DLL_IMPORT BOOL TosoCalcBlockFrame( int DrawingNum, const LPSTR BlockName, const LPSTR LibraryName,
                                    const MATRIX* Matrix, DRECT* Frame, BOOL AutoLoad );

DLL_IMPORT BOOL TosoCalcCurvature( double x1, double y1,
                                   double x2, double y2, double x3, double y3, double* Result );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoGeoDistance( const GEO_OBJECT* GeoObj, double x, double y, double* Result );

DLL_IMPORT int TosoGeoIntersection( const GEO_OBJECT* GeoObj1, const GEO_OBJECT* GeoObj2, DPOINT* Result );

DLL_IMPORT int TosoGeoPerpendicular( const GEO_OBJECT* GeoObj, double x, double y, DPOINT* Result );

DLL_IMPORT int TosoGeoTangent( const GEO_OBJECT* GeoObj1, const GEO_OBJECT* GeoObj2, DPOINT* Result );

DLL_IMPORT int TosoGeoRadiusFit( const GEO_OBJECT* GeoObj1,
                                 const GEO_OBJECT* GeoObj2, double Radius, int ObjType, GEO_OBJECT* Result );

DLL_IMPORT int TosoGeoIncircle( const DPOINT* Point1, const DPOINT* Point2,
                                const DPOINT* Point3, DPOINT* Result );

DLL_IMPORT int TosoGeoCircumcircle( const DPOINT* Point1, const DPOINT* Point2,
                                    const DPOINT* Point3, DPOINT* Result );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoEnumerateAll( int DrawingNum, int EnumFlag1, int EnumFlag2,
                                  int EnumMode, TOSOENUMOBJECT_PROC CallBack );

DLL_IMPORT BOOL TosoEnumerateLibrary( int DrawingNum, const LPSTR LibraryName,
                                      int EnumMode, TOSOENUMOBJECT_PROC CallBack );

DLL_IMPORT BOOL TosoEnumerateUnit( int DrawingNum, const UNIT_PTR UnitPtr,
                                   int EnumMode, TOSOENUMOBJECT_PROC CallBack );

DLL_IMPORT BOOL TosoEnumerateBlock( int DrawingNum, const LPSTR BlockName, const LPSTR LibraryName,
                                    int EnumMode, TOSOENUMOBJECT_PROC CallBack );

DLL_IMPORT BOOL TosoEnumerateChar( int DrawingNum, const FONTDEF* Font, int CharIndex, const MATRIX* Matrix,
                                   int EnumMode, TOSOENUMOBJECT_PROC CallBack );

DLL_IMPORT int TosoEnumerateInstanceAttrib( int DrawingNum, const UNIT_INSTANCE_PTR InstObj,
                                            TOSOENUMATTRIB_PROC CallBack );

DLL_IMPORT int TosoEnumerateBlockAttrib( int DrawingNum, const LPSTR BlockName, const LPSTR LibraryName,
                                         TOSOENUMATTRIB_PROC CallBack );

DLL_IMPORT BOOL TosoEnumerateIdent( int DrawingNum, TOSOENUMIDENT_PROC CallBack );

DLL_IMPORT BOOL TosoEnumeratePoints( int DrawingNum, TOSOENUMPOINTS_PROC CallBack );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT void TosoInputDrawPoint( HDC hDrawDC, double x, double y );

DLL_IMPORT void TosoInputDrawLine( HDC hDrawDC, double x1, double y1, double x2, double y2 );

DLL_IMPORT void TosoInputDrawEndless( HDC hDrawDC, double x1, double y1, double x2, double y2 );

DLL_IMPORT void TosoInputDrawBezier( HDC hDrawDC, double x1, double y1, double x2, double y2,
                                                  double x3, double y3, double x4, double y4 );

DLL_IMPORT void TosoInputDrawFrame( HDC hDrawDC, double x1, double y1, double x2, double y2,
                                                 double x3, double y3, double x4, double y4 );

DLL_IMPORT void TosoInputDrawCircle( HDC hDrawDC, double x1, double y1, double x2, double y2 );

DLL_IMPORT void TosoInputDrawCircleArc( HDC hDrawDC, double x1, double y1, double x2, double y2,
                                                     double x3, double y3, double x4, double y4, BOOL Positive );

DLL_IMPORT void TosoInputDrawEllipse( HDC hDrawDC, double x1, double y1,
                                                   double x2, double y2, double x3, double y3 );

DLL_IMPORT void TosoInputDrawEllipseArc( HDC hDrawDC, double x1, double y1,
                                                      double x2, double y2, double x3, double y3,
                                                      double x4, double y4, double x5, double y5, BOOL Positive );

DLL_IMPORT void TosoInputDrawReference( HDC hDrawDC, const GEO_OBJECT* GeoObject );

DLL_IMPORT int TosoInputGetIdentData( int DrawingNum, int PointIndex, GEO_OBJECT* GeoObject );

DLL_IMPORT int TosoInputGetIdentObject( int DrawingNum, int PointIndex, GEO_OBJECT* GeoObject );

DLL_IMPORT UNIT_PTR TosoInputGetIdentAddress( int DrawingNum, int PointIndex );

DLL_IMPORT int TosoInputGetGeneratedSurface( int DrawingNum, int PointIndex, int PointCount,
                                             UNIT_PTR ResultObj, int Bytes );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT long TosoEditIdentCount( int DrawingNum, DRECT* Frame );

DLL_IMPORT BOOL TosoEditIdentMatrix( int DrawingNum, const MATRIX* Matrix, BOOL Duplicate );

DLL_IMPORT BOOL TosoEditIdentEnumModify( int DrawingNum, TOSOENUMOBJECT_PROC CallBack, BOOL Duplicate );

DLL_IMPORT void TosoEditDelete( int DrawingNum, UNIT_PTR UnitPtr );

DLL_IMPORT long TosoEditPointsCount( int DrawingNum, DRECT* Frame );

DLL_IMPORT BOOL TosoEditPointsMatrix( int DrawingNum, const MATRIX* Matrix, BOOL Duplicate );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoFileSetExtension( const LPSTR OldName, LPSTR NewName, const LPSTR Extension );

DLL_IMPORT BOOL TosoFileGetExtension( const LPSTR FullName, LPSTR Extension );

DLL_IMPORT BOOL TosoFileShortName( const LPSTR FullName, LPSTR ShortName );

DLL_IMPORT BOOL TosoFileSplitName( const LPSTR FullName, LPSTR Path, LPSTR Name );

DLL_IMPORT BOOL TosoFileFullPath( const LPSTR OldName, LPSTR NewName );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoFileExist( const LPSTR FileName );

DLL_IMPORT BOOL TosoFileDelete( const LPSTR FileName );

DLL_IMPORT BOOL TosoFileOpen( HANDLE* FileHandle, const LPSTR FileName );

DLL_IMPORT BOOL TosoFileCreate( HANDLE* FileHandle, const LPSTR FileName );

DLL_IMPORT long TosoFileSize( HANDLE FileHandle );

DLL_IMPORT long TosoFileRead( HANDLE FileHandle, LPVOID Data, long Size );

DLL_IMPORT long TosoFileWrite( HANDLE FileHandle, const LPVOID Data, long Size );

DLL_IMPORT BOOL TosoFileSetPointer( HANDLE FileHandle, long Offset, DWORD Mode );

DLL_IMPORT BOOL TosoFileClose( HANDLE FileHandle );

DLL_IMPORT BOOL TosoFileCopy( const LPSTR SourceName, const LPSTR DestinName );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoFileWriteInitNull( void );

DLL_IMPORT BOOL TosoFileWriteInitDisk( HANDLE FileHandle );

DLL_IMPORT BOOL TosoFileWriteInitMemory( HGLOBAL hMemory, long MemorySize );

DLL_IMPORT BOOL TosoFileWriteData( const LPVOID Data, int Size );

DLL_IMPORT BOOL TosoFileWriteTextData( const LPSTR Data );

DLL_IMPORT BOOL TosoFileWriteFlush( void );

DLL_IMPORT void TosoFileWriteExit( void );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT void TosoFileWriteNewline( void );

DLL_IMPORT void TosoFileWriteComma( void );

DLL_IMPORT void TosoFileWriteSemi( void );

DLL_IMPORT void TosoFileWriteComment( const LPSTR Value );

DLL_IMPORT void TosoFileWriteKeyword( int KeyNum );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT void TosoFileWriteString( const LPSTR Value );
DLL_IMPORT void TosoFileWriteCommaString( const LPSTR Value );

DLL_IMPORT void TosoFileWriteBinary( const LPVOID Value, int Size );
DLL_IMPORT void TosoFileWriteCommaBinary( const LPVOID Value, int Size );

DLL_IMPORT void TosoFileWriteBool( BOOL Value );
DLL_IMPORT void TosoFileWriteCommaBool( BOOL Value );

DLL_IMPORT void TosoFileWriteShort( short Value );
DLL_IMPORT void TosoFileWriteCommaShort( short Value );

DLL_IMPORT void TosoFileWriteInt( int Value );
DLL_IMPORT void TosoFileWriteCommaInt( int Value );

DLL_IMPORT void TosoFileWriteDouble( double Value );
DLL_IMPORT void TosoFileWriteCommaDouble( double Value );

DLL_IMPORT void TosoFileWriteColorref( COLORREF Color );
DLL_IMPORT void TosoFileWriteCommaColorref( COLORREF Color );

DLL_IMPORT void TosoFileWriteFontdef( const FONTDEF* Font );
DLL_IMPORT void TosoFileWriteCommaFontdef( const FONTDEF* Font );

DLL_IMPORT void TosoFileWriteXProperty( const XPROPERTY* XProperty );
DLL_IMPORT void TosoFileWriteCommaXProperty( const XPROPERTY* XProperty );

DLL_IMPORT void TosoFileWriteProperty( const PROPERTY* Property );
DLL_IMPORT void TosoFileWriteCommaProperty( const PROPERTY* Property );

DLL_IMPORT void TosoFileWriteDimLine( const DIMLINE* DimLine );
DLL_IMPORT void TosoFileWriteCommaDimLine( const DIMLINE* DimLine );

DLL_IMPORT void TosoFileWriteDimSmall( const DIMSMALL* DimSmall );
DLL_IMPORT void TosoFileWriteCommaDimSmall( const DIMSMALL* DimSmall );

DLL_IMPORT void TosoFileWriteDimLarge( const DIMLARGE* DimLarge );
DLL_IMPORT void TosoFileWriteCommaDimLarge( const DIMLARGE* DimLarge );

DLL_IMPORT void TosoFileWriteTextStandard( const TEXTSTANDARD* TextStandard );
DLL_IMPORT void TosoFileWriteCommaTextStandard( const TEXTSTANDARD* TextStandard );

DLL_IMPORT void TosoFileWriteTextFrame( const TEXTFRAME* TextFrame );
DLL_IMPORT void TosoFileWriteCommaTextFrame( const TEXTFRAME* TextFrame );

DLL_IMPORT void TosoFileWriteTextReference( const TEXTREFERENCE* TextReference );
DLL_IMPORT void TosoFileWriteCommaTextReference( const TEXTREFERENCE* TextReference );

DLL_IMPORT void TosoFileWriteClipSurface( const CLIPSURFACE* ClipSurface );
DLL_IMPORT void TosoFileWriteCommaClipSurface( const CLIPSURFACE* ClipSurface );

DLL_IMPORT void TosoFileWriteBitmapRef( const BITMAPREF* BitmapRef );
DLL_IMPORT void TosoFileWriteCommaBitmapRef( const BITMAPREF* BitmapRef );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoFileWriteHeader( const LPSTR Header );

DLL_IMPORT BOOL TosoFileWriteEndOfFile( void );

DLL_IMPORT void TosoFileWriteZeros( BOOL Value );

DLL_IMPORT void TosoFileWriteDelimiters( const TOKEN_DATA* Data );

DLL_IMPORT BOOL TosoFileWriteError( void );

DLL_IMPORT long TosoFileWriteCurrentSize( void );

DLL_IMPORT long TosoFileWriteCurrentLine( void );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoFileReadInitDisk( HANDLE FileHandle );

DLL_IMPORT BOOL TosoFileReadInitMemory( HGLOBAL hMemory );

DLL_IMPORT BOOL TosoFileReadData( LPVOID Data, int Size );

DLL_IMPORT int TosoFileReadChar( void );

DLL_IMPORT BOOL TosoFileReadLine( LPSTR Data, int Size );

DLL_IMPORT void TosoFileReadExit( void );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT void TosoFileReadSemi( void );

DLL_IMPORT void TosoFileReadComma( void );

DLL_IMPORT BOOL TosoFileReadContinue( void );

DLL_IMPORT int TosoFileReadLastKeyword( void );

DLL_IMPORT void TosoFileReadKeyword( void );

DLL_IMPORT void TosoFileReadNextKeyword( void );

DLL_IMPORT void TosoFileReadNextSection( void );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT void TosoFileReadString( LPSTR Value, int Size );
DLL_IMPORT void TosoFileReadCommaString( LPSTR Value, int Size );

DLL_IMPORT void TosoFileReadBinary( LPVOID Value, int Size );
DLL_IMPORT void TosoFileReadCommaBinary( LPVOID Value, int Size );

DLL_IMPORT void TosoFileReadBool( BOOL* Value );
DLL_IMPORT void TosoFileReadCommaBool( BOOL* Value );

DLL_IMPORT void TosoFileReadShort( short* Value );
DLL_IMPORT void TosoFileReadCommaShort( short* Value );

DLL_IMPORT void TosoFileReadInt( int* Value );
DLL_IMPORT void TosoFileReadCommaInt( int* Value );

DLL_IMPORT void TosoFileReadDouble( double* Value );
DLL_IMPORT void TosoFileReadCommaDouble( double* Value );

DLL_IMPORT void TosoFileReadColorref( COLORREF* Color );
DLL_IMPORT void TosoFileReadCommaColorref( COLORREF* Color );

DLL_IMPORT void TosoFileReadFontdef( FONTDEF* Font );
DLL_IMPORT void TosoFileReadCommaFontdef( FONTDEF* Font );

DLL_IMPORT void TosoFileReadXProperty( XPROPERTY* XProperty );
DLL_IMPORT void TosoFileReadCommaXProperty( XPROPERTY* XProperty );

DLL_IMPORT void TosoFileReadProperty( PROPERTY* Property );
DLL_IMPORT void TosoFileReadCommaProperty( PROPERTY* Property );

DLL_IMPORT void TosoFileReadDimLine( DIMLINE* DimLine );
DLL_IMPORT void TosoFileReadCommaDimLine( DIMLINE* DimLine );

DLL_IMPORT void TosoFileReadDimSmall( DIMSMALL* DimSmall );
DLL_IMPORT void TosoFileReadCommaDimSmall( DIMSMALL* DimSmall );

DLL_IMPORT void TosoFileReadDimLarge( DIMLARGE* DimLarge );
DLL_IMPORT void TosoFileReadCommaDimLarge( DIMLARGE* DimLarge );

DLL_IMPORT void TosoFileReadTextStandard( TEXTSTANDARD* TextStandard );
DLL_IMPORT void TosoFileReadCommaTextStandard( TEXTSTANDARD* TextStandard );

DLL_IMPORT void TosoFileReadTextFrame( TEXTFRAME* TextFrame );
DLL_IMPORT void TosoFileReadCommaTextFrame( TEXTFRAME* TextFrame );

DLL_IMPORT void TosoFileReadTextReference( TEXTREFERENCE* TextReference );
DLL_IMPORT void TosoFileReadCommaTextReference( TEXTREFERENCE* TextReference );

DLL_IMPORT void TosoFileReadClipSurface( CLIPSURFACE* ClipSurface );
DLL_IMPORT void TosoFileReadCommaClipSurface( CLIPSURFACE* ClipSurface );

DLL_IMPORT void TosoFileReadBitmapRef( BITMAPREF* BitmapRef );
DLL_IMPORT void TosoFileReadCommaBitmapRef( BITMAPREF* BitmapRef );

//------------------------------------------------------------------------------------------------------

DLL_IMPORT BOOL TosoFileReadHeader( const LPSTR Header );

DLL_IMPORT BOOL TosoFileReadEndOfFile( void );

DLL_IMPORT void TosoFileReadDelimiters( const TOKEN_DATA* Data );

DLL_IMPORT BOOL TosoFileReadError( void );

DLL_IMPORT long TosoFileReadTotalSize( void );

DLL_IMPORT long TosoFileReadCurrentSize( void );

DLL_IMPORT long TosoFileReadCurrentLine( void );

#endif

//------------------------------------------------------------------------------------------------------

#endif
