From: buliabyak Date: Mon, 16 Feb 2009 01:16:56 +0000 (+0000) Subject: make doubleclick not only switch to text but also position cursor X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3d105b9aa18fc3ae82a2371c73f99c608b1dccc3;p=inkscape.git make doubleclick not only switch to text but also position cursor --- diff --git a/src/select-context.cpp b/src/select-context.cpp index fd4e132e1..0e35c6546 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -430,7 +430,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) sp_canvas_end_forced_full_redraws(desktop->canvas); } else { // switch tool - tools_switch_by_item (desktop, clicked_item); + Geom::Point const button_pt(event->button.x, event->button.y); + Geom::Point const p(desktop->w2d(button_pt)); + tools_switch_by_item (desktop, clicked_item, p); } } else { sp_select_context_up_one_layer(desktop); diff --git a/src/tools-switch.cpp b/src/tools-switch.cpp index f10b86f64..9fbc966c6 100644 --- a/src/tools-switch.cpp +++ b/src/tools-switch.cpp @@ -234,7 +234,7 @@ tools_switch(SPDesktop *dt, int num) } } -void tools_switch_by_item(SPDesktop *dt, SPItem *item) +void tools_switch_by_item(SPDesktop *dt, SPItem *item, Geom::Point const p) { if (SP_IS_RECT(item)) { tools_switch(dt, TOOLS_SHAPES_RECT); @@ -255,6 +255,7 @@ void tools_switch_by_item(SPDesktop *dt, SPItem *item) } } else if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { tools_switch(dt, TOOLS_TEXT); + sp_text_context_place_cursor_at (SP_TEXT_CONTEXT(dt->event_context), SP_OBJECT(item), p); } else if (SP_IS_OFFSET(item)) { tools_switch(dt, TOOLS_NODES); } diff --git a/src/tools-switch.h b/src/tools-switch.h index 38b83b226..36dd8f80b 100644 --- a/src/tools-switch.h +++ b/src/tools-switch.h @@ -40,7 +40,7 @@ enum { int tools_isactive(SPDesktop *dt, unsigned num); int tools_active(SPDesktop *dt); void tools_switch(SPDesktop *dt, int num); -void tools_switch_by_item (SPDesktop *dt, SPItem *item); +void tools_switch_by_item (SPDesktop *dt, SPItem *item, Geom::Point const p); #endif /* !SEEN_TOOLS_SWITCH_H */