summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/bitmap/imagemagick.cpp32
-rw-r--r--src/live_effects/effect.cpp3
-rw-r--r--src/live_effects/lpe-clone-original.cpp8
-rw-r--r--src/live_effects/parameter/item.cpp5
-rw-r--r--src/live_effects/parameter/text.cpp24
-rw-r--r--src/live_effects/parameter/text.h1
-rw-r--r--src/path-chemistry.cpp7
7 files changed, 57 insertions, 23 deletions
diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp
index cc5b3d1bc..352271e26 100644
--- a/src/extension/internal/bitmap/imagemagick.cpp
+++ b/src/extension/internal/bitmap/imagemagick.cpp
@@ -39,7 +39,7 @@ namespace Bitmap {
class ImageMagickDocCache: public Inkscape::Extension::Implementation::ImplementationDocumentCache {
friend class ImageMagick;
private:
- void readImage(char const *xlink, Magick::Image *image);
+ void readImage(char const *xlink, char const *id, Magick::Image *image);
protected:
Inkscape::XML::Node** _nodes;
@@ -85,11 +85,12 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) :
{
_nodes[_imageCount] = node;
char const *xlink = node->attribute("xlink:href");
+ char const *id = node->attribute("id");
_originals[_imageCount] = xlink;
_caches[_imageCount] = (char*)"";
_cacheLengths[_imageCount] = 0;
_images[_imageCount] = new Magick::Image();
- readImage(xlink, _images[_imageCount]);
+ readImage(xlink, id, _images[_imageCount]);
_imageItems[_imageCount] = item;
_imageCount++;
}
@@ -113,26 +114,33 @@ ImageMagickDocCache::~ImageMagickDocCache ( ) {
}
void
-ImageMagickDocCache::readImage(const char *xlink, Magick::Image *image)
+ImageMagickDocCache::readImage(const char *xlink, const char *id, Magick::Image *image)
{
// Find if the xlink:href is base64 data, i.e. if the image is embedded
- char *search = (char *) g_strndup(xlink, 30);
+ gchar *search = g_strndup(xlink, 30);
if (strstr(search, "base64") != (char*)NULL) {
// 7 = strlen("base64") + strlen(",")
const char* pureBase64 = strstr(xlink, "base64") + 7;
Magick::Blob blob;
blob.base64(pureBase64);
- image->read(blob);
- }
- else {
- const gchar *path = xlink;
- if (strncmp (xlink,"file:", 5) == 0) {
- path = g_filename_from_uri(xlink, NULL, NULL);
+ try {
+ image->read(blob);
+ } catch (Magick::Exception &error_) {
+ g_warning("ImageMagick could not read '%s'\nDetails: %s", id, error_.what());
+ }
+ } else {
+ gchar *path;
+ if (strncmp (xlink,"file:", 5) == 0) {
+ path = g_filename_from_uri(xlink, NULL, NULL);
+ } else {
+ path = g_strdup(xlink);
}
-
try {
image->read(path);
- } catch (...) {}
+ } catch (Magick::Exception &error_) {
+ g_warning("ImageMagick could not read '%s' from '%s'\nDetails: %s", id, path, error_.what());
+ }
+ g_free(path);
}
g_free(search);
}
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 703852881..2332ab8f2 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -874,7 +874,8 @@ Effect::defaultParamSet()
vbox->pack_start(*dynamic_cast<Gtk::Widget *> (expander), true, true, 2);
if (has_params) {
Gtk::Widget *vboxwidg = dynamic_cast<Gtk::Widget *>(vbox);
- vboxwidg->set_margin_bottom(15);
+ vboxwidg->set_margin_bottom(10);
+ vboxwidg->set_margin_top(5);
return vboxwidg;
} else {
return NULL;
diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp
index b035cc1d0..6e5ad66bf 100644
--- a/src/live_effects/lpe-clone-original.cpp
+++ b/src/live_effects/lpe-clone-original.cpp
@@ -181,7 +181,7 @@ LPECloneOriginal::cloneAttrbutes(SPObject *origin, SPObject *dest, const char *
g_strfreev (styleattarray);
Glib::ustring css_str;
sp_repr_css_write_string(css_dest,css_str);
- dest->getRepr()->setAttribute("style", css_str.c_str());
+ dest->getRepr()->setAttribute("style", g_strdup(css_str.c_str()));
}
void
@@ -189,9 +189,9 @@ LPECloneOriginal::doBeforeEffect (SPLPEItem const* lpeitem){
if (linkeditem.linksToItem()) {
Glib::ustring attr = "";
if (method != CLM_NONE) {
- attr.append("d,");
+ attr += Glib::ustring("d,");
}
- attr.append(Glib::ustring(attributes.param_getSVGValue()).append(","));
+ attr += Glib::ustring(attributes.param_getSVGValue()) + Glib::ustring(",");
if (attr.size() && !Glib::ustring(attributes.param_getSVGValue()).size()) {
attr.erase (attr.size()-1, 1);
}
@@ -199,7 +199,7 @@ LPECloneOriginal::doBeforeEffect (SPLPEItem const* lpeitem){
if (style_attr.size() && !Glib::ustring(style_attributes.param_getSVGValue()).size()) {
style_attr.erase (style_attr.size()-1, 1);
}
- style_attr.append(Glib::ustring(style_attributes.param_getSVGValue()).append(","));
+ style_attr += Glib::ustring(style_attributes.param_getSVGValue()) + Glib::ustring(",");
SPItem * origin = SP_ITEM(linkeditem.getObject());
SPItem * dest = SP_ITEM(sp_lpe_item);
diff --git a/src/live_effects/parameter/item.cpp b/src/live_effects/parameter/item.cpp
index 149fd6627..e075cab1a 100644
--- a/src/live_effects/parameter/item.cpp
+++ b/src/live_effects/parameter/item.cpp
@@ -101,7 +101,10 @@ ItemParam::param_readSVGValue(const gchar * strvalue)
gchar *
ItemParam::param_getSVGValue() const
{
- return g_strdup(href);
+ if (href) {
+ return g_strdup(href);
+ }
+ return g_strdup("");
}
gchar *
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 3f41bfeed..7e56b2c75 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -9,7 +9,7 @@
*/
#include "ui/widget/registered-widget.h"
-#include <glibmm/i18n.h>
+#include <gtkmm/alignment.h>
#include "live_effects/parameter/text.h"
#include "live_effects/effect.h"
@@ -18,9 +18,10 @@
#include "inkscape.h"
#include "verbs.h"
#include "display/canvas-text.h"
-
#include <2geom/sbasis-geometric.h>
+#include <glibmm/i18n.h>
+
namespace Inkscape {
namespace LivePathEffect {
@@ -124,6 +125,14 @@ TextParam::param_getDefaultSVGValue() const
return str;
}
+void
+TextParam::setTextParam(Inkscape::UI::Widget::RegisteredText *rsu)
+{
+ Glib::ustring str(rsu->getText());
+ param_setValue(str);
+ write_to_SVG();
+}
+
Gtk::Widget *
TextParam::param_newWidget()
{
@@ -131,9 +140,16 @@ TextParam::param_newWidget()
param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc()));
rsu->setText(value);
rsu->setProgrammatically = false;
-
rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change text parameter"));
- return dynamic_cast<Gtk::Widget *> (rsu);
+ Gtk::Box *text_container = Gtk::manage(new Gtk::Box());
+ Gtk::Button *set = Gtk::manage(new Gtk::Button(Glib::ustring("✔")));
+ set->signal_clicked()
+ .connect(sigc::bind<Inkscape::UI::Widget::RegisteredText *>(sigc::mem_fun(*this, &TextParam::setTextParam),rsu));
+ text_container->pack_start(*rsu, false, false, 2);
+ text_container->pack_start(*set, false, false, 2);
+ Gtk::Widget *return_widg = dynamic_cast<Gtk::Widget *> (text_container);
+ return_widg->set_halign(Gtk::ALIGN_END);
+ return return_widg;
}
void
diff --git a/src/live_effects/parameter/text.h b/src/live_effects/parameter/text.h
index 460ef8629..a9de26a52 100644
--- a/src/live_effects/parameter/text.h
+++ b/src/live_effects/parameter/text.h
@@ -42,6 +42,7 @@ public:
void param_setValue(Glib::ustring newvalue);
void param_hide_canvas_text();
+ void setTextParam(Inkscape::UI::Widget::RegisteredText *rsu);
virtual void param_set_default();
virtual void param_update_default(const gchar * default_value);
void setPos(Geom::Point pos);
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 043d47517..89cf6fb43 100644
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
@@ -366,7 +366,12 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>&
{
continue;
}
-
+ //TODO: decide if we want to unlink clones or not, for now keep previous functionality retaining clones as is
+ SPUse *use = dynamic_cast<SPUse *>(item);
+ if (use) {
+ continue;
+ }
+
SPPath *path = dynamic_cast<SPPath *>(item);
if (path && !path->_curve_before_lpe) {
// remove connector attributes