aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--display-gtk.h13
-rw-r--r--dive.c15
-rw-r--r--dive.h25
-rw-r--r--divelist.c34
-rw-r--r--equipment.c16
-rw-r--r--gtk-gui.c183
-rw-r--r--info.c8
-rw-r--r--parse-xml.c25
-rw-r--r--print.c4
-rw-r--r--profile.c44
10 files changed, 191 insertions, 176 deletions
diff --git a/display-gtk.h b/display-gtk.h
index 3e12d8051..36895b7c8 100644
--- a/display-gtk.h
+++ b/display-gtk.h
@@ -30,11 +30,16 @@ typedef struct {
double phe_threshold;
} partial_pressure_graphs_t;
-extern visible_cols_t visible_cols;
-extern partial_pressure_graphs_t partial_pressure_graphs;
-extern gboolean profile_red_ceiling;
+struct preferences {
+ struct units output_units;
+ visible_cols_t visible_cols;
+ partial_pressure_graphs_t pp_graphs;
+ gboolean profile_red_ceiling;
+};
-#define GRAPHS_ENABLED (partial_pressure_graphs.po2 || partial_pressure_graphs.pn2 || partial_pressure_graphs.phe)
+extern struct preferences prefs;
+
+#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
typedef enum {
PREF_BOOL,
diff --git a/dive.c b/dive.c
index d4e0217d7..b197c835f 100644
--- a/dive.c
+++ b/dive.c
@@ -34,8 +34,9 @@ int get_pressure_units(unsigned int mb, const char **units)
{
int pressure;
const char* unit;
+ struct units *output_units_p = get_output_units();
- switch (output_units.pressure) {
+ switch (output_units_p->pressure) {
case PASCAL:
pressure = mb * 100;
unit = _("pascal");
@@ -58,8 +59,9 @@ double get_temp_units(unsigned int mk, const char **units)
{
double deg;
const char *unit;
+ struct units *output_units_p = get_output_units();
- if (output_units.temperature == FAHRENHEIT) {
+ if (output_units_p->temperature == FAHRENHEIT) {
deg = mkelvin_to_F(mk);
unit = UTF8_DEGREE "F";
} else {
@@ -76,8 +78,9 @@ double get_volume_units(unsigned int ml, int *frac, const char **units)
int decimals;
double vol;
const char *unit;
+ struct units *output_units_p = get_output_units();
- switch (output_units.volume) {
+ switch (output_units_p->volume) {
case LITER:
vol = ml / 1000.0;
unit = _("l");
@@ -101,8 +104,9 @@ double get_depth_units(unsigned int mm, int *frac, const char **units)
int decimals;
double d;
const char *unit;
+ struct units *output_units_p = get_output_units();
- switch (output_units.length) {
+ switch (output_units_p->length) {
case METERS:
d = mm / 1000.0;
unit = _("m");
@@ -126,8 +130,9 @@ double get_weight_units(unsigned int grams, int *frac, const char **units)
int decimals;
double value;
const char* unit;
+ struct units *output_units_p = get_output_units();
- if (output_units.weight == LBS) {
+ if (output_units_p->weight == LBS) {
value = grams_to_lbs(grams);
unit = _("lbs");
decimals = 0;
diff --git a/dive.h b/dive.h
index 4cfa6fa38..487bc0d0e 100644
--- a/dive.h
+++ b/dive.h
@@ -390,9 +390,32 @@ struct units {
enum { KG, LBS } weight;
};
+/*
+ * We're going to default to SI units for input. Yes,
+ * technically the SI unit for pressure is Pascal, but
+ * we default to bar (10^5 pascal), which people
+ * actually use. Similarly, C instead of Kelvin.
+ * And kg instead of g.
+ */
+#define SI_UNITS { \
+ .length = METERS, \
+ .volume = LITER, \
+ .pressure = BAR, \
+ .temperature = CELSIUS, \
+ .weight = KG \
+}
+
+#define IMPERIAL_UNITS { \
+ .length = FEET, \
+ .volume = CUFT, \
+ .pressure = PSI, \
+ .temperature = FAHRENHEIT, \
+ .weight = LBS \
+}
extern const struct units SI_units, IMPERIAL_units;
-extern struct units input_units, output_units;
+extern struct units input_units;
+extern struct units *get_output_units(void);
extern int verbose;
struct dive_table {
diff --git a/divelist.c b/divelist.c
index 7a2f4fa5b..03517d360 100644
--- a/divelist.c
+++ b/divelist.c
@@ -401,7 +401,7 @@ static void depth_data_func(GtkTreeViewColumn *col,
if (idx < 0) {
*buffer = '\0';
} else {
- switch (output_units.length) {
+ switch (prefs.output_units.length) {
case METERS:
/* To tenths of meters */
depth = (depth + 49) / 100;
@@ -460,7 +460,7 @@ static void temperature_data_func(GtkTreeViewColumn *col,
*buffer = 0;
if (idx >= 0 && value) {
double deg;
- switch (output_units.temperature) {
+ switch (prefs.output_units.temperature) {
case CELSIUS:
deg = mkelvin_to_C(value);
break;
@@ -657,7 +657,7 @@ static void sac_data_func(GtkTreeViewColumn *col,
}
sac = value / 1000.0;
- switch (output_units.volume) {
+ switch (prefs.output_units.volume) {
case LITER:
fmt = "%4.1f";
break;
@@ -913,13 +913,13 @@ void update_dive_list_units(void)
void update_dive_list_col_visibility(void)
{
- gtk_tree_view_column_set_visible(dive_list.cylinder, visible_cols.cylinder);
- gtk_tree_view_column_set_visible(dive_list.temperature, visible_cols.temperature);
- gtk_tree_view_column_set_visible(dive_list.totalweight, visible_cols.totalweight);
- gtk_tree_view_column_set_visible(dive_list.suit, visible_cols.suit);
- gtk_tree_view_column_set_visible(dive_list.nitrox, visible_cols.nitrox);
- gtk_tree_view_column_set_visible(dive_list.sac, visible_cols.sac);
- gtk_tree_view_column_set_visible(dive_list.otu, visible_cols.otu);
+ gtk_tree_view_column_set_visible(dive_list.cylinder, prefs.visible_cols.cylinder);
+ gtk_tree_view_column_set_visible(dive_list.temperature, prefs.visible_cols.temperature);
+ gtk_tree_view_column_set_visible(dive_list.totalweight, prefs.visible_cols.totalweight);
+ gtk_tree_view_column_set_visible(dive_list.suit, prefs.visible_cols.suit);
+ gtk_tree_view_column_set_visible(dive_list.nitrox, prefs.visible_cols.nitrox);
+ gtk_tree_view_column_set_visible(dive_list.sac, prefs.visible_cols.sac);
+ gtk_tree_view_column_set_visible(dive_list.otu, prefs.visible_cols.otu);
return;
}
@@ -1266,13 +1266,13 @@ static struct divelist_column {
[DIVE_RATING] = { UTF8_BLACKSTAR, star_data_func, NULL, ALIGN_LEFT },
[DIVE_DEPTH] = { N_("ft"), depth_data_func, NULL, ALIGN_RIGHT },
[DIVE_DURATION] = { N_("min"), duration_data_func, NULL, ALIGN_RIGHT },
- [DIVE_TEMPERATURE] = { UTF8_DEGREE "F", temperature_data_func, NULL, ALIGN_RIGHT, &visible_cols.temperature },
- [DIVE_TOTALWEIGHT] = { N_("lbs"), weight_data_func, NULL, ALIGN_RIGHT, &visible_cols.totalweight },
- [DIVE_SUIT] = { N_("Suit"), NULL, NULL, ALIGN_LEFT, &visible_cols.suit },
- [DIVE_CYLINDER] = { N_("Cyl"), NULL, NULL, 0, &visible_cols.cylinder },
- [DIVE_NITROX] = { "O" UTF8_SUBSCRIPT_2 "%", nitrox_data_func, nitrox_sort_func, 0, &visible_cols.nitrox },
- [DIVE_SAC] = { N_("SAC"), sac_data_func, NULL, 0, &visible_cols.sac },
- [DIVE_OTU] = { N_("OTU"), otu_data_func, NULL, 0, &visible_cols.otu },
+ [DIVE_TEMPERATURE] = { UTF8_DEGREE "F", temperature_data_func, NULL, ALIGN_RIGHT, &prefs.visible_cols.temperature },
+ [DIVE_TOTALWEIGHT] = { N_("lbs"), weight_data_func, NULL, ALIGN_RIGHT, &prefs.visible_cols.totalweight },
+ [DIVE_SUIT] = { N_("Suit"), NULL, NULL, ALIGN_LEFT, &prefs.visible_cols.suit },
+ [DIVE_CYLINDER] = { N_("Cyl"), NULL, NULL, 0, &prefs.visible_cols.cylinder },
+ [DIVE_NITROX] = { "O" UTF8_SUBSCRIPT_2 "%", nitrox_data_func, nitrox_sort_func, 0, &prefs.visible_cols.nitrox },
+ [DIVE_SAC] = { N_("SAC"), sac_data_func, NULL, 0, &prefs.visible_cols.sac },
+ [DIVE_OTU] = { N_("OTU"), otu_data_func, NULL, 0, &prefs.visible_cols.otu },
[DIVE_LOCATION] = { N_("Location"), NULL, NULL, ALIGN_LEFT },
};
diff --git a/equipment.c b/equipment.c
index 8bfb7a7a8..232764676 100644
--- a/equipment.c
+++ b/equipment.c
@@ -75,7 +75,7 @@ static int convert_pressure(int mbar, double *p)
int decimals = 1;
double pressure;
- if (output_units.pressure == PSI) {
+ if (prefs.output_units.pressure == PSI) {
pressure = mbar_to_PSI(mbar);
decimals = 0;
} else {
@@ -92,12 +92,12 @@ static void convert_volume_pressure(int ml, int mbar, double *v, double *p)
volume = ml / 1000.0;
if (mbar) {
- if (output_units.volume == CUFT) {
+ if (prefs.output_units.volume == CUFT) {
volume = ml_to_cuft(ml);
volume *= bar_to_atm(mbar / 1000.0);
}
- if (output_units.pressure == PSI)
+ if (prefs.output_units.pressure == PSI)
pressure = mbar_to_PSI(mbar);
else
pressure = mbar / 1000.0;
@@ -111,7 +111,7 @@ static int convert_weight(int grams, double *m)
int decimals = 1; /* not sure - do people do less than whole lbs/kg ? */
double weight;
- if (output_units.weight == LBS)
+ if (prefs.output_units.weight == LBS)
weight = grams_to_lbs(grams);
else
weight = grams / 1000.0;
@@ -631,14 +631,14 @@ static void fill_cylinder_info(struct cylinder_widget *cylinder, cylinder_t *cyl
{
int mbar, ml;
- if (output_units.pressure == PSI) {
+ if (prefs.output_units.pressure == PSI) {
pressure = psi_to_bar(pressure);
start = psi_to_bar(start);
end = psi_to_bar(end);
}
mbar = pressure * 1000 + 0.5;
- if (mbar && output_units.volume == CUFT) {
+ if (mbar && prefs.output_units.volume == CUFT) {
volume = cuft_to_l(volume);
volume /= bar_to_atm(pressure);
}
@@ -714,7 +714,7 @@ static void record_weightsystem_changes(weightsystem_t *ws, struct ws_widget *we
desc = gtk_combo_box_get_active_text(box);
value = gtk_spin_button_get_value(weightsystem_widget->weight);
- if (output_units.weight == LBS)
+ if (prefs.output_units.weight == LBS)
grams = lbs_to_grams(value);
else
grams = value * 1000;
@@ -1041,7 +1041,7 @@ static void ws_widget(GtkWidget *vbox, struct ws_widget *ws_widget, GtkListStore
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 0);
- if ( output_units.weight == KG)
+ if ( prefs.output_units.weight == KG)
widget = create_spinbutton(hbox, _("kg"), 0, 50, 0.5);
else
widget = create_spinbutton(hbox, _("lbs"), 0, 110, 1);
diff --git a/gtk-gui.c b/gtk-gui.c
index e4928e905..799613214 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -32,20 +32,25 @@ const char *existing_filename;
const char *divelist_font;
const char *default_filename;
-struct units output_units;
+struct preferences prefs = {
+ SI_UNITS,
+ { TRUE, FALSE, },
+ { FALSE, FALSE, FALSE, 1.6, 4.0, 13.0},
+ FALSE
+};
static GtkWidget *dive_profile;
-
-visible_cols_t visible_cols = {TRUE, FALSE, };
-partial_pressure_graphs_t partial_pressure_graphs = { FALSE, FALSE, FALSE, 1.6, 4.0, 10.0};
-gboolean profile_red_ceiling = FALSE;
-
static const char *default_dive_computer_vendor;
static const char *default_dive_computer_product;
static const char *default_dive_computer_device;
static gboolean force_download;
static gboolean prefer_downloaded;
+struct units *get_output_units()
+{
+ return &prefs.output_units;
+}
+
static int is_default_dive_computer(const char *vendor, const char *product)
{
return default_dive_computer_vendor && !strcmp(vendor, default_dive_computer_vendor) &&
@@ -450,11 +455,9 @@ static void create_radio(GtkWidget *vbox, const char *w_name, ...)
static void name(GtkWidget *w, gpointer data) \
{ \
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) \
- menu_units.type = value; \
+ prefs.output_units.type = value; \
}
-static struct units menu_units;
-
UNITCALLBACK(set_meter, length, METERS)
UNITCALLBACK(set_feet, length, FEET)
UNITCALLBACK(set_bar, pressure, BAR)
@@ -475,18 +478,18 @@ static void name(GtkWidget *w, gpointer data) \
gtk_widget_set_sensitive(*entry, option);\
}
-OPTIONCALLBACK(otu_toggle, visible_cols.otu)
-OPTIONCALLBACK(sac_toggle, visible_cols.sac)
-OPTIONCALLBACK(nitrox_toggle, visible_cols.nitrox)
-OPTIONCALLBACK(temperature_toggle, visible_cols.temperature)
-OPTIONCALLBACK(totalweight_toggle, visible_cols.totalweight)
-OPTIONCALLBACK(suit_toggle, visible_cols.suit)
-OPTIONCALLBACK(cylinder_toggle, visible_cols.cylinder)
+OPTIONCALLBACK(otu_toggle, prefs.visible_cols.otu)
+OPTIONCALLBACK(sac_toggle, prefs.visible_cols.sac)
+OPTIONCALLBACK(nitrox_toggle, prefs.visible_cols.nitrox)
+OPTIONCALLBACK(temperature_toggle, prefs.visible_cols.temperature)
+OPTIONCALLBACK(totalweight_toggle, prefs.visible_cols.totalweight)
+OPTIONCALLBACK(suit_toggle, prefs.visible_cols.suit)
+OPTIONCALLBACK(cylinder_toggle, prefs.visible_cols.cylinder)
OPTIONCALLBACK(autogroup_toggle, autogroup)
-OPTIONCALLBACK(po2_toggle, partial_pressure_graphs.po2)
-OPTIONCALLBACK(pn2_toggle, partial_pressure_graphs.pn2)
-OPTIONCALLBACK(phe_toggle, partial_pressure_graphs.phe)
-OPTIONCALLBACK(red_ceiling_toggle, profile_red_ceiling)
+OPTIONCALLBACK(po2_toggle, prefs.pp_graphs.po2)
+OPTIONCALLBACK(pn2_toggle, prefs.pp_graphs.pn2)
+OPTIONCALLBACK(phe_toggle, prefs.pp_graphs.phe)
+OPTIONCALLBACK(red_ceiling_toggle, prefs.profile_red_ceiling)
OPTIONCALLBACK(force_toggle, force_download)
OPTIONCALLBACK(prefer_dl_toggle, prefer_downloaded)
@@ -554,14 +557,13 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
GtkWidget *entry_po2, *entry_pn2, *entry_phe;
const char *current_default, *new_default;
char threshold_text[10];
-
- menu_units = output_units;
+ struct preferences oldprefs = prefs;
dialog = gtk_dialog_new_with_buttons(_("Preferences"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
/* create the notebook for the preferences and attach it to dialog */
@@ -579,28 +581,28 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_container_add(GTK_CONTAINER(frame), box);
create_radio(box, _("Depth:"),
- _("Meter"), set_meter, (output_units.length == METERS),
- _("Feet"), set_feet, (output_units.length == FEET),
+ _("Meter"), set_meter, (prefs.output_units.length == METERS),
+ _("Feet"), set_feet, (prefs.output_units.length == FEET),
NULL);
create_radio(box, _("Pressure:"),
- _("Bar"), set_bar, (output_units.pressure == BAR),
- _("PSI"), set_psi, (output_units.pressure == PSI),
+ _("Bar"), set_bar, (prefs.output_units.pressure == BAR),
+ _("PSI"), set_psi, (prefs.output_units.pressure == PSI),
NULL);
create_radio(box, _("Volume:"),
- _("Liter"), set_liter, (output_units.volume == LITER),
- _("CuFt"), set_cuft, (output_units.volume == CUFT),
+ _("Liter"), set_liter, (prefs.output_units.volume == LITER),
+ _("CuFt"), set_cuft, (prefs.output_units.volume == CUFT),
NULL);
create_radio(box, _("Temperature:"),
- _("Celsius"), set_celsius, (output_units.temperature == CELSIUS),
- _("Fahrenheit"), set_fahrenheit, (output_units.temperature == FAHRENHEIT),
+ _("Celsius"), set_celsius, (prefs.output_units.temperature == CELSIUS),
+ _("Fahrenheit"), set_fahrenheit, (prefs.output_units.temperature == FAHRENHEIT),
NULL);
create_radio(box, _("Weight:"),
- _("kg"), set_kg, (output_units.weight == KG),
- _("lbs"), set_lbs, (output_units.weight == LBS),
+ _("kg"), set_kg, (prefs.output_units.weight == KG),
+ _("lbs"), set_lbs, (prefs.output_units.weight == LBS),
NULL);
frame = gtk_frame_new(_("Show Columns"));
@@ -610,32 +612,32 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_container_add(GTK_CONTAINER(frame), box);
button = gtk_check_button_new_with_label(_("Temp"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.temperature);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.visible_cols.temperature);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(temperature_toggle), NULL);
button = gtk_check_button_new_with_label(_("Cyl"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.cylinder);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.visible_cols.cylinder);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(cylinder_toggle), NULL);
button = gtk_check_button_new_with_label("O" UTF8_SUBSCRIPT_2 "%");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.nitrox);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.visible_cols.nitrox);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(nitrox_toggle), NULL);
button = gtk_check_button_new_with_label(_("SAC"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.sac);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.visible_cols.sac);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(sac_toggle), NULL);
button = gtk_check_button_new_with_label(_("Weight"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.totalweight);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.visible_cols.totalweight);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(totalweight_toggle), NULL);
button = gtk_check_button_new_with_label(_("Suit"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.suit);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.visible_cols.suit);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(suit_toggle), NULL);
@@ -678,7 +680,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_container_add(GTK_CONTAINER(frame), box);
button = gtk_check_button_new_with_label(_("OTU"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.otu);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.visible_cols.otu);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(otu_toggle), NULL);
@@ -691,7 +693,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_container_add(GTK_CONTAINER(vbox), box);
button = gtk_check_button_new_with_label(_("Show pO" UTF8_SUBSCRIPT_2 " graph"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), partial_pressure_graphs.po2);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.pp_graphs.po2);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(po2_toggle), &entry_po2);
@@ -699,16 +701,16 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 6);
entry_po2 = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(entry_po2), 4);
- snprintf(threshold_text, sizeof(threshold_text), "%.1f", partial_pressure_graphs.po2_threshold);
+ snprintf(threshold_text, sizeof(threshold_text), "%.1f", prefs.pp_graphs.po2_threshold);
gtk_entry_set_text(GTK_ENTRY(entry_po2), threshold_text);
- gtk_widget_set_sensitive(entry_po2, partial_pressure_graphs.po2);
+ gtk_widget_set_sensitive(entry_po2, prefs.pp_graphs.po2);
gtk_container_add(GTK_CONTAINER(frame), entry_po2);
box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(vbox), box);
button = gtk_check_button_new_with_label(_("Show pN" UTF8_SUBSCRIPT_2 " graph"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), partial_pressure_graphs.pn2);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.pp_graphs.pn2);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(pn2_toggle), &entry_pn2);
@@ -716,16 +718,16 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 6);
entry_pn2 = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(entry_pn2), 4);
- snprintf(threshold_text, sizeof(threshold_text), "%.1f", partial_pressure_graphs.pn2_threshold);
+ snprintf(threshold_text, sizeof(threshold_text), "%.1f", prefs.pp_graphs.pn2_threshold);
gtk_entry_set_text(GTK_ENTRY(entry_pn2), threshold_text);
- gtk_widget_set_sensitive(entry_pn2, partial_pressure_graphs.pn2);
+ gtk_widget_set_sensitive(entry_pn2, prefs.pp_graphs.pn2);
gtk_container_add(GTK_CONTAINER(frame), entry_pn2);
box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(vbox), box);
button = gtk_check_button_new_with_label(_("Show pHe graph"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), partial_pressure_graphs.phe);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.pp_graphs.phe);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(phe_toggle), &entry_phe);
@@ -733,16 +735,16 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 6);
entry_phe = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(entry_phe), 4);
- snprintf(threshold_text, sizeof(threshold_text), "%.1f", partial_pressure_graphs.phe_threshold);
+ snprintf(threshold_text, sizeof(threshold_text), "%.1f", prefs.pp_graphs.phe_threshold);
gtk_entry_set_text(GTK_ENTRY(entry_phe), threshold_text);
- gtk_widget_set_sensitive(entry_phe, partial_pressure_graphs.phe);
+ gtk_widget_set_sensitive(entry_phe, prefs.pp_graphs.phe);
gtk_container_add(GTK_CONTAINER(frame), entry_phe);
box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(vbox), box);
button = gtk_check_button_new_with_label(_("Show ceiling in red"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), profile_red_ceiling);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), prefs.profile_red_ceiling);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(red_ceiling_toggle), NULL);
@@ -758,40 +760,39 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
divelist_font = strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON(font)));
set_divelist_font(divelist_font);
po2_threshold_text = gtk_entry_get_text(GTK_ENTRY(entry_po2));
- sscanf(po2_threshold_text, "%lf", &partial_pressure_graphs.po2_threshold);
+ sscanf(po2_threshold_text, "%lf", &prefs.pp_graphs.po2_threshold);
pn2_threshold_text = gtk_entry_get_text(GTK_ENTRY(entry_pn2));
- sscanf(pn2_threshold_text, "%lf", &partial_pressure_graphs.pn2_threshold);
+ sscanf(pn2_threshold_text, "%lf", &prefs.pp_graphs.pn2_threshold);
phe_threshold_text = gtk_entry_get_text(GTK_ENTRY(entry_phe));
- sscanf(phe_threshold_text, "%lf", &partial_pressure_graphs.phe_threshold);
- output_units = menu_units;
+ sscanf(phe_threshold_text, "%lf", &prefs.pp_graphs.phe_threshold);
update_dive_list_units();
repaint_dive();
update_dive_list_col_visibility();
- subsurface_set_conf("feet", PREF_BOOL, BOOL_TO_PTR(output_units.length == FEET));
- subsurface_set_conf("psi", PREF_BOOL, BOOL_TO_PTR(output_units.pressure == PSI));
- subsurface_set_conf("cuft", PREF_BOOL, BOOL_TO_PTR(output_units.volume == CUFT));
- subsurface_set_conf("fahrenheit", PREF_BOOL, BOOL_TO_PTR(output_units.temperature == FAHRENHEIT));
- subsurface_set_conf("lbs", PREF_BOOL, BOOL_TO_PTR(output_units.weight == LBS));
+ subsurface_set_conf("feet", PREF_BOOL, BOOL_TO_PTR(prefs.output_units.length == FEET));
+ subsurface_set_conf("psi", PREF_BOOL, BOOL_TO_PTR(prefs.output_units.pressure == PSI));
+ subsurface_set_conf("cuft", PREF_BOOL, BOOL_TO_PTR(prefs.output_units.volume == CUFT));
+ subsurface_set_conf("fahrenheit", PREF_BOOL, BOOL_TO_PTR(prefs.output_units.temperature == FAHRENHEIT));
+ subsurface_set_conf("lbs", PREF_BOOL, BOOL_TO_PTR(prefs.output_units.weight == LBS));
- subsurface_set_conf("TEMPERATURE", PREF_BOOL, BOOL_TO_PTR(visible_cols.temperature));
- subsurface_set_conf("TOTALWEIGHT", PREF_BOOL, BOOL_TO_PTR(visible_cols.totalweight));
- subsurface_set_conf("SUIT", PREF_BOOL, BOOL_TO_PTR(visible_cols.suit));
- subsurface_set_conf("CYLINDER", PREF_BOOL, BOOL_TO_PTR(visible_cols.cylinder));
- subsurface_set_conf("NITROX", PREF_BOOL, BOOL_TO_PTR(visible_cols.nitrox));
- subsurface_set_conf("SAC", PREF_BOOL, BOOL_TO_PTR(visible_cols.sac));
- subsurface_set_conf("OTU", PREF_BOOL, BOOL_TO_PTR(visible_cols.otu));
+ subsurface_set_conf("TEMPERATURE", PREF_BOOL, BOOL_TO_PTR(prefs.visible_cols.temperature));
+ subsurface_set_conf("TOTALWEIGHT", PREF_BOOL, BOOL_TO_PTR(prefs.visible_cols.totalweight));
+ subsurface_set_conf("SUIT", PREF_BOOL, BOOL_TO_PTR(prefs.visible_cols.suit));
+ subsurface_set_conf("CYLINDER", PREF_BOOL, BOOL_TO_PTR(prefs.visible_cols.cylinder));
+ subsurface_set_conf("NITROX", PREF_BOOL, BOOL_TO_PTR(prefs.visible_cols.nitrox));
+ subsurface_set_conf("SAC", PREF_BOOL, BOOL_TO_PTR(prefs.visible_cols.sac));
+ subsurface_set_conf("OTU", PREF_BOOL, BOOL_TO_PTR(prefs.visible_cols.otu));
subsurface_set_conf("divelist_font", PREF_STRING, divelist_font);
subsurface_set_conf("autogroup", PREF_BOOL, BOOL_TO_PTR(autogroup));
- subsurface_set_conf("po2graph", PREF_BOOL, BOOL_TO_PTR(partial_pressure_graphs.po2));
- subsurface_set_conf("pn2graph", PREF_BOOL, BOOL_TO_PTR(partial_pressure_graphs.pn2));
- subsurface_set_conf("phegraph", PREF_BOOL, BOOL_TO_PTR(partial_pressure_graphs.phe));
+ subsurface_set_conf("po2graph", PREF_BOOL, BOOL_TO_PTR(prefs.pp_graphs.po2));
+ subsurface_set_conf("pn2graph", PREF_BOOL, BOOL_TO_PTR(prefs.pp_graphs.pn2));
+ subsurface_set_conf("phegraph", PREF_BOOL, BOOL_TO_PTR(prefs.pp_graphs.phe));
subsurface_set_conf("po2threshold", PREF_STRING, po2_threshold_text);
subsurface_set_conf("pn2threshold", PREF_STRING, pn2_threshold_text);
subsurface_set_conf("phethreshold", PREF_STRING, phe_threshold_text);
- subsurface_set_conf("redceiling", PREF_BOOL, BOOL_TO_PTR(profile_red_ceiling));
+ subsurface_set_conf("redceiling", PREF_BOOL, BOOL_TO_PTR(prefs.profile_red_ceiling));
new_default = strdup(gtk_button_get_label(GTK_BUTTON(xmlfile_button)));
@@ -812,6 +813,8 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
/* Flush the changes out to the system */
subsurface_flush_conf();
+ } else if (result == GTK_RESPONSE_CANCEL) {
+ prefs = oldprefs;
}
free((void *)current_default);
gtk_widget_destroy(dialog);
@@ -1122,37 +1125,37 @@ void init_ui(int *argcp, char ***argvp)
subsurface_open_conf();
if (subsurface_get_conf("feet", PREF_BOOL))
- output_units.length = FEET;
+ prefs.output_units.length = FEET;
if (subsurface_get_conf("psi", PREF_BOOL))
- output_units.pressure = PSI;
+ prefs.output_units.pressure = PSI;
if (subsurface_get_conf("cuft", PREF_BOOL))
- output_units.volume = CUFT;
+ prefs.output_units.volume = CUFT;
if (subsurface_get_conf("fahrenheit", PREF_BOOL))
- output_units.temperature = FAHRENHEIT;
+ prefs.output_units.temperature = FAHRENHEIT;
if (subsurface_get_conf("lbs", PREF_BOOL))
- output_units.weight = LBS;
+ prefs.output_units.weight = LBS;
/* an unset key is FALSE - all these are hidden by default */
- visible_cols.cylinder = PTR_TO_BOOL(subsurface_get_conf("CYLINDER", PREF_BOOL));
- visible_cols.temperature = PTR_TO_BOOL(subsurface_get_conf("TEMPERATURE", PREF_BOOL));
- visible_cols.totalweight = PTR_TO_BOOL(subsurface_get_conf("TOTALWEIGHT", PREF_BOOL));
- visible_cols.suit = PTR_TO_BOOL(subsurface_get_conf("SUIT", PREF_BOOL));
- visible_cols.nitrox = PTR_TO_BOOL(subsurface_get_conf("NITROX", PREF_BOOL));
- visible_cols.otu = PTR_TO_BOOL(subsurface_get_conf("OTU", PREF_BOOL));
- visible_cols.sac = PTR_TO_BOOL(subsurface_get_conf("SAC", PREF_BOOL));
-
- partial_pressure_graphs.po2 = PTR_TO_BOOL(subsurface_get_conf("po2graph", PREF_BOOL));
- partial_pressure_graphs.pn2 = PTR_TO_BOOL(subsurface_get_conf("pn2graph", PREF_BOOL));
- partial_pressure_graphs.phe = PTR_TO_BOOL(subsurface_get_conf("phegraph", PREF_BOOL));
+ prefs.visible_cols.cylinder = PTR_TO_BOOL(subsurface_get_conf("CYLINDER", PREF_BOOL));
+ prefs.visible_cols.temperature = PTR_TO_BOOL(subsurface_get_conf("TEMPERATURE", PREF_BOOL));
+ prefs.visible_cols.totalweight = PTR_TO_BOOL(subsurface_get_conf("TOTALWEIGHT", PREF_BOOL));
+ prefs.visible_cols.suit = PTR_TO_BOOL(subsurface_get_conf("SUIT", PREF_BOOL));
+ prefs.visible_cols.nitrox = PTR_TO_BOOL(subsurface_get_conf("NITROX", PREF_BOOL));
+ prefs.visible_cols.otu = PTR_TO_BOOL(subsurface_get_conf("OTU", PREF_BOOL));
+ prefs.visible_cols.sac = PTR_TO_BOOL(subsurface_get_conf("SAC", PREF_BOOL));
+
+ prefs.pp_graphs.po2 = PTR_TO_BOOL(subsurface_get_conf("po2graph", PREF_BOOL));
+ prefs.pp_graphs.pn2 = PTR_TO_BOOL(subsurface_get_conf("pn2graph", PREF_BOOL));
+ prefs.pp_graphs.phe = PTR_TO_BOOL(subsurface_get_conf("phegraph", PREF_BOOL));
conf_value = subsurface_get_conf("po2threshold", PREF_STRING);
if (conf_value)
- sscanf(conf_value, "%lf", &partial_pressure_graphs.po2_threshold);
+ sscanf(conf_value, "%lf", &prefs.pp_graphs.po2_threshold);
conf_value = subsurface_get_conf("pn2threshold", PREF_STRING);
if (conf_value)
- sscanf(conf_value, "%lf", &partial_pressure_graphs.pn2_threshold);
+ sscanf(conf_value, "%lf", &prefs.pp_graphs.pn2_threshold);
conf_value = subsurface_get_conf("phethreshold", PREF_STRING);
if (conf_value)
- sscanf(conf_value, "%lf", &partial_pressure_graphs.phe_threshold);
- profile_red_ceiling = PTR_TO_BOOL(subsurface_get_conf("redceiling", PREF_BOOL));
+ sscanf(conf_value, "%lf", &prefs.pp_graphs.phe_threshold);
+ prefs.profile_red_ceiling = PTR_TO_BOOL(subsurface_get_conf("redceiling", PREF_BOOL));
divelist_font = subsurface_get_conf("divelist_font", PREF_STRING);
autogroup = PTR_TO_BOOL(subsurface_get_conf("autogroup", PREF_BOOL));
default_filename = subsurface_get_conf("default_filename", PREF_STRING);
diff --git a/info.c b/info.c
index ee27c4535..c61fd7588 100644
--- a/info.c
+++ b/info.c
@@ -455,7 +455,7 @@ static void save_dive_info_changes(struct dive *dive, struct dive *master, struc
new_text = (char *)gtk_entry_get_text(info->airtemp);
if(sscanf(new_text, "%lf", &newtemp) == 1) {
unsigned long mkelvin;
- switch (output_units.temperature) {
+ switch (prefs.output_units.temperature) {
case CELSIUS:
mkelvin = C_to_mkelvin(newtemp);
break;
@@ -890,8 +890,8 @@ static timestamp_t dive_time_widget(struct dive *dive)
gtk_box_pack_end(GTK_BOX(box), duration, FALSE, FALSE, 0);
/* Depth box */
- box = frame_box(hbox, _("Depth (%s):"), output_units.length == FEET ? _("ft") : _("m"));
- if (output_units.length == FEET) {
+ box = frame_box(hbox, _("Depth (%s):"), prefs.output_units.length == FEET ? _("ft") : _("m"));
+ if (prefs.output_units.length == FEET) {
depthinterval = 1.0;
} else {
depthinterval = 0.1;
@@ -917,7 +917,7 @@ static timestamp_t dive_time_widget(struct dive *dive)
tm.tm_min = gtk_spin_button_get_value(GTK_SPIN_BUTTON(m));
val = gtk_spin_button_get_value(GTK_SPIN_BUTTON(depth));
- if (output_units.length == FEET) {
+ if (prefs.output_units.length == FEET) {
dive->maxdepth.mm = feet_to_mm(val);
} else {
dive->maxdepth.mm = val * 1000 + 0.5;
diff --git a/parse-xml.c b/parse-xml.c
index 35299257a..eb4d4832e 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -129,29 +129,8 @@ static int match(const char *pattern, int plen,
struct units input_units;
-
-/*
- * We're going to default to SI units for input. Yes,
- * technically the SI unit for pressure is Pascal, but
- * we default to bar (10^5 pascal), which people
- * actually use. Similarly, C instead of Kelvin.
- * And kg instead of g.
- */
-const struct units SI_units = {
- .length = METERS,
- .volume = LITER,
- .pressure = BAR,
- .temperature = CELSIUS,
- .weight = KG
-};
-
-const struct units IMPERIAL_units = {
- .length = FEET,
- .volume = CUFT,
- .pressure = PSI,
- .temperature = FAHRENHEIT,
- .weight = LBS
-};
+const struct units SI_units = SI_UNITS;
+const struct units IMPERIAL_units = IMPERIAL_UNITS;
/*
* Dive info as it is being built up..
diff --git a/print.c b/print.c
index 7d879cecb..368ab9475 100644
--- a/print.c
+++ b/print.c
@@ -237,7 +237,7 @@ static void show_dive_tanks(struct dive *dive, cairo_t *cr, double w,
while ( i < 3 ) {
cairo_move_to(cr, curwidth / (double) PANGO_SCALE, 0);
switch(i) {
- case 0 : if (output_units.volume == CUFT) {
+ case 0 : if (prefs.output_units.volume == CUFT) {
cyl_cap *= cyl_wp / 14.7 ;
}
snprintf(buffer, sizeof(buffer), _("%.*f %s"),
@@ -256,7 +256,7 @@ static void show_dive_tanks(struct dive *dive, cairo_t *cr, double w,
}
break;
case 2 : cairo_move_to(cr, curwidth / (double) PANGO_SCALE, 0);
- if (output_units.volume == CUFT) {
+ if (prefs.output_units.volume == CUFT) {
cyl_cons_gas /= 14.7 ;
}
snprintf(buffer, sizeof(buffer), _("%.*f %s\n"),
diff --git a/profile.c b/profile.c
index 8940817b8..4b02f9bc1 100644
--- a/profile.c
+++ b/profile.c
@@ -241,7 +241,7 @@ static int get_maxdepth(struct plot_info *pi)
/* Minimum 30m, rounded up to 10m, with at least 3m to spare */
md = MAX(30000, ROUND_UP(mm+3000, 10000));
}
- if (GRAPHS_ENABLED) {
+ if (PP_GRAPHS_ENABLED) {
if (md <= 20000)
md += 10000;
else
@@ -505,7 +505,7 @@ static void plot_depth_scale(struct graphics_context *gc, struct plot_info *pi)
maxdepth = get_maxdepth(pi);
gc->topy = 0; gc->bottomy = maxdepth;
- switch (output_units.length) {
+ switch (prefs.output_units.length) {
case METERS: marker = 10000; break;
case FEET: marker = 9144; break; /* 30 ft */
}
@@ -783,15 +783,15 @@ static void plot_pp_text(struct graphics_context *gc, struct plot_info *pi)
setup_pp_limits(gc, pi);
- if (partial_pressure_graphs.po2) {
+ if (prefs.pp_graphs.po2) {
maxpp = plot_single_gas_pp_text(gc, pi, po2_value, 0.4, PO2);
}
- if (partial_pressure_graphs.pn2) {
+ if (prefs.pp_graphs.pn2) {
m = plot_single_gas_pp_text(gc, pi, pn2_value, 0.6, PN2);
if (m > maxpp)
maxpp = m;
}
- if (partial_pressure_graphs.phe) {
+ if (prefs.pp_graphs.phe) {
m = plot_single_gas_pp_text(gc, pi, phe_value, 0.4, PHE);
if (m > maxpp)
maxpp = m;
@@ -814,13 +814,13 @@ static void plot_pp_gas_profile(struct graphics_context *gc, struct plot_info *p
setup_pp_limits(gc, pi);
- if (partial_pressure_graphs.po2) {
+ if (prefs.pp_graphs.po2) {
set_source_rgba(gc, PO2);
entry = pi->entry;
move_to(gc, entry->sec, entry->po2);
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->po2 < partial_pressure_graphs.po2_threshold)
+ if (entry->po2 < prefs.pp_graphs.po2_threshold)
line_to(gc, entry->sec, entry->po2);
else
move_to(gc, entry->sec, entry->po2);
@@ -832,20 +832,20 @@ static void plot_pp_gas_profile(struct graphics_context *gc, struct plot_info *p
move_to(gc, entry->sec, entry->po2);
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->po2 >= partial_pressure_graphs.po2_threshold)
+ if (entry->po2 >= prefs.pp_graphs.po2_threshold)
line_to(gc, entry->sec, entry->po2);
else
move_to(gc, entry->sec, entry->po2);
}
cairo_stroke(gc->cr);
}
- if (partial_pressure_graphs.pn2) {
+ if (prefs.pp_graphs.pn2) {
set_source_rgba(gc, PN2);
entry = pi->entry;
move_to(gc, entry->sec, entry->pn2);
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->pn2 < partial_pressure_graphs.pn2_threshold)
+ if (entry->pn2 < prefs.pp_graphs.pn2_threshold)
line_to(gc, entry->sec, entry->pn2);
else
move_to(gc, entry->sec, entry->pn2);
@@ -857,20 +857,20 @@ static void plot_pp_gas_profile(struct graphics_context *gc, struct plot_info *p
move_to(gc, entry->sec, entry->pn2);
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->pn2 >= partial_pressure_graphs.pn2_threshold)
+ if (entry->pn2 >= prefs.pp_graphs.pn2_threshold)
line_to(gc, entry->sec, entry->pn2);
else
move_to(gc, entry->sec, entry->pn2);
}
cairo_stroke(gc->cr);
}
- if (partial_pressure_graphs.phe) {
+ if (prefs.pp_graphs.phe) {
set_source_rgba(gc, PHE);
entry = pi->entry;
move_to(gc, entry->sec, entry->phe);
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->phe < partial_pressure_graphs.phe_threshold)
+ if (entry->phe < prefs.pp_graphs.phe_threshold)
line_to(gc, entry->sec, entry->phe);
else
move_to(gc, entry->sec, entry->phe);
@@ -882,7 +882,7 @@ static void plot_pp_gas_profile(struct graphics_context *gc, struct plot_info *p
move_to(gc, entry->sec, entry->phe);
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->phe >= partial_pressure_graphs.phe_threshold)
+ if (entry->phe >= prefs.pp_graphs.phe_threshold)
line_to(gc, entry->sec, entry->phe);
else
move_to(gc, entry->sec, entry->phe);
@@ -945,7 +945,7 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi
/* Depth markers: every 30 ft or 10 m*/
gc->leftx = 0; gc->rightx = 1.0;
gc->topy = 0; gc->bottomy = maxdepth;
- switch (output_units.length) {
+ switch (prefs.output_units.length) {
case METERS: marker = 10000; break;
case FEET: marker = 9144; break; /* 30 ft */
}
@@ -1010,7 +1010,7 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi
/* if the user wants the deco ceiling more visible, do that here (this
* basically draws over the background that we had allowed to shine
* through so far) */
- if (profile_red_ceiling) {
+ if (prefs.profile_red_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);
@@ -1086,7 +1086,7 @@ static int setup_temperature_limits(struct graphics_context *gc, struct plot_inf
delta = 3000;
gc->topy = maxtemp + delta*2;
- if (GRAPHS_ENABLED)
+ if (PP_GRAPHS_ENABLED)
gc->bottomy = mintemp - delta * 2;
else
gc->bottomy = mintemp - delta / 3;
@@ -1178,7 +1178,7 @@ static int get_cylinder_pressure_range(struct graphics_context *gc, struct plot_
gc->leftx = 0;
gc->rightx = get_maxtime(pi);
- if (GRAPHS_ENABLED)
+ if (PP_GRAPHS_ENABLED)
gc->bottomy = -pi->maxpressure * 0.75;
else
gc->bottomy = 0;
@@ -2036,7 +2036,7 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale)
plot_text(gc, &computer, 0, 1, "%s", dc->model);
}
- if (GRAPHS_ENABLED) {
+ if (PP_GRAPHS_ENABLED) {
plot_pp_gas_profile(gc, pi);
plot_pp_text(gc, pi);
}
@@ -2101,15 +2101,15 @@ static void plot_string(struct plot_data *entry, char *buf, size_t bufsize,
memcpy(buf2, buf, bufsize);
snprintf(buf, bufsize, "%s\nNDL:%umin", buf2, entry->ndl / 60);
}
- if (partial_pressure_graphs.po2) {
+ if (prefs.pp_graphs.po2) {
memcpy(buf2, buf, bufsize);
snprintf(buf, bufsize, "%s\npO" UTF8_SUBSCRIPT_2 ":%.1f", buf2, entry->po2);
}
- if (partial_pressure_graphs.pn2) {
+ if (prefs.pp_graphs.pn2) {
memcpy(buf2, buf, bufsize);
snprintf(buf, bufsize, "%s\npN" UTF8_SUBSCRIPT_2 ":%.1f", buf2, entry->pn2);
}
- if (partial_pressure_graphs.phe) {
+ if (prefs.pp_graphs.phe) {
memcpy(buf2, buf, bufsize);
snprintf(buf, bufsize, "%s\npHe:%.1f", buf2, entry->phe);
}