1 /**********
2 Copyright 1990 Regents of the University of California.  All rights reserved.
3 Author: 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
4 Modified 1999 Emmanuel Rouat - 2000  AlansFixes
5 **********/
6 
7 /*
8  * Definitions for the help system.
9  */
10 #include "ngspice/config.h"
11 
12 
13 
14 #ifndef X_DISPLAY_MISSING
15 #  include <X11/Intrinsic.h>
16 #endif
17 
18 typedef struct fplace {
19     char *filename;
20     long fpos;
21     FILE *fp;
22 } fplace;
23 
24 typedef struct button {
25     char *text;
26     fplace *tag;        /* Why isn't used for anything? */
27     int x;
28     int y;
29     int width;
30     int height;
31 } button;
32 
33 struct hlp_index {
34     char subject[64];
35     long fpos;
36 };
37 
38 typedef struct toplink {
39     char *description;          /* really the subject */
40     fplace *place;
41     struct toplink *next;
42     struct button button;
43 } toplink;
44 
45 typedef struct topic {
46     char *subject;
47     char *title;
48     fplace *place;
49     wordlist *text;
50     char *chartext;
51     toplink *subtopics;
52     toplink *seealso;
53     int xposition;
54     int yposition;
55     struct topic *parent;
56     struct topic *children;
57     struct topic *next;
58     struct topic *winlink;
59     struct topic *readlink;
60     int numlines;
61     int maxcols;
62     int curtopline;
63 
64 #ifndef X_DISPLAY_MISSING
65     Widget shellwidget, formwidget, titlewidget, buttonwidget,
66         textwidget, seelabelwidget, sublabelwidget, seeboxwidget, subboxwidget;
67 #endif
68 } topic;
69 
70 typedef struct handle {
71     topic *parent;
72     toplink *result;
73 } handle;
74 
75 #define REG_FONT        "timrom12"
76 #define BOLD_FONT       "timrom12b"
77 #define ITALIC_FONT     "timrom12i"
78 #define TITLE_FONT      "accordb"
79 #define BUTTON_FONT     "6x10"
80 
81 #define X_INCR          20
82 #define Y_INCR          20
83 #define BORDER_WIDTH    3
84 #define INT_BORDER      10
85 #define BUTTON_XPAD 4
86 #define BUTTON_YPAD 2
87 
88 #define START_XPOS  100
89 #define START_YPOS  100
90 
91 /* If the MAX_LINES and SCROLL_INCR are different, it is very confusing... */
92 
93 #define MIN_COLS    40
94 #define MAX_COLS    90
95 
96 #define MAX_LINES   25
97 #define SCROLL_INCR 25
98 
99 enum {
100     BS_LEFT = 0,
101     BS_CENTER,
102     BS_UNIF,
103 };
104 
105 /* External symbols. */
106 
107 /* help.c */
108 
109 extern char *hlp_directory;
110 
111 extern void hlp_main(char *path, wordlist *wl);
112 extern FILE *hlp_fopen(char *filename);
113 extern fplace *findglobalsubject(char *subject);
114 extern bool hlp_approvedfile(char *filename);
115 extern void hlp_pathfix(char *buf);
116 
117 
118 /* readhelp.c */
119 
120 extern topic *hlp_read(fplace *place);
121 extern void hlp_free(void);
122 extern long findsubject(char *filename, char *subject);
123 
124 /* provide.c */
125 
126 extern void hlp_provide(topic *top);
127 extern bool hlp_usex;
128 extern void hlp_fixchildren(topic *parent);
129 extern void hlp_killfamily(topic *top);
130 
131 /* xdisplay.c */
132 
133 extern char *hlp_regfontname;
134 extern char *hlp_boldfontname;
135 extern char *hlp_italicfontname;
136 extern char *hlp_titlefontname;
137 extern char *hlp_buttonfontname;
138 extern int hlp_initxpos;
139 extern int hlp_initypos;
140 extern int hlp_buttonstyle;
141 extern char *hlp_displayname;
142 extern bool hlp_xdisplay(topic *top);
143 extern void hlp_xclosedisplay(void);
144 extern toplink *hlp_xhandle(topic **pp);
145 extern void hlp_xkillwin(topic *top);
146 extern void hlp_xwait(topic *top, bool on);
147 
148 
149 /* textdisp.c */
150 
151 extern bool hlp_tdisplay(topic *top);
152 extern toplink *hlp_thandle(topic **parent);
153 extern void hlp_tkillwin(topic *top);
154 extern int hlp_width;
155 
156