diff options
| author | Denis Declara <declara91@gmail.com> | 2012-04-26 11:14:34 +0000 |
|---|---|---|
| committer | Denis Declara <declara91@gmail.com> | 2012-04-26 11:14:34 +0000 |
| commit | 95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4 (patch) | |
| tree | 506de5a8437cb39917a66d74b68d78692d10a993 /src/extension | |
| parent | Added first support for elliptical arrangements (diff) | |
| parent | powerstroke: cautious fix. (diff) | |
| download | inkscape-95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4.tar.gz inkscape-95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4.zip | |
Trunk merge
(bzr r11073.1.20)
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/internal/emf-win32-inout.cpp | 8 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-print.cpp | 25 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-print.h | 8 | ||||
| -rw-r--r-- | src/extension/internal/gdkpixbuf-input.cpp | 6 | ||||
| -rw-r--r-- | src/extension/internal/latex-pstricks-out.cpp | 26 | ||||
| -rw-r--r-- | src/extension/internal/latex-pstricks.cpp | 25 | ||||
| -rw-r--r-- | src/extension/internal/pdf-input-cairo.cpp | 42 | ||||
| -rw-r--r-- | src/extension/internal/pdf-input-cairo.h | 9 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-input.cpp | 46 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-input.h | 9 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/svg-builder.cpp | 63 | ||||
| -rw-r--r-- | src/extension/internal/svg.cpp | 12 | ||||
| -rw-r--r-- | src/extension/internal/svgz.cpp | 12 | ||||
| -rw-r--r-- | src/extension/internal/wpg-input.cpp | 7 | ||||
| -rw-r--r-- | src/extension/param/string.cpp | 1 | ||||
| -rw-r--r-- | src/extension/prefdialog.h | 1 |
16 files changed, 116 insertions, 184 deletions
diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index e321f67f1..bb7f22a70 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -2457,10 +2457,8 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) void EmfWin32::init (void) { - Inkscape::Extension::Extension * ext; - /* EMF in */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("EMF Input") "</name>\n" "<id>org.inkscape.input.emf.win32</id>\n" @@ -2474,7 +2472,7 @@ EmfWin32::init (void) "</inkscape-extension>", new EmfWin32()); /* WMF in */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("WMF Input") "</name>\n" "<id>org.inkscape.input.wmf.win32</id>\n" @@ -2488,7 +2486,7 @@ EmfWin32::init (void) "</inkscape-extension>", new EmfWin32()); /* EMF out */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("EMF Output") "</name>\n" "<id>org.inkscape.output.emf.win32</id>\n" diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index d5e44e702..ef76c2c14 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -543,7 +543,7 @@ bool PrintEmfWin32::print_simple_shape(Geom::PathVector const &pathv, const Geom /** * For all Subpaths in the <path> - */ + */ for (Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { using Geom::X; @@ -553,7 +553,7 @@ bool PrintEmfWin32::print_simple_shape(Geom::PathVector const &pathv, const Geom p0[X] = (p0[X] * IN_PER_PX * dwDPI); p0[Y] = (p0[Y] * IN_PER_PX * dwDPI); - + LONG const x0 = (LONG) round(p0[X]); LONG const y0 = (LONG) round(rc.bottom-p0[Y]); @@ -715,7 +715,7 @@ unsigned int PrintEmfWin32::print_pathv(Geom::PathVector const &pathv, const Geo /** * For all Subpaths in the <path> - */ + */ for (Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { using Geom::X; @@ -725,7 +725,7 @@ unsigned int PrintEmfWin32::print_pathv(Geom::PathVector const &pathv, const Geo p0[X] = (p0[X] * IN_PER_PX * dwDPI); p0[Y] = (p0[Y] * IN_PER_PX * dwDPI); - + LONG const x0 = (LONG) round(p0[X]); LONG const y0 = (LONG) round(rc.bottom-p0[Y]); @@ -818,7 +818,7 @@ unsigned int PrintEmfWin32::text(Inkscape::Extension::Print * /*mod*/, char cons HFONT hfont = NULL; Geom::Affine tf = m_tr_stack.top(); - double rot = 1800.0*std::atan2(tf[1], tf[0])/M_PI; // 0.1 degree rotation + double rot = 1800.0*std::atan2(tf[1], tf[0])/M_PI; // 0.1 degree rotation #ifdef USE_PANGO_WIN32 /* @@ -904,10 +904,8 @@ unsigned int PrintEmfWin32::text(Inkscape::Extension::Print * /*mod*/, char cons void PrintEmfWin32::init (void) { - Inkscape::Extension::Extension * ext; - /* EMF print */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>Enhanced Metafile Print</name>\n" "<id>org.inkscape.print.emf.win32</id>\n" @@ -920,6 +918,17 @@ void PrintEmfWin32::init (void) return; } +unsigned int PrintEmfWin32::image(Inkscape::Extension::Print * /* module */, /** not used */ + unsigned char *px, /** array of pixel values, Gdk::Pixbuf bitmap format */ + unsigned int /*w*/, /** width of bitmap */ + unsigned int /*h*/, /** height of bitmap */ + unsigned int /*rs*/, /** row stride (normally w*4) */ + Geom::Affine const & /*tf_ignore*/, /** WRONG affine transform, use the one from m_tr_stack */ + SPStyle const * /*style*/) /** provides indirect link to image object */ +{ + free(px); + return 0; +} } /* namespace Internal */ } /* namespace Extension */ diff --git a/src/extension/internal/emf-win32-print.h b/src/extension/internal/emf-win32-print.h index 71ce5d6d0..e7bd08477 100644 --- a/src/extension/internal/emf-win32-print.h +++ b/src/extension/internal/emf-win32-print.h @@ -50,6 +50,13 @@ class PrintEmfWin32 : public Inkscape::Extension::Implementation::Implementation unsigned int print_pathv (Geom::PathVector const &pathv, const Geom::Affine &transform); bool print_simple_shape (Geom::PathVector const &pathv, const Geom::Affine &transform); + unsigned int image(Inkscape::Extension::Print * /* module */, /** not used */ + unsigned char *px, /** array of pixel values, Gdk::Pixbuf bitmap format */ + unsigned int w, /** width of bitmap */ + unsigned int h, /** height of bitmap */ + unsigned int rs, /** row stride (normally w*4) */ + Geom::Affine const &tf_ignore, /** WRONG affine transform, use the one from m_tr_stack */ + SPStyle const *style); /** provides indirect link to image object */ public: PrintEmfWin32 (void); @@ -80,7 +87,6 @@ public: bool textToPath (Inkscape::Extension::Print * ext); static void init (void); - protected: int create_brush(SPStyle const *style); diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 4519befcf..80be2ecc2 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -54,7 +54,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) static std::set<Glib::ustring> lossy = create_lossy_set(); if (pb) { /* We are readable */ - bool is_lossy; + // TODO revisit: bool is_lossy; Glib::ustring mime_type, ext; Glib::ustring u = uri; std::size_t dotpos = u.rfind('.'); @@ -64,10 +64,10 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) // HACK: replace with something better based on GIO if (!ext.empty() && lossy.find(ext) != lossy.end()) { - is_lossy = true; + // TODO revisit: is_lossy = true; mime_type = "image/jpeg"; } else { - is_lossy = false; + // TODO revisit: is_lossy = false; mime_type = "image/png"; } diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index decc42d94..3ce2c5531 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -49,8 +49,6 @@ bool LatexOutput::check(Inkscape::Extension::Extension * /*module*/) void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, gchar const *filename) { SPPrintContext context; - unsigned int ret = 0; - doc->ensureUpToDate(); Inkscape::Extension::Print *mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX); @@ -58,28 +56,26 @@ void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, gchar * oldoutput = g_strdup(oldconst); mod->set_param_string("destination", filename); - /* Start */ + // Start context.module = mod; - /* fixme: This has to go into module constructor somehow */ + // fixme: This has to go into module constructor somehow mod->base = doc->getRoot(); Inkscape::Drawing drawing; - mod->dkey = SPItem::display_key_new (1); - mod->root = (mod->base)->invoke_show (drawing, mod->dkey, SP_ITEM_SHOW_DISPLAY); + mod->dkey = SPItem::display_key_new(1); + mod->root = (mod->base)->invoke_show(drawing, mod->dkey, SP_ITEM_SHOW_DISPLAY); drawing.setRoot(mod->root); - /* Print document */ - ret = mod->begin (doc); - (mod->base)->invoke_print (&context); - ret = mod->finish (); - /* Release things */ - (mod->base)->invoke_hide (mod->dkey); + // Print document + mod->begin(doc); + (mod->base)->invoke_print(&context); + mod->finish(); + // Release things + (mod->base)->invoke_hide(mod->dkey); mod->base = NULL; mod->root = NULL; // should have been deleted by invoke_hide - /* end */ + // end mod->set_param_string("destination", oldoutput); g_free(oldoutput); - - return; } #include "clear-n_.h" diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index bdf95f941..c1eddf539 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -326,22 +326,17 @@ PrintLatex::textToPath(Inkscape::Extension::Print * ext) #include "clear-n_.h" -void -PrintLatex::init (void) +void PrintLatex::init(void) { - Inkscape::Extension::Extension * ext; - - /* SVG in */ - ext = Inkscape::Extension::build_from_mem( - "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" - "<name>" N_("LaTeX Print") "</name>\n" - "<id>" SP_MODULE_KEY_PRINT_LATEX "</id>\n" - "<param name=\"destination\" type=\"string\"></param>\n" - "<param name=\"textToPath\" type=\"boolean\">true</param>\n" - "<print/>\n" - "</inkscape-extension>", new PrintLatex()); - - return; + /* SVG in */ + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("LaTeX Print") "</name>\n" + "<id>" SP_MODULE_KEY_PRINT_LATEX "</id>\n" + "<param name=\"destination\" type=\"string\"></param>\n" + "<param name=\"textToPath\" type=\"boolean\">true</param>\n" + "<print/>\n" + "</inkscape-extension>", new PrintLatex()); } } /* namespace Internal */ diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index 36ef66713..0a89c6661 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -32,6 +32,8 @@ #include <poppler/glib/poppler-page.h> #include "ui/widget/spinbutton.h" +#include "ui/widget/frame.h" + #include <gdkmm/general.h> namespace Inkscape { @@ -99,9 +101,7 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) hbox3 = Gtk::manage(new class Gtk::HBox(false, 4)); vbox2 = Gtk::manage(new class Gtk::VBox(false, 4)); - alignment3 = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1)); - _labelPageSettings = Gtk::manage(new class Gtk::Label(_("Page settings"))); - _pageSettingsFrame = Gtk::manage(new class Gtk::Frame()); + _pageSettingsFrame = Gtk::manage(new class Inkscape::UI::Widget::Frame(_("Page settings"))); _labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:"))); _labelPrecisionWarning = Gtk::manage(new class Gtk::Label(_("<b>Note</b>: setting the precision too high may result in a large SVG file and slow performance."))); @@ -125,9 +125,7 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) hbox5 = Gtk::manage(new class Gtk::HBox(false, 4)); _embedImagesCheck = Gtk::manage(new class Gtk::CheckButton(_("Embed images"))); vbox3 = Gtk::manage(new class Gtk::VBox(false, 4)); - alignment4 = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1)); - _labelImportSettings = Gtk::manage(new class Gtk::Label(_("Import settings"))); - _importSettingsFrame = Gtk::manage(new class Gtk::Frame()); + _importSettingsFrame = Gtk::manage(new class Inkscape::UI::Widget::Frame(_("Import settings"))); vbox1 = Gtk::manage(new class Gtk::VBox(false, 4)); _previewArea = Gtk::manage(new class Gtk::DrawingArea()); hbox1 = Gtk::manage(new class Gtk::HBox(false, 4)); @@ -167,18 +165,8 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) hbox3->pack_start(*_cropTypeCombo, Gtk::PACK_SHRINK, 0); vbox2->pack_start(*hbox2); vbox2->pack_start(*hbox3); - alignment3->add(*vbox2); - _labelPageSettings->set_alignment(0.5,0.5); - _labelPageSettings->set_padding(4,0); - _labelPageSettings->set_justify(Gtk::JUSTIFY_LEFT); - _labelPageSettings->set_line_wrap(false); - _labelPageSettings->set_use_markup(true); - _labelPageSettings->set_selectable(false); + _pageSettingsFrame->add(*vbox2); _pageSettingsFrame->set_border_width(4); - _pageSettingsFrame->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - _pageSettingsFrame->set_label_align(0,0.5); - _pageSettingsFrame->add(*alignment3); - _pageSettingsFrame->set_label_widget(*_labelPageSettings); _labelPrecision->set_alignment(0,0.5); _labelPrecision->set_padding(4,0); _labelPrecision->set_justify(Gtk::JUSTIFY_LEFT); @@ -228,18 +216,8 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) vbox3->pack_start(*hbox5, Gtk::PACK_SHRINK, 4); vbox3->pack_start(*_localFontsCheck, Gtk::PACK_SHRINK, 0); vbox3->pack_start(*_embedImagesCheck, Gtk::PACK_SHRINK, 0); - alignment4->add(*vbox3); - _labelImportSettings->set_alignment(0.5,0.5); - _labelImportSettings->set_padding(4,0); - _labelImportSettings->set_justify(Gtk::JUSTIFY_LEFT); - _labelImportSettings->set_line_wrap(false); - _labelImportSettings->set_use_markup(true); - _labelImportSettings->set_selectable(false); + _importSettingsFrame->add(*vbox3); _importSettingsFrame->set_border_width(4); - _importSettingsFrame->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - _importSettingsFrame->set_label_align(0,0.5); - _importSettingsFrame->add(*alignment4); - _importSettingsFrame->set_label_widget(*_labelImportSettings); vbox1->pack_start(*_pageSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0); vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0); hbox1->pack_start(*vbox1); @@ -266,8 +244,6 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) _cropTypeCombo->show(); hbox3->show(); vbox2->show(); - alignment3->show(); - _labelPageSettings->show(); _pageSettingsFrame->show(); _labelPrecision->show(); _labelPrecisionWarning->show(); @@ -280,8 +256,6 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) _localFontsCheck->show(); _embedImagesCheck->show(); vbox3->show(); - alignment4->show(); - _labelImportSettings->show(); _importSettingsFrame->show(); vbox1->show(); _previewArea->show(); @@ -657,9 +631,7 @@ static cairo_status_t void PdfInputCairo::init(void) { - Inkscape::Extension::Extension * ext; - - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>PDF Input</name>\n" "<id>org.inkscape.input.cairo-pdf</id>\n" diff --git a/src/extension/internal/pdf-input-cairo.h b/src/extension/internal/pdf-input-cairo.h index 7581cb0a5..cc3ed975e 100644 --- a/src/extension/internal/pdf-input-cairo.h +++ b/src/extension/internal/pdf-input-cairo.h @@ -42,6 +42,7 @@ namespace Inkscape { namespace UI { namespace Widget { class SpinButton; + class Frame; } } @@ -77,9 +78,7 @@ private: class Gtk::ComboBoxText * _cropTypeCombo; class Gtk::HBox * hbox3; class Gtk::VBox * vbox2; - class Gtk::Alignment * alignment3; - class Gtk::Label * _labelPageSettings; - class Gtk::Frame * _pageSettingsFrame; + class Inkscape::UI::Widget::Frame * _pageSettingsFrame; class Gtk::Label * _labelPrecision; class Gtk::Label * _labelPrecisionWarning; class Gtk::HScale * _fallbackPrecisionSlider; @@ -92,9 +91,7 @@ private: class Gtk::CheckButton * _localFontsCheck; class Gtk::CheckButton * _embedImagesCheck; class Gtk::VBox * vbox3; - class Gtk::Alignment * alignment4; - class Gtk::Label * _labelImportSettings; - class Gtk::Frame * _importSettingsFrame; + class Inkscape::UI::Widget::Frame * _importSettingsFrame; class Gtk::VBox * vbox1; class Gtk::DrawingArea * _previewArea; class Gtk::HBox * hbox1; diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index eff488c9d..8802ce2ba 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -49,6 +49,7 @@ #include "dialogs/dialog-events.h" #include <gtk/gtk.h> #include "ui/widget/spinbutton.h" +#include "ui/widget/frame.h" #include <glibmm/i18n.h> #include <gdkmm/general.h> @@ -116,9 +117,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) hbox3 = Gtk::manage(new class Gtk::HBox(false, 4)); vbox2 = Gtk::manage(new class Gtk::VBox(false, 4)); - alignment3 = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1)); - _labelPageSettings = Gtk::manage(new class Gtk::Label(_("Page settings"))); - _pageSettingsFrame = Gtk::manage(new class Gtk::Frame()); + _pageSettingsFrame = Gtk::manage(new class Inkscape::UI::Widget::Frame(_("Page settings"))); _labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:"))); _labelPrecisionWarning = Gtk::manage(new class Gtk::Label(_("<b>Note</b>: setting the precision too high may result in a large SVG file and slow performance."))); @@ -142,9 +141,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) hbox5 = Gtk::manage(new class Gtk::HBox(false, 4)); _embedImagesCheck = Gtk::manage(new class Gtk::CheckButton(_("Embed images"))); vbox3 = Gtk::manage(new class Gtk::VBox(false, 4)); - alignment4 = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1)); - _labelImportSettings = Gtk::manage(new class Gtk::Label(_("Import settings"))); - _importSettingsFrame = Gtk::manage(new class Gtk::Frame()); + _importSettingsFrame = Gtk::manage(new class Inkscape::UI::Widget::Frame(_("Import settings"))); vbox1 = Gtk::manage(new class Gtk::VBox(false, 4)); _previewArea = Gtk::manage(new class Gtk::DrawingArea()); hbox1 = Gtk::manage(new class Gtk::HBox(false, 4)); @@ -184,18 +181,8 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) hbox3->pack_start(*_cropTypeCombo, Gtk::PACK_SHRINK, 0); vbox2->pack_start(*hbox2); vbox2->pack_start(*hbox3); - alignment3->add(*vbox2); - _labelPageSettings->set_alignment(0.5,0.5); - _labelPageSettings->set_padding(4,0); - _labelPageSettings->set_justify(Gtk::JUSTIFY_LEFT); - _labelPageSettings->set_line_wrap(false); - _labelPageSettings->set_use_markup(true); - _labelPageSettings->set_selectable(false); + _pageSettingsFrame->add(*vbox2); _pageSettingsFrame->set_border_width(4); - _pageSettingsFrame->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - _pageSettingsFrame->set_label_align(0,0.5); - _pageSettingsFrame->add(*alignment3); - _pageSettingsFrame->set_label_widget(*_labelPageSettings); _labelPrecision->set_alignment(0,0.5); _labelPrecision->set_padding(4,0); _labelPrecision->set_justify(Gtk::JUSTIFY_LEFT); @@ -245,18 +232,8 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) vbox3->pack_start(*hbox5, Gtk::PACK_SHRINK, 4); vbox3->pack_start(*_localFontsCheck, Gtk::PACK_SHRINK, 0); vbox3->pack_start(*_embedImagesCheck, Gtk::PACK_SHRINK, 0); - alignment4->add(*vbox3); - _labelImportSettings->set_alignment(0.5,0.5); - _labelImportSettings->set_padding(4,0); - _labelImportSettings->set_justify(Gtk::JUSTIFY_LEFT); - _labelImportSettings->set_line_wrap(false); - _labelImportSettings->set_use_markup(true); - _labelImportSettings->set_selectable(false); + _importSettingsFrame->add(*vbox3); _importSettingsFrame->set_border_width(4); - _importSettingsFrame->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - _importSettingsFrame->set_label_align(0,0.5); - _importSettingsFrame->add(*alignment4); - _importSettingsFrame->set_label_widget(*_labelImportSettings); vbox1->pack_start(*_pageSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0); vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0); hbox1->pack_start(*vbox1); @@ -283,8 +260,6 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _cropTypeCombo->show(); hbox3->show(); vbox2->show(); - alignment3->show(); - _labelPageSettings->show(); _pageSettingsFrame->show(); _labelPrecision->show(); _labelPrecisionWarning->show(); @@ -297,8 +272,6 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _localFontsCheck->show(); _embedImagesCheck->show(); vbox3->show(); - alignment4->show(); - _labelImportSettings->show(); _importSettingsFrame->show(); vbox1->show(); _previewArea->show(); @@ -762,12 +735,9 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { #include "../clear-n_.h" -void -PdfInput::init(void) { - Inkscape::Extension::Extension * ext; - +void PdfInput::init(void) { /* PDF in */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("PDF Input") "</name>\n" "<id>org.inkscape.input.pdf</id>\n" @@ -780,7 +750,7 @@ PdfInput::init(void) { "</inkscape-extension>", new PdfInput()); /* AI in */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("AI Input") "</name>\n" "<id>org.inkscape.input.ai</id>\n" diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 7282de322..8334fd2f3 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -49,6 +49,7 @@ namespace Inkscape { namespace UI { namespace Widget { class SpinButton; + class Frame; } } @@ -87,9 +88,7 @@ private: class Gtk::ComboBoxText * _cropTypeCombo; class Gtk::HBox * hbox3; class Gtk::VBox * vbox2; - class Gtk::Alignment * alignment3; - class Gtk::Label * _labelPageSettings; - class Gtk::Frame * _pageSettingsFrame; + class Inkscape::UI::Widget::Frame * _pageSettingsFrame; class Gtk::Label * _labelPrecision; class Gtk::Label * _labelPrecisionWarning; class Gtk::HScale * _fallbackPrecisionSlider; @@ -102,9 +101,7 @@ private: class Gtk::CheckButton * _localFontsCheck; class Gtk::CheckButton * _embedImagesCheck; class Gtk::VBox * vbox3; - class Gtk::Alignment * alignment4; - class Gtk::Label * _labelImportSettings; - class Gtk::Frame * _importSettingsFrame; + class Inkscape::UI::Widget::Frame * _importSettingsFrame; class Gtk::VBox * vbox1; class Gtk::DrawingArea * _previewArea; class Gtk::HBox * hbox1; diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 885bed3c9..2f36e19a4 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -57,6 +57,7 @@ namespace Internal { #define TRACE(_args) IFTRACE(g_print _args) static double ttm[6] = {1, 0, 0, 1, 0, 0}; // temporary transform matrix +static bool ttm_is_set = false; // flag to forbid setting ttm /** * \struct SvgTransparencyGroup @@ -214,7 +215,11 @@ Inkscape::XML::Node *SvgBuilder::pushGroup() { setAsLayer(_docname); } } - + if (_container->parent()->attribute("inkscape:groupmode") != NULL) { + ttm[0] = ttm[3] = 1.0; // clear ttm if parent is a layer + ttm[1] = ttm[2] = ttm[4] = ttm[5] = 0.0; + ttm_is_set = false; + } return _container; } @@ -567,17 +572,14 @@ bool SvgBuilder::getTransform(double *transform) { void SvgBuilder::setTransform(double c0, double c1, double c2, double c3, double c4, double c5) { // do not remember the group which is a layer - if (_container->attribute("inkscape:groupmode") != NULL) { - ttm[0] = ttm[3] = 1.0; - ttm[1] = ttm[2] = ttm[4] = ttm[5] = 0.0; - } - else { + if ((_container->attribute("inkscape:groupmode") == NULL) && !ttm_is_set) { ttm[0] = c0; ttm[1] = c1; ttm[2] = c2; ttm[3] = c3; ttm[4] = c4; ttm[5] = c5; + ttm_is_set = true; } // Avoid transforming a group with an already set clip-path @@ -862,30 +864,29 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh } else if ( type == 3 ) { // Stitching StitchingFunction *stitchingFunc = static_cast<StitchingFunction*>(func); double *bounds = stitchingFunc->getBounds(); + double *encode = stitchingFunc->getEncode(); int num_funcs = stitchingFunc->getNumFuncs(); + // Add stops from all the stitched functions + GfxRGB prev_color, color; + svgGetShadingColorRGB(shading, bounds[0], &prev_color); + _addStopToGradient(gradient, bounds[0], &prev_color, 1.0); for ( int i = 0 ; i < num_funcs ; i++ ) { - GfxRGB color; - svgGetShadingColorRGB(shading, bounds[i], &color); - bool is_continuation = false; - if ( i > 0 ) { // Compare to previous stop - GfxRGB prev_color; - svgGetShadingColorRGB(shading, bounds[i-1], &prev_color); - if ( abs(color.r - prev_color.r) < INT_EPSILON && - abs(color.g - prev_color.g) < INT_EPSILON && - abs(color.b - prev_color.b) < INT_EPSILON ) { - is_continuation = true; - } - } + svgGetShadingColorRGB(shading, bounds[i + 1], &color); // Add stops - if ( !is_continuation ) { - _addStopToGradient(gradient, bounds[i], &color, 1.0); - } - if ( is_continuation || ( i == num_funcs - 1 ) ) { - GfxRGB next_color; - svgGetShadingColorRGB(shading, bounds[i+1], &next_color); - _addStopToGradient(gradient, bounds[i+1], &next_color, 1.0); + if (stitchingFunc->getFunc(i)->getType() == 2) { // process exponential fxn + double expE = (static_cast<ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE(); + if (expE > 1.0) { + expE = (bounds[i + 1] - bounds[i])/expE; // approximate exponential as a single straight line at x=1 + if (encode[2*i] == 0) { // normal sequence + _addStopToGradient(gradient, bounds[i + 1] - expE, &prev_color, 1.0); + } else { // reflected sequence + _addStopToGradient(gradient, bounds[i] + expE, &color, 1.0); + } + } } + _addStopToGradient(gradient, bounds[i + 1], &color, 1.0); + prev_color = color; } } else { // Unsupported function type return false; @@ -911,10 +912,10 @@ void SvgBuilder::updateStyle(GfxState *state) { that a space in sp may be removed or replaced by some other tokens specified in the code. (Bug LP #179589) */ -static int MatchingChars(std::string s1, std::string sp) +static size_t MatchingChars(std::string s1, std::string sp) { - unsigned int is = 0; - unsigned int ip = 0; + size_t is = 0; + size_t ip = 0; while(is < s1.length() && ip < sp.length()) { if (s1[is] == sp[ip]) { @@ -928,7 +929,7 @@ static int MatchingChars(std::string s1, std::string sp) break; } } - return(ip); + return ip; } /* @@ -945,12 +946,12 @@ std::string SvgBuilder::_BestMatchingFont(std::string PDFname) std::string fontname = _availableFontNames[i]; // At least the first word of the font name should match. - guint minMatch = fontname.find(" "); + size_t minMatch = fontname.find(" "); if (minMatch == std::string::npos) { minMatch = fontname.length(); } - int Match = MatchingChars(PDFname, fontname); + size_t Match = MatchingChars(PDFname, fontname); if (Match >= minMatch) { double relMatch = (float)Match / (fontname.length() + PDFname.length()); if (relMatch > bestMatch) { diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index d054e4427..9b1098afd 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -83,10 +83,8 @@ void pruneExtendedAttributes( Inkscape::XML::Node *repr ) void Svg::init(void) { - Inkscape::Extension::Extension * ext; - /* SVG in */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("SVG Input") "</name>\n" "<id>" SP_MODULE_KEY_INPUT_SVG "</id>\n" @@ -100,7 +98,7 @@ Svg::init(void) "</inkscape-extension>", new Svg()); /* SVG out Inkscape */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("SVG Output Inkscape") "</name>\n" "<id>" SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE "</id>\n" @@ -114,7 +112,7 @@ Svg::init(void) "</inkscape-extension>", new Svg()); /* SVG out */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("SVG Output") "</name>\n" "<id>" SP_MODULE_KEY_OUTPUT_SVG "</id>\n" @@ -232,8 +230,6 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena g_return_if_fail(doc != NULL); g_return_if_fail(filename != NULL); - gchar *save_path = g_path_get_dirname(filename); - bool const exportExtensions = ( !mod->get_id() || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE) || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE)); @@ -259,8 +255,6 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena Inkscape::GC::release(rdoc); } - g_free(save_path); - return; } diff --git a/src/extension/internal/svgz.cpp b/src/extension/internal/svgz.cpp index fceafd3ee..be9440980 100644 --- a/src/extension/internal/svgz.cpp +++ b/src/extension/internal/svgz.cpp @@ -40,10 +40,8 @@ namespace Internal { void Svgz::init(void) { - Inkscape::Extension::Extension * ext; - /* SVGZ in */ - ext = Inkscape::Extension::build_from_mem( + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("SVGZ Input") "</name>\n" "<id>" SP_MODULE_KEY_INPUT_SVGZ "</id>\n" @@ -57,8 +55,8 @@ Svgz::init(void) "</input>\n" "</inkscape-extension>", new Svgz()); - /* SVGZ out Inkscape */ - ext = Inkscape::Extension::build_from_mem( + /* SVGZ out Inkscape */ + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("SVGZ Output") "</name>\n" "<id>" SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE "</id>\n" @@ -71,8 +69,8 @@ Svgz::init(void) "</output>\n" "</inkscape-extension>", new Svgz()); - /* SVGZ out */ - ext = Inkscape::Extension::build_from_mem( + /* SVGZ out */ + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("SVGZ Output") "</name>\n" "<id>" SP_MODULE_KEY_OUTPUT_SVGZ "</id>\n" diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 8862c1d4a..cb1677547 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -115,11 +115,8 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #include "clear-n_.h" -void -WpgInput::init(void) { - Inkscape::Extension::Extension * ext; - - ext = Inkscape::Extension::build_from_mem( +void WpgInput::init(void) { + Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("WPG Input") "</name>\n" "<id>org.inkscape.input.wpg</id>\n" diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index f15d56f0d..cf2b0f5d5 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -10,6 +10,7 @@ # include "config.h" #endif +#include <glibmm/value.h> #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/spinbutton.h> diff --git a/src/extension/prefdialog.h b/src/extension/prefdialog.h index ff857272a..943273623 100644 --- a/src/extension/prefdialog.h +++ b/src/extension/prefdialog.h @@ -10,6 +10,7 @@ #ifndef INKSCAPE_EXTENSION_DIALOG_H__ #define INKSCAPE_EXTENSION_DIALOG_H__ +#include <glibmm/value.h> #include <gtkmm/dialog.h> #include <glibmm/ustring.h> |
