summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-10-17 20:03:14 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-10-17 20:03:14 +0000
commit4fc13b246c0c03c26c10c421c63c33331aa57d85 (patch)
tree82f8ceea42ace9c0512b6073935e4bd9c3d14f7a /src/sp-item.cpp
parentSmall warning cleanup (diff)
parentPort inkscape to librevenge framework for WPG, CDR and VSD imports (diff)
downloadinkscape-4fc13b246c0c03c26c10c421c63c33331aa57d85.tar.gz
inkscape-4fc13b246c0c03c26c10c421c63c33331aa57d85.zip
Update to trunk r13621
(bzr r13341.1.278)
Diffstat (limited to 'src/sp-item.cpp')
-rw-r--r--src/sp-item.cpp100
1 files changed, 100 insertions, 0 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index c5b4b1667..967756055 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -120,6 +120,9 @@ SPItem::SPItem() : SPObject() {
mask_ref = new SPMaskReference(this);
mask_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(mask_ref_changed), this));
+ style->signal_fill_ps_changed.connect(sigc::bind(sigc::ptr_fun(fill_ps_ref_changed), this));
+ style->signal_stroke_ps_changed.connect(sigc::bind(sigc::ptr_fun(stroke_ps_ref_changed), this));
+
avoidRef = new SPAvoidRef(this);
}
@@ -465,7 +468,15 @@ void SPItem::release() {
SPObject::release();
+ SPPaintServer *fill_ps = style->getFillPaintServer();
+ SPPaintServer *stroke_ps = style->getStrokePaintServer();
while (item->display) {
+ if (fill_ps) {
+ fill_ps->hide(item->display->arenaitem->key());
+ }
+ if (stroke_ps) {
+ stroke_ps->hide(item->display->arenaitem->key());
+ }
item->display = sp_item_view_list_remove(item->display, item->display);
}
@@ -623,6 +634,56 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item)
}
}
+void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) {
+ SPPaintServer *old_fill_ps = SP_PAINT_SERVER(old_ps);
+ if (old_fill_ps) {
+ for (SPItemView *v =item->display; v != NULL; v = v->next) {
+ old_fill_ps->hide(v->arenaitem->key());
+ }
+ }
+
+ SPPaintServer *new_fill_ps = SP_PAINT_SERVER(ps);
+ if (new_fill_ps) {
+ Geom::OptRect bbox = item->geometricBounds();
+ for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ if (!v->arenaitem->key()) {
+ v->arenaitem->setKey(SPItem::display_key_new(3));
+ }
+ Inkscape::DrawingPattern *pi = new_fill_ps->show(
+ v->arenaitem->drawing(), v->arenaitem->key(), bbox);
+ v->arenaitem->setFillPattern(pi);
+ if (pi) {
+ new_fill_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ }
+ }
+ }
+}
+
+void SPItem::stroke_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) {
+ SPPaintServer *old_stroke_ps = SP_PAINT_SERVER(old_ps);
+ if (old_stroke_ps) {
+ for (SPItemView *v =item->display; v != NULL; v = v->next) {
+ old_stroke_ps->hide(v->arenaitem->key());
+ }
+ }
+
+ SPPaintServer *new_stroke_ps = SP_PAINT_SERVER(ps);
+ if (new_stroke_ps) {
+ Geom::OptRect bbox = item->geometricBounds();
+ for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ if (!v->arenaitem->key()) {
+ v->arenaitem->setKey(SPItem::display_key_new(3));
+ }
+ Inkscape::DrawingPattern *pi = new_stroke_ps->show(
+ v->arenaitem->drawing(), v->arenaitem->key(), bbox);
+ v->arenaitem->setStrokePattern(pi);
+ if (pi) {
+ new_stroke_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ }
+ }
+ }
+}
+
void SPItem::update(SPCtx* /*ctx*/, guint flags) {
SPItem *item = this;
SPItem* object = item;
@@ -682,6 +743,10 @@ void SPItem::update(SPCtx* /*ctx*/, guint flags) {
item->avoidRef->handleSettingChange();
}
+void SPItem::modified(unsigned int /*flags*/)
+{
+}
+
Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
SPItem *item = this;
SPItem* object = item;
@@ -1130,6 +1195,33 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned
SP_MASK(mask)->sp_mask_set_bbox(mask_key, item_bbox);
mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
+
+ SPPaintServer *fill_ps = style->getFillPaintServer();
+ if (fill_ps) {
+ if (!display->arenaitem->key()) {
+ display->arenaitem->setKey(display_key_new(3));
+ }
+ int fill_key = display->arenaitem->key();
+
+ Inkscape::DrawingPattern *ap = fill_ps->show(drawing, fill_key, item_bbox);
+ ai->setFillPattern(ap);
+ if (ap) {
+ fill_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ }
+ }
+ SPPaintServer *stroke_ps = style->getStrokePaintServer();
+ if (stroke_ps) {
+ if (!display->arenaitem->key()) {
+ display->arenaitem->setKey(display_key_new(3));
+ }
+ int stroke_key = display->arenaitem->key();
+
+ Inkscape::DrawingPattern *ap = stroke_ps->show(drawing, stroke_key, item_bbox);
+ ai->setStrokePattern(ap);
+ if (ap) {
+ stroke_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ }
+ }
ai->setData(this);
ai->setItemBounds(geometricBounds());
}
@@ -1159,6 +1251,14 @@ void SPItem::invoke_hide(unsigned key)
mask_ref->getObject()->sp_mask_hide(v->arenaitem->key());
v->arenaitem->setMask(NULL);
}
+ SPPaintServer *fill_ps = style->getFillPaintServer();
+ if (fill_ps) {
+ fill_ps->hide(v->arenaitem->key());
+ }
+ SPPaintServer *stroke_ps = style->getStrokePaintServer();
+ if (stroke_ps) {
+ stroke_ps->hide(v->arenaitem->key());
+ }
if (!ref) {
display = v->next;
} else {