winmm: dwBytesRecorded controls how much is played, not dwBufferLength.
[wine/hramrach.git] / programs / winhlp32 / hlpfile.h
blobf2c5b12fd283f3c823283f724b0f51f537c1bacb
1 /*
2 * Help Viewer
4 * Copyright 1996 Ulrich Schmid
5 * 2002, 2008 Eric Pouech
6 * 2007 Kirill K. Smirnov
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 struct tagHelpFile;
25 typedef struct
27 char type[10];
28 char name[9];
29 char caption[51];
30 POINT origin;
31 SIZE size;
32 int style;
33 DWORD win_style;
34 COLORREF sr_color; /* color for scrollable region */
35 COLORREF nsr_color; /* color for non scrollable region */
36 } HLPFILE_WINDOWINFO;
38 typedef struct tagHlpFileLink
40 enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
41 LPCSTR string; /* name of the file to for the link (NULL if same file) */
42 LONG hash; /* topic index */
43 unsigned bClrChange : 1; /* true if the link is green & underlined */
44 unsigned bHotSpot : 1; /* true if the link is an hotspot (actually HLPFILE_HOTSPOTLINK) */
45 unsigned window; /* window number for displaying the link (-1 is current) */
46 DWORD cpMin;
47 DWORD cpMax;
48 struct tagHlpFileLink* next;
49 } HLPFILE_LINK;
51 typedef struct tagHlpFileHotSpotLink
53 HLPFILE_LINK link;
54 unsigned x;
55 unsigned y;
56 unsigned width;
57 unsigned height;
58 } HLPFILE_HOTSPOTLINK;
60 typedef struct tagHlpFileMacro
62 LPCSTR lpszMacro;
63 struct tagHlpFileMacro* next;
64 } HLPFILE_MACRO;
66 typedef struct tagHlpFilePage
68 LPSTR lpszTitle;
69 HLPFILE_MACRO* first_macro;
71 HLPFILE_LINK* first_link;
73 unsigned wNumber;
74 unsigned offset;
75 DWORD reference;
76 struct tagHlpFilePage* next;
77 struct tagHlpFilePage* prev;
79 DWORD browse_bwd;
80 DWORD browse_fwd;
82 struct tagHlpFileFile* file;
83 } HLPFILE_PAGE;
85 typedef struct
87 LONG lMap;
88 unsigned long offset;
89 } HLPFILE_MAP;
91 typedef struct
93 LOGFONT LogFont;
94 HFONT hFont;
95 COLORREF color;
96 } HLPFILE_FONT;
98 typedef struct tagHlpFileFile
100 BYTE* file_buffer;
101 UINT file_buffer_size;
102 LPSTR lpszPath;
103 LPSTR lpszTitle;
104 LPSTR lpszCopyright;
105 HLPFILE_PAGE* first_page;
106 HLPFILE_PAGE* last_page;
107 HLPFILE_MACRO* first_macro;
108 BYTE* Context;
109 BYTE* kwbtree;
110 BYTE* kwdata;
111 unsigned wMapLen;
112 HLPFILE_MAP* Map;
113 unsigned wTOMapLen;
114 unsigned* TOMap;
115 unsigned long contents_start;
117 struct tagHlpFileFile* prev;
118 struct tagHlpFileFile* next;
120 unsigned wRefCount;
122 unsigned short version;
123 unsigned short flags;
124 unsigned short charset;
125 unsigned short tbsize; /* topic block size */
126 unsigned short dsize; /* decompress size */
127 unsigned short compressed;
128 unsigned hasPhrases; /* file has |Phrases */
129 unsigned hasPhrases40; /* file has |PhrIndex/|PhrImage */
130 UINT num_phrases;
131 unsigned* phrases_offsets;
132 char* phrases_buffer;
134 BYTE** topic_map;
135 BYTE* topic_end;
136 UINT topic_maplen;
138 unsigned numBmps;
139 HBITMAP* bmps;
141 unsigned numFonts;
142 HLPFILE_FONT* fonts;
144 unsigned numWindows;
145 HLPFILE_WINDOWINFO* windows;
146 HICON hIcon;
148 BOOL has_popup_color;
149 COLORREF popup_color;
151 LPSTR help_on_file;
152 } HLPFILE;
155 * Compare function type for HLPFILE_BPTreeSearch function.
157 * PARAMS
158 * p [I] pointer to testing block (key + data)
159 * key [I] pointer to key value to look for
160 * leaf [I] whether this function called for index of leaf page
161 * next [O] pointer to pointer to next block
163 typedef int (*HLPFILE_BPTreeCompare)(void *p, const void *key,
164 int leaf, void **next);
167 * Callback function type for HLPFILE_BPTreeEnum function.
169 * PARAMS
170 * p [I] pointer to data block
171 * next [O] pointer to pointer to next block
172 * cookie [IO] cookie data
174 typedef void (*HLPFILE_BPTreeCallback)(void *p, void **next, void *cookie);
176 HLPFILE* HLPFILE_ReadHlpFile(LPCSTR lpszPath);
177 HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash, ULONG* relative);
178 HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap, ULONG* relative);
179 HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset, ULONG* relative);
180 LONG HLPFILE_Hash(LPCSTR lpszContext);
181 void HLPFILE_FreeHlpFile(HLPFILE*);
183 void HLPFILE_BPTreeEnum(BYTE*, HLPFILE_BPTreeCallback cb, void *cookie);
185 struct RtfData {
186 BOOL in_text;
187 char* data; /* RTF stream start */
188 char* ptr; /* current position in stream */
189 unsigned allocated; /* overall allocated size */
190 unsigned char_pos; /* current char position (in richedit) */
191 char* where; /* pointer to feed back richedit */
192 unsigned font_scale; /* how to scale fonts */
193 HLPFILE_LINK*first_link;
194 HLPFILE_LINK*current_link;
195 BOOL force_color;
196 unsigned relative; /* offset within page to lookup for */
197 unsigned char_pos_rel; /* char_pos correspondinf to relative */
200 BOOL HLPFILE_BrowsePage(HLPFILE_PAGE*, struct RtfData* rd,
201 unsigned font_scale, unsigned relative);