1 // Copyright (c) <2012> <Leif Asbrink>
2 //
3 // Permission is hereby granted, free of charge, to any person
4 // obtaining a copy of this software and associated documentation
5 // files (the "Software"), to deal in the Software without restriction,
6 // including without limitation the rights to use, copy, modify,
7 // merge, publish, distribute, sublicense, and/or sell copies of
8 // the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21 // OR OTHER DEALINGS IN THE SOFTWARE.
22 
23 
24 #include "globdef.h"
25 #include "screendef.h"
26 
27 unsigned int sc[MAX_SC];
28 unsigned int sd[MAX_SC];
29 int screen_loop_counter;
30 int screen_loop_counter_max;
31 
32 
33 BUTTONS wgbutt[MAX_WGBUTT];
34 BUTTONS hgbutt[MAX_HGBUTT];
35 BUTTONS bgbutt[MAX_BGBUTT];
36 BUTTONS agbutt[MAX_AGBUTT];
37 BUTTONS pgbutt[MAX_PGBUTT];
38 BUTTONS cgbutt[MAX_CGBUTT];
39 BUTTONS egbutt[MAX_EGBUTT];
40 BUTTONS fgbutt[MAX_FGBUTT];
41 BUTTONS mgbutt[MAX_MGBUTT];
42 BUTTONS tgbutt[MAX_TGBUTT];
43 BUTTONS rgbutt[MAX_RGBUTT];
44 
45 WG_PARMS wg;
46 HG_PARMS hg;
47 BG_PARMS bg;
48 CG_PARMS cg;
49 MG_PARMS mg;
50 EG_PARMS eg;
51 PG_PARMS pg;
52 FG_PARMS fg;
53 PG_PARMS dpg;
54 AG_PARMS ag;
55 TG_PARMS tg;
56 RG_PARMS rg;
57 NET_PARMS net;
58 
59 
60 SCREEN_OBJECT scro[MAX_SCRO];
61 
62 WATERF_TIMES *bg_waterf_times;
63 
64 
65 ROUTINE current_mouse_activity;
66 
67 char numinput_txt[MAX_TEXTPAR_CHARS+1];
68 
69 unsigned char button_color;
70 int no_of_scro;
71 
72 int wg_flag;
73 int hg_flag;
74 int ag_flag;
75 int bg_flag;
76 int pg_flag;
77 int cg_flag;
78 int mg_flag;
79 int eg_flag;
80 int fg_flag;
81 int tg_flag;
82 int rg_flag;
83 
84 
85 int wg_fft_avg2num;
86 
87 int wg_first_xpixel;
88 int wg_last_xpixel;
89 float wg_yfac_power;
90 float wg_yfac_log;
91 float wg_hz_per_pixel;
92 float wg_first_frequency;
93 double frequency_scale_offset;
94 double frequency_scale_offset_hz;
95 double rx_passband_center_mhz;
96 
97 int wg_xpixels;
98 float wg_db_per_pixel;
99 int wg_timestamp_counter;
100 int waterfall_yield_interval;
101 
102 int bg_flatpoints;
103 int bg_curvpoints;
104 int bg_6db_points;
105 int bg_60db_points;
106 int bg_120db_points;
107 int bg_first_xpixel;
108 int bg_last_xpixel;
109 int bg_first_xpoint;
110 int bg_xpoints;
111 int bg_xpixels;
112 int bg_timestamp_counter;
113 int bg_ymax;
114 int bg_y3;
115 int bg_y4;
116 int bg_y2;
117 int bg_y1;
118 int bg_y0;
119 int bg_avg_counter;
120 int bg_yborder_max;
121 int bg_yborder_min;
122 int bg_vol_x1;
123 int bg_vol_x2;
124 float bg_hz_per_pixel;
125 
126 int hg_size;
127 int hg_first_point;
128 int hg_last_point;
129 int hg_first_xpixel;
130 int hg_last_xpixel;
131 int hg_xpix1;
132 int hg_first_fq;
133 int hg_curx;
134 int hg_center;
135 int hg_cury0;
136 int hg_cury1;
137 int hg_cury2;
138 int hg_stonbars_ytop;
139 int hg_y0;
140 int hg_redraw_counter;
141 int hg_ymax;
142 float hg_db_per_pixel;
143 float hg_hz_per_pixel;
144 float hg_yfac_log;
145 float hg_yfac_power;
146 int hg_powersum_recalc;
147 int hg_recalc_pointer;
148 int hg_ston1_y;
149 int hg_ston2_y;
150 int hg_ston1_yold;
151 int hg_ston2_yold;
152 int hg_ston_y0;
153 int hg_ston1_x1;
154 int hg_ston1_x2;
155 int hg_ston2_x1;
156 int hg_ston2_x2;
157 int afc_curx;
158 
159 
160 int pg_x0;
161 int pg_y0;
162 int pg_oldx;
163 int pg_oldy;
164 float pg_pol_angle;
165 float pg_b;
166 double show_pol_time;
167 double update_meter_time;
168 
169 int cg_x0;
170 int cg_y0;
171 int cg_y1;
172 int cg_chirpx;
173 int cg_chirpy;
174 int cg_oldx;
175 int cg_oldy;
176 
177 int eg_hsiz;
178 int eg_vsiz;
179 int eg_oldx;
180 int eg_oldy;
181 int eme_active_flag;
182 
183 int fg_oldx;
184 int fg_oldy;
185 int fg_yborder;
186 
187 int tg_oldx;
188 int tg_oldy;
189 int tg_yborder;
190 int tg_old_band;
191 
192 int fftx_totmem;
193 int baseband_totmem;
194 int afc_totmem;
195 int hires_totmem;
196 int fft3_totmem;
197 int radar_totmem;
198 
199 int bg_waterf_sum_counter;
200 float *bg_waterf_sum;
201 int bg_waterf_yinc;
202 int bg_waterf_y1;
203 int bg_waterf_y2;
204 int bg_waterf_y;
205 float bg_waterf_cfac;
206 float bg_waterf_czer;
207 int bg_waterf_block;
208 int bg_waterf_lines;
209 float bg_waterf_yfac;
210 
211 unsigned char *wg_background;
212 unsigned char *bg_background;
213 unsigned char *hg_background;
214 char *hg_stonbuf;
215 short int *hg_spectrum;
216 int mouse_active_flag;
217 int numinput_flag;
218 int numinput_xdiff;
219 int numinput_ydiff;
220 int numinput_xpix;
221 int numinput_ypix;
222 int numinput_curpos;
223 int numinput_int_data;
224 int numinput_chars;
225 float numinput_float_data;
226 double numinput_double_data;
227 double cursor_blink_time;
228 float moon_az;
229 float moon_el;
230 
231 MEMREF_T *hires_handle;
232 float *wg_waterf_sum;
233 int wg_waterf_sum_counter;
234 int wg_waterf_yinc;
235 int wg_waterf_y1;
236 int wg_waterf_y2;
237 int wg_waterf_y;
238 float wg_waterf_cfac;
239 float wg_waterf_czer;
240 int wg_waterf_block;
241 int wg_waterf_lines;
242 int screen_last_line;
243 
244 short int *bg_waterf;
245 int max_bg_waterf_times;
246 int bg_waterf_ptr;
247 int bg_waterf_ptr2;
248 int bg_waterf_size;
249 int local_bg_waterf_ptr;
250 int local_bg_yborder;
251 int s_meter_avg_filled_flag;
252 
253 char ch2_phase_symbol[MAX_CH2_PHASES]={'+','-','c'};
254 
255 
256 char *graphtype_names[MAX_GRAPHTYPES]={"ag",
257                                        "wg",
258                                        "bg",
259                                        "hg",
260                                        "pg",
261                                        "cg",
262                                        "eg",
263                                        "fg",
264                                        "mg",
265                                        "tg",
266                                        "rg"};
267 
268 char *graphtype_parptr[MAX_GRAPHTYPES]={(void*)(&ag),
269                                        (void*)(&wg),
270                                        (void*)(&bg),
271                                        (void*)(&hg),
272  //Use dpg for read/write to keep defaults while moving window.
273                                        (void*)(&dpg),
274                                        (void*)(&cg),
275                                        (void*)(&eg),
276                                        (void*)(&fg),
277                                        (void*)(&mg),
278                                        (void*)(&tg),
279                                        (void*)(&rg)};
280 
281 int graphtype_max_intpar[MAX_GRAPHTYPES]={MAX_AG_INTPAR,
282                                           MAX_WG_INTPAR,
283                                           MAX_BG_INTPAR,
284                                           MAX_HG_INTPAR,
285                                           MAX_PG_INTPAR,
286                                           MAX_CG_INTPAR,
287                                           MAX_EG_INTPAR,
288                                           MAX_FG_INTPAR,
289                                           MAX_MG_INTPAR,
290                                           MAX_TG_INTPAR,
291                                           MAX_RG_INTPAR};
292 
293 char **graphtype_partexts_int[MAX_GRAPHTYPES]={ag_intpar_text,
294                                                wg_intpar_text,
295                                                bg_intpar_text,
296                                                hg_intpar_text,
297                                                pg_intpar_text,
298                                                cg_intpar_text,
299                                                eg_intpar_text,
300                                                fg_intpar_text,
301                                                mg_intpar_text,
302                                                tg_intpar_text,
303                                                rg_intpar_text};
304 
305 // Store number of float with reversed sign if the
306 // float variables are double precision.
307 int graphtype_max_floatpar[MAX_GRAPHTYPES]={MAX_AG_FLOATPAR,
308                                           MAX_WG_FLOATPAR,
309                                           MAX_BG_FLOATPAR,
310                                           MAX_HG_FLOATPAR,
311                                           MAX_PG_FLOATPAR,
312                                           MAX_CG_FLOATPAR,
313                                           MAX_EG_FLOATPAR,
314                                           -MAX_FG_FLOATPAR,
315                                           MAX_MG_FLOATPAR,
316                                           -MAX_TG_FLOATPAR,
317                                           MAX_RG_FLOATPAR};
318 
319 char **graphtype_partexts_float[MAX_GRAPHTYPES]={ag_floatpar_text,
320                                                wg_floatpar_text,
321                                                bg_floatpar_text,
322                                                hg_floatpar_text,
323                                                pg_floatpar_text,
324                                                cg_floatpar_text,
325                                                eg_floatpar_text,
326                                                fg_floatpar_text,
327                                                mg_floatpar_text,
328                                                tg_floatpar_text,
329                                                rg_floatpar_text};
330 
331 
332 
333