]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: readshg.h | |
3 | // Purpose: Petr Smilauer's .SHG (Segmented Hypergraphics file) reading | |
4 | // code. | |
5 | // Note: .SHG is undocumented (anywhere!) so this is | |
6 | // reverse-engineering | |
7 | // and guesswork at its best. | |
8 | // Author: Petr Smilauer | |
9 | // Modified by: | |
10 | // Created: 01/01/99 | |
11 | // RCS-ID: $Id$ | |
12 | // Copyright: (c) Petr Smilauer | |
13 | // Licence: wxWindows licence | |
14 | ///////////////////////////////////////////////////////////////////////////// | |
15 | ||
16 | #ifndef readshgh | |
17 | #define readshgh | |
18 | ||
19 | #include <stdio.h> | |
20 | #include <stdlib.h> | |
21 | ||
22 | typedef enum { TypePopup = 0xE2, TypeJump = 0xE3, TypeMacro = 0xC8} HotspotType; | |
23 | ||
24 | #define NOT_VISIBLE 0x04 | |
25 | ||
26 | typedef struct | |
27 | { | |
28 | unsigned char hotspotType;// combines HotspotType /w NOT_VISIBLE if appropriate | |
29 | unsigned char flag; // NOT_VISIBLE or 0 ?? | |
30 | unsigned char skip; // 0, always?? | |
31 | unsigned short left, | |
32 | top, | |
33 | width, // left+width/top+height give right/bottom, | |
34 | height; // =>right and bottom edge are not 'included' | |
35 | unsigned char magic[4]; // wonderful numbers: for macros, this seems | |
36 | // (at least first 2 bytes) to represent offset into macro-strings block. | |
37 | } ShgInfoBlock; // whole block is just 15 bytes long. How weird! | |
38 | ||
39 | #define OFF_OFFSET 0x20 // this is offset, where WORD (?) lies | |
40 | #define OFFSET_DELTA 9 // we must add this to get real offset from file beginning | |
41 | ||
42 | struct HotSpot | |
43 | { | |
44 | HotspotType type; | |
45 | unsigned int left, | |
46 | top, | |
47 | right, | |
48 | bottom; | |
49 | wxChar szHlpTopic_Macro[65]; | |
50 | bool IsVisible; | |
51 | }; | |
52 | ||
53 | // Returns the number of hotspots, and the array of hotspots. | |
54 | // E.g. | |
55 | // HotSpots *array; | |
56 | // int n = ParseSHG("thing.shg", &array); | |
57 | ||
58 | extern int ParseSHG( const wxChar* fileName, HotSpot **hotspots); | |
59 | ||
60 | // Converts Windows .SHG file to HTML map file | |
61 | extern bool SHGToMap(wxChar *filename, wxChar *defaultFile); | |
62 | ||
63 | #endif | |
64 |