summaryrefslogtreecommitdiffstats
path: root/statistics.c
diff options
context:
space:
mode:
authorGravatar Ďoďo <dodo.sk@gmail.com>2013-04-09 17:54:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-09 10:31:36 -0700
commited3f67bc33fbd9aac819687317d3066c22799f83 (patch)
tree0ca44c39b68f5e2681ebfd915e86105b8a4a0900 /statistics.c
parent68545465ba971952e4c66606e44786d9337f97ad (diff)
downloadsubsurface-ed3f67bc33fbd9aac819687317d3066c22799f83.tar.gz
Add dive tags and support invalid dives
This started out as a way to keep dives in the dive list but being able to mark them as 'invalid' so they wouldn't be visible (with an option to disable that feature). Now it supports an (at this point, fixed) set of tags that can be assigned to a dive with 'invalid' being just one of them (but one that is special as it gets some additional support for hiding such dive and marking dives as (in)valid from the divelist). [Dirk Hohndel: merged with the latest code and minor changes for coding style and consistency. Ensure divelist is marked as modified when changing 'invalid' tag] Signed-Off-By: Jozef Ivanecký (dodo.sk@gmail.com) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'statistics.c')
-rw-r--r--statistics.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/statistics.c b/statistics.c
index 502c06cb4..552694563 100644
--- a/statistics.c
+++ b/statistics.c
@@ -28,7 +28,8 @@ typedef struct {
*sac,
*otu,
*o2he,
- *gas_used;
+ *gas_used,
+ *dive_type;
} single_stat_widget_t;
static single_stat_widget_t single_w;
@@ -631,6 +632,38 @@ static void show_single_dive_stats(struct dive *dive)
} else {
set_label(single_w.gas_used, "");
}
+ /* Dive type */
+ if (dive->dive_tags) {
+ buf[0]=0;
+ if(dive->dive_tags & DTYPE_INVALID)
+ strcat(buf, " Invalid,");
+ if(dive->dive_tags & DTYPE_BOAT)
+ strcat(buf, " Boat,");
+ if(dive->dive_tags & DTYPE_SHORE)
+ strcat(buf, " Shore,");
+ if(dive->dive_tags & DTYPE_DRIFT)
+ strcat(buf, " Drift,");
+ if(dive->dive_tags & DTYPE_DEEP)
+ strcat(buf, " Deep,");
+ if(dive->dive_tags & DTYPE_CAVERN)
+ strcat(buf, " Cavern,");
+ if(dive->dive_tags & DTYPE_ICE)
+ strcat(buf, " Ice,");
+ if(dive->dive_tags & DTYPE_WRECK)
+ strcat(buf, " Wreck,");
+ if(dive->dive_tags & DTYPE_CAVE)
+ strcat(buf, " Cave,");
+ if(dive->dive_tags & DTYPE_ALTITUDE)
+ strcat(buf, " Altitude,");
+ if(dive->dive_tags & DTYPE_POOL)
+ strcat(buf, " Pool,");
+ if(strlen(buf) > 1)
+ buf[strlen(buf)-1] = 0;
+ }
+ else {
+ buf[0] = 0;
+ }
+ set_label(single_w.dive_type, buf);
}
/* this gets called when at least two but not all dives are selected */
@@ -865,6 +898,12 @@ GtkWidget *single_stats_widget(void)
single_w.o2he = new_info_label_in_frame(hbox, "O" UTF8_SUBSCRIPT_2 " / He");
single_w.gas_used = new_info_label_in_frame(hbox, C_("Amount","Gas Used"));
+ /* fifth row */
+ hbox = gtk_hbox_new(FALSE, 3);
+ gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
+
+ single_w.dive_type = new_info_label_in_frame(hbox, _("Dive Type"));
+
return vbox;
}
@@ -884,6 +923,7 @@ void clear_stats_widgets(void)
set_label(single_w.otu, "");
set_label(single_w.o2he, "");
set_label(single_w.gas_used, "");
+ set_label(single_w.dive_type, "");
set_label(stats_w.total_time,"");
set_label(stats_w.avg_time,"");
set_label(stats_w.shortest_time,"");