summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-18 19:39:57 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-18 19:46:17 -0700
commit14b6551a6af4ae9a7d8d56863636fc91a36ee9c0 (patch)
treeb8a7f944c115c4422a31eb13678279963ac3a478 /profile.c
parent471b944704559f0ec3436c3e71da5752e9742e86 (diff)
downloadsubsurface-14b6551a6af4ae9a7d8d56863636fc91a36ee9c0.tar.gz
Manually remove events in the profile context menu
As logical extension of the ability to add bookmarks and gas changes this adds the ability to remove (any arbitrary) event that happens at the mouse position (specifically, that is within +/- six (scaled) pixels around the x-position (time) of the mouse). That's the same width that the triangle marker occupies which was moved to be centered around the event time in commit 5752e9742e86 ("Finetune event triangle position to have the top point at the event time"). Fixes #60 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/profile.c b/profile.c
index ce2113e68..96a051705 100644
--- a/profile.c
+++ b/profile.c
@@ -150,6 +150,12 @@ int x_to_time(double x)
return (seconds > 0) ? seconds : 0;
}
+/* x offset into the drawing area */
+int x_abs(double x)
+{
+ return x - last_gc.drawing_area.x;
+}
+
static void move_to(struct graphics_context *gc, double x, double y)
{
cairo_move_to(gc->cr, SCALE(gc, x, y));
@@ -423,7 +429,7 @@ static void plot_one_event(struct graphics_context *gc, struct plot_info *pi, st
event->flags == SAMPLE_FLAGS_BEGIN ? C_("Starts with space!"," begin") :
event->flags == SAMPLE_FLAGS_END ? C_("Starts with space!", " end") : "");
}
- attach_tooltip(x-6, y, 12, 12, buffer);
+ attach_tooltip(x-6, y, 12, 12, buffer, event);
}
static void plot_events(struct graphics_context *gc, struct plot_info *pi, struct divecomputer *dc)