1 /*
2  *
3  * XASTIR, Amateur Station Tracking and Information Reporting
4  * Copyright (C) 1999,2000  Frank Giannandrea
5  * Copyright (C) 2000-2019 The Xastir Group
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20  *
21  * Look at the README for more information on the program.
22  */
23 
24 /* All of the misc entry points to be included for all packages */
25 
26 #ifndef _XASTIR_H
27 #define _XASTIR_H
28 
29 
30 
31 // Macros that help us avoid warnings on 64-bit CPU's.
32 // Borrowed from the freeciv project (also a GPL project).
33 #define INT_TO_XTPOINTER(m_i)  ((XtPointer)((long)(m_i)))
34 #define XTPOINTER_TO_INT(m_p)  ((int)((long)(m_p)))
35 
36 
37 // Defines we can use to mark functions and parameters as "unused" to the compiler
38 #ifdef __GNUC__
39   #define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
40 #else
41   #define UNUSED(x) UNUSED_ ## x
42 #endif
43 
44 #ifdef __GNUC__
45   #define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x
46 #else
47   #define UNUSED_FUNCTION(x) UNUSED_ ## x
48 #endif
49 
50 
51 #define SERIAL_KISS_RELAY_DIGI
52 
53 
54 #include <X11/Intrinsic.h>
55 
56 //#include "database.h"
57 #include "util.h"
58 #include "messages.h"
59 #include "fcc_data.h"
60 #include "rac_data.h"
61 
62 
63 #define MAX_CALLSIGN 9       // Objects are up to 9 chars
64 
65 
66 // black
67 #define MY_FG_COLOR             colors[0x08]
68 #define MY_FOREGROUND_COLOR     XmNforeground,colors[0x08]
69 // gray73
70 #define MY_BG_COLOR             colors[0xff]
71 #define MY_BACKGROUND_COLOR     XmNbackground,colors[0xff]
72 
73 // Latitude and longitude string formats.
74 #define CONVERT_HP_NORMAL       0
75 #define CONVERT_HP_NOSP         1
76 #define CONVERT_LP_NORMAL       2
77 #define CONVERT_LP_NOSP         3
78 #define CONVERT_DEC_DEG         4
79 #define CONVERT_UP_TRK          5
80 #define CONVERT_DMS_NORMAL      6
81 #define CONVERT_VHP_NOSP        7
82 #define CONVERT_DMS_NORMAL_FORMATED      8
83 #define CONVERT_HP_NORMAL_FORMATED       9
84 
85 #ifndef M_PI                      /* if not defined in math.h */
86   #define M_PI 3.14159265358979323846
87 #endif  // M_PI
88 
89 #define SPEECH_TEST_STRING      "Greeteengz frum eggzaster"
90 
91 /* GLOBAL DEFINES */
92 extern char dangerous_operation[200];
93 extern GC gc;
94 extern Pixmap  pixmap;
95 extern Pixmap  pixmap_final;
96 extern Pixmap  pixmap_alerts;
97 extern Pixmap  pixmap_50pct_stipple;
98 extern Pixmap  pixmap_25pct_stipple;
99 extern Pixmap  pixmap_13pct_stipple;
100 extern Pixmap  pixmap_wx_stipple;
101 
102 extern Widget appshell;
103 
104 
105 extern int wait_to_redraw;
106 /*extern char my_callsign[MAX_CALLSIGN+1];*/
107 
108 extern void pad_callsign(char *callsignout, char *callsignin);
109 
110 
111 
112 extern char *to_upper(char *data);
113 
114 extern void Send_message(Widget w, XtPointer clientData, XtPointer callData);
115 
116 extern void create_gc(Widget w);
117 
118 extern void Station_info(Widget w, XtPointer clientData, XtPointer calldata);
119 
120 extern void fix_dialog_size(Widget w);
121 
122 void resize_dialog( Widget form, Widget dialog);
123 
124 extern int debug_level;
125 extern GC gc;
126 extern Pixel colors[];
127 
128 
129 extern float f_center_longitude;   // Floating point map center longitude
130 extern float f_center_latitude;    // Floating point map center latitude
131 extern float f_NW_corner_longitude;// longitude of NW corner
132 extern float f_NW_corner_latitude; // latitude of NW corner
133 extern float f_SE_corner_longitude;// longitude of SE corner
134 extern float f_SE_corner_latitude; // latitude of SE corner
135 
136 extern long center_longitude;      // Longitude at center of map
137 extern long center_latitude;       // Latitude at center of map
138 extern long NW_corner_longitude;   // longitude of NW corner
139 extern long NW_corner_latitude;    // latitude of NW corner
140 extern long SE_corner_longitude;   // longitude of SE corner
141 extern long SE_corner_latitude;    // latitude of SE corner
142 
143 extern long scale_x;               // x scaling in 1/100 sec per pixel
144 extern long scale_y;               // y scaling in 1/100 sec per pixel
145 
146 
147 extern long screen_width;
148 extern long screen_height;
149 extern Position screen_x_offset;
150 extern Position screen_y_offset;
151 extern int long_lat_grid;
152 //extern Pixmap  pixmap;
153 //extern Pixmap  pixmap_final;
154 //extern Pixmap  pixmap_alerts;
155 extern int map_color_levels;
156 extern int map_labels;
157 extern int map_lock_pan_zoom;
158 extern int map_auto_maps;
159 extern int auto_maps_skip_raster;
160 extern time_t sec_remove;
161 extern Widget da;
162 extern Widget text;
163 extern XtAppContext app_context;
164 extern int redraw_on_new_data;
165 //extern Widget hidden_shell;
166 extern int index_maps_on_startup;
167 #define MAX_LABEL_FONTNAME 256
168 #define FONT_SYSTEM  0
169 #define FONT_STATION 1
170 #define FONT_TINY    2
171 #define FONT_SMALL   3
172 #define FONT_MEDIUM  4
173 #define FONT_LARGE   5
174 #define FONT_HUGE    6
175 #define FONT_BORDER  7
176 #define FONT_ATV_ID  8
177 #define FONT_MAX     9
178 #define FONT_DEFAULT FONT_MEDIUM
179 #define MAX_FONTNAME 256
180 extern char rotated_label_fontname[FONT_MAX][MAX_LABEL_FONTNAME];
181 
182 #ifdef HAVE_LIBGEOTIFF
183   extern int DRG_XOR_colors;
184   extern int DRG_show_colors[13];
185 #endif  // HAVE_LIBGEOTIFF
186 
187 
188 extern int net_map_timeout;
189 
190 extern void sort_list(char *filename,int size, Widget list, int *item);
191 extern void redraw_symbols(Widget w);
192 
193 extern Colormap cmap;
194 
195 
196 
197 /* from messages.c */
198 extern char  message_counter[5+1];
199 extern int  auto_reply;
200 extern char auto_reply_message[100];
201 extern int  satellite_ack_mode;
202 extern void clear_outgoing_messages(void);
203 extern void reset_outgoing_messages(void);
204 extern void output_message(char *from, char *to, char *message, char *path);
205 extern void check_and_transmit_messages(time_t time);
206 extern Message_Window mw[MAX_MESSAGE_WINDOWS+1];
207 extern void clear_message_windows(void);
208 
209 /* from sound.c */
210 extern pid_t play_sound(char *sound_cmd, char *soundfile);
211 extern int sound_done(void);
212 
213 /* from fcc_data.c */
214 
215 
216 
217 /* from rac_data.c */
218 
219 /* from lang.c */
220 extern int load_language_file(char *filename);
221 extern char *langcode(char *code);
222 extern char langcode_hotkey(char *code);
223 
224 /* from sound.c */
225 extern pid_t play_sound(char *sound_cmd, char *soundfile);
226 
227 /* from location.c */
228 extern void set_last_position(void);
229 extern void map_pos_last_position(void);
230 
231 /* from location_gui.c */
232 extern char locate_station_call[30];
233 extern void Last_location(Widget w, XtPointer clientData, XtPointer callData);
234 extern void Jump_location(Widget w, XtPointer clientData, XtPointer callData);
235 extern void map_pos(long mid_y, long mid_x, long sz);
236 extern char locate_gnis_filename[200];
237 
238 // This needs to be quite long for some of the weather station
239 // serial data to get through ok (Peet Bros U2k Complete Record Mode
240 // for one).
241 #define MAX_LINE_SIZE 512
242 
243 // from main.c
244 extern char gprmc_save_string[MAX_LINE_SIZE+1];
245 extern char gpgga_save_string[MAX_LINE_SIZE+1];
246 extern int gps_port_save;
247 
248 // from map.c
249 extern double calc_dscale_x(long x, long y);
250 
251 /* from popup_gui.c */
252 extern void popup_message_always(char *banner, char *message);
253 extern void popup_message(char *banner, char *message);
254 extern void popup_ID_message(char *banner, char *message);
255 
256 
257 /* from view_messages.c */
258 extern void all_messages(char from, char *call_sign, char *from_call, char *message);
259 extern void view_all_messages(Widget w, XtPointer clientData, XtPointer callData);
260 
261 /* from db.c */
262 extern void setup_in_view(void);
263 
264 #endif /* XASTIR_H */
265 
266 
267