wmglobe: Add version 0.5 to repository.
[dockapps.git] / wmglobe / src / wmglobe.h
blob9456f00c1f39e3281e7a33f5310637b3c75c401e
1 /* WMGlobe 0.5 - All the Earth on a WMaker Icon
2 * copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 ***************************************************************************/
18 /* it uses some functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib
19 ***************************************************************************/
22 #ifndef WMG_HEADER_H
23 #define WMG_HEADER_H
25 /* customization : see wmgoption.h */
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <string.h>
30 #include <unistd.h>
31 #include <fcntl.h>
32 #include <math.h>
33 #include <limits.h>
34 #include <ctype.h> /*toupper */
35 #include <stdarg.h>
36 #include <time.h>
37 #include <sys/timeb.h>
38 #include <sys/time.h>
39 #include <sys/types.h>
40 #include <X11/Xlib.h>
41 #include <X11/xpm.h>
42 #include <X11/Xutil.h>
43 #include <X11/extensions/shape.h>
44 #include <assert.h>
45 #include <X11/Xatom.h>
46 #include <locale.h>
48 #include "wraster.h"
50 #include "wmgoption.h"
52 #define FALSE 0
53 #define TRUE 1
54 #define MAX(x, y) ((x) < (y) ? (y) : (x))
55 #define MIN(x, y) ((x) > (y) ? (y) : (x))
56 #define ABS(a) ((a) < 0 ? -(a) : (a))
58 #define PTFIXED 1
59 #define PTSUNREL 2
60 #define PTRANDOM 3
62 #ifndef PI
63 #define PI 3.141592653
64 #endif
67 * wmglobe
68 * variables globales
71 /************/
72 /* Typedefs */
73 /************/
74 #define MAX_MOUSE_REGION (8)
76 typedef struct {
77 int enable;
78 int top;
79 int bottom;
80 int left;
81 int right;
82 } MOUSE_REGION;
84 MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
86 typedef struct MPO {
87 int r, g, b;
88 } MPO;
90 MPO *md[4], *mn[4];
92 double soluce[DIAMETRE / 2][DIAMETRE][4];
93 int solution;
95 /************/
97 typedef struct {
98 Pixmap pixmap;
99 Pixmap mask;
100 XpmAttributes attributes;
101 } XpmIcon;
103 /************/
106 Display *dpy;
108 char *dayfile, *nightfile, *dpy_name;
110 Pixmap pix, pixmask;
112 XEvent Event;
114 RImage *map, *small, *mapnight;
116 XpmIcon screenpos, scrdate, scrdiv, numpix, txtpix, wmg;
118 Window iconwin, win;
119 int onlyshape, option_iw;
120 GC NormalGC;
122 /********* rendering********/
124 double delay, time_multi;
126 * struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim,
127 * vec_tim;
129 * time_t beg_time, ini_time,t1901;
131 struct timeval tlast, tnext, trend, tdelay, tini, tbase;
132 time_t tsunpos;
134 int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr;
136 int typecadre, p_type, use_nightmap, use_nmap_ini, firstTime, stoprand,
137 do_something, iop;
139 double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long;
140 double dlat, dlong, addlat, addlong, ratiox, ratioy, dawn;
142 double sun_lat;
143 double sun_long;
145 double fov;
146 double radius;
147 double proj_dist; /* distance to projection plane */
149 double center_dist; /* distance to center of earth */
151 double ambient_light; /* how dark is the dark side? */
153 double light_x, light_y, light_z; /* vector of sunlight with lengt 1 */
155 double c_coef, b_coef;
156 double zoom;
157 int radius_proj, aml; /* radius of sphere on screen */
159 RColor noir;
160 #ifdef DEBUG
161 double minhz;
162 #endif
164 /****************************************************************/
165 /* Function Prototypes */
166 /****************************************************************/
167 int main(int argc, char *argv[]);
168 /****************************************************************/
169 void AddMouseRegion(int index, int left, int top, int right, int bottom);
170 int CheckMouseRegion(int x, int y);
171 void RedrawWindowXYWH(int x, int y, int w, int h);
172 void set_defaults();
173 void loadxpm(Window drawable);
174 void cmdline(int argc, char *argv[]);
175 void screen_back();
176 void rotation_terre(int x, int y, int lat_flag);
177 void zooming(int facto);
178 struct timeval diftimev(struct timeval t1, struct timeval t2);
179 struct timeval addtimev(struct timeval t1, struct timeval t2);
180 struct timeval getimev();
182 /***************************************************************/
183 void setZoom(double z);
184 void calcDistance();
185 void renderFrame();
186 void initmyconvert();
187 int myRConvertImage(RContext * context, RImage * image, Pixmap * pixmap);
188 RContext *myRCreateContext
189 (Display * dpy, int screen_number, RContextAttributes * attribs);
190 void setTime(struct timeval t);
191 void recalc(int calme);
192 void GetSunPos(time_t ssue, double *lat, double *lon);
193 void setViewPos(double lat, double lon);
195 /***************************************************************/
197 #endif