Code

make doubleclick not only switch to text but also position cursor
authorbuliabyak <buliabyak@users.sourceforge.net>
Mon, 16 Feb 2009 01:16:56 +0000 (01:16 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Mon, 16 Feb 2009 01:16:56 +0000 (01:16 +0000)
src/select-context.cpp
src/tools-switch.cpp
src/tools-switch.h

index fd4e132e1798cb054553f5e483a14b881916c90e..0e35c6546fedb1accef8f3cd36ffdfc1125efd8b 100644 (file)
@@ -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);
index f10b86f6404c1110a1af7d948043d14bff2457c3..9fbc966c621daa73173c1159e47ce8a4f5029927 100644 (file)
@@ -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);
     }
index 38b83b226329f6505293c6477db5a257aafc3058..36dd8f80bac69a3f135d3d80d108933b9d9cdc1e 100644 (file)
@@ -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 */