diff options
| -rw-r--r-- | src/desktop.cpp | 12 | ||||
| -rw-r--r-- | src/desktop.h | 27 | ||||
| -rw-r--r-- | src/display/drawing-image.cpp | 7 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 5 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 1 |
5 files changed, 46 insertions, 6 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index b61f6867f..35ee22448 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -138,6 +138,8 @@ SPDesktop::SPDesktop() : _w2d(), _d2w(), _doc2dt( Geom::Scale(1, -1) ), + // This doesn't work I don't know why. + // _image_render_observer(*this, "/options/rendering/imageinoutlinemode"), grids_visible( false ) { _d2w.setIdentity(); @@ -499,11 +501,15 @@ SPDesktop::remove_temporary_canvasitem (Inkscape::Display::TemporaryItem * tempi } } +void SPDesktop::redrawDesktop() { + sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw +} + void SPDesktop::_setDisplayMode(Inkscape::RenderMode mode) { SP_CANVAS_ARENA (drawing)->drawing.setRenderMode(mode); canvas->rendermode = mode; _display_mode = mode; - sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw + redrawDesktop(); _widget->setTitle( sp_desktop_document(this)->getName() ); } void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) { @@ -524,7 +530,7 @@ void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) { SP_CANVAS_ARENA (drawing)->drawing.setColorMode(mode); canvas->colorrendermode = mode; _display_color_mode = mode; - sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw + redrawDesktop(); _widget->setTitle( sp_desktop_document(this)->getName() ); } @@ -819,7 +825,7 @@ SPDesktop::set_display_area (double x0, double y0, double x1, double y1, double // zoom changed - set new zoom factors _d2w = Geom::Scale(newscale, -newscale); _w2d = Geom::Scale(1/newscale, 1/-newscale); - sp_canvas_item_affine_absolute(SP_CANVAS_ITEM(main), _d2w); + redrawDesktop(); clear = TRUE; zoomChanged = true; } diff --git a/src/desktop.h b/src/desktop.h index 2f47dc2dd..ccc45904d 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -35,12 +35,14 @@ #include "display/rendermode.h" #include <glibmm/ustring.h> +#include "preferences.h" #include "sp-gradient.h" // TODO refactor enums out to their own .h file class SPCSSAttr; struct SPCanvas; struct SPCanvasItem; struct SPCanvasGroup; +struct DesktopPrefObserver; namespace Inkscape { namespace UI { @@ -206,7 +208,7 @@ public: /// Emitted when the zoom factor changes (not emitted when scrolling). /// The parameter is the new zoom factor sigc::signal<void, double> signal_zoom_changed; - + sigc::connection connectDestroy(const sigc::slot<void, SPDesktop*> &slot) { return _destroy_signal.connect(slot); @@ -256,6 +258,8 @@ public: Inkscape::Display::TemporaryItem * add_temporary_canvasitem (SPCanvasItem *item, guint lifetime, bool move_to_bottom = true); void remove_temporary_canvasitem (Inkscape::Display::TemporaryItem * tempitem); + void redrawDesktop(); + void _setDisplayMode(Inkscape::RenderMode mode); void setDisplayModeNormal() { _setDisplayMode(Inkscape::RENDERMODE_NORMAL); @@ -426,6 +430,27 @@ private: Geom::Affine _d2w; Geom::Affine _doc2dt; + /* + * Allow redrawing or refreshing if preferences change + */ + class DesktopPrefObserver : public Inkscape::Preferences::Observer { + public: + DesktopPrefObserver(SPDesktop *desktop, Glib::ustring const &path) + : Inkscape::Preferences::Observer(path) + , _desktop(desktop) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->addObserver(*this); + } + private: + void notify(Inkscape::Preferences::Entry const &val) { + _desktop->redrawDesktop(); + } + SPDesktop *_desktop; + }; + + // Disabled while stupid init call doesn't work + //DesktopPrefObserver _image_render_observer; + bool grids_visible; /* don't set this variable directly, use the method below */ void set_grids_visible(bool visible); diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp index 5844c8b08..bec59384c 100644 --- a/src/display/drawing-image.cpp +++ b/src/display/drawing-image.cpp @@ -106,7 +106,10 @@ unsigned DrawingImage::_renderItem(DrawingContext &dc, Geom::IntRect const &/*ar { bool outline = _drawing.outline(); - if (!outline) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool imgoutline = prefs->getBool("/options/rendering/imageinoutlinemode", true); + + if (!outline || imgoutline) { if (!_pixbuf) return RENDER_OK; Inkscape::DrawingContext::Save save(dc); @@ -141,7 +144,7 @@ unsigned DrawingImage::_renderItem(DrawingContext &dc, Geom::IntRect const &/*ar dc.paint(_opacity); } else { // outline; draw a rect instead - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + guint32 rgba = prefs->getInt("/options/wireframecolors/images", 0xff0000ff); { Inkscape::DrawingContext::Save save(dc); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index d826ece09..940f105d0 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1463,6 +1463,11 @@ void InkscapePreferences::initPageBitmaps() _page_bitmaps.add_line( false, "", _importexport_import_res_override, "", _("Use default bitmap resolution in favor of information from file")); + _page_bitmaps.add_group_header( _("Render")); + // rendering outlines for pixmap image tags + _rendering_image_outline.init( _("Images in Outline Mode"), "/options/rendering/imageinoutlinemode", true); + _page_bitmaps.add_line(false, _(""), _rendering_image_outline, "", _("When active will render images while in outline mode instead of a red box with an x. This is useful for manual tracing.")); + this->AddPage(_page_bitmaps, _("Bitmaps"), PREFS_PAGE_BITMAPS); } diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index da85b805d..1c2151605 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -292,6 +292,7 @@ protected: UI::Widget::PrefCheckButton _show_filters_info_box; UI::Widget::PrefCombo _dockbar_style; UI::Widget::PrefCombo _switcher_style; + UI::Widget::PrefCheckButton _rendering_image_outline; UI::Widget::PrefSpinButton _rendering_cache_size; UI::Widget::PrefSpinButton _filter_multi_threaded; |
