X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Frect-context.cpp;h=b03cdeead7c08dc5aee4bd0a3be52900a8587bfc;hb=411b8ce8881e841bd236bd6aab966cbbd166bd39;hp=1d62667956b84d8499a3db1a3ab6b7a19443ce4c;hpb=f951374eef04129c6a0d213e7ab4d9ed2095ca69;p=inkscape.git diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 1d6266795..b03cdeead 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -29,6 +29,7 @@ #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-rect.xpm" +#include "pixmaps/cursor-rect.pixbuf" #include "rect-context.h" #include "sp-metrics.h" #include @@ -93,6 +94,11 @@ static void sp_rect_context_init(SPRectContext *rect_context) SPEventContext *event_context = SP_EVENT_CONTEXT(rect_context); event_context->cursor_shape = cursor_rect_xpm; + event_context->cursor_pixbuf = gdk_pixbuf_new_from_inline( + -1, + cursor_rect_pixbuf, + FALSE, + NULL); event_context->hot_x = 4; event_context->hot_y = 4; event_context->xp = 0; @@ -181,7 +187,6 @@ void sp_rect_context_selection_changed(Inkscape::Selection *selection, gpointer ec->shape_repr = shape_repr; Inkscape::GC::anchor(shape_repr); sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec); - sp_repr_synthesize_events(shape_repr, &ec_shape_repr_events, ec); } } } @@ -194,7 +199,7 @@ static void sp_rect_context_setup(SPEventContext *ec) ((SPEventContextClass *) parent_class)->setup(ec); } - SPItem *item = SP_DT_SELECTION(ec->desktop)->singleItem(); + SPItem *item = sp_desktop_selection(ec->desktop)->singleItem(); if (item) { ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop); Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item); @@ -202,12 +207,11 @@ static void sp_rect_context_setup(SPEventContext *ec) ec->shape_repr = shape_repr; Inkscape::GC::anchor(shape_repr); sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec); - sp_repr_synthesize_events(shape_repr, &ec_shape_repr_events, ec); } } rc->sel_changed_connection.disconnect(); - rc->sel_changed_connection = SP_DT_SELECTION(ec->desktop)->connectChanged( + rc->sel_changed_connection = sp_desktop_selection(ec->desktop)->connectChanged( sigc::bind(sigc::ptr_fun(&sp_rect_context_selection_changed), (gpointer)rc) ); @@ -272,7 +276,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent static bool dragging; SPDesktop *desktop = event_context->desktop; - Inkscape::Selection *selection = SP_DT_SELECTION (desktop); + Inkscape::Selection *selection = sp_desktop_selection (desktop); SPRectContext *rc = SP_RECT_CONTEXT(event_context); @@ -299,7 +303,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent NR::Point const button_dt(desktop->w2d(button_w)); /* Snap center */ - SnapManager const m(desktop->namedview); + SnapManager const &m = desktop->namedview->snap_manager; rc->center = m.freeSnap(Inkscape::Snapper::SNAP_POINT | Inkscape::Snapper::BBOX_POINT, button_dt, rc->item).getPoint(); @@ -307,7 +311,6 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent ( GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK ), NULL, event->button.time); ret = TRUE; @@ -393,7 +396,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent break; case GDK_Escape: - SP_DT_SELECTION(desktop)->clear(); + sp_desktop_selection(desktop)->clear(); //TODO: make dragging escapable by Esc default: break; @@ -482,8 +485,9 @@ static void sp_rect_finish(SPRectContext *rc) SP_OBJECT(rc->item)->updateRepr(); - SP_DT_SELECTION(dt)->set(rc->item); - sp_document_done(SP_DT_DOCUMENT(dt)); + sp_desktop_selection(dt)->set(rc->item); + sp_document_done(sp_desktop_document(dt), SP_VERB_CONTEXT_RECT, + _("Create rectangle")); rc->item = NULL; }