| 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 <string> |
| 22 |
|
| 23 |
#include "gettext.h" |
| 24 |
#include "status.h" |
| 25 |
#include "util.h" |
| 26 |
|
| 27 |
#include "flmsg_dialog.h" |
| 28 |
#include "flmsg.h" |
| 29 |
|
| 30 |
Fl_Group *tab_cap110 = (Fl_Group *)0; |
| 31 |
Fl_Tabs *tab_cap110_type = (Fl_Tabs *)0; |
| 32 |
|
| 33 |
Fl_Input2 *txt_110_mission_nbr = (Fl_Input2 *)0; |
| 34 |
Fl_Input2 *txt_110_station = (Fl_Input2 *)0; |
| 35 |
Fl_Input2 *txt_110_date = (Fl_Input2 *)0; |
| 36 |
Fl_Button *btn_110_date = (Fl_Button *)0; |
| 37 |
Fl_Group *desig_src = (Fl_Group *)0; |
| 38 |
Fl_Input2 *txt_110_ds_a = (Fl_Input2 *)0; |
| 39 |
Fl_Input2 *txt_110_ds_b = (Fl_Input2 *)0; |
| 40 |
Fl_Input2 *txt_110_ds_c = (Fl_Input2 *)0; |
| 41 |
Fl_Input2 *txt_110_ds_d = (Fl_Input2 *)0; |
| 42 |
Fl_Input2 *txt_110_ds_e = (Fl_Input2 *)0; |
| 43 |
Fl_Input2 *txt_110_ds_f = (Fl_Input2 *)0; |
| 44 |
|
| 45 |
Fl_Input2 *txt_110_comm_time[23] = {(Fl_Input2 *)0}; |
| 46 |
Fl_Button *btn_110_comm_time[23] = {(Fl_Button *)0}; |
| 47 |
Fl_Input2 *txt_110_comm_call[23] = {(Fl_Input2 *)0}; |
| 48 |
Fl_Input2 *txt_110_comm_chref[23] = {(Fl_Input2 *)0}; |
| 49 |
Fl_Input2 *txt_110_comm_rem[23] = {(Fl_Input2 *)0}; |
| 50 |
|
| 51 |
int cap_bptr[23] = {\ |
| 52 |
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \ |
| 53 |
10,11,12,13,14,15,16,17,18,19, \ |
| 54 |
20,21,22 }; |
| 55 |
|
| 56 |
void cap110_changed(Fl_Widget *w, void *) |
| 57 |
{ |
| 58 |
Fl_Input2 *inp = (Fl_Input2 *)w; |
| 59 |
std::string s = inp->value(); |
| 60 |
int len = s.length(); |
| 61 |
int maxlen = 1000; |
| 62 |
if (inp == txt_110_mission_nbr) maxlen = 14; |
| 63 |
else if (inp == txt_110_station) maxlen = 48; |
| 64 |
else if (inp == txt_110_ds_a) maxlen = 12; |
| 65 |
else if (inp == txt_110_ds_b) maxlen = 12; |
| 66 |
else if (inp == txt_110_ds_c) maxlen = 12; |
| 67 |
else if (inp == txt_110_ds_d) maxlen = 12; |
| 68 |
else if (inp == txt_110_ds_e) maxlen = 12; |
| 69 |
else if (inp == txt_110_ds_f) maxlen = 12; |
| 70 |
else for (int i = 0; i < 23; i++) { |
| 71 |
if (inp == txt_110_comm_chref[i]) { maxlen = 6; break; } |
| 72 |
if (inp == txt_110_comm_call[i]) { maxlen = 10; break; } |
| 73 |
if (inp == txt_110_comm_time[i]) { maxlen = 8; break; } |
| 74 |
if (inp == txt_110_comm_rem[i]) { maxlen = 53; break; } |
| 75 |
} |
| 76 |
if (len > maxlen) { s.erase(len-1); inp->value(s.c_str()); } |
| 77 |
estimate(); |
| 78 |
} |
| 79 |
|
| 80 |
void cb_110_comm_time_changed(Fl_Widget *w, void *d) |
| 81 |
{ |
| 82 |
int p = *(int *)d; |
| 83 |
txt_110_comm_time[p]->value(szTime(progStatus.UTC) ); |
| 84 |
cap110_changed(txt_110_comm_time[p], d); |
| 85 |
} |
| 86 |
|
| 87 |
void create_cap110_tab() |
| 88 |
{ |
| 89 |
int Y = tab_top; |
| 90 |
tab_cap110 = new Fl_Group(0, Y, 570, 380); |
| 91 |
tab_cap110->align(FL_ALIGN_TOP); |
| 92 |
|
| 93 |
Y += 24; |
| 94 |
txt_110_mission_nbr = new Fl_Input2(5, Y, 110, 24, _("Mission #")); |
| 95 |
txt_110_mission_nbr->tooltip(_("")); |
| 96 |
txt_110_mission_nbr->box(FL_DOWN_BOX); |
| 97 |
txt_110_mission_nbr->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 98 |
txt_110_mission_nbr->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 99 |
txt_110_mission_nbr->labeltype(FL_NORMAL_LABEL); |
| 100 |
txt_110_mission_nbr->labelfont(0); |
| 101 |
txt_110_mission_nbr->labelsize(13); |
| 102 |
txt_110_mission_nbr->textsize(11); |
| 103 |
txt_110_mission_nbr->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 104 |
txt_110_mission_nbr->align(FL_ALIGN_TOP_LEFT); |
| 105 |
txt_110_mission_nbr->callback(cap110_changed); |
| 106 |
txt_110_mission_nbr->when(FL_WHEN_CHANGED); |
| 107 |
|
| 108 |
txt_110_station = new Fl_Input2(117, Y, 350, 24, _("Station Functional Desc.")); |
| 109 |
txt_110_station->tooltip(_("")); |
| 110 |
txt_110_station->box(FL_DOWN_BOX); |
| 111 |
txt_110_station->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 112 |
txt_110_station->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 113 |
txt_110_station->labeltype(FL_NORMAL_LABEL); |
| 114 |
txt_110_station->labelfont(0); |
| 115 |
txt_110_station->labelsize(13); |
| 116 |
txt_110_station->textsize(11); |
| 117 |
txt_110_station->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 118 |
txt_110_station->align(FL_ALIGN_TOP_LEFT); |
| 119 |
txt_110_station->callback(cap110_changed); |
| 120 |
txt_110_station->when(FL_WHEN_CHANGED); |
| 121 |
|
| 122 |
txt_110_date = new Fl_Input2(469, Y, 70, 24, _("Date")); |
| 123 |
txt_110_date->tooltip(_("Report date")); |
| 124 |
txt_110_date->box(FL_DOWN_BOX); |
| 125 |
txt_110_date->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 126 |
txt_110_date->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 127 |
txt_110_date->labeltype(FL_NORMAL_LABEL); |
| 128 |
txt_110_date->labelfont(0); |
| 129 |
txt_110_date->labelsize(13); |
| 130 |
txt_110_date->textsize(11); |
| 131 |
txt_110_date->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 132 |
txt_110_date->align(FL_ALIGN_TOP_LEFT); |
| 133 |
txt_110_date->callback(cap110_changed); |
| 134 |
txt_110_date->when(FL_WHEN_CHANGED); |
| 135 |
|
| 136 |
btn_110_date = new Fl_Button(542, Y, 20, 20, _("...")); |
| 137 |
btn_110_date->tooltip(_("Set today")); |
| 138 |
btn_110_date->callback((Fl_Callback*)cap110_set_date); |
| 139 |
|
| 140 |
Y += 30; |
| 141 |
desig_src = new Fl_Group(2, Y, 566, 60, _("DESIGNATOR/SOURCE")); |
| 142 |
{ |
| 143 |
desig_src->box(FL_FLAT_BOX); |
| 144 |
desig_src->align (FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_TOP); |
| 145 |
desig_src->labelfont(0); |
| 146 |
desig_src->labelsize(13); |
| 147 |
|
| 148 |
Y += 34; |
| 149 |
txt_110_ds_a = new Fl_Input2(10, Y, 90, 24, _("A")); |
| 150 |
txt_110_ds_a->tooltip(_("Designator/Source A")); |
| 151 |
txt_110_ds_a->box(FL_DOWN_BOX); |
| 152 |
txt_110_ds_a->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 153 |
txt_110_ds_a->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 154 |
txt_110_ds_a->labeltype(FL_NORMAL_LABEL); |
| 155 |
txt_110_ds_a->labelfont(0); |
| 156 |
txt_110_ds_a->labelsize(13); |
| 157 |
txt_110_ds_a->textsize(11); |
| 158 |
txt_110_ds_a->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 159 |
txt_110_ds_a->align(FL_ALIGN_TOP_LEFT); |
| 160 |
txt_110_ds_a->callback(cap110_changed); |
| 161 |
txt_110_ds_a->when(FL_WHEN_CHANGED); |
| 162 |
|
| 163 |
txt_110_ds_b = new Fl_Input2(102, Y, 90, 24, _("B")); |
| 164 |
txt_110_ds_b->tooltip(_("Designator/Source B")); |
| 165 |
txt_110_ds_b->box(FL_DOWN_BOX); |
| 166 |
txt_110_ds_b->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 167 |
txt_110_ds_b->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 168 |
txt_110_ds_b->labeltype(FL_NORMAL_LABEL); |
| 169 |
txt_110_ds_b->labelfont(0); |
| 170 |
txt_110_ds_b->labelsize(13); |
| 171 |
txt_110_ds_b->textsize(11); |
| 172 |
txt_110_ds_b->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 173 |
txt_110_ds_b->align(FL_ALIGN_TOP_LEFT); |
| 174 |
txt_110_ds_b->callback(cap110_changed); |
| 175 |
txt_110_ds_b->when(FL_WHEN_CHANGED); |
| 176 |
|
| 177 |
txt_110_ds_c = new Fl_Input2(194, Y, 90, 24, _("C")); |
| 178 |
txt_110_ds_c->tooltip(_("Designator/Source C")); |
| 179 |
txt_110_ds_c->box(FL_DOWN_BOX); |
| 180 |
txt_110_ds_c->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 181 |
txt_110_ds_c->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 182 |
txt_110_ds_c->labeltype(FL_NORMAL_LABEL); |
| 183 |
txt_110_ds_c->labelfont(0); |
| 184 |
txt_110_ds_c->labelsize(13); |
| 185 |
txt_110_ds_c->textsize(11); |
| 186 |
txt_110_ds_c->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 187 |
txt_110_ds_c->align(FL_ALIGN_TOP_LEFT); |
| 188 |
txt_110_ds_c->callback(cap110_changed); |
| 189 |
txt_110_ds_c->when(FL_WHEN_CHANGED); |
| 190 |
|
| 191 |
txt_110_ds_d = new Fl_Input2(286, Y, 90, 24, _("D")); |
| 192 |
txt_110_ds_d->tooltip(_("Designator/Source D")); |
| 193 |
txt_110_ds_d->box(FL_DOWN_BOX); |
| 194 |
txt_110_ds_d->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 195 |
txt_110_ds_d->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 196 |
txt_110_ds_d->labeltype(FL_NORMAL_LABEL); |
| 197 |
txt_110_ds_d->labelfont(0); |
| 198 |
txt_110_ds_d->labelsize(13); |
| 199 |
txt_110_ds_d->textsize(11); |
| 200 |
txt_110_ds_d->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 201 |
txt_110_ds_d->align(FL_ALIGN_TOP_LEFT); |
| 202 |
txt_110_ds_d->callback(cap110_changed); |
| 203 |
txt_110_ds_d->when(FL_WHEN_CHANGED); |
| 204 |
|
| 205 |
txt_110_ds_e = new Fl_Input2(378, Y, 90, 24, _("E")); |
| 206 |
txt_110_ds_e->tooltip(_("Designator/Source E")); |
| 207 |
txt_110_ds_e->box(FL_DOWN_BOX); |
| 208 |
txt_110_ds_e->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 209 |
txt_110_ds_e->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 210 |
txt_110_ds_e->labeltype(FL_NORMAL_LABEL); |
| 211 |
txt_110_ds_e->labelfont(0); |
| 212 |
txt_110_ds_e->labelsize(13); |
| 213 |
txt_110_ds_e->textsize(11); |
| 214 |
txt_110_ds_e->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 215 |
txt_110_ds_e->align(FL_ALIGN_TOP_LEFT); |
| 216 |
txt_110_ds_e->callback(cap110_changed); |
| 217 |
txt_110_ds_e->when(FL_WHEN_CHANGED); |
| 218 |
|
| 219 |
txt_110_ds_f = new Fl_Input2(470, Y, 90, 24, _("F")); |
| 220 |
txt_110_ds_f->tooltip(_("Designator/Source F")); |
| 221 |
txt_110_ds_f->box(FL_DOWN_BOX); |
| 222 |
txt_110_ds_f->color((Fl_Color)FL_BACKGROUND2_COLOR); |
| 223 |
txt_110_ds_f->selection_color((Fl_Color)FL_SELECTION_COLOR); |
| 224 |
txt_110_ds_f->labeltype(FL_NORMAL_LABEL); |
| 225 |
txt_110_ds_f->labelfont(0); |
| 226 |
txt_110_ds_f->labelsize(13); |
| 227 |
txt_110_ds_f->textsize(11); |
| 228 |
txt_110_ds_f->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); |
| 229 |
txt_110_ds_f->align(FL_ALIGN_TOP_LEFT); |
| 230 |
txt_110_ds_f->callback(cap110_changed); |
| 231 |
txt_110_ds_f->when(FL_WHEN_CHANGED); |
| 232 |
|
| 233 |
desig_src->end(); |
| 234 |
} |
| 235 |
|
| 236 |
Y += 36; |
| 237 |
Fl_Group *g1a = new Fl_Group(2, Y, 566, 260); |
| 238 |
|
| 239 |
Fl_Box* bx1 = new Fl_Box(2, Y, 85, 20, _("TIME")); |
| 240 |
bx1->box(FL_DOWN_BOX); |
| 241 |
bx1->labelsize(13); |
| 242 |
bx1->color((Fl_Color)215); |
| 243 |
|
| 244 |
Fl_Box* bx2 = new Fl_Box(bx1->x() + bx1->w(), Y, 75, 20, _("CALL")); |
| 245 |
bx2->box(FL_DOWN_BOX); |
| 246 |
bx2->labelsize(13); |
| 247 |
bx2->color((Fl_Color)215); |
| 248 |
|
| 249 |
Fl_Box* bx3 = new Fl_Box(bx2->x() + bx2->w(), Y, 50, 20, _("CH REF")); |
| 250 |
bx3->box(FL_DOWN_BOX); |
| 251 |
bx3->labelsize(13); |
| 252 |
bx3->color((Fl_Color)215); |
| 253 |
|
| 254 |
Fl_Box* bx4 = new Fl_Box(bx3->x() + bx3->w(), Y, 340, 20, _("REMARKS")); |
| 255 |
bx4->box(FL_DOWN_BOX); |
| 256 |
bx4->labelsize(13); |
| 257 |
bx4->color((Fl_Color)215); |
| 258 |
|
| 259 |
Y += 22; |
| 260 |
Fl_Scroll* scrl = new Fl_Scroll(2, Y, 566, 240); |
| 261 |
scrl->type(Fl_Scroll::VERTICAL_ALWAYS); |
| 262 |
scrl->box(FL_DOWN_BOX); |
| 263 |
// scrl->color((Fl_Color)215); |
| 264 |
for (int i = 0; i < 23; i++) { |
| 265 |
txt_110_comm_time[i] = new Fl_Input2(2, Y + i*22, 65, 22); |
| 266 |
txt_110_comm_time[i]->tooltip(_("")); |
| 267 |
txt_110_comm_time[i]->callback(cap110_changed); |
| 268 |
txt_110_comm_time[i]->when(FL_WHEN_CHANGED); |
| 269 |
|
| 270 |
btn_110_comm_time[i] = new Fl_Button( |
| 271 |
txt_110_comm_time[i]->x() + txt_110_comm_time[i]->w(), Y + i*22, |
| 272 |
20, 22, _("..")); |
| 273 |
btn_110_comm_time[i]->tooltip(_("Set time now")); |
| 274 |
btn_110_comm_time[i]->callback( |
| 275 |
cb_110_comm_time_changed, (void *)&cap_bptr[i]); |
| 276 |
|
| 277 |
|
| 278 |
txt_110_comm_call[i] = new Fl_Input2( |
| 279 |
btn_110_comm_time[i]->x() + btn_110_comm_time[i]->w(), Y + i*22, |
| 280 |
75, 22, ""); |
| 281 |
txt_110_comm_call[i]->tooltip(_("")); |
| 282 |
txt_110_comm_call[i]->callback(cap110_changed); |
| 283 |
txt_110_comm_call[i]->when(FL_WHEN_CHANGED); |
| 284 |
|
| 285 |
txt_110_comm_chref[i] = new Fl_Input2( |
| 286 |
txt_110_comm_call[i]->x() + txt_110_comm_call[i]->w(), Y + i*22, |
| 287 |
50, 22); |
| 288 |
txt_110_comm_chref[i]->tooltip(_("")); |
| 289 |
txt_110_comm_chref[i]->callback(cap110_changed); |
| 290 |
txt_110_comm_chref[i]->when(FL_WHEN_CHANGED); |
| 291 |
|
| 292 |
txt_110_comm_rem[i] = new Fl_Input2( |
| 293 |
txt_110_comm_chref[i]->x() + txt_110_comm_chref[i]->w(), Y + i*22, |
| 294 |
340, 22); |
| 295 |
txt_110_comm_rem[i]->tooltip(_("")); |
| 296 |
txt_110_comm_rem[i]->callback(cap110_changed); |
| 297 |
txt_110_comm_rem[i]->when(FL_WHEN_CHANGED); |
| 298 |
} |
| 299 |
scrl->end(); |
| 300 |
g1a->end(); |
| 301 |
|
| 302 |
Fl_Group *g1b = new Fl_Group(569, Y, 2, 260); |
| 303 |
g1b->box(FL_FLAT_BOX); |
| 304 |
g1b->end(); |
| 305 |
|
| 306 |
tab_cap110->end(); |
| 307 |
tab_cap110->resizable(g1b); |
| 308 |
|
| 309 |
tab_cap110->hide(); |
| 310 |
} |
| 311 |
|