From e958fe298a23189c77a57146e7c22179d826efe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 17 Nov 2013 20:12:57 +0100 Subject: changed unit calculation to regard doc unit (bzr r12817) --- share/extensions/hpgl_encoder.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/share/extensions/hpgl_encoder.py b/share/extensions/hpgl_encoder.py index b4191e7c0..e053751b9 100644 --- a/share/extensions/hpgl_encoder.py +++ b/share/extensions/hpgl_encoder.py @@ -62,13 +62,15 @@ class hpglEncoder: self.sizeY = 'False' self.dryRun = True self.lastPoint = [0, 0, 0] - self.scaleX = self.options.resolutionX / 90 # inch to pixels - self.scaleY = self.options.resolutionY / 90 # inch to pixels - self.options.offsetX = self.options.offsetX * 3.5433070866 * self.scaleX # mm to dots (plotter coordinate system) - self.options.offsetY = self.options.offsetY * 3.5433070866 * self.scaleY # mm to dots - self.options.overcut = self.options.overcut * 3.5433070866 * ((self.scaleX + self.scaleY) / 2) # mm to dots - self.options.toolOffset = self.options.toolOffset * 3.5433070866 * ((self.scaleX + self.scaleY) / 2) # mm to dots - self.options.flat = ((self.options.resolutionX + self.options.resolutionY) / 2) * self.options.flat / 1000 # scale flatness to resolution + self.scaleX = self.options.resolutionX / effect.uuconv['in'] * effect.uuconv[effect.getDocumentUnit()] # inch to document unit + self.scaleY = self.options.resolutionY / effect.uuconv['in'] * effect.uuconv[effect.getDocumentUnit()] # inch to document unit + mmToDocUnit = effect.uuconv['mm'] / effect.uuconv[effect.getDocumentUnit()] + self.options.offsetX = self.options.offsetX * mmToDocUnit * self.scaleX # mm to dots (plotter coordinate system) + self.options.offsetY = self.options.offsetY * mmToDocUnit * self.scaleY # mm to dots + scaleXY = (self.scaleX + self.scaleY) / 2 + self.options.overcut = self.options.overcut * mmToDocUnit * scaleXY # mm to dots + self.options.toolOffset = self.options.toolOffset * mmToDocUnit * scaleXY # mm to dots + self.options.flat = self.options.flat / (1016 / ((self.options.resolutionX + self.options.resolutionY) / 2)) # scale flatness to resolution self.toolOffsetFlat = self.options.flat / self.options.toolOffset * 4.5 # scale flatness to offset self.mirrorX = 1.0 if self.options.mirrorX: @@ -83,8 +85,8 @@ class hpglEncoder: if viewBox: viewBox = string.split(viewBox, ' ') if viewBox[2] and viewBox[3]: - self.viewBoxTransformX = float(effect.unittouu(self.doc.get('width'))) / float(viewBox[2]) - self.viewBoxTransformY = float(effect.unittouu(self.doc.get('height'))) / float(viewBox[3]) + self.viewBoxTransformX = effect.unittouu(self.doc.get('width')) / effect.unittouu(viewBox[2]) + self.viewBoxTransformY = effect.unittouu(self.doc.get('height')) / effect.unittouu(viewBox[3]) def getHpgl(self): # dryRun to find edges -- cgit v1.2.3 From dcfb31842ef9a0c1f53ad65cd08188a7ba447b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 17 Nov 2013 20:13:45 +0100 Subject: added missing documentation (bzr r12818) --- share/extensions/hpgl_decoder.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/extensions/hpgl_decoder.py b/share/extensions/hpgl_decoder.py index 0af2d5f5f..96571df94 100644 --- a/share/extensions/hpgl_decoder.py +++ b/share/extensions/hpgl_decoder.py @@ -33,6 +33,8 @@ class hpglDecoder: "resolutionX":float "resolutionY":float "showMovements":bool + "docWidth":float + "docHeight":float ''' self.hpglString = hpglString self.options = options -- cgit v1.2.3 From 87006b84d98fe828a38069b0e706a55113acb736 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Nov 2013 23:32:04 +0100 Subject: adhere to Python "convention" of using double underscore to indicate class private members (bzr r12819) --- share/extensions/inkex.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index 4542bc418..5333ef52b 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -269,11 +269,11 @@ class Effect: return 'px' #a dictionary of unit to user unit conversion factors - uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866, + __uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866, 'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080} def unittouu(self, string): '''Returns userunits given a string representation of units in another system''' - unit = re.compile('(%s)$' % '|'.join(self.uuconv.keys())) + unit = re.compile('(%s)$' % '|'.join(self.__uuconv.keys())) param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)') p = param.match(string) @@ -284,16 +284,16 @@ class Effect: retval = 0.0 if u: try: - return retval * (self.uuconv[u.string[u.start():u.end()]] / self.uuconv[self.getDocumentUnit()]) + return retval * (self.__uuconv[u.string[u.start():u.end()]] / self.__uuconv[self.getDocumentUnit()]) except KeyError: pass else: # default assume 'px' unit - return retval / self.uuconv[self.getDocumentUnit()] + return retval / self.__uuconv[self.getDocumentUnit()] return retval def uutounit(self, val, unit): - return val / (self.uuconv[unit] / self.uuconv[self.getDocumentUnit()]) + return val / (self.__uuconv[unit] / self.__uuconv[self.getDocumentUnit()]) # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 -- cgit v1.2.3 From 43762b687409942c663ed1ab327247f37ec226bc Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 18 Nov 2013 12:59:40 +0100 Subject: i18n. Fix for Bug #1252229 (As for the verb name XXX (No preferences), XXX are not localized.). Fixed bugs: - https://launchpad.net/bugs/1252229 (bzr r12820) --- src/extension/effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 1575c2b10..3c8ee5844 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -38,7 +38,7 @@ Inkscape::XML::Node * Effect::_filters_list = NULL; Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : Extension(in_repr, in_imp), _id_noprefs(Glib::ustring(get_id()) + ".noprefs"), - _name_noprefs(Glib::ustring(get_name()) + _(" (No preferences)")), + _name_noprefs(Glib::ustring(_(get_name())) + _(" (No preferences)")), _verb(get_id(), get_name(), NULL, NULL, this, true), _verb_nopref(_id_noprefs.c_str(), _name_noprefs.c_str(), NULL, NULL, this, false), _menu_node(NULL), _workingDialog(true), -- cgit v1.2.3 From 59d29d9954ee7e93872b8ccc994a001366c61c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Mon, 18 Nov 2013 22:29:32 +0100 Subject: removed access to private member, fixed dpi calculation (bzr r12821) --- share/extensions/hpgl_encoder.py | 13 ++++++------- share/extensions/plotter.py | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/share/extensions/hpgl_encoder.py b/share/extensions/hpgl_encoder.py index e053751b9..692f11cd4 100644 --- a/share/extensions/hpgl_encoder.py +++ b/share/extensions/hpgl_encoder.py @@ -62,14 +62,13 @@ class hpglEncoder: self.sizeY = 'False' self.dryRun = True self.lastPoint = [0, 0, 0] - self.scaleX = self.options.resolutionX / effect.uuconv['in'] * effect.uuconv[effect.getDocumentUnit()] # inch to document unit - self.scaleY = self.options.resolutionY / effect.uuconv['in'] * effect.uuconv[effect.getDocumentUnit()] # inch to document unit - mmToDocUnit = effect.uuconv['mm'] / effect.uuconv[effect.getDocumentUnit()] - self.options.offsetX = self.options.offsetX * mmToDocUnit * self.scaleX # mm to dots (plotter coordinate system) - self.options.offsetY = self.options.offsetY * mmToDocUnit * self.scaleY # mm to dots + self.scaleX = self.options.resolutionX / effect.unittouu("1.0in") # dots per inch to dots per user unit + self.scaleY = self.options.resolutionY / effect.unittouu("1.0in") # dots per inch to dots per user unit scaleXY = (self.scaleX + self.scaleY) / 2 - self.options.overcut = self.options.overcut * mmToDocUnit * scaleXY # mm to dots - self.options.toolOffset = self.options.toolOffset * mmToDocUnit * scaleXY # mm to dots + self.options.offsetX = effect.unittouu(str(self.options.offsetX) + "mm") * self.scaleX # mm to dots (plotter coordinate system) + self.options.offsetY = effect.unittouu(str(self.options.offsetY) + "mm") * self.scaleY # mm to dots + self.options.overcut = effect.unittouu(str(self.options.overcut) + "mm") * scaleXY # mm to dots + self.options.toolOffset = effect.unittouu(str(self.options.toolOffset) + "mm") * scaleXY # mm to dots self.options.flat = self.options.flat / (1016 / ((self.options.resolutionX + self.options.resolutionY) / 2)) # scale flatness to resolution self.toolOffsetFlat = self.options.flat / self.options.toolOffset * 4.5 # scale flatness to offset self.mirrorX = 1.0 diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index f57057435..78d480f05 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -79,6 +79,7 @@ class MyEffect(inkex.Effect): raise ValueError, ('', type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is # a preview or a final run. (Remember to set to true) + # This outcommented code has a user unit issue (getSvg produces px, docWidth could be mm or something else) ''' # reparse data for preview self.options.showMovements = True -- cgit v1.2.3 From 6505a9c92866f136b51024462c2b69a4f529a339 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 18 Nov 2013 22:56:11 +0100 Subject: fix initialization bug, that leads to non-continuous path (bzr r12822) --- src/sp-ellipse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 4cf96e432..7e5dda871 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -450,7 +450,7 @@ void SPGenericEllipse::set_shape() // This code converts the circle to four elliptical arcs explicitly. // Circle::getPath currently creates cubic bezier curves, these are not suitable here // as a circle should have four mid markers at 0, 90, 180, 270 degrees. - Geom::Path path; + Geom::Path path(Geom::Point::polar(0)); Geom::EllipticalArc* arc; arc = circle.arc(Geom::Point::polar(0), Geom::Point::polar(M_PI / 4.0), Geom::Point::polar(M_PI / 2.0)); -- cgit v1.2.3 From 9318c9c232cf73aa806c366381f144dc6df4d218 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 19 Nov 2013 13:10:04 +0100 Subject: Add GUI for 'image-rendering'. Completes fix for blocker bug #1163449. Removed two unused preference options for bitmaps. (bzr r12823) --- src/extension/internal/gdkpixbuf-input.cpp | 56 ++++++++++++++------ src/extension/system.cpp | 4 +- src/preferences-skeleton.h | 3 +- src/ui/dialog/inkscape-preferences.cpp | 37 +++++++++----- src/ui/dialog/inkscape-preferences.h | 6 ++- src/ui/dialog/object-attributes.cpp | 1 + src/ui/dialog/object-properties.cpp | 82 +++++++++++++++++++++++++++++- src/ui/dialog/object-properties.h | 8 +++ 8 files changed, 161 insertions(+), 36 deletions(-) diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 6d159d265..d7d692091 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -26,23 +26,34 @@ namespace Internal { SPDocument * GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) { - // determine whether the image should be embedded - // TODO: this logic seems very wrong - bool embed = false; + // Determine whether the image should be embedded Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring attr = prefs->getString("/dialogs/import/link"); - if (strcmp(attr.c_str(), "embed") == 0) { - embed = true; - } else if (strcmp(attr.c_str(), "link") == 0) { - embed = false; - } else { - embed = (strcmp(mod->get_param_optiongroup("link"), "embed") == 0); - if (mod->get_param_bool("ask")) { - prefs->setString("/dialogs/import/link", mod->get_param_optiongroup("link")); - mod->set_param_bool("ask", false); + bool ask = prefs->getBool("/dialogs/import/ask"); + Glib::ustring link = prefs->getString("/dialogs/import/link"); + Glib::ustring scale = prefs->getString("/dialogs/import/scale"); + // std::cout << "GkdpixbufInput::open: " + // << " ask: " << ask + // << ", link: " << link + // << ", scale: " << scale << std::endl; + // std::cout << " in preferences: " + // << " ask: " << !mod->get_param_bool("do_not_ask") + // << ", link: " << mod->get_param_optiongroup("link") + // << ", scale: " << mod->get_param_optiongroup("scale") << std::endl; + if( ask ) { + Glib::ustring mod_link = mod->get_param_optiongroup("link"); + Glib::ustring mod_scale = mod->get_param_optiongroup("scale"); + if( link.compare( mod_link ) != 0 ) { + link = mod_link; + } + prefs->setString("/dialogs/import/link", link ); + if( scale.compare( mod_scale ) != 0 ) { + scale = mod_scale; } + prefs->setString("/dialogs/import/scale", scale ); + prefs->setBool("/dialogs/import/ask", !mod->get_param_bool("do_not_ask") ); } - + bool embed = ( link.compare( "embed" ) == 0 ); + SPDocument *doc = NULL; boost::scoped_ptr pb(Inkscape::Pixbuf::create_from_file(uri)); @@ -84,6 +95,12 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) Inkscape::XML::Node *image_node = xml_doc->createElement("svg:image"); sp_repr_set_svg_double(image_node, "width", width); sp_repr_set_svg_double(image_node, "height", height); + if( scale.compare( "auto" ) != 0 ) { + SPCSSAttr *css = sp_repr_css_attr_new(); + sp_repr_css_set_property(css, "image-rendering", scale.c_str()); + sp_repr_css_set(image_node, css, "style"); + sp_repr_css_attr_unref( css ); + } if (embed) { sp_embed_image(image_node, pb.get()); @@ -155,12 +172,21 @@ GdkpixbufInput::init(void) "\n" "%s\n" "org.inkscape.input.gdkpixbuf.%s\n" + "\n" "<_option value='embed' >" N_("Embed") "\n" "<_option value='link' >" N_("Link") "\n" "\n" "<_param name='help' type='description'>" N_("Embed results in stand-alone, larger SVG files. Link references a file outside this SVG document and all files must be moved together.") "\n" - "false\n" + + "\n" + "<_option value='auto' >" N_("None (auto)") "\n" + "<_option value='optimizeQuality' >" N_("Smooth (optimizeQuality)") "\n" + "<_option value='optimizeSpeed' >" N_("Blocky (optimizeSpeed)") "\n" + "\n" + "<_param name='help' type='description'>" N_("When an image is upscaled, apply smoothing or keep blocky (pixelated). (Will not work in all browsers.)") "\n" + + "false\n" "\n" ".%s\n" "%s\n" diff --git a/src/extension/system.cpp b/src/extension/system.cpp index c0211032c..7a50826ca 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -97,9 +97,9 @@ SPDocument *open(Extension *key, gchar const *filename) bool show = true; if (strlen(imod->get_id()) > 27) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring attr = prefs->getString("/dialogs/import/link"); + bool ask = prefs->getBool("/dialogs/import/ask"); Glib::ustring id = Glib::ustring(imod->get_id(), 28); - if (strcmp(attr.c_str(), "ask") != 0 and strcmp(id.c_str(), "org.inkscape.input.gdkpixbuf") == 0) { + if (!ask and id.compare( "org.inkscape.input.gdkpixbuf") == 0) { show = false; imod->set_gui(false); } diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 17b912d33..ebc5386e3 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -197,7 +197,7 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" -" \n" +" \n" " \n" " \n" " \n" @@ -279,7 +279,6 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" -" \n" " \n" " \n" " \n" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index e9cf2e753..03108b403 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1419,34 +1419,43 @@ void InkscapePreferences::initPageRendering() void InkscapePreferences::initPageBitmaps() { - { - Glib::ustring labels[] = {_("None"), _("2x2"), _("4x4"), _("8x8"), _("16x16")}; - int values[] = {0, 1, 2, 3, 4}; - _misc_overs_bitmap.set_size_request(_sb_width); - _misc_overs_bitmap.init("/options/bitmapoversample/value", labels, values, G_N_ELEMENTS(values), 1); - _page_bitmaps.add_line( false, _("Oversample bitmaps:"), _misc_overs_bitmap, "", "", false); - } - + /* Note: /options/bitmapoversample removed with Cairo renderer */ + _page_bitmaps.add_group_header( _("Edit")); _misc_bitmap_autoreload.init(_("Automatically reload bitmaps"), "/options/bitmapautoreload/value", true); _page_bitmaps.add_line( false, "", _misc_bitmap_autoreload, "", _("Automatically reload linked images when file is changed on disk")); _misc_bitmap_editor.init("/options/bitmapeditor/value", true); _page_bitmaps.add_line( false, _("_Bitmap editor:"), _misc_bitmap_editor, "", "", true); + + _page_bitmaps.add_group_header( _("Export")); _importexport_export_res.init("/dialogs/export/defaultxdpi/value", 0.0, 6000.0, 1.0, 1.0, Inkscape::Util::Quantity::convert(1, "in", "px"), true, false); _page_bitmaps.add_line( false, _("Default export _resolution:"), _importexport_export_res, _("dpi"), _("Default bitmap resolution (in dots per inch) in the Export dialog"), false); + _page_bitmaps.add_group_header( _("Create")); _bitmap_copy_res.init("/options/createbitmap/resolution", 1.0, 6000.0, 1.0, 1.0, Inkscape::Util::Quantity::convert(1, "in", "px"), true, false); _page_bitmaps.add_line( false, _("Resolution for Create Bitmap _Copy:"), _bitmap_copy_res, _("dpi"), _("Resolution used by the Create Bitmap Copy command"), false); + + _page_bitmaps.add_group_header( _("Import")); + _bitmap_ask.init(_("Ask about linking and scaling when importing"), "/dialogs/import/ask", true); + _page_bitmaps.add_line( true, "", _bitmap_ask, "", + _("Pop-up linking and scaling dialog when importing bitmap image.")); + { - Glib::ustring labels[] = {_("Always embed"), _("Always link"), _("Ask")}; - Glib::ustring values[] = {"embed", "link", "ask"}; - _bitmap_import.init("/dialogs/import/link", labels, values, G_N_ELEMENTS(values), "ask"); - _page_bitmaps.add_line( false, _("Bitmap import:"), _bitmap_import, "", "", false); + Glib::ustring labels[] = {_("Embed"), _("Link")}; + Glib::ustring values[] = {"embed", "link"}; + _bitmap_link.init("/dialogs/import/link", labels, values, G_N_ELEMENTS(values), "link"); + _page_bitmaps.add_line( false, _("Bitmap link:"), _bitmap_link, "", "", false); + } - _bitmap_import_quality.init("/dialogs/import/quality", 1, 100, 1, 1, 100, true, false); - _page_bitmaps.add_line( false, _("Bitmap import quality:"), _bitmap_import_quality, "%", "Bitmap import quality (jpeg only). 100 is best quality", false); + { + Glib::ustring labels[] = {_("None (auto)"), _("Smooth (optimizeQuality)"), _("Blocky (optimizeSpeed)") }; + Glib::ustring values[] = {"auto", "optimizeQuality", "optimizeSpeed"}; + _bitmap_scale.init("/dialogs/import/scale", labels, values, G_N_ELEMENTS(values), "scale"); + _page_bitmaps.add_line( false, _("Bitmap scale (image-rendering):"), _bitmap_scale, "", "", false); } + + /* Note: /dialogs/import/quality removed use of in r12542 */ _importexport_import_res.init("/dialogs/import/defaultxdpi/value", 0.0, 6000.0, 1.0, 1.0, Inkscape::Util::Quantity::convert(1, "in", "px"), true, false); _page_bitmaps.add_line( false, _("Default _import resolution:"), _importexport_import_res, _("dpi"), _("Default bitmap resolution (in dots per inch) for bitmap import"), false); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 56222fb22..da85b805d 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -365,12 +365,14 @@ protected: UI::Widget::PrefCheckButton _spell_ignorenumbers; UI::Widget::PrefCheckButton _spell_ignoreallcaps; - + // Bitmaps UI::Widget::PrefCombo _misc_overs_bitmap; UI::Widget::PrefEntryFileButtonHBox _misc_bitmap_editor; UI::Widget::PrefCheckButton _misc_bitmap_autoreload; UI::Widget::PrefSpinButton _bitmap_copy_res; - UI::Widget::PrefCombo _bitmap_import; + UI::Widget::PrefCheckButton _bitmap_ask; + UI::Widget::PrefCombo _bitmap_link; + UI::Widget::PrefCombo _bitmap_scale; UI::Widget::PrefSpinButton _bitmap_import_quality; UI::Widget::PrefEntry _kb_search; diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index 9a7b91c57..cfa5c6182 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -67,6 +67,7 @@ static const SPAttrDesc image_desc[] = { { N_("Y:"), "y"}, { N_("Width:"), "width"}, { N_("Height:"), "height"}, + { N_("Image Rendering:"), "image-rendering"}, { NULL, NULL} }; diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index 8a2b0299a..82b2cf6b1 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -36,6 +36,8 @@ #include "selection.h" #include "desktop.h" #include "sp-item.h" +#include "sp-image.h" +#include "xml/repr.h" #include #if WITH_GTKMM_3_0 @@ -56,11 +58,12 @@ ObjectProperties::ObjectProperties (void) : #if WITH_GTKMM_3_0 TopTable(Gtk::manage(new Gtk::Grid())), #else - TopTable(Gtk::manage(new Gtk::Table(3, 4))), + TopTable(Gtk::manage(new Gtk::Table(4, 4))), #endif LabelID(_("_ID:"), 1), LabelLabel(_("_Label:"), 1), LabelTitle(_("_Title:"),1), + LabelImageRendering(_("_Image Rendering:"),1), LabelDescription(_("_Description:"),1), FrameDescription("", FALSE), HBoxCheck(FALSE, 0), @@ -248,6 +251,39 @@ void ObjectProperties::MakeWidget(void) FrameTextDescription.add (TextViewDescription); TextViewDescription.add_mnemonic_label(LabelDescription); + /* Image rendering */ + /* Create the label for the object ImageRendering */ + LabelImageRendering.set_label (LabelImageRendering.get_label() + " "); + LabelImageRendering.set_alignment (1, 0.5); + +#if WITH_GTKMM_3_0 + LabelImageRendering.set_valign(Gtk::ALIGN_CENTER); + TopTable->attach(LabelImageRendering, 0, 3, 1, 1); +#else + TopTable->attach(LabelImageRendering, 0, 1, 3, 4, + Gtk::SHRINK | Gtk::FILL, + Gtk::AttachOptions(), 0, 0 ); +#endif + + /* Create the combo box text for the 'image-rendering' property */ + ComboBoxTextImageRendering.append( "auto" ); + ComboBoxTextImageRendering.append( "optimizeQuality" ); + ComboBoxTextImageRendering.append( "optimizeSpeed" ); + ComboBoxTextImageRendering.set_tooltip_text (_("The 'image-rendering' property can influence how a bitmap is up-scaled:\n\t'auto' no preference;\n\t'optimizeQuality' smooth;\n\t'optimizeSpeed' blocky.\nNote that this behaviour is not defined in the SVG 1.1 specification and not all browsers follow this interpretation.")); + +#if WITH_GTKMM_3_0 + ComboBoxTextImageRendering.set_valign(Gtk::ALIGN_CENTER); + TopTable->attach(ComboBoxTextImageRendering, 1, 3, 1, 1); +#else + TopTable->attach(ComboBoxTextImageRendering, 1, 2, 3, 4, + Gtk::EXPAND | Gtk::FILL, + Gtk::AttachOptions(), 0, 0 ); +#endif + + LabelImageRendering.set_mnemonic_widget (ComboBoxTextImageRendering); + + ComboBoxTextImageRendering.signal_changed().connect(sigc::mem_fun(this, &ObjectProperties::image_rendering_changed)); + /* Check boxes */ contents->pack_start (HBoxCheck, FALSE, FALSE, 0); CheckTable->set_border_width(4); @@ -376,6 +412,24 @@ void ObjectProperties::widget_setup(void) } EntryTitle.set_sensitive(TRUE); + /* Image Rendering */ + if( SP_IS_IMAGE( item ) ) { + ComboBoxTextImageRendering.show(); + LabelImageRendering.show(); + char const *str = obj->getStyleProperty( "image-rendering", "auto" ); + if( strcmp( str, "auto" ) == 0 ) { + ComboBoxTextImageRendering.set_active(0); + } else if( strcmp( str, "optimizeQuality" ) == 0 ) { + ComboBoxTextImageRendering.set_active(1); + } else { + ComboBoxTextImageRendering.set_active(2); + } + } else { + ComboBoxTextImageRendering.hide(); + ComboBoxTextImageRendering.unset_active(); + LabelImageRendering.hide(); + } + /* Description */ gchar *desc = obj->desc(); if (desc) { @@ -459,6 +513,32 @@ void ObjectProperties::label_changed(void) blocked = false; } +void ObjectProperties::image_rendering_changed(void) +{ + if (blocked) + { + return; + } + + SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + g_return_if_fail (item != NULL); + + blocked = true; + + Glib::ustring scale = ComboBoxTextImageRendering.get_active_text(); + + // We should unset if the parent computed value is auto and the desired value is auto. + SPCSSAttr *css = sp_repr_css_attr_new(); + sp_repr_css_set_property(css, "image-rendering", scale.c_str()); + Inkscape::XML::Node *image_node = item->getRepr(); + if( image_node ) { + sp_repr_css_change(image_node, css, "style"); + } + sp_repr_css_attr_unref( css ); + + blocked = false; +} + void ObjectProperties::sensitivity_toggled (void) { if (blocked) diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h index 624a18246..721c12c56 100644 --- a/src/ui/dialog/object-properties.h +++ b/src/ui/dialog/object-properties.h @@ -41,6 +41,7 @@ #include #include #include +#include #include "ui/dialog/desktop-tracker.h" @@ -96,6 +97,8 @@ private: Gtk::Entry EntryLabel; //the entry for the object label Gtk::Label LabelTitle; //the label for the object title Gtk::Entry EntryTitle; //the entry for the object title + Gtk::Label LabelImageRendering; // the label for 'image-rendering' + Gtk::ComboBoxText ComboBoxTextImageRendering; // the combo box text for 'image-rendering' Gtk::Label LabelDescription; //the label for the object description UI::Widget::Frame FrameDescription; //the frame for the object description @@ -134,6 +137,11 @@ private: */ void label_changed(void); + /** + * Callback for 'image-rendering'. + */ + void image_rendering_changed(void); + /** * Callback for checkbox Lock. */ -- cgit v1.2.3 From d2f932ed15e276fda44e80d5d6139ed42c0f706a Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 19 Nov 2013 13:38:19 +0100 Subject: Increased pattern resolution to fix blocker bug #1251039. (bzr r12824) --- src/sp-pattern.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 213b57559..ad5449f34 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -665,7 +665,8 @@ cairo_pattern_t* SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b // the scaling component from the complete matrix and use it // to find the optimum tile size for rendering // c is number of pixels in buffer x and y. - Geom::Point c(pattern_tile.dimensions()*vb2ps.descrim()*ps2user.descrim()*full.descrim()*1.1); + // Scale factor of 1.1 is too small... see bug #1251039 + Geom::Point c(pattern_tile.dimensions()*vb2ps.descrim()*ps2user.descrim()*full.descrim()*2.0); c[Geom::X] = ceil(c[Geom::X]); c[Geom::Y] = ceil(c[Geom::Y]); -- cgit v1.2.3 From 31874237bd212ff8a933da4b71aa33569a077501 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 19 Nov 2013 20:33:30 +0100 Subject: BalloonSymbols.svg rewritten. Balloon symbols should render properly in all browsers. (bzr r12825) --- share/symbols/BalloonSymbols.svg | 261 ++++++++++++++++++++------------------- 1 file changed, 136 insertions(+), 125 deletions(-) diff --git a/share/symbols/BalloonSymbols.svg b/share/symbols/BalloonSymbols.svg index 8c7e840e2..0244f2f3a 100644 --- a/share/symbols/BalloonSymbols.svg +++ b/share/symbols/BalloonSymbols.svg @@ -1,128 +1,139 @@ - + + Word Balloons + Ballons for holding text. + + + + image/svg+xml + + Word Balloons + 2013-04-22 + + + Martin Owens, Tavmjong Bah + + + + + Public Domain + + + English + + + word + balloon + comic + cartoon + speach + exclaim + + + + + + + + + + + + + + + Thought Balloon + + + + + + + + + + + + + Dream Speaking + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -Word Balloons - - -Exclaim Balloon - - - -Exclaim Balloon!! - -Speaking Dream - - - - - -Dream Speaking - - -Squared Balloon - - - - - -Squared Balloon - - -Rounded Balloon - - - - - -Rounded Balloon - - -Cricle Balloon - - - - - -Circle Balloon - - -Hip Balloon - - - - - -Hip Balloon - - -Electronic Balloon - - - - - -Over the Phone - - -Thought Balloon - - - - - -Think Balloon - - - - - - - - -image/svg+xml - -Word Balloons -2013-04-22 - - -Martin Owens - - - - -Public Domain - - -English - - -word -balloon -comic -cartoon -speach -exclaim - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3