mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 21:20:19 +00:00
Merge branch 'forlinus' of git://github.com/dirkhh/subsurface
* 'forlinus' of git://github.com/dirkhh/subsurface: Make sure SAC and OTU get recalculated after cylinder info was changed
This commit is contained in:
commit
ede70c03b0
3 changed files with 18 additions and 8 deletions
11
divelist.c
11
divelist.c
|
@ -335,6 +335,14 @@ static int calculate_sac(struct dive *dive)
|
||||||
return sac * 1000;
|
return sac * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void update_cylinder_related_info(struct dive *dive)
|
||||||
|
{
|
||||||
|
if(dive != NULL) {
|
||||||
|
dive->sac = calculate_sac(dive);
|
||||||
|
dive->otu = calculate_otu(dive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void get_string(char **str, const char *s)
|
static void get_string(char **str, const char *s)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
@ -452,8 +460,7 @@ static void fill_dive_list(void)
|
||||||
for (i = 0; i < dive_table.nr; i++) {
|
for (i = 0; i < dive_table.nr; i++) {
|
||||||
struct dive *dive = dive_table.dives[i];
|
struct dive *dive = dive_table.dives[i];
|
||||||
|
|
||||||
dive->otu = calculate_otu(dive);
|
update_cylinder_related_info(dive);
|
||||||
dive->sac = calculate_sac(dive);
|
|
||||||
gtk_list_store_append(store, &iter);
|
gtk_list_store_append(store, &iter);
|
||||||
gtk_list_store_set(store, &iter,
|
gtk_list_store_set(store, &iter,
|
||||||
DIVE_INDEX, i,
|
DIVE_INDEX, i,
|
||||||
|
|
|
@ -7,7 +7,7 @@ extern void dive_list_update_dives(void);
|
||||||
extern void update_dive_list_col_visibility(void);
|
extern void update_dive_list_col_visibility(void);
|
||||||
extern void update_dive_list_units(void);
|
extern void update_dive_list_units(void);
|
||||||
extern void flush_divelist(struct dive *);
|
extern void flush_divelist(struct dive *);
|
||||||
|
extern void update_cylinder_related_info(struct dive *);
|
||||||
extern void mark_divelist_changed(int);
|
extern void mark_divelist_changed(int);
|
||||||
extern int unsaved_changes(void);
|
extern int unsaved_changes(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -416,12 +416,14 @@ static void record_cylinder_changes(cylinder_t *cyl, struct cylinder_widget *cyl
|
||||||
desc = gtk_combo_box_get_active_text(box);
|
desc = gtk_combo_box_get_active_text(box);
|
||||||
volume = gtk_spin_button_get_value(cylinder->size);
|
volume = gtk_spin_button_get_value(cylinder->size);
|
||||||
pressure = gtk_spin_button_get_value(cylinder->pressure);
|
pressure = gtk_spin_button_get_value(cylinder->pressure);
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->pressure_button))) {
|
||||||
start = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->start));
|
start = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->start));
|
||||||
end = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->end));
|
end = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->end));
|
||||||
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->pressure_button)))
|
} else
|
||||||
start = end = 0;
|
start = end = 0;
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button)))
|
||||||
o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
|
o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
|
||||||
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button)))
|
else
|
||||||
o2 = 0;
|
o2 = 0;
|
||||||
fill_cylinder_info(cylinder, cyl, desc, volume, pressure, start, end, o2);
|
fill_cylinder_info(cylinder, cyl, desc, volume, pressure, start, end, o2);
|
||||||
}
|
}
|
||||||
|
@ -643,6 +645,7 @@ static int edit_cylinder_dialog(int index, cylinder_t *cyl)
|
||||||
record_cylinder_changes(cyl, &cylinder);
|
record_cylinder_changes(cyl, &cylinder);
|
||||||
dive->cylinder[index] = *cyl;
|
dive->cylinder[index] = *cyl;
|
||||||
mark_divelist_changed(TRUE);
|
mark_divelist_changed(TRUE);
|
||||||
|
update_cylinder_related_info(dive);
|
||||||
flush_divelist(dive);
|
flush_divelist(dive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue