diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-05-04 05:38:04 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-06-02 09:50:16 +0000 |
| commit | 6f199a0d6205622e184f2c06b4f47e00d458a69b (patch) | |
| tree | 1bd87fb51b4012f91386ac5cf1204ae9b18f2a22 /src/style.cpp | |
| parent | working on new UI (diff) | |
| download | inkscape-6f199a0d6205622e184f2c06b4f47e00d458a69b.tar.gz inkscape-6f199a0d6205622e184f2c06b4f47e00d458a69b.zip | |
Add visualization of style dialog
Diffstat (limited to 'src/style.cpp')
| -rw-r--r-- | src/style.cpp | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/src/style.cpp b/src/style.cpp index c83b19230..ac4f1f37e 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -720,6 +720,32 @@ SPStyle::readIfUnset(SPAttributeEnum id, gchar const *val, SPStyleSrc const &sou } } +// return if is seted property +bool +SPStyle::isSet(SPAttributeEnum id) { + bool set = false; + switch (id) { + case SP_PROP_CLIP_PATH: + return set; + case SP_PROP_MASK: + return set; + case SP_PROP_FILTER: + if( !filter.inherit ) set = filter.set; + return set; + case SP_PROP_COLOR_INTERPOLATION: + // We read it but issue warning + return color_interpolation.set; + } + + auto p = _prop_helper.get(this, id); + if (p) { + return p->set; + } else { + g_warning("Unimplemented style property %d", id); + return set; + } +} + /** * Outputs the style to a CSS string. * @@ -881,16 +907,18 @@ SPStyle::_mergeDecl( CRDeclaration const *const decl, SPStyleSrc const &source * convert to string. Alternatively, set from CRTerm directly rather * than converting to string. */ - guchar *const str_value_unsigned = cr_term_to_string(decl->value); - gchar *const str_value = reinterpret_cast<gchar *>(str_value_unsigned); + if (!isSet(prop_idx) || decl->important) { + guchar *const str_value_unsigned = cr_term_to_string(decl->value); + gchar *const str_value = reinterpret_cast<gchar *>(str_value_unsigned); - // Add "!important" rule if necessary as this is not handled by cr_term_to_string(). - gchar const * important = decl->important ? " !important" : ""; - Inkscape::CSSOStringStream os; - os << str_value << important; + // Add "!important" rule if necessary as this is not handled by cr_term_to_string(). + gchar const * important = decl->important ? " !important" : ""; + Inkscape::CSSOStringStream os; + os << str_value << important; - readIfUnset( prop_idx, os.str().c_str(), source ); - g_free(str_value); + readIfUnset( prop_idx, os.str().c_str(), source ); + g_free(str_value); + } } } |
