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 <FL/Fl_Hold_Browser.H>
22 
23 #include "gettext.h"
24 #include "status.h"
25 #include "util.h"
26 
27 #include "flmsg_dialog.h"
28 #include "flmsg.h"
29 #include "fileselect.h"
30 
31 Fl_Group	*tab_wxhc = (Fl_Group *)0;
32 Fl_Tabs		*tab_wxhc_type = (Fl_Tabs *)0;
33 
34 Fl_Group	*tab_wxhc_1 = (Fl_Group *)0;
35 
36 Fl_Input2	*w_wxhc_rptsta;
37 Fl_Input2	*w_wxhc_email;
38 Fl_Input2	*w_wxhc_phone;
39 Fl_Input2	*w_wxhc_addr;
40 Fl_Input2	*w_wxhc_city;
41 Fl_Input2	*w_wxhc_state;
42 Fl_Input2	*w_wxhc_country;
43 Fl_Input2	*w_wxhc_lat;
44 Fl_Input2	*w_wxhc_long;
45 Fl_Input2	*w_wxhc_date;
46 Fl_Input2	*w_wxhc_time;
47 Fl_Check_Button *w_wxhc_meas;
48 Fl_Check_Button *w_wxhc_est;
49 Fl_Input2	*w_wxhc_wind_speed;
50 Fl_ListBox	*w_wxhc_wind_speed_units;
51 Fl_Input2	*w_wxhc_wind_gusts;
52 Fl_ListBox	*w_wxhc_wind_gusts_units;
53 Fl_ListBox	*w_wxhc_wind_dir;
54 Fl_Input2	*w_wxhc_wind_degrees;
55 Fl_Input2	*w_wxhc_baro_press;
56 Fl_ListBox	*w_wxhc_baro_units;
57 
58 Fl_Group	*tab_wxhc_2 = (Fl_Group *)0;
59 
60 FTextEdit	*w_wxhc_comments;
61 
62 //----------------------------------------------------------------------
63 
64 // widget callbacks & support
65 
66 //----------------------------------------------------------------------
67 
cb_measured(Fl_Check_Button *,void *)68 static void cb_measured(Fl_Check_Button*, void*)
69 {
70 	w_wxhc_est->value(!w_wxhc_meas->value());
71 }
72 
cb_estimated(Fl_Check_Button *,void *)73 static void cb_estimated(Fl_Check_Button*, void*)
74 {
75 	w_wxhc_meas->value(!w_wxhc_est->value());
76 }
77 
wxhc_changed(Fl_Widget *,void *)78 void wxhc_changed(Fl_Widget *, void *)
79 {
80 	estimate();
81 }
82 
create_wxhc_tab()83 void create_wxhc_tab()
84 {
85 	int Y = tab_top;
86 	tab_wxhc = new Fl_Group(0, Y, 570, 390);
87 	tab_wxhc->begin();
88 	tab_wxhc->align(FL_ALIGN_TOP);
89 
90 
91 	tab_wxhc_type = new Fl_Tabs(0, Y+2, 570, 387);
92 	tab_wxhc_type->selection_color((Fl_Color)246);
93 
94 	tab_wxhc_1 = new Fl_Group(0, Y+25, 570, 360, _("Report"));
95 	tab_wxhc_1->begin();
96 
97 	Y += 35;
98 	w_wxhc_rptsta = new Fl_Input2(150, Y, 250, 22, _("Reporting Station"));
99 	w_wxhc_rptsta->tooltip(_("Amateur Radio Callsign or First & Last Name"));
100 	w_wxhc_rptsta->callback(wxhc_changed);
101 	w_wxhc_rptsta->when(FL_WHEN_CHANGED);
102 
103 	Y += 25;
104 	w_wxhc_email = new Fl_Input2(150, Y, 250, 22, _("Email address"));
105 	w_wxhc_email->tooltip("");
106 	w_wxhc_email->callback(wxhc_changed);
107 	w_wxhc_email->when(FL_WHEN_CHANGED);
108 
109 	Y += 25;
110 	w_wxhc_phone = new Fl_Input2(150, Y, 250, 22, _("Phone number"));
111 	w_wxhc_phone->tooltip("");
112 	w_wxhc_phone->callback(wxhc_changed);
113 	w_wxhc_phone->when(FL_WHEN_CHANGED);
114 
115 	Y += 25;
116 	w_wxhc_addr = new Fl_Input2(150, Y, 400, 22, _("Street address"));
117 	w_wxhc_addr->tooltip("");
118 	w_wxhc_addr->callback(wxhc_changed);
119 	w_wxhc_addr->when(FL_WHEN_CHANGED);
120 
121 	Y += 25;
122 	w_wxhc_city = new Fl_Input2(150, Y, 250, 22, _("city"));
123 	w_wxhc_city->tooltip("");
124 	w_wxhc_city->callback(wxhc_changed);
125 	w_wxhc_city->when(FL_WHEN_CHANGED);
126 
127 	w_wxhc_state = new Fl_Input2(450, Y, 100, 22, _("State"));
128 	w_wxhc_state->tooltip("");
129 	w_wxhc_state->callback(wxhc_changed);
130 	w_wxhc_state->when(FL_WHEN_CHANGED);
131 
132 	Y += 25;
133 	w_wxhc_country = new Fl_Input2(150, Y, 250, 22, _("Country"));
134 	w_wxhc_country->tooltip("");
135 	w_wxhc_country->callback(wxhc_changed);
136 	w_wxhc_country->when(FL_WHEN_CHANGED);
137 
138 	Y += 25;
139 	w_wxhc_lat = new Fl_Input2(150, Y, 150, 22, _("Latitude"));
140 	w_wxhc_lat->tooltip(_("Latitude (degrees North)"));
141 	w_wxhc_lat->callback(wxhc_changed);
142 	w_wxhc_lat->when(FL_WHEN_CHANGED);
143 
144 	w_wxhc_long = new Fl_Input2(400, Y, 150, 22, _("Longitude"));
145 	w_wxhc_long->tooltip(_("Longitude (degrees West)"));
146 	w_wxhc_long->callback(wxhc_changed);
147 	w_wxhc_long->when(FL_WHEN_CHANGED);
148 
149 	Y += 25;
150 	w_wxhc_date = new Fl_Input2(150, Y, 150, 22, _("Date"));
151 	w_wxhc_date->tooltip(_("Observation date : month-day-year"));
152 	w_wxhc_date->callback(wxhc_changed);
153 	w_wxhc_date->when(FL_WHEN_CHANGED);
154 
155 	w_wxhc_time = new Fl_Input2(400, Y, 150, 22, _("Time"));
156 	w_wxhc_time->tooltip(_("Observation time : HHMM Z (GMT/UTC preferred)"));
157 	w_wxhc_time->callback(wxhc_changed);
158 	w_wxhc_time->when(FL_WHEN_CHANGED);
159 
160 	Y += 25;
161 	w_wxhc_meas = new Fl_Check_Button(150, Y, 50, 22, _("Measured"));
162 	w_wxhc_meas->tooltip(_("Wind speed measured"));
163 	w_wxhc_meas->callback((Fl_Callback*)cb_measured);
164 
165 	w_wxhc_est = new Fl_Check_Button(305, Y, 50, 22, _("Estimated"));
166 	w_wxhc_est->tooltip(_("Wind speed estimated"));
167 	w_wxhc_est->callback((Fl_Callback*)cb_estimated);
168 
169 	Y += 25;
170 	w_wxhc_wind_speed = new Fl_Input2(150, Y, 80, 22, _("Wind speed"));
171 	w_wxhc_wind_speed->tooltip(_("Sustained wind speed"));
172 	w_wxhc_wind_speed->callback(wxhc_changed);
173 	w_wxhc_wind_speed->when(FL_WHEN_CHANGED);
174 
175 	w_wxhc_wind_speed_units = new Fl_ListBox(230, Y, 80, 22, _(""));
176 	w_wxhc_wind_speed_units->begin();
177 	w_wxhc_wind_speed_units->callback(wxhc_changed);
178 	w_wxhc_wind_speed_units->when(FL_WHEN_RELEASE);
179 	w_wxhc_wind_speed_units->end();
180 
181 
182 	Y += 25;
183 	w_wxhc_wind_gusts = new Fl_Input2(150, Y, 80, 22, _("Wind gust"));
184 	w_wxhc_wind_gusts->tooltip(_("Less than 1 minute"));
185 	w_wxhc_wind_gusts->callback(wxhc_changed);
186 	w_wxhc_wind_gusts->when(FL_WHEN_CHANGED);
187 
188 	w_wxhc_wind_gusts_units = new Fl_ListBox(230, Y, 80, 22, _(""));
189 	w_wxhc_wind_gusts_units->begin();
190 	w_wxhc_wind_gusts_units->callback(wxhc_changed);
191 	w_wxhc_wind_gusts_units->when(FL_WHEN_RELEASE);
192 	w_wxhc_wind_gusts_units->end();
193 
194 	Y += 25;
195 	w_wxhc_wind_dir = new Fl_ListBox(150, Y, 50, 22, _("Wind direc'"));
196 	w_wxhc_wind_dir->begin();
197 	w_wxhc_wind_dir->align(FL_ALIGN_LEFT);
198 	w_wxhc_wind_dir->callback(wxhc_changed);
199 	w_wxhc_wind_dir->when(FL_WHEN_RELEASE);
200 	w_wxhc_wind_dir->end();
201 
202 	w_wxhc_wind_degrees = new Fl_Input2(210, Y, 80, 22, _("Degrees"));
203 	w_wxhc_wind_degrees->align(FL_ALIGN_RIGHT);
204 
205 	Y += 25;
206 	w_wxhc_baro_press = new Fl_Input2(150, Y, 80, 22, _("Baro Press"));
207 	w_wxhc_baro_press->tooltip(_("Must be measured with calibrated barometer"));
208 	w_wxhc_baro_press->align(FL_ALIGN_LEFT);
209 	w_wxhc_baro_press->callback(wxhc_changed);
210 	w_wxhc_baro_press->when(FL_WHEN_CHANGED);
211 
212 	w_wxhc_baro_units = new Fl_ListBox(230, Y, 100, 22, _(""));
213 	w_wxhc_baro_units->begin();
214 	w_wxhc_baro_units->when(FL_WHEN_RELEASE);
215 	w_wxhc_baro_units->callback(wxhc_changed);
216 	w_wxhc_baro_units->end();
217 
218 	tab_wxhc_1->end();
219 
220 	Y = tab_top;
221 	tab_wxhc_2 = new Fl_Group(0, Y+25, 570, 360, _("Comments"));
222 	Y += 35;
223 	w_wxhc_comments = new FTextEdit(5, Y, 560, 340, _(""));
224 
225 	tab_wxhc_2->end();
226 
227 	tab_wxhc->end();
228 
229 	set_nhc_wx_combos();
230 
231 	tab_wxhc->hide();
232 
233 };
234 
235