summaryrefslogtreecommitdiffstats
path: root/core/picture.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-19 17:01:58 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-06 13:58:09 -0700
commit6ae2d36e381b4f676eb9d8c0e06245989ef16383 (patch)
tree169e0b4119fc9c549a32528952215cd78a64221d /core/picture.h
parent74f03e3537ee530000d4b11013bb12de91cb21dd (diff)
downloadsubsurface-6ae2d36e381b4f676eb9d8c0e06245989ef16383.tar.gz
core: move picture-related function from dive.c to picture.c
Move the two functions create_picture() and picture_check_valid_time() from dive.c to picture.c. This might be somewhat questionable, as these functions are not purely picture related, but check the nearest selected dives, etc. However, dive.c is so huge, that slimming it down can't hurt. Moreover, getting the nearest selected dive is more divelist- than dive functionality anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/picture.h')
-rw-r--r--core/picture.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/picture.h b/core/picture.h
index 61492fffc..b763adfe9 100644
--- a/core/picture.h
+++ b/core/picture.h
@@ -10,6 +10,8 @@
extern "C" {
#endif
+struct dive;
+
struct picture {
char *filename;
offset_t offset;
@@ -17,6 +19,13 @@ struct picture {
};
static const struct picture empty_picture = { NULL, { 0 }, { { 0 }, { 0 } } };
+/* loop through all pictures of a dive */
+#define FOR_EACH_PICTURE(_dive) \
+ if ((_dive) && (_dive)->pictures.nr) \
+ for (struct picture *picture = (_dive)->pictures.pictures; \
+ picture < (_dive)->pictures.pictures + (_dive)->pictures.nr; \
+ picture++)
+
/* Table of pictures. Attention: this stores pictures,
* *not* pointers to pictures. This has two crucial consequences:
* 1) Pointers to pictures are not stable. They may be
@@ -37,6 +46,9 @@ extern void remove_from_picture_table(struct picture_table *, int idx);
extern int get_picture_idx(const struct picture_table *, const char *filename); /* Return -1 if not found */
extern void sort_picture_table(struct picture_table *);
+extern struct picture *create_picture(const char *filename, int shift_time, bool match_all, struct dive **dive);
+extern bool picture_check_valid_time(timestamp_t timestamp, int shift_time);
+
#ifdef __cplusplus
}
#endif