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>
This commit is contained in:
Dirk Hohndel 2013-03-18 19:39:57 -07:00
parent 471b944704
commit 14b6551a6a
3 changed files with 63 additions and 12 deletions

View file

@ -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)