diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/attributes.cpp | 1 | ||||
| -rw-r--r-- | src/attributes.h | 1 | ||||
| -rw-r--r-- | src/desktop.cpp | 2 | ||||
| -rw-r--r-- | src/display/drawing-group.cpp | 17 | ||||
| -rw-r--r-- | src/display/drawing-group.h | 2 | ||||
| -rw-r--r-- | src/display/sp-canvas.cpp | 1 | ||||
| -rw-r--r-- | src/sp-namedview.cpp | 6 | ||||
| -rw-r--r-- | src/sp-namedview.h | 1 | ||||
| -rw-r--r-- | src/sp-root.cpp | 10 | ||||
| -rw-r--r-- | src/sp-root.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 19 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.h | 1 |
12 files changed, 54 insertions, 9 deletions
diff --git a/src/attributes.cpp b/src/attributes.cpp index ee2a80fd3..1c62ea841 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -117,6 +117,7 @@ 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 b8843fcb7..530c9d11a 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -118,6 +118,7 @@ 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/desktop.cpp b/src/desktop.cpp index a02baeac8..234831e69 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1736,6 +1736,8 @@ 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 38ace001f..c03e0f3ba 100644 --- a/src/display/drawing-group.cpp +++ b/src/display/drawing-group.cpp @@ -22,6 +22,7 @@ DrawingGroup::DrawingGroup(Drawing &drawing) : DrawingItem(drawing) , _style(NULL) , _child_transform(NULL) + , _uses_antialiasing(true) {} DrawingGroup::~DrawingGroup() @@ -47,6 +48,15 @@ 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 @@ -100,6 +110,13 @@ 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 651e9d8af..c7f1c70ce 100644 --- a/src/display/drawing-group.h +++ b/src/display/drawing-group.h @@ -30,6 +30,7 @@ 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, @@ -42,6 +43,7 @@ protected: SPStyle *_style; Geom::Affine *_child_transform; + bool _uses_antialiasing; }; bool is_drawing_group(DrawingItem *item); diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index c502daf64..6d903867b 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -35,7 +35,6 @@ #include "display/cairo-utils.h" #include "debug/gdk-event-latency-tracker.h" #include "desktop.h" -#include "sp-namedview.h" using Inkscape::Debug::GdkEventLatencyTracker; diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index a01ba891e..03c124117 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -90,6 +90,7 @@ 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; @@ -248,6 +249,7 @@ 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() ) { @@ -603,6 +605,10 @@ 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 05cbcc398..b6e32206e 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -44,6 +44,7 @@ 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 12570e03e..12ac1bad4 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -25,6 +25,7 @@ #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" @@ -307,6 +308,7 @@ 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); } } @@ -373,6 +375,7 @@ 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; @@ -391,6 +394,13 @@ 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 a25e8030c..a1954c42f 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -50,6 +50,8 @@ 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/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 0411c789c..ef7c9ee1d 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -106,6 +106,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_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), @@ -239,7 +240,8 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con yoptions = Gtk::FILL|Gtk::EXPAND; } if (docum_prop_flag) { - if( i==(n-4) || i==(n-6) ) { + // this sets the padding for subordinate widgets on the "Page" page + if( i==(n-8) || i==(n-10) ) { #if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); arr[i+1]->set_margin_left(20); @@ -316,28 +318,28 @@ void DocumentProperties::build_page() Gtk::Label* label_gen = manage (new Gtk::Label); label_gen->set_markup (_("<b>General</b>")); - Gtk::Label* label_col = manage (new Gtk::Label); - label_col->set_markup (_("<b>Color</b>")); - Gtk::Label* label_bor = manage (new Gtk::Label); - label_bor->set_markup (_("<b>Border</b>")); Gtk::Label *label_for = manage (new Gtk::Label); label_for->set_markup (_("<b>Page Size</b>")); + Gtk::Label* label_dsp = manage (new Gtk::Label); + label_dsp->set_markup (_("<b>Display</b>")); _page_sizer.init(); Gtk::Widget *const widget_array[] = { label_gen, 0, 0, &_rum_deflt, - label_col, 0, - _rcp_bg._label, &_rcp_bg, + //label_col, 0, + //_rcp_bg._label, &_rcp_bg, 0, 0, label_for, 0, 0, &_page_sizer, 0, 0, - label_bor, 0, + label_dsp, 0, 0, &_rcb_canb, 0, &_rcb_bord, 0, &_rcb_shad, + 0, &_rcb_antialias, + _rcp_bg._label, &_rcp_bg, _rcp_bord._label, &_rcp_bord, }; @@ -1472,6 +1474,7 @@ 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); if (nv->doc_units) { _rum_deflt.setUnit (nv->doc_units->abbr); diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index e3ca91731..495f3177d 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -117,6 +117,7 @@ protected: UI::Widget::Registry _wr; //--------------------------------------------------------------- + UI::Widget::RegisteredCheckButton _rcb_antialias; UI::Widget::RegisteredCheckButton _rcb_canb; UI::Widget::RegisteredCheckButton _rcb_bord; UI::Widget::RegisteredCheckButton _rcb_shad; |
