summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-02 18:28:02 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-02 23:59:29 -0700
commitd95d1735b5f0fec2941696a4bb1720eb00a6f59c (patch)
treeeae15bb2c25d051150292de7b17429d074c65d36 /dive.c
parent13e8aba7daee2104c859e17de3363a24c5a885c0 (diff)
downloadsubsurface-d95d1735b5f0fec2941696a4bb1720eb00a6f59c.tar.gz
Break picture handling code from C++ to C.
This commit breaks the loading of images that were done in the divelist into smaller bits. A bit of code refactor was done in order to correct the placement of a few methods. ShiftTimesDialog::EpochFromExiv got moved to Exif::epoch dive_add_picture is now used instead of add_event picture_load_exif_data got implemented using the old listview code. dive_set_geodata_from_picture got implemented using the old listview code. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/dive.c b/dive.c
index f1e113d05..6d9be7dfb 100644
--- a/dive.c
+++ b/dive.c
@@ -2260,14 +2260,26 @@ int average_depth(struct diveplan *dive)
return integral / last_time;
}
-void picture_load_exif_data(struct picture *p)
+struct picture *alloc_picture()
{
-
+ struct picture *pic = malloc(sizeof(struct picture));
+ if (!pic)
+ exit(1);
+ memset(pic, 0, sizeof(struct picture));
+ return pic;
}
-struct picture* dive_add_picture(struct dive *d, char *picture)
+void dive_add_picture(struct dive *d, struct picture *picture)
{
-
+ if (d->picture_list == NULL) {
+ d->picture_list = picture;
+ return;
+ }
+ struct picture *last = d->picture_list;
+ while( last->next )
+ last = last->next;
+ last->next = picture;
+ return;
}
uint dive_get_picture_count(struct dive *d)
@@ -2278,7 +2290,15 @@ uint dive_get_picture_count(struct dive *d)
return i;
}
-void dive_remove_picture(struct dive *d, char *picture)
+void dive_set_geodata_from_picture(struct dive *d, struct picture *pic)
+{
+ if (!d->latitude.udeg && pic->latitude.udeg) {
+ d->latitude = pic->latitude;
+ d->longitude = pic->longitude;
+ }
+}
+
+void dive_remove_picture(struct dive *d, struct picture *p)
{
}