summaryrefslogtreecommitdiffstats
path: root/src/extension/internal
diff options
context:
space:
mode:
authorMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
committerMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
commite7248b2fa042f42a5c4dd14cd86ab6a5b4524059 (patch)
tree9097520c54e355ded9bd0b4d6618af4e8dacdd91 /src/extension/internal
parentupdated to latest trunk (diff)
parent[Bug #1695016] Xaml export misses some radialGradients. (diff)
downloadinkscape-e7248b2fa042f42a5c4dd14cd86ab6a5b4524059.tar.gz
inkscape-e7248b2fa042f42a5c4dd14cd86ab6a5b4524059.zip
updated to latest trunk
(bzr r14876.2.4)
Diffstat (limited to 'src/extension/internal')
-rw-r--r--src/extension/internal/Makefile_insert173
-rw-r--r--src/extension/internal/bitmap/imagemagick.cpp9
-rw-r--r--src/extension/internal/bluredge.cpp8
-rw-r--r--src/extension/internal/cairo-render-context.cpp41
-rw-r--r--src/extension/internal/cairo-renderer.cpp14
-rw-r--r--src/extension/internal/cdr-input.cpp70
-rw-r--r--src/extension/internal/emf-inout.cpp16
-rw-r--r--src/extension/internal/emf-print.cpp22
-rw-r--r--src/extension/internal/filter/color.h2
-rw-r--r--src/extension/internal/filter/filter.cpp3
-rw-r--r--src/extension/internal/filter/protrusions.h2
-rw-r--r--src/extension/internal/gdkpixbuf-input.cpp7
-rw-r--r--src/extension/internal/grid.cpp4
-rw-r--r--src/extension/internal/javafx-out.cpp8
-rw-r--r--src/extension/internal/metafile-print.cpp31
-rw-r--r--src/extension/internal/metafile-print.h1
-rw-r--r--src/extension/internal/odf.cpp5
-rw-r--r--src/extension/internal/pdfinput/pdf-input.cpp111
-rw-r--r--src/extension/internal/pdfinput/pdf-input.h16
-rw-r--r--src/extension/internal/pov-out.cpp4
-rw-r--r--src/extension/internal/svg.cpp26
-rw-r--r--src/extension/internal/vsd-input.cpp68
-rw-r--r--src/extension/internal/wmf-inout.cpp26
-rw-r--r--src/extension/internal/wmf-print.cpp25
-rw-r--r--src/extension/internal/wpg-input.cpp12
25 files changed, 333 insertions, 371 deletions
diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert
deleted file mode 100644
index 125776d41..000000000
--- a/src/extension/internal/Makefile_insert
+++ /dev/null
@@ -1,173 +0,0 @@
-## Makefile.am fragment sourced by src/Makefile.am.
-
-if WITH_LIBWPG
-ink_common_sources += \
- extension/internal/wpg-input.cpp \
- extension/internal/wpg-input.h
-endif
-
-if WITH_LIBVISIO
-ink_common_sources += \
- extension/internal/vsd-input.cpp \
- extension/internal/vsd-input.h
-endif
-
-if WITH_LIBCDR
-ink_common_sources += \
- extension/internal/cdr-input.cpp \
- extension/internal/cdr-input.h
-endif
-
-if USE_IMAGE_MAGICK
-ink_common_sources += \
- extension/internal/bitmap/imagemagick.cpp \
- extension/internal/bitmap/imagemagick.h \
- extension/internal/bitmap/adaptiveThreshold.cpp \
- extension/internal/bitmap/adaptiveThreshold.h \
- extension/internal/bitmap/addNoise.cpp \
- extension/internal/bitmap/addNoise.h \
- extension/internal/bitmap/blur.cpp \
- extension/internal/bitmap/blur.h \
- extension/internal/bitmap/channel.cpp \
- extension/internal/bitmap/channel.h \
- extension/internal/bitmap/charcoal.cpp \
- extension/internal/bitmap/charcoal.h \
- extension/internal/bitmap/colorize.cpp \
- extension/internal/bitmap/colorize.h \
- extension/internal/bitmap/contrast.cpp \
- extension/internal/bitmap/contrast.h \
- extension/internal/bitmap/crop.cpp \
- extension/internal/bitmap/crop.h \
- extension/internal/bitmap/cycleColormap.cpp \
- extension/internal/bitmap/cycleColormap.h \
- extension/internal/bitmap/despeckle.cpp \
- extension/internal/bitmap/despeckle.h \
- extension/internal/bitmap/edge.cpp \
- extension/internal/bitmap/edge.h \
- extension/internal/bitmap/emboss.cpp \
- extension/internal/bitmap/emboss.h \
- extension/internal/bitmap/enhance.cpp \
- extension/internal/bitmap/enhance.h \
- extension/internal/bitmap/equalize.cpp \
- extension/internal/bitmap/equalize.h \
- extension/internal/bitmap/gaussianBlur.cpp \
- extension/internal/bitmap/gaussianBlur.h \
- extension/internal/bitmap/implode.cpp \
- extension/internal/bitmap/implode.h \
- extension/internal/bitmap/level.cpp \
- extension/internal/bitmap/level.h \
- extension/internal/bitmap/levelChannel.cpp \
- extension/internal/bitmap/levelChannel.h \
- extension/internal/bitmap/medianFilter.cpp \
- extension/internal/bitmap/medianFilter.h \
- extension/internal/bitmap/modulate.cpp \
- extension/internal/bitmap/modulate.h \
- extension/internal/bitmap/negate.cpp \
- extension/internal/bitmap/negate.h \
- extension/internal/bitmap/normalize.cpp \
- extension/internal/bitmap/normalize.h \
- extension/internal/bitmap/oilPaint.cpp \
- extension/internal/bitmap/oilPaint.h \
- extension/internal/bitmap/opacity.cpp \
- extension/internal/bitmap/opacity.h \
- extension/internal/bitmap/raise.cpp \
- extension/internal/bitmap/raise.h \
- extension/internal/bitmap/reduceNoise.cpp \
- extension/internal/bitmap/reduceNoise.h \
- extension/internal/bitmap/sample.cpp \
- extension/internal/bitmap/sample.h \
- extension/internal/bitmap/shade.cpp \
- extension/internal/bitmap/shade.h \
- extension/internal/bitmap/sharpen.cpp \
- extension/internal/bitmap/sharpen.h \
- extension/internal/bitmap/solarize.cpp \
- extension/internal/bitmap/solarize.h \
- extension/internal/bitmap/spread.cpp \
- extension/internal/bitmap/spread.h \
- extension/internal/bitmap/swirl.cpp \
- extension/internal/bitmap/swirl.h \
- extension/internal/bitmap/threshold.cpp \
- extension/internal/bitmap/threshold.h \
- extension/internal/bitmap/unsharpmask.cpp \
- extension/internal/bitmap/unsharpmask.h \
- extension/internal/bitmap/wave.cpp \
- extension/internal/bitmap/wave.h
-endif
-
-ink_common_sources += \
- extension/internal/bluredge.h \
- extension/internal/bluredge.cpp \
- extension/internal/clear-n_.h \
- extension/internal/grid.h \
- extension/internal/grid.cpp \
- extension/internal/gimpgrad.h \
- extension/internal/gimpgrad.cpp \
- extension/internal/svg.h \
- extension/internal/svg.cpp \
- extension/internal/svgz.h \
- extension/internal/svgz.cpp \
- extension/internal/cairo-ps-out.h \
- extension/internal/cairo-ps-out.cpp \
- extension/internal/cairo-render-context.h \
- extension/internal/cairo-render-context.cpp \
- extension/internal/cairo-renderer.h \
- extension/internal/cairo-renderer.cpp \
- extension/internal/cairo-renderer-pdf-out.h \
- extension/internal/cairo-renderer-pdf-out.cpp \
- extension/internal/cairo-png-out.h \
- extension/internal/cairo-png-out.cpp \
- extension/internal/javafx-out.cpp \
- extension/internal/javafx-out.h \
- extension/internal/gdkpixbuf-input.h \
- extension/internal/gdkpixbuf-input.cpp \
- extension/internal/latex-text-renderer.h \
- extension/internal/latex-text-renderer.cpp \
- extension/internal/pdfinput/svg-builder.h \
- extension/internal/pdfinput/svg-builder.cpp \
- extension/internal/pdfinput/pdf-parser.h \
- extension/internal/pdfinput/pdf-parser.cpp \
- extension/internal/pdfinput/pdf-input.h \
- extension/internal/pdfinput/pdf-input.cpp \
- extension/internal/pov-out.cpp \
- extension/internal/pov-out.h \
- extension/internal/odf.cpp \
- extension/internal/odf.h \
- extension/internal/latex-pstricks.cpp \
- extension/internal/latex-pstricks.h \
- extension/internal/latex-pstricks-out.cpp \
- extension/internal/latex-pstricks-out.h \
- extension/internal/filter/bevels.h \
- extension/internal/filter/blurs.h \
- extension/internal/filter/bumps.h \
- extension/internal/filter/color.h \
- extension/internal/filter/distort.h \
- extension/internal/filter/filter.h \
- extension/internal/filter/image.h \
- extension/internal/filter/morphology.h \
- extension/internal/filter/overlays.h \
- extension/internal/filter/paint.h \
- extension/internal/filter/protrusions.h \
- extension/internal/filter/shadows.h \
- extension/internal/filter/textures.h \
- extension/internal/filter/transparency.h \
- extension/internal/filter/filter-all.cpp \
- extension/internal/filter/filter-file.cpp \
- extension/internal/filter/filter.cpp \
- extension/internal/filter/filter.h \
- extension/internal/text_reassemble.c \
- extension/internal/text_reassemble.h \
- extension/internal/emf-print.h \
- extension/internal/emf-print.cpp \
- extension/internal/emf-inout.h \
- extension/internal/emf-inout.cpp \
- extension/internal/metafile-inout.h \
- extension/internal/metafile-inout.cpp \
- extension/internal/metafile-print.h \
- extension/internal/metafile-print.cpp \
- extension/internal/wmf-print.h \
- extension/internal/wmf-print.cpp \
- extension/internal/wmf-inout.h \
- extension/internal/wmf-inout.cpp \
- extension/internal/image-resolution.h \
- extension/internal/image-resolution.cpp
-
diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp
index a235dcb0f..cc5b3d1bc 100644
--- a/src/extension/internal/bitmap/imagemagick.cpp
+++ b/src/extension/internal/bitmap/imagemagick.cpp
@@ -65,8 +65,8 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) :
_imageItems(NULL)
{
SPDesktop *desktop = (SPDesktop*)view;
- const std::vector<SPItem*> selectedItemList = desktop->selection->itemList();
- int selectCount = selectedItemList.size();
+ auto selectedItemList = desktop->selection->items();
+ int selectCount = (int) boost::distance(selectedItemList);
// Init the data-holders
_nodes = new Inkscape::XML::Node*[selectCount];
@@ -78,7 +78,7 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) :
_imageItems = new SPItem*[selectCount];
// Loop through selected items
- for (std::vector<SPItem*>::const_iterator i = selectedItemList.begin(); i != selectedItemList.end(); ++i) {
+ for (auto i = selectedItemList.begin(); i != selectedItemList.end(); ++i) {
SPItem *item = *i;
Inkscape::XML::Node *node = reinterpret_cast<Inkscape::XML::Node *>(item->getRepr());
if (!strcmp(node->name(), "image") || !strcmp(node->name(), "svg:image"))
@@ -213,6 +213,7 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi
dc->_nodes[i]->setAttribute("xlink:href", dc->_caches[i], true);
dc->_nodes[i]->setAttribute("sodipodi:absref", NULL, true);
+ delete blob;
}
catch (Magick::Exception &error_) {
printf("Caught exception: %s \n", error_.what());
@@ -235,7 +236,7 @@ ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::Vie
{
SPDocument * current_document = view->doc();
- std::vector<SPItem*> selected = ((SPDesktop *)view)->getSelection()->itemList();
+ auto selected = ((SPDesktop *) view)->getSelection()->items();
Inkscape::XML::Node * first_select = NULL;
if (!selected.empty()) {
first_select = (selected.front())->getRepr();
diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp
index 4a04e3c33..d1fe357da 100644
--- a/src/extension/internal/bluredge.cpp
+++ b/src/extension/internal/bluredge.cpp
@@ -62,7 +62,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View
double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px");
// TODO need to properly refcount the items, at least
- std::vector<SPItem*> items(selection->itemList());
+ std::vector<SPItem*> items(selection->items().begin(), selection->items().end());
selection->clear();
for(std::vector<SPItem*>::iterator item = items.begin();
@@ -90,7 +90,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View
new_group->appendChild(new_items[i]);
selection->add(new_items[i]);
- sp_selected_path_to_curves(selection, static_cast<SPDesktop *>(desktop));
+ selection->toCurves();
if (offset < 0.0) {
/* Doing an inset here folks */
@@ -131,8 +131,8 @@ BlurEdge::init (void)
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
"<name>" N_("Inset/Outset Halo") "</name>\n"
"<id>org.inkscape.effect.bluredge</id>\n"
- "<param name=\"blur-width\" _gui-text=\"" N_("Width:") "\" gui-description=\"" N_("Width in px of the halo") "\" scope=\"document\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
- "<param name=\"num-steps\" _gui-text=\"" N_("Number of steps:") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" scope=\"document\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
+ "<param name=\"blur-width\" _gui-text=\"" N_("Width:") "\" gui-description=\"" N_("Width in px of the halo") "\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
+ "<param name=\"num-steps\" _gui-text=\"" N_("Number of steps:") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
"<effect>\n"
"<object-type>all</object-type>\n"
"<effects-menu>\n"
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 5d8b0e076..21902db7d 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -42,7 +42,7 @@
#include "sp-hatch.h"
#include "sp-linear-gradient.h"
#include "sp-radial-gradient.h"
-#include "sp-mesh.h"
+#include "sp-mesh-gradient.h"
#include "sp-pattern.h"
#include "sp-mask.h"
#include "sp-clippath.h"
@@ -865,7 +865,7 @@ CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t
cairo_scale(_cr, Inkscape::Util::Quantity::convert(1, "px", "pt"), Inkscape::Util::Quantity::convert(1, "px", "pt"));
} else if (cairo_surface_get_content(_surface) != CAIRO_CONTENT_ALPHA) {
// set background color on non-alpha surfaces
- // TODO: bgcolor should be derived from SPDocument
+ // TODO: bgcolor should be derived from SPDocument (see IconImpl)
cairo_set_source_rgb(_cr, 1.0, 1.0, 1.0);
cairo_rectangle(_cr, 0, 0, _width, _height);
cairo_fill(_cr);
@@ -986,13 +986,12 @@ void CairoRenderContext::popState(void)
static bool pattern_hasItemChildren(SPPattern *pat)
{
- bool hasItems = false;
- for ( SPObject *child = pat->firstChild() ; child && !hasItems; child = child->getNext() ) {
- if (SP_IS_ITEM (child)) {
- hasItems = true;
+ for (auto& child: pat->children) {
+ if (SP_IS_ITEM (&child)) {
+ return true;
}
}
- return hasItems;
+ return false;
}
cairo_pattern_t*
@@ -1087,10 +1086,10 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
// show items and render them
for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children
- for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) {
- if (SP_IS_ITEM(child)) {
- SP_ITEM(child)->invoke_show(drawing, dkey, SP_ITEM_REFERENCE_FLAGS);
- _renderer->renderItem(pattern_ctx, SP_ITEM(child));
+ for (auto& child: pat_i->children) {
+ if (SP_IS_ITEM(&child)) {
+ SP_ITEM(&child)->invoke_show(drawing, dkey, SP_ITEM_REFERENCE_FLAGS);
+ _renderer->renderItem(pattern_ctx, SP_ITEM(&child));
}
}
break; // do not go further up the chain if children are found
@@ -1116,9 +1115,9 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
// hide all items
for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children
- for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) {
- if (SP_IS_ITEM(child)) {
- SP_ITEM(child)->invoke_hide(dkey);
+ for (auto& child: pat_i->children) {
+ if (SP_IS_ITEM(&child)) {
+ SP_ITEM(&child)->invoke_hide(dkey);
}
}
break; // do not go further up the chain if children are found
@@ -1258,8 +1257,8 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
sp_color_get_rgb_floatv(&rg->vector.stops[i].color, rgb);
cairo_pattern_add_color_stop_rgba(pattern, rg->vector.stops[i].offset, rgb[0], rgb[1], rgb[2], rg->vector.stops[i].opacity * alpha);
}
- } else if (SP_IS_MESH (paintserver)) {
- SPMesh *mg = SP_MESH(paintserver);
+ } else if (SP_IS_MESHGRADIENT (paintserver)) {
+ SPMeshGradient *mg = SP_MESHGRADIENT(paintserver);
pattern = mg->pattern_new(_cr, pbox, 1.0);
} else if (SP_IS_PATTERN (paintserver)) {
@@ -1581,13 +1580,13 @@ bool CairoRenderContext::renderImage(Inkscape::Pixbuf *pb,
// http://www.w3.org/TR/css4-images/#the-image-rendering
// style.h/style.cpp
switch (style->image_rendering.computed) {
- case SP_CSS_COLOR_RENDERING_AUTO:
- // Do nothing
- break;
- case SP_CSS_COLOR_RENDERING_OPTIMIZEQUALITY:
+ case SP_CSS_IMAGE_RENDERING_AUTO:
+ case SP_CSS_IMAGE_RENDERING_OPTIMIZEQUALITY:
+ case SP_CSS_IMAGE_RENDERING_CRISPEDGES:
cairo_pattern_set_filter(cairo_get_source(_cr), CAIRO_FILTER_BEST );
break;
- case SP_CSS_COLOR_RENDERING_OPTIMIZESPEED:
+ case SP_CSS_IMAGE_RENDERING_OPTIMIZESPEED:
+ case SP_CSS_IMAGE_RENDERING_PIXELATED:
default:
cairo_pattern_set_filter(cairo_get_source(_cr), CAIRO_FILTER_NEAREST );
break;
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index 5dc20ab06..a2b8fb22f 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -541,8 +541,7 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx)
return;
}
- SPStyle* style = item->style;
- if((ctx->getFilterToBitmap() == TRUE) && (style->filter.set != 0)) {
+ if(ctx->getFilterToBitmap() && (item->style->filter.set != 0)) {
return sp_asbitmap_render(item, ctx);
}
@@ -599,8 +598,7 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx)
void
CairoRenderer::setStateForItem(CairoRenderContext *ctx, SPItem const *item)
{
- SPStyle const *style = item->style;
- ctx->setStateForStyle(style);
+ ctx->setStateForStyle(item->style);
CairoRenderState *state = ctx->getCurrentState();
state->clip_path = item->clip_ref->getObject();
@@ -741,8 +739,8 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp)
TRACE(("BEGIN clip\n"));
SPObject const *co = cp;
- for ( SPObject const *child = co->firstChild() ; child; child = child->getNext() ) {
- SPItem const *item = dynamic_cast<SPItem const *>(child);
+ for (auto& child: co->children) {
+ SPItem const *item = dynamic_cast<SPItem const *>(&child);
if (item) {
// combine transform of the item in clippath and the item using clippath:
@@ -800,8 +798,8 @@ CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask)
TRACE(("BEGIN mask\n"));
SPObject const *co = mask;
- for ( SPObject const *child = co->firstChild() ; child; child = child->getNext() ) {
- SPItem const *item = dynamic_cast<SPItem const *>(child);
+ for (auto& child: co->children) {
+ SPItem const *item = dynamic_cast<SPItem const *>(&child);
if (item) {
// TODO fix const correctness:
renderItem(ctx, const_cast<SPItem*>(item));
diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp
index a26af2078..b94408b36 100644
--- a/src/extension/internal/cdr-input.cpp
+++ b/src/extension/internal/cdr-input.cpp
@@ -41,6 +41,7 @@
#endif
#include <gtkmm/alignment.h>
+#include <gtkmm/grid.h>
#include <gtkmm/spinbutton.h>
#include "extension/system.h"
@@ -83,6 +84,8 @@ private:
class Gtk::Widget * _previewArea;
class Gtk::Button * cancelbutton;
class Gtk::Button * okbutton;
+
+ class Gtk::HBox * _page_selector_box;
class Gtk::Label * _labelSelect;
class Gtk::Label * _labelTotalPages;
class Gtk::SpinButton * _pageNumberSpin;
@@ -111,48 +114,41 @@ CdrImportDialog::CdrImportDialog(const std::vector<RVNGString> &vec)
_previewArea = Gtk::manage(new class Gtk::VBox());
vbox1 = Gtk::manage(new class Gtk::VBox());
vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0);
-#if WITH_GTKMM_3_0
this->get_content_area()->pack_start(*vbox1);
-#else
- this->get_vbox()->pack_start(*vbox1);
-#endif
// CONTROLS
+ _page_selector_box = Gtk::manage(new Gtk::HBox());
- // Buttons
- cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel")));
- okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok")));
-
- // Labels
+ // "Select page:" label
_labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:")));
_labelTotalPages = Gtk::manage(new class Gtk::Label());
_labelSelect->set_line_wrap(false);
_labelSelect->set_use_markup(false);
_labelSelect->set_selectable(false);
+ _page_selector_box->pack_start(*_labelSelect, Gtk::PACK_SHRINK);
+
+ // Adjustment + spinner
+ auto pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0);
+ _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(pageNumberSpin_adj, 1, 0));
+ _pageNumberSpin->set_can_focus();
+ _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS);
+ _pageNumberSpin->set_numeric(true);
+ _pageNumberSpin->set_wrap(false);
+ _page_selector_box->pack_start(*_pageNumberSpin, Gtk::PACK_SHRINK);
+
_labelTotalPages->set_line_wrap(false);
_labelTotalPages->set_use_markup(false);
_labelTotalPages->set_selectable(false);
gchar *label_text = g_strdup_printf(_("out of %i"), num_pages);
_labelTotalPages->set_label(label_text);
g_free(label_text);
+ _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK);
- // Adjustment + spinner
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0);
- _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(_pageNumberSpin_adj, 1, 0));
-#else
- Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, _vec.size(), 1, 10, 0));
- _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(*_pageNumberSpin_adj, 1, 0));
-#endif
- _pageNumberSpin->set_can_focus();
- _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS);
- _pageNumberSpin->set_numeric(true);
- _pageNumberSpin->set_wrap(false);
+ vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK);
- this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END);
- this->get_action_area()->add(*_labelSelect);
- this->add_action_widget(*_pageNumberSpin, Gtk::RESPONSE_ACCEPT);
- this->get_action_area()->add(*_labelTotalPages);
+ // Buttons
+ cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true));
+ okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true));
this->add_action_widget(*cancelbutton, Gtk::RESPONSE_CANCEL);
this->add_action_widget(*okbutton, Gtk::RESPONSE_OK);
@@ -214,6 +210,19 @@ void CdrImportDialog::_setPreviewPage()
}
SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0);
+ if(!doc) {
+ g_warning("CDR import: Could not create preview for page %d", _current_page);
+ gchar const *no_preview_template =
+ "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>"
+ " <path style='fill:none;stroke:#ff0000;stroke-width:2px;' d='M 82,10 18,74 m 0,-64 64,64' />"
+ " <rect style='fill:none;stroke:#000000;stroke-width:1.5px;' width='64' height='64' x='18' y='10' />"
+ " <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>"
+ "</svg>";
+ gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview"));
+ doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0);
+ g_free(no_preview);
+ }
+
Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc));
std::swap(_previewArea, tmpPreviewArea);
delete tmpPreviewArea;
@@ -223,7 +232,16 @@ void CdrImportDialog::_setPreviewPage()
SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
{
- RVNGFileStream input(uri);
+ #ifdef WIN32
+ // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
+ // therefore attempt to convert uri to the system codepage
+ // even if this is not possible the alternate short (8.3) file name will be used if available
+ gchar * converted_uri = g_win32_locale_filename_from_utf8(uri);
+ RVNGFileStream input(converted_uri);
+ g_free(converted_uri);
+ #else
+ RVNGFileStream input(uri);
+ #endif
if (!libcdr::CDRDocument::isSupported(&input)) {
return NULL;
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp
index 12751c5ec..92deb2e19 100644
--- a/src/extension/internal/emf-inout.cpp
+++ b/src/extension/internal/emf-inout.cpp
@@ -165,8 +165,16 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena
ext->set_param_bool("FixImageRot",new_FixImageRot);
ext->set_param_bool("textToPath", new_val);
+ // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale)
+ char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
+
print_document_to_file(doc, filename);
+ // restore decimal separator used in scanf/printf functions to initial value
+ setlocale(LC_NUMERIC, oldlocale);
+ g_free(oldlocale);
+
return;
}
@@ -3524,6 +3532,10 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
return NULL;
}
+ // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale)
+ char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
+
EMF_CALLBACK_DATA d;
d.n_obj = 0; //these might not be set otherwise if the input file is corrupt
@@ -3588,6 +3600,10 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
// in earlier versions no viewbox was generated and a call to setViewBoxIfMissing() was needed here.
+ // restore decimal separator used in scanf/printf functions to initial value
+ setlocale(LC_NUMERIC, oldlocale);
+ g_free(oldlocale);
+
return doc;
}
diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp
index 9f3b5475f..147324b4f 100644
--- a/src/extension/internal/emf-print.cpp
+++ b/src/extension/internal/emf-print.cpp
@@ -205,7 +205,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc)
} else {
p = ansi_uri;
}
- snprintf(buff, sizeof(buff) - 1, "Inkscape %s (%s)\1%s\1", Inkscape::version_string, __DATE__, p);
+ snprintf(buff, sizeof(buff) - 1, "Inkscape %s \1%s\1", Inkscape::version_string, p);
uint16_t *Description = U_Utf8ToUtf16le(buff, 0, NULL);
int cbDesc = 2 + wchar16len(Description); // also count the final terminator
(void) U_Utf16leEdit(Description, '\1', '\0'); // swap the temporary \1 characters for nulls
@@ -251,11 +251,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc)
g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1");
}
- char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL));
- setlocale(LC_NUMERIC, "C");
snprintf(buff, sizeof(buff) - 1, "Drawing=%.1fx%.1fpx, %.1fx%.1fmm", _width, _height, Inkscape::Util::Quantity::convert(dwInchesX, "in", "mm"), Inkscape::Util::Quantity::convert(dwInchesY, "in", "mm"));
- setlocale(LC_NUMERIC, oldlocale);
- g_free(oldlocale);
rec = textcomment_set(buff);
if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) {
g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1");
@@ -1042,8 +1038,12 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){
/* find the clipping path */
Geom::PathVector combined_pathvector;
Geom::Affine tfc; // clipping transform, generally not the same as item transform
- for(item = SP_ITEM(scp->firstChild()); item; item=SP_ITEM(item->getNext())){
- if (SP_IS_GROUP(item)) { // not implemented
+ for (auto& child: scp->children) {
+ item = SP_ITEM(&child);
+ if (!item) {
+ break;
+ }
+ if (SP_IS_GROUP(item)) { // not implemented
// return sp_group_render(item);
combined_pathvector = merge_PathVector_with_group(combined_pathvector, item, tfc);
} else if (SP_IS_SHAPE(item)) {
@@ -1060,7 +1060,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){
g_error("Fatal programming error in PrintEmf::image at U_EMRSAVEDC_set");
}
(void) draw_pathv_to_EMF(combined_pathvector, tf);
- rec = U_EMRSELECTCLIPPATH_set(U_RGN_OR);
+ rec = U_EMRSELECTCLIPPATH_set(U_RGN_COPY);
if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) {
g_error("Fatal programming error in PrintEmf::do_clip_if_present at U_EMRSELECTCLIPPATH_set");
}
@@ -1081,7 +1081,11 @@ Geom::PathVector PrintEmf::merge_PathVector_with_group(Geom::PathVector const &c
new_combined_pathvector = combined_pathvector;
SPGroup *group = SP_GROUP(item);
Geom::Affine tfc = item->transform * transform;
- for(SPItem *item = SP_ITEM(group->firstChild()); item; item=SP_ITEM(item->getNext())){
+ for (auto& child: group->children) {
+ item = SP_ITEM(&child);
+ if (!item) {
+ break;
+ }
if (SP_IS_GROUP(item)) {
new_combined_pathvector = merge_PathVector_with_group(new_combined_pathvector, item, tfc); // could be endlessly recursive on a badly formed SVG
} else if (SP_IS_SHAPE(item)) {
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index a6b777d20..6324dafa9 100644
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -1480,7 +1480,7 @@ public:
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Quadritone fantasy") "</name>\n"
+ "<name>" N_("Quadritone Fantasy") "</name>\n"
"<id>org.inkscape.effect.filter.Quadritone</id>\n"
"<param name=\"dist\" _gui-text=\"" N_("Hue distribution (°)") "\" type=\"int\" appearance=\"full\" min=\"0\" max=\"360\">280</param>\n"
"<param name=\"colors\" _gui-text=\"" N_("Colors") "\" type=\"int\" appearance=\"full\" min=\"0\" max=\"360\">100</param>\n"
diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp
index 25e89bbf3..0408d516e 100644
--- a/src/extension/internal/filter/filter.cpp
+++ b/src/extension/internal/filter/filter.cpp
@@ -125,7 +125,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie
Inkscape::Selection * selection = ((SPDesktop *)document)->selection;
// TODO need to properly refcount the items, at least
- std::vector<SPItem*> items(selection->itemList());
+ std::vector<SPItem*> items(selection->items().begin(), selection->items().end());
Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc();
Inkscape::XML::Node * defsrepr = document->doc()->getDefs()->getRepr();
@@ -143,6 +143,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie
Inkscape::XML::Node * newfilterroot = xmldoc->createElement("svg:filter");
merge_filters(newfilterroot, filterdoc->root(), xmldoc);
defsrepr->appendChild(newfilterroot);
+ document->doc()->priv->resources_changed_signals[g_quark_from_string("filter")].emit();
Glib::ustring url = "url(#"; url += newfilterroot->attribute("id"); url += ")";
diff --git a/src/extension/internal/filter/protrusions.h b/src/extension/internal/filter/protrusions.h
index ad75d8896..d6fd315db 100644
--- a/src/extension/internal/filter/protrusions.h
+++ b/src/extension/internal/filter/protrusions.h
@@ -45,7 +45,7 @@ public:
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Snow crest") "</name>\n"
+ "<name>" N_("Snow Crest") "</name>\n"
"<id>org.inkscape.effect.filter.snow</id>\n"
"<param name=\"drift\" _gui-text=\"" N_("Drift Size") "\" type=\"float\" appearance=\"full\" min=\"0.0\" max=\"20.0\">3.5</param>\n"
"<effect>\n"
diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp
index b30c67a4d..e0dc90981 100644
--- a/src/extension/internal/gdkpixbuf-input.cpp
+++ b/src/extension/internal/gdkpixbuf-input.cpp
@@ -134,8 +134,13 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
}
// Add it to the current layer
- doc->getRoot()->appendChildRepr(image_node);
+ Inkscape::XML::Node *layer_node = xml_doc->createElement("svg:g");
+ layer_node->setAttribute("inkscape:groupmode", "layer");
+ layer_node->setAttribute("inkscape:label", "Image");
+ doc->getRoot()->appendChildRepr(layer_node);
+ layer_node->appendChild(image_node);
Inkscape::GC::release(image_node);
+ Inkscape::GC::release(layer_node);
fit_canvas_to_drawing(doc);
// Set viewBox if it doesn't exist
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp
index c766bd828..9e730f5e5 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -180,10 +180,10 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View
{
SPDocument * current_document = view->doc();
- std::vector<SPItem*> selected = ((SPDesktop *)view)->getSelection()->itemList();
+ auto selected = ((SPDesktop *) view)->getSelection()->items();
Inkscape::XML::Node * first_select = NULL;
if (!selected.empty()) {
- first_select = selected[0]->getRepr();
+ first_select = selected.front()->getRepr();
}
return module->autogui(current_document, first_select, changeSignal);
diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp
index 386bde1d6..d7ad7e6f7 100644
--- a/src/extension/internal/javafx-out.cpp
+++ b/src/extension/internal/javafx-out.cpp
@@ -732,9 +732,9 @@ bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj)
/**
* Descend into children
*/
- for (SPObject *child = obj->firstChild() ; child ; child = child->next)
+ for (auto &child: obj->children)
{
- if (!doTreeRecursive(doc, child)) {
+ if (!doTreeRecursive(doc, &child)) {
return false;
}
}
@@ -804,9 +804,9 @@ bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj)
/**
* Descend into children
*/
- for (SPObject *child = obj->firstChild() ; child ; child = child->next)
+ for (auto &child: obj->children)
{
- if (!doBody(doc, child)) {
+ if (!doBody(doc, &child)) {
return false;
}
}
diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp
index 47ba5971c..68a425d85 100644
--- a/src/extension/internal/metafile-print.cpp
+++ b/src/extension/internal/metafile-print.cpp
@@ -293,20 +293,22 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf
}
// still looking? Look at this pattern's children, if there are any
- SPObject *child = pat_i->firstChild();
- while (child && !(*epixbuf) && (*hatchType == -1)) {
- brush_classify(child, depth, epixbuf, hatchType, hatchColor, bkColor);
- child = child->getNext();
+ for (auto& child: pat_i->children) {
+ if (*epixbuf || *hatchType != -1) {
+ break;
+ }
+ brush_classify(&child, depth, epixbuf, hatchType, hatchColor, bkColor);
}
}
} else if (SP_IS_IMAGE(parent)) {
*epixbuf = ((SPImage *)parent)->pixbuf;
return;
} else { // some inkscape rearrangements pass through nodes between pattern and image which are not classified as either.
- SPObject *child = parent->firstChild();
- while (child && !(*epixbuf) && (*hatchType == -1)) {
- brush_classify(child, depth, epixbuf, hatchType, hatchColor, bkColor);
- child = child->getNext();
+ for (auto& child: parent->children) {
+ if (*epixbuf || *hatchType != -1) {
+ break;
+ }
+ brush_classify(&child, depth, epixbuf, hatchType, hatchColor, bkColor);
}
}
}
@@ -388,7 +390,8 @@ Geom::PathVector PrintMetafile::center_ellipse_as_SVG_PathV(Geom::Point ctr, dou
y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI);
char text[256];
- sprintf(text, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
+ snprintf(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z",
+ x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
Geom::PathVector outres = Geom::parse_svg_path(text);
return outres;
}
@@ -416,9 +419,9 @@ Geom::PathVector PrintMetafile::center_elliptical_ring_as_SVG_PathV(Geom::Point
y22 = ctr[Y] + sin(F) * rx2 * cos(M_PI) + cos(F) * ry2 * sin(M_PI);
char text[512];
- sprintf(text, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z",
- x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11,
- x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21);
+ snprintf(text, 512, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z",
+ x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11,
+ x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21);
Geom::PathVector outres = Geom::parse_svg_path(text);
return outres;
@@ -438,8 +441,8 @@ Geom::PathVector PrintMetafile::center_elliptical_hole_as_SVG_PathV(Geom::Point
y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI);
char text[256];
- sprintf(text, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z",
- x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
+ snprintf(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z",
+ x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
Geom::PathVector outres = Geom::parse_svg_path(text);
return outres;
}
diff --git a/src/extension/internal/metafile-print.h b/src/extension/internal/metafile-print.h
index d184b72b7..9903cbb98 100644
--- a/src/extension/internal/metafile-print.h
+++ b/src/extension/internal/metafile-print.h
@@ -101,6 +101,7 @@ protected:
static void swapRBinRGBA(char *px, int pixels);
int hold_gradient(void *gr, int mode);
+ static int snprintf_dots(char * s, size_t n, const char * format, ...);
static Geom::PathVector center_ellipse_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F);
static Geom::PathVector center_elliptical_ring_as_SVG_PathV(Geom::Point ctr, double rx1, double ry1, double rx2, double ry2, double F);
static Geom::PathVector center_elliptical_hole_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F);
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 6904eb2fd..f885ef5e5 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -873,11 +873,8 @@ int SingularValueDecomposition::rank()
-#define pi 3.14159
//#define pxToCm 0.0275
#define pxToCm 0.03
-#define piToRad 0.0174532925
-#define docHeightCm 22.86
//########################################################################
@@ -1565,7 +1562,7 @@ bool OdfOutput::processGradient(SPItem *item,
output += buf;
//TODO: apply maths, to define begin of gradient, taking gradient begin and end, as well as object boundary into account
double angle = (gi.y2-gi.y1);
- angle = (angle != 0.) ? (atan((gi.x2-gi.x1)/(gi.y2-gi.y1))* 180. / pi) : 90;
+ angle = (angle != 0.) ? (atan((gi.x2-gi.x1)/(gi.y2-gi.y1))* 180. / M_PI) : 90;
angle = (angle < 0)?(180+angle):angle;
angle = angle * 10; //why do we need this: precision?????????????
output += Glib::ustring::compose(" draw:start-intensity=\"%1\" draw:end-intensity=\"%2\" draw:angle=\"%3\"/>\n",
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index c1940b16a..2ee713085 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -39,10 +39,8 @@
#include <gtkmm/radiobutton.h>
#include <gtkmm/scale.h>
-#if WITH_GTKMM_3_0
#include <glibmm/convert.h>
#include <glibmm/miscutils.h>
-#endif
#include "extension/system.h"
#include "extension/input.h"
@@ -87,19 +85,13 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
_poppler_doc = NULL;
#endif // HAVE_POPPLER_CAIRO
_pdf_doc = doc;
- cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel")));
- okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok")));
+ cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true));
+ okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true));
_labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:")));
// Page number
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0);
+ auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0);
_pageNumberSpin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(_pageNumberSpin_adj, 1, 1));
-#else
- Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(
- new class Gtk::Adjustment(1, 1, _pdf_doc->getNumPages(), 1, 10, 0));
- _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1));
-#endif
_labelTotalPages = Gtk::manage(new class Gtk::Label());
hbox2 = Gtk::manage(new class Gtk::HBox(false, 0));
// Disable the page selector when there's only one page
@@ -137,13 +129,8 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
_labelViaInternal = Gtk::manage(new class Gtk::Label(_("Import via internal (Poppler derived) library. Text is stored as text but white space is missing. Meshes are converted to tiles, the number depends on the precision set below.")));
#endif
-#if WITH_GTKMM_3_0
_fallbackPrecisionSlider_adj = Gtk::Adjustment::create(2, 1, 256, 1, 10, 10);
_fallbackPrecisionSlider = Gtk::manage(new class Gtk::Scale(_fallbackPrecisionSlider_adj));
-#else
- _fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10));
- _fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj));
-#endif
_fallbackPrecisionSlider->set_value(2.0);
_labelPrecisionComment = Gtk::manage(new class Gtk::Label(_("rough")));
hbox6 = Gtk::manage(new class Gtk::HBox(false, 4));
@@ -170,9 +157,50 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
okbutton->set_can_focus();
okbutton->set_can_default();
okbutton->set_relief(Gtk::RELIEF_NORMAL);
- this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END);
+
+#if GTK_CHECK_VERSION(3,16,0)
+ _labelSelect->set_xalign(0.5);
+ _labelSelect->set_yalign(0.5);
+ _labelTotalPages->set_xalign(0.5);
+ _labelTotalPages->set_yalign(0.5);
+ _labelPrecision->set_xalign(0.0);
+ _labelPrecision->set_yalign(0.5);
+ _labelPrecisionWarning->set_xalign(0.0);
+ _labelPrecisionWarning->set_yalign(0.5);
+ _labelPrecisionComment->set_xalign(0.5);
+ _labelPrecisionComment->set_yalign(0.5);
+#else
_labelSelect->set_alignment(0.5,0.5);
- _labelSelect->set_padding(4,0);
+ _labelTotalPages->set_alignment(0.5,0.5);
+ _labelPrecision->set_alignment(0,0.5);
+ _labelPrecisionWarning->set_alignment(0,0.5);
+ _labelPrecisionComment->set_alignment(0.5,0.5);
+#endif
+
+#if GTK_CHECK_VERSION(3,12,0)
+ _labelSelect->set_margin_start(4);
+ _labelSelect->set_margin_end(4);
+ _labelTotalPages->set_margin_start(4);
+ _labelTotalPages->set_margin_end(4);
+ _labelPrecision->set_margin_start(4);
+ _labelPrecision->set_margin_end(4);
+ _labelPrecisionWarning->set_margin_start(4);
+ _labelPrecisionWarning->set_margin_end(4);
+ _labelPrecisionComment->set_margin_start(4);
+ _labelPrecisionComment->set_margin_end(4);
+#else
+ _labelSelect->set_margin_left(4);
+ _labelSelect->set_margin_right(4);
+ _labelTotalPages->set_margin_left(4);
+ _labelTotalPages->set_margin_right(4);
+ _labelPrecision->set_margin_left(4);
+ _labelPrecision->set_margin_right(4);
+ _labelPrecisionWarning->set_margin_left(4);
+ _labelPrecisionWarning->set_margin_right(4);
+ _labelPrecisionComment->set_margin_left(4);
+ _labelPrecisionComment->set_margin_right(4);
+#endif
+
_labelSelect->set_justify(Gtk::JUSTIFY_LEFT);
_labelSelect->set_line_wrap(false);
_labelSelect->set_use_markup(false);
@@ -182,8 +210,6 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
_pageNumberSpin->set_numeric(true);
_pageNumberSpin->set_digits(0);
_pageNumberSpin->set_wrap(false);
- _labelTotalPages->set_alignment(0.5,0.5);
- _labelTotalPages->set_padding(4,0);
_labelTotalPages->set_justify(Gtk::JUSTIFY_LEFT);
_labelTotalPages->set_line_wrap(false);
_labelTotalPages->set_use_markup(false);
@@ -202,14 +228,10 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
vbox2->pack_start(*hbox3);
_pageSettingsFrame->add(*vbox2);
_pageSettingsFrame->set_border_width(4);
- _labelPrecision->set_alignment(0,0.5);
- _labelPrecision->set_padding(4,0);
_labelPrecision->set_justify(Gtk::JUSTIFY_LEFT);
_labelPrecision->set_line_wrap(true);
_labelPrecision->set_use_markup(false);
_labelPrecision->set_selectable(false);
- _labelPrecisionWarning->set_alignment(0,0.5);
- _labelPrecisionWarning->set_padding(4,0);
_labelPrecisionWarning->set_justify(Gtk::JUSTIFY_LEFT);
_labelPrecisionWarning->set_line_wrap(true);
_labelPrecisionWarning->set_use_markup(true);
@@ -226,6 +248,14 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
_importViaInternal->set_active(true);
_labelViaPoppler->set_line_wrap(true);
_labelViaInternal->set_line_wrap(true);
+
+# if GTK_CHECK_VERSION(3,16,0)
+ _labelViaPoppler->set_xalign(0);
+ _labelViaInternal->set_xalign(0);
+# else
+ _labelViaPoppler->set_alignment(0, 0.5);
+ _labelViaInternal->set_alignment(0, 0.5);
+# endif
#endif
_fallbackPrecisionSlider->set_size_request(180,-1);
@@ -235,8 +265,6 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
_fallbackPrecisionSlider->set_draw_value(true);
_fallbackPrecisionSlider->set_value_pos(Gtk::POS_TOP);
_labelPrecisionComment->set_size_request(90,-1);
- _labelPrecisionComment->set_alignment(0.5,0.5);
- _labelPrecisionComment->set_padding(4,0);
_labelPrecisionComment->set_justify(Gtk::JUSTIFY_LEFT);
_labelPrecisionComment->set_line_wrap(false);
_labelPrecisionComment->set_use_markup(false);
@@ -273,20 +301,14 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
// vbox3->pack_start(*hbox5, Gtk::PACK_SHRINK, 4);
_importSettingsFrame->add(*vbox3);
_importSettingsFrame->set_border_width(4);
- vbox1->pack_start(*_pageSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0);
- vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0);
+ vbox1->pack_start(*_pageSettingsFrame, Gtk::PACK_SHRINK, 0);
+ vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_SHRINK, 0);
hbox1->pack_start(*vbox1);
- hbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 4);
+ hbox1->pack_start(*_previewArea, Gtk::PACK_SHRINK, 4);
-#if WITH_GTKMM_3_0
get_content_area()->set_homogeneous(false);
get_content_area()->set_spacing(0);
get_content_area()->pack_start(*hbox1);
-#else
- this->get_vbox()->set_homogeneous(false);
- this->get_vbox()->set_spacing(0);
- this->get_vbox()->pack_start(*hbox1);
-#endif
this->set_title(_("PDF Import Settings"));
this->set_modal(true);
@@ -300,12 +322,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
this->show_all();
// Connect signals
-#if WITH_GTKMM_3_0
_previewArea->signal_draw().connect(sigc::mem_fun(*this, &PdfImportDialog::_onDraw));
-#else
- _previewArea->signal_expose_event().connect(sigc::mem_fun(*this, &PdfImportDialog::_onExposePreview));
-#endif
-
_pageNumberSpin_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPageNumberChanged));
_cropCheck->signal_toggled().connect(sigc::mem_fun(*this, &PdfImportDialog::_onToggleCropping));
_fallbackPrecisionSlider_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPrecisionChanged));
@@ -527,16 +544,6 @@ static void copy_cairo_surface_to_pixbuf (cairo_surface_t *surface,
#endif
-/**
- * \brief Updates the preview area with the previously rendered thumbnail
- */
-#if !WITH_GTKMM_3_0
-bool PdfImportDialog::_onExposePreview(GdkEventExpose * /*event*/) {
- Cairo::RefPtr<Cairo::Context> cr = _previewArea->get_window()->create_cairo_context();
- return _onDraw(cr);
-}
-#endif
-
bool PdfImportDialog::_onDraw(const Cairo::RefPtr<Cairo::Context>& cr) {
// Check if we have a thumbnail at all
if (!_thumb_data) {
@@ -939,8 +946,8 @@ void PdfInput::init(void) {
"<input>\n"
"<extension>.pdf</extension>\n"
"<mimetype>application/pdf</mimetype>\n"
- "<filetypename>" N_("Adobe PDF (*.pdf)") "</filetypename>\n"
- "<filetypetooltip>" N_("Adobe Portable Document Format") "</filetypetooltip>\n"
+ "<filetypename>" N_("Portable Document Format (*.pdf)") "</filetypename>\n"
+ "<filetypetooltip>" N_("Portable Document Format") "</filetypetooltip>\n"
"</input>\n"
"</inkscape-extension>", new PdfInput());
diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h
index 6e36603c3..a70d40a23 100644
--- a/src/extension/internal/pdfinput/pdf-input.h
+++ b/src/extension/internal/pdfinput/pdf-input.h
@@ -32,18 +32,13 @@ class Page;
class PDFDoc;
namespace Gtk {
- class Alignment;
class Button;
class CheckButton;
class ComboBoxText;
class DrawingArea;
class Frame;
class HBox;
-#if WITH_GTKMM_3_0
class Scale;
-#else
- class HScale;
-#endif
class RadioButton;
class VBox;
class Label;
@@ -79,10 +74,6 @@ private:
void _setPreviewPage(int page);
// Signal handlers
-#if !WITH_GTKMM_3_0
- bool _onExposePreview(GdkEventExpose *event);
-#endif
-
bool _onDraw(const Cairo::RefPtr<Cairo::Context>& cr);
void _onPageNumberChanged();
void _onToggleCropping();
@@ -110,13 +101,8 @@ private:
class Gtk::RadioButton * _importViaInternal; // Use native (poppler based) importing
class Gtk::Label * _labelViaInternal;
#endif
-#if WITH_GTKMM_3_0
- class Gtk::Scale * _fallbackPrecisionSlider;
+ Gtk::Scale * _fallbackPrecisionSlider;
Glib::RefPtr<Gtk::Adjustment> _fallbackPrecisionSlider_adj;
-#else
- class Gtk::HScale * _fallbackPrecisionSlider;
- class Gtk::Adjustment *_fallbackPrecisionSlider_adj;
-#endif
class Gtk::Label * _labelPrecisionComment;
class Gtk::HBox * hbox6;
class Gtk::Label * _labelText;
diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp
index bd2168b68..8df883069 100644
--- a/src/extension/internal/pov-out.cpp
+++ b/src/extension/internal/pov-out.cpp
@@ -479,9 +479,9 @@ bool PovOutput::doTreeRecursive(SPDocument *doc, SPObject *obj)
/**
* Descend into children
*/
- for (SPObject *child = obj->firstChild() ; child ; child = child->next)
+ for (auto &child: obj->children)
{
- if (!doTreeRecursive(doc, child))
+ if (!doTreeRecursive(doc, &child))
return false;
}
diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp
index a94bc2141..9cde90519 100644
--- a/src/extension/internal/svg.cpp
+++ b/src/extension/internal/svg.cpp
@@ -78,6 +78,28 @@ static void pruneExtendedNamespaces( Inkscape::XML::Node *repr )
}
}
+/*
+ * Similar to the above sodipodi and inkscape prune, but used on all documents
+ * to remove problematic elements (for example Adobe's i:pgf tag) only removes
+ * known garbage tags.
+ */
+static void pruneProprietaryGarbage( Inkscape::XML::Node *repr )
+{
+ if (repr) {
+ std::vector<Inkscape::XML::Node *> nodesRemoved;
+ for ( Node *child = repr->firstChild(); child; child = child->next() ) {
+ if((strncmp("i:pgf", child->name(), 5) == 0)) {
+ nodesRemoved.push_back(child);
+ g_warning( "An Adobe proprietary tag was found which is known to cause issues. It was removed before saving.");
+ } else {
+ pruneProprietaryGarbage(child);
+ }
+ }
+ for ( std::vector<Inkscape::XML::Node *>::iterator it = nodesRemoved.begin(); it != nodesRemoved.end(); ++it ) {
+ repr->removeChild(*it);
+ }
+ }
+}
/**
\return None
@@ -246,6 +268,10 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena
|| !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)
|| !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE));
+ // We prune the in-use document and deliberately loose data, because there
+ // is no known use for this data at the present time.
+ pruneProprietaryGarbage(rdoc->root());
+
if (!exportExtensions) {
// We make a duplicate document so we don't prune the in-use document
// and loose data. Perhaps the user intends to save as inkscape-svg next.
diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp
index a3d4aad37..c1cfb5cc6 100644
--- a/src/extension/internal/vsd-input.cpp
+++ b/src/extension/internal/vsd-input.cpp
@@ -84,6 +84,8 @@ private:
class Gtk::Widget * _previewArea;
class Gtk::Button * cancelbutton;
class Gtk::Button * okbutton;
+
+ class Gtk::HBox * _page_selector_box;
class Gtk::Label * _labelSelect;
class Gtk::Label * _labelTotalPages;
class Gtk::SpinButton * _pageNumberSpin;
@@ -113,18 +115,10 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec)
_previewArea = Gtk::manage(new class Gtk::VBox());
vbox1 = Gtk::manage(new class Gtk::VBox());
vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0);
-#if WITH_GTKMM_3_0
this->get_content_area()->pack_start(*vbox1);
-#else
- this->get_vbox()->pack_start(*vbox1);
-#endif
-
// CONTROLS
-
- // Buttons
- cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel")));
- okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok")));
+ _page_selector_box = Gtk::manage(new Gtk::HBox());
// Labels
_labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:")));
@@ -132,30 +126,30 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec)
_labelSelect->set_line_wrap(false);
_labelSelect->set_use_markup(false);
_labelSelect->set_selectable(false);
- _labelTotalPages->set_line_wrap(false);
- _labelTotalPages->set_use_markup(false);
- _labelTotalPages->set_selectable(false);
- gchar *label_text = g_strdup_printf(_("out of %i"), num_pages);
- _labelTotalPages->set_label(label_text);
- g_free(label_text);
+ _page_selector_box->pack_start(*_labelSelect, Gtk::PACK_SHRINK);
// Adjustment + spinner
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0);
+ auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0);
_pageNumberSpin = Gtk::manage(new Gtk::SpinButton(_pageNumberSpin_adj, 1, 0));
-#else
- Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, _vec.size(), 1, 10, 0));
- _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(*_pageNumberSpin_adj, 1, 0));
-#endif
_pageNumberSpin->set_can_focus();
_pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS);
_pageNumberSpin->set_numeric(true);
_pageNumberSpin->set_wrap(false);
+ _page_selector_box->pack_start(*_pageNumberSpin, Gtk::PACK_SHRINK);
+
+ _labelTotalPages->set_line_wrap(false);
+ _labelTotalPages->set_use_markup(false);
+ _labelTotalPages->set_selectable(false);
+ gchar *label_text = g_strdup_printf(_("out of %i"), num_pages);
+ _labelTotalPages->set_label(label_text);
+ g_free(label_text);
+ _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK);
+
+ vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK);
- this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END);
- this->get_action_area()->add(*_labelSelect);
- this->add_action_widget(*_pageNumberSpin, Gtk::RESPONSE_ACCEPT);
- this->get_action_area()->add(*_labelTotalPages);
+ // Buttons
+ cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true));
+ okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true));
this->add_action_widget(*cancelbutton, Gtk::RESPONSE_CANCEL);
this->add_action_widget(*okbutton, Gtk::RESPONSE_OK);
@@ -217,6 +211,19 @@ void VsdImportDialog::_setPreviewPage()
}
SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0);
+ if(!doc) {
+ g_warning("VSD import: Could not create preview for page %d", _current_page);
+ gchar const *no_preview_template =
+ "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>"
+ " <path style='fill:none;stroke:#ff0000;stroke-width:2px;' d='M 82,10 18,74 m 0,-64 64,64' />"
+ " <rect style='fill:none;stroke:#000000;stroke-width:1.5px;' width='64' height='64' x='18' y='10' />"
+ " <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>"
+ "</svg>";
+ gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview"));
+ doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0);
+ g_free(no_preview);
+ }
+
Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc));
std::swap(_previewArea, tmpPreviewArea);
delete tmpPreviewArea;
@@ -226,7 +233,16 @@ void VsdImportDialog::_setPreviewPage()
SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
{
- RVNGFileStream input(uri);
+ #ifdef WIN32
+ // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
+ // therefore attempt to convert uri to the system codepage
+ // even if this is not possible the alternate short (8.3) file name will be used if available
+ gchar * converted_uri = g_win32_locale_filename_from_utf8(uri);
+ RVNGFileStream input(converted_uri);
+ g_free(converted_uri);
+ #else
+ RVNGFileStream input(uri);
+ #endif
if (!libvisio::VisioDocument::isSupported(&input)) {
return NULL;
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index c7226a58a..e2d1433e4 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -161,8 +161,16 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena
ext->set_param_bool("FixPPTPatternAsHatch",new_FixPPTPatternAsHatch);
ext->set_param_bool("textToPath", new_val);
+ // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale)
+ char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
+
print_document_to_file(doc, filename);
+ // restore decimal separator used in scanf/printf functions to initial value
+ setlocale(LC_NUMERIC, oldlocale);
+ g_free(oldlocale);
+
return;
}
@@ -1762,11 +1770,20 @@ std::cout << "BEFORE DRAW"
<< " test0 " << ( d->mask & U_DRAW_VISIBLE)
<< " test1 " << ( d->mask & U_DRAW_FORCE)
<< " test2 " << (wmr_mask & U_DRAW_ALTERS)
+ << " test2.5 " << ((d->mask & U_DRAW_NOFILL) != (wmr_mask & U_DRAW_NOFILL) )
<< " test3 " << (wmr_mask & U_DRAW_VISIBLE)
<< " test4 " << !(d->mask & U_DRAW_ONLYTO)
<< " test5 " << ((d->mask & U_DRAW_ONLYTO) && !(wmr_mask & U_DRAW_ONLYTO) )
<< std::endl;
*/
+ /* spurious moveto records should not affect the drawing. However, they set the NOFILL
+ bit and that messes up the logic about when to emit a path. So prune out any
+ stray moveto records. That is those which were never followed by a lineto.
+ */
+ if((d->mask & U_DRAW_NOFILL) && !(d->mask & U_DRAW_VISIBLE) &&
+ !(wmr_mask & U_DRAW_ONLYTO) && (wmr_mask & U_DRAW_VISIBLE)){
+ d->mask ^= U_DRAW_NOFILL;
+ }
if(
(wmr_mask != U_WMR_INVALID) && // next record is valid type
@@ -1774,6 +1791,7 @@ std::cout << "BEFORE DRAW"
(
(d->mask & U_DRAW_FORCE) || // This draw is forced by STROKE/FILL/STROKEANDFILL PATH
(wmr_mask & U_DRAW_ALTERS) || // Next record would alter the drawing environment in some way
+ ((d->mask & U_DRAW_NOFILL) != (wmr_mask & U_DRAW_NOFILL)) || // Fill<->!Fill requires a draw between
( (wmr_mask & U_DRAW_VISIBLE) && // Next record is visible...
(
( !(d->mask & U_DRAW_ONLYTO) ) || // Non *TO records cannot be followed by any Visible
@@ -3087,6 +3105,10 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
return NULL;
}
+ // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale)
+ char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
+
WMF_CALLBACK_DATA d;
d.n_obj = 0; //these might not be set otherwise if the input file is corrupt
@@ -3167,6 +3189,10 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
// in earlier versions no viewbox was generated and a call to setViewBoxIfMissing() was needed here.
+ // restore decimal separator used in scanf/printf functions to initial value
+ setlocale(LC_NUMERIC, oldlocale);
+ g_free(oldlocale);
+
return doc;
}
diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp
index 3d913bf1e..29dfa2716 100644
--- a/src/extension/internal/wmf-print.cpp
+++ b/src/extension/internal/wmf-print.cpp
@@ -312,7 +312,7 @@ unsigned int PrintWmf::finish(Inkscape::Extension::Print * /*mod*/)
g_error("Fatal programming error in PrintWmf::finish");
}
(void) wmf_finish(wt); // Finalize and write out the WMF
- wmf_free(&wt); // clean up
+ uwmf_free(&wt); // clean up
wmf_htable_free(&wht); // clean up
return 0;
@@ -598,7 +598,28 @@ int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform)
if (!style->stroke_dasharray.values.empty()) {
if (!FixPPTDashLine) { // if this is set code elsewhere will break dots/dashes into many smaller lines.
- penstyle = U_PS_DASH;// userstyle not supported apparently, for now map all Inkscape dot/dash to just dash
+ int n_dash = style->stroke_dasharray.values.size();
+ /* options are dash, dot, dashdot and dashdotdot. Try to pick the closest one. */
+ int mark_short=INT_MAX;
+ int mark_long =0;
+ int i;
+ for (i=0;i<n_dash;i++) {
+ int mark = style->stroke_dasharray.values[i];
+ if (mark>mark_long) { mark_long = mark; }
+ if (mark<mark_short) { mark_short = mark; }
+ }
+ if(mark_long == mark_short){ // only one mark size
+ penstyle = U_PS_DOT;
+ }
+ else if (n_dash==2) {
+ penstyle = U_PS_DASH;
+ }
+ else if (n_dash==4) {
+ penstyle = U_PS_DASHDOT;
+ }
+ else {
+ penstyle = U_PS_DASHDOTDOT;
+ }
}
}
diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp
index 54a14fc72..299614c94 100644
--- a/src/extension/internal/wpg-input.cpp
+++ b/src/extension/internal/wpg-input.cpp
@@ -81,7 +81,17 @@ namespace Internal {
SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
{
- RVNGInputStream* input = new RVNGFileStream(uri);
+ #ifdef WIN32
+ // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
+ // therefore attempt to convert uri to the system codepage
+ // even if this is not possible the alternate short (8.3) file name will be used if available
+ gchar * converted_uri = g_win32_locale_filename_from_utf8(uri);
+ RVNGInputStream* input = new RVNGFileStream(converted_uri);
+ g_free(converted_uri);
+ #else
+ RVNGInputStream* input = new RVNGFileStream(uri);
+ #endif
+
#if WITH_LIBWPG03
if (input->isStructured()) {
RVNGInputStream* olestream = input->getSubStreamByName("PerfectOffice_MAIN");