summaryrefslogtreecommitdiffstats
path: root/src/draw-context.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-06-04 13:14:45 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-06-04 13:14:45 +0000
commitb87784976d14ec1fbde6dd3335f45f7fb1137cff (patch)
treeea70749ce8d8d440c46a40481e5961dd93af3e7c /src/draw-context.cpp
parentFactor out 'create and apply' code for LPEs so that it can be called from eve... (diff)
downloadinkscape-b87784976d14ec1fbde6dd3335f45f7fb1137cff.tar.gz
inkscape-b87784976d14ec1fbde6dd3335f45f7fb1137cff.zip
Groundwork to allow automatic application of an LPE to a newly drawn path
(bzr r5799)
Diffstat (limited to 'src/draw-context.cpp')
-rw-r--r--src/draw-context.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 9a2c1215c..0130f2378 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -115,6 +115,8 @@ sp_draw_context_init(SPDrawContext *dc)
dc->green_color = 0x00ff007f;
dc->red_curve_is_valid = false;
+ dc->waiting_LPE = Inkscape::LivePathEffect::INVALID_LPE;
+
new (&dc->sel_changed_connection) sigc::connection();
new (&dc->sel_modified_connection) sigc::connection();
}
@@ -241,6 +243,16 @@ sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event)
return ret;
}
+/*
+ * If we have an item and a waiting LPE, apply the effect to the item
+ */
+void
+spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item)
+{
+ if (item && dc->waiting_LPE != Inkscape::LivePathEffect::INVALID_LPE) {
+ Inkscape::LivePathEffect::Effect::createAndApply(dc->waiting_LPE, dc->desktop->doc(), item);
+ }
+}
/*
* Selection handlers
@@ -249,6 +261,8 @@ sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event)
static void
spdc_selection_changed(Inkscape::Selection *sel, SPDrawContext *dc)
{
+ spdc_check_for_and_apply_waiting_LPE(dc, sel->singleItem());
+
if (dc->attach) {
spdc_attach_selection(dc, sel);
}