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_ics309 = (Fl_Group *)0;
29 Fl_Tabs		*tab_ics309_type = (Fl_Tabs *)0;
30 Fl_Group	*tab_309_1 = (Fl_Group *)0;
31 Fl_Input2	*txt_309_incident = (Fl_Input2 *)0;
32 Fl_Input2	*txt_309_date_fm = (Fl_Input2 *)0;
33 Fl_Button	*btn_309_date_fm = (Fl_Button *)0;
34 Fl_Input2	*txt_309_date_to = (Fl_Input2 *)0;
35 Fl_Button	*btn_309_date_to = (Fl_Button *)0;
36 Fl_Input2	*txt_309_time_fm = (Fl_Input2 *)0;
37 Fl_Button	*btn_309_time_fm = (Fl_Button *)0;
38 Fl_Input2	*txt_309_time_to = (Fl_Input2 *)0;
39 Fl_Button	*btn_309_time_to = (Fl_Button *)0;
40 
41 Fl_Input2	*txt_309_prepared_by = (Fl_Input2 *)0;
42 Fl_Input2	*txt_309_radio_net = (Fl_Input2 *)0;
43 Fl_Input2	*txt_309_radio_operator = (Fl_Input2 *)0;
44 Fl_Input2	*txt_309_preparer_date_time = (Fl_Input2 *)0;
45 Fl_Button	*btn_309_date_time = (Fl_Button *)0;
46 
47 Fl_Button	*btn_309_export_csv = (Fl_Button *)0;
48 
49 Fl_Group	*tab_309_2 = (Fl_Group *)0;
50 Fl_Input2	*txt_309_comm_time[34] = {(Fl_Input2 *)0};
51 Fl_Button	*btn_309_comm_time[34] = {(Fl_Button *)0};
52 Fl_Input2	*txt_309_comm_from[34] = {(Fl_Input2 *)0};
53 Fl_Input2	*txt_309_comm_to[34]   = {(Fl_Input2 *)0};
54 Fl_Input2	*txt_309_comm_msg[34]  = {(Fl_Input2 *)0};
55 
56 int bptr[34] = {\
57  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \
58 10,11,12,13,14,15,16,17,18,19, \
59 20,21,22,23,24,25,26,27,28,29, \
60 30,31,32,33 };
61 
cb_309_comm_time_changed(Fl_Widget * w,void * d)62 void cb_309_comm_time_changed(Fl_Widget *w, void *d)
63 {
64 	int p = *(int *)d;
65 	txt_309_comm_time[p]->value(szTime(progStatus.UTC));
66 	ics_changed(txt_309_comm_time[p], d);
67 }
68 
create_ics309_tab()69 void create_ics309_tab()
70 {
71 	int Y = tab_top;
72 
73 	tab_ics309 = new Fl_Group(0, Y, 570, 390);
74 	tab_ics309->align(FL_ALIGN_TOP);
75 
76 	tab_ics309_type = new Fl_Tabs(0, Y+2, 570, 387);
77 	tab_ics309_type->selection_color((Fl_Color)246);
78 
79 		tab_309_1 = new Fl_Group(0, Y+25, 570, 360, _("Incident"));
80 			{
81 			Fl_Group* o = new Fl_Group(2, Y+34, 566, 146);
82 			o->box(FL_ENGRAVED_FRAME);
83 			o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
84 
85 				txt_309_incident = new Fl_Input2(135, Y+40, 425, 24, _("Incident Name"));
86 				txt_309_incident->tooltip(_("Incident name"));
87 				txt_309_incident->box(FL_DOWN_BOX);
88 				txt_309_incident->color((Fl_Color)FL_BACKGROUND2_COLOR);
89 				txt_309_incident->selection_color((Fl_Color)FL_SELECTION_COLOR);
90 				txt_309_incident->labeltype(FL_NORMAL_LABEL);
91 				txt_309_incident->labelfont(0);
92 				txt_309_incident->labelsize(14);
93 				txt_309_incident->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
94 				txt_309_incident->align(FL_ALIGN_LEFT);
95 				txt_309_incident->callback(ics_changed);
96 				txt_309_incident->when(FL_WHEN_CHANGED);
97 
98 				txt_309_radio_operator = new Fl_Input2(135, Y+67, 425, 24, _("Radio Operator"));
99 				txt_309_radio_operator->tooltip(_("Radio Operator, Name / Callsign"));
100 				txt_309_radio_operator->box(FL_DOWN_BOX);
101 				txt_309_radio_operator->color((Fl_Color)FL_BACKGROUND2_COLOR);
102 				txt_309_radio_operator->selection_color((Fl_Color)FL_SELECTION_COLOR);
103 				txt_309_radio_operator->labeltype(FL_NORMAL_LABEL);
104 				txt_309_radio_operator->labelfont(0);
105 				txt_309_radio_operator->labelsize(14);
106 				txt_309_radio_operator->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
107 				txt_309_radio_operator->align(FL_ALIGN_LEFT);
108 				txt_309_radio_operator->callback(ics_changed);
109 				txt_309_radio_operator->when(FL_WHEN_CHANGED);
110 
111 				txt_309_date_fm = new Fl_Input2(135, Y+93, 155, 24, _("From: date"));
112 				txt_309_date_fm->tooltip(_("Starting date"));
113 				txt_309_date_fm->box(FL_DOWN_BOX);
114 				txt_309_date_fm->color((Fl_Color)FL_BACKGROUND2_COLOR);
115 				txt_309_date_fm->selection_color((Fl_Color)FL_SELECTION_COLOR);
116 				txt_309_date_fm->labeltype(FL_NORMAL_LABEL);
117 				txt_309_date_fm->labelfont(0);
118 				txt_309_date_fm->labelsize(14);
119 				txt_309_date_fm->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
120 				txt_309_date_fm->align(FL_ALIGN_LEFT);
121 				txt_309_date_fm->callback(ics_changed);
122 				txt_309_date_fm->when(FL_WHEN_CHANGED);
123 
124 				btn_309_date_fm = new Fl_Button(292, Y+95, 20, 20, _("..."));
125 				btn_309_date_fm->tooltip(_("Set today"));
126 				btn_309_date_fm->callback((Fl_Callback*)cb_309_set_date_fm);
127 
128 				txt_309_time_fm = new Fl_Input2(358, Y+93, 80, 24, _("time"));
129 				txt_309_time_fm->tooltip(_("Starting time"));
130 				txt_309_time_fm->box(FL_DOWN_BOX);
131 				txt_309_time_fm->color((Fl_Color)FL_BACKGROUND2_COLOR);
132 				txt_309_time_fm->selection_color((Fl_Color)FL_SELECTION_COLOR);
133 				txt_309_time_fm->labeltype(FL_NORMAL_LABEL);
134 				txt_309_time_fm->labelfont(0);
135 				txt_309_time_fm->labelsize(14);
136 				txt_309_time_fm->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
137 				txt_309_time_fm->align(FL_ALIGN_LEFT);
138 				txt_309_time_fm->callback(ics_changed);
139 				txt_309_time_fm->when(FL_WHEN_CHANGED);
140 
141 				btn_309_time_fm = new Fl_Button(444, Y+95, 20, 20, _("..."));
142 				btn_309_time_fm->tooltip(_("Set time now"));
143 				btn_309_time_fm->callback((Fl_Callback*)cb_309_set_time_fm);
144 
145 				txt_309_date_to = new Fl_Input2(135, Y+119, 155, 24, _("To: date"));
146 				txt_309_date_to->tooltip(_("Ending date"));
147 				txt_309_date_to->box(FL_DOWN_BOX);
148 				txt_309_date_to->color((Fl_Color)FL_BACKGROUND2_COLOR);
149 				txt_309_date_to->selection_color((Fl_Color)FL_SELECTION_COLOR);
150 				txt_309_date_to->labeltype(FL_NORMAL_LABEL);
151 				txt_309_date_to->labelfont(0);
152 				txt_309_date_to->labelsize(14);
153 				txt_309_date_to->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
154 				txt_309_date_to->align(FL_ALIGN_LEFT);
155 				txt_309_date_to->callback(ics_changed);
156 				txt_309_date_to->when(FL_WHEN_CHANGED);
157 
158 				btn_309_date_to = new Fl_Button(292, Y+121, 20, 20, _("..."));
159 				btn_309_date_to->tooltip(_("Set today"));
160 				btn_309_date_to->callback((Fl_Callback*)cb_309_set_date_to);
161 
162 				txt_309_time_to = new Fl_Input2(358, Y+119, 80, 24, _("time"));
163 				txt_309_time_to->tooltip(_("Ending time"));
164 				txt_309_time_to->box(FL_DOWN_BOX);
165 				txt_309_time_to->color((Fl_Color)FL_BACKGROUND2_COLOR);
166 				txt_309_time_to->selection_color((Fl_Color)FL_SELECTION_COLOR);
167 				txt_309_time_to->labeltype(FL_NORMAL_LABEL);
168 				txt_309_time_to->labelfont(0);
169 				txt_309_time_to->labelsize(14);
170 				txt_309_time_to->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
171 				txt_309_time_to->align(FL_ALIGN_LEFT);
172 				txt_309_time_to->callback(ics_changed);
173 				txt_309_time_to->when(FL_WHEN_CHANGED);
174 
175 				btn_309_time_to = new Fl_Button(444, Y+121, 20, 20, _("..."));
176 				btn_309_time_to->tooltip(_("Set time now"));
177 				btn_309_time_to->callback((Fl_Callback*)cb_309_set_time_to);
178 
179 				txt_309_radio_net = new Fl_Input2(135, Y+145, 425, 24, _("Net"));
180 				txt_309_radio_net->tooltip(_("Radio Net Name or Position/Tactical Call"));
181 				txt_309_radio_net->box(FL_DOWN_BOX);
182 				txt_309_radio_net->color((Fl_Color)FL_BACKGROUND2_COLOR);
183 				txt_309_radio_net->selection_color((Fl_Color)FL_SELECTION_COLOR);
184 				txt_309_radio_net->labeltype(FL_NORMAL_LABEL);
185 				txt_309_radio_net->labelfont(0);
186 				txt_309_radio_net->labelsize(14);
187 				txt_309_radio_net->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
188 				txt_309_radio_net->align(FL_ALIGN_LEFT);
189 				txt_309_radio_net->callback(ics_changed);
190 				txt_309_radio_net->when(FL_WHEN_CHANGED);
191 
192 				o->end();
193 			} // Fl_Group* o
194 
195 			{
196 			Fl_Group* o = new Fl_Group(2, Y+220, 566, 62);
197 				o->box(FL_ENGRAVED_FRAME);
198 
199 				txt_309_prepared_by = new Fl_Input2(135, Y+226, 425, 24, _("Prepared by"));
200 				txt_309_prepared_by->tooltip(_("Name of preparer"));
201 				txt_309_prepared_by->box(FL_DOWN_BOX);
202 				txt_309_prepared_by->color((Fl_Color)FL_BACKGROUND2_COLOR);
203 				txt_309_prepared_by->selection_color((Fl_Color)FL_SELECTION_COLOR);
204 				txt_309_prepared_by->labeltype(FL_NORMAL_LABEL);
205 				txt_309_prepared_by->labelfont(0);
206 				txt_309_prepared_by->labelsize(14);
207 				txt_309_prepared_by->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
208 				txt_309_prepared_by->align(FL_ALIGN_LEFT);
209 				txt_309_prepared_by->callback(ics_changed);
210 				txt_309_prepared_by->when(FL_WHEN_CHANGED);
211 
212 				txt_309_preparer_date_time = new Fl_Input2(135, Y+252, 250, 24, _("Date/Time"));
213 				txt_309_preparer_date_time->tooltip(_("Date / Time"));
214 				txt_309_preparer_date_time->box(FL_DOWN_BOX);
215 				txt_309_preparer_date_time->color((Fl_Color)FL_BACKGROUND2_COLOR);
216 				txt_309_preparer_date_time->selection_color((Fl_Color)FL_SELECTION_COLOR);
217 				txt_309_preparer_date_time->labeltype(FL_NORMAL_LABEL);
218 				txt_309_preparer_date_time->labelfont(0);
219 				txt_309_preparer_date_time->labelsize(14);
220 				txt_309_preparer_date_time->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
221 				txt_309_preparer_date_time->align(FL_ALIGN_LEFT);
222 				txt_309_preparer_date_time->callback(ics_changed);
223 				txt_309_preparer_date_time->when(FL_WHEN_CHANGED);
224 
225 				btn_309_date_time = new Fl_Button(390, Y+254, 20, 20, _("..."));
226 				btn_309_date_time->tooltip(_("Set today / now"));
227 				btn_309_date_time->callback((Fl_Callback*)cb_309_set_date_time);
228 
229 				o->end();
230 
231 				btn_309_export_csv = new Fl_Button(450, Y+340, 100, 24, _("Export CSV"));
232 				btn_309_export_csv->tooltip(_("Export Incident data to a CSV file"));
233 				btn_309_export_csv->callback((Fl_Callback*)ics309_csv);
234 
235 
236 			} // Fl_Group* o
237 
238 		tab_309_1->end();
239 
240 		tab_309_2 = new Fl_Group(0, Y+25, 570, 360, _("Communications Log"));
241 		tab_309_2->hide();
242 
243 		Fl_Group *g1 = new Fl_Group( 0, Y+30, 569, 355);
244 		g1->box(FL_FLAT_BOX);
245 
246 			Fl_Box* bx1 = new Fl_Box(5, Y+30, 70, 20, _("Time"));
247 			bx1->box(FL_DOWN_BOX);
248 			bx1->color((Fl_Color)215);
249 
250 			Fl_Box* bx2 = new Fl_Box(bx1->x() + bx1->w(), Y+30, 95, 20, _("From"));
251 			bx2->box(FL_DOWN_BOX);
252 			bx2->color((Fl_Color)215);
253 
254 			Fl_Box* bx3 = new Fl_Box(bx2->x() + bx2->w(), Y+30, 95, 20, _("To"));
255 			bx3->box(FL_DOWN_BOX);
256 			bx3->color((Fl_Color)215);
257 
258 			Fl_Box* bx4 = new Fl_Box(bx3->x() + bx3->w(), Y+30, 284, 20, _("Message"));
259 			bx4->box(FL_DOWN_BOX);
260 			bx4->color((Fl_Color)215);
261 
262 			Fl_Scroll* scrl = new Fl_Scroll(3, Y+52, 566, 334);
263 				scrl->type(Fl_Scroll::BOTH_ALWAYS);
264 				scrl->box(FL_DOWN_BOX);
265 
266 				for (int i = 0; i < 34; i++) {
267 
268 					txt_309_comm_time[i] = new Fl_Input2(5, Y+52 + i*22, 50, 22);
269 					txt_309_comm_time[i]->tooltip(_(""));
270 					txt_309_comm_time[i]->callback(ics_changed);
271 					txt_309_comm_time[i]->when(FL_WHEN_CHANGED);
272 
273 					btn_309_comm_time[i] = new Fl_Button(
274 						txt_309_comm_time[i]->x() + txt_309_comm_time[i]->w(),Y+52 + i*22,
275 						20, 20, _(".."));
276 					btn_309_comm_time[i]->tooltip(_("Set time now"));
277 					btn_309_comm_time[i]->callback(cb_309_comm_time_changed, (void *)&bptr[i]);
278 
279 					txt_309_comm_from[i] = new Fl_Input2(
280 						btn_309_comm_time[i]->x() + btn_309_comm_time[i]->w(),Y+52 + i*22,
281 						95, 22, "");
282 					txt_309_comm_from[i]->tooltip(_(""));
283 					txt_309_comm_from[i]->callback(ics_changed);
284 					txt_309_comm_from[i]->when(FL_WHEN_CHANGED);
285 
286 					txt_309_comm_to[i] = new Fl_Input2(
287 						txt_309_comm_from[i]->x() + txt_309_comm_from[i]->w(),Y+52 + i*22,
288 						95, 22);
289 					txt_309_comm_to[i]->tooltip(_(""));
290 					txt_309_comm_to[i]->callback(ics_changed);
291 					txt_309_comm_to[i]->when(FL_WHEN_CHANGED);
292 
293 					txt_309_comm_msg[i] = new Fl_Input2(
294 						txt_309_comm_to[i]->x() + txt_309_comm_to[i]->w(),Y+52 + i*22,
295 						285, 22);
296 					txt_309_comm_msg[i]->tooltip(_(""));
297 					txt_309_comm_msg[i]->callback(ics_changed);
298 					txt_309_comm_msg[i]->when(FL_WHEN_CHANGED);
299 				}
300 				scrl->end();
301 
302 		g1->end();
303 
304 		Fl_Group *g2 = new Fl_Group( 569, Y+30, 1, 355);
305 		g2->box(FL_FLAT_BOX);
306 
307 		tab_309_2->end();
308 		tab_309_2->resizable(g2);
309 
310 	tab_ics309_type->end();
311 	Fl_Group::current()->resizable(tab_ics309_type);
312 	tab_ics309->end();
313 
314 	tab_ics309->hide();
315 }
316 
317