summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-03-14 13:32:07 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-03-14 13:32:07 +0000
commitfd0ca31309d9fb4ffa8da11dee80f935ebc4c0fb (patch)
tree54686ce820bd72a2081aec10d9638946937ae824 /src
parentcommit Vinícius code (diff)
parentAdd a few font related tests. (diff)
downloadinkscape-fd0ca31309d9fb4ffa8da11dee80f935ebc4c0fb.tar.gz
inkscape-fd0ca31309d9fb4ffa8da11dee80f935ebc4c0fb.zip
update to trunk
(bzr r11950.1.295)
Diffstat (limited to 'src')
-rw-r--r--src/attributes.cpp1
-rw-r--r--src/attributes.h1
-rw-r--r--src/color.cpp7
-rw-r--r--src/desktop.cpp2
-rw-r--r--src/display/drawing-group.cpp17
-rw-r--r--src/display/drawing-group.h2
-rw-r--r--src/display/drawing-item.cpp30
-rw-r--r--src/display/drawing-item.h2
-rw-r--r--src/document.cpp7
-rw-r--r--src/preferences-skeleton.h4
-rw-r--r--src/sp-gradient.cpp83
-rw-r--r--src/sp-item.cpp1
-rw-r--r--src/sp-namedview.cpp6
-rw-r--r--src/sp-namedview.h1
-rw-r--r--src/sp-root.cpp10
-rw-r--r--src/sp-root.h2
-rw-r--r--src/style-test.h20
-rw-r--r--src/style.cpp10
-rw-r--r--src/ui/dialog/document-properties.cpp8
-rw-r--r--src/ui/widget/registered-widget.cpp6
-rw-r--r--src/ui/widget/registered-widget.h8
21 files changed, 143 insertions, 85 deletions
diff --git a/src/attributes.cpp b/src/attributes.cpp
index 1c62ea841..ee2a80fd3 100644
--- a/src/attributes.cpp
+++ b/src/attributes.cpp
@@ -117,7 +117,6 @@ static SPStyleProp const props[] = {
{SP_ATTR_INKSCAPE_DOCUMENT_UNITS, "inkscape:document-units"},
{SP_ATTR_UNITS, "units"},
{SP_ATTR_INKSCAPE_CONNECTOR_SPACING, "inkscape:connector-spacing"},
- {SP_ATTR_INKSCAPE_ANTIALIASING, "inkscape:antialiasing"},
/* SPColorProfile */
{SP_ATTR_LOCAL, "local"},
{SP_ATTR_NAME, "name"},
diff --git a/src/attributes.h b/src/attributes.h
index 530c9d11a..b8843fcb7 100644
--- a/src/attributes.h
+++ b/src/attributes.h
@@ -118,7 +118,6 @@ enum SPAttributeEnum {
SP_ATTR_INKSCAPE_DOCUMENT_UNITS,
SP_ATTR_UNITS,
SP_ATTR_INKSCAPE_CONNECTOR_SPACING,
- SP_ATTR_INKSCAPE_ANTIALIASING,
/* SPColorProfile */
SP_ATTR_LOCAL,
SP_ATTR_NAME,
diff --git a/src/color.cpp b/src/color.cpp
index 5eb0d91ef..dccd603b0 100644
--- a/src/color.cpp
+++ b/src/color.cpp
@@ -84,9 +84,10 @@ SPColor& SPColor::operator= (SPColor const& other)
*/
bool SPColor::operator == (SPColor const& other) const
{
- bool match = (v.c[0] != other.v.c[0])
- && (v.c[1] != other.v.c[1])
- && (v.c[2] != other.v.c[2]);
+ bool match =
+ (v.c[0] == other.v.c[0]) &&
+ (v.c[1] == other.v.c[1]) &&
+ (v.c[2] == other.v.c[2]);
match &= profileMatches( icc, other.icc );
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 234831e69..a02baeac8 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -1736,8 +1736,6 @@ static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop)
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- desktop->getDocument()->getRoot()->setAntialiasing(nv->antialiasing);
-
/* Show/hide page background */
if (nv->pagecolor | (0xff != 0xffffffff)) {
sp_canvas_item_show (desktop->table);
diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp
index c03e0f3ba..38ace001f 100644
--- a/src/display/drawing-group.cpp
+++ b/src/display/drawing-group.cpp
@@ -22,7 +22,6 @@ DrawingGroup::DrawingGroup(Drawing &drawing)
: DrawingItem(drawing)
, _style(NULL)
, _child_transform(NULL)
- , _uses_antialiasing(true)
{}
DrawingGroup::~DrawingGroup()
@@ -48,15 +47,6 @@ DrawingGroup::setStyle(SPStyle *style)
_setStyleCommon(_style, style);
}
-void
-DrawingGroup::setAntialiasing(bool a)
-{
- if (_uses_antialiasing != a) {
- _uses_antialiasing = a;
- _markForUpdate(STATE_ALL, true);
- }
-}
-
/**
* Set additional transform for the group.
* This is applied after the normal transform and mainly useful for
@@ -110,13 +100,6 @@ DrawingGroup::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u
unsigned
DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at)
{
- DrawingContext::Save aa_save;
-
- if (!_uses_antialiasing) {
- aa_save.save(dc);
- cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_NONE);
- }
-
if (stop_at == NULL) {
// normal rendering
for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) {
diff --git a/src/display/drawing-group.h b/src/display/drawing-group.h
index c7f1c70ce..651e9d8af 100644
--- a/src/display/drawing-group.h
+++ b/src/display/drawing-group.h
@@ -30,7 +30,6 @@ public:
void setStyle(SPStyle *style);
void setChildTransform(Geom::Affine const &new_trans);
- void setAntialiasing(bool a);
protected:
virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx,
@@ -43,7 +42,6 @@ protected:
SPStyle *_style;
Geom::Affine *_child_transform;
- bool _uses_antialiasing;
};
bool is_drawing_group(DrawingItem *item);
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp
index 13e7b61eb..ccf905e81 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -127,6 +127,7 @@ DrawingItem::DrawingItem(Drawing &drawing)
, _propagate(0)
// , _renders_opacity(0)
, _pick_children(0)
+ , _antialias(1)
, _isolation(SP_CSS_ISOLATION_AUTO)
, _blend_mode(SP_CSS_BLEND_NORMAL)
{}
@@ -229,6 +230,8 @@ DrawingItem::prependChild(DrawingItem *item)
void
DrawingItem::clearChildren()
{
+ if (_children.empty()) return;
+
_markForRendering();
// prevent children from referencing the parent during deletion
// this way, children won't try to remove themselves from a list
@@ -266,8 +269,19 @@ DrawingItem::setTransform(Geom::Affine const &new_trans)
void
DrawingItem::setOpacity(float opacity)
{
- _opacity = opacity;
- _markForRendering();
+ if (_opacity != opacity) {
+ _opacity = opacity;
+ _markForRendering();
+ }
+}
+
+void
+DrawingItem::setAntialiasing(bool a)
+{
+ if (_antialias != a) {
+ _antialias = a;
+ _markForRendering();
+ }
}
void
@@ -289,8 +303,10 @@ DrawingItem::setBlendMode(unsigned blend_mode)
void
DrawingItem::setVisible(bool v)
{
- _visible = v;
- _markForRendering();
+ if (_visible != v) {
+ _visible = v;
+ _markForRendering();
+ }
}
/// This is currently unused
@@ -568,6 +584,12 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag
Geom::OptIntRect carea = Geom::intersect(area, _drawbox);
if (!carea) return RENDER_OK;
+ if (_antialias) {
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_DEFAULT);
+ } else {
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_NONE);
+ }
+
// render from cache if possible
if (_cached) {
if (_cache) {
diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h
index 913706021..db803cf60 100644
--- a/src/display/drawing-item.h
+++ b/src/display/drawing-item.h
@@ -108,6 +108,7 @@ public:
void setCached(bool c, bool persistent = false);
void setOpacity(float opacity);
+ void setAntialiasing(bool a);
void setIsolation(unsigned isolation); // CSS Compositing and Blending
void setBlendMode(unsigned blend_mode);
void setTransform(Geom::Affine const &trans);
@@ -205,6 +206,7 @@ protected:
//unsigned _renders_opacity : 1; ///< Whether object needs temporary surface for opacity
unsigned _pick_children : 1; ///< For groups: if true, children are returned from pick(),
/// otherwise the group is returned
+ unsigned _antialias : 1; ///< Whether to use antialiasing
unsigned _isolation : 1;
unsigned _blend_mode : 4;
diff --git a/src/document.cpp b/src/document.cpp
index 4756110f6..dc7ed254c 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -1133,12 +1133,11 @@ static gint
sp_document_idle_handler(gpointer data)
{
SPDocument *doc = static_cast<SPDocument *>(data);
- if (doc->_updateDocument()) {
+ bool status = !doc->_updateDocument(); // method TRUE if it does NOT need further modification, so invert
+ if (!status) {
doc->modified_id = 0;
- return false;
- } else {
- return true;
}
+ return status;
}
/**
diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h
index ebc5386e3..2211baddb 100644
--- a/src/preferences-skeleton.h
+++ b/src/preferences-skeleton.h
@@ -475,10 +475,6 @@ static char const preferences_skeleton[] =
" </group>\n"
" </group>\n"
" </group>\n"
-" <group id = \"whiteboard\">\n"
-" <group id = \"server\" name = \"jabber.org\" port = \"5222\" username = \"\" ssl = \"0\"/>\n"
-" <group id = \"room\" name = \"inkboard\" server = \"gristle.org\"/>\n"
-" </group>\n"
" <group id=\"debug\">\n"
" <group id=\"latency\" skew=\"1\"/>\n"
" </group>\n"
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index e2ae98ec5..115cb754a 100644
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -111,33 +111,45 @@ gboolean SPGradient::isEquivalent(SPGradient *that)
{
//TODO Make this work for mesh gradients
- if (this->getStopCount() != that->getStopCount())
- return FALSE;
-
- if (this->hasStops() != that->hasStops())
- return FALSE;
-
- if (!this->getVector() || !that->getVector())
- return FALSE;
+ bool status = FALSE;
+
+ while(1){ // not really a loop, used to avoid deep nesting or multiple exit points from function
+ if (this->getStopCount() != that->getStopCount()) { break; }
+ if (this->hasStops() != that->hasStops()) { break; }
+ if (!this->getVector() || !that->getVector()) { break; }
+ if ( (SP_IS_LINEARGRADIENT(this) && SP_IS_LINEARGRADIENT(that)) ||
+ (SP_IS_RADIALGRADIENT(this) && SP_IS_RADIALGRADIENT(that)) ||
+ (SP_IS_MESHGRADIENT(this) && SP_IS_MESHGRADIENT(that))) {
+ /* OK! */
+ }
+ else { break; }
- SPStop *as = this->getVector()->getFirstStop();
- SPStop *bs = that->getVector()->getFirstStop();
+ SPStop *as = this->getVector()->getFirstStop();
+ SPStop *bs = that->getVector()->getFirstStop();
- while (as && bs) {
- if (!as->getEffectiveColor().isClose(bs->getEffectiveColor(), 0.001) ||
- as->offset != bs->offset) {
- return FALSE;
+ bool effective = TRUE;
+ while (effective && (as && bs)) {
+ if (!as->getEffectiveColor().isClose(bs->getEffectiveColor(), 0.001) ||
+ as->offset != bs->offset) {
+ effective = FALSE;
+ break;
+ }
+ else {
+ as = as->getNextStop();
+ bs = bs->getNextStop();
+ }
}
- as = as->getNextStop();
- bs = bs->getNextStop();
- }
+ if(!effective)break;
- return TRUE;
+ status = TRUE;
+ break;
+ }
+ return status;
}
/**
* return true if this gradient is "aligned" to that gradient.
- * Aligned means that they have exactly the same transform.
+ * Aligned means that they have exactly the same coordinates and transform.
* @param that - A gradient to compare this to
*/
gboolean SPGradient::isAligned(SPGradient *that)
@@ -148,13 +160,44 @@ gboolean SPGradient::isAligned(SPGradient *that)
if(this->gradientTransform_set != that->gradientTransform_set) { break; }
if(this->gradientTransform_set &&
(this->gradientTransform != that->gradientTransform)) { break; }
+ if (SP_IS_LINEARGRADIENT(this) && SP_IS_LINEARGRADIENT(that)) {
+ SPLinearGradient *sg=SP_LINEARGRADIENT(this);
+ SPLinearGradient *tg=SP_LINEARGRADIENT(that);
+
+ if( !sg->x1._set || !tg->x1._set || // assume that if these are set so will be all the others
+ (sg->x1.computed != tg->x1.computed) ||
+ (sg->y1.computed != tg->y1.computed) ||
+ (sg->x2.computed != tg->x2.computed) ||
+ (sg->y2.computed != tg->y2.computed)
+ ) { break; }
+ } else if (SP_IS_RADIALGRADIENT(this) && SP_IS_LINEARGRADIENT(that)) {
+ SPRadialGradient *sg=SP_RADIALGRADIENT(this);
+ SPRadialGradient *tg=SP_RADIALGRADIENT(that);
+ if( !sg->cx._set || !tg->cx._set || // assume that if these are set so will be all the others
+ (sg->cx.computed != tg->cx.computed) ||
+ (sg->cy.computed != tg->cy.computed) ||
+ (sg->r.computed != tg->r.computed ) ||
+ (sg->fx.computed != tg->fx.computed) ||
+ (sg->fy.computed != tg->fy.computed)
+ ) { break; }
+ } else if (SP_IS_MESHGRADIENT(this) && SP_IS_MESHGRADIENT(that)) {
+ SPMeshGradient *sg=SP_MESHGRADIENT(this);
+ SPMeshGradient *tg=SP_MESHGRADIENT(that);
+
+ if( !sg->x._set || !tg->x._set ||
+ !sg->y._set || !tg->y._set ||
+ (sg->x.computed != tg->x.computed) ||
+ (sg->y.computed != tg->y.computed)
+ ) { break; }
+ } else {
+ break;
+ }
status = TRUE;
break;
}
return status;
}
-
/*
* Gradient
*/
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 9c8b28559..b10aae1c6 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -599,6 +599,7 @@ void SPItem::update(SPCtx* /*ctx*/, guint flags) {
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
for (SPItemView *v = item->display; v != NULL; v = v->next) {
v->arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(object->style->opacity.value));
+ v->arenaitem->setAntialiasing(object->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES);
v->arenaitem->setIsolation( object->style->isolation.value );
v->arenaitem->setBlendMode( object->style->blend_mode.value );
v->arenaitem->setVisible(!item->isHidden());
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 03c124117..a01ba891e 100644
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -90,7 +90,6 @@ SPNamedView::SPNamedView() : SPObjectGroup(), snap_manager(this) {
this->grids_visible = false;
this->showborder = TRUE;
this->showpageshadow = TRUE;
- this->antialiasing = TRUE;
this->guides = NULL;
this->viewcount = 0;
@@ -249,7 +248,6 @@ void SPNamedView::build(SPDocument *document, Inkscape::XML::Node *repr) {
this->readAttr( "inkscape:snap-page" );
this->readAttr( "inkscape:current-layer" );
this->readAttr( "inkscape:connector-spacing" );
- this->readAttr( "inkscape:antialiasing" );
/* Construct guideline list */
for (SPObject *o = this->firstChild() ; o; o = o->getNext() ) {
@@ -605,10 +603,6 @@ void SPNamedView::set(unsigned int key, const gchar* value) {
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
}
- case SP_ATTR_INKSCAPE_ANTIALIASING:
- this->antialiasing = value ? sp_str_to_bool(value) : TRUE;
- this->requestModified(SP_OBJECT_MODIFIED_FLAG);
- break;
default:
SPObjectGroup::set(key, value);
break;
diff --git a/src/sp-namedview.h b/src/sp-namedview.h
index b6e32206e..05cbcc398 100644
--- a/src/sp-namedview.h
+++ b/src/sp-namedview.h
@@ -44,7 +44,6 @@ public:
unsigned int showborder : 1;
unsigned int showpageshadow : 1;
unsigned int borderlayer : 2;
- unsigned int antialiasing : 1;
double zoom;
double cx;
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index 12ac1bad4..12570e03e 100644
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
@@ -25,7 +25,6 @@
#include "document.h"
#include "inkscape-version.h"
#include "sp-defs.h"
-#include "sp-namedview.h"
#include "sp-root.h"
#include "display/drawing-group.h"
#include "svg/stringstream.h"
@@ -308,7 +307,6 @@ void SPRoot::update(SPCtx *ctx, guint flags)
for (SPItemView *v = this->display; v != NULL; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
g->setChildTransform(this->c2p);
- g->setAntialiasing(sp_document_namedview(this->document, NULL)->antialiasing);
}
}
@@ -375,7 +373,6 @@ Inkscape::DrawingItem *SPRoot::show(Inkscape::Drawing &drawing, unsigned int key
if (ai) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(ai);
g->setChildTransform(this->c2p);
- g->setAntialiasing(sp_document_namedview(this->document, NULL)->antialiasing);
}
return ai;
@@ -394,13 +391,6 @@ const char *SPRoot::displayName() const {
return "SVG"; // Do not translate
}
-void SPRoot::setAntialiasing(bool s) {
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
- Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
- g->setAntialiasing(s);
- }
-}
-
/*
Local Variables:
mode:c++
diff --git a/src/sp-root.h b/src/sp-root.h
index a1954c42f..a25e8030c 100644
--- a/src/sp-root.h
+++ b/src/sp-root.h
@@ -50,8 +50,6 @@ public:
*/
SPDefs *defs;
- void setAntialiasing(bool a);
-
virtual void build(SPDocument *document, Inkscape::XML::Node *repr);
virtual void release();
virtual void set(unsigned int key, gchar const* value);
diff --git a/src/style-test.h b/src/style-test.h
index 90654ce83..c88c1c30a 100644
--- a/src/style-test.h
+++ b/src/style-test.h
@@ -87,13 +87,25 @@ public:
// TestCase("fill:url(#painter) inherit", 0, "#painter"),
TestCase("fill:inherit"),
-// General tests (in order of appearance in sp_style_read), SPIPaint tested above
+// General tests (in general order of appearance in sp_style_read), SPIPaint tested above
TestCase("visibility:hidden"), // SPIEnum
TestCase("visibility:collapse"),
TestCase("visibility:visible"),
TestCase("display:none"), // SPIEnum
TestCase("overflow:visible"), // SPIEnum
TestCase("overflow:auto"), // SPIEnum
+
+ // Not directly read
+ TestCase("font:bold 12px Arial",
+ "font-size:12px;font-style:normal;font-variant:normal;font-weight:bold;font-family:Arial"),
+ // line-height not read in
+ //TestCase("font:bold 12px/24px 'Times New Roman'",
+ // "font-size:12px;font-style:normal;font-variant:normal;font-weight:bold;line-height:24px;font-family:Times New Roman"),
+ TestCase("font-family:sans-serif"), // SPIString, text_private
+ TestCase("font-family:Arial"),
+ TestCase("font-variant:normal;font-stretch:normal;-inkscape-font-specification:Nimbus Roman No9 L Bold Italic"),
+ // Needs to be fixed (quotes should be around each font-family):
+ TestCase("font-family:Georgia, 'Minion Web'","font-family:'Georgia, \"Minion Web\"'"),
TestCase("font-size:12", "font-size:12px"), // SPIFontSize
TestCase("font-size:12px"),
TestCase("font-size:12pt", "font-size:15px"),
@@ -105,11 +117,15 @@ public:
TestCase("font-weight:normal"),
TestCase("font-weight:bolder"),
TestCase("font-stretch:condensed"), // SPIEnum
+
+ // Should be moved down
TestCase("text-indent:12em"), // SPILength?
TestCase("text-align:center"), // SPIEnum
TestCase("text-decoration: underline"), // SPITextDecoration
TestCase("text-decoration: underline wavy #0000ff"), // SPITextDecoration CSS3
TestCase("text-decoration: overline double #ff0000"),
+
+ // Should be moved up
TestCase("line-height:24px"), // SPILengthOrNormal
TestCase("line-height:1.5"),
TestCase("letter-spacing:2px"), // SPILengthOrNormal
@@ -121,6 +137,7 @@ public:
TestCase("baseline-shift:sub"),
TestCase("baseline-shift:12.5%"),
TestCase("baseline-shift:2px"),
+
TestCase("opacity:0.1"), // SPIScale24
// ...
TestCase("stroke-width:2px"), // SPILength
@@ -138,7 +155,6 @@ public:
TestCase("stroke-dashoffset:13"), // SPILength
TestCase("stroke-dashoffset:10px"),
// ...
- TestCase("font-family:sans-serif"), // SPIString, text_private
//TestCase("filter:url(#myfilter)"), // SPIFilter segfault in read
TestCase("filter:inherit"),
diff --git a/src/style.cpp b/src/style.cpp
index de5b23854..132972164 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -1936,7 +1936,15 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent)
if (!style->color_rendering.set || style->color_rendering.inherit) {
style->color_rendering.computed = parent->color_rendering.computed;
}
-
+ if (!style->image_rendering.set || style->image_rendering.inherit) {
+ style->image_rendering.computed = parent->image_rendering.computed;
+ }
+ if (!style->shape_rendering.set || style->shape_rendering.inherit) {
+ style->shape_rendering.computed = parent->shape_rendering.computed;
+ }
+ if (!style->text_rendering.set || style->text_rendering.inherit) {
+ style->text_rendering.computed = parent->text_rendering.computed;
+ }
}
template <typename T>
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index ef7c9ee1d..a31ab1a09 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -35,6 +35,7 @@
#include "sp-namedview.h"
#include "sp-root.h"
#include "sp-script.h"
+#include "style.h"
#include "svg/stringstream.h"
#include "tools-switch.h"
#include "ui/widget/color-picker.h"
@@ -106,7 +107,7 @@ DocumentProperties::DocumentProperties()
_page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
_page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
//---------------------------------------------------------------
- _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "inkscape:antialiasing", _wr, false),
+ _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "shape-rendering", _wr, false, NULL, NULL, NULL, "crispEdges"),
_rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false),
_rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false),
_rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false),
@@ -1474,7 +1475,10 @@ void DocumentProperties::update()
_rcb_bord.setActive (nv->borderlayer == SP_BORDER_LAYER_TOP);
_rcp_bord.setRgba32 (nv->bordercolor);
_rcb_shad.setActive (nv->showpageshadow);
- _rcb_antialias.setActive(nv->antialiasing);
+
+ SPRoot *root = dt->getDocument()->getRoot();
+ _rcb_antialias.set_xml_target(root->getRepr(), dt->getDocument());
+ _rcb_antialias.setActive(root->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES);
if (nv->doc_units) {
_rum_deflt.setUnit (nv->doc_units->abbr);
diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp
index ae6a7d1e0..175f6471c 100644
--- a/src/ui/widget/registered-widget.cpp
+++ b/src/ui/widget/registered-widget.cpp
@@ -49,8 +49,10 @@ RegisteredCheckButton::~RegisteredCheckButton()
_toggled_connection.disconnect();
}
-RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in)
+RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *active_str, char const *inactive_str)
: RegisteredWidget<Gtk::CheckButton>()
+ , _active_str(active_str)
+ , _inactive_str(inactive_str)
{
init_parent(key, wr, repr_in, doc_in);
@@ -88,7 +90,7 @@ RegisteredCheckButton::on_toggled()
return;
_wr->setUpdating (true);
- write_to_xml(get_active() ? "true" : "false");
+ write_to_xml(get_active() ? _active_str : _inactive_str);
//The slave button is greyed out if the master button is unchecked
for (std::list<Gtk::Widget*>::const_iterator i = _slavewidgets.begin(); i != _slavewidgets.end(); ++i) {
(*i)->set_sensitive(get_active());
diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h
index 883a9e1a2..d64c09c16 100644
--- a/src/ui/widget/registered-widget.h
+++ b/src/ui/widget/registered-widget.h
@@ -55,6 +55,11 @@ public:
event_description = _event_description;
write_undo = true;
}
+ void set_xml_target(Inkscape::XML::Node *xml_node, SPDocument *document)
+ {
+ repr = xml_node;
+ doc = document;
+ }
bool is_updating() {if (_wr) return _wr->isUpdating(); else return false;}
@@ -136,7 +141,7 @@ private:
class RegisteredCheckButton : public RegisteredWidget<Gtk::CheckButton> {
public:
virtual ~RegisteredCheckButton();
- RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL);
+ RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *active_str = "true", char const *inactive_str = "false");
void setActive (bool);
@@ -153,6 +158,7 @@ public:
// if a callback checks it, it must reset it back to false
protected:
+ char const *_active_str, *_inactive_str;
sigc::connection _toggled_connection;
void on_toggled();
};