summaryrefslogtreecommitdiffstats
path: root/src/desktop-style.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2010-06-06 19:57:59 +0000
committertavmjong-free <tavmjong@free.fr>2010-06-06 19:57:59 +0000
commitc5c62e62d4ace55d6dc0146fb4ca9f59e9500750 (patch)
treef23ef6e9b083e1c4016faad0e318ce355b613b33 /src/desktop-style.cpp
parentCompute baseline-shift relative to parent baseline-shift. (diff)
downloadinkscape-c5c62e62d4ace55d6dc0146fb4ca9f59e9500750.tar.gz
inkscape-c5c62e62d4ace55d6dc0146fb4ca9f59e9500750.zip
Don't write text-specific style attributes to non-text objects.
(bzr r9488)
Diffstat (limited to 'src/desktop-style.cpp')
-rw-r--r--src/desktop-style.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 2c2a99aee..26f29d172 100644
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
@@ -196,10 +196,29 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write
// 3. If nobody has intercepted the signal, apply the style to the selection
if (!intercepted) {
+
+ // Remove text attributes if not text...
+ // Do this once in case a zillion objects are selected.
+ SPCSSAttr *css_no_text = sp_repr_css_attr_new();
+ sp_repr_css_merge(css_no_text, css);
+ css_no_text = sp_css_attr_unset_text(css_no_text);
+
for (GSList const *i = desktop->selection->itemList(); i != NULL; i = i->next) {
- /// \todo if the style is text-only, apply only to texts?
- sp_desktop_apply_css_recursive(SP_OBJECT(i->data), css, true);
+
+ // If not text, don't apply text attributes (can a group have text attributes?)
+ if ( SP_IS_TEXT(i->data) || SP_IS_FLOWTEXT(i->data)
+ || SP_IS_TSPAN(i->data) || SP_IS_TREF(i->data) || SP_IS_TEXTPATH(i->data)
+ || SP_IS_FLOWDIV(i->data) || SP_IS_FLOWPARA(i->data) || SP_IS_FLOWTSPAN(i->data)) {
+
+ sp_desktop_apply_css_recursive(SP_OBJECT(i->data), css, true);
+
+ } else {
+
+ sp_desktop_apply_css_recursive(SP_OBJECT(i->data), css_no_text, true);
+
+ }
}
+ sp_repr_css_attr_unref(css_no_text);
}
}