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_netlog = (Fl_Group *)0;
29 Fl_Tabs *tab_netlog_type = (Fl_Tabs *)0;
30 Fl_Group *tab_netlog_1 = (Fl_Group *)0;
31 Fl_Input2 *txt_netlog_event = (Fl_Input2 *)0;
32 Fl_Input2 *txt_netlog_date_fm = (Fl_Input2 *)0;
33 Fl_Button *btn_netlog_date_fm = (Fl_Button *)0;
34 Fl_Input2 *txt_netlog_date_to = (Fl_Input2 *)0;
35 Fl_Button *btn_netlog_date_to = (Fl_Button *)0;
36 Fl_Input2 *txt_netlog_time_fm = (Fl_Input2 *)0;
37 Fl_Button *btn_netlog_time_fm = (Fl_Button *)0;
38 Fl_Input2 *txt_netlog_time_to = (Fl_Input2 *)0;
39 Fl_Button *btn_netlog_time_to = (Fl_Button *)0;
40
41 Fl_Input2 *txt_netlog_prepared_by = (Fl_Input2 *)0;
42 Fl_Input2 *txt_netlog_radio_net = (Fl_Input2 *)0;
43 Fl_Input2 *txt_netlog_radio_operator = (Fl_Input2 *)0;
44 Fl_Input2 *txt_netlog_preparer_date_time = (Fl_Input2 *)0;
45 Fl_Button *btn_netlog_date_time = (Fl_Button *)0;
46
47 Fl_Button *btn_netlog_export_csv = (Fl_Button *)0;
48
49 Fl_Group *tab_netlog_2 = (Fl_Group *)0;
50 Fl_Input2 *txt_netlog_comm_time[60] = {(Fl_Input2 *)0};
51 Fl_Button *btn_netlog_comm_time[60] = {(Fl_Button *)0};
52 Fl_Input2 *txt_netlog_comm_from[60] = {(Fl_Input2 *)0};
53 Fl_Input2 *txt_netlog_comm_to[60] = {(Fl_Input2 *)0};
54 Fl_Input2 *txt_netlog_comm_msg[60] = {(Fl_Input2 *)0};
55
56 int net_bptr[60] = {\
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,34,35,36,37,38,39, \
61 40,41,42,43,44,45,46,47,48,49, \
62 50,51,52,53,54,55,56,57,58,59, \
63 };
64
cb_netlog_comm_time_changed(Fl_Widget * w,void * d)65 void cb_netlog_comm_time_changed(Fl_Widget *w, void *d)
66 {
67 int p = *(int *)d;
68 txt_netlog_comm_time[p]->value(szTime());
69 hamform_changed(txt_netlog_comm_time[p], d);
70 }
71
create_netlog_tab()72 void create_netlog_tab()
73 {
74 tab_netlog = new Fl_Group(0, tab_top, 570, 380);
75 tab_netlog->align(FL_ALIGN_TOP);
76
77 tab_netlog_type = new Fl_Tabs(0, tab_top, 570, 380);
78 tab_netlog_type->selection_color((Fl_Color)246);
79
80 tab_netlog_1 = new Fl_Group(0, tab_top+25, 570, 360, _("Event"));
81 {
82 Fl_Group* o = new Fl_Group(2, tab_top+34, 566, 146);
83 o->box(FL_ENGRAVED_FRAME);
84 o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
85
86 txt_netlog_event = new Fl_Input2(135, tab_top+40, 425, 24, _("Event Name"));
87 txt_netlog_event->tooltip(_("Event name"));
88 txt_netlog_event->box(FL_DOWN_BOX);
89 txt_netlog_event->color((Fl_Color)FL_BACKGROUND2_COLOR);
90 txt_netlog_event->selection_color((Fl_Color)FL_SELECTION_COLOR);
91 txt_netlog_event->labeltype(FL_NORMAL_LABEL);
92 txt_netlog_event->labelfont(0);
93 txt_netlog_event->labelsize(14);
94 txt_netlog_event->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
95 txt_netlog_event->align(FL_ALIGN_LEFT);
96 txt_netlog_event->callback(hamform_changed);
97 txt_netlog_event->when(FL_WHEN_CHANGED);
98
99 txt_netlog_radio_operator = new Fl_Input2(135, tab_top+67, 425, 24, _("Radio Operator"));
100 txt_netlog_radio_operator->tooltip(_("Radio Operator, Name / Callsign"));
101 txt_netlog_radio_operator->box(FL_DOWN_BOX);
102 txt_netlog_radio_operator->color((Fl_Color)FL_BACKGROUND2_COLOR);
103 txt_netlog_radio_operator->selection_color((Fl_Color)FL_SELECTION_COLOR);
104 txt_netlog_radio_operator->labeltype(FL_NORMAL_LABEL);
105 txt_netlog_radio_operator->labelfont(0);
106 txt_netlog_radio_operator->labelsize(14);
107 txt_netlog_radio_operator->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
108 txt_netlog_radio_operator->align(FL_ALIGN_LEFT);
109 txt_netlog_radio_operator->callback(hamform_changed);
110 txt_netlog_radio_operator->when(FL_WHEN_CHANGED);
111
112 txt_netlog_date_fm = new Fl_Input2(135, tab_top+93, 155, 24, _("From: date"));
113 txt_netlog_date_fm->tooltip(_("Starting date"));
114 txt_netlog_date_fm->box(FL_DOWN_BOX);
115 txt_netlog_date_fm->color((Fl_Color)FL_BACKGROUND2_COLOR);
116 txt_netlog_date_fm->selection_color((Fl_Color)FL_SELECTION_COLOR);
117 txt_netlog_date_fm->labeltype(FL_NORMAL_LABEL);
118 txt_netlog_date_fm->labelfont(0);
119 txt_netlog_date_fm->labelsize(14);
120 txt_netlog_date_fm->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
121 txt_netlog_date_fm->align(FL_ALIGN_LEFT);
122 txt_netlog_date_fm->callback(hamform_changed);
123 txt_netlog_date_fm->when(FL_WHEN_CHANGED);
124
125 btn_netlog_date_fm = new Fl_Button(292, tab_top+95, 20, 20, _("..."));
126 btn_netlog_date_fm->tooltip(_("Set today"));
127 btn_netlog_date_fm->callback((Fl_Callback*)cb_netlog_set_date_fm);
128
129 txt_netlog_time_fm = new Fl_Input2(358, tab_top+93, 80, 24, _("time"));
130 txt_netlog_time_fm->tooltip(_("Starting time"));
131 txt_netlog_time_fm->box(FL_DOWN_BOX);
132 txt_netlog_time_fm->color((Fl_Color)FL_BACKGROUND2_COLOR);
133 txt_netlog_time_fm->selection_color((Fl_Color)FL_SELECTION_COLOR);
134 txt_netlog_time_fm->labeltype(FL_NORMAL_LABEL);
135 txt_netlog_time_fm->labelfont(0);
136 txt_netlog_time_fm->labelsize(14);
137 txt_netlog_time_fm->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
138 txt_netlog_time_fm->align(FL_ALIGN_LEFT);
139 txt_netlog_time_fm->callback(hamform_changed);
140 txt_netlog_time_fm->when(FL_WHEN_CHANGED);
141
142 btn_netlog_time_fm = new Fl_Button(444, tab_top+95, 20, 20, _("..."));
143 btn_netlog_time_fm->tooltip(_("Set time now"));
144 btn_netlog_time_fm->callback((Fl_Callback*)cb_netlog_set_time_fm);
145
146 txt_netlog_date_to = new Fl_Input2(135, tab_top+119, 155, 24, _("To: date"));
147 txt_netlog_date_to->tooltip(_("Ending date"));
148 txt_netlog_date_to->box(FL_DOWN_BOX);
149 txt_netlog_date_to->color((Fl_Color)FL_BACKGROUND2_COLOR);
150 txt_netlog_date_to->selection_color((Fl_Color)FL_SELECTION_COLOR);
151 txt_netlog_date_to->labeltype(FL_NORMAL_LABEL);
152 txt_netlog_date_to->labelfont(0);
153 txt_netlog_date_to->labelsize(14);
154 txt_netlog_date_to->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
155 txt_netlog_date_to->align(FL_ALIGN_LEFT);
156 txt_netlog_date_to->callback(hamform_changed);
157 txt_netlog_date_to->when(FL_WHEN_CHANGED);
158
159 btn_netlog_date_to = new Fl_Button(292, tab_top+121, 20, 20, _("..."));
160 btn_netlog_date_to->tooltip(_("Set today"));
161 btn_netlog_date_to->callback((Fl_Callback*)cb_netlog_set_date_to);
162
163 txt_netlog_time_to = new Fl_Input2(358, tab_top+119, 80, 24, _("time"));
164 txt_netlog_time_to->tooltip(_("Ending time"));
165 txt_netlog_time_to->box(FL_DOWN_BOX);
166 txt_netlog_time_to->color((Fl_Color)FL_BACKGROUND2_COLOR);
167 txt_netlog_time_to->selection_color((Fl_Color)FL_SELECTION_COLOR);
168 txt_netlog_time_to->labeltype(FL_NORMAL_LABEL);
169 txt_netlog_time_to->labelfont(0);
170 txt_netlog_time_to->labelsize(14);
171 txt_netlog_time_to->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
172 txt_netlog_time_to->align(FL_ALIGN_LEFT);
173 txt_netlog_time_to->callback(hamform_changed);
174 txt_netlog_time_to->when(FL_WHEN_CHANGED);
175
176 btn_netlog_time_to = new Fl_Button(444, tab_top+121, 20, 20, _("..."));
177 btn_netlog_time_to->tooltip(_("Set time now"));
178 btn_netlog_time_to->callback((Fl_Callback*)cb_netlog_set_time_to);
179
180 txt_netlog_radio_net = new Fl_Input2(135, tab_top+145, 425, 24, _("Net"));
181 txt_netlog_radio_net->tooltip(_("Radio Net Name or Position/Tactical Call"));
182 txt_netlog_radio_net->box(FL_DOWN_BOX);
183 txt_netlog_radio_net->color((Fl_Color)FL_BACKGROUND2_COLOR);
184 txt_netlog_radio_net->selection_color((Fl_Color)FL_SELECTION_COLOR);
185 txt_netlog_radio_net->labeltype(FL_NORMAL_LABEL);
186 txt_netlog_radio_net->labelfont(0);
187 txt_netlog_radio_net->labelsize(14);
188 txt_netlog_radio_net->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
189 txt_netlog_radio_net->align(FL_ALIGN_LEFT);
190 txt_netlog_radio_net->callback(hamform_changed);
191 txt_netlog_radio_net->when(FL_WHEN_CHANGED);
192
193 o->end();
194 } // Fl_Group* o
195
196 {
197 Fl_Group* o = new Fl_Group(2, tab_top+220, 566, 62);
198 o->box(FL_ENGRAVED_FRAME);
199
200 txt_netlog_prepared_by = new Fl_Input2(135, tab_top+226, 425, 24, _("Prepared by"));
201 txt_netlog_prepared_by->tooltip(_("Name of preparer"));
202 txt_netlog_prepared_by->box(FL_DOWN_BOX);
203 txt_netlog_prepared_by->color((Fl_Color)FL_BACKGROUND2_COLOR);
204 txt_netlog_prepared_by->selection_color((Fl_Color)FL_SELECTION_COLOR);
205 txt_netlog_prepared_by->labeltype(FL_NORMAL_LABEL);
206 txt_netlog_prepared_by->labelfont(0);
207 txt_netlog_prepared_by->labelsize(14);
208 txt_netlog_prepared_by->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
209 txt_netlog_prepared_by->align(FL_ALIGN_LEFT);
210 txt_netlog_prepared_by->callback(hamform_changed);
211 txt_netlog_prepared_by->when(FL_WHEN_CHANGED);
212
213 txt_netlog_preparer_date_time = new Fl_Input2(135, tab_top+252, 250, 24, _("Date/Time"));
214 txt_netlog_preparer_date_time->tooltip(_("Date / Time"));
215 txt_netlog_preparer_date_time->box(FL_DOWN_BOX);
216 txt_netlog_preparer_date_time->color((Fl_Color)FL_BACKGROUND2_COLOR);
217 txt_netlog_preparer_date_time->selection_color((Fl_Color)FL_SELECTION_COLOR);
218 txt_netlog_preparer_date_time->labeltype(FL_NORMAL_LABEL);
219 txt_netlog_preparer_date_time->labelfont(0);
220 txt_netlog_preparer_date_time->labelsize(14);
221 txt_netlog_preparer_date_time->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
222 txt_netlog_preparer_date_time->align(FL_ALIGN_LEFT);
223 txt_netlog_preparer_date_time->callback(hamform_changed);
224 txt_netlog_preparer_date_time->when(FL_WHEN_CHANGED);
225
226 btn_netlog_date_time = new Fl_Button(390, tab_top+254, 20, 20, _("..."));
227 btn_netlog_date_time->tooltip(_("Set today / now"));
228 btn_netlog_date_time->callback((Fl_Callback*)cb_netlog_set_date_time);
229
230 o->end();
231
232 btn_netlog_export_csv = new Fl_Button(450, tab_top+340, 100, 24, _("Export CSV"));
233 btn_netlog_export_csv->tooltip(_("Export Event data to a CSV file"));
234 btn_netlog_export_csv->callback((Fl_Callback*)netlog_csv);
235
236
237 } // Fl_Group* o
238
239 tab_netlog_1->end();
240
241 tab_netlog_2 = new Fl_Group(0, tab_top+25, 570, 360, _("Communications Log"));
242 tab_netlog_2->hide();
243
244 Fl_Group *g2a = new Fl_Group(0, tab_top+30, 569, 355);
245
246 Fl_Box* bx1 = new Fl_Box(7, tab_top+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(), tab_top+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(), tab_top+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(), tab_top+30, 280, 20, _("Message"));
259 bx4->box(FL_DOWN_BOX);
260 bx4->color((Fl_Color)215);
261
262 Fl_Scroll* scrl = new Fl_Scroll(5, tab_top+52, 560, 320);
263 scrl->type(Fl_Scroll::VERTICAL_ALWAYS);
264 scrl->box(FL_DOWN_BOX);
265 for (int i = 0; i < 60; i++) {
266
267 txt_netlog_comm_time[i] = new Fl_Input2(7, tab_top+52 + i*22, 50, 22);
268 txt_netlog_comm_time[i]->tooltip(_(""));
269 txt_netlog_comm_time[i]->callback(hamform_changed);
270 txt_netlog_comm_time[i]->when(FL_WHEN_CHANGED);
271
272 btn_netlog_comm_time[i] = new Fl_Button(
273 txt_netlog_comm_time[i]->x() + txt_netlog_comm_time[i]->w(), tab_top+52 + i*22, 20, 22, _(".."));
274 btn_netlog_comm_time[i]->tooltip(_("Set time now"));
275 btn_netlog_comm_time[i]->callback(cb_netlog_comm_time_changed, (void *)&net_bptr[i]);
276
277 txt_netlog_comm_from[i] = new Fl_Input2(
278 btn_netlog_comm_time[i]->x() + btn_netlog_comm_time[i]->w(), tab_top+52 + i*22, 95, 22, "");
279 txt_netlog_comm_from[i]->tooltip(_(""));
280 txt_netlog_comm_from[i]->callback(hamform_changed);
281 txt_netlog_comm_from[i]->when(FL_WHEN_CHANGED);
282
283 txt_netlog_comm_to[i] = new Fl_Input2(
284 txt_netlog_comm_from[i]->x() + txt_netlog_comm_from[i]->w(), tab_top+52 + i*22, 95, 22);
285 txt_netlog_comm_to[i]->tooltip(_(""));
286 txt_netlog_comm_to[i]->callback(hamform_changed);
287 txt_netlog_comm_to[i]->when(FL_WHEN_CHANGED);
288
289 txt_netlog_comm_msg[i] = new Fl_Input2(
290 txt_netlog_comm_to[i]->x() + txt_netlog_comm_to[i]->w(), tab_top+52 + i*22, 280, 22);
291 txt_netlog_comm_msg[i]->tooltip(_(""));
292 txt_netlog_comm_msg[i]->callback(hamform_changed);
293 txt_netlog_comm_msg[i]->when(FL_WHEN_CHANGED);
294 }
295 scrl->end();
296 g2a->end();
297 Fl_Group *g2b = new Fl_Group(569, tab_top+30, 1, 355);
298 g2b->end();
299 tab_netlog_2->end();
300 tab_netlog_2->resizable(g2b);
301
302 tab_netlog_type->end();
303 Fl_Group::current()->resizable(tab_netlog_type);
304 tab_netlog->end();
305
306 tab_netlog->hide();
307 }
308
309