1 // ----------------------------------------------------------------------------
2 // Copyright (C) 2014
3 //              David Freese, W1HKJ
4 //
5 // This file is part of flmsg
6 //
7 // flrig is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // flrig 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, see <http://www.gnu.org/licenses/>.
19 // ----------------------------------------------------------------------------
20 
21 #include "gettext.h"
22 #include "status.h"
23 #include "util.h"
24 
25 #include "flmsg_dialog.h"
26 #include "flmsg.h"
27 
28 Fl_Group	*tab_iaru = (Fl_Group *)0;
29 Fl_Tabs		*tabs_iaru = (Fl_Tabs *)0;
30 Fl_Group	*tab_iaru_message = (Fl_Group *)0;
31 Fl_Group	*tab_iaru_information = (Fl_Group *)0;
32 Fl_Input2	*iaru_txt_nbr = (Fl_Input2 *)0;
33 
34 Fl_ListBox	*iaru_sel_prec = (Fl_ListBox *)0;
35 
36 Fl_Input2	*iaru_txt_station = (Fl_Input2 *)0;
37 Fl_Input2	*iaru_txt_orig = (Fl_Input2 *)0;
38 
39 Fl_Input2	*iaru_txt_t1 = (Fl_Input2 *)0;
40 Fl_Button	*iaru_btn_t1 = (Fl_Button *)0;
41 Fl_Input2	*iaru_txt_d1 = (Fl_Input2 *)0;
42 Fl_Button	*iaru_btn_d1 = (Fl_Button *)0;
43 
44 Fl_Input2	*iaru_txt_check = (Fl_Input2 *)0;
45 Fl_Button	*iaru_btn_check = (Fl_Button *)0;
46 
47 Fl_Input2	*iaru_txt_to = (Fl_Input2 *)0;
48 FTextEdit	*iaru_txt_msg = (FTextEdit *)0;
49 Fl_Input2	*iaru_txt_fm = (Fl_Input2 *)0;
50 
51 Fl_Input2	*iaru_txt_rcv_fm = (Fl_Input2 *)0;
52 Fl_Input2	*iaru_txt_d2 = (Fl_Input2 *)0;
53 Fl_Button	*iaru_btn_d2 = (Fl_Button *)0;
54 Fl_Input2	*iaru_txt_t2 = (Fl_Input2 *)0;
55 Fl_Button	*iaru_btn_t2 = (Fl_Button *)0;
56 
57 Fl_Input2	*iaru_txt_sent_to = (Fl_Input2 *)0;
58 Fl_Input2	*iaru_txt_d3 = (Fl_Input2 *)0;
59 Fl_Button	*iaru_btn_d3 = (Fl_Button *)0;
60 Fl_Input2	*iaru_txt_t3 = (Fl_Input2 *)0;
61 Fl_Button	*iaru_btn_t3 = (Fl_Button *)0;
62 
cb_iaru_txt_nbr(Fl_Input2 *,void *)63 static void cb_iaru_txt_nbr(Fl_Input2*, void*) {
64   iaru_cb_nbr(iaru_txt_nbr);
65 }
66 
cb_iaru_txt_station(Fl_Input2 *,void *)67 static void cb_iaru_txt_station(Fl_Input2*, void*) {
68   iaru_cb_filter_input(iaru_txt_station);
69 }
70 
cb_iaru_txt_orig(Fl_Input2 *,void *)71 static void cb_iaru_txt_orig(Fl_Input2*, void*) {
72   iaru_cb_filter_input(iaru_txt_orig);
73 }
74 
cb_iaru_btn_t1(Fl_Button *,void *)75 static void cb_iaru_btn_t1(Fl_Button*, void*) {
76   iaru_cb_set_t1();
77 }
78 
cb_iaru_btn_d1(Fl_Button *,void *)79 static void cb_iaru_btn_d1(Fl_Button*, void*) {
80   iaru_cb_set_d1();
81 }
82 
cb_iaru_btn_t2(Fl_Button *,void *)83 static void cb_iaru_btn_t2(Fl_Button*, void*) {
84   iaru_cb_set_t2();
85 }
86 
cb_iaru_btn_d2(Fl_Button *,void *)87 static void cb_iaru_btn_d2(Fl_Button*, void*) {
88   iaru_cb_set_d2();
89 }
90 
cb_iaru_btn_t3(Fl_Button *,void *)91 static void cb_iaru_btn_t3(Fl_Button*, void*) {
92   iaru_cb_set_t3();
93 }
94 
cb_iaru_btn_d3(Fl_Button *,void *)95 static void cb_iaru_btn_d3(Fl_Button*, void*) {
96   iaru_cb_set_d3();
97 }
98 
cb_iaru_txt_to(Fl_Input2 *,void *)99 static void cb_iaru_txt_to(Fl_Input2*, void*) {
100   iaru_cb_filter_input(iaru_txt_to);
101 }
102 
cb_iaru_txt_fm(Fl_Input2 *,void *)103 static void cb_iaru_txt_fm(Fl_Input2*, void*) {
104   iaru_cb_filter_input(iaru_txt_fm);
105 }
106 
cb_iaru_txt_msg(FTextEdit *,void *)107 static void cb_iaru_txt_msg(FTextEdit*, void*) {
108   iaru_btn_check->labelcolor(FL_RED);
109 iaru_btn_check->redraw_label();
110 }
111 
cb_iaru_btn_check(Fl_Button *,void *)112 static void cb_iaru_btn_check(Fl_Button*, void*) {
113   iaru_cb_check();
114 }
115 
iaru_changed(Fl_Widget *,void *)116 void iaru_changed(Fl_Widget *, void *)
117 {
118 	estimate();
119 }
120 
create_iaru_tab()121 void create_iaru_tab()
122 {
123 	int Y = tab_top;
124 	tab_iaru = new Fl_Group(0, Y, 570, 404);
125 	tab_iaru->align(FL_ALIGN_TOP);
126 
127 		iaru_txt_nbr = new Fl_Input2(4, Y+20, 102, 24, _("NR"));
128 		iaru_txt_nbr->tooltip(_("Message number at station of origin"));
129 		iaru_txt_nbr->box(FL_DOWN_BOX);
130 		iaru_txt_nbr->color((Fl_Color)FL_BACKGROUND2_COLOR);
131 		iaru_txt_nbr->selection_color((Fl_Color)FL_SELECTION_COLOR);
132 		iaru_txt_nbr->labeltype(FL_NORMAL_LABEL);
133 		iaru_txt_nbr->labelfont(0);
134 		iaru_txt_nbr->labelsize(14);
135 		iaru_txt_nbr->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
136 		iaru_txt_nbr->callback((Fl_Callback*)cb_iaru_txt_nbr);
137 		iaru_txt_nbr->align(FL_ALIGN_TOP);
138 		iaru_txt_nbr->callback(iaru_changed);
139 		iaru_txt_nbr->when(FL_WHEN_CHANGED);
140 
141 		iaru_sel_prec = new Fl_ListBox(108, Y+20, 120, 24, _("PREC"));
142 		iaru_sel_prec->tooltip(_("Message Precedence"));
143 		iaru_sel_prec->align(FL_ALIGN_TOP);
144 
145 		iaru_txt_station = new Fl_Input2(230, Y+20, 100, 24, _("STN OF ORIG"));
146 		iaru_txt_station->tooltip(_("Station call sign"));
147 		iaru_txt_station->box(FL_DOWN_BOX);
148 		iaru_txt_station->color((Fl_Color)FL_BACKGROUND2_COLOR);
149 		iaru_txt_station->selection_color((Fl_Color)FL_SELECTION_COLOR);
150 		iaru_txt_station->labeltype(FL_NORMAL_LABEL);
151 		iaru_txt_station->labelfont(0);
152 		iaru_txt_station->labelsize(14);
153 		iaru_txt_station->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
154 		iaru_txt_station->callback((Fl_Callback*)cb_iaru_txt_station);
155 		iaru_txt_station->align(FL_ALIGN_TOP);
156 		iaru_txt_station->callback(iaru_changed);
157 		iaru_txt_station->when(FL_WHEN_CHANGED);
158 
159 		iaru_txt_orig = new Fl_Input2(332, Y+20, 230, 24, _("PLACE OF ORIG"));
160 		iaru_txt_orig->tooltip(_("Place of origin"));
161 		iaru_txt_orig->box(FL_DOWN_BOX);
162 		iaru_txt_orig->color((Fl_Color)FL_BACKGROUND2_COLOR);
163 		iaru_txt_orig->selection_color((Fl_Color)FL_SELECTION_COLOR);
164 		iaru_txt_orig->labeltype(FL_NORMAL_LABEL);
165 		iaru_txt_orig->labelfont(0);
166 		iaru_txt_orig->labelsize(14);
167 		iaru_txt_orig->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
168 		iaru_txt_orig->callback((Fl_Callback*)cb_iaru_txt_orig);
169 		iaru_txt_orig->align(FL_ALIGN_TOP_LEFT);
170 		iaru_txt_orig->callback(iaru_changed);
171 		iaru_txt_orig->when(FL_WHEN_CHANGED);
172 
173 		iaru_txt_t1 = new Fl_Input2(90, Y+50, 80, 24, _("FILED TIME"));
174 		iaru_txt_t1->tooltip(_("Time of filing"));
175 		iaru_txt_t1->box(FL_DOWN_BOX);
176 		iaru_txt_t1->color((Fl_Color)FL_BACKGROUND2_COLOR);
177 		iaru_txt_t1->selection_color((Fl_Color)FL_SELECTION_COLOR);
178 		iaru_txt_t1->labeltype(FL_NORMAL_LABEL);
179 		iaru_txt_t1->labelfont(0);
180 		iaru_txt_t1->labelsize(14);
181 		iaru_txt_t1->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
182 		iaru_txt_t1->align(FL_ALIGN_LEFT);
183 		iaru_txt_t1->callback(iaru_changed);
184 		iaru_txt_t1->when(FL_WHEN_CHANGED);
185 
186 		iaru_btn_t1 = new Fl_Button(174, Y+52, 20, 20, _("..."));
187 		iaru_btn_t1->tooltip(_("Set time now"));
188 		iaru_btn_t1->callback((Fl_Callback*)cb_iaru_btn_t1);
189 
190 		iaru_txt_d1 = new Fl_Input2(290, Y+50, 80, 24, _("FILED DATE"));
191 		iaru_txt_d1->tooltip(_("Date of filing"));
192 		iaru_txt_d1->box(FL_DOWN_BOX);
193 		iaru_txt_d1->color((Fl_Color)FL_BACKGROUND2_COLOR);
194 		iaru_txt_d1->selection_color((Fl_Color)FL_SELECTION_COLOR);
195 		iaru_txt_d1->labeltype(FL_NORMAL_LABEL);
196 		iaru_txt_d1->labelfont(0);
197 		iaru_txt_d1->labelsize(14);
198 		iaru_txt_d1->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
199 		iaru_txt_d1->align(FL_ALIGN_LEFT);
200 		iaru_txt_d1->callback(iaru_changed);
201 		iaru_txt_d1->when(FL_WHEN_CHANGED);
202 
203 		iaru_btn_d1 = new Fl_Button(372, Y+52, 20, 20, _("..."));
204 		iaru_btn_d1->tooltip(_("Set today"));
205 		iaru_btn_d1->callback((Fl_Callback*)cb_iaru_btn_d1);
206 
207 		iaru_txt_check = new Fl_Input2(460, Y+50, 50, 24, _("CHECK"));
208 		iaru_txt_check->tooltip(_("Message check count"));
209 		iaru_txt_check->box(FL_DOWN_BOX);
210 		iaru_txt_check->color((Fl_Color)FL_BACKGROUND2_COLOR);
211 		iaru_txt_check->selection_color((Fl_Color)FL_SELECTION_COLOR);
212 		iaru_txt_check->labeltype(FL_NORMAL_LABEL);
213 		iaru_txt_check->labelfont(0);
214 		iaru_txt_check->labelsize(14);
215 		iaru_txt_check->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
216 		iaru_txt_check->align(FL_ALIGN_LEFT);
217 		iaru_txt_check->callback(iaru_changed);
218 		iaru_txt_check->when(FL_WHEN_CHANGED);
219 
220 		iaru_btn_check = new Fl_Button(512, Y+52, 22, 22, _("ck"));
221 		iaru_btn_check->tooltip(_("Compute check count"));
222 		iaru_btn_check->callback((Fl_Callback*)cb_iaru_btn_check);
223 
224 		iaru_txt_to = new Fl_Input2(4, Y+93, 275, 60, _("TO"));
225 		iaru_txt_to->tooltip(_("Addressee"));
226 		iaru_txt_to->type(4);
227 		iaru_txt_to->box(FL_DOWN_BOX);
228 		iaru_txt_to->color((Fl_Color)FL_BACKGROUND2_COLOR);
229 		iaru_txt_to->selection_color((Fl_Color)FL_SELECTION_COLOR);
230 		iaru_txt_to->labeltype(FL_NORMAL_LABEL);
231 		iaru_txt_to->labelfont(0);
232 		iaru_txt_to->labelsize(14);
233 		iaru_txt_to->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
234 		iaru_txt_to->callback((Fl_Callback*)cb_iaru_txt_to);
235 		iaru_txt_to->align(FL_ALIGN_TOP_LEFT);
236 		iaru_txt_to->callback(iaru_changed);
237 		iaru_txt_to->when(FL_WHEN_CHANGED);
238 
239 		iaru_txt_fm = new Fl_Input2(290, Y+93, 275, 60, _("FROM"));
240 		iaru_txt_fm->tooltip(_("Message originator"));
241 		iaru_txt_fm->type(4);
242 		iaru_txt_fm->box(FL_DOWN_BOX);
243 		iaru_txt_fm->color((Fl_Color)FL_BACKGROUND2_COLOR);
244 		iaru_txt_fm->selection_color((Fl_Color)FL_SELECTION_COLOR);
245 		iaru_txt_fm->labeltype(FL_NORMAL_LABEL);
246 		iaru_txt_fm->labelfont(0);
247 		iaru_txt_fm->labelsize(14);
248 		iaru_txt_fm->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
249 		iaru_txt_fm->callback((Fl_Callback*)cb_iaru_txt_fm);
250 		iaru_txt_fm->align(FL_ALIGN_TOP_LEFT);
251 		iaru_txt_fm->callback(iaru_changed);
252 		iaru_txt_fm->when(FL_WHEN_CHANGED);
253 
254 		iaru_txt_msg = new FTextEdit(4, Y+172, 562, 140, _("MESSAGE"));
255 		iaru_txt_msg->tooltip(_("Message contents"));
256 		iaru_txt_msg->box(FL_DOWN_BOX);
257 		iaru_txt_msg->color((Fl_Color)FL_BACKGROUND2_COLOR);
258 		iaru_txt_msg->selection_color((Fl_Color)FL_SELECTION_COLOR);
259 		iaru_txt_msg->labeltype(FL_NORMAL_LABEL);
260 		iaru_txt_msg->labelfont(0);
261 		iaru_txt_msg->labelsize(14);
262 		iaru_txt_msg->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
263 		iaru_txt_msg->callback((Fl_Callback*)cb_iaru_txt_msg);
264 		iaru_txt_msg->align(FL_ALIGN_TOP_LEFT);
265 		iaru_txt_msg->callback(iaru_changed);
266 		iaru_txt_msg->when(FL_WHEN_CHANGED);
267 
268 		iaru_txt_rcv_fm = new Fl_Input2(130, Y+315, 100, 24, _("RECEIVED FROM"));
269 		iaru_txt_rcv_fm->tooltip(_("Call sign of sender"));
270 		iaru_txt_rcv_fm->box(FL_DOWN_BOX);
271 		iaru_txt_rcv_fm->color((Fl_Color)FL_BACKGROUND2_COLOR);
272 		iaru_txt_rcv_fm->selection_color((Fl_Color)FL_SELECTION_COLOR);
273 		iaru_txt_rcv_fm->labeltype(FL_NORMAL_LABEL);
274 		iaru_txt_rcv_fm->labelfont(0);
275 		iaru_txt_rcv_fm->labelsize(14);
276 		iaru_txt_rcv_fm->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
277 		iaru_txt_rcv_fm->align(FL_ALIGN_LEFT);
278 		iaru_txt_rcv_fm->callback(iaru_changed);
279 		iaru_txt_rcv_fm->when(FL_WHEN_CHANGED);
280 
281 		iaru_txt_d2 = new Fl_Input2(280, Y+315, 80, 24, _("DATE"));
282 		iaru_txt_d2->tooltip(_("date of receipt"));
283 		iaru_txt_d2->box(FL_DOWN_BOX);
284 		iaru_txt_d2->color((Fl_Color)FL_BACKGROUND2_COLOR);
285 		iaru_txt_d2->selection_color((Fl_Color)FL_SELECTION_COLOR);
286 		iaru_txt_d2->labeltype(FL_NORMAL_LABEL);
287 		iaru_txt_d2->labelfont(0);
288 		iaru_txt_d2->labelsize(14);
289 		iaru_txt_d2->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
290 		iaru_txt_d2->align(FL_ALIGN_LEFT);
291 		iaru_txt_d2->callback(iaru_changed);
292 		iaru_txt_d2->when(FL_WHEN_CHANGED);
293 
294 		iaru_btn_d2 = new Fl_Button(362, Y+317, 20, 20, _("..."));
295 		iaru_btn_d2->tooltip(_("Set today"));
296 		iaru_btn_d2->callback((Fl_Callback*)cb_iaru_btn_d2);
297 
298 		iaru_txt_t2 = new Fl_Input2(440, Y+315, 80, 24, _("TIME"));
299 		iaru_txt_t2->tooltip(_("Time of receipt"));
300 		iaru_txt_t2->box(FL_DOWN_BOX);
301 		iaru_txt_t2->color((Fl_Color)FL_BACKGROUND2_COLOR);
302 		iaru_txt_t2->selection_color((Fl_Color)FL_SELECTION_COLOR);
303 		iaru_txt_t2->labeltype(FL_NORMAL_LABEL);
304 		iaru_txt_t2->labelfont(0);
305 		iaru_txt_t2->labelsize(14);
306 		iaru_txt_t2->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
307 		iaru_txt_t2->align(FL_ALIGN_LEFT);
308 		iaru_txt_t2->callback(iaru_changed);
309 		iaru_txt_t2->when(FL_WHEN_CHANGED);
310 
311 		iaru_btn_t2 = new Fl_Button(522, Y+317, 20, 20, _("..."));
312 		iaru_btn_t2->tooltip(_("Set time now"));
313 		iaru_btn_t2->callback((Fl_Callback*)cb_iaru_btn_t2);
314 
315 		iaru_txt_sent_to = new Fl_Input2(130, Y+340, 100, 24, _("SENT TO"));
316 		iaru_txt_sent_to->tooltip(_("Sent to call sign"));
317 		iaru_txt_sent_to->box(FL_DOWN_BOX);
318 		iaru_txt_sent_to->color((Fl_Color)FL_BACKGROUND2_COLOR);
319 		iaru_txt_sent_to->selection_color((Fl_Color)FL_SELECTION_COLOR);
320 		iaru_txt_sent_to->labeltype(FL_NORMAL_LABEL);
321 		iaru_txt_sent_to->labelfont(0);
322 		iaru_txt_sent_to->labelsize(14);
323 		iaru_txt_sent_to->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
324 		iaru_txt_sent_to->align(FL_ALIGN_LEFT);
325 		iaru_txt_sent_to->callback(iaru_changed);
326 		iaru_txt_sent_to->when(FL_WHEN_CHANGED);
327 
328 		iaru_txt_d3 = new Fl_Input2(280, Y+340, 80, 24, _("DATE"));
329 		iaru_txt_d3->tooltip(_("date message sent"));
330 		iaru_txt_d3->box(FL_DOWN_BOX);
331 		iaru_txt_d3->color((Fl_Color)FL_BACKGROUND2_COLOR);
332 		iaru_txt_d3->selection_color((Fl_Color)FL_SELECTION_COLOR);
333 		iaru_txt_d3->labeltype(FL_NORMAL_LABEL);
334 		iaru_txt_d3->labelfont(0);
335 		iaru_txt_d3->labelsize(14);
336 		iaru_txt_d3->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
337 		iaru_txt_d3->align(FL_ALIGN_LEFT);
338 		iaru_txt_d3->callback(iaru_changed);
339 		iaru_txt_d3->when(FL_WHEN_CHANGED);
340 
341 		iaru_btn_d3 = new Fl_Button(362, Y+342, 20, 20, _("..."));
342 		iaru_btn_d3->tooltip(_("Set today"));
343 		iaru_btn_d3->callback((Fl_Callback*)cb_iaru_btn_d3);
344 
345 		iaru_txt_t3 = new Fl_Input2(440, Y+340, 81, 24, _("TIME"));
346 		iaru_txt_t3->tooltip(_("Time sent"));
347 		iaru_txt_t3->box(FL_DOWN_BOX);
348 		iaru_txt_t3->color((Fl_Color)FL_BACKGROUND2_COLOR);
349 		iaru_txt_t3->selection_color((Fl_Color)FL_SELECTION_COLOR);
350 		iaru_txt_t3->labeltype(FL_NORMAL_LABEL);
351 		iaru_txt_t3->labelfont(0);
352 		iaru_txt_t3->labelsize(14);
353 		iaru_txt_t3->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
354 		iaru_txt_t3->align(FL_ALIGN_LEFT);
355 		iaru_txt_t3->callback(iaru_changed);
356 		iaru_txt_t3->when(FL_WHEN_CHANGED);
357 
358 		iaru_btn_t3 = new Fl_Button(522, Y+342, 20, 20, _("..."));
359 		iaru_btn_t3->tooltip(_("Set time now"));
360 		iaru_btn_t3->callback((Fl_Callback*)cb_iaru_btn_t3);
361 
362 	tab_iaru->end();
363 	tab_iaru->hide();
364 }
365