diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-04-09 10:45:20 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-04-09 10:45:20 +0000 |
| commit | f0c6ea33bcb5a03352f6276bac82d56c39c3f5fe (patch) | |
| tree | 28159b96674a5c003fb36948ff04f3eaae3ec864 /src | |
| parent | Refactor of end anchors. (diff) | |
| parent | Make extension tests compatible with VPATH builds. (diff) | |
| download | inkscape-f0c6ea33bcb5a03352f6276bac82d56c39c3f5fe.tar.gz inkscape-f0c6ea33bcb5a03352f6276bac82d56c39c3f5fe.zip | |
update to trunk
(bzr r11950.1.326)
Diffstat (limited to 'src')
| -rw-r--r-- | src/2geom/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/2geom/path.cpp | 6 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/Makefile.am | 4 | ||||
| -rw-r--r-- | src/color-profile.cpp | 10 | ||||
| -rw-r--r-- | src/extension/internal/svg.cpp | 55 | ||||
| -rw-r--r-- | src/filter-chemistry.cpp | 5 | ||||
| -rw-r--r-- | src/main.cpp | 28 | ||||
| -rw-r--r-- | src/preferences-skeleton.h | 1 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 27 | ||||
| -rw-r--r-- | src/sp-object.cpp | 17 | ||||
| -rw-r--r-- | src/sp-object.h | 5 | ||||
| -rw-r--r-- | src/text-editing.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/align-and-distribute.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/dialog-manager.cpp | 9 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 25 | ||||
| -rw-r--r-- | src/util/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/util/Makefile_insert | 1 | ||||
| -rw-r--r-- | src/verbs.cpp | 21 |
19 files changed, 139 insertions, 86 deletions
diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt index b1c30f678..3d516dc18 100644 --- a/src/2geom/CMakeLists.txt +++ b/src/2geom/CMakeLists.txt @@ -21,6 +21,7 @@ set(2geom_SRC nearest-point.cpp numeric/matrix.cpp path-intersection.cpp + path-sink.cpp path.cpp pathvector.cpp piecewise.cpp @@ -43,7 +44,6 @@ set(2geom_SRC solve-bezier-parametric.cpp svg-elliptical-arc.cpp svg-path-parser.cpp - svg-path.cpp sweep.cpp toposweep.cpp transforms.cpp diff --git a/src/2geom/path.cpp b/src/2geom/path.cpp index 5797f475c..fc4d72028 100644 --- a/src/2geom/path.cpp +++ b/src/2geom/path.cpp @@ -104,12 +104,14 @@ Path &Path::operator*=(Affine const &m) { } Path &Path::operator*=(Translate const &m) { +/* Somehow there is something wrong here, LPE Construct grid fails with this code unshare(); Sequence::iterator last = get_curves().end() - 1; Sequence::iterator it; Point prev; for (it = get_curves().begin() ; it != last ; ++it) { - *(const_cast<Curve*>(&**it)) *= m; + //*(const_cast<Curve*>(&**it)) *= m; + const_cast<Curve*>(it->get())->operator*=(m); if ( it != get_curves().begin() && (*it)->initialPoint() != prev ) { THROW_CONTINUITYERROR(); } @@ -124,6 +126,8 @@ Path &Path::operator*=(Translate const &m) { } } return *this; +*/ + return this->operator*=(static_cast<Affine>(m)); } std::vector<double> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e1e0afa79..8408d6270 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -485,7 +485,6 @@ list(APPEND inkscape_SRC add_subdirectory(debug) add_subdirectory(dialogs) add_subdirectory(display) -add_subdirectory(dom) add_subdirectory(extension) add_subdirectory(filters) add_subdirectory(helper) @@ -539,7 +538,6 @@ target_link_libraries(inkscape #sp_LIB # annoying, we need both! nrtype_LIB # annoying, we need both! - dom_LIB croco_LIB avoid_LIB gdl_LIB diff --git a/src/Makefile.am b/src/Makefile.am index d3f8794ee..d5439f0ea 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -250,7 +250,9 @@ check_PROGRAMS = cxxtests # "make distcheck". # List of all tests to be run. -TESTS = $(check_PROGRAMS) ../share/extensions/test/run-all-extension-tests +TESTS = $(check_PROGRAMS) +check-local: + $(top_srcdir)/share/extensions/test/run-all-extension-tests # FIXME: Currently, a number of cxxtest tests fail. These should be fixed and # the XFAIL_TESTS build target should be removed. diff --git a/src/color-profile.cpp b/src/color-profile.cpp index ed4b9029e..aa0750c00 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -322,17 +322,15 @@ void ColorProfile::set(unsigned key, gchar const *value) { } //# 1. Get complete URI of document gchar const *docbase = doc->getURI(); - if (!docbase) - { - // Normal for files that have not yet been saved. - docbase = ""; - } gchar* escaped = g_uri_escape_string(this->href, "!*'();:@=+$,/?#[]", TRUE); //g_message("docbase:%s\n", docbase); //org::w3c::dom::URI docUri(docbase); - Inkscape::URI docUri(docbase); + Inkscape::URI docUri(""); + if (docbase) { // The file has already been saved + docUri = Inkscape::URI::from_native_filename(docbase); + } //# 2. Get href of icc file. we don't care if it's rel or abs //org::w3c::dom::URI hrefUri(escaped); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 8b272af60..a94bc2141 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -24,6 +24,7 @@ #include "extension/output.h" #include <vector> #include "xml/attribute-record.h" +#include "xml/simple-document.h" #include "sp-root.h" #include "document.h" @@ -42,27 +43,37 @@ using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; using Inkscape::XML::Node; - - -static void pruneExtendedAttributes( Inkscape::XML::Node *repr ) +/* + * Removes all sodipodi and inkscape elements and attributes from an xml tree. + * used to make plain svg output. + */ +static void pruneExtendedNamespaces( Inkscape::XML::Node *repr ) { if (repr) { if ( repr->type() == Inkscape::XML::ELEMENT_NODE ) { - std::vector<gchar const*> toBeRemoved; + std::vector<gchar const*> attrsRemoved; for ( List<AttributeRecord const> it = repr->attributeList(); it; ++it ) { const gchar* attrName = g_quark_to_string(it->key); if ((strncmp("inkscape:", attrName, 9) == 0) || (strncmp("sodipodi:", attrName, 9) == 0)) { - toBeRemoved.push_back(attrName); + attrsRemoved.push_back(attrName); } } // Can't change the set we're interating over while we are iterating. - for ( std::vector<gchar const*>::iterator it = toBeRemoved.begin(); it != toBeRemoved.end(); ++it ) { + for ( std::vector<gchar const*>::iterator it = attrsRemoved.begin(); it != attrsRemoved.end(); ++it ) { repr->setAttribute(*it, 0); } } + std::vector<Inkscape::XML::Node *> nodesRemoved; for ( Node *child = repr->firstChild(); child; child = child->next() ) { - pruneExtendedAttributes(child); + if((strncmp("inkscape:", child->name(), 9) == 0) || strncmp("sodipodi:", child->name(), 9) == 0) { + nodesRemoved.push_back(child); + } else { + pruneExtendedNamespaces(child); + } + } + for ( std::vector<Inkscape::XML::Node *>::iterator it = nodesRemoved.begin(); it != nodesRemoved.end(); ++it ) { + repr->removeChild(*it); } } } @@ -229,24 +240,34 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena { g_return_if_fail(doc != NULL); g_return_if_fail(filename != NULL); + Inkscape::XML::Document *rdoc = doc->rdoc; 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)); - Inkscape::XML::Document *rdoc = NULL; - Inkscape::XML::Node *repr = NULL; - if (exportExtensions) { - repr = doc->getReprRoot(); - } else { - rdoc = sp_repr_document_new ("svg:svg"); - repr = rdoc->root(); - repr = doc->getRoot()->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); + 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. + Inkscape::XML::Document *new_rdoc = new Inkscape::XML::SimpleDocument(); + + // Comments and PI nodes are not included in this duplication + // TODO: Move this code into xml/document.h and duplicate rdoc instead of root. + new_rdoc->setAttribute("version", "1.0"); + new_rdoc->setAttribute("standalone", "no"); + + // Get a new xml repr for the svg root node + Inkscape::XML::Node *root = rdoc->root()->duplicate(new_rdoc); + + // Add the duplicated svg node as the document's rdoc + new_rdoc->appendChild(root); + Inkscape::GC::release(root); - pruneExtendedAttributes(repr); + pruneExtendedNamespaces(root); + rdoc = new_rdoc; } - if (!sp_repr_save_rebased_file(repr->document(), filename, SP_SVG_NS_URI, + if (!sp_repr_save_rebased_file(rdoc, filename, SP_SVG_NS_URI, doc->getBase(), filename)) { throw Inkscape::Extension::Output::save_failed(); } diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index 0f9138560..151480177 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -378,6 +378,11 @@ SPFilter *modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *it } SPFilter *filter = SP_FILTER(item->style->getFilter()); + if (!filter) { + // We reach here when filter.set is true, but the href is not found in the document + return new_filter_simple_from_item(document, item, "normal", radius); + } + Inkscape::XML::Document *xml_doc = document->getReprDoc(); // If there are more users for this filter, duplicate it diff --git a/src/main.cpp b/src/main.cpp index 00d0fcbb6..6f4add4b1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1145,7 +1145,8 @@ static int sp_process_file_list(GSList *fl) if (!sp_export_svg && (sp_vacuum_defs || has_performed_actions)) { // save under the name given in the command line - sp_repr_save_file(doc->rdoc, filename, SP_SVG_NS_URI); + Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, filename, false, + false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); } if (sp_global_printer) { sp_print_document_to_file(doc, sp_global_printer); @@ -1176,14 +1177,25 @@ static int sp_process_file_list(GSList *fl) g_slist_free (selected); g_slist_free (to_select); } + if(sp_export_id) { + doc->ensureUpToDate(); - Inkscape::XML::Document *rdoc; - Inkscape::XML::Node *repr; - rdoc = sp_repr_document_new("svg:svg"); - repr = rdoc->root(); - repr = doc->getRoot()->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); - sp_repr_save_rebased_file(repr->document(), sp_export_svg, SP_SVG_NS_URI, - doc->getBase(), sp_export_svg); + // "crop" the document to the specified object, cleaning as we go. + SPObject *obj = doc->getObjectById(sp_export_id); + Geom::OptRect const bbox(SP_ITEM(obj)->visualBounds()); + + if (bbox) { + doc->fitToRect(*bbox, false); + } + + if (sp_export_id_only) { + // If -j then remove all other objects to complete the "crop" + doc->getRoot()->cropToObject(obj); + } + } + + Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false, + false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY); } if (sp_export_ps) { retVal |= do_export_ps_pdf(doc, sp_export_ps, "image/x-postscript"); diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 2211baddb..96629f22d 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -293,6 +293,7 @@ static char const preferences_skeleton[] = #ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs " <group id=\"dialogsontopwin32\" value=\"0\"/>\n" #endif +" <group id=\"defaultwindowsize\" value=\"2\" />\n" " <group id=\"arenatilescachesize\" value=\"8192\"/>\n" " <group id=\"preservetransform\" value=\"0\"/>\n" " <group id=\"clonecompensation\" value=\"1\"/>\n" diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 666c79e49..7dd14f5d9 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -50,20 +50,21 @@ typedef std::list<std::string> HRefList; static std::string patheffectlist_write_svg(PathEffectList const & list); static std::string hreflist_write_svg(HRefList const & list); -SPLPEItem::SPLPEItem() : SPItem() { - this->path_effects_enabled = 1; - - this->path_effect_list = new PathEffectList(); - this->current_path_effect = NULL; - - this->lpe_modified_connection_list = new std::list<sigc::connection>(); +SPLPEItem::SPLPEItem() + : SPItem() + , path_effects_enabled(1) + , path_effect_list(new PathEffectList()) + , lpe_modified_connection_list(new std::list<sigc::connection>()) + , current_path_effect(NULL) + , lpe_helperpaths() +{ } SPLPEItem::~SPLPEItem() { } void SPLPEItem::build(SPDocument *document, Inkscape::XML::Node *repr) { - this->readAttr( "inkscape:path-effect" ); + this->readAttr( "inkscape:path-effect" ); SPItem::build(document, repr); } @@ -166,9 +167,9 @@ void SPLPEItem::set(unsigned int key, gchar const* value) { } void SPLPEItem::update(SPCtx* ctx, unsigned int flags) { - SPItem::update(ctx, flags); + SPItem::update(ctx, flags); - // update the helperpaths of all LPEs applied to the item + // update the helperpaths of all LPEs applied to the item // TODO: re-add for the new node tool } @@ -200,11 +201,11 @@ Inkscape::XML::Node* SPLPEItem::write(Inkscape::XML::Document *xml_doc, Inkscape */ bool SPLPEItem::performPathEffect(SPCurve *curve) { if (!this) { - return false; + return false; } if (!curve) { - return false; + return false; } if (this->hasPathEffect() && this->pathEffectsEnabled()) { @@ -259,7 +260,7 @@ bool SPLPEItem::performPathEffect(SPCurve *curve) { // CPPIFY: make pure virtual void SPLPEItem::update_patheffect(bool /*write*/) { - //throw; + //throw; } /** diff --git a/src/sp-object.cpp b/src/sp-object.cpp index be3a1ab9d..65228ec0a 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -460,6 +460,23 @@ void SPObject::deleteObject(bool propagate, bool propagate_descendants) sp_object_unref(this, NULL); } +void SPObject::cropToObject(SPObject *except) +{ + std::vector<SPObject*> toDelete; + for ( SPObject *child = this->firstChild(); child; child = child->getNext() ) { + if (SP_IS_ITEM(child)) { + if (child->isAncestorOf(except)) { + child->cropToObject(except); + } else if(child != except) { + toDelete.push_back(child); + } + } + } + for (std::size_t i = 0; i < toDelete.size(); ++i) { + (toDelete[i])->deleteObject(true, true); + } +} + void SPObject::attach(SPObject *object, SPObject *prev) { //g_return_if_fail(parent != NULL); diff --git a/src/sp-object.h b/src/sp-object.h index cf18d4523..9ce5629e6 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -465,6 +465,11 @@ public: } /** + * Removes all children except for the given object, it's children and it's ancesstors. + */ + void cropToObject(SPObject *except); + + /** * Connects a slot to be called when an object is deleted. * * This connects a slot to an object's internal delete signal, which is invoked when the object diff --git a/src/text-editing.cpp b/src/text-editing.cpp index cae123616..47964880c 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -776,7 +776,7 @@ sp_te_delete (SPItem *item, Inkscape::Text::Layout::iterator const &start, bool has_text_decoration = false; gchar const *root_style = (item)->getRepr()->attribute("style"); - if(strstr(root_style,"text-decoration"))has_text_decoration = true; + if(root_style && strstr(root_style,"text-decoration"))has_text_decoration = true; if (start_item == end_item) { // the quick case where we're deleting stuff all from the same string @@ -2035,7 +2035,7 @@ void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &sta roundtrippability. */ bool has_text_decoration = false; gchar const *root_style = (text)->getRepr()->attribute("style"); - if(strstr(root_style,"text-decoration"))has_text_decoration = true; + if(root_style && strstr(root_style,"text-decoration")) has_text_decoration = true; while (tidy_xml_tree_recursively(common_ancestor, has_text_decoration)){}; // if we only modified subobjects this won't have been automatically sent diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 6b4aeebb9..e02ccd3f1 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -1002,7 +1002,7 @@ AlignAndDistribute::AlignAndDistribute() _combo.append(_("Smallest object")); _combo.append(_("Page")); _combo.append(_("Drawing")); - _combo.append(_("Selection")); + _combo.append(_("Selection Area")); _combo.set_active(prefs->getInt("/dialogs/align/align-to", 6)); _combo.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_ref_change)); diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 47e1fdd30..d427e3590 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -96,6 +96,9 @@ DialogManager::DialogManager() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int dialogs_type = prefs->getIntLimited("/options/dialogtype/value", DOCK, 0, 1); + // The preferences dialog is broken, the DockBehavior code resizes it's floating window to the smallest size + registerFactory("InkscapePreferences", &create<InkscapePreferences, FloatingBehavior>); + if (dialogs_type == FLOATING) { registerFactory("AlignAndDistribute", &create<AlignAndDistribute, FloatingBehavior>); registerFactory("DocumentMetadata", &create<DocumentMetadata, FloatingBehavior>); @@ -106,7 +109,6 @@ DialogManager::DialogManager() { registerFactory("Find", &create<Find, FloatingBehavior>); registerFactory("Glyphs", &create<GlyphsPanel, FloatingBehavior>); registerFactory("IconPreviewPanel", &create<IconPreviewPanel, FloatingBehavior>); - registerFactory("InkscapePreferences", &create<InkscapePreferences, FloatingBehavior>); registerFactory("LayersPanel", &create<LayersPanel, FloatingBehavior>); registerFactory("LivePathEffect", &create<LivePathEffectEditor, FloatingBehavior>); registerFactory("Memory", &create<Memory, FloatingBehavior>); @@ -126,8 +128,8 @@ DialogManager::DialogManager() { registerFactory("TextFont", &create<TextEdit, FloatingBehavior>); registerFactory("SpellCheck", &create<SpellCheck, FloatingBehavior>); registerFactory("Export", &create<Export, FloatingBehavior>); - registerFactory("XmlTree", &create<XmlTree, FloatingBehavior>); registerFactory("CloneTiler", &create<CloneTiler, FloatingBehavior>); + registerFactory("XmlTree", &create<XmlTree, FloatingBehavior>); } else { @@ -140,7 +142,6 @@ DialogManager::DialogManager() { registerFactory("Find", &create<Find, DockBehavior>); registerFactory("Glyphs", &create<GlyphsPanel, DockBehavior>); registerFactory("IconPreviewPanel", &create<IconPreviewPanel, DockBehavior>); - registerFactory("InkscapePreferences", &create<InkscapePreferences, DockBehavior>); registerFactory("LayersPanel", &create<LayersPanel, DockBehavior>); registerFactory("LivePathEffect", &create<LivePathEffectEditor, DockBehavior>); registerFactory("Memory", &create<Memory, DockBehavior>); @@ -160,8 +161,8 @@ DialogManager::DialogManager() { registerFactory("TextFont", &create<TextEdit, DockBehavior>); registerFactory("SpellCheck", &create<SpellCheck, DockBehavior>); registerFactory("Export", &create<Export, DockBehavior>); - registerFactory("XmlTree", &create<XmlTree, DockBehavior>); registerFactory("CloneTiler", &create<CloneTiler, DockBehavior>); + registerFactory("XmlTree", &create<XmlTree, DockBehavior>); } } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 67e788e21..2674efc1e 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1236,23 +1236,16 @@ void DocumentProperties::removeEmbeddedScript(){ } } - const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); - while ( current ) { - if (current->data && SP_IS_OBJECT(current->data)) { - SPObject* obj = SP_OBJECT(current->data); - if (id == obj->getId()){ - - //XML Tree being used directly here while it shouldn't be. - Inkscape::XML::Node *repr = obj->getRepr(); - if (repr){ - sp_repr_unparent(repr); - - // inform the document, so we can undo - DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script")); - } - } + SPObject* obj = SP_ACTIVE_DOCUMENT->getObjectById(id); + if (obj) { + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node *repr = obj->getRepr(); + if (repr){ + sp_repr_unparent(repr); + + // inform the document, so we can undo + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script")); } - current = g_slist_next(current); } populate_script_lists(); diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index cfccfa94d..924cab355 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -5,6 +5,7 @@ set(util_SRC expression-evaluator.cpp share.cpp units.cpp + ziptool.cpp # ------- diff --git a/src/util/Makefile_insert b/src/util/Makefile_insert index 7169fa8f7..6d2e63278 100644 --- a/src/util/Makefile_insert +++ b/src/util/Makefile_insert @@ -31,6 +31,7 @@ ink_common_sources += \ util/reverse-list.h \ util/share.h \ util/share.cpp \ + util/signal-blocker.h \ util/tuple.h \ util/ucompose.hpp \ util/units.cpp \ diff --git a/src/verbs.cpp b/src/verbs.cpp index fad090852..ab6c25973 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1777,6 +1777,13 @@ void ZoomVerb::perform(SPAction *action, void *data) gdouble zoom_inc = prefs->getDoubleLimited( "/options/zoomincrement/value", 1.414213562, 1.01, 10 ); + double zcorr = 1.0; + Glib::ustring abbr = prefs->getString("/options/zoomcorrection/unit"); + if (dt->namedview->doc_units && dt->namedview->doc_units->abbr == abbr) + zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); + + Geom::Rect const d = dt->get_display_area(); + switch (reinterpret_cast<std::size_t>(data)) { case SP_VERB_ZOOM_IN: { @@ -1792,7 +1799,6 @@ void ZoomVerb::perform(SPAction *action, void *data) } } - Geom::Rect const d = dt->get_display_area(); dt->zoom_relative( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], mul*zoom_inc); break; } @@ -1810,31 +1816,18 @@ void ZoomVerb::perform(SPAction *action, void *data) } } - Geom::Rect const d = dt->get_display_area(); dt->zoom_relative( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 1 / (mul*zoom_inc) ); break; } case SP_VERB_ZOOM_1_1: - { - double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); - Geom::Rect const d = dt->get_display_area(); dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 1.0 * zcorr ); break; - } case SP_VERB_ZOOM_1_2: - { - double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); - Geom::Rect const d = dt->get_display_area(); dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 0.5 * zcorr ); break; - } case SP_VERB_ZOOM_2_1: - { - double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); - Geom::Rect const d = dt->get_display_area(); dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 2.0 * zcorr ); break; - } case SP_VERB_ZOOM_PAGE: dt->zoom_page(); break; |
