diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index 2b76233f5c5cdf3d88a1eb62ec01bfef760081d4..e3476deb3a00aec82ab547d3c56a08e73a504fd0 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
static void sp_box3d_context_dispose(GObject *object);
static void sp_box3d_context_setup(SPEventContext *ec);
+static void sp_box3d_context_finish(SPEventContext *ec);
static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEvent *event);
static gint sp_box3d_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event);
object_class->dispose = sp_box3d_context_dispose;
event_context_class->setup = sp_box3d_context_setup;
+ event_context_class->finish = sp_box3d_context_finish;
event_context_class->root_handler = sp_box3d_context_root_handler;
event_context_class->item_handler = sp_box3d_context_item_handler;
}
new (&box3d_context->sel_changed_connection) sigc::connection();
}
+static void sp_box3d_context_finish(SPEventContext *ec)
+{
+ Box3DContext *bc = SP_BOX3D_CONTEXT(ec);
+ SPDesktop *desktop = ec->desktop;
+
+ sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME);
+ sp_box3d_finish(bc);
+ bc->sel_changed_connection.disconnect();
+
+ if (((SPEventContextClass *) parent_class)->finish) {
+ ((SPEventContextClass *) parent_class)->finish(ec);
+ }
+}
+
+
static void sp_box3d_context_dispose(GObject *object)
{
Box3DContext *bc = SP_BOX3D_CONTEXT(object);
@@ -276,7 +293,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
event_context->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, event->button.state & GDK_CONTROL_MASK);
dragging = true;
- sp_canvas_set_snap_delay_active(desktop->canvas, true);
/* */
Geom::Point button_dt(desktop->w2d(button_w));
@@ -294,7 +310,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
/* Snap center */
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, true, bc->item);
- m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, button_dt);
+ m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, button_dt, Inkscape::SNAPSOURCE_HANDLE);
bc->center = from_2geom(button_dt);
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -326,7 +342,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, true, bc->item);
- m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, motion_dt);
+ m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, motion_dt, Inkscape::SNAPSOURCE_HANDLE);
bc->ctrl_dragged = event->motion.state & GDK_CONTROL_MASK;
@@ -360,7 +376,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
bc->drag_ptC_proj = cur_persp->tmat.preimage (from_2geom(motion_dt), bc->drag_ptB_proj[Proj::X], Proj::X);
}
Geom::Point pt2g = to_2geom(bc->drag_ptC);
- m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g);
+ m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE);
bc->drag_ptC = from_2geom(pt2g);
}
@@ -373,7 +389,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
event_context->xp = event_context->yp = 0;
if ( event->button.button == 1 && !event_context->space_panning) {
dragging = false;
- sp_canvas_set_snap_delay_active(desktop->canvas, false);
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the box
@@ -449,6 +465,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
ret = true;
break;
+ /* TODO: what is this???
case GDK_O:
if (MOD__CTRL && MOD__SHIFT) {
Box3D::create_canvas_point(persp3d_get_VP(inkscape_active_document()->current_persp3d, Proj::W).affine(),
@@ -456,6 +473,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
}
ret = true;
break;
+ */
case GDK_g:
case GDK_G:
@@ -506,7 +524,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
dragging = false;
- sp_canvas_set_snap_delay_active(desktop->canvas, false);
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the box
sp_box3d_finish(bc);
static void sp_box3d_finish(Box3DContext *bc)
{
bc->_message_context->clear();
- g_assert (SP_ACTIVE_DOCUMENT->current_persp3d);
+ bc->ctrl_dragged = false;
+ bc->extruded = false;
if ( bc->item != NULL ) {
SPDesktop * desktop = SP_EVENT_CONTEXT_DESKTOP(bc);
+ SPDocument *doc = sp_desktop_document(desktop);
+ if (!doc || !doc->current_persp3d)
+ return;
SPBox3D *box = SP_BOX3D(bc->item);
bc->item = NULL;
}
-
- bc->ctrl_dragged = false;
- bc->extruded = false;
}
void sp_box3d_context_update_lines(SPEventContext *ec) {