diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-03-27 01:33:44 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-03-27 01:33:44 +0000 |
| commit | 5a4fb2325f60d292b47330f540b26a3279341c90 (patch) | |
| tree | d2aa7967be25450b83e625025366c618101ae49f /src/helper/stock-items.cpp | |
| parent | The Polar Arrange Tab of the Arrange Dialog now hides the parametric (diff) | |
| parent | Remove Snap menu item and improve grid menu item text (diff) | |
| download | inkscape-5a4fb2325f60d292b47330f540b26a3279341c90.tar.gz inkscape-5a4fb2325f60d292b47330f540b26a3279341c90.zip | |
Commit a merge to trunk, with probabal errors
(bzr r11073.1.36)
Diffstat (limited to 'src/helper/stock-items.cpp')
| -rw-r--r-- | src/helper/stock-items.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index 1de282ba2..a12fa377a 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -33,7 +33,7 @@ #include "inkscape.h" #include "io/sys.h" - +#include "stock-items.h" @@ -173,7 +173,7 @@ sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc) // if necessary it will import the object. Copes with name clashes through use of the inkscape:stockid property // This should be set to be the same as the id in the libary file. -SPObject *get_stock_item(gchar const *urn) +SPObject *get_stock_item(gchar const *urn, gboolean stock) { g_assert(urn != NULL); @@ -198,9 +198,12 @@ SPObject *get_stock_item(gchar const *urn) SPDesktop *desktop = inkscape_active_desktop(); SPDocument *doc = sp_desktop_document(desktop); SPDefs *defs = doc->getDefs(); - + if (!defs) { + g_free(base); + return NULL; + } SPObject *object = NULL; - if (!strcmp(base, "marker")) { + if (!strcmp(base, "marker") && !stock) { for ( SPObject *child = defs->firstChild(); child; child = child->getNext() ) { if (child->getRepr()->attribute("inkscape:stockid") && @@ -212,7 +215,7 @@ SPObject *get_stock_item(gchar const *urn) } } - else if (!strcmp(base,"pattern")) { + else if (!strcmp(base,"pattern") && !stock) { for ( SPObject *child = defs->firstChild() ; child; child = child->getNext() ) { if (child->getRepr()->attribute("inkscape:stockid") && @@ -224,7 +227,7 @@ SPObject *get_stock_item(gchar const *urn) } } - else if (!strcmp(base,"gradient")) { + else if (!strcmp(base,"gradient") && !stock) { for ( SPObject *child = defs->firstChild(); child; child = child->getNext() ) { if (child->getRepr()->attribute("inkscape:stockid") && @@ -253,6 +256,10 @@ SPObject *get_stock_item(gchar const *urn) g_free(base); g_free(name); + if (object) { + object->getRepr()->setAttribute("inkscape:isstock", "true"); + } + return object; } |
