index ed20f9b619e79b5cc090b074d41f61cff0015839..d37e9b02270ba0e21149dda51c2842161893f18e 100644 (file)
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
-#define __SP_GRADIENT_CONTEXT_C__
-
/*
* Gradient drawing and editing tool
*
* Authors:
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
+ * Abhishek Sharma
*
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 2005 Authors
#include "sp-namedview.h"
#include "rubberband.h"
+using Inkscape::DocumentUndo;
static void sp_gradient_context_class_init(SPGradientContextClass *klass);
if (SP_IS_GRADIENT (parent)) {
doc = SP_OBJECT_DOCUMENT (parent);
sp_vector_add_stop (SP_GRADIENT (parent), this_stop, next_stop, offset);
- sp_gradient_ensure_vector (SP_GRADIENT (parent));
+ SP_GRADIENT(parent)->ensureVector();
}
}
if (g_slist_length(these_stops) > 0 && doc) {
- sp_document_done (doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop"));
+ DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop"));
drag->updateDraggers();
// so that it does not automatically update draggers in idle loop, as this would deselect
drag->local_change = true;
}
if (g_slist_length(todel) > 0) {
- sp_document_done (doc, SP_VERB_CONTEXT_GRADIENT, _("Simplify gradient"));
+ DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Simplify gradient"));
drag->local_change = true;
drag->updateDraggers();
drag->selectByCoords(coords);
ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom());
- sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
- _("Add gradient stop"));
+ DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
+ _("Add gradient stop"));
ec->get_drag()->updateDraggers();
}
@@ -530,8 +530,8 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
sp_gradient_reset_to_userspace(priv, item);
}
- sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
- _("Create default gradient"));
+ DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
+ _("Create default gradient"));
}
ret = TRUE;
}
@@ -559,6 +559,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
rc->origin = from_2geom(button_dt);
}
@@ -599,7 +600,9 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
Geom::Point const motion_w(event->motion.x, event->motion.y);
Geom::Point const motion_dt = event_context->desktop->w2d(motion_w);
+
m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
bool over_line = false;
@@ -650,7 +653,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (!event_context->within_tolerance) {
// we've been dragging, either do nothing (grdrag handles that),
// or rubberband-select if we have rubberband
- Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get(desktop);
+ Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
if (r->is_started() && !event_context->within_tolerance) {
// this was a rubberband drag
if (r->getMode() == RUBBERBAND_MODE_RECT) {
@@ -812,8 +815,8 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
}
}
// we did an undoable action
- sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
- _("Invert gradient"));
+ DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
+ _("Invert gradient"));
ret = TRUE;
}
break;
-1, // ignore number (though it is always 1)
fill_or_stroke, 99999, 99999, etime);
}
- // We did an undoable action, but sp_document_done will be called by the knot when released
+ // We did an undoable action, but SPDocumentUndo::done will be called by the knot when released
// status text; we do not track coords because this branch is run once, not all the time
// during drag
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :