summaryrefslogtreecommitdiffstats
path: root/src/helper/stock-items.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
committerMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
commita168040d5a452544328a1e6ad35aaac351f94d44 (patch)
treefae1ba829f543a473da281bd5fa6e4deabbf6912 /src/helper/stock-items.cpp
parentRemoved function pointers from SPObject and subclasses. (diff)
parentDutch translation update (diff)
downloadinkscape-a168040d5a452544328a1e6ad35aaac351f94d44.tar.gz
inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.zip
merged from trunk
(bzr r11608.1.56)
Diffstat (limited to 'src/helper/stock-items.cpp')
-rw-r--r--src/helper/stock-items.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp
index e18d56199..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);
@@ -199,10 +199,11 @@ SPObject *get_stock_item(gchar const *urn)
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") &&
@@ -214,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") &&
@@ -226,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") &&
@@ -255,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;
}