diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-09-13 14:17:00 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-09-13 14:17:00 +0000 |
| commit | 6496875e6e3b594c5b1d4f412a23c7dc1c6aee18 (patch) | |
| tree | 8e587b7331b4b0737ee6f20df1f7602756b9d4cc /src | |
| parent | update POTFILES.in (diff) | |
| parent | Fix a meassure tooltip updated pointed by maren at hacfest, tooltip is not up... (diff) | |
| download | inkscape-6496875e6e3b594c5b1d4f412a23c7dc1c6aee18.tar.gz inkscape-6496875e6e3b594c5b1d4f412a23c7dc1c6aee18.zip | |
Merge branch 'master' of gitlab.com:inkscape/inkscape
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/cairo-utils.cpp | 12 | ||||
| -rw-r--r-- | src/display/cairo-utils.h | 4 | ||||
| -rw-r--r-- | src/extension/internal/svg.cpp | 6 | ||||
| -rw-r--r-- | src/object/sp-image.cpp | 18 | ||||
| -rw-r--r-- | src/ui/tools/measure-tool.cpp | 14 | ||||
| -rw-r--r-- | src/ui/tools/measure-tool.h | 1 |
6 files changed, 32 insertions, 23 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index 7279ac052..965645b15 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -207,7 +207,7 @@ Pixbuf::~Pixbuf() } } -Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data, char const *svgdpi) +Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data, double svgdpi) { Pixbuf *pixbuf = nullptr; @@ -311,8 +311,8 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data, char const *svgdpi) } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); double dpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", 96.0); - if (svgdpi && atof(svgdpi) > 0) { - dpi = atof(svgdpi); + if (svgdpi && svgdpi > 0) { + dpi = svgdpi; } std::cout << dpi << "dpi" << std::endl; // Get the size of the document @@ -342,7 +342,7 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data, char const *svgdpi) return pixbuf; } -Pixbuf *Pixbuf::create_from_file(std::string const &fn, char const *svgdpi) +Pixbuf *Pixbuf::create_from_file(std::string const &fn, double svgdpi) { Pixbuf *pb = nullptr; // test correctness of filename @@ -387,8 +387,8 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn, char const *svgdpi) } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); double dpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", 96.0); - if (svgdpi && atof(svgdpi) > 0) { - dpi = atof(svgdpi); + if (svgdpi && svgdpi > 0) { + dpi = svgdpi; } std::cout << dpi << "dpi" << std::endl; // Get the size of the document diff --git a/src/display/cairo-utils.h b/src/display/cairo-utils.h index 256bda94c..ada78ce51 100644 --- a/src/display/cairo-utils.h +++ b/src/display/cairo-utils.h @@ -117,8 +117,8 @@ public: PixelFormat pixelFormat() const { return _pixel_format; } void ensurePixelFormat(PixelFormat fmt); - static Pixbuf *create_from_data_uri(gchar const *uri, char const *svgdpi = NULL); - static Pixbuf *create_from_file(std::string const &fn, char const *svgddpi = NULL); + static Pixbuf *create_from_data_uri(gchar const *uri, double svgdpi = 0); + static Pixbuf *create_from_file(std::string const &fn, double svgddpi = 0); private: void _ensurePixelsARGB32(); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index d39f5a960..e4586ec5f 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -245,8 +245,8 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) // Added 11 Feb 2014 as we now honor "preserveAspectRatio" and this is // what Inkscaper's expect. image_node->setAttribute("preserveAspectRatio", "none"); - Glib::ustring svgdpi = Glib::ustring::format(mod->get_param_float("svgdpi")); - image_node->setAttribute("inkscape:svg-dpi", svgdpi.c_str()); + double svgdpi = mod->get_param_float("svgdpi"); + image_node->setAttribute("inkscape:svg-dpi", Glib::ustring::format(svgdpi).c_str()); image_node->setAttribute("width", Glib::ustring::format(width)); image_node->setAttribute("height", Glib::ustring::format(height)); Glib::ustring scale = prefs->getString("/dialogs/import/scale"); @@ -258,7 +258,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) } // convert filename to uri if (embed) { - std::unique_ptr<Inkscape::Pixbuf> pb(Inkscape::Pixbuf::create_from_file(uri, svgdpi.c_str())); + std::unique_ptr<Inkscape::Pixbuf> pb(Inkscape::Pixbuf::create_from_file(uri, svgdpi)); if(pb) { sp_embed_svg(image_node, uri); } diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp index 9c2fe9ac3..65643c701 100644 --- a/src/object/sp-image.cpp +++ b/src/object/sp-image.cpp @@ -73,7 +73,7 @@ static void sp_image_set_curve(SPImage *image); static Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absref, gchar const *base, - char const *svgdpi); + double svgdpi = 0); static void sp_image_update_arenaitem (SPImage *img, Inkscape::DrawingImage *ai); static void sp_image_update_canvas_image (SPImage *image); @@ -338,11 +338,11 @@ void SPImage::update(SPCtx *ctx, unsigned int flags) { this->pixbuf = nullptr; if (this->href) { Inkscape::Pixbuf *pixbuf = nullptr; - const gchar *svgdpi = this->getRepr()->attribute("inkscape:svg-dpi"); - if (!svgdpi) { - svgdpi = "96"; + double svgdpi = 96; + if (this->getRepr()->attribute("inkscape:svg-dpi")) { + svgdpi = atof(this->getRepr()->attribute("inkscape:svg-dpi")); } - this->dpi = atof(svgdpi); + this->dpi = svgdpi; pixbuf = sp_image_repr_read_image(this->getRepr()->attribute("xlink:href"), this->getRepr()->attribute("sodipodi:absref"), doc->getBase(), svgdpi); @@ -545,9 +545,9 @@ gchar* SPImage::description() const { this->document) { Inkscape::Pixbuf * pb = nullptr; - const gchar *svgdpi = this->getRepr()->attribute("inkscape:svg-dpi"); - if (!svgdpi) { - svgdpi = "96"; + double svgdpi = 96; + if (this->getRepr()->attribute("inkscape:svg-dpi")) { + svgdpi = atof(this->getRepr()->attribute("inkscape:svg-dpi")); } pb = sp_image_repr_read_image(this->getRepr()->attribute("xlink:href"), this->getRepr()->attribute("sodipodi:absref"), this->document->getBase(), svgdpi); @@ -573,7 +573,7 @@ Inkscape::DrawingItem* SPImage::show(Inkscape::Drawing &drawing, unsigned int /* return ai; } -Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absref, gchar const *base, char const *svgdpi) +Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absref, gchar const *base, double svgdpi) { Inkscape::Pixbuf *inkpb = nullptr; diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 75335ce1a..9191af081 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -339,6 +339,7 @@ MeasureTool::MeasureTool() start_p = readMeasurePoint(true); end_p = readMeasurePoint(false); dimension_offset = 35; + last_pos = Geom::Point(0,0); // create the knots this->knot_start = new SPKnot(desktop, _("Measure start, <b>Shift+Click</b> for position dialog")); this->knot_start->setMode(SP_KNOT_MODE_XOR); @@ -587,6 +588,13 @@ bool MeasureTool::root_handler(GdkEvent* event) if ((event->key.keyval == GDK_KEY_Shift_L) || (event->key.keyval == GDK_KEY_Shift_R)) { explicit_base_tmp = explicit_base; explicit_base = end_p; + showInfoBox(last_pos, true); + } + break; + } + case GDK_KEY_RELEASE: { + if ((event->key.keyval == GDK_KEY_Shift_L) || (event->key.keyval == GDK_KEY_Shift_R)) { + showInfoBox(last_pos, false); } break; } @@ -605,11 +613,11 @@ bool MeasureTool::root_handler(GdkEvent* event) snap_manager.preSnap(scp); snap_manager.unSetup(); } - Geom::Point const motion_w(event->motion.x, event->motion.y); + last_pos = Geom::Point(event->motion.x, event->motion.y); if(event->motion.state & GDK_SHIFT_MASK) { - showInfoBox(motion_w, true); + showInfoBox(last_pos, true); } else { - showInfoBox(motion_w, false); + showInfoBox(last_pos, false); } } else { SPDesktop *desktop = SP_ACTIVE_DESKTOP; diff --git a/src/ui/tools/measure-tool.h b/src/ui/tools/measure-tool.h index f87ac2c81..0fb488948 100644 --- a/src/ui/tools/measure-tool.h +++ b/src/ui/tools/measure-tool.h @@ -77,6 +77,7 @@ private: gint dimension_offset; Geom::Point start_p; Geom::Point end_p; + Geom::Point last_pos; std::vector<SPCanvasItem *> measure_tmp_items; std::vector<SPCanvasItem *> measure_phantom_items; std::vector<SPCanvasItem *> measure_item; |
