From: cilix42 Date: Tue, 18 Dec 2007 11:28:48 +0000 (+0000) Subject: Use 'D' to toggle (not just switch to) the dropper tool; closes bug/RFE #170590 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d676a4b81fca94a00d278c6c8c328675b98c9863;p=inkscape.git Use 'D' to toggle (not just switch to) the dropper tool; closes bug/RFE #170590 --- diff --git a/src/event-context.cpp b/src/event-context.cpp index 7fca5accb..6186bb36f 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -69,6 +69,10 @@ static GObjectClass *parent_class; static bool selector_toggled = FALSE; static int switch_selector_to = 0; +// globals for temporary switching to dropper by 'D' +static bool dropper_toggled = FALSE; +static int switch_dropper_to = 0; + static gint xp = 0, yp = 0; // where drag started static gint tolerance = 0; static bool within_tolerance = false; @@ -276,6 +280,27 @@ sp_toggle_selector(SPDesktop *dt) } } +/** + * Toggles current tool between active tool and selector tool. + * Subroutine of sp_event_context_private_root_handler(). + */ +static void +sp_toggle_dropper(SPDesktop *dt) +{ + if (!dt->event_context) return; + + if (tools_isactive(dt, TOOLS_DROPPER)) { + if (dropper_toggled) { + if (switch_dropper_to) tools_switch (dt, switch_dropper_to); + dropper_toggled = FALSE; + } else return; + } else { + dropper_toggled = TRUE; + switch_dropper_to = tools_active(dt); + tools_switch (dt, TOOLS_DROPPER); + } +} + /** * Calculates and keeps track of scroll acceleration. * Subroutine of sp_event_context_private_root_handler(). @@ -495,6 +520,11 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context, ret = sp_shortcut_invoke(shortcut, desktop); break; + case GDK_D: + case GDK_d: + sp_toggle_dropper(desktop); + ret = TRUE; + break; case GDK_W: case GDK_w: case GDK_F4: