diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-09-14 06:27:21 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-09-14 06:27:21 +0000 |
| commit | 9d32539b23031c0e0d1a24c083fc609975a459e2 (patch) | |
| tree | e49d90232f01941bc49fbece3ff715790830649b /src/sp-item.cpp | |
| parent | add radius support to fillet-chamfer, bugfixes (diff) | |
| parent | Update to experimental r13543 (diff) | |
| download | inkscape-9d32539b23031c0e0d1a24c083fc609975a459e2.tar.gz inkscape-9d32539b23031c0e0d1a24c083fc609975a459e2.zip | |
Merge in ponyscape features by Theo and worked on my LiamW
(bzr r13341.1.204)
Diffstat (limited to 'src/sp-item.cpp')
| -rw-r--r-- | src/sp-item.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 63fc833b3..c3cbe531f 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -99,6 +99,8 @@ SPItem::SPItem() : SPObject() { sensitive = TRUE; bbox_valid = FALSE; + _highlightColor = NULL; + transform_center_x = 0; transform_center_y = 0; @@ -179,6 +181,26 @@ bool SPItem::isHidden(unsigned display_key) const { return true; } +bool SPItem::isHighlightSet() const { + return _highlightColor != NULL; +} + +guint32 SPItem::highlight_color() const { + if (_highlightColor) + { + return atoi(_highlightColor) | 0x000000ff; + } + else if (parent && parent != this && SP_IS_ITEM(parent)) + { + return SP_ITEM(parent)->highlight_color(); + } + else + { + static Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + return prefs->getInt("/tools/nodes/highlight_color", 0xff0000ff) | 0x000000ff; + } +} + void SPItem::setEvaluated(bool evaluated) { _is_evaluated = evaluated; _evaluated_status = StatusSet; @@ -421,6 +443,7 @@ void SPItem::build(SPDocument *document, Inkscape::XML::Node *repr) { object->readAttr( "inkscape:transform-center-y" ); object->readAttr( "inkscape:connector-avoid" ); object->readAttr( "inkscape:connection-points" ); + object->readAttr( "inkscape:highlight-color" ); SPObject::build(document, repr); } @@ -495,11 +518,23 @@ void SPItem::set(unsigned int key, gchar const* value) { break; } case SP_ATTR_SODIPODI_INSENSITIVE: + { item->sensitive = !value; for (SPItemView *v = item->display; v != NULL; v = v->next) { v->arenaitem->setSensitive(item->sensitive); } break; + } + case SP_ATTR_INKSCAPE_HIGHLIGHT_COLOR: + { + g_free(item->_highlightColor); + if (value) { + item->_highlightColor = g_strdup(value); + } else { + item->_highlightColor = NULL; + } + break; + } case SP_ATTR_CONNECTOR_AVOID: item->avoidRef->setAvoid(value); break; @@ -709,6 +744,11 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X g_free ((void *) uri); } } + if (item->_highlightColor){ + repr->setAttribute("inkscape:highlight-color", item->_highlightColor); + } else { + repr->setAttribute("inkscape:highlight-color", NULL); + } SPObject::write(xml_doc, repr, flags); |
