Remove trailing whitespace.
[dockapps.git] / wmglobe / src / wmglobe.h
blob8d454263a9d51fe695fa4cc281b1b7d84ed54429
1 /* WMGlobe 1.3 - All the Earth on a WMaker Icon
2 * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
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.
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 STRONG 2
55 #define MAX(x, y) ((x) < (y) ? (y) : (x))
56 #define MIN(x, y) ((x) > (y) ? (y) : (x))
57 #define ABS(a) ((a) < 0 ? -(a) : (a))
59 #define PTFIXED 1
60 #define PTSUN 2
61 #define PTRANDOM 3
62 #define PTMOON 4
64 #ifndef PI
65 #define PI 3.141592653
66 #endif
69 * wmglobe
70 * variables globales
73 /************/
74 /* Typedefs */
75 /************/
76 #define MAX_MOUSE_REGION (8)
78 typedef struct {
79 int enable;
80 int top;
81 int bottom;
82 int left;
83 int right;
84 } MOUSE_REGION;
86 MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
88 typedef struct MPO {
89 int r, g, b;
90 } MPO;
92 MPO *md[4], *mn[4];
94 double solu[DIAMETRE][DIAMETRE][3];
95 int tabsolu[DIAMETRE][DIAMETRE];
96 int solution;
98 typedef struct {
99 Pixmap pixmap;
100 Pixmap mask;
101 XpmAttributes attributes;
102 } XpmIcon;
105 Display *dpy;
107 char *dayfile, *nightfile, *dpy_name;
109 Pixmap pix, pixmask;
111 XEvent Event;
113 RImage *map, *small, *mapnight;
115 XpmIcon screenpos, scrdate, scrdiv, numpix, txtpix, wmg;
117 Window iconwin, win;
118 int onlyshape, option_iw;
119 GC NormalGC;
121 /********* rendering********/
123 #if WITH_MARKERS
124 double marker[MAX_MARKERS][3];
125 int nb_marker, sun_marker, moon_marker;
126 RColor sun_col, moon_col;
127 double moon_lat,moon_long;
128 #endif
130 double delay, time_multi;
132 * struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim,
133 * vec_tim;
135 * time_t beg_time, ini_time,t1901;
137 struct timeval tlast, tnext, trend, tdelay, tini, tbase;
138 time_t tsunpos;
140 int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr;
142 int typecadre, p_type, use_nightmap, use_default_nightmap, use_nmap_ini,
143 firstTime, stoprand, do_something, iop;
145 double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long;
146 double dlat, dlong, addlat, addlong, ratiox, ratioy, dawn;
148 double sun_lat;
149 double sun_long;
151 double fov;
152 double radius;
153 double proj_dist; /* distance to projection plane */
155 double center_dist; /* distance to center of earth */
157 double ambient_light; /* how dark is the dark side? */
159 double light_x, light_y, light_z; /* vector of sunlight with lengt 1 */
161 double c_coef, b_coef;
162 double zoom;
163 int radius_proj, aml; /* radius of sphere on screen */
165 RColor noir;
166 #ifdef DEBUG
167 double minhz;
168 #endif
170 int stable;
172 /****************************************************************/
173 /* Function Prototypes */
174 /****************************************************************/
175 int main(int argc, char *argv[]);
178 void AddMouseRegion(int index, int left, int top, int right, int bottom);
179 int CheckMouseRegion(int x, int y);
180 void RedrawWindowXYWH(int x, int y, int w, int h);
181 void set_defaults();
182 void loadxpm(Window drawable);
183 void cmdline(int argc, char *argv[]);
184 void screen_back();
185 void rotation_terre(int x, int y, int lat_flag);
186 void zooming(int facto);
187 struct timeval diftimev(struct timeval t1, struct timeval t2);
188 struct timeval addtimev(struct timeval t1, struct timeval t2);
189 struct timeval getimev();
192 void setZoom(double z);
193 void calcDistance();
194 void renderFrame();
195 void initmyconvert();
196 int myRConvertImage(RContext * context, RImage * image, Pixmap * pixmap);
197 RContext *myRCreateContext
198 (Display * dpy, int screen_number, RContextAttributes * attribs);
199 void setTime(struct timeval t);
200 void recalc(int calme);
201 void sun_position(time_t ssue, double *lat, double *lon);
202 void moon_position(time_t ssue, double *lat, double *lon);
203 void transform_marker(int m);
204 void setViewPos(double lat, double lon);
205 int ripalpha(RImage * image);
206 RImage*
207 RScaleImage(RImage *image, unsigned new_width, unsigned new_height);
208 void
209 RReleaseImage(RImage *image);
211 #endif