Move more dive computer filled data to the divecomputer structure

This moves the fields 'duration', 'surfacetime', 'maxdepth',
'meandepth', 'airtemp', 'watertemp', 'salinity' and 'surface_pressure'
to the per-divecomputer data structure.  They are filled in by the dive
computer, and normally not edited.

NOTE! All actual *use* of this data was then changed from dive->field to
dive->dc.field programmatically with a shell-script and sed, and the
result then edited for details.  So while the XML save and restore code
has been updated, all the displaying etc will currently always just show
the first dive computer entry.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2013-01-23 10:25:31 -08:00 committed by Dirk Hohndel
parent 3e5a508b15
commit b6c9301e58
16 changed files with 183 additions and 175 deletions

View file

@ -98,11 +98,11 @@ static void show_dive_header(struct dive *dive, cairo_t *cr, double w,
people = "";
}
depth = get_depth_units(dive->maxdepth.mm, &decimals, &unit);
depth = get_depth_units(dive->dc.maxdepth.mm, &decimals, &unit);
snprintf(buffer, sizeof(buffer),
_("Max depth: %.*f %s\nDuration: %d min\n%s"),
decimals, depth, unit,
(dive->duration.seconds+59) / 60,
(dive->dc.duration.seconds+59) / 60,
people);
set_font(layout, font, FONT_SMALL, PANGO_ALIGN_RIGHT);
@ -591,7 +591,7 @@ static void show_dive_table(struct dive *dive, cairo_t *cr, double w,
curwidth = curwidth + colwidth;
// Col 3: Depth
depth = get_depth_units(dive->maxdepth.mm, &decimals, &unit);
depth = get_depth_units(dive->dc.maxdepth.mm, &decimals, &unit);
len = snprintf(buffer, sizeof(buffer),
"%.*f %s", decimals, depth, unit);
cairo_move_to(cr, curwidth / PANGO_SCALE, 0);
@ -603,7 +603,7 @@ static void show_dive_table(struct dive *dive, cairo_t *cr, double w,
// Col 4: Time
len = snprintf(buffer, sizeof(buffer),
_("%d min"),(dive->duration.seconds+59) / 60);
_("%d min"),(dive->dc.duration.seconds+59) / 60);
cairo_move_to(cr, curwidth / PANGO_SCALE, 0);
pango_layout_set_width(layout, colwidth/ (double) 2);
pango_layout_set_text(layout, buffer, len);