diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-08-29 20:34:06 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-08-29 20:34:06 +0000 |
| commit | 719b90d62fe152b9ff7f08133d0bb7016c4194f2 (patch) | |
| tree | 725bed1090b75349cd01916a29d74a99046ec085 /src | |
| parent | Remove warnings on de/activate (diff) | |
| download | inkscape-719b90d62fe152b9ff7f08133d0bb7016c4194f2.tar.gz inkscape-719b90d62fe152b9ff7f08133d0bb7016c4194f2.zip | |
add improvements to selectors and merge stylesheet on copy to work between docs
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/clipboard.cpp | 8 | ||||
| -rw-r--r-- | src/ui/clipboard.h | 1 | ||||
| -rw-r--r-- | src/ui/dialog/selectorsdialog.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 7 |
4 files changed, 15 insertions, 3 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 4362c2b94..b9e7dc2b5 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -24,6 +24,7 @@ #include <glib/gstdio.h> // for g_file_set_contents etc., used in _onGet and paste #include "inkgc/gc-core.h" #include "xml/repr.h" +#include "xml/sp-css-attr.h" #include "inkscape.h" #include "desktop.h" @@ -753,6 +754,12 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) // copy complete inherited style SPCSSAttr *css = sp_repr_css_attr_inherited(obj, "style"); + for (auto iter : item->style->properties()) { + if (iter->style_src == SP_STYLE_SRC_STYLE_SHEET) { + Glib::ustring val = iter->get_value(); + css->setAttribute(iter->name, val.c_str()); + } + } sp_repr_css_set(obj_copy, css, "style"); sp_repr_css_attr_unref(css); @@ -923,7 +930,6 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } } - /** * Copy a single gradient to the clipboard's defs element. */ diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h index d8c78cd69..aa96a21fe 100644 --- a/src/ui/clipboard.h +++ b/src/ui/clipboard.h @@ -48,7 +48,6 @@ public: virtual Glib::ustring getShapeOrTextObjectId(SPDesktop *desktop) = 0; virtual std::vector<Glib::ustring> getElementsOfType(SPDesktop *desktop, gchar const* type = "*", gint maxdepth = -1) = 0; virtual const gchar *getFirstObjectID() = 0; - static ClipboardManager *get(); protected: ClipboardManager(); // singleton diff --git a/src/ui/dialog/selectorsdialog.cpp b/src/ui/dialog/selectorsdialog.cpp index 375d2d89b..a4b6c2c8b 100644 --- a/src/ui/dialog/selectorsdialog.cpp +++ b/src/ui/dialog/selectorsdialog.cpp @@ -879,6 +879,8 @@ void SelectorsDialog::_addToSelector(Gtk::TreeModel::Row row) css->setAttribute(key, nullptr); } sp_repr_css_write_string(css, css_str); + sp_repr_css_attr_unref(css); + sp_repr_css_attr_unref(css_selector); obj->getRepr()->setAttribute("style", css_str.c_str()); obj->style->readFromObject(obj); obj->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 38c194b4f..84ea82423 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -262,7 +262,12 @@ Glib::ustring StyleDialog::fixCSSSelectors(Glib::ustring selector) tag = tag.substr(0, i); } if (!SPAttributeRelSVG::isSVGElement(tag)) { - return ""; + if (tokens.size() == 1) { + tag = "." + tag; + return tag; + } else { + return ""; + } } } } |
