Add support for visibility tracking and allow manual entry air temp

Turns out we had a data field for visibility as a length unit - but never
used it. I can never guess how much visibility we actually had on a dive -
but I think most everyone can assign a rating between abysmal (zero stars,
"I couldn't read my dive computer even right in front of my mask" - trust
me, I had some of those dives) to amazing ("five stars, I could see farther
than I though possible" - and I had one or two of those, too). So I
changed this to an integer and am re-using the star infrastructure we have
for the overall dive rating.

When displaying this I was dismayed that we are running out of space in
the "Dive Notes" notbook. So I moved this to the "Dive Info" notebook.
This is not consistent and not logical. I think we need to revisit the
notebooks and think about what we want to display where.

While adding the infrastructure to manually enter the visibility I went
ahead and added the ability to manually enter the air temperature as well
(that was one of the things missing in the previous commit).

Fixes #7

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-10-28 15:49:02 -07:00
parent 601ac0c362
commit 01f1ccff14
5 changed files with 74 additions and 3 deletions

View file

@ -27,6 +27,7 @@ typedef struct {
*surf_intv,
*max_depth,
*avg_depth,
*viz,
*water_temp,
*air_temp,
*sac,
@ -544,6 +545,7 @@ static void show_single_dive_stats(struct dive *dive)
set_label(single_w.max_depth, "%.*f %s", decimals, value, unit);
value = get_depth_units(dive->meandepth.mm, &decimals, &unit);
set_label(single_w.avg_depth, "%.*f %s", decimals, value, unit);
set_label(single_w.viz, star_strings[dive->visibility]);
if (dive->watertemp.mkelvin) {
value = get_temp_units(dive->watertemp.mkelvin, &unit);
set_label(single_w.water_temp, "%.1f %s", value, unit);
@ -733,10 +735,16 @@ GtkWidget *single_stats_widget(void)
single_w.max_depth = new_info_label_in_frame(hbox, _("Max Depth"));
single_w.avg_depth = new_info_label_in_frame(hbox, _("Avg Depth"));
single_w.viz = new_info_label_in_frame(hbox, _("Visibility"));
/* third row */
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
single_w.water_temp = new_info_label_in_frame(hbox, _("Water Temp"));
single_w.air_temp = new_info_label_in_frame(hbox, _("Air Temp"));
/* third row */
/* fourth row */
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
@ -755,6 +763,7 @@ void clear_stats_widgets(void)
set_label(single_w.surf_intv, "");
set_label(single_w.max_depth, "");
set_label(single_w.avg_depth, "");
set_label(single_w.viz, "");
set_label(single_w.water_temp, "");
set_label(single_w.air_temp, "");
set_label(single_w.sac, "");