diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-parser.cpp | 19 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-parser.h | 6 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/svg-builder.cpp | 6 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/svg-builder.h | 4 | ||||
| -rw-r--r-- | src/file.cpp | 14 | ||||
| -rwxr-xr-x[-rw-r--r--] | src/selection-chemistry.cpp | 15 | ||||
| -rw-r--r-- | src/ui/clipboard.cpp | 18 |
7 files changed, 60 insertions, 22 deletions
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index 5fa21263a..a3a8ff25a 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -32,6 +32,7 @@ #include "pdf-parser.h" #include "util/units.h" +#include "glib/poppler-features.h" #include "goo/gmem.h" #include "goo/GooString.h" #include "GlobalParams.h" @@ -2577,7 +2578,11 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) } } +#if POPPLER_CHECK_VERSION(0,64,0) void PdfParser::doShowText(const GooString *s) { +#else +void PdfParser::doShowText(GooString *s) { +#endif GfxFont *font; int wMode; double riseX, riseY; @@ -2590,7 +2595,11 @@ void PdfParser::doShowText(const GooString *s) { Object charProc; Dict *resDict; Parser *oldParser; +#if POPPLER_CHECK_VERSION(0,64,0) + const char *p; +#else char *p; +#endif int len, n, uLen; font = state->getFont(); @@ -2626,7 +2635,7 @@ void PdfParser::doShowText(const GooString *s) { double lineX = state->getLineX(); double lineY = state->getLineY(); oldParser = parser; - p = g_strdup(s->getCString()); + p = s->getCString(); len = s->getLength(); while (len > 0) { n = font->getNextChar(p, len, &code, @@ -2681,7 +2690,7 @@ void PdfParser::doShowText(const GooString *s) { } else { state->textTransformDelta(0, state->getRise(), &riseX, &riseY); - p = g_strdup(s->getCString()); + p = s->getCString(); len = s->getLength(); while (len > 0) { n = font->getNextChar(p, len, &code, @@ -2727,7 +2736,11 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/) { Object obj1, obj2, obj3, refObj; - char *name = g_strdup(args[0].getName()); +#if POPPLER_CHECK_VERSION(0,64,0) + const char *name = args[0].getName(); +#else + char *name = args[0].getName(); +#endif #if defined(POPPLER_NEW_OBJECT_API) if ((obj1 = res->lookupXObject(name)).isNull()) { #else diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h index 755e6741b..b27a29cfb 100644 --- a/src/extension/internal/pdfinput/pdf-parser.h +++ b/src/extension/internal/pdfinput/pdf-parser.h @@ -25,6 +25,7 @@ namespace Inkscape { // TODO clean up and remove using: using Inkscape::Extension::Internal::SvgBuilder; +#include "glib/poppler-features.h" #include "goo/gtypes.h" #include "Object.h" @@ -287,7 +288,12 @@ private: void opMoveShowText(Object args[], int numArgs); void opMoveSetShowText(Object args[], int numArgs); void opShowSpaceText(Object args[], int numArgs); +#if POPPLER_CHECK_VERSION(0,64,0) void doShowText(const GooString *s); +#else + void doShowText(GooString *s); +#endif + // XObject operators void opXObject(Object args[], int numArgs); diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 50a7685b8..9d0df7c04 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -1020,9 +1020,9 @@ void SvgBuilder::updateFont(GfxState *state) { GfxFont *font = state->getFont(); // Store original name if (font->getName()) { - _font_specification = g_strdup(font->getName()->getCString()); + _font_specification = font->getName()->getCString(); } else { - _font_specification = (char*) "Arial"; + _font_specification = "Arial"; } // Prune the font name to get the correct font family name @@ -1030,7 +1030,7 @@ void SvgBuilder::updateFont(GfxState *state) { char *font_family = nullptr; char *font_style = nullptr; char *font_style_lowercase = nullptr; - char *plus_sign = strstr(_font_specification, "+"); + const char *plus_sign = strstr(_font_specification, "+"); if (plus_sign) { font_family = g_strdup(plus_sign + 1); _font_specification = plus_sign + 1; diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index 499724a4c..729cdc944 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -80,7 +80,7 @@ struct SvgGlyph { bool style_changed; // Set to true if style has to be reset SPCSSAttr *style; int render_mode; // Text render mode - char *font_specification; // Pointer to current font specification + const char *font_specification; // Pointer to current font specification }; /** @@ -202,7 +202,7 @@ private: SPCSSAttr *_font_style; // Current font style GfxFont *_current_font; - char *_font_specification; + const char *_font_specification; double _font_scaling; bool _need_font_update; Geom::Affine _text_matrix; diff --git a/src/file.cpp b/src/file.cpp index d32d104ac..48218e617 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1093,14 +1093,16 @@ void sp_import_document(SPDesktop *desktop, SPDocument *clipdoc, bool in_place) Inkscape::GC::release(obj_copy); pasted_objects.push_back(obj_copy); + + // if we are pasting a clone to an already existing object, its + // transform is wrong (see ui/clipboard.cpp) + if(obj_copy->attribute("transform-with-parent") && target_document->getObjectById(obj->attribute("xlink:href")+1) ){ + obj_copy->setAttribute("transform",obj_copy->attribute("transform-with-parent")); + } + if(obj_copy->attribute("transform-with-parent")) + obj_copy->setAttribute("transform-with-parent", nullptr); } - /* take that stuff into account: - * if( use && selection->includes(use->get_original()) ){//we are copying something whose parent is also copied (!) - * transform = ((SPItem*)(use->get_original()->parent))->i2doc_affine().inverse() * transform; - * } - * - */ std::vector<Inkscape::XML::Node*> pasted_objects_not; if(clipboard) for (Inkscape::XML::Node *obj = clipboard->firstChild() ; obj ; obj = obj->next()) { diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 366ccbe33..e9b9bb469 100644..100755 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -515,6 +515,7 @@ void ObjectSet::duplicate(bool suppressDone, bool duplicateLayer) SPUse *use = dynamic_cast<SPUse *>(old_clone); SPOffset *offset = dynamic_cast<SPOffset *>(old_clone); SPText *text = dynamic_cast<SPText *>(old_clone); + SPPath *path = dynamic_cast<SPPath *>(old_clone); if (use) { SPItem *orig = use->get_original(); if (!orig) // orphaned @@ -544,6 +545,20 @@ void ObjectSet::duplicate(bool suppressDone, bool duplicateLayer) doc->getObjectById(new_ids[i])->firstChild()->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]); } } + } else if (path) { + if (old_clone->getAttribute("inkscape:connection-start") != nullptr) { + const char *old_start = old_clone->getAttribute("inkscape:connection-start"); + const char *old_end = old_clone->getAttribute("inkscape:connection-end"); + SPObject *new_clone = doc->getObjectById(new_ids[i]); + for (guint j = 0; j < old_ids.size(); j++) { + if(old_start == Glib::ustring("#") + old_ids[j]) { + new_clone->getRepr()->setAttribute("inkscape:connection-start", Glib::ustring("#") + new_ids[j]); + } + if(old_end == Glib::ustring("#") + old_ids[j]) { + new_clone->getRepr()->setAttribute("inkscape:connection-end", Glib::ustring("#") + new_ids[j]); + } + } + } } } } diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 2f0cc2bbb..65a704278 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -760,15 +760,17 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) // write the complete accumulated transform passed to us // (we're dealing with unattached representations, so we write to their attributes // instead of using sp_item_set_transform) + SPUse *use=dynamic_cast<SPUse *>(item); - if( use && use->get_original() && use->get_original()->parent ){//we are copying something whose parent is also copied (!) - transform = ((SPItem*)(use->get_original()->parent))->i2doc_affine().inverse() * transform; - } - gchar *transform_str = sp_svg_transform_write(transform ); - - - obj_copy->setAttribute("transform", transform_str); - g_free(transform_str); + if( use && use->get_original() && use->get_original()->parent) { + if (selection->includes(use->get_original())){ //we are copying something whose parent is also copied (!) + obj_copy->setAttribute("transform", sp_svg_transform_write( ((SPItem*)(use->get_original()->parent))->i2doc_affine().inverse() * transform)); + } else { // original is not copied + obj_copy->setAttribute("transform-with-parent", sp_svg_transform_write(transform)); + obj_copy->setAttribute("transform", sp_svg_transform_write( ((SPItem*)(use->get_original()->parent))->i2doc_affine().inverse() * transform)); + } + } else + obj_copy->setAttribute("transform", sp_svg_transform_write(transform)); } } |
