wmclockmon: update change-log
[dockapps.git] / wmglobe / src / wmglobe.h
blob810c6d56be7ad35ac4121b5368bda9b35025c67b
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 #ifndef MY_EXTERN
26 #define MY_EXTERN extern
27 #endif
29 /* customization : see wmgoption.h */
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <string.h>
34 #include <unistd.h>
35 #include <fcntl.h>
36 #include <math.h>
37 #include <limits.h>
38 #include <ctype.h> /*toupper */
39 #include <stdarg.h>
40 #include <time.h>
41 #include <sys/timeb.h>
42 #include <sys/time.h>
43 #include <sys/types.h>
44 #include <X11/Xlib.h>
45 #include <X11/xpm.h>
46 #include <X11/Xutil.h>
47 #include <X11/extensions/shape.h>
48 #include <assert.h>
49 #include <X11/Xatom.h>
50 #include <locale.h>
52 #include "wraster.h"
53 #include "wmgoption.h"
55 #define FALSE 0
56 #define TRUE 1
57 #define STRONG 2
58 #define MAX(x, y) ((x) < (y) ? (y) : (x))
59 #define MIN(x, y) ((x) > (y) ? (y) : (x))
60 #define ABS(a) ((a) < 0 ? -(a) : (a))
62 #define PTFIXED 1
63 #define PTSUN 2
64 #define PTRANDOM 3
65 #define PTMOON 4
67 #ifndef PI
68 #define PI 3.141592653
69 #endif
72 * wmglobe
73 * variables globales
76 /************/
77 /* Typedefs */
78 /************/
79 #define MAX_MOUSE_REGION (8)
81 typedef struct {
82 int enable;
83 int top;
84 int bottom;
85 int left;
86 int right;
87 } MOUSE_REGION;
89 MY_EXTERN MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
91 typedef struct MPO {
92 int r, g, b;
93 } MPO;
95 MY_EXTERN MPO *md[4], *mn[4];
96 MY_EXTERN double solu[DIAMETRE][DIAMETRE][3];
97 MY_EXTERN int tabsolu[DIAMETRE][DIAMETRE];
98 MY_EXTERN int solution;
100 typedef struct {
101 Pixmap pixmap;
102 Pixmap mask;
103 XpmAttributes attributes;
104 } XpmIcon;
106 MY_EXTERN Display *dpy;
107 MY_EXTERN char *dayfile, *nightfile, *dpy_name;
108 MY_EXTERN Pixmap pix, pixmask;
109 MY_EXTERN XEvent Event;
110 MY_EXTERN RImage *map, *small, *mapnight;
111 MY_EXTERN XpmIcon screenpos, scrdate, scrdiv, numpix, txtpix, wmg;
112 MY_EXTERN Window iconwin, win;
114 MY_EXTERN int onlyshape, option_iw;
115 MY_EXTERN GC NormalGC;
117 /********* rendering********/
119 #if WITH_MARKERS
120 MY_EXTERN double marker[MAX_MARKERS][3];
121 MY_EXTERN int nb_marker, sun_marker, moon_marker;
122 MY_EXTERN RColor sun_col, moon_col;
123 MY_EXTERN double moon_lat,moon_long;
124 #endif
126 MY_EXTERN double delay, time_multi;
128 * struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim,
129 * vec_tim;
131 * time_t beg_time, ini_time,t1901;
133 MY_EXTERN struct timeval tlast, tnext, trend, tdelay, tini, tbase;
134 MY_EXTERN time_t tsunpos;
136 MY_EXTERN int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr;
138 MY_EXTERN int typecadre, p_type, use_nightmap,
139 use_default_nightmap, use_nmap_ini, firstTime,
140 stoprand, do_something, iop;
142 MY_EXTERN double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long;
143 MY_EXTERN double dlat, dlong, addlat, addlong, ratiox, ratioy, dawn;
144 MY_EXTERN double sun_lat;
145 MY_EXTERN double sun_long;
146 MY_EXTERN double fov;
147 MY_EXTERN double radius;
148 MY_EXTERN double proj_dist; /* distance to projection plane */
149 MY_EXTERN double center_dist; /* distance to center of earth */
150 MY_EXTERN double ambient_light; /* how dark is the dark side? */
151 MY_EXTERN double light_x, light_y, light_z; /* vector of sunlight with lengt 1 */
152 MY_EXTERN double c_coef, b_coef;
153 MY_EXTERN double zoom;
154 MY_EXTERN int radius_proj, aml; /* radius of sphere on screen */
156 MY_EXTERN RColor noir;
157 #ifdef DEBUG
158 MY_EXTERN double minhz;
159 #endif
161 MY_EXTERN int stable;
163 /****************************************************************/
164 /* Function Prototypes */
165 /****************************************************************/
166 int main(int argc, char *argv[]);
168 void AddMouseRegion(unsigned index, int left, int top, int right, int bottom);
169 int CheckMouseRegion(int x, int y);
170 void RedrawWindowXYWH(int x, int y, int w, int h);
171 void set_defaults();
172 void loadxpm(Window drawable);
173 void cmdline(int argc, char *argv[]);
174 void screen_back();
175 void rotation_terre(int x, int y, int lat_flag);
176 void zooming(int facto);
177 struct timeval diftimev(struct timeval t1, struct timeval t2);
178 struct timeval addtimev(struct timeval t1, struct timeval t2);
179 struct timeval getimev();
181 void setZoom(double z);
182 void calcDistance();
183 void renderFrame();
184 void initmyconvert();
185 int myRConvertImage(RContext * context, RImage * image, Pixmap * pixmap);
186 RContext *myRCreateContext
187 (Display * dpy, int screen_number, RContextAttributes * attribs);
188 void setTime(struct timeval t);
189 void recalc(int calme);
190 void sun_position(time_t ssue, double *lat, double *lon);
191 void moon_position(time_t ssue, double *lat, double *lon);
192 void transform_marker(int m);
193 void setViewPos(double lat, double lon);
194 int ripalpha(RImage * image);
195 RImage*
196 RScaleImage(RImage *image, unsigned new_width, unsigned new_height);
197 void
198 RReleaseImage(RImage *image);
200 #endif