summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-02 23:22:07 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-03 20:44:37 -0800
commit5ba250bd48500c9f7aa206324272d40fd3064069 (patch)
treea2eed434b80d9de6f3edd2a6af41a497597b886a /gtk-gui.c
parentaab67e2a5bb9c74fcc60af4ade0192d31263ebc7 (diff)
downloadsubsurface-5ba250bd48500c9f7aa206324272d40fd3064069.tar.gz
Use gradient factors in deco calculation
Usually dive computers show the ceiling in terms of the next deco stop - and those are in 3m increments. This commit also adds the ability to chose either the typical 3m increments or the smooth ceiling that the Bühlmann algorithm actually calculates. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 9637ba532..79003ac2f 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -512,6 +512,7 @@ OPTIONCALLBACK(pn2_toggle, prefs.pp_graphs.pn2)
OPTIONCALLBACK(phe_toggle, prefs.pp_graphs.phe)
OPTIONCALLBACK(red_ceiling_toggle, prefs.profile_red_ceiling)
OPTIONCALLBACK(calc_ceiling_toggle, prefs.profile_calc_ceiling)
+OPTIONCALLBACK(calc_ceiling_3m_toggle, prefs.calc_ceiling_3m_incr)
OPTIONCALLBACK(force_toggle, force_download)
OPTIONCALLBACK(prefer_dl_toggle, prefer_downloaded)
@@ -779,6 +780,11 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(calc_ceiling_toggle), NULL);
+ button = gtk_check_button_new_with_label(_("3m increments for calculated ceiling"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.calc_ceiling_3m_incr);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(calc_ceiling_3m_toggle), NULL);
+
gtk_widget_show_all(dialog);
result = gtk_dialog_run(GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_ACCEPT) {
@@ -824,6 +830,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
subsurface_set_conf("phethreshold", PREF_STRING, phe_threshold_text);
subsurface_set_conf("redceiling", PREF_BOOL, BOOL_TO_PTR(prefs.profile_red_ceiling));
subsurface_set_conf("calcceiling", PREF_BOOL, BOOL_TO_PTR(prefs.profile_calc_ceiling));
+ subsurface_set_conf("calcceiling3m", PREF_BOOL, BOOL_TO_PTR(prefs.calc_ceiling_3m_incr));
new_default = strdup(gtk_button_get_label(GTK_BUTTON(xmlfile_button)));
@@ -1244,6 +1251,7 @@ void init_ui(int *argcp, char ***argvp)
}
prefs.profile_red_ceiling = PTR_TO_BOOL(subsurface_get_conf("redceiling", PREF_BOOL));
prefs.profile_calc_ceiling = PTR_TO_BOOL(subsurface_get_conf("calcceiling", PREF_BOOL));
+ prefs.calc_ceiling_3m_incr = PTR_TO_BOOL(subsurface_get_conf("calcceiling3m", PREF_BOOL));
divelist_font = subsurface_get_conf("divelist_font", PREF_STRING);
default_filename = subsurface_get_conf("default_filename", PREF_STRING);