summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-17 18:07:59 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-17 20:04:25 -0700
commit8a5792d473bb30a6f5cbfd2168c4427c16436031 (patch)
tree58ec7fcb24aec27de5c7b4d2511478ed6550c1b1 /dive.h
parentbfa37c3cac22949323bb6a5dfb23557638d20757 (diff)
downloadsubsurface-8a5792d473bb30a6f5cbfd2168c4427c16436031.tar.gz
Manually add gas changes to a dive
Create a little widget that lists all the gases / tanks we know about and allow the user to pick one of them. Turns out that add_event only added events at the end of the list - but we treat that list as chronologically sorted. So I fixed that little mis-feature as well. This does raise the question whether we need the inverse operation (removing a gas change). And if there are other things that we should be able to manually edit, now that we have the infrastructure for this neat little context menu... See #60 -- this doesn't address all of the issues mentioned there, but at least deals with the 'headline' of the feature request... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/dive.h b/dive.h
index b6738d171..9d359fe18 100644
--- a/dive.h
+++ b/dive.h
@@ -471,6 +471,7 @@ extern struct dive_table dive_table;
extern int selected_dive;
#define current_dive (get_dive(selected_dive))
+#define current_dc (get_dive_dc(current_dive, dc_number))
static inline struct dive *get_gps_location(int nr, struct dive_table *table)
{
@@ -486,6 +487,16 @@ static inline struct dive *get_dive(int nr)
return dive_table.dives[nr];
}
+static inline struct divecomputer *get_dive_dc(struct dive *dive, int nr)
+{
+ struct divecomputer *dc = NULL;
+ if (nr >= 0)
+ dc = &dive->dc;
+ while (nr-- > 0)
+ dc = dc->next;
+ return dc;
+}
+
/*
* Iterate over each dive, with the first parameter being the index
* iterator variable, and the second one being the dive one.
@@ -670,6 +681,7 @@ void add_duration_to_nth_dp(struct diveplan *diveplan, int idx, int duration, gb
void add_depth_to_nth_dp(struct diveplan *diveplan, int idx, int depth);
void add_gas_to_nth_dp(struct diveplan *diveplan, int idx, int o2, int he);
void free_dps(struct divedatapoint *dp);
+void get_gas_string(int o2, int he, char *buf, int len);
#ifdef DEBUGFILE
extern char *debugfilename;