diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/style-internal.cpp | 8 | ||||
| -rw-r--r-- | src/style-internal.h | 9 | ||||
| -rw-r--r-- | src/style.cpp | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/style-internal.cpp b/src/style-internal.cpp index b03e848ba..df08d0adf 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -693,6 +693,14 @@ SPIString::write( guint const flags, SPIBase const *const base) const { } void +SPIString::clear() { + SPIBase::clear(); + g_free( value ); + value = NULL; + if( value_default ) value = strdup( value_default ); +} + +void SPIString::cascade( const SPIBase* const parent ) { if( const SPIString* p = dynamic_cast<const SPIString*>(parent) ) { if( inherits && (!set || inherit) ) { diff --git a/src/style-internal.h b/src/style-internal.h index 131b77b77..d1a331acf 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -385,13 +385,15 @@ class SPIString : public SPIBase { public: SPIString() : SPIBase( "anonymous_string" ), value(NULL) {}; - SPIString( Glib::ustring name ) : - SPIBase( name ) , value(NULL) {}; + SPIString( Glib::ustring name, gchar* value_default_in = NULL ) : + SPIBase( name ) , value(NULL) , value_default(NULL) { + value_default = value_default_in?g_strdup(value_default_in):NULL; + }; virtual ~SPIString() { g_free(value); }; virtual void read( gchar const *str ); virtual const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPIBase const *const base = NULL ) const; - virtual void clear() { SPIBase::clear(); g_free( value ); value = NULL; }; + virtual void clear(); virtual void cascade( const SPIBase* const parent ); virtual void merge( const SPIBase* const parent ); @@ -407,6 +409,7 @@ class SPIString : public SPIBase { // To do: make private, convert value to Glib::ustring public: gchar *value; + gchar *value_default; }; /// Color type interal to SPStyle, FIXME Add string value to store SVG named color. diff --git a/src/style.cpp b/src/style.cpp index 2d66284d4..11b1dc440 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -112,7 +112,7 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : font_stretch( "font-stretch", enum_font_stretch, SP_CSS_FONT_STRETCH_NORMAL ), font_size(), line_height( "line-height", 1.0 ), // SPILengthOrNormal - font_family( "font-family" ), // SPIString + font_family( "font-family", "sans-serif" ), // SPIString w/default font(), // SPIFont font_specification( "-inkscape-font-specification" ), // SPIString |
