home *** CD-ROM | disk | FTP | other *** search
/ PC Open 13 / pcopen13.iso / Zip / THINHELP.ZIP / support.lzh / SEG.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-26  |  6.1 KB  |  147 lines

  1. /* SEG.H -------------------------------------------------------*
  2.  * This Defined the SEGDATA-Structure used by SEG and THINHELP    *
  3.  * To Store Data-Correspondence between Positionon on the Srceen*
  4.  * and Help-Topic                        *
  5.  *--------------------------------------------------------------*/
  6.  
  7. #ifndef __SEG_H
  8. #define __SEG_H
  9.  
  10.  
  11. /* File-Structure of .SEG-Files had to be revised between JPANI Version 1.x
  12.    and ThinHelp. The new .SEG-Files are not Compatible to the old ones and
  13.    old Files have to be converted by SEG.EXE
  14.  
  15.    The main Reason for the Change in the File Structure is that we Felt it
  16.    to be neccessary to support Longer Macro-Strings especially in respect to
  17.    for Windows Help V4.0.
  18.  
  19.    There are also some more Dummy-Datafields for future enhancements as we
  20.    plan to implement several additional Features.
  21.  
  22.    To show the incompatibility of the Files the new SEG-Files to now use
  23.    a different SEG_MAGIC number.
  24. */
  25.  
  26. #define FILENAMELENGTH    256        // Maximum Length of a File-Name for .HPJ and .JPG/.BMP-File
  27. #define MAX_SEGINFOS    600        // Maximum Number of SEGJUMP-Entries in one SEG-File.
  28. #define MACROLENGTH     8000        // Maximum Length of a Macro-String... more or less a random Number...
  29. #define HOTSPOTIDLENGTH 200        // Maximum Length of a Macro-String... more or less a random Number...
  30.  
  31. #define SEG_MAGIC    12199           // Magic Number to show it's really one of our SEG-Files
  32.  
  33. #define SI_JUMP  0            // Markes Hotspot type: Jump
  34. #define SI_POPUP 1            //            Popup
  35. #define SI_MACRO 2            //            Macro
  36.  
  37.  
  38. /* SEGSTRINGs for Macros and Context-Strings have unlimeted Strings-Lengths
  39.    When loeaded into memory, the Application Program (THNHLP.DLL) stores
  40.    a Pointer to the String, on the Hard-Disk an offset into the SEG-File
  41.    is to be used instead.
  42.  
  43.    The End of the String is to be detected by the trailing Zero as usual in C
  44.  
  45.    Note that the Strings-Length is not limited by the way this File-Format is
  46.    defined but THNHLP.DLL 16-Bit will not allow to use more than about 4-8 KByte
  47.    of Strings at one time.
  48. */
  49. typedef union
  50.     {
  51.           DWORD  dw;               // Byte-Offset from the Beginning of the SEG-File
  52.           LPSTR  lpsz;                     // Pointer to the String when loaded into Memory by SEG.EXE
  53.         } SEGSTRING;
  54.  
  55.  
  56. /* SEGJUMP Structure defines one rectangular Hotspot-area that is connected to a
  57.    Context-String or Macro-Reference.
  58. */
  59. typedef struct
  60.     {  /* Rectangular Area for the Segment.
  61.               Note: This is NOT binary compatible To a RECT-Structure on WIN32 */
  62.            short    left, top, right, bottom;
  63.  
  64.  
  65.            /* WinHelp Macro-String to be executed when the user clicks onto the Hotspot.
  66.               For SI_POPUP and SI_JUMP this member contains the Context-String used for the Jump */
  67.        SEGSTRING    macro;
  68.  
  69.            /* The Hostspot Id is the String that SHED also allows to enter for our
  70.               Hotspot. It may be used later for special effects. */
  71.            SEGSTRING    HotspotId;
  72.  
  73.            /* Metafiles can be huge Pictures and are stored by Position into the file. */
  74.            DWORD     metapos,       // Position of the Metafile in the SEG File
  75.                      metalen;       // Length of the Metafile Information in the SEG File.
  76.  
  77.            /* Style-Control Flags */             
  78.            DWORD     flags;               // SI_xxxx Style Flags
  79.  
  80.            /* Variables reseved for future Definition. Must be Zero. */
  81.            DWORD    dwReserved[9];                 
  82.     }
  83.     SEGJUMP, FAR *LPSEGJUMP;
  84.  
  85.  
  86. typedef struct
  87.     {
  88.            short Magic;                       // Should Contain SEG_MAGIC
  89.            short SegJumpCount;                // Number of Segments currently available
  90.  
  91.            short Width, Height;              // Width and Height need to show ALL Hotspots
  92.  
  93.            //--------- Design-Time-only Information ----------------------------
  94.            char  PictureFileName[FILENAMELENGTH];// Filename of the Picture File that shall be shown at Design-Time
  95.            char  HpjFileName[FILENAMELENGTH];    // Filename of the .HPJ - File containing the Help Topic Jump IDs
  96.  
  97.            //--------- Help THNHLP to save memory ------------------------------
  98.            DWORD HeaderAndStringSize;         // Size of SEGINFOHEADER+SEGJUMP+Strings without Metafiles
  99.  
  100.            /* Variables reserved for future Definition. Must be Zero. */
  101.            DWORD dwReserved[10];
  102.     }
  103.     SEGINFOHEADER, FAR *LPSEGINFOHEADER;
  104.  
  105. /* A SEG_File consists of one SEGINFOHEADER-Structure followed by
  106.    SegJumpCount SEGJUMP-Structures, which may be followed by
  107.    Metafile- and String-Data.
  108.  
  109.    There are no Metafile- or string-Informations between the SEGJUMPs
  110.    or the SEGINFOHEADER and the SEGJUMPs
  111.  
  112.          +-------------------+-----------------+
  113.   0x000: | SEGINFOHEADER     | SegJumpCount=3  |
  114.          +-------------------+-----------------+
  115.   0x208: | SEGJUMP           | macro.dw=0x2aa  | --\
  116.          +-------------------+-----------------+   |
  117.   0x23e: | SEGJUMP           | macro.dw=0x2b2  | --+--\
  118.          +-------------------+-----------------+   |  |
  119.   0x27e: | SEGJUMP           | macro.dw=0x2bd  | --+--+--\
  120.          +-------------------+-----------------+   |  |  |
  121.                                                    |  |  |
  122.   0x2aa: "Print()\0" <-----------------------------/  |  |
  123.                                                       |  |
  124.   0x2b2: "JI(`',`ID_CONTENTS')\0" <-------------------/  |
  125.                                                          |
  126.   0x2bd: "About()\0" <-----------------------------------/
  127.  
  128.  
  129.  
  130.    SEG.EXE sorts the SEGJUMP-records by the size of the Rectangular
  131.    Area, so big Areas will be at the End of the File, thus scanning
  132.    from the Beginning of the File will find the smallest SEGJUMP
  133.    matching a given Point;
  134.  
  135.    The maximum Length of the File excluding Metafiles is 65535 Bytes, thus
  136.    limiting SegInfoCount to MAX_SEGINFOS.
  137.  
  138.    the metapos and metalen-Fields of a SEGJUMP give the starting-Position of a Metafile-
  139.    Byte-relative to the beginning of the File. The Metafile-Data is metalen bytes long.
  140.  
  141.    The "PictureFileName" and "HpjFileName"-Members are only used during SEG Editiing.
  142.    The are not requred by ThinHelp.
  143. */
  144.  
  145. #endif
  146.  
  147.