diff --git a/share/keys/carbon.xml b/share/keys/carbon.xml index 6cce735b819021f9c7390255a38a3b6496689a85..2128f3555f11bc7e358c1401f4f6affb057759a4 100644 --- a/share/keys/carbon.xml +++ b/share/keys/carbon.xml @@ -98,7 +98,7 @@ See "inkscape.xml" for information about file structure. - + diff --git a/share/keys/inkscape.xml b/share/keys/inkscape.xml index 38ef26963204102ab9440b46b7704daadf6e78c0..ef57bae5b36ee358052c954379820a3fb69f5185 100644 --- a/share/keys/inkscape.xml +++ b/share/keys/inkscape.xml @@ -138,7 +138,7 @@ override) the bindings in the main default.xml. - + diff --git a/share/keys/right-handed-illustration.xml b/share/keys/right-handed-illustration.xml index 63e56cfdf68c2c196135789938e4208823cc5cfc..8d0923f46d13fe598d538a5b1c25106d003e0320 100644 --- a/share/keys/right-handed-illustration.xml +++ b/share/keys/right-handed-illustration.xml @@ -122,7 +122,7 @@ Future improvements: - + diff --git a/share/keys/xara.xml b/share/keys/xara.xml index a0826ab6e255ff3bf496c3cfd272df50a16754a1..cde7ba9a78b1cf952f8c05102c3ce342073a6ede 100644 --- a/share/keys/xara.xml +++ b/share/keys/xara.xml @@ -133,7 +133,7 @@ Hom/end keys-select minimum or maximum feather values - + diff --git a/share/ui/menus.ui b/share/ui/menus.ui index 74c05df7b55cb866744447a0efdd223bb73952c0..5e4b67b248e1f01055caac7f6c8b1ce9a0e8cc70 100644 --- a/share/ui/menus.ui +++ b/share/ui/menus.ui @@ -156,7 +156,12 @@ _Style - app.paste-style + app.paste-style-computed + edit-paste-style + + + _Style + app.paste-style-verbatim edit-paste-style diff --git a/src/actions/actions-edit.cpp b/src/actions/actions-edit.cpp index cb273d6e322c1574e8800d970135e331d09edf42..6d4e77dad828ade2758acd8f8252f98d6ef457dc 100644 --- a/src/actions/actions-edit.cpp +++ b/src/actions/actions-edit.cpp @@ -81,12 +81,21 @@ copy(InkscapeApplication *app) } void -paste_style(InkscapeApplication *app) +paste_style_computed(InkscapeApplication *app) { auto selection = app->get_active_selection(); // Paste Style - selection->pasteStyle(); + selection->pasteStyle(true); +} + +void +paste_style_verbatim(InkscapeApplication *app) +{ + auto selection = app->get_active_selection(); + + // Paste Style + selection->pasteStyle(false); } void @@ -290,7 +299,8 @@ std::vector> raw_data_edit = { {"app.object-to-guides", N_("Objects to Guides"), "Edit", N_("Convert selected objects to a collection of guidelines aligned with their edges")}, {"app.cut", N_("Cut"), "Edit", N_("Cut selection to clipboard")}, {"app.copy", N_("Copy"), "Edit", N_("Copy selection to clipboard")}, - {"app.paste-style", N_("Paste Style"), "Edit", N_("Apply the style of the copied object to selection")}, + {"app.paste-style-computed", N_("Paste Computed Style"), "Edit", N_("Apply the computed style of the copied object to selection")}, + {"app.paste-style-verbatim", N_("Paste Verbatim Style"), "Edit", N_("Apply the verbatim style and class of the copied object to selection")}, {"app.paste-size", N_("Paste Size"), "Edit", N_("Scale selection to match the size of the copied object")}, {"app.paste-width", N_("Paste Width"), "Edit", N_("Scale selection horizontally to match the width of the copied object")}, {"app.paste-height", N_("Paste Height"), "Edit", N_("Scale selection vertically to match the height of the copied object")}, @@ -330,7 +340,8 @@ add_actions_edit(InkscapeApplication* app) gapp->add_action( "object-to-guides", sigc::bind(sigc::ptr_fun(&object_to_guides), app)); gapp->add_action( "cut", sigc::bind(sigc::ptr_fun(&cut), app)); gapp->add_action( "copy", sigc::bind(sigc::ptr_fun(©), app)); - gapp->add_action( "paste-style", sigc::bind(sigc::ptr_fun(&paste_style), app)); + gapp->add_action( "paste-style-computed", sigc::bind(sigc::ptr_fun(&paste_style_computed), app)); + gapp->add_action( "paste-style-verbatim", sigc::bind(sigc::ptr_fun(&paste_style_verbatim), app)); gapp->add_action( "paste-size", sigc::bind(sigc::ptr_fun(&paste_size), app)); gapp->add_action( "paste-width", sigc::bind(sigc::ptr_fun(&paste_width), app)); gapp->add_action( "paste-height", sigc::bind(sigc::ptr_fun(&paste_height), app)); diff --git a/src/object/object-set.h b/src/object/object-set.h index e761ce6755687b81fcd1143751f318aca70d4382..ff3f13a96f7ca2c9007885397d188aa43ebfecec 100644 --- a/src/object/object-set.h +++ b/src/object/object-set.h @@ -447,7 +447,7 @@ public: //in selection-chemistry.cpp void copy(); void cut(); - void pasteStyle(); + void pasteStyle(bool use_computed); void pasteSize(bool apply_x, bool apply_y); void pasteSizeSeparately(bool apply_x, bool apply_y); void pastePathEffect(); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 79532a443a5ffc4e183b385a25bf6d8cfa70dc8d..afbaf89ece1808981db872a9761154937ad599f1 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1328,10 +1328,10 @@ void sp_selection_paste(SPDesktop *desktop, bool in_place, bool on_page) } } -void ObjectSet::pasteStyle() +void ObjectSet::pasteStyle(bool use_computed) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); - if (cm->pasteStyle(this)) { + if (cm->pasteStyle(this, use_computed)) { DocumentUndo::done(document(), _("Paste style"), INKSCAPE_ICON("edit-paste-style")); } } diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 89af358ff014871fea1b32bf14a462b498538075..57eb87b7dfa16ace69d343dc97c29a926238a485 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -27,7 +27,7 @@ // TODO: reduce header bloat if possible #include "context-fns.h" -#include "desktop-style.h" // for sp_desktop_set_style, used in _pasteStyle +#include "desktop-style.h" // for sp_desktop_set_style, used in pasteStyle #include "desktop.h" #include "display/curve.h" #include "document.h" @@ -109,7 +109,7 @@ public: void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, SPDocument *source, Geom::Rect const &bbox) override; void insertSymbol(SPDesktop *desktop, Geom::Point const &shift_dt) override; bool paste(SPDesktop *desktop, bool in_place, bool on_page) override; - bool pasteStyle(ObjectSet *set) override; + bool pasteStyle(ObjectSet *set, bool use_computed) override; bool pasteSize(ObjectSet *set, bool separately, bool apply_x, bool apply_y) override; bool pastePathEffect(ObjectSet *set) override; Glib::ustring getPathParameter(SPDesktop* desktop) override; @@ -700,9 +700,9 @@ void ClipboardManagerImpl::_cleanStyle(SPCSSAttr *style) } /** - * Implements the Paste Style action. + * Implements the Paste {Computed,Verbatim} Style actions. */ -bool ClipboardManagerImpl::pasteStyle(ObjectSet *set) +bool ClipboardManagerImpl::pasteStyle(ObjectSet *set, bool use_computed) { if (set->desktop() == nullptr) { return false; @@ -717,7 +717,7 @@ bool ClipboardManagerImpl::pasteStyle(ObjectSet *set) auto tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == nullptr ) { // no document, but we can try _text_style - if (_text_style) { + if (_text_style && use_computed) { _cleanStyle(_text_style); sp_desktop_set_style(set, set->desktop(), _text_style); return true; @@ -727,17 +727,17 @@ bool ClipboardManagerImpl::pasteStyle(ObjectSet *set) } } - static auto *const prefs = Inkscape::Preferences::get(); - auto const copy_computed = prefs->getBool("/options/copycomputedstyle/value", true); - Inkscape::XML::Node *root = tempdoc->getReprRoot(); Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1); bool pasted = false; if (clipnode) { - if (copy_computed) { - SPCSSAttr *style = sp_repr_css_attr(clipnode, "style"); + if (use_computed) { + SPCSSAttr *style = sp_repr_css_attr(clipnode, "inkscape:computed-style"); + if (!style) { + style = sp_repr_css_attr(clipnode, "style"); + } sp_desktop_set_style(set, set->desktop(), style); } else { for (auto node : set->xmlNodes()) { @@ -998,8 +998,6 @@ std::vector ClipboardManagerImpl::getElementsOfType(SPDesktop *de */ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) { - static auto *const prefs = Inkscape::Preferences::get(); - auto const copy_computed = prefs->getBool("/options/copycomputedstyle/value", true); SPPage *page = nullptr; // copy the defs used by all items @@ -1082,23 +1080,18 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) else obj_copy = _copyNode(obj, _doc, _clipnode); - if (copy_computed) { - // copy complete inherited style - _copyCompleteStyle(item, obj_copy); - } + // copy complete inherited style + _copyCompleteStyle(item, obj_copy); } } // copy style for Paste Style action if (auto item = selection->singleItem()) { - if (copy_computed) { - SPCSSAttr *style = take_style_from_item(item); - _cleanStyle(style); - sp_repr_css_set(_clipnode, style, "style"); - sp_repr_css_attr_unref(style); - } else { - _clipnode->copyAttribute("class", item->getRepr(), true); - _clipnode->copyAttribute("style", item->getRepr(), true); - } + SPCSSAttr *style = take_style_from_item(item); + _cleanStyle(style); + sp_repr_css_set(_clipnode, style, "inkscape:computed-style"); + sp_repr_css_attr_unref(style); + _clipnode->copyAttribute("class", item->getRepr(), true); + _clipnode->copyAttribute("style", item->getRepr(), true); // copy path effect from the first path if (gchar const *effect = item->getRepr()->attribute("inkscape:path-effect")) { diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h index b2537ed5aac0641ffbe3a9ea5d13ed19d4ba401d..ba4bbbd33b46d40884880e66211be20394bd20d3 100644 --- a/src/ui/clipboard.h +++ b/src/ui/clipboard.h @@ -46,7 +46,7 @@ public: virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, SPDocument *source, Geom::Rect const &bbox) = 0; virtual void insertSymbol(SPDesktop *desktop, Geom::Point const &shift_dt) = 0; virtual bool paste(SPDesktop *desktop, bool in_place = false, bool on_page = false) = 0; - virtual bool pasteStyle(ObjectSet *set) = 0; + virtual bool pasteStyle(ObjectSet *set, bool use_computed) = 0; virtual bool pasteSize(ObjectSet *set, bool separately, bool apply_x, bool apply_y) = 0; virtual bool pastePathEffect(ObjectSet *set) = 0; virtual Glib::ustring getPathParameter(SPDesktop* desktop) = 0; diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index fe27b914c063606eecc7e1674909488aedcb7d73..19ee2e40baaf244a18c10fa98a08eef91ffda709 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -2627,21 +2627,6 @@ void InkscapePreferences::initPageBehavior() this->AddPage(_page_markers, _("Markers"), iter_behavior, PREFS_PAGE_BEHAVIOR_MARKERS); - // Clipboard options - _clipboard_style_computed.init(_("Copy computed style"), "/options/copycomputedstyle/value", 1, true, nullptr); - _clipboard_style_verbatim.init(_("Copy class and style attributes verbatim"), "/options/copycomputedstyle/value", 0, - false, &_clipboard_style_computed); - - _page_clipboard.add_group_header(_("Copying objects to the clipboard")); - _page_clipboard.add_line(true, "", _clipboard_style_computed, "", - _("Object style= attribute will be set to the computed style, " - "preserving the object's appearance as in previous Inkscape versions")); - _page_clipboard.add_line( - true, "", _clipboard_style_verbatim, "", - _("Object style= and class= values will be copied verbatim and may be removed by 'paste style'")); - - this->AddPage(_page_clipboard, _("Clipboard"), iter_behavior, PREFS_PAGE_BEHAVIOR_CLIPBOARD); - // Document cleanup options _page_cleanup.add_group_header( _("Document cleanup")); _cleanup_swatches.init ( _("Remove unused swatches when doing a document cleanup"), "/options/cleanupswatches/value", false); // text label diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 779c695f41170a87c85356e3620152d961929d59..fb3338b2cf581eb22dfebd0b966158e7b1fb15b8 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -93,7 +93,6 @@ enum PREFS_PAGE_BEHAVIOR_CLONES, PREFS_PAGE_BEHAVIOR_MASKS, PREFS_PAGE_BEHAVIOR_MARKERS, - PREFS_PAGE_BEHAVIOR_CLIPBOARD, PREFS_PAGE_BEHAVIOR_CLEANUP, PREFS_PAGE_BEHAVIOR_LPE, PREFS_PAGE_IO, @@ -194,7 +193,6 @@ protected: UI::Widget::DialogPage _page_clones; UI::Widget::DialogPage _page_mask; UI::Widget::DialogPage _page_markers; - UI::Widget::DialogPage _page_clipboard; UI::Widget::DialogPage _page_cleanup; UI::Widget::DialogPage _page_lpe; @@ -401,9 +399,6 @@ protected: UI::Widget::PrefCheckButton _markers_color_custom; UI::Widget::PrefCheckButton _markers_color_update; - UI::Widget::PrefRadioButton _clipboard_style_computed; - UI::Widget::PrefRadioButton _clipboard_style_verbatim; - UI::Widget::PrefCheckButton _cleanup_swatches; UI::Widget::PrefCheckButton _lpe_copy_mirroricons; diff --git a/src/widgets/mappings.xml b/src/widgets/mappings.xml index c3993614d791e0b7574fdf48948bffd150f58220..4589de250a2c5e616f8f2f889280893f21a2b876 100644 --- a/src/widgets/mappings.xml +++ b/src/widgets/mappings.xml @@ -15,7 +15,8 @@ - + +