]> git.tdb.fi Git - ext/subsurface.git/blobdiff - equipment.c
Create separate single dive and total stats pages
[ext/subsurface.git] / equipment.c
index f14733f19182db2ac5a81f2a3972b9e61297f223..e4f880f64e584ca1eb29183e0ceddaca973360ef 100644 (file)
@@ -64,9 +64,8 @@ static int convert_pressure(int mbar, double *p)
        return decimals;
 }
 
-static int convert_volume_pressure(int ml, int mbar, double *v, double *p)
+static void convert_volume_pressure(int ml, int mbar, double *v, double *p)
 {
-       int decimals = 1;
        double volume, pressure;
 
        volume = ml / 1000.0;
@@ -78,13 +77,11 @@ static int convert_volume_pressure(int ml, int mbar, double *v, double *p)
 
                if (output_units.pressure == PSI) {
                        pressure = mbar_to_PSI(mbar);
-                       decimals = 0;
                } else
                        pressure = mbar / 1000.0;
        }
        *v = volume;
        *p = pressure;
-       return decimals;
 }
 
 static void set_cylinder_type_spinbuttons(struct cylinder_widget *cylinder, int ml, int mbar)
@@ -288,7 +285,7 @@ static void show_cylinder(cylinder_t *cyl, struct cylinder_widget *cylinder)
        o2 = cyl->gasmix.o2.permille / 10.0;
        he = cyl->gasmix.he.permille / 10.0;
        if (!o2)
-               o2 = 21.0;
+               o2 = AIR_PERMILLE / 10.0;
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->o2), o2);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->he), he);
 }
@@ -306,7 +303,7 @@ int cylinder_none(cylinder_t *cyl)
                !cyl->end.mbar;
 }
 
-static void set_one_cylinder(int index, cylinder_t *cyl, GtkListStore *model, GtkTreeIter *iter)
+static void set_one_cylinder(cylinder_t *cyl, GtkListStore *model, GtkTreeIter *iter)
 {
        unsigned int start, end;
 
@@ -349,7 +346,7 @@ void show_dive_equipment(struct dive *dive)
                cylinder_t *cyl = dive->cylinder+i;
 
                gtk_list_store_append(model, &iter);
-               set_one_cylinder(i, cyl, model, &iter);
+               set_one_cylinder(cyl, model, &iter);
        }
 }
 
@@ -479,6 +476,17 @@ static struct tank_info {
        { "HP119", .cuft = 119, .psi = 3442 },
        { "HP130", .cuft = 130, .psi = 3442 },
 
+       /* Common European steel cylinders */
+       { "10L 300 bar",  .ml = 10000, .bar = 300 },
+       { "12L 200 bar",  .ml = 12000, .bar = 200 },
+       { "12L 232 bar",  .ml = 12000, .bar = 232 },
+       { "12L 300 bar",  .ml = 12000, .bar = 300 },
+       { "15L 200 bar",  .ml = 15000, .bar = 200 },
+       { "15L 232 bar",  .ml = 15000, .bar = 232 },
+       { "D7 300 bar",   .ml = 14000, .bar = 300 },
+       { "D8.5 232 bar", .ml = 17000, .bar = 232 },
+       { "D12 232 bar",  .ml = 24000, .bar = 232 },
+
        /* We'll fill in more from the dive log dynamically */
        { NULL, }
 };
@@ -732,7 +740,7 @@ static void edit_cb(GtkButton *button, GtkTreeView *tree_view)
        if (!edit_cylinder_dialog(index, &cyl))
                return;
 
-       set_one_cylinder(index, &cyl, model, &iter);
+       set_one_cylinder(&cyl, model, &iter);
        repaint_dive();
 }
 
@@ -748,7 +756,7 @@ static void add_cb(GtkButton *button, GtkTreeView *tree_view)
                return;
 
        gtk_list_store_append(model, &iter);
-       set_one_cylinder(index, &cyl, model, &iter);
+       set_one_cylinder(&cyl, model, &iter);
 
        selection = gtk_tree_view_get_selection(tree_view);
        gtk_tree_selection_select_iter(selection, &iter);