return vw->vt->tools[vw->vt->active_tool].ti.key_press(vl, event, vw->vt->tools[vw->vt->active_tool].state);
}
+ // No layer - but enable window tool keypress processing - these should be able to handle a NULL layer
+ if ( vw->vt->tools[vw->vt->active_tool].ti.key_press ) {
+ return vw->vt->tools[vw->vt->active_tool].ti.key_press ( vl, event, vw->vt->tools[vw->vt->active_tool].state );
+ }
+
/* Restore Main Menu via Escape key if the user has hidden it */
/* This key is more likely to be used as they may not remember the function key */
if ( event->keyval == GDK_Escape ) {
draw_update ( s->vw );
}
+static gboolean ruler_key_press (VikLayer *vl, GdkEventKey *event, ruler_tool_state_t *s)
+{
+ if (event->keyval == GDK_Escape) {
+ s->has_oldcoord = FALSE;
+ ruler_deactivate ( vl, s );
+ return TRUE;
+ }
+ return FALSE;
+}
+
static VikToolInterface ruler_tool =
{ "Ruler",
(VikToolConstructorFunc) ruler_create,
(VikToolMouseFunc) ruler_click,
(VikToolMouseMoveFunc) ruler_move,
(VikToolMouseFunc) ruler_release,
- NULL,
+ (VikToolKeyFunc) ruler_key_press,
GDK_CURSOR_IS_PIXMAP,
&cursor_ruler_pixbuf };
/*** end ruler code ********************************************************/