diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index 1d62667956b84d8499a3db1a3ab6b7a19443ce4c..b03cdeead7c08dc5aee4bd0a3be52900a8587bfc 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
#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 <glibmm/i18n.h>
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;
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);
}
}
}
((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);
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;
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;
}