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 ***************************************************************************/
25 /* customization : see wmgoption.h */
34 #include <ctype.h> /*toupper */
37 #include <sys/timeb.h>
39 #include <sys/types.h>
42 #include <X11/Xutil.h>
43 #include <X11/extensions/shape.h>
45 #include <X11/Xatom.h>
50 #include "wmgoption.h"
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))
65 #define PI 3.141592653
76 #define MAX_MOUSE_REGION (8)
86 MOUSE_REGION mouse_region
[MAX_MOUSE_REGION
];
94 double solu
[DIAMETRE
][DIAMETRE
][3];
95 int tabsolu
[DIAMETRE
][DIAMETRE
];
101 XpmAttributes attributes
;
107 char *dayfile
, *nightfile
, *dpy_name
;
113 RImage
*map
, *small
, *mapnight
;
115 XpmIcon screenpos
, scrdate
, scrdiv
, numpix
, txtpix
, wmg
;
118 int onlyshape
, option_iw
;
121 /********* rendering********/
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
;
130 double delay
, time_multi
;
132 * struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim,
135 * time_t beg_time, ini_time,t1901;
137 struct timeval tlast
, tnext
, trend
, tdelay
, tini
, tbase
;
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
;
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
;
163 int radius_proj
, aml
; /* radius of sphere on screen */
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
);
182 void loadxpm(Window drawable
);
183 void cmdline(int argc
, char *argv
[]);
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
);
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
);
207 RScaleImage(RImage
*image
, unsigned new_width
, unsigned new_height
);
209 RReleaseImage(RImage
*image
);