summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-04-19 22:26:37 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-04-19 22:26:37 +0000
commit23be58fdf34cbcb29040b312de7e2b6764f60c50 (patch)
treed25a24e24f830c7618edeadc9d211e15e576c3fa /src
parentupdate to trunk (diff)
parentMerge in outline bitmap image preference feature (diff)
downloadinkscape-23be58fdf34cbcb29040b312de7e2b6764f60c50.tar.gz
inkscape-23be58fdf34cbcb29040b312de7e2b6764f60c50.zip
update to trunk
(bzr r11950.1.329)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp15
-rw-r--r--src/desktop.h26
-rw-r--r--src/display/drawing-image.cpp7
-rw-r--r--src/display/sp-canvas.cpp2
-rw-r--r--src/extension/dbus/Makefile_insert2
-rw-r--r--src/extension/internal/pdf-input-cairo.cpp2
-rw-r--r--src/preferences-skeleton.h4
-rw-r--r--src/splivarot.cpp15
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp5
-rw-r--r--src/ui/dialog/inkscape-preferences.h1
-rw-r--r--src/xml/repr-css.cpp5
11 files changed, 64 insertions, 20 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 22c00d4f1..3ed6d9ef3 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;
}
@@ -1699,7 +1705,6 @@ _layer_hierarchy_changed(SPObject */*top*/, SPObject *bottom,
/// Called when document is starting to be rebuilt.
static void _reconstruction_start(SPDesktop * desktop)
{
- g_debug("Desktop, starting reconstruction\n");
desktop->_reconstruction_old_layer_id = desktop->currentLayer()->getId() ? desktop->currentLayer()->getId() : "";
desktop->layers->reset();
@@ -1710,8 +1715,6 @@ static void _reconstruction_start(SPDesktop * desktop)
}
*/
desktop->selection->clear();
-
- g_debug("Desktop, starting reconstruction end\n");
}
/// Called when document rebuild is finished.
diff --git a/src/desktop.h b/src/desktop.h
index 2f47dc2dd..fec6249e9 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,26 @@ 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;
+ };
+
+ 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..00caef525 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", false);
+
+ 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/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 6d903867b..3dc4a7504 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -2153,6 +2153,8 @@ gboolean SPCanvasImpl::handleDraw(GtkWidget *widget, cairo_t *cr) {
canvas->requestRedraw(r.left(), r.top(), r.right(), r.bottom());
}
+ cairo_rectangle_list_destroy(rects);
+
return FALSE;
}
#else
diff --git a/src/extension/dbus/Makefile_insert b/src/extension/dbus/Makefile_insert
index 7d851715e..192651d87 100644
--- a/src/extension/dbus/Makefile_insert
+++ b/src/extension/dbus/Makefile_insert
@@ -78,7 +78,7 @@ libinkdbus_la_CFLAGS = \
$(DBUS_CFLAGS) \
$(INKSCAPE_CFLAGS) \
-I$(builddir)/extension/dbus \
- -Wall -Werror
+ -Wall
libinkdbus_la_LIBADD = \
$(DBUS_LIBS) \
diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp
index c45367c08..9ce73c260 100644
--- a/src/extension/internal/pdf-input-cairo.cpp
+++ b/src/extension/internal/pdf-input-cairo.cpp
@@ -616,7 +616,7 @@ PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
output, width, height);
cairo_t* cr = cairo_create(surface);
- poppler_page_render(page, cr);
+ poppler_page_render_for_printing(page, cr);
cairo_show_page(cr);
cairo_destroy(cr);
diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h
index 96629f22d..734e8a582 100644
--- a/src/preferences-skeleton.h
+++ b/src/preferences-skeleton.h
@@ -293,7 +293,9 @@ static char const preferences_skeleton[] =
#ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs
" <group id=\"dialogsontopwin32\" value=\"0\"/>\n"
#endif
-" <group id=\"defaultwindowsize\" value=\"2\" />\n"
+#if !defined(GDK_WINDOWING_QUARTZ) // No maximise for Quartz, see lp:1302627
+ " <group id=\"defaultwindowsize\" value=\"2\" />\n"
+#endif
" <group id=\"arenatilescachesize\" value=\"8192\"/>\n"
" <group id=\"preservetransform\" value=\"0\"/>\n"
" <group id=\"clonecompensation\" value=\"1\"/>\n"
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 6aec42c5b..40f3f174a 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -960,16 +960,17 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only)
Geom::Affine const transform(item->transform);
float const scale = transform.descrim();
- float o_width, o_miter;
+ float o_width = i_style->stroke_width.computed;
+ if (o_width < Geom::EPSILON) {
+ // This may result in rounding errors for very small stroke widths (happens e.g. when user unit is large).
+ // See bug lp:1244861
+ o_width = Geom::EPSILON;
+ }
+ float o_miter = i_style->stroke_miterlimit.value * o_width;
+
JoinType o_join;
ButtType o_butt;
{
- o_width = i_style->stroke_width.computed;
- if (o_width < 0.01) {
- o_width = 0.01;
- }
- o_miter = i_style->stroke_miterlimit.value * o_width;
-
switch (i_style->stroke_linejoin.computed) {
case SP_STROKE_LINEJOIN_MITER:
o_join = join_pointy;
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index d826ece09..559398a84 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", false);
+ _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;
diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp
index 24e2db9e1..32a1e7f5d 100644
--- a/src/xml/repr-css.cpp
+++ b/src/xml/repr-css.cpp
@@ -382,7 +382,10 @@ static void sp_repr_css_merge_from_decl(SPCSSAttr *css, CRDeclaration const *con
std::string characters;
std::string temp;
bool number_valid = !(ss >> number).fail();
- if( !number_valid ) ss.clear();
+ if (!number_valid) {
+ ss.clear();
+ ss.seekg(0); // work-around for a bug in libc++ (see lp:1300271)
+ }
while( !(ss >> temp).eof() ) {
characters += temp;
characters += " ";