summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-30 06:22:35 +1100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-30 06:22:35 +1100
commit3ab3e4e892d6a904639d9dc97264a52b0aa5ea8d (patch)
tree9e6447f4d9f09d1d89a4e7a1b71de6ea04faa679
parent3aa41635f0d1e17acc39d0356f7f1ff06d093251 (diff)
downloadsubsurface-3ab3e4e892d6a904639d9dc97264a52b0aa5ea8d.tar.gz
Show Gradient Factors in plot when showing calculated ceilings
This adds the GFlow/high values used to calculate the ceiling (if any). Right now it shows those numbers even if at no point of the dive there was an actual ceiling (but only if showing the ceiling itself is enabled). This should make it easier to for the user to make sense of the calculated ceiling, especially if posting screen shots. As an aside - for some dive computers like the OSTC and the Shearwaters we should be able to also plot the GF used by its calculation which might be interesting for comparison purposes, as both of them also give us the ceiling (lowest deco stop) calculated during the dive.. See #13 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--gtk-gui.c6
-rw-r--r--profile.c15
2 files changed, 18 insertions, 3 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 289211964..22cd8290a 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -526,7 +526,8 @@ static gboolean gflow_edit(GtkWidget *w, GdkEvent *event, gpointer _data)
if (event->type == GDK_FOCUS_CHANGE) {
buf = gtk_entry_get_text(GTK_ENTRY(w));
sscanf(buf, "%lf", &gflow);
- set_gf(gflow / 100.0, -1.0);
+ prefs.gflow = gflow / 100.0;
+ set_gf(prefs.gflow, -1.0);
update_screen();
}
return FALSE;
@@ -539,7 +540,8 @@ static gboolean gfhigh_edit(GtkWidget *w, GdkEvent *event, gpointer _data)
if (event->type == GDK_FOCUS_CHANGE) {
buf = gtk_entry_get_text(GTK_ENTRY(w));
sscanf(buf, "%lf", &gfhigh);
- set_gf(-1.0, gfhigh / 100.0);
+ prefs.gfhigh = gfhigh / 100.0;
+ set_gf(-1.0, prefs.gfhigh);
update_screen();
}
return FALSE;
diff --git a/profile.c b/profile.c
index bb73b2656..b57bacd15 100644
--- a/profile.c
+++ b/profile.c
@@ -822,7 +822,7 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi
cairo_close_path(gc->cr);
cairo_fill(gc->cr);
}
- /* next show where we have been bad and crossed the ceiling */
+ /* next show where we have been bad and crossed the dc's ceiling */
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0 * plot_scale);
pattern_add_color_stop_rgba (gc, pat, 0, CEILING_SHALLOW);
pattern_add_color_stop_rgba (gc, pat, 1, CEILING_DEEP);
@@ -1127,6 +1127,18 @@ static void plot_cylinder_pressure_text(struct graphics_context *gc, struct plot
}
}
+static void plot_deco_text(struct graphics_context *gc, struct plot_info *pi)
+{
+ if (prefs.profile_calc_ceiling) {
+ text_render_options_t tro = {10, PRESSURE_TEXT, CENTER, -0.2};
+ gc->leftx = 0;
+ gc->rightx = gc->maxtime = 1.0;
+ gc->topy = 0;
+ gc->bottomy = 1.0;
+ plot_text(gc, &tro, 0.5, 0, "GF %.0f/%.0f", prefs.gflow * 100, prefs.gfhigh * 100);
+ }
+}
+
static void analyze_plot_info_minmax_minute(struct plot_data *entry, struct plot_data *first, struct plot_data *last, int index)
{
struct plot_data *p = entry;
@@ -2028,6 +2040,7 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale)
plot_temperature_text(gc, pi);
plot_depth_text(gc, pi);
plot_cylinder_pressure_text(gc, pi);
+ plot_deco_text(gc, pi);
/* Bounding box last */
gc->leftx = 0; gc->rightx = 1.0;