-
Notifications
You must be signed in to change notification settings - Fork 1
/
defs.h
295 lines (257 loc) · 8.25 KB
/
defs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
/*
* HypView - (c) 2001 - 2006 Philipp Donze
* 2006 - Philipp Donze & Odd Skancke
*
* A replacement hypertext viewer
*
* This file is part of HypView.
*
* HypView is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* HypView is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HypView; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DEFS_H
#define DEFS_H 1
#define VERSION "0.40.0"
#define LINE_BUF 512
/* Return values for file loading routines */
enum {
F_LOADERROR = -2, /* Error while loading */
F_UNKNOWN = -1, /* Unknown file type */
F_BINARY = 0, /* binary format */
F_ASCII, /* ASCII format */
F_HYP, /* ST-Guide hypertext format */
};
typedef struct {
long line; /* Line number */
long y;
long offset; /* Char. offset to beginning of word */
short x; /* x coordinate of lower left corner */
}TEXT_POS;
typedef struct
{
short valid; /* Flag indicating validity of content */
TEXT_POS start; /* Start of block */
TEXT_POS end; /* End of block */
}BLOCK;
#define BLK_CHKOP 0 /* Check if operation is supported */
#define BLK_ASCIISAVE 1 /* Save current block as ASCII */
#define BLK_PRINT 2 /* Print current block */
/* Anonymous document type specific functions */
struct _document_;
typedef void (*DOC_PROC1)(struct _document_ *doc);
typedef long (*DOC_GETNODEPROC)(struct _document_ *doc);
typedef void (*DOC_GOTOPROC)(struct _document_ *doc, char *chapter, long node);
typedef void (*DOC_CLICKPROC)(struct _document_ *doc, EVNTDATA *event);
typedef long (*DOC_AUTOLOCPROC)(struct _document_ *doc, long line);
typedef void (*DOC_GETCURSORPROC)(struct _document_ *doc, short x, short y, TEXT_POS *pos);
typedef short (*DOC_BLOCKPROC)(struct _document_ *doc, short op, BLOCK *block, void *param);
struct _document_
{
struct _document_ *next; /* Pointer to next document */
short type; /* Document type see F_xy constants */
char *path; /* Full file access path */
char *filename; /* File name */
char *window_title; /* Window titel */
long start_line; /* First visible line of document */
long lines; /* Number of lines (in window lines) */
long height;
long columns; /* Number of window columns */
unsigned long buttons; /* Toolbar button configuration (bit vector)*/
void *data; /* File format specific data */
short mtime,mdate; /* File modification time and date */
WINDOW_DATA *window; /* Window associated with this file */
WINDOW_DATA *popup; /* Currently activ popup window */
DOC_PROC1 displayProc; /* Document display function */
DOC_PROC1 closeProc; /* Document close function */
DOC_GOTOPROC gotoNodeProc; /* Document navigation function */
DOC_GETNODEPROC getNodeProc;/* Function to determine current node number */
DOC_CLICKPROC clickProc; /* Mouse-click processing function */
DOC_AUTOLOCPROC autolocProc;/* Autolocator search function */
char *autolocator; /* Autolocator search string */
int autolocator_dir; /* Autolocator direction (1 = down, else up) */
DOC_GETCURSORPROC getCursorProc;/* Cursor position function */
BLOCK selection; /* Content of selection */
DOC_BLOCKPROC blockProc; /* Block operation function */
};
typedef struct _document_ DOCUMENT;
/* Convert toolbar object number into bit values for DOCUMENT->buttons */
#define BITVAL(x) (1L<<(x))
/*
* Global.c
*/
extern char path_list[];
extern char default_file[];
extern char catalog_file[];
extern char file_extensions[];
extern char dir_separator;
extern short binary_columns;
extern short ascii_tab_size;
extern short ascii_break_len;
extern WINDOW_DATA *Win;
extern short win_x,win_y,win_w,win_h;
extern short adjust_winsize;
extern short intelligent_fuller;
extern short sel_font_id,sel_font_pt;
extern short font_id,font_pt;
extern short xfont_id,xfont_pt;
extern short font_h, font_w, font_cw, font_ch;
extern short background_col;
extern short text_col,link_col,link_effect;
extern short transparent_pics;
extern char *av_parameter;
extern short va_start_newwin;
extern char debug_file[];
extern short check_time;
extern char skin_path[];
extern GlobalArray skin_global;
extern short clipbrd_new_window;
extern short av_window_cycle;
extern char marken_path[];
extern short marken_save_ask;
extern char all_ref[];
extern char hypfind_path[];
extern short refonly;
/*
* Config.c
*/
void LoadConfig(void);
/*
* Init.c
*/
void Init(void);
void Exit(void);
/*
* Fileselc.c
*/
void SelectFileLoad(void);
void SelectFileSave(DOCUMENT *doc);
/*
* File.c
*/
short LoadFile(DOCUMENT *doc, short handle);
void CloseFile(DOCUMENT *doc);
short OpenFileNW(char *path, char *chapter, long node);
short OpenFileSW(char *path, char *chapter,short new_win);
void CheckFiledate(DOCUMENT *doc);
/*
* Error.c
*/
void FileError(char *path,char *str);
void FileErrorNr(char *path,long ret);
/*
* Ascii.c
*/
short AsciiLoad(DOCUMENT *doc, short handle);
/*
* hyp\Hyp.c
*/
short HypLoad(DOCUMENT *doc, short handle);
/*
* Window.c
*/
void SendClose(WINDOW_DATA *wind);
void SendRedraw(WINDOW_DATA *wind);
void ReInitWindow(WINDOW_DATA *wind, DOCUMENT *doc);
short HelpWindow(WINDOW_DATA *ptr, short obj, void *data);
/*
* Keyrepet.c
*/
void KeyboardOnOff(void);
/*
* Toolbar.c
*/
void ToolbarUpdate(DOCUMENT *doc, OBJECT *toolbar, short redraw);
void ToolbarClick(DOCUMENT *doc, short obj);
void RemoveSearchBox(DOCUMENT *doc);
/*
* History.c
*/
typedef struct _history_
{
struct _history_ *next; /* Pointer to next history entry */
WINDOW_DATA *win; /* Associated window */
DOCUMENT *doc; /* Pointer to document */
long line; /* First visible line */
long node; /* Document node (=chapter) number */
char title; /* First byte of history title */
}HISTORY;
extern HISTORY *history; /* Pointer to history data */
void AddHistoryEntry(WINDOW_DATA *wind);
short RemoveHistoryEntry(DOCUMENT **doc,long *node,long *line);
void RemoveAllHistoryEntries(WINDOW_DATA *wind);
short CountWindowHistoryEntries(WINDOW_DATA *wind);
short CountDocumentHistoryEntries(DOCUMENT *doc);
void DeletLastHistory(void *entry);
void *GetLastHistory(void);
void SetLastHistory(WINDOW_DATA *the_win,void *last);
/*
* Tools.c
*/
WINDOW_DATA *get_first_window(void);
/*
* Navigate.c
*/
void GotoPage(DOCUMENT *doc, long num, long line, short calc);
void GoBack(DOCUMENT *doc);
void MoreBackPopup(DOCUMENT *doc, short x, short y);
void GotoHelp(DOCUMENT *doc);
void GotoIndex(DOCUMENT *doc);
void GoThisButton(DOCUMENT *doc,short obj);
/*
* Autoloc.c
*/
short AutolocatorKey(DOCUMENT *doc, short kbstate, short ascii);
void AutoLocatorPaste(DOCUMENT *doc);
/*
* selectio.c
*/
void SelectAll(DOCUMENT *doc);
void MouseSelection(DOCUMENT *doc,EVNTDATA *m_data);
void RemoveSelection(DOCUMENT *doc);
void DrawSelection(DOCUMENT *doc);
/*
* Font.c
*/
short ProportionalFont(short *width);
void SwitchFont(DOCUMENT *doc);
/*
* Block.c
*/
void BlockOperation(DOCUMENT *doc, short num);
void BlockSelectAll(DOCUMENT *doc, BLOCK *b);
void BlockCopy(DOCUMENT *doc);
void BlockPaste(short new_window);
void BlockAsciiSave(DOCUMENT *doc, char *path);
/*
* Marker.c
*/
void MarkerSave(DOCUMENT *doc, short num);
void MarkerShow(DOCUMENT *doc, short num, short new_window);
void MarkerPopup(DOCUMENT *doc, short x, short y);
void MarkerSaveToDisk(void);
void MarkerInit(void);
/*
* Info.c
*/
void ProgrammInfos(DOCUMENT *doc);
/*
* search.c
*/
void search_all(char *string);
void Search(DOCUMENT *doc);
/*
* hyp\search.c
*/
void Hypfind( DOCUMENT *doc );
#endif