1 /* $Header: /home/yav/catty/fkiss/RCS/work.c,v 1.23 2000/09/28 07:54:00 yav Exp $
2  * fkiss global work
3  * written by yav <yav@bigfoot.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 char id_work[] = "$Id: work.c,v 1.23 2000/09/28 07:54:00 yav Exp $";
21 
22 #include <X11/Xlib.h>
23 #include <stdio.h>
24 
25 #include "config.h"
26 
27 #include "headers.h"
28 #include "fkiss.h"
29 #include "version.h"
30 
31 char str_fullname[] = "French-KISS!";
32 char str_version[] = FKISS_VERSION;
33 char str_author[] = "yav <yav@bigfoot.com>";
34 char *coptions[] = {
35 #ifdef __STDC__
36   "__STDC__",
37 #endif
38 #ifdef _POSIX_SOURCE
39   "_POSIX_SOURCE",
40 #endif
41 #ifdef _BSD_SOURCE
42   "_BSD_SOURCE",
43 #endif
44 #ifdef _GNU_SOURCE
45   "_GNU_SOURCE",
46 #endif
47 #ifdef __STRICT_ANSI__
48   "__STRICT_ANSI__",
49 #endif
50 #ifdef __GNUC__
51   "__GNUC__",
52 #endif
53 #ifdef __FreeBSD__
54   "__FreeBSD__",
55 #endif
56 #ifdef linux
57   "linux",
58 #endif
59 #include "coptions"
60 #ifdef USE_STDARG
61 # if USE_STDARG
62   "USE_STDARG",
63 # else
64   "!USE_STDARG",
65 # endif
66 #endif
67 #ifdef USE_VARARGS
68 # if USE_VARARGS
69   "USE_VARARGS",
70 # else
71   "!USE_VARARGS",
72 # endif
73 #endif
74 #ifdef USE_BSD_DIRLIB
75 # if USE_BSD_DIRLIB
76   "USE_BSD_DIRLIB",
77 # else
78   "!USE_BSD_DIRLIB",
79 # endif
80 #endif
81   NULL};
82 char kiss_magic_number[] = KISS_MAGIC_NUMBER;
83 int oargc;
84 char **oargv;
85 Display *dsp = NULL;
86 int scr;
87 int screen_depth;
88 Visual *vis = NULL;
89 Window rootwin;
90 unsigned long spx[SPX_MAX];	/* System pixel */
91 GC sysgc[SGC_MAX];		/* System GC */
92 int debug_mode = 0;
93 int test_mode = 0;
94 char *extract_dir = NULL;
95 char *conf_dir = NULL;
96 char *conf_file = NULL;
97 char *str_font = NULL;
98 char *str_font8 = NULL;
99 char *str_font16 = NULL;
100 Pixmap iconp = None;
101 int iconw, iconh;
102 Window topwin;
103 int topw, toph;			/* topwin width, height */
104 XFontStruct *fsp = NULL;
105 XFontStruct *fsp8 = NULL;
106 XFontStruct *fsp16 = NULL;
107 int font_ascent = 11;
108 int font_descent = 2;
109 int font8_ascent = 16;
110 int font8_descent = 0;
111 int font16_ascent = 16;
112 int font16_descent = 0;
113 Window viewwin;
114 int vieww, viewh;
115 Window mnwin;
116 int mnx = 0;
117 int mny;
118 int mnw;
119 int mnh = 24;
120 int mnbw = 1;			/* menu bar window border width */
121 int setcnt = 0;			/* set count */
122 int palcnt = 0;			/* palette group count */
123 Bool quit_flag = False;
124 int cset = -1;			/* current set (0...MAXSET-1) */
125 int cpal = -1;			/* current col (0...MAXPAL-1) */
126 char *str_geometry = "";
127 int imgw0 = KISS_WIDTH_DEFAULT;
128 int imgh0 = KISS_HEIGHT_DEFAULT;
129 int imgx, imgy, imgw, imgh;
130 int imgbw = 1;			/* image window border width */
131 int scrdx, scrdy;		/* imgx, imgy add value */
132 int celcnt;
133 int objcnt;			/* object mark max value */
134 int objcnt2;			/* effective object count */
135 int motion_compress = 1;	/* 0:trace smooth 1:compress pointer motion */
136 unsigned char hatch_ptrn[] = {	/* 8x8 cross hatch pattern */
137   0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55};
138 int arcfilecnt = 0;		/* archive file count */
139 char **arcfilelist = NULL;	/* archive filename pointer */
140 int verbose_mode = 1;		/* bit0:warning bit1:message */
141 int sound_mode = 1;		/* 0:no use 1:internal 2:external */
142 char active_set[MAXSET];	/* 0:no use 1:active */
143 int border_color = -1;		/* KISS border area color */
144 int max_fix = 0;
145 CELL *cell = NULL;		/* cell data structures list */
146 OBJECT *object = NULL;
147 int colorfilecnt;		/* color file count described in cnf */
148 COLOR *kcflist = NULL;		/* [colorfilecnt] */
149 SETINFO kset[MAXSET];		/* set color and object positions */
150 
151 Colormap cmap;			/* default colormap */
152 int gray_mode = 0;		/* 0:Color 1:GrayScale 2:1plane-mono */
153 int colcnt = 0;			/* loaded color count */
154 XColor *xcol[MAXPAL];
155 KISSCOLOR *kcol[MAXPAL];
156 short *colindex = NULL;		/* [loaded_colfcnt] */
157 char *str_curs_fore = NULL;	/* cursor fore color */
158 char *str_curs_back = NULL;	/* cursor back color */
159 int cursor_mode = 3;		/* cursor font control mode
160 				 * bit0:hand
161 				 * bit1:grip
162 				 */
163 int event_mode = 1;		/* != 0 Event extension enable */
164 Bool event_detect;		/* True: Found event extension in cnf */
165 int sleep_tick = 16;		/* 16.666...ms = 1/60 sec. */
166 int private_color_mode = 0;	/* != 0 use private color cells */
167 int private_colormap_mode = 1;	/* == 0 disable to use private color map */
168 char infostr0[256] = "Pointed: ";
169 char infostr[256] = "(None)";
170 int cnf_comment_cnt;		/* number of hold comment strings */
171 char **cnf_comment = NULL;	/* comment strings holding buffer list */
172 int coding_type = CODING_UNKNOWN; /* cnf comment Kanji coding system */
173 int objpos_first_align = 0;	/* adjust object position by first set value */
174 				/* now, under construction */
175 int oldcnf_comaptible = 0;	/* Old style single line set info. */
176 char *hes_keyword = "open sesame";
177 Window infowin;
178 int evn = 0;			/* registrated event number (<= MAXEVENT) */
179 int enable_event_shell = 0;	/* != 0 enable to execute event shell */
180 char *evid = ";@EventHandler";	/* event extension identifier */
181 int randseed = 0;		/* seed for pseudo-random numbers */
182 char *str_sound_cache_limit = NULL;
183 long sound_cache_limit = 256*1024L; /* sound cache buffer limit */
184 int wkiss_bug_emulation = 0;	/* event extension DOS filename */
185 int transparency_mode = 1;	/* 0:none 1:static 2:realtime */
186 Window comwin;			/* comment window */
187 int combw = 1;			/* comment window border width (pixel) */
188 int comment_mode = 2;		/* comment mode
189 				 * 0: None
190 				 * 1: One cel
191 				 * 2: All cel
192 				 */
193 int comment_linenum = 0;	/* 0:without line# 1:with line# */
194 int auto_adjust = 4;		/* Auto adjust pixel */
195 
196 /* End of file */
197