summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2008-10-31 15:06:16 +0000
committerTed Gould <ted@canonical.com>2008-10-31 15:06:16 +0000
commit7e67d66e7817a9321c4e94b2184a9226b20b396a (patch)
treea857d7aae5f544c4243a331e4eb4e4629bbc27a9 /src
parentMerge from trunk (diff)
downloadinkscape-7e67d66e7817a9321c4e94b2184a9226b20b396a.tar.gz
inkscape-7e67d66e7817a9321c4e94b2184a9226b20b396a.zip
Merge from trunk
(bzr r6887)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/dialogs/xml-tree.cpp19
-rw-r--r--src/display/sp-canvas.cpp73
-rw-r--r--src/draw-context.cpp2
-rw-r--r--src/extension/internal/Makefile_insert9
-rw-r--r--src/extension/internal/cairo-render-context.cpp14
-rw-r--r--src/extension/internal/cairo-renderer.cpp62
-rw-r--r--src/extension/internal/emf-win32-inout.cpp19
-rw-r--r--src/extension/internal/emf-win32-inout.h16
-rw-r--r--src/extension/internal/emf-win32-print.cpp7
-rw-r--r--src/extension/internal/emf-win32-print.h19
-rw-r--r--src/extension/internal/win32.cpp25
-rw-r--r--src/extension/internal/win32.h103
-rw-r--r--src/gradient-chemistry.cpp104
-rw-r--r--src/gradient-chemistry.h6
-rw-r--r--src/libgdl/Makefile_insert2
-rw-r--r--src/libgdl/gdl-win32.c8
-rw-r--r--src/libgdl/gdl-win32.h19
-rw-r--r--src/libnrtype/FontFactory.cpp2
-rw-r--r--src/libnrtype/FontInstance.cpp2
-rw-r--r--src/libnrtype/Layout-TNG-Input.cpp2
-rw-r--r--src/main.cpp13
-rw-r--r--src/nodepath.cpp9
-rw-r--r--src/pen-context.cpp5
-rw-r--r--src/selection-chemistry.cpp24
-rw-r--r--src/seltrans.cpp20
-rw-r--r--src/snap-preferences.cpp3
-rw-r--r--src/snap.cpp23
-rw-r--r--src/snap.h7
-rw-r--r--src/snapped-point.cpp59
-rw-r--r--src/snapped-point.h16
-rw-r--r--src/sp-gradient-test.h59
-rw-r--r--src/sp-gradient.cpp70
-rw-r--r--src/sp-gradient.h2
-rw-r--r--src/sp-paint-server.cpp4
-rw-r--r--src/sp-paint-server.h4
-rw-r--r--src/sp-pattern.cpp48
-rw-r--r--src/sp-pattern.h8
-rw-r--r--src/sp-shape.cpp3
-rw-r--r--src/svg/path-string.cpp26
-rw-r--r--src/svg/path-string.h79
-rw-r--r--src/svg/svg-affine.cpp381
-rw-r--r--src/ui/dialog/Makefile_insert4
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.h10
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp9
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp9
-rw-r--r--src/ui/dialog/filter-effects-dialog.h1
-rw-r--r--src/ui/widget/object-composite-settings.cpp15
-rw-r--r--src/ui/widget/object-composite-settings.h3
49 files changed, 749 insertions, 681 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3dc9e7cd7..0726b7228 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,7 +27,8 @@ INCLUDES = \
$(POPPLER_GLIB_CFLAGS) \
-DPOTRACE=\"potrace\" \
$(INKSCAPE_CFLAGS) \
- -I$(top_srcdir)/cxxtest
+ -I$(top_srcdir)/cxxtest \
+ $(WIN32_CFLAGS)
include Makefile_insert
include application/Makefile_insert
diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp
index 06103e9b3..2c596bc0e 100644
--- a/src/dialogs/xml-tree.cpp
+++ b/src/dialogs/xml-tree.cpp
@@ -97,7 +97,8 @@ static SPDocument *current_document = NULL;
static gint selected_attr = 0;
static Inkscape::XML::Node *selected_repr = NULL;
-static void sp_xmltree_desktop_change( Inkscape::Application *inkscape, SPDesktop *desktop, GtkWidget *dialog );
+static void sp_xmltree_desktop_activate( Inkscape::Application *inkscape, SPDesktop *desktop, GtkWidget *dialog );
+static void sp_xmltree_desktop_deactivate( Inkscape::Application *inkscape, SPDesktop *desktop, GtkWidget *dialog );
static void set_tree_desktop(SPDesktop *desktop);
static void set_tree_document(SPDocument *document);
@@ -612,10 +613,10 @@ void sp_xml_tree_dialog()
gtk_widget_hide(text_container);
g_signal_connect( G_OBJECT(INKSCAPE), "activate_desktop",
- G_CALLBACK(sp_xmltree_desktop_change), dlg);
+ G_CALLBACK(sp_xmltree_desktop_activate), dlg);
g_signal_connect( G_OBJECT(INKSCAPE), "deactivate_desktop",
- G_CALLBACK(sp_xmltree_desktop_change), dlg);
+ G_CALLBACK(sp_xmltree_desktop_deactivate), dlg);
g_signal_connect((GObject *) dlg, "key_press_event", (GCallback) sp_xml_tree_key_press, NULL);
@@ -650,16 +651,20 @@ static gboolean sp_xml_tree_key_press(GtkWidget */*widget*/, GdkEventKey *event)
}
-static void sp_xmltree_desktop_change(Inkscape::Application */*inkscape*/,
+static void sp_xmltree_desktop_activate(Inkscape::Application */*inkscape*/,
SPDesktop *desktop,
GtkWidget */*dialog*/ )
{
- if (!desktop) {
- return;
- }
set_tree_desktop(desktop);
}
+static void sp_xmltree_desktop_deactivate(Inkscape::Application */*inkscape*/,
+ SPDesktop *desktop,
+ GtkWidget */*dialog*/ )
+{
+ set_tree_desktop(NULL);
+}
+
void set_tree_desktop(SPDesktop *desktop)
{
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 53dd6c62c..e9bf1633e 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -1497,6 +1497,7 @@ static gint
sp_canvas_button (GtkWidget *widget, GdkEventButton *event)
{
SPCanvas *canvas = SP_CANVAS (widget);
+ SPDesktop *dt = SP_ACTIVE_DESKTOP;
int retval = FALSE;
@@ -1531,7 +1532,13 @@ sp_canvas_button (GtkWidget *widget, GdkEventButton *event)
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
- /* Pick the current item as if the button were not pressed, and
+ if (dt) {
+ // Snapping will be on hold if we're moving the mouse at high speeds. When starting
+ // drawing a new shape we really should snap though.
+ dt->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(false);
+ }
+
+ /* Pick the current item as if the button were not pressed, and
* then process the event.
*/
canvas->state = event->state;
@@ -1541,7 +1548,9 @@ sp_canvas_button (GtkWidget *widget, GdkEventButton *event)
break;
case GDK_BUTTON_RELEASE:
- /* Process the event as if the button were pressed, then repick
+ sp_canvas_snap_watchdog_callback(canvas); // If we have any pending snapping action, then invoke it now
+
+ /* Process the event as if the button were pressed, then repick
* after the button has been released
*/
canvas->state = event->state;
@@ -1550,6 +1559,7 @@ sp_canvas_button (GtkWidget *widget, GdkEventButton *event)
canvas->state = event->state;
pick_current_item (canvas, (GdkEvent *) event);
event->state ^= mask;
+
break;
default:
@@ -1583,7 +1593,7 @@ static inline void request_motions(GdkWindow *w, GdkEventMotion *event) {
static int
sp_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
{
- static guint32 prev_time;
+ static guint32 prev_time;
static boost::optional<Geom::Point> prev_pos;
int status;
@@ -1597,44 +1607,44 @@ sp_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
if (canvas->pixmap_gc == NULL) // canvas being deleted
return FALSE;
- // Snap when speed drops below e.g. 0.1 px/msec, or when no motion events have occured for 100 msec.
- // i.e. snap when we're at stand still. The speed threshold enforces snapping for tablets, which will never
- // be full at stand still and might keep spitting out motion events.
+ SPDesktop *dt = SP_ACTIVE_DESKTOP;
+
+ // Snap when speed drops below e.g. 0.02 px/msec, or when no motion events have occured for some period.
+ // i.e. snap when we're at stand still. A speed threshold enforces snapping for tablets, which might never
+ // be fully at stand still and might keep spitting out motion events.
- // When moving at speeds around the speed limit, Inkscape might snap for one motion event but not for the
- // next, which will make the object that's being dragged jump from the snapped position to the mouse
- // position and back again. That could be annoying, but I don't see an easy way around this.
-
if (event->type == GDK_MOTION_NOTIFY) {
Geom::Point event_pos(event->x, event->y);
guint32 event_t = gdk_event_get_time ( (GdkEvent *) event );
- sp_canvas_snap_watchdog_kill(canvas);
- SPDesktop *dt = SP_ACTIVE_DESKTOP;
+ if (dt) { // put snapping on hold
+ dt->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(true);
+ }
if (prev_pos) {
Geom::Coord dist = Geom::L2(event_pos - *prev_pos);
guint32 delta_t = event_t - prev_time;
gdouble speed = delta_t > 0 ? dist/delta_t : 1000;
// std::cout << "speed = " << speed << " px/msec " << "| time passed = " << delta_t << " msec" << std::endl;
- if (speed < 0.1) {
- if (dt) {
- dt->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(false);
- }
- } else {
- // We're moving fast, so postpone any snapping until the next GDK_MOTION_NOTIFY event.
- if (dt) {
- dt->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(true);
- }
- // We must snap at some point in time though, so set a watchdog timer at 100 msec from
- // now, just in case there's no future motion event that's under the speed limit.
- sp_canvas_snap_watchdog_set(canvas, event);
+ if (speed > 0.02) { // Jitter threshold, might be needed for tablets
+ // We're moving fast, so postpone any snapping until the next GDK_MOTION_NOTIFY event. We
+ // will keep on postponing the snapping as long as the speed is high.
+ // We must snap at some point in time though, so set a watchdog timer at some time from
+ // now, just in case there's no future motion event that drops under the speed limit (when
+ // stoppping abruptly)
+ sp_canvas_snap_watchdog_kill(canvas);
+ sp_canvas_snap_watchdog_set(canvas, event); // watchdog is reset, i.e. pushed forward in time
+ } else { // Speed is very low, so we're virtually at stand still
+ // But if we're really standing still, then we should snap now. We could use some low-pass filtering,
+ // otherwise snapping occurs for each jitter movement. For this filtering we'll leave the watchdog to expire,
+ // snap, and set a new watchdog again.
+ if (canvas->watchdog_id == 0) { // no watchdog has been set
+ // it might have already expired, so we'll set a new one; the snapping frequency will be limited by this
+ sp_canvas_snap_watchdog_set(canvas, event);
+ } // else: watchdog has been set before and we'll wait for it to expire
}
} else {
// This is the first GDK_MOTION_NOTIFY event, so postpone snapping and set the watchdog
- if (dt) {
- dt->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(true);
- }
sp_canvas_snap_watchdog_set(canvas, event);
}
@@ -1656,12 +1666,17 @@ sp_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
gboolean sp_canvas_snap_watchdog_callback(gpointer data)
{
+ // Snap NOW! For this the "postponed" flag will be reset and an the last motion event will be repeated
+ SPCanvas *canvas = reinterpret_cast<SPCanvas *>(data);
+ if (!canvas->watchdog_event) {
+ return FALSE;
+ }
+
SPDesktop *dt = SP_ACTIVE_DESKTOP;
if (dt) {
dt->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(false);
}
- SPCanvas *canvas = reinterpret_cast<SPCanvas *>(data);
emit_event(canvas, canvas->watchdog_event);
gdk_event_free(canvas->watchdog_event);
canvas->watchdog_event = NULL;
@@ -1673,7 +1688,7 @@ gboolean sp_canvas_snap_watchdog_callback(gpointer data)
void sp_canvas_snap_watchdog_set(SPCanvas *canvas, GdkEventMotion *event)
{
g_assert(canvas->watchdog_id == 0);
- canvas->watchdog_id = g_timeout_add(100, &sp_canvas_snap_watchdog_callback, canvas);
+ canvas->watchdog_id = g_timeout_add(400, &sp_canvas_snap_watchdog_callback, canvas);
g_assert(canvas->watchdog_event == NULL);
canvas->watchdog_event = gdk_event_copy( (GdkEvent *) event);
}
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index d1124b75a..74b6e8d52 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -295,7 +295,7 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item)
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (item && SP_IS_LPE_ITEM(item)) {
- if (prefs->getBool(tool_name(dc) + "/freehand-mode", 0) == 1) {
+ if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1) {
Effect::createAndApply(SPIRO, dc->desktop->doc(), item);
}
diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert
index 0bab68456..1de46034e 100644
--- a/src/extension/internal/Makefile_insert
+++ b/src/extension/internal/Makefile_insert
@@ -140,9 +140,14 @@ extension_internal_libinternal_a_SOURCES = \
extension/internal/latex-pstricks-out.h \
$(extension_internal_libwpg) \
$(extension_internal_image_magick_sources) \
- \
extension/internal/filter/filter-all.cpp \
extension/internal/filter/filter-file.cpp \
extension/internal/filter/filter.cpp \
- extension/internal/filter/filter.h
+ extension/internal/filter/filter.h \
+ extension/internal/win32.h \
+ extension/internal/win32.cpp \
+ extension/internal/emf-win32-print.h \
+ extension/internal/emf-win32-print.cpp \
+ extension/internal/emf-win32-inout.h \
+ extension/internal/emf-win32-inout.cpp
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 6bbaa5c06..656cd4a08 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -1305,7 +1305,11 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con
return true;
}
- if (style->fill.isNone() && style->stroke.isNone())
+ bool no_fill = style->fill.isNone() || style->fill_opacity.value == 0;
+ bool no_stroke = style->stroke.isNone() || style->stroke_width.computed < 1e-9 ||
+ style->fill_opacity.value == 0;
+
+ if (no_fill && no_stroke)
return true;
bool need_layer = ( !_state->merge_opacity && !_state->need_layer &&
@@ -1316,7 +1320,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con
else
pushLayer();
- if (!style->fill.isNone()) {
+ if (!no_fill) {
_setFillStyle(style, pbox);
setPathVector(pathv);
@@ -1326,15 +1330,15 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con
cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING);
}
- if (style->stroke.isNone())
+ if (no_stroke)
cairo_fill(_cr);
else
cairo_fill_preserve(_cr);
}
- if (!style->stroke.isNone()) {
+ if (!no_stroke) {
_setStrokeStyle(style, pbox);
- if (style->fill.isNone())
+ if (no_fill)
setPathVector(pathv);
cairo_stroke(_cr);
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index 86e04fb54..af9c3cd6e 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -155,7 +155,6 @@ static void sp_image_render(SPItem *item, CairoRenderContext *ctx);
static void sp_symbol_render(SPItem *item, CairoRenderContext *ctx);
static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx);
-/* TODO FIXME: this does not render painting-marker-01-f.svg of SVG1.1 Test suite correctly. (orientation of one of the markers middle left ) */
static void sp_shape_render (SPItem *item, CairoRenderContext *ctx)
{
NRRect pbox;
@@ -164,7 +163,6 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx)
if (!shape->curve) return;
- /* fixme: Think (Lauris) */
sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE);
SPStyle* style = SP_OBJECT_STYLE (item);
@@ -187,16 +185,22 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx)
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(path_it->front().pointAt(0));
}
+ bool render = true;
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = Geom::Scale(style->stroke_width.computed) * tr;
+ if (style->stroke_width.computed > 1e-9) {
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
+ } else {
+ render = false; // stroke width zero and marker is thus scaled down to zero, skip
+ }
}
- tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
-
- Geom::Matrix old_tr = marker_item->transform;
- marker_item->transform = tr;
- renderer->renderItem (ctx, marker_item);
- marker_item->transform = old_tr;
+ if (render) {
+ tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
+ Geom::Matrix old_tr = marker_item->transform;
+ marker_item->transform = tr;
+ renderer->renderItem (ctx, marker_item);
+ marker_item->transform = old_tr;
+ }
}
if ( shape->marker[SP_MARKER_LOC_MID] && (path_it->size_default() > 1) ) {
@@ -218,16 +222,22 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx)
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(curve_it1->pointAt(1));
}
+ bool render = true;
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = Geom::Scale(style->stroke_width.computed) * tr;
+ if (style->stroke_width.computed > 1e-9) {
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
+ } else {
+ render = false; // stroke width zero and marker is thus scaled down to zero, skip
+ }
}
- tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
-
- Geom::Matrix old_tr = marker_item->transform;
- marker_item->transform = tr;
- renderer->renderItem (ctx, marker_item);
- marker_item->transform = old_tr;
+ if (render) {
+ tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
+ Geom::Matrix old_tr = marker_item->transform;
+ marker_item->transform = tr;
+ renderer->renderItem (ctx, marker_item);
+ marker_item->transform = old_tr;
+ }
++curve_it1;
++curve_it2;
@@ -253,16 +263,22 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx)
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(lastcurve.pointAt(1));
}
+ bool render = true;
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = Geom::Scale(style->stroke_width.computed) * tr;
+ if (style->stroke_width.computed > 1e-9) {
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
+ } else {
+ render = false; // stroke width zero and marker is thus scaled down to zero, skip
+ }
}
- tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
-
- Geom::Matrix old_tr = marker_item->transform;
- marker_item->transform = tr;
- renderer->renderItem (ctx, marker_item);
- marker_item->transform = old_tr;
+ if (render) {
+ tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
+ Geom::Matrix old_tr = marker_item->transform;
+ marker_item->transform = tr;
+ renderer->renderItem (ctx, marker_item);
+ marker_item->transform = old_tr;
+ }
}
}
}
diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp
index 8dd793f92..bc7a3ac78 100644
--- a/src/extension/internal/emf-win32-inout.cpp
+++ b/src/extension/internal/emf-win32-inout.cpp
@@ -1,15 +1,13 @@
-/** \file
- * Enhanced Metafile Input and Output.
+/** @file
+ * @brief Windows-only Enhanced Metafile input and output.
*/
-/*
- * Authors:
+/* Authors:
* Ulf Erikson <ulferikson@users.sf.net>
*
* Copyright (C) 2006-2008 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
- */
-/*
+ *
* References:
* - How to Create & Play Enhanced Metafiles in Win32
* http://support.microsoft.com/kb/q145999/
@@ -2447,17 +2445,14 @@ EmfWin32::init (void)
} } } /* namespace Inkscape, Extension, Implementation */
-
#endif /* WIN32 */
-
-
/*
Local Variables:
- mode:cpp
+ mode:c++
c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0))
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/extension/internal/emf-win32-inout.h b/src/extension/internal/emf-win32-inout.h
index 01aa91bdc..49c1826e4 100644
--- a/src/extension/internal/emf-win32-inout.h
+++ b/src/extension/internal/emf-win32-inout.h
@@ -1,17 +1,15 @@
-/*
- * Enhanced Metafile Input/Output.
- *
- * Authors:
+/** @file
+ * @brief Enhanced Metafile Input/Output
+ */
+/* Authors:
* Ulf Erikson <ulferikson@users.sf.net>
*
* Copyright (C) 2006-2008 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-
-#ifndef EXTENSION_INTERNAL_EMF_WIN32_H
-#define EXTENSION_INTERNAL_EMF_WIN32_H
-
+#ifndef SEEN_EXTENSION_INTERNAL_EMF_WIN32_H
+#define SEEN_EXTENSION_INTERNAL_EMF_WIN32_H
#ifdef WIN32
#include "extension/implementation/implementation.h"
@@ -56,4 +54,4 @@ private:
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp
index d5bdcb6d3..8c92fc320 100644
--- a/src/extension/internal/emf-win32-print.cpp
+++ b/src/extension/internal/emf-win32-print.cpp
@@ -1,8 +1,7 @@
-/** \file
- * Enhanced Metafile Printing.
+/** @file
+ * @brief Enhanced Metafile printing
*/
-/*
- * Authors:
+/* Authors:
* Ulf Erikson <ulferikson@users.sf.net>
*
* Copyright (C) 2006-2008 Authors
diff --git a/src/extension/internal/emf-win32-print.h b/src/extension/internal/emf-win32-print.h
index 374aaef45..ab9a1a4cf 100644
--- a/src/extension/internal/emf-win32-print.h
+++ b/src/extension/internal/emf-win32-print.h
@@ -1,16 +1,15 @@
-#ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__
-#define __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__
-
-/*
- * Enhanced Metafile Printing.
- *
- * Author:
+/** @file
+ * @brief Enhanced Metafile printing - implementation
+ */
+/* Author:
* Ulf Erikson <ulferikson@users.sf.net>
*
* Copyright (C) 2006-2008 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__
+#define __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__
#ifdef WIN32
@@ -100,11 +99,11 @@ protected:
/*
Local Variables:
- mode:cpp
+ mode:c++
c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0))
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/extension/internal/win32.cpp b/src/extension/internal/win32.cpp
index ecf66ca1f..0fa70d734 100644
--- a/src/extension/internal/win32.cpp
+++ b/src/extension/internal/win32.cpp
@@ -1,14 +1,14 @@
-#define __SP_MODULE_WIN32_C__
-
-/*
- * Windows stuff
- *
- * Author:
+/** @file
+ * @brief Windows-specific stuff
+ */
+/* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* This code is in public domain
*/
+#ifdef WIN32
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -494,3 +494,16 @@ PrintWin32::init (void)
} /* namespace Internal */
} /* namespace Extension */
} /* namespace Inkscape */
+
+#endif // ifdef WIN32
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/extension/internal/win32.h b/src/extension/internal/win32.h
index 4fb726fae..9462115c6 100644
--- a/src/extension/internal/win32.h
+++ b/src/extension/internal/win32.h
@@ -1,10 +1,7 @@
-#ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__
-#define __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__
-
-/*
- * Windows stuff
- *
- * Author:
+/** @file
+ * @brief Windows-specific stuff
+ */
+/* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ted Gould <ted@gould.cx>
*
@@ -12,10 +9,12 @@
* Ted: This code is released under the GNU GPL
*/
-#include <config.h>
+#ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__
+#define __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__
+#ifdef WIN32
-#ifndef WIN32
-#error "This file is only usable for Windows"
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
#endif
#ifdef DATADIR
@@ -33,55 +32,65 @@ namespace Internal {
/* Initialization */
class PrintWin32 : public Inkscape::Extension::Implementation::Implementation {
- /* Document dimensions */
- float _PageWidth;
- float _PageHeight;
+ /* Document dimensions */
+ float _PageWidth;
+ float _PageHeight;
- HDC _hDC;
+ HDC _hDC;
- unsigned int _landscape;
+ unsigned int _landscape;
- void main_init (int argc, char **argv, const char *name);
- void finish (void);
+ void main_init (int argc, char **argv, const char *name);
+ void finish (void);
- /* File dialogs */
- char *get_open_filename (unsigned char *dir, unsigned char *filter, unsigned char *title);
- char *get_write_filename (unsigned char *dir, unsigned char *filter, unsigned char *title);
- char *get_save_filename (unsigned char *dir, unsigned int *spns);
+ /* File dialogs */
+ char *get_open_filename (unsigned char *dir, unsigned char *filter, unsigned char *title);
+ char *get_write_filename (unsigned char *dir, unsigned char *filter, unsigned char *title);
+ char *get_save_filename (unsigned char *dir, unsigned int *spns);
- VOID CALLBACK timer (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+ VOID CALLBACK timer (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
public:
- PrintWin32 (void);
- virtual ~PrintWin32 (void);
-
- /* Tell modules about me */
- static void init (void);
-
- /* Platform detection */
- static gboolean is_os_wide();
-
- /* Print functions */
- virtual unsigned int setup (Inkscape::Extension::Print * module);
- //virtual unsigned int set_preview (Inkscape::Extension::Print * module);
-
- virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc);
- virtual unsigned int finish (Inkscape::Extension::Print * module);
-
- /* Rendering methods */
- /*
- virtual unsigned int bind (Inkscape::Extension::Print * module, const Geom::Matrix *transform, float opacity);
- virtual unsigned int release (Inkscape::Extension::Print * module);
- virtual unsigned int comment (Inkscape::Extension::Print * module, const char * comment);
- virtual unsigned int image (Inkscape::Extension::Print * module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
- const Geom::Matrix *transform, const SPStyle *style);
- */
-
+ PrintWin32 (void);
+ virtual ~PrintWin32 (void);
+
+ /* Tell modules about me */
+ static void init (void);
+
+ /* Platform detection */
+ static gboolean is_os_wide();
+
+ /* Print functions */
+ virtual unsigned int setup (Inkscape::Extension::Print * module);
+ //virtual unsigned int set_preview (Inkscape::Extension::Print * module);
+
+ virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc);
+ virtual unsigned int finish (Inkscape::Extension::Print * module);
+
+ /* Rendering methods */
+ /*
+ virtual unsigned int bind (Inkscape::Extension::Print * module, const Geom::Matrix *transform, float opacity);
+ virtual unsigned int release (Inkscape::Extension::Print * module);
+ virtual unsigned int comment (Inkscape::Extension::Print * module, const char * comment);
+ virtual unsigned int image (Inkscape::Extension::Print * module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
+ const Geom::Matrix *transform, const SPStyle *style);
+ */
};
} /* namespace Internal */
} /* namespace Extension */
} /* namespace Inkscape */
+#endif // ifdef WIN32
#endif /* __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__ */
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index ce26d2c5f..0fa24ccad 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -443,7 +443,7 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
}
void
-sp_gradient_transform_multiply(SPGradient *gradient, NR::Matrix postmul, bool set)
+sp_gradient_transform_multiply(SPGradient *gradient, Geom::Matrix postmul, bool set)
{
if (set) {
gradient->gradientTransform = postmul;
@@ -819,7 +819,7 @@ Set the position of point point_type of the gradient applied to item (either fil
p_w (in desktop coordinates). Write_repr if you want the change to become permanent.
*/
void
-sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::Point p_w, bool fill_or_stroke, bool write_repr, bool scale)
+sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, Geom::Point p_w, bool fill_or_stroke, bool write_repr, bool scale)
{
SPGradient *gradient = sp_item_gradient (item, fill_or_stroke);
@@ -828,8 +828,8 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
gradient = sp_gradient_convert_to_userspace (gradient, item, fill_or_stroke? "fill" : "stroke");
- NR::Matrix i2d (sp_item_i2d_affine (item));
- NR::Point p = p_w * i2d.inverse();
+ Geom::Matrix i2d (sp_item_i2d_affine (item));
+ Geom::Point p = p_w * i2d.inverse();
p *= (gradient->gradientTransform).inverse();
// now p is in gradient's original coordinates
@@ -840,11 +840,11 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
switch (point_type) {
case POINT_LG_BEGIN:
if (scale) {
- lg->x2.computed += (lg->x1.computed - p[NR::X]);
- lg->y2.computed += (lg->y1.computed - p[NR::Y]);
+ lg->x2.computed += (lg->x1.computed - p[Geom::X]);
+ lg->y2.computed += (lg->y1.computed - p[Geom::Y]);
}
- lg->x1.computed = p[NR::X];
- lg->y1.computed = p[NR::Y];
+ lg->x1.computed = p[Geom::X];
+ lg->y1.computed = p[Geom::Y];
if (write_repr) {
if (scale) {
sp_repr_set_svg_double(repr, "x2", lg->x2.computed);
@@ -858,11 +858,11 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
break;
case POINT_LG_END:
if (scale) {
- lg->x1.computed += (lg->x2.computed - p[NR::X]);
- lg->y1.computed += (lg->y2.computed - p[NR::Y]);
+ lg->x1.computed += (lg->x2.computed - p[Geom::X]);
+ lg->y1.computed += (lg->y2.computed - p[Geom::Y]);
}
- lg->x2.computed = p[NR::X];
- lg->y2.computed = p[NR::Y];
+ lg->x2.computed = p[Geom::X];
+ lg->y2.computed = p[Geom::Y];
if (write_repr) {
if (scale) {
sp_repr_set_svg_double(repr, "x1", lg->x1.computed);
@@ -877,7 +877,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
case POINT_LG_MID:
{
// using X-coordinates only to determine the offset, assuming p has been snapped to the vector from begin to end.
- double offset = get_offset_between_points (p, NR::Point(lg->x1.computed, lg->y1.computed), NR::Point(lg->x2.computed, lg->y2.computed));
+ double offset = get_offset_between_points (p, Geom::Point(lg->x1.computed, lg->y1.computed), Geom::Point(lg->x2.computed, lg->y2.computed));
SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (lg, false);
sp_gradient_ensure_vector(lg);
lg->vector.stops.at(point_i).offset = offset;
@@ -895,21 +895,21 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
}
} else if (SP_IS_RADIALGRADIENT(gradient)) {
SPRadialGradient *rg = SP_RADIALGRADIENT(gradient);
- NR::Point c (rg->cx.computed, rg->cy.computed);
- NR::Point c_w = c * gradient->gradientTransform * i2d; // now in desktop coords
- if ((point_type == POINT_RG_R1 || point_type == POINT_RG_R2) && NR::L2 (p_w - c_w) < 1e-3) {
+ Geom::Point c (rg->cx.computed, rg->cy.computed);
+ Geom::Point c_w = c * gradient->gradientTransform * i2d; // now in desktop coords
+ if ((point_type == POINT_RG_R1 || point_type == POINT_RG_R2) && Geom::L2 (p_w - c_w) < 1e-3) {
// prevent setting a radius too close to the center
return;
}
- NR::Matrix new_transform;
+ Geom::Matrix new_transform;
bool transform_set = false;
switch (point_type) {
case POINT_RG_CENTER:
- rg->fx.computed = p[NR::X] + (rg->fx.computed - rg->cx.computed);
- rg->fy.computed = p[NR::Y] + (rg->fy.computed - rg->cy.computed);
- rg->cx.computed = p[NR::X];
- rg->cy.computed = p[NR::Y];
+ rg->fx.computed = p[Geom::X] + (rg->fx.computed - rg->cx.computed);
+ rg->fy.computed = p[Geom::Y] + (rg->fy.computed - rg->cy.computed);
+ rg->cx.computed = p[Geom::X];
+ rg->cy.computed = p[Geom::Y];
if (write_repr) {
sp_repr_set_svg_double(repr, "fx", rg->fx.computed);
sp_repr_set_svg_double(repr, "fy", rg->fy.computed);
@@ -920,8 +920,8 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
}
break;
case POINT_RG_FOCUS:
- rg->fx.computed = p[NR::X];
- rg->fy.computed = p[NR::Y];
+ rg->fx.computed = p[Geom::X];
+ rg->fy.computed = p[Geom::Y];
if (write_repr) {
sp_repr_set_svg_double(repr, "fx", rg->fx.computed);
sp_repr_set_svg_double(repr, "fy", rg->fy.computed);
@@ -931,17 +931,17 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
break;
case POINT_RG_R1:
{
- NR::Point r1_w = (c + NR::Point(rg->r.computed, 0)) * gradient->gradientTransform * i2d;
- double r1_angle = NR::atan2(r1_w - c_w);
- double move_angle = NR::atan2(p_w - c_w) - r1_angle;
- double move_stretch = NR::L2(p_w - c_w) / NR::L2(r1_w - c_w);
-
- NR::Matrix move = NR::Matrix (Geom::Translate (-c_w)) *
- NR::Matrix (Geom::Rotate(-r1_angle)) *
- NR::Matrix (Geom::Scale(move_stretch, scale? move_stretch : 1)) *
- NR::Matrix (Geom::Rotate(r1_angle)) *
- NR::Matrix (Geom::Rotate(move_angle)) *
- NR::Matrix (Geom::Translate (c_w));
+ Geom::Point r1_w = (c + Geom::Point(rg->r.computed, 0)) * gradient->gradientTransform * i2d;
+ double r1_angle = Geom::atan2(r1_w - c_w);
+ double move_angle = Geom::atan2(p_w - c_w) - r1_angle;
+ double move_stretch = Geom::L2(p_w - c_w) / Geom::L2(r1_w - c_w);
+
+ Geom::Matrix move = Geom::Matrix (Geom::Translate (-c_w)) *
+ Geom::Matrix (Geom::Rotate(-r1_angle)) *
+ Geom::Matrix (Geom::Scale(move_stretch, scale? move_stretch : 1)) *
+ Geom::Matrix (Geom::Rotate(r1_angle)) *
+ Geom::Matrix (Geom::Rotate(move_angle)) *
+ Geom::Matrix (Geom::Translate (c_w));
new_transform = gradient->gradientTransform * i2d * move * i2d.inverse();
transform_set = true;
@@ -950,17 +950,17 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
}
case POINT_RG_R2:
{
- NR::Point r2_w = (c + NR::Point(0, -rg->r.computed)) * gradient->gradientTransform * i2d;
- double r2_angle = NR::atan2(r2_w - c_w);
- double move_angle = NR::atan2(p_w - c_w) - r2_angle;
- double move_stretch = NR::L2(p_w - c_w) / NR::L2(r2_w - c_w);
-
- NR::Matrix move = NR::Matrix (Geom::Translate (-c_w)) *
- NR::Matrix (Geom::Rotate(-r2_angle)) *
- NR::Matrix (Geom::Scale(move_stretch, scale? move_stretch : 1)) *
- NR::Matrix (Geom::Rotate(r2_angle)) *
- NR::Matrix (Geom::Rotate(move_angle)) *
- NR::Matrix (Geom::Translate (c_w));
+ Geom::Point r2_w = (c + Geom::Point(0, -rg->r.computed)) * gradient->gradientTransform * i2d;
+ double r2_angle = Geom::atan2(r2_w - c_w);
+ double move_angle = Geom::atan2(p_w - c_w) - r2_angle;
+ double move_stretch = Geom::L2(p_w - c_w) / Geom::L2(r2_w - c_w);
+
+ Geom::Matrix move = Geom::Matrix (Geom::Translate (-c_w)) *
+ Geom::Matrix (Geom::Rotate(-r2_angle)) *
+ Geom::Matrix (Geom::Scale(move_stretch, scale? move_stretch : 1)) *
+ Geom::Matrix (Geom::Rotate(r2_angle)) *
+ Geom::Matrix (Geom::Rotate(move_angle)) *
+ Geom::Matrix (Geom::Translate (c_w));
new_transform = gradient->gradientTransform * i2d * move * i2d.inverse();
transform_set = true;
@@ -969,8 +969,8 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
}
case POINT_RG_MID1:
{
- NR::Point start = NR::Point (rg->cx.computed, rg->cy.computed);
- NR::Point end = NR::Point (rg->cx.computed + rg->r.computed, rg->cy.computed);
+ Geom::Point start = Geom::Point (rg->cx.computed, rg->cy.computed);
+ Geom::Point end = Geom::Point (rg->cx.computed + rg->r.computed, rg->cy.computed);
double offset = get_offset_between_points (p, start, end);
SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (rg, false);
sp_gradient_ensure_vector(rg);
@@ -985,8 +985,8 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
break;
}
case POINT_RG_MID2:
- NR::Point start = NR::Point (rg->cx.computed, rg->cy.computed);
- NR::Point end = NR::Point (rg->cx.computed, rg->cy.computed - rg->r.computed);
+ Geom::Point start = Geom::Point (rg->cx.computed, rg->cy.computed);
+ Geom::Point end = Geom::Point (rg->cx.computed, rg->cy.computed - rg->r.computed);
double offset = get_offset_between_points (p, start, end);
SPGradient *vector = sp_gradient_get_forked_vector_if_necessary(rg, false);
sp_gradient_ensure_vector(rg);
@@ -1040,7 +1040,7 @@ Returns the position of point point_type of the gradient applied to item (either
in desktop coordinates.
*/
-NR::Point
+Geom::Point
sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke)
{
SPGradient *gradient = sp_item_gradient (item, fill_or_stroke);
@@ -1054,10 +1054,10 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
SPLinearGradient *lg = SP_LINEARGRADIENT(gradient);
switch (point_type) {
case POINT_LG_BEGIN:
- p = NR::Point (lg->x1.computed, lg->y1.computed);
+ p = Geom::Point (lg->x1.computed, lg->y1.computed);
break;
case POINT_LG_END:
- p = NR::Point (lg->x2.computed, lg->y2.computed);
+ p = Geom::Point (lg->x2.computed, lg->y2.computed);
break;
case POINT_LG_MID:
{
diff --git a/src/gradient-chemistry.h b/src/gradient-chemistry.h
index 13e15e5b8..73b9893bc 100644
--- a/src/gradient-chemistry.h
+++ b/src/gradient-chemistry.h
@@ -66,11 +66,11 @@ guint32 average_color (guint32 c1, guint32 c2, gdouble p = 0.5);
SPStop *sp_vector_add_stop (SPGradient *vector, SPStop* prev_stop, SPStop* next_stop, gfloat offset);
-void sp_gradient_transform_multiply (SPGradient *gradient, NR::Matrix postmul, bool set);
+void sp_gradient_transform_multiply (SPGradient *gradient, Geom::Matrix postmul, bool set);
SPGradient * sp_item_gradient (SPItem *item, bool fill_or_stroke);
-void sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::Point p_desk, bool fill_or_stroke, bool write_repr, bool scale);
-NR::Point sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke);
+void sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, Geom::Point p_desk, bool fill_or_stroke, bool write_repr, bool scale);
+Geom::Point sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke);
SPGradient *sp_item_gradient_get_vector (SPItem *item, bool fill_or_stroke);
SPGradientSpread sp_item_gradient_get_spread (SPItem *item, bool fill_or_stroke);
diff --git a/src/libgdl/Makefile_insert b/src/libgdl/Makefile_insert
index 3f07931f8..5869633ea 100644
--- a/src/libgdl/Makefile_insert
+++ b/src/libgdl/Makefile_insert
@@ -34,6 +34,8 @@ libgdl_libgdl_a_SOURCES = \
libgdl/gdl-stock.c \
libgdl/gdl-switcher.h \
libgdl/gdl-switcher.c \
+ libgdl/gdl-win32.h \
+ libgdl/gdl-win32.c \
libgdl/libgdltypebuiltins.h \
libgdl/libgdltypebuiltins.c \
libgdl/libgdlmarshal.h \
diff --git a/src/libgdl/gdl-win32.c b/src/libgdl/gdl-win32.c
index 68df2f67d..f23036ed6 100644
--- a/src/libgdl/gdl-win32.c
+++ b/src/libgdl/gdl-win32.c
@@ -7,12 +7,10 @@
*
* This code is in public domain
*/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#ifdef WIN32
#include "gdl-win32.h"
+#include <windows.h>
/* Platform detection */
gboolean
@@ -40,3 +38,5 @@ is_os_vista()
return is_vista;
}
+
+#endif
diff --git a/src/libgdl/gdl-win32.h b/src/libgdl/gdl-win32.h
index 21361e982..90c0cbafa 100644
--- a/src/libgdl/gdl-win32.h
+++ b/src/libgdl/gdl-win32.h
@@ -1,6 +1,3 @@
-#ifndef __INKSCAPE_GDL_WIN32_H__
-#define __INKSCAPE_GDL_WIN32_H__
-
/*
* Windows stuff
*
@@ -9,22 +6,16 @@
*
* This code is in public domain
*/
+#ifndef __INKSCAPE_GDL_WIN32_H__
+#define __INKSCAPE_GDL_WIN32_H__
+#ifdef WIN32
-
-
-#define WIN32_MAJORVERSION_VISTA 0x0006
-
-
-
-#include <config.h>
-#include <windows.h>
#include <gdk/gdk.h>
-#ifndef WIN32
-#error "This file is only usable for Windows"
-#endif
+#define WIN32_MAJORVERSION_VISTA 0x0006
/* Platform detection */
gboolean is_os_vista();
+#endif // ifdef WIN32
#endif /* __INKSCAPE_GDL_WIN32_H__ */
diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp
index f2d3be60a..71387ac55 100644
--- a/src/libnrtype/FontFactory.cpp
+++ b/src/libnrtype/FontFactory.cpp
@@ -8,6 +8,8 @@
*
*/
+#define PANGO_ENABLE_ENGINE
+
#include "FontFactory.h"
#include <libnrtype/font-instance.h>
diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp
index 25a6af935..d7d45b1e3 100644
--- a/src/libnrtype/FontInstance.cpp
+++ b/src/libnrtype/FontInstance.cpp
@@ -8,6 +8,8 @@
*
*/
+#define PANGO_ENABLE_ENGINE
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
diff --git a/src/libnrtype/Layout-TNG-Input.cpp b/src/libnrtype/Layout-TNG-Input.cpp
index dcf76b3bd..a5ae1cd81 100644
--- a/src/libnrtype/Layout-TNG-Input.cpp
+++ b/src/libnrtype/Layout-TNG-Input.cpp
@@ -9,6 +9,8 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#define PANGO_ENABLE_ENGINE
+
#include <gtk/gtkversion.h>
#include "Layout-TNG.h"
#include "style.h"
diff --git a/src/main.cpp b/src/main.cpp
index 229ef65f7..5e1e6f64b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -515,19 +515,10 @@ static int set_extensions_env()
char *oldenv = getenv("PYTHONPATH");
Glib::ustring tmp = INKSCAPE_EXTENSIONDIR;
if (oldenv != NULL) {
-#ifdef WIN32
- tmp += ";";
-#else
- tmp += ":";
-#endif
+ tmp += G_SEARCHPATH_SEPARATOR;
tmp += oldenv;
}
-#ifdef WIN32
- /// \todo this does not work on windows, cannot find the setenv method or an equivalent.
- //setenv("PYTHONPATH", tmp.c_str(), 1);
-#else
- setenv("PYTHONPATH", tmp.c_str(), 1);
-#endif
+ g_setenv("PYTHONPATH", tmp.c_str(), TRUE);
return 0;
}
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index bb63a014d..3481f6ed2 100644
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -2804,12 +2804,12 @@ static void sp_node_set_selected(Inkscape::NodePath::Node *node, gboolean select
node->selected = selected;
if (selected) {
- node->knot->setSize ((node->type == Inkscape::NodePath::NODE_CUSP) ? 11 : 9);
+ node->knot->setSize ((node->type == Inkscape::NodePath::NODE_CUSP || node->type == Inkscape::NodePath::NODE_AUTO) ? 11 : 9);
node->knot->setFill(NODE_FILL_SEL, NODE_FILL_SEL_HI, NODE_FILL_SEL_HI);
node->knot->setStroke(NODE_STROKE_SEL, NODE_STROKE_SEL_HI, NODE_STROKE_SEL_HI);
sp_knot_update_ctrl(node->knot);
} else {
- node->knot->setSize ((node->type == Inkscape::NodePath::NODE_CUSP) ? 9 : 7);
+ node->knot->setSize ((node->type == Inkscape::NodePath::NODE_CUSP || node->type == Inkscape::NodePath::NODE_AUTO) ? 9 : 7);
node->knot->setFill(NODE_FILL, NODE_FILL_HI, NODE_FILL_HI);
node->knot->setStroke(NODE_STROKE, NODE_STROKE_HI, NODE_STROKE_HI);
sp_knot_update_ctrl(node->knot);
@@ -4600,12 +4600,11 @@ sp_nodepath_node_new(Inkscape::NodePath::SubPath *sp, Inkscape::NodePath::Node *
n->knot = sp_knot_new(sp->nodepath->desktop, _("<b>Node</b>: drag to edit the path; with <b>Ctrl</b> to snap to horizontal/vertical; with <b>Ctrl+Alt</b> to snap to handles' directions"));
sp_knot_set_position(n->knot, *pos, 0);
- n->knot->setShape ((n->type == Inkscape::NodePath::NODE_CUSP)? SP_KNOT_SHAPE_DIAMOND : (n->type == Inkscape::NodePath::NODE_AUTO)? SP_KNOT_SHAPE_CIRCLE : SP_KNOT_SHAPE_SQUARE);
- n->knot->setSize ((n->type == Inkscape::NodePath::NODE_CUSP)? 9 : 7);
n->knot->setAnchor (GTK_ANCHOR_CENTER);
n->knot->setFill(NODE_FILL, NODE_FILL_HI, NODE_FILL_HI);
n->knot->setStroke(NODE_STROKE, NODE_STROKE_HI, NODE_STROKE_HI);
- sp_knot_update_ctrl(n->knot);
+
+ sp_nodepath_update_node_knot(n);
g_signal_connect(G_OBJECT(n->knot), "event", G_CALLBACK(node_event), n);
g_signal_connect(G_OBJECT(n->knot), "clicked", G_CALLBACK(node_clicked), n);
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index eb399d191..4f4d287ad 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -1110,7 +1110,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
case GDK_BackSpace:
case GDK_Delete:
case GDK_KP_Delete:
- if (pc->green_curve->is_empty()) {
+ if ( pc->green_curve->is_empty() || (pc->green_curve->last_segment() == NULL) ) {
if (!pc->red_curve->is_empty()) {
pen_cancel (pc);
ret = TRUE;
@@ -1132,8 +1132,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
break;
}
// The code below assumes that pc->green_curve has only ONE path !
- Geom::Path const & path = pc->green_curve->get_pathvector().back();
- Geom::Curve const * crv = &path.back_default();
+ Geom::Curve const * crv = pc->green_curve->last_segment();
pc->p[0] = crv->initialPoint();
if ( Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>(crv)) {
pc->p[1] = (*cubic)[1];
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 08449720d..86bf64f01 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2220,7 +2220,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
// calculate the transform to be applied to objects to move them to 0,0
Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - (r->min() + Geom::Point (0, r->dimensions()[NR::Y]));
move_p[Geom::Y] = -move_p[Geom::Y];
- NR::Matrix move = NR::Matrix (Geom::Translate (move_p));
+ Geom::Matrix move = Geom::Matrix (Geom::Translate (move_p));
GSList *items = g_slist_copy((GSList *) selection->itemList());
@@ -2229,7 +2229,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
// bottommost object, after sorting
SPObject *parent = SP_OBJECT_PARENT (items->data);
- NR::Matrix parent_transform (sp_item_i2root_affine(SP_ITEM(parent)));
+ Geom::Matrix parent_transform (sp_item_i2root_affine(SP_ITEM(parent)));
// remember the position of the first item
gint pos = SP_OBJECT_REPR (items->data)->position();
@@ -2243,7 +2243,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
// restore the z-order after prepends
repr_copies = g_slist_reverse (repr_copies);
- NR::Rect bounds(desktop->dt2doc(r->min()), desktop->dt2doc(r->max()));
+ Geom::Rect bounds(desktop->dt2doc(r->min()), desktop->dt2doc(r->max()));
if (apply) {
// delete objects so that their clones don't get alerted; this object will be restored shortly
@@ -2261,9 +2261,9 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
gchar const *pat_id = pattern_tile(repr_copies, bounds, doc,
- ( NR::Matrix(Geom::Translate(desktop->dt2doc(NR::Point(r->min()[NR::X],
- r->max()[NR::Y]))))
- * parent_transform.inverse() ),
+ ( Geom::Matrix(Geom::Translate(desktop->dt2doc(Geom::Point(r->min()[Geom::X],
+ r->max()[Geom::Y]))))
+ * to_2geom(parent_transform.inverse()) ),
parent_transform * move);
// restore compensation setting
@@ -2273,13 +2273,13 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
Inkscape::XML::Node *rect = xml_doc->createElement("svg:rect");
rect->setAttribute("style", g_strdup_printf("stroke:none;fill:url(#%s)", pat_id));
- NR::Point min = bounds.min() * parent_transform.inverse();
- NR::Point max = bounds.max() * parent_transform.inverse();
+ Geom::Point min = bounds.min() * to_2geom(parent_transform.inverse());
+ Geom::Point max = bounds.max() * to_2geom(parent_transform.inverse());
- sp_repr_set_svg_double(rect, "width", max[NR::X] - min[NR::X]);
- sp_repr_set_svg_double(rect, "height", max[NR::Y] - min[NR::Y]);
- sp_repr_set_svg_double(rect, "x", min[NR::X]);
- sp_repr_set_svg_double(rect, "y", min[NR::Y]);
+ sp_repr_set_svg_double(rect, "width", max[Geom::X] - min[Geom::X]);
+ sp_repr_set_svg_double(rect, "height", max[Geom::Y] - min[Geom::Y]);
+ sp_repr_set_svg_double(rect, "x", min[Geom::X]);
+ sp_repr_set_svg_double(rect, "y", min[Geom::Y]);
// restore parent and position
SP_OBJECT_REPR (parent)->appendChild(rect);
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 0b1c4f5c9..614ce7584 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -932,8 +932,8 @@ gboolean Inkscape::SelTrans::scaleRequest(Geom::Point &pt, guint state)
}
// Snap along a suitable constraint vector from the origin.
- bb = m.constrainedSnapScale(SnapPreferences::SNAPPOINT_BBOX, _bbox_points, default_scale, _origin_for_bboxpoints);
- sn = m.constrainedSnapScale(SnapPreferences::SNAPPOINT_NODE, _snap_points, geom_scale, _origin_for_specpoints);
+ bb = m.constrainedSnapScale(SnapPreferences::SNAPPOINT_BBOX, _bbox_points, _point, default_scale, _origin_for_bboxpoints);
+ sn = m.constrainedSnapScale(SnapPreferences::SNAPPOINT_NODE, _snap_points, _point, geom_scale, _origin_for_specpoints);
/* Choose the smaller difference in scale. Since s[X] == s[Y] we can
** just compare difference in s[X].
@@ -942,8 +942,8 @@ gboolean Inkscape::SelTrans::scaleRequest(Geom::Point &pt, guint state)
sd = sn.getSnapped() ? fabs(sn.getTransformation()[Geom::X] - geom_scale[Geom::X]) : NR_HUGE;
} else {
/* Scale aspect ratio is unlocked */
- bb = m.freeSnapScale(SnapPreferences::SNAPPOINT_BBOX, _bbox_points, default_scale, _origin_for_bboxpoints);
- sn = m.freeSnapScale(SnapPreferences::SNAPPOINT_NODE, _snap_points, geom_scale, _origin_for_specpoints);
+ bb = m.freeSnapScale(SnapPreferences::SNAPPOINT_BBOX, _bbox_points, _point, default_scale, _origin_for_bboxpoints);
+ sn = m.freeSnapScale(SnapPreferences::SNAPPOINT_NODE, _snap_points, _point, geom_scale, _origin_for_specpoints);
/* Pick the snap that puts us closest to the original scale */
bd = bb.getSnapped() ? fabs(Geom::L2(bb.getTransformation()) - Geom::L2(Geom::Point(default_scale[Geom::X], default_scale[Geom::Y]))) : NR_HUGE;
@@ -1031,8 +1031,8 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, Geom
bool symmetrical = state & GDK_CONTROL_MASK;
- bb = m.constrainedSnapStretch(SnapPreferences::SNAPPOINT_BBOX, _bbox_points, Geom::Coord(default_scale[axis]), _origin_for_bboxpoints, Geom::Dim2(axis), symmetrical);
- sn = m.constrainedSnapStretch(SnapPreferences::SNAPPOINT_NODE, _snap_points, Geom::Coord(geom_scale[axis]), _origin_for_specpoints, Geom::Dim2(axis), symmetrical);
+ bb = m.constrainedSnapStretch(SnapPreferences::SNAPPOINT_BBOX, _bbox_points, _point, Geom::Coord(default_scale[axis]), _origin_for_bboxpoints, Geom::Dim2(axis), symmetrical);
+ sn = m.constrainedSnapStretch(SnapPreferences::SNAPPOINT_NODE, _snap_points, _point, Geom::Coord(geom_scale[axis]), _origin_for_specpoints, Geom::Dim2(axis), symmetrical);
if (bb.getSnapped()) {
// We snapped the bbox (which is either visual or geometric)
@@ -1149,7 +1149,7 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, Geom::P
Inkscape::Snapper::ConstraintLine const constraint(component_vectors[dim_b]);
// When skewing, we cannot snap the corners of the bounding box, see the comment in "constrainedSnapSkew" for details
Geom::Point const s(skew[dim_a], scale[dim_a]);
- Inkscape::SnappedPoint sn = m.constrainedSnapSkew(Inkscape::SnapPreferences::SNAPPOINT_NODE, _snap_points, constraint, s, _origin, Geom::Dim2(dim_b));
+ Inkscape::SnappedPoint sn = m.constrainedSnapSkew(Inkscape::SnapPreferences::SNAPPOINT_NODE, _snap_points, _point, constraint, s, _origin, Geom::Dim2(dim_b));
if (sn.getSnapped()) {
// We snapped something, so change the skew to reflect it
@@ -1384,11 +1384,13 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
// individually for each point to be snapped; this will be handled however by _snapTransformed()
s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX,
_bbox_points,
+ _point,
Inkscape::Snapper::ConstraintLine(component_vectors[dim]),
dxy));
s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE,
_snap_points,
+ _point,
Inkscape::Snapper::ConstraintLine(component_vectors[dim]),
dxy));
}
@@ -1401,8 +1403,8 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
g_get_current_time(&starttime); */
/* Snap to things with no constraint */
- s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, _bbox_points, dxy));
- s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, _snap_points, dxy));
+ s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, _bbox_points, _point, dxy));
+ s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, _snap_points, _point, dxy));
/*g_get_current_time(&endtime);
double elapsed = ((((double)endtime.tv_sec - starttime.tv_sec) * G_USEC_PER_SEC + (endtime.tv_usec - starttime.tv_usec))) / 1000.0;
diff --git a/src/snap-preferences.cpp b/src/snap-preferences.cpp
index f1ad0fd0d..0bfd94c71 100644
--- a/src/snap-preferences.cpp
+++ b/src/snap-preferences.cpp
@@ -22,7 +22,8 @@ Inkscape::SnapPreferences::PointType const Inkscape::SnapPreferences::SNAPPOINT_
Inkscape::SnapPreferences::SnapPreferences() :
_include_item_center(false),
- _snap_enabled_globally(true)
+ _snap_enabled_globally(true),
+ _snap_postponed_globally(false)
{
setSnapFrom(SNAPPOINT_BBOX | SNAPPOINT_NODE, true); //Snap any point. In v0.45 and earlier, this was controlled in the preferences tab
}
diff --git a/src/snap.cpp b/src/snap.cpp
index 6fa99f288..e0c83ad36 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -313,7 +313,8 @@ void SnapManager::guideSnap(Geom::Point &p, Geom::Point const &guide_normal) con
* of duplicated code.
*
* \param type Type of points being snapped.
- * \param points List of points to snap.
+ * \param points List of points to snap (i.e. untransformed).
+ * \param pointer Location of the mouse pointer, at the time when dragging started (i.e. "untransformed")
* \param constrained true if the snap is constrained.
* \param constraint Constraint line to use, if `constrained' is true, otherwise undefined.
* \param transformation_type Type of transformation to apply to points before trying to snap them.
@@ -326,6 +327,7 @@ void SnapManager::guideSnap(Geom::Point &p, Geom::Point const &guide_normal) con
Inkscape::SnappedPoint SnapManager::_snapTransformed(
Inkscape::SnapPreferences::PointType type,
std::vector<Geom::Point> const &points,
+ Geom::Point const &pointer,
bool constrained,
Inkscape::Snapper::ConstraintLine const &constraint,
Transformation transformation_type,
@@ -446,6 +448,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
} else {
snapped_point = freeSnap(type, *j, i == points.begin(), bbox);
}
+ snapped_point.setPointerDistance(Geom::L2(pointer - *i));
}
Geom::Point result;
@@ -592,9 +595,10 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
Inkscape::SnappedPoint SnapManager::freeSnapTranslation(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Geom::Point const &tr) const
{
- return _snapTransformed(point_type, p, false, Geom::Point(), TRANSLATION, tr, Geom::Point(), Geom::X, false);
+ return _snapTransformed(point_type, p, pointer, false, Geom::Point(), TRANSLATION, tr, Geom::Point(), Geom::X, false);
}
@@ -612,10 +616,11 @@ Inkscape::SnappedPoint SnapManager::freeSnapTranslation(Inkscape::SnapPreference
Inkscape::SnappedPoint SnapManager::constrainedSnapTranslation(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Inkscape::Snapper::ConstraintLine const &constraint,
Geom::Point const &tr) const
{
- return _snapTransformed(point_type, p, true, constraint, TRANSLATION, tr, Geom::Point(), Geom::X, false);
+ return _snapTransformed(point_type, p, pointer, true, constraint, TRANSLATION, tr, Geom::Point(), Geom::X, false);
}
@@ -632,10 +637,11 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapTranslation(Inkscape::SnapPre
Inkscape::SnappedPoint SnapManager::freeSnapScale(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Geom::Scale const &s,
Geom::Point const &o) const
{
- return _snapTransformed(point_type, p, false, Geom::Point(), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, false);
+ return _snapTransformed(point_type, p, pointer, false, Geom::Point(), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, false);
}
@@ -653,11 +659,12 @@ Inkscape::SnappedPoint SnapManager::freeSnapScale(Inkscape::SnapPreferences::Poi
Inkscape::SnappedPoint SnapManager::constrainedSnapScale(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Geom::Scale const &s,
Geom::Point const &o) const
{
// When constrained scaling, only uniform scaling is supported.
- return _snapTransformed(point_type, p, true, Geom::Point(), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, true);
+ return _snapTransformed(point_type, p, pointer, true, Geom::Point(), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, true);
}
@@ -676,12 +683,13 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapScale(Inkscape::SnapPreferenc
Inkscape::SnappedPoint SnapManager::constrainedSnapStretch(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Geom::Coord const &s,
Geom::Point const &o,
Geom::Dim2 d,
bool u) const
{
- return _snapTransformed(point_type, p, true, Geom::Point(), STRETCH, Geom::Point(s, s), o, d, u);
+ return _snapTransformed(point_type, p, pointer, true, Geom::Point(), STRETCH, Geom::Point(s, s), o, d, u);
}
@@ -699,6 +707,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapStretch(Inkscape::SnapPrefere
Inkscape::SnappedPoint SnapManager::constrainedSnapSkew(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Inkscape::Snapper::ConstraintLine const &constraint,
Geom::Point const &s,
Geom::Point const &o,
@@ -712,7 +721,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapSkew(Inkscape::SnapPreference
// so it's corners have a different transformation. The snappers cannot handle this, therefore snapping
// of bounding boxes is not allowed here.
g_assert(!(point_type & Inkscape::SnapPreferences::SNAPPOINT_BBOX));
- return _snapTransformed(point_type, p, true, constraint, SKEW, s, o, d, false);
+ return _snapTransformed(point_type, p, pointer, true, constraint, SKEW, s, o, d, false);
}
Inkscape::SnappedPoint SnapManager::findBestSnap(Geom::Point const &p, SnappedConstraints &sc, bool constrained) const
diff --git a/src/snap.h b/src/snap.h
index 624f7adac..15b4bd095 100644
--- a/src/snap.h
+++ b/src/snap.h
@@ -83,25 +83,30 @@ public:
Inkscape::SnappedPoint freeSnapTranslation(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Geom::Point const &tr) const;
Inkscape::SnappedPoint constrainedSnapTranslation(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Inkscape::Snapper::ConstraintLine const &constraint,
Geom::Point const &tr) const;
Inkscape::SnappedPoint freeSnapScale(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Geom::Scale const &s,
Geom::Point const &o) const;
Inkscape::SnappedPoint constrainedSnapScale(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Geom::Scale const &s,
Geom::Point const &o) const;
Inkscape::SnappedPoint constrainedSnapStretch(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Geom::Coord const &s,
Geom::Point const &o,
Geom::Dim2 d,
@@ -109,6 +114,7 @@ public:
Inkscape::SnappedPoint constrainedSnapSkew(Inkscape::SnapPreferences::PointType point_type,
std::vector<Geom::Point> const &p,
+ Geom::Point const &pointer,
Inkscape::Snapper::ConstraintLine const &constraint,
Geom::Point const &s, // s[0] = skew factor, s[1] = scale factor
Geom::Point const &o,
@@ -144,6 +150,7 @@ private:
Inkscape::SnappedPoint _snapTransformed(Inkscape::SnapPreferences::PointType type,
std::vector<Geom::Point> const &points,
+ Geom::Point const &pointer,
bool constrained,
Inkscape::Snapper::ConstraintLine const &constraint,
Transformation transformation_type,
diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp
index 4176d4a3d..1177e5f14 100644
--- a/src/snapped-point.cpp
+++ b/src/snapped-point.cpp
@@ -21,6 +21,7 @@ Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapTargetType const
_second_tolerance = 0;
_second_always_snap = false;
_transformation = Geom::Point(1,1);
+ _pointer_distance = 0;
}
Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &at_intersection, bool const &fully_constrained, Geom::Coord const &d2, Geom::Coord const &t2, bool const &a2)
@@ -28,6 +29,7 @@ Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapTargetType const
_second_distance(d2), _second_tolerance(t2), _second_always_snap(a2)
{
_transformation = Geom::Point(1,1);
+ _pointer_distance = 0;
}
Inkscape::SnappedPoint::SnappedPoint()
@@ -42,45 +44,13 @@ Inkscape::SnappedPoint::SnappedPoint()
_second_tolerance = 0;
_second_always_snap = false;
_transformation = Geom::Point(1,1);
+ _pointer_distance = 0;
}
-
-
Inkscape::SnappedPoint::~SnappedPoint()
{
}
-Geom::Coord Inkscape::SnappedPoint::getDistance() const
-{
- return _distance;
-}
-
-Geom::Coord Inkscape::SnappedPoint::getTolerance() const
-{
- return _tolerance;
-}
-
-bool Inkscape::SnappedPoint::getAlwaysSnap() const
-{
- return _always_snap;
-}
-
-Geom::Coord Inkscape::SnappedPoint::getSecondDistance() const
-{
- return _second_distance;
-}
-
-Geom::Coord Inkscape::SnappedPoint::getSecondTolerance() const
-{
- return _second_tolerance;
-}
-
-bool Inkscape::SnappedPoint::getSecondAlwaysSnap() const
-{
- return _second_always_snap;
-}
-
-
void Inkscape::SnappedPoint::getPoint(Geom::Point &p) const
{
// When we have snapped
@@ -107,23 +77,26 @@ bool getClosestSP(std::list<Inkscape::SnappedPoint> &list, Inkscape::SnappedPoin
bool Inkscape::SnappedPoint::isOtherOneBetter(Inkscape::SnappedPoint const &other_one) const
{
- // If it's closer
- bool c2 = other_one.getDistance() < getDistance();
+ double const w = 0.25; // weigth factor: controls which node should be preferrerd for snapping, which is either
+ // the node with the closest snap (w = 0), or the node closest to the mousepointer (w = 1)
+
+ // If it's closer
+ bool c1 = (w * other_one.getPointerDistance() + (1-w) * other_one.getDistance()) < (w * getPointerDistance() + (1-w) * getDistance());
// or, if it's for a snapper with "always snap" turned on, and the previous wasn't
- bool c3 = other_one.getAlwaysSnap() && !getAlwaysSnap();
+ bool c2 = other_one.getAlwaysSnap() && !getAlwaysSnap();
// But in no case fall back from a snapper with "always snap" on to one with "always snap" off
- bool c3n = !other_one.getAlwaysSnap() && getAlwaysSnap();
+ bool c2n = !other_one.getAlwaysSnap() && getAlwaysSnap();
// or, if we have a fully constrained snappoint (e.g. to a node), while the previous one was only partly constrained (e.g. to a line)
- bool c4 = other_one.getFullyConstrained() && !getFullyConstrained();
+ bool c3 = other_one.getFullyConstrained() && !getFullyConstrained();
// But in no case fall back; (has less priority than c3n, so it is allowed to fall back when c3 is true, see below)
- bool c4n = !other_one.getFullyConstrained() && getFullyConstrained();
+ bool c3n = !other_one.getFullyConstrained() && getFullyConstrained();
// or, if it's just as close then consider the second distance
// (which is only relevant for points at an intersection)
- bool c5a = (other_one.getDistance() == getDistance());
- bool c5b = other_one.getSecondDistance() < getSecondDistance();
+ bool c4a = (other_one.getDistance() == getDistance());
+ bool c4b = other_one.getSecondDistance() < getSecondDistance();
- // std::cout << "c2 = " << c2 << " | c3 = " << c3 << " | c3n = " << c3n << " | c4 = " << c4 << " | c4n = " << c4n << " | c5a = " << c5a << " | c5b = " << c5b;
- return (c2 || c3 || c4 || (c5a && c5b)) && !c3n && (!c4n || c3);
+ // std::cout << "c1 = " << c1 << " | c2 = " << c2 << " | c2n = " << c2n << " | c3 = " << c3 << " | c3n = " << c3n << " | c4a = " << c4a << " | c4b = " << c4b;
+ return (c1 || c2 || c3 || (c4a && c4b)) && !c2n && (!c3n || c2);
}
/*
diff --git a/src/snapped-point.h b/src/snapped-point.h
index 575fd0e1c..254e46421 100644
--- a/src/snapped-point.h
+++ b/src/snapped-point.h
@@ -46,14 +46,16 @@ public:
SnappedPoint(Geom::Point const &p, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &fully_constrained);
~SnappedPoint();
- Geom::Coord getDistance() const;
+ Geom::Coord getDistance() const {return _distance;}
void setDistance(Geom::Coord const d) {_distance = d;}
- Geom::Coord getTolerance() const;
- bool getAlwaysSnap() const;
- Geom::Coord getSecondDistance() const;
+ Geom::Coord getTolerance() const {return _tolerance;}
+ bool getAlwaysSnap() const {return _always_snap;}
+ Geom::Coord getSecondDistance() const {return _second_distance;}
void setSecondDistance(Geom::Coord const d) {_second_distance = d;}
- Geom::Coord getSecondTolerance() const;
- bool getSecondAlwaysSnap() const;
+ Geom::Coord getSecondTolerance() const {return _second_tolerance;}
+ bool getSecondAlwaysSnap() const {return _second_always_snap;}
+ Geom::Coord getPointerDistance() const {return _pointer_distance;}
+ void setPointerDistance(Geom::Coord const d) {_pointer_distance = d;}
/* This is the preferred method to find out which point we have snapped
* to, because it only returns a point if snapping has actually occured
@@ -104,6 +106,8 @@ protected:
bool _second_always_snap;
/* The transformation (translation, scale, skew, or stretch) from the original point to the snapped point */
Geom::Point _transformation;
+ /* Distance from the un-transformed point to the mouse pointer, measured at the point in time when dragging started */
+ Geom::Coord _pointer_distance;
};
}
diff --git a/src/sp-gradient-test.h b/src/sp-gradient-test.h
index b41ac5b9b..bc188401b 100644
--- a/src/sp-gradient-test.h
+++ b/src/sp-gradient-test.h
@@ -9,6 +9,7 @@
#include "svg/svg.h"
#include "xml/repr.h"
#include <2geom/transforms.h>
+#include "helper/geom.h"
class SPGradientTest : public DocumentUsingTest
{
@@ -32,8 +33,8 @@ public:
{
SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
if ( gr ) {
- UTEST_ASSERT(gr->gradientTransform.test_identity());
- UTEST_ASSERT(gr->gradientTransform == NR::identity());
+ UTEST_ASSERT(gr->gradientTransform.isIdentity());
+ UTEST_ASSERT(gr->gradientTransform == Geom::identity());
g_object_unref(gr);
dst = new SPGradientTest();
@@ -56,13 +57,13 @@ public:
SP_OBJECT(gr)->document = _doc;
sp_object_set(SP_OBJECT(gr), SP_ATTR_GRADIENTTRANSFORM, "translate(5, 8)");
- TS_ASSERT_EQUALS( gr->gradientTransform, NR::Matrix(Geom::Translate(5, 8)) );
+ TS_ASSERT_EQUALS( gr->gradientTransform, Geom::Matrix(Geom::Translate(5, 8)) );
sp_object_set(SP_OBJECT(gr), SP_ATTR_GRADIENTTRANSFORM, "");
- TS_ASSERT_EQUALS( gr->gradientTransform, NR::identity() );
+ TS_ASSERT_EQUALS( gr->gradientTransform, Geom::identity() );
sp_object_set(SP_OBJECT(gr), SP_ATTR_GRADIENTTRANSFORM, "rotate(90)");
- TS_ASSERT_EQUALS( gr->gradientTransform, NR::Matrix(rotate_degrees(90)) );
+ TS_ASSERT_EQUALS( gr->gradientTransform, Geom::Matrix(rotate_degrees(90)) );
g_object_unref(gr);
}
@@ -79,10 +80,10 @@ public:
SP_OBJECT(gr)->updateRepr(repr, SP_OBJECT_WRITE_ALL);
{
gchar const *tr = repr->attribute("gradientTransform");
- NR::Matrix svd;
+ Geom::Matrix svd;
bool const valid = sp_svg_transform_read(tr, &svd);
TS_ASSERT( valid );
- TS_ASSERT_EQUALS( svd, NR::Matrix(rotate_degrees(90)) );
+ TS_ASSERT_EQUALS( svd, Geom::Matrix(rotate_degrees(90)) );
}
g_object_unref(gr);
@@ -93,53 +94,53 @@ public:
{
SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
SP_OBJECT(gr)->document = _doc;
- NR::Matrix const grXform(2, 1,
+ Geom::Matrix const grXform(2, 1,
1, 3,
4, 6);
gr->gradientTransform = grXform;
- NR::Rect const unit_rect(NR::Point(0, 0), NR::Point(1, 1));
+ Geom::Rect const unit_rect(Geom::Point(0, 0), Geom::Point(1, 1));
{
- NR::Matrix const g2d(sp_gradient_get_g2d_matrix(gr, NR::identity(), unit_rect));
- NR::Matrix const gs2d(sp_gradient_get_gs2d_matrix(gr, NR::identity(), unit_rect));
- TS_ASSERT_EQUALS( g2d, NR::identity() );
- TS_ASSERT( NR::matrix_equalp(gs2d, gr->gradientTransform * g2d, 1e-12) );
+ Geom::Matrix const g2d(sp_gradient_get_g2d_matrix(gr, Geom::identity(), unit_rect));
+ Geom::Matrix const gs2d(sp_gradient_get_gs2d_matrix(gr, Geom::identity(), unit_rect));
+ TS_ASSERT_EQUALS( g2d, Geom::identity() );
+ TS_ASSERT( Geom::matrix_equalp(gs2d, gr->gradientTransform * g2d, 1e-12) );
- sp_gradient_set_gs2d_matrix(gr, NR::identity(), unit_rect, gs2d);
- TS_ASSERT( NR::matrix_equalp(gr->gradientTransform, grXform, 1e-12) );
+ sp_gradient_set_gs2d_matrix(gr, Geom::identity(), unit_rect, gs2d);
+ TS_ASSERT( Geom::matrix_equalp(gr->gradientTransform, grXform, 1e-12) );
}
gr->gradientTransform = grXform;
- NR::Matrix const funny(2, 3,
+ Geom::Matrix const funny(2, 3,
4, 5,
6, 7);
{
- NR::Matrix const g2d(sp_gradient_get_g2d_matrix(gr, funny, unit_rect));
- NR::Matrix const gs2d(sp_gradient_get_gs2d_matrix(gr, funny, unit_rect));
+ Geom::Matrix const g2d(sp_gradient_get_g2d_matrix(gr, funny, unit_rect));
+ Geom::Matrix const gs2d(sp_gradient_get_gs2d_matrix(gr, funny, unit_rect));
TS_ASSERT_EQUALS( g2d, funny );
- TS_ASSERT( NR::matrix_equalp(gs2d, gr->gradientTransform * g2d, 1e-12) );
+ TS_ASSERT( Geom::matrix_equalp(gs2d, gr->gradientTransform * g2d, 1e-12) );
sp_gradient_set_gs2d_matrix(gr, funny, unit_rect, gs2d);
- TS_ASSERT( NR::matrix_equalp(gr->gradientTransform, grXform, 1e-12) );
+ TS_ASSERT( Geom::matrix_equalp(gr->gradientTransform, grXform, 1e-12) );
}
gr->gradientTransform = grXform;
- NR::Rect const larger_rect(NR::Point(5, 6), NR::Point(8, 10));
+ Geom::Rect const larger_rect(Geom::Point(5, 6), Geom::Point(8, 10));
{
- NR::Matrix const g2d(sp_gradient_get_g2d_matrix(gr, funny, larger_rect));
- NR::Matrix const gs2d(sp_gradient_get_gs2d_matrix(gr, funny, larger_rect));
- TS_ASSERT_EQUALS( g2d, NR::Matrix(3, 0,
+ Geom::Matrix const g2d(sp_gradient_get_g2d_matrix(gr, funny, larger_rect));
+ Geom::Matrix const gs2d(sp_gradient_get_gs2d_matrix(gr, funny, larger_rect));
+ TS_ASSERT_EQUALS( g2d, Geom::Matrix(3, 0,
0, 4,
5, 6) * funny );
- TS_ASSERT( NR::matrix_equalp(gs2d, gr->gradientTransform * g2d, 1e-12) );
+ TS_ASSERT( Geom::matrix_equalp(gs2d, gr->gradientTransform * g2d, 1e-12) );
sp_gradient_set_gs2d_matrix(gr, funny, larger_rect, gs2d);
- TS_ASSERT( NR::matrix_equalp(gr->gradientTransform, grXform, 1e-12) );
+ TS_ASSERT( Geom::matrix_equalp(gr->gradientTransform, grXform, 1e-12) );
sp_object_set(SP_OBJECT(gr), SP_ATTR_GRADIENTUNITS, "userSpaceOnUse");
- NR::Matrix const user_g2d(sp_gradient_get_g2d_matrix(gr, funny, larger_rect));
- NR::Matrix const user_gs2d(sp_gradient_get_gs2d_matrix(gr, funny, larger_rect));
+ Geom::Matrix const user_g2d(sp_gradient_get_g2d_matrix(gr, funny, larger_rect));
+ Geom::Matrix const user_gs2d(sp_gradient_get_gs2d_matrix(gr, funny, larger_rect));
TS_ASSERT_EQUALS( user_g2d, funny );
- TS_ASSERT( NR::matrix_equalp(user_gs2d, gr->gradientTransform * user_g2d, 1e-12) );
+ TS_ASSERT( Geom::matrix_equalp(user_gs2d, gr->gradientTransform * user_g2d, 1e-12) );
}
g_object_unref(gr);
}
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index 3383de8c8..5c973cf0d 100644
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -375,7 +375,7 @@ sp_gradient_init(SPGradient *gr)
gr->units = SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX;
gr->units_set = FALSE;
- gr->gradientTransform = NR::identity();
+ gr->gradientTransform = Geom::identity();
gr->gradientTransform_set = FALSE;
gr->spread = SP_GRADIENT_SPREAD_PAD;
@@ -478,12 +478,12 @@ sp_gradient_set(SPObject *object, unsigned key, gchar const *value)
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_GRADIENTTRANSFORM: {
- NR::Matrix t;
+ Geom::Matrix t;
if (value && sp_svg_transform_read(value, &t)) {
gr->gradientTransform = t;
gr->gradientTransform_set = TRUE;
} else {
- gr->gradientTransform = NR::identity();
+ gr->gradientTransform = Geom::identity();
gr->gradientTransform_set = FALSE;
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -1248,8 +1248,8 @@ sp_gradient_render_vector_block_rgb(SPGradient *gradient, guchar *buf,
}
}
-NR::Matrix
-sp_gradient_get_g2d_matrix(SPGradient const *gr, NR::Matrix const &ctm, NR::Rect const &bbox)
+Geom::Matrix
+sp_gradient_get_g2d_matrix(SPGradient const *gr, Geom::Matrix const &ctm, Geom::Rect const &bbox)
{
if (gr->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
return ( Geom::Scale(bbox.dimensions())
@@ -1260,8 +1260,8 @@ sp_gradient_get_g2d_matrix(SPGradient const *gr, NR::Matrix const &ctm, NR::Rect
}
}
-NR::Matrix
-sp_gradient_get_gs2d_matrix(SPGradient const *gr, NR::Matrix const &ctm, NR::Rect const &bbox)
+Geom::Matrix
+sp_gradient_get_gs2d_matrix(SPGradient const *gr, Geom::Matrix const &ctm, Geom::Rect const &bbox)
{
if (gr->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
return ( gr->gradientTransform
@@ -1274,8 +1274,8 @@ sp_gradient_get_gs2d_matrix(SPGradient const *gr, NR::Matrix const &ctm, NR::Rec
}
void
-sp_gradient_set_gs2d_matrix(SPGradient *gr, NR::Matrix const &ctm,
- NR::Rect const &bbox, NR::Matrix const &gs2d)
+sp_gradient_set_gs2d_matrix(SPGradient *gr, Geom::Matrix const &ctm,
+ Geom::Rect const &bbox, Geom::Matrix const &gs2d)
{
gr->gradientTransform = gs2d * ctm.inverse();
if (gr->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX ) {
@@ -1313,8 +1313,8 @@ static Inkscape::XML::Node *sp_lineargradient_write(SPObject *object, Inkscape::
guint flags);
static SPPainter *sp_lineargradient_painter_new(SPPaintServer *ps,
- NR::Matrix const &full_transform,
- NR::Matrix const &parent_transform,
+ Geom::Matrix const &full_transform,
+ Geom::Matrix const &parent_transform,
NRRect const *bbox);
static void sp_lineargradient_painter_free(SPPaintServer *ps, SPPainter *painter);
@@ -1467,8 +1467,8 @@ sp_lineargradient_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inks
*/
static SPPainter *
sp_lineargradient_painter_new(SPPaintServer *ps,
- NR::Matrix const &full_transform,
- NR::Matrix const &/*parent_transform*/,
+ Geom::Matrix const &full_transform,
+ Geom::Matrix const &/*parent_transform*/,
NRRect const *bbox)
{
SPLinearGradient *lg = SP_LINEARGRADIENT(ps);
@@ -1490,31 +1490,32 @@ sp_lineargradient_painter_new(SPPaintServer *ps,
* or something similar. Originally I had 1023.9999 here - not sure
* whether we have really to cut out ceil int (Lauris).
*/
- NR::Matrix color2norm(NR::identity());
- NR::Matrix color2px;
+ Geom::Matrix color2norm(Geom::identity());
+ Geom::Matrix color2px;
if (gr->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
- NR::Matrix norm2pos(NR::identity());
+ Geom::Matrix norm2pos(Geom::identity());
/* BBox to user coordinate system */
- NR::Matrix bbox2user(bbox->x1 - bbox->x0, 0, 0, bbox->y1 - bbox->y0, bbox->x0, bbox->y0);
+ Geom::Matrix bbox2user(bbox->x1 - bbox->x0, 0, 0, bbox->y1 - bbox->y0, bbox->x0, bbox->y0);
- NR::Matrix color2pos = color2norm * norm2pos;
- NR::Matrix color2tpos = color2pos * gr->gradientTransform;
- NR::Matrix color2user = color2tpos * bbox2user;
+ Geom::Matrix color2pos = color2norm * norm2pos;
+ Geom::Matrix color2tpos = color2pos * gr->gradientTransform;
+ Geom::Matrix color2user = color2tpos * bbox2user;
color2px = color2user * full_transform;
} else {
/* Problem: What to do, if we have mixed lengths and percentages? */
/* Currently we do ignore percentages at all, but that is not good (lauris) */
- NR::Matrix norm2pos(NR::identity());
- NR::Matrix color2pos = color2norm * norm2pos;
- NR::Matrix color2tpos = color2pos * gr->gradientTransform;
+ Geom::Matrix norm2pos(Geom::identity());
+ Geom::Matrix color2pos = color2norm * norm2pos;
+ Geom::Matrix color2tpos = color2pos * gr->gradientTransform;
color2px = color2tpos * full_transform;
}
-
- nr_lgradient_renderer_setup(&lgp->lgr, gr->color, sp_gradient_get_spread(gr), &color2px,
+ // TODO: remove color2px_nr after converting to 2geom
+ NR::Matrix color2px_nr = from_2geom(color2px);
+ nr_lgradient_renderer_setup(&lgp->lgr, gr->color, sp_gradient_get_spread(gr), &color2px_nr,
lg->x1.computed, lg->y1.computed,
lg->x2.computed, lg->y2.computed);
@@ -1587,8 +1588,8 @@ static Inkscape::XML::Node *sp_radialgradient_write(SPObject *object, Inkscape::
guint flags);
static SPPainter *sp_radialgradient_painter_new(SPPaintServer *ps,
- NR::Matrix const &full_transform,
- NR::Matrix const &parent_transform,
+ Geom::Matrix const &full_transform,
+ Geom::Matrix const &parent_transform,
NRRect const *bbox);
static void sp_radialgradient_painter_free(SPPaintServer *ps, SPPainter *painter);
@@ -1749,8 +1750,8 @@ sp_radialgradient_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inks
*/
static SPPainter *
sp_radialgradient_painter_new(SPPaintServer *ps,
- NR::Matrix const &full_transform,
- NR::Matrix const &/*parent_transform*/,
+ Geom::Matrix const &full_transform,
+ Geom::Matrix const &/*parent_transform*/,
NRRect const *bbox)
{
SPRadialGradient *rg = SP_RADIALGRADIENT(ps);
@@ -1765,7 +1766,7 @@ sp_radialgradient_painter_new(SPPaintServer *ps,
rgp->rg = rg;
- NR::Matrix gs2px;
+ Geom::Matrix gs2px;
if (gr->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
/** \todo
@@ -1774,9 +1775,9 @@ sp_radialgradient_painter_new(SPPaintServer *ps,
*/
/* BBox to user coordinate system */
- NR::Matrix bbox2user(bbox->x1 - bbox->x0, 0, 0, bbox->y1 - bbox->y0, bbox->x0, bbox->y0);
+ Geom::Matrix bbox2user(bbox->x1 - bbox->x0, 0, 0, bbox->y1 - bbox->y0, bbox->x0, bbox->y0);
- NR::Matrix gs2user = gr->gradientTransform * bbox2user;
+ Geom::Matrix gs2user = gr->gradientTransform * bbox2user;
gs2px = gs2user * full_transform;
} else {
@@ -1788,9 +1789,10 @@ sp_radialgradient_painter_new(SPPaintServer *ps,
gs2px = gr->gradientTransform * full_transform;
}
-
+ // TODO: remove gs2px_nr after converting to 2geom
+ NR::Matrix gs2px_nr = from_2geom(gs2px);
nr_rgradient_renderer_setup(&rgp->rgr, gr->color, sp_gradient_get_spread(gr),
- &gs2px,
+ &gs2px_nr,
rg->cx.computed, rg->cy.computed,
rg->fx.computed, rg->fy.computed,
rg->r.computed);
diff --git a/src/sp-gradient.h b/src/sp-gradient.h
index 52234b50e..3a26f5e5a 100644
--- a/src/sp-gradient.h
+++ b/src/sp-gradient.h
@@ -68,7 +68,7 @@ struct SPGradient : public SPPaintServer {
SPGradientUnits units;
guint units_set : 1;
/** gradientTransform attribute */
- NR::Matrix gradientTransform;
+ Geom::Matrix gradientTransform;
guint gradientTransform_set : 1;
/** spreadMethod attribute */
SPGradientSpread spread;
diff --git a/src/sp-paint-server.cpp b/src/sp-paint-server.cpp
index 0176bfdd0..b85b0f279 100644
--- a/src/sp-paint-server.cpp
+++ b/src/sp-paint-server.cpp
@@ -77,8 +77,8 @@ static void sp_paint_server_release(SPObject *object)
}
SPPainter *sp_paint_server_painter_new(SPPaintServer *ps,
- NR::Matrix const &full_transform,
- NR::Matrix const &parent_transform,
+ Geom::Matrix const &full_transform,
+ Geom::Matrix const &parent_transform,
const NRRect *bbox)
{
g_return_val_if_fail(ps != NULL, NULL);
diff --git a/src/sp-paint-server.h b/src/sp-paint-server.h
index 975ae542f..998f1556b 100644
--- a/src/sp-paint-server.h
+++ b/src/sp-paint-server.h
@@ -49,14 +49,14 @@ struct SPPaintServer : public SPObject {
struct SPPaintServerClass {
SPObjectClass sp_object_class;
/* Get SPPaint instance */
- SPPainter * (* painter_new) (SPPaintServer *ps, NR::Matrix const &full_transform, NR::Matrix const &parent_transform, const NRRect *bbox);
+ SPPainter * (* painter_new) (SPPaintServer *ps, Geom::Matrix const &full_transform, Geom::Matrix const &parent_transform, const NRRect *bbox);
/* Free SPPaint instance */
void (* painter_free) (SPPaintServer *ps, SPPainter *painter);
};
GType sp_paint_server_get_type (void);
-SPPainter *sp_paint_server_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR::Matrix const &parent_transform, const NRRect *bbox);
+SPPainter *sp_paint_server_painter_new (SPPaintServer *ps, Geom::Matrix const &full_transform, Geom::Matrix const &parent_transform, const NRRect *bbox);
SPPainter *sp_painter_free (SPPainter *painter);
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index 9d981c5f2..96ff50cda 100644
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
@@ -44,17 +44,17 @@ struct SPPatPainter {
SPPainter painter;
SPPattern *pat;
- NR::Matrix ps2px;
- NR::Matrix px2ps;
- NR::Matrix pcs2px;
+ Geom::Matrix ps2px;
+ Geom::Matrix px2ps;
+ Geom::Matrix pcs2px;
NRArena *arena;
unsigned int dkey;
NRArenaItem *root;
bool use_cached_tile;
- NR::Matrix ca2pa;
- NR::Matrix pa2ca;
+ Geom::Matrix ca2pa;
+ Geom::Matrix pa2ca;
NRRectL cached_bbox;
NRPixBlock cached_tile;
};
@@ -72,7 +72,7 @@ static void sp_pattern_modified (SPObject *object, unsigned int flags);
static void pattern_ref_changed(SPObject *old_ref, SPObject *ref, SPPattern *pat);
static void pattern_ref_modified (SPObject *ref, guint flags, SPPattern *pattern);
-static SPPainter *sp_pattern_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR::Matrix const &parent_transform, const NRRect *bbox);
+static SPPainter *sp_pattern_painter_new (SPPaintServer *ps, Geom::Matrix const &full_transform, Geom::Matrix const &parent_transform, const NRRect *bbox);
static void sp_pattern_painter_free (SPPaintServer *ps, SPPainter *painter);
static SPPaintServerClass * pattern_parent_class;
@@ -474,7 +474,7 @@ sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *pr
}
void
-sp_pattern_transform_multiply (SPPattern *pattern, NR::Matrix postmul, bool set)
+sp_pattern_transform_multiply (SPPattern *pattern, Geom::Matrix postmul, bool set)
{
// this formula is for a different interpretation of pattern transforms as described in (*) in sp-pattern.cpp
// for it to work, we also need sp_object_read_attr (SP_OBJECT (item), "transform");
@@ -494,15 +494,15 @@ sp_pattern_transform_multiply (SPPattern *pattern, NR::Matrix postmul, bool set)
}
const gchar *
-pattern_tile (GSList *reprs, NR::Rect bounds, SPDocument *document, NR::Matrix transform, NR::Matrix move)
+pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move)
{
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern");
repr->setAttribute("patternUnits", "userSpaceOnUse");
- sp_repr_set_svg_double(repr, "width", bounds.extent(NR::X));
- sp_repr_set_svg_double(repr, "height", bounds.extent(NR::Y));
+ sp_repr_set_svg_double(repr, "width", bounds.dimensions()[Geom::X]);
+ sp_repr_set_svg_double(repr, "height", bounds.dimensions()[Geom::Y]);
gchar *t=sp_svg_transform_write(transform);
repr->setAttribute("patternTransform", t);
@@ -516,9 +516,9 @@ pattern_tile (GSList *reprs, NR::Rect bounds, SPDocument *document, NR::Matrix t
Inkscape::XML::Node *node = (Inkscape::XML::Node *)(i->data);
SPItem *copy = SP_ITEM(pat_object->appendChildRepr(node));
- NR::Matrix dup_transform;
+ Geom::Matrix dup_transform;
if (!sp_svg_transform_read (node->attribute("transform"), &dup_transform))
- dup_transform = NR::identity();
+ dup_transform = Geom::identity();
dup_transform *= move;
sp_item_write_transform(copy, SP_OBJECT_REPR(copy), dup_transform);
@@ -562,7 +562,7 @@ guint pattern_patternContentUnits (SPPattern *pat)
return pat->patternContentUnits;
}
-NR::Matrix const &pattern_patternTransform(SPPattern const *pat)
+Geom::Matrix const &pattern_patternTransform(SPPattern const *pat)
{
for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
if (pat_i->patternTransform_set)
@@ -637,7 +637,7 @@ Creates a painter (i.e. the thing that does actual filling at the given zoom).
See (*) below for why the parent_transform may be necessary.
*/
static SPPainter *
-sp_pattern_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR::Matrix const &/*parent_transform*/, const NRRect *bbox)
+sp_pattern_painter_new (SPPaintServer *ps, Geom::Matrix const &full_transform, Geom::Matrix const &/*parent_transform*/, const NRRect *bbox)
{
SPPattern *pat = SP_PATTERN (ps);
SPPatPainter *pp = g_new (SPPatPainter, 1);
@@ -649,10 +649,10 @@ sp_pattern_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR:
if (pattern_patternUnits (pat) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) {
/* BBox to user coordinate system */
- NR::Matrix bbox2user (bbox->x1 - bbox->x0, 0.0, 0.0, bbox->y1 - bbox->y0, bbox->x0, bbox->y0);
+ Geom::Matrix bbox2user (bbox->x1 - bbox->x0, 0.0, 0.0, bbox->y1 - bbox->y0, bbox->x0, bbox->y0);
// the final patternTransform, taking into account bbox
- NR::Matrix const ps2user(pattern_patternTransform(pat) * bbox2user);
+ Geom::Matrix const ps2user(pattern_patternTransform(pat) * bbox2user);
// see (*) comment below
pp->ps2px = ps2user * full_transform;
@@ -683,9 +683,9 @@ sp_pattern_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR:
gdouble tmp_y = pattern_height (pat) / (pattern_viewBox(pat)->y1 - pattern_viewBox(pat)->y0);
// FIXME: preserveAspectRatio must be taken into account here too!
- NR::Matrix vb2ps (tmp_x, 0.0, 0.0, tmp_y, pattern_x(pat) - pattern_viewBox(pat)->x0 * tmp_x, pattern_y(pat) - pattern_viewBox(pat)->y0 * tmp_y);
+ Geom::Matrix vb2ps (tmp_x, 0.0, 0.0, tmp_y, pattern_x(pat) - pattern_viewBox(pat)->x0 * tmp_x, pattern_y(pat) - pattern_viewBox(pat)->y0 * tmp_y);
- NR::Matrix vb2us = vb2ps * pattern_patternTransform(pat);
+ Geom::Matrix vb2us = vb2ps * pattern_patternTransform(pat);
// see (*)
pp->pcs2px = vb2us * full_transform;
@@ -693,9 +693,9 @@ sp_pattern_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR:
/* No viewbox, have to parse units */
if (pattern_patternContentUnits (pat) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) {
/* BBox to user coordinate system */
- NR::Matrix bbox2user (bbox->x1 - bbox->x0, 0.0, 0.0, bbox->y1 - bbox->y0, bbox->x0, bbox->y0);
+ Geom::Matrix bbox2user (bbox->x1 - bbox->x0, 0.0, 0.0, bbox->y1 - bbox->y0, bbox->x0, bbox->y0);
- NR::Matrix pcs2user = pattern_patternTransform(pat) * bbox2user;
+ Geom::Matrix pcs2user = pattern_patternTransform(pat) * bbox2user;
// see (*)
pp->pcs2px = pcs2user * full_transform;
@@ -736,7 +736,9 @@ sp_pattern_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR:
one_tile.y0=pattern_y(pp->pat);
one_tile.x1=one_tile.x0+pattern_width (pp->pat);
one_tile.y1=one_tile.y0+pattern_height (pp->pat);
- nr_rect_d_matrix_transform (&tr_tile, &one_tile, &pp->ps2px);
+ // TODO: remove ps2px_nr after converting to 2geom
+ NR::Matrix ps2px_nr = from_2geom(pp->ps2px);
+ nr_rect_d_matrix_transform (&tr_tile, &one_tile, &ps2px_nr);
int tr_width=(int)ceil(1.3*(tr_tile.x1-tr_tile.x0));
int tr_height=(int)ceil(1.3*(tr_tile.y1-tr_tile.y0));
// if ( tr_width < 10000 && tr_height < 10000 && tr_width*tr_height < 1000000 ) {
@@ -948,7 +950,9 @@ sp_pat_fill (SPPainter *painter, NRPixBlock *pb)
fabs(pp->px2ps[4]) < 1e6 &&
fabs(pp->px2ps[5]) < 1e6)
{
- nr_rect_d_matrix_transform (&psa, &ba, &pp->px2ps);
+ // TODO: remove px2ps_nr after converting to 2geom
+ NR::Matrix px2ps_nr = from_2geom(pp->px2ps);
+ nr_rect_d_matrix_transform (&psa, &ba, &px2ps_nr);
psa.x0 = floor ((psa.x0 - pattern_x (pp->pat)) / pattern_width (pp->pat)) -1;
psa.y0 = floor ((psa.y0 - pattern_y (pp->pat)) / pattern_height (pp->pat)) -1;
diff --git a/src/sp-pattern.h b/src/sp-pattern.h
index b40b12d8a..f15285e27 100644
--- a/src/sp-pattern.h
+++ b/src/sp-pattern.h
@@ -63,7 +63,7 @@ struct SPPattern : public SPPaintServer {
guint patternContentUnits : 1;
guint patternContentUnits_set : 1;
/* patternTransform attribute */
- NR::Matrix patternTransform;
+ Geom::Matrix patternTransform;
guint patternTransform_set : 1;
/* Tile rectangle */
SVGLength x;
@@ -84,15 +84,15 @@ struct SPPatternClass {
guint pattern_users (SPPattern *pattern);
SPPattern *pattern_chain (SPPattern *pattern);
SPPattern *sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *property);
-void sp_pattern_transform_multiply (SPPattern *pattern, NR::Matrix postmul, bool set);
+void sp_pattern_transform_multiply (SPPattern *pattern, Geom::Matrix postmul, bool set);
-const gchar *pattern_tile (GSList *reprs, NR::Rect bounds, SPDocument *document, NR::Matrix transform, NR::Matrix move);
+const gchar *pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move);
SPPattern *pattern_getroot (SPPattern *pat);
guint pattern_patternUnits (SPPattern *pat);
guint pattern_patternContentUnits (SPPattern *pat);
-NR::Matrix const &pattern_patternTransform(SPPattern const *pat);
+Geom::Matrix const &pattern_patternTransform(SPPattern const *pat);
gdouble pattern_x (SPPattern *pat);
gdouble pattern_y (SPPattern *pat);
gdouble pattern_width (SPPattern *pat);
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index fb3bb9e6a..bf8fd2003 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -286,6 +286,9 @@ sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags)
if (sp_shape_has_markers (shape)) {
/* Dimension marker views */
for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ if (!v->arenaitem->key) {
+ NR_ARENA_ITEM_SET_KEY (v->arenaitem, sp_item_display_key_new (SP_MARKER_LOC_QTY));
+ }
for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
if (shape->marker[i]) {
sp_marker_show_dimension ((SPMarker *) shape->marker[i],
diff --git a/src/svg/path-string.cpp b/src/svg/path-string.cpp
index c0e33fddd..0baaf521e 100644
--- a/src/svg/path-string.cpp
+++ b/src/svg/path-string.cpp
@@ -65,28 +65,28 @@ void Inkscape::SVG::PathString::_appendOp(char abs_op, char rel_op) {
if ( !rel_op_repeated ) _rel_state.appendOp(rel_op);
}
-void Inkscape::SVG::PathString::State::append(NR::Coord v) {
+void Inkscape::SVG::PathString::State::append(Geom::Coord v) {
str += ' ';
appendNumber(v);
}
-void Inkscape::SVG::PathString::State::append(NR::Point p) {
+void Inkscape::SVG::PathString::State::append(Geom::Point p) {
str += ' ';
- appendNumber(p[NR::X]);
+ appendNumber(p[Geom::X]);
str += ',';
- appendNumber(p[NR::Y]);
+ appendNumber(p[Geom::Y]);
}
-void Inkscape::SVG::PathString::State::append(NR::Coord v, NR::Coord& rv) {
+void Inkscape::SVG::PathString::State::append(Geom::Coord v, Geom::Coord& rv) {
str += ' ';
appendNumber(v, rv);
}
-void Inkscape::SVG::PathString::State::append(NR::Point p, NR::Point &rp) {
+void Inkscape::SVG::PathString::State::append(Geom::Point p, Geom::Point &rp) {
str += ' ';
- appendNumber(p[NR::X], rp[NR::X]);
+ appendNumber(p[Geom::X], rp[Geom::X]);
str += ',';
- appendNumber(p[NR::Y], rp[NR::Y]);
+ appendNumber(p[Geom::Y], rp[Geom::Y]);
}
// NOTE: The following appendRelativeCoord function will not be exact if the total number of digits needed
@@ -95,7 +95,7 @@ void Inkscape::SVG::PathString::State::append(NR::Point p, NR::Point &rp) {
// than the absolute value).
// NOTE: This assumes v and r are already rounded (this includes flushing to zero if they are < 10^minexp)
-void Inkscape::SVG::PathString::State::appendRelativeCoord(NR::Coord v, NR::Coord r) {
+void Inkscape::SVG::PathString::State::appendRelativeCoord(Geom::Coord v, Geom::Coord r) {
int const minexp = minimumexponent-numericprecision+1;
int const digitsEnd = (int)floor(log10(std::min(fabs(v),fabs(r)))) - numericprecision; // Position just beyond the last significant digit of the smallest (in absolute sense) number
double const roundeddiff = floor((v-r)*pow(10.,-digitsEnd-1)+.5);
@@ -112,14 +112,14 @@ void Inkscape::SVG::PathString::State::appendRelativeCoord(NR::Coord v, NR::Coor
}
}
-void Inkscape::SVG::PathString::State::appendRelative(NR::Point p, NR::Point r) {
+void Inkscape::SVG::PathString::State::appendRelative(Geom::Point p, Geom::Point r) {
str += ' ';
- appendRelativeCoord(p[NR::X], r[NR::X]);
+ appendRelativeCoord(p[Geom::X], r[Geom::X]);
str += ',';
- appendRelativeCoord(p[NR::Y], r[NR::Y]);
+ appendRelativeCoord(p[Geom::Y], r[Geom::Y]);
}
-void Inkscape::SVG::PathString::State::appendRelative(NR::Coord v, NR::Coord r) {
+void Inkscape::SVG::PathString::State::appendRelative(Geom::Coord v, Geom::Coord r) {
str += ' ';
appendRelativeCoord(v, r);
}
diff --git a/src/svg/path-string.h b/src/svg/path-string.h
index 01389a3d0..9079acfb4 100644
--- a/src/svg/path-string.h
+++ b/src/svg/path-string.h
@@ -19,8 +19,7 @@
#include <glibmm/ustring.h>
#include <string>
#include <stdio.h>
-#include "libnr/nr-point.h"
-#include "libnr/nr-point-ops.h"
+#include <2geom/point.h>
namespace Inkscape {
@@ -53,11 +52,11 @@ public:
return string().c_str();
}
- PathString &moveTo(NR::Coord x, NR::Coord y) {
- return moveTo(NR::Point(x, y));
+ PathString &moveTo(Geom::Coord x, Geom::Coord y) {
+ return moveTo(Geom::Point(x, y));
}
- PathString &moveTo(NR::Point p) {
+ PathString &moveTo(Geom::Point p) {
_appendOp('M','m');
_appendPoint(p, true);
@@ -65,47 +64,47 @@ public:
return *this;
}
- PathString &lineTo(NR::Coord x, NR::Coord y) {
- return lineTo(NR::Point(x, y));
+ PathString &lineTo(Geom::Coord x, Geom::Coord y) {
+ return lineTo(Geom::Point(x, y));
}
- PathString &lineTo(NR::Point p) {
+ PathString &lineTo(Geom::Point p) {
_appendOp('L','l');
_appendPoint(p, true);
return *this;
}
- PathString &horizontalLineTo(NR::Coord x) {
+ PathString &horizontalLineTo(Geom::Coord x) {
_appendOp('H','h');
_appendX(x, true);
return *this;
}
- PathString &verticalLineTo(NR::Coord y) {
+ PathString &verticalLineTo(Geom::Coord y) {
_appendOp('V','v');
_appendY(y, true);
return *this;
}
- PathString &quadTo(NR::Coord cx, NR::Coord cy, NR::Coord x, NR::Coord y) {
- return quadTo(NR::Point(cx, cy), NR::Point(x, y));
+ PathString &quadTo(Geom::Coord cx, Geom::Coord cy, Geom::Coord x, Geom::Coord y) {
+ return quadTo(Geom::Point(cx, cy), Geom::Point(x, y));
}
- PathString &quadTo(NR::Point c, NR::Point p) {
+ PathString &quadTo(Geom::Point c, Geom::Point p) {
_appendOp('Q','q');
_appendPoint(c, false);
_appendPoint(p, true);
return *this;
}
- PathString &curveTo(NR::Coord x0, NR::Coord y0,
- NR::Coord x1, NR::Coord y1,
- NR::Coord x, NR::Coord y)
+ PathString &curveTo(Geom::Coord x0, Geom::Coord y0,
+ Geom::Coord x1, Geom::Coord y1,
+ Geom::Coord x, Geom::Coord y)
{
- return curveTo(NR::Point(x0, y0), NR::Point(x1, y1), NR::Point(x, y));
+ return curveTo(Geom::Point(x0, y0), Geom::Point(x1, y1), Geom::Point(x, y));
}
- PathString &curveTo(NR::Point c0, NR::Point c1, NR::Point p) {
+ PathString &curveTo(Geom::Point c0, Geom::Point c1, Geom::Point p) {
_appendOp('C','c');
_appendPoint(c0, false);
_appendPoint(c1, false);
@@ -116,12 +115,12 @@ public:
/**
* \param rot the angle in degrees
*/
- PathString &arcTo(NR::Coord rx, NR::Coord ry, NR::Coord rot,
+ PathString &arcTo(Geom::Coord rx, Geom::Coord ry, Geom::Coord rot,
bool large_arc, bool sweep,
- NR::Point p)
+ Geom::Point p)
{
_appendOp('A','a');
- _appendValue(NR::Point(rx,ry));
+ _appendValue(Geom::Point(rx,ry));
_appendValue(rot);
_appendFlag(large_arc);
_appendFlag(sweep);
@@ -145,32 +144,32 @@ private:
_rel_state.append(flag);
}
- void _appendValue(NR::Coord v) {
+ void _appendValue(Geom::Coord v) {
_abs_state.append(v);
_rel_state.append(v);
}
- void _appendValue(NR::Point p) {
+ void _appendValue(Geom::Point p) {
_abs_state.append(p);
_rel_state.append(p);
}
- void _appendX(NR::Coord x, bool sc) {
+ void _appendX(Geom::Coord x, bool sc) {
double rx;
_abs_state.append(x, rx);
- _rel_state.appendRelative(rx, _current_point[NR::X]);
- if (sc) _current_point[NR::X] = rx;
+ _rel_state.appendRelative(rx, _current_point[Geom::X]);
+ if (sc) _current_point[Geom::X] = rx;
}
- void _appendY(NR::Coord y, bool sc) {
+ void _appendY(Geom::Coord y, bool sc) {
double ry;
_abs_state.append(y, ry);
- _rel_state.appendRelative(ry, _current_point[NR::Y]);
- if (sc) _current_point[NR::Y] = ry;
+ _rel_state.appendRelative(ry, _current_point[Geom::Y]);
+ if (sc) _current_point[Geom::Y] = ry;
}
- void _appendPoint(NR::Point p, bool sc) {
- NR::Point rp;
+ void _appendPoint(Geom::Point p, bool sc) {
+ Geom::Point rp;
_abs_state.append(p, rp);
_rel_state.appendRelative(rp, _current_point);
if (sc) _current_point = rp;
@@ -190,12 +189,12 @@ private:
str += ( flag ? '1' : '0' );
}
- void append(NR::Coord v);
- void append(NR::Point v);
- void append(NR::Coord v, NR::Coord& rv);
- void append(NR::Point p, NR::Point& rp);
- void appendRelative(NR::Coord v, NR::Coord r);
- void appendRelative(NR::Point p, NR::Point r);
+ void append(Geom::Coord v);
+ void append(Geom::Point v);
+ void append(Geom::Coord v, Geom::Coord& rv);
+ void append(Geom::Point p, Geom::Point& rp);
+ void appendRelative(Geom::Coord v, Geom::Coord r);
+ void appendRelative(Geom::Point p, Geom::Point r);
bool operator<=(const State& s) const {
if ( str.size() < s.str.size() ) return true;
@@ -214,11 +213,11 @@ private:
private:
void appendNumber(double v, int precision=numericprecision, int minexp=minimumexponent);
void appendNumber(double v, double &rv, int precision=numericprecision, int minexp=minimumexponent);
- void appendRelativeCoord(NR::Coord v, NR::Coord r);
+ void appendRelativeCoord(Geom::Coord v, Geom::Coord r);
} _abs_state, _rel_state; // State with the last operator being an absolute/relative operator
- NR::Point _initial_point;
- NR::Point _current_point;
+ Geom::Point _initial_point;
+ Geom::Point _current_point;
// If both states have a common prefix it is stored here.
// Separating out the common prefix prevents repeated copying between the states
diff --git a/src/svg/svg-affine.cpp b/src/svg/svg-affine.cpp
index 2b9a79d3d..bcc685e8a 100644
--- a/src/svg/svg-affine.cpp
+++ b/src/svg/svg-affine.cpp
@@ -49,123 +49,123 @@ sp_svg_transform_read(gchar const *str, Geom::Matrix *transform)
bool
sp_svg_transform_read(gchar const *str, NR::Matrix *transform)
{
- int idx;
- char keyword[32];
- double args[6];
- int n_args;
- size_t key_len;
+ int idx;
+ char keyword[32];
+ double args[6];
+ int n_args;
+ size_t key_len;
- if (str == NULL) return false;
+ if (str == NULL) return false;
- NR::Matrix a(NR::identity());
+ NR::Matrix a(NR::identity());
- idx = 0;
- while (str[idx]) {
- /* skip initial whitespace */
- while (g_ascii_isspace (str[idx])) idx++;
+ idx = 0;
+ while (str[idx]) {
+ /* skip initial whitespace */
+ while (g_ascii_isspace (str[idx])) idx++;
- /* parse keyword */
- for (key_len = 0; key_len < sizeof (keyword); key_len++) {
- char c;
+ /* parse keyword */
+ for (key_len = 0; key_len < sizeof (keyword); key_len++) {
+ char c;
- c = str[idx];
- if (g_ascii_isalpha (c) || c == '-') {
- keyword[key_len] = str[idx++];
- } else {
- break;
- }
- }
- if (key_len >= sizeof (keyword)) return false;
- keyword[key_len] = '\0';
+ c = str[idx];
+ if (g_ascii_isalpha (c) || c == '-') {
+ keyword[key_len] = str[idx++];
+ } else {
+ break;
+ }
+ }
+ if (key_len >= sizeof (keyword)) return false;
+ keyword[key_len] = '\0';
- /* skip whitespace */
- while (g_ascii_isspace (str[idx])) idx++;
+ /* skip whitespace */
+ while (g_ascii_isspace (str[idx])) idx++;
- if (str[idx] != '(') return false;
- idx++;
+ if (str[idx] != '(') return false;
+ idx++;
- for (n_args = 0; ; n_args++) {
- char c;
- char *end_ptr;
+ for (n_args = 0; ; n_args++) {
+ char c;
+ char *end_ptr;
- /* skip whitespace */
- while (g_ascii_isspace (str[idx])) idx++;
- c = str[idx];
- if (g_ascii_isdigit (c) || c == '+' || c == '-' || c == '.') {
- if (n_args == sizeof (args) / sizeof (args[0])) return false; /* Too many args */
- args[n_args] = g_ascii_strtod (str + idx, &end_ptr);
-
- //printf("took %d chars from '%s' to make %f\n",
- // end_ptr-(str+idx),
- // str+idx,
- // args[n_args]);
+ /* skip whitespace */
+ while (g_ascii_isspace (str[idx])) idx++;
+ c = str[idx];
+ if (g_ascii_isdigit (c) || c == '+' || c == '-' || c == '.') {
+ if (n_args == sizeof (args) / sizeof (args[0])) return false; /* Too many args */
+ args[n_args] = g_ascii_strtod (str + idx, &end_ptr);
+
+ //printf("took %d chars from '%s' to make %f\n",
+ // end_ptr-(str+idx),
+ // str+idx,
+ // args[n_args]);
- idx = end_ptr - (char *) str;
+ idx = end_ptr - (char *) str;
- while (g_ascii_isspace (str[idx])) idx++;
+ while (g_ascii_isspace (str[idx])) idx++;
- /* skip optional comma */
- if (str[idx] == ',') idx++;
- } else if (c == ')') {
- break;
- } else {
- return false;
- }
- }
- idx++;
+ /* skip optional comma */
+ if (str[idx] == ',') idx++;
+ } else if (c == ')') {
+ break;
+ } else {
+ return false;
+ }
+ }
+ idx++;
- /* ok, have parsed keyword and args, now modify the transform */
- if (!strcmp (keyword, "matrix")) {
- if (n_args != 6) return false;
- a = (*NR_MATRIX_D_FROM_DOUBLE(args)) * a;
- } else if (!strcmp (keyword, "translate")) {
- if (n_args == 1) {
- args[1] = 0;
- } else if (n_args != 2) {
- return false;
- }
- a = Geom::Translate(args[0], args[1]) * a;
- } else if (!strcmp (keyword, "scale")) {
- if (n_args == 1) {
- args[1] = args[0];
- } else if (n_args != 2) {
- return false;
- }
- a = Geom::Scale(args[0], args[1]) * a;
- } else if (!strcmp (keyword, "rotate")) {
- if (n_args != 1 && n_args != 3) {
- return false;
- }
- Geom::Rotate const rot(Geom::deg_to_rad(args[0]));
- if (n_args == 3) {
- a = ( Geom::Translate(-args[1], -args[2])
- * rot
- * Geom::Translate(args[1], args[2])
- * Geom::Matrix(a) );
- } else {
- a = rot * a;
- }
- } else if (!strcmp (keyword, "skewX")) {
- if (n_args != 1) return false;
- a = ( NR::Matrix(1, 0,
- tan(args[0] * M_PI / 180.0), 1,
- 0, 0)
- * a );
- } else if (!strcmp (keyword, "skewY")) {
- if (n_args != 1) return false;
- a = ( NR::Matrix(1, tan(args[0] * M_PI / 180.0),
- 0, 1,
- 0, 0)
- * a );
- } else {
- return false; /* unknown keyword */
- }
- /* Skip trailing whitespace */
+ /* ok, have parsed keyword and args, now modify the transform */
+ if (!strcmp (keyword, "matrix")) {
+ if (n_args != 6) return false;
+ a = (*NR_MATRIX_D_FROM_DOUBLE(args)) * a;
+ } else if (!strcmp (keyword, "translate")) {
+ if (n_args == 1) {
+ args[1] = 0;
+ } else if (n_args != 2) {
+ return false;
+ }
+ a = Geom::Translate(args[0], args[1]) * a;
+ } else if (!strcmp (keyword, "scale")) {
+ if (n_args == 1) {
+ args[1] = args[0];
+ } else if (n_args != 2) {
+ return false;
+ }
+ a = Geom::Scale(args[0], args[1]) * a;
+ } else if (!strcmp (keyword, "rotate")) {
+ if (n_args != 1 && n_args != 3) {
+ return false;
+ }
+ Geom::Rotate const rot(Geom::deg_to_rad(args[0]));
+ if (n_args == 3) {
+ a = ( Geom::Translate(-args[1], -args[2])
+ * rot
+ * Geom::Translate(args[1], args[2])
+ * Geom::Matrix(a) );
+ } else {
+ a = rot * a;
+ }
+ } else if (!strcmp (keyword, "skewX")) {
+ if (n_args != 1) return false;
+ a = ( NR::Matrix(1, 0,
+ tan(args[0] * M_PI / 180.0), 1,
+ 0, 0)
+ * a );
+ } else if (!strcmp (keyword, "skewY")) {
+ if (n_args != 1) return false;
+ a = ( NR::Matrix(1, tan(args[0] * M_PI / 180.0),
+ 0, 1,
+ 0, 0)
+ * a );
+ } else {
+ return false; /* unknown keyword */
+ }
+ /* Skip trailing whitespace */
while (g_ascii_isspace (str[idx])) idx++;
- }
+ }
- *transform = a;
- return true;
+ *transform = a;
+ return true;
}
#define EQ(a,b) (fabs ((a) - (b)) < 1e-9)
@@ -173,112 +173,107 @@ sp_svg_transform_read(gchar const *str, NR::Matrix *transform)
gchar *
sp_svg_transform_write(Geom::Matrix const &transform)
{
- return sp_svg_transform_write(&transform);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
+ double e = 0.000001 * transform.descrim();
+ int prec = prefs->getInt("/options/svgoutput/numericprecision", 8);
+ int min_exp = prefs->getInt("/options/svgoutput/minimumexponent", -8);
+
+ /* fixme: We could use t1 * t1 + t2 * t2 here instead */
+ if ( Geom::are_near(transform[1], 0.0, e) && Geom::are_near (transform[2], 0.0, e)) {
+ if (Geom::are_near (transform[4], 0.0, e) && Geom::are_near (transform[5], 0.0, e)) {
+ if (Geom::are_near (transform[0], 1.0, e) && Geom::are_near (transform[3], 1.0, e)) {
+ /* We are more or less identity */
+ return NULL;
+ } else {
+ /* We are more or less scale */
+ gchar c[256];
+ unsigned p = 0;
+ strcpy (c + p, "scale(");
+ p += 6;
+ p += sp_svg_number_write_de (c + p, transform[0], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[3], prec, min_exp);
+ c[p++] = ')';
+ c[p] = '\000';
+ g_assert( p <= sizeof(c) );
+ return g_strdup(c);
+ }
+ } else {
+ if (Geom::are_near (transform[0], 1.0, e) && Geom::are_near (transform[3], 1.0, e)) {
+ /* We are more or less translate */
+ gchar c[256];
+ unsigned p = 0;
+ strcpy (c + p, "translate(");
+ p += 10;
+ p += sp_svg_number_write_de (c + p, transform[4], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[5], prec, min_exp);
+ c[p++] = ')';
+ c[p] = '\000';
+ g_assert( p <= sizeof(c) );
+ return g_strdup(c);
+ } else {
+ gchar c[256];
+ unsigned p = 0;
+ strcpy (c + p, "matrix(");
+ p += 7;
+ p += sp_svg_number_write_de (c + p, transform[0], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[1], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[2], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[3], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[4], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[5], prec, min_exp);
+ c[p++] = ')';
+ c[p] = '\000';
+ g_assert( p <= sizeof(c) );
+ return g_strdup(c);
+ }
+ }
+ } else {
+ gchar c[256];
+ unsigned p = 0;
+ strcpy (c + p, "matrix(");
+ p += 7;
+ p += sp_svg_number_write_de (c + p, transform[0], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[1], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[2], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[3], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[4], prec, min_exp);
+ c[p++] = ',';
+ p += sp_svg_number_write_de (c + p, transform[5], prec, min_exp);
+ c[p++] = ')';
+ c[p] = '\000';
+ g_assert( p <= sizeof(c) );
+ return g_strdup(c);
+ }
}
gchar *
sp_svg_transform_write(Geom::Matrix const *transform)
{
- NR::Matrix const t(*transform);
- return sp_svg_transform_write(&t);
+ return sp_svg_transform_write(*transform);
}
gchar *
sp_svg_transform_write(NR::Matrix const &transform)
{
- NR::Matrix const t(transform);
- return sp_svg_transform_write(&t);
+ return sp_svg_transform_write((Geom::Matrix)transform);
}
gchar *
sp_svg_transform_write(NR::Matrix const *transform)
{
- if (!transform) {
- return NULL;
- }
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
-
- double e = 0.000001 * NR::expansion(*transform);
- int prec = prefs->getInt("/options/svgoutput/numericprecision", 8);
- int min_exp = prefs->getInt("/options/svgoutput/minimumexponent", -8);
-
- /* fixme: We could use t1 * t1 + t2 * t2 here instead */
- if (NR_DF_TEST_CLOSE ((*transform)[1], 0.0, e) && NR_DF_TEST_CLOSE ((*transform)[2], 0.0, e)) {
- if (NR_DF_TEST_CLOSE ((*transform)[4], 0.0, e) && NR_DF_TEST_CLOSE ((*transform)[5], 0.0, e)) {
- if (NR_DF_TEST_CLOSE ((*transform)[0], 1.0, e) && NR_DF_TEST_CLOSE ((*transform)[3], 1.0, e)) {
- /* We are more or less identity */
- return NULL;
- } else {
- /* We are more or less scale */
- gchar c[256];
- unsigned p = 0;
- strcpy (c + p, "scale(");
- p += 6;
- p += sp_svg_number_write_de (c + p, (*transform)[0], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[3], prec, min_exp);
- c[p++] = ')';
- c[p] = '\000';
- g_assert( p <= sizeof(c) );
- return g_strdup(c);
- }
- } else {
- if (NR_DF_TEST_CLOSE ((*transform)[0], 1.0, e) && NR_DF_TEST_CLOSE ((*transform)[3], 1.0, e)) {
- /* We are more or less translate */
- gchar c[256];
- unsigned p = 0;
- strcpy (c + p, "translate(");
- p += 10;
- p += sp_svg_number_write_de (c + p, (*transform)[4], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[5], prec, min_exp);
- c[p++] = ')';
- c[p] = '\000';
- g_assert( p <= sizeof(c) );
- return g_strdup(c);
- } else {
- gchar c[256];
- unsigned p = 0;
- strcpy (c + p, "matrix(");
- p += 7;
- p += sp_svg_number_write_de (c + p, (*transform)[0], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[1], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[2], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[3], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[4], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[5], prec, min_exp);
- c[p++] = ')';
- c[p] = '\000';
- g_assert( p <= sizeof(c) );
- return g_strdup(c);
- }
- }
- } else {
- gchar c[256];
- unsigned p = 0;
- strcpy (c + p, "matrix(");
- p += 7;
- p += sp_svg_number_write_de (c + p, (*transform)[0], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[1], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[2], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[3], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[4], prec, min_exp);
- c[p++] = ',';
- p += sp_svg_number_write_de (c + p, (*transform)[5], prec, min_exp);
- c[p++] = ')';
- c[p] = '\000';
- g_assert( p <= sizeof(c) );
- return g_strdup(c);
- }
+ return sp_svg_transform_write(*transform);
}
diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert
index 6c75a6c81..638be2832 100644
--- a/src/ui/dialog/Makefile_insert
+++ b/src/ui/dialog/Makefile_insert
@@ -60,6 +60,8 @@ ui_dialog_libuidialog_a_SOURCES = \
ui/dialog/aboutbox.cpp \
ui/dialog/aboutbox.h \
ui/dialog/ocaldialogs.cpp \
- ui/dialog/ocaldialogs.h
+ ui/dialog/ocaldialogs.h \
+ ui/dialog/filedialogimpl-win32.h \
+ ui/dialog/filedialogimpl-win32.cpp
ui/dialog/aboutbox.$(OBJEXT): inkscape_version.h
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h
index 1ac259221..90dddce59 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.h
+++ b/src/ui/dialog/filedialogimpl-gtkmm.h
@@ -1,22 +1,22 @@
-#ifndef __FILE_DIALOGIMPL_H__
-#define __FILE_DIALOGIMPL_H__
/** @file
* @brief Implementation of the file dialog interfaces defined in filedialogimpl.h
*/
/* Authors:
* Bob Jamison
+ * Johan Engelen <johan@shouraizou.nl>
* Joel Holdsworth
* Bruno Dilly
* Other dudes from The Inkscape Organization
*
- * Copyright (C) 2004-2007 Bob Jamison
- * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
- * Copyright (C) 2007-2008 Joel Holdsworth
+ * Copyright (C) 2004-2008 Authors
* Copyright (C) 2004-2007 The Inkscape Organization
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#ifndef __FILE_DIALOGIMPL_H__
+#define __FILE_DIALOGIMPL_H__
+
#include "filedialog.h"
//General includes
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 77a42df99..b47f2ccc7 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -9,13 +9,12 @@
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#ifdef WIN32
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#ifdef WIN32
-
//General includes
#include <list>
#include <unistd.h>
@@ -1694,11 +1693,9 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc(
return 0;
}
-}
-}
-}
+} } } // namespace Dialog, UI, Inkscape
-#endif
+#endif // ifdef WIN32
/*
Local Variables:
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index d31331a0d..799bb2a24 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1157,6 +1157,8 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d)
g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop",
G_CALLBACK(&FilterModifier::on_activate_desktop), this);
+ g_signal_connect(G_OBJECT(INKSCAPE), "deactivate_desktop",
+ G_CALLBACK(&FilterModifier::on_deactivate_desktop), this);
on_activate_desktop(INKSCAPE, d.getDesktop(), this);
update_filters();
@@ -1184,6 +1186,13 @@ void FilterEffectsDialog::FilterModifier::on_activate_desktop(Application*, SPDe
me->update_filters();
}
+void FilterEffectsDialog::FilterModifier::on_deactivate_desktop(Application*, SPDesktop* desktop, FilterModifier* me)
+{
+ me->_doc_replaced.disconnect();
+ me->_resource_changed.disconnect();
+ me->_dialog.setDesktop(NULL);
+}
+
// When the selection changes, show the active filter(s) in the dialog
void FilterEffectsDialog::FilterModifier::on_inkscape_change_selection(Application */*inkscape*/,
diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h
index 0522b7a99..ccffb2a67 100644
--- a/src/ui/dialog/filter-effects-dialog.h
+++ b/src/ui/dialog/filter-effects-dialog.h
@@ -87,6 +87,7 @@ private:
};
static void on_activate_desktop(Application*, SPDesktop*, FilterModifier*);
+ static void on_deactivate_desktop(Application*, SPDesktop*, FilterModifier*);
void on_document_replaced(SPDesktop*, SPDocument*)
{
update_filters();
diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp
index f2fa9bcd3..9e39af75f 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -33,7 +33,7 @@ namespace Inkscape {
namespace UI {
namespace Widget {
-void ObjectCompositeSettings::_on_desktop_switch(
+void ObjectCompositeSettings::_on_desktop_activate(
Inkscape::Application */*application*/,
SPDesktop *desktop,
ObjectCompositeSettings *w
@@ -43,6 +43,16 @@ void ObjectCompositeSettings::_on_desktop_switch(
}
}
+void ObjectCompositeSettings::_on_desktop_deactivate(
+ Inkscape::Application */*application*/,
+ SPDesktop *desktop,
+ ObjectCompositeSettings *w
+) {
+ if (w->_subject) {
+ w->_subject->setDesktop(NULL);
+ }
+}
+
ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char const *history_prefix, int flags)
: _verb_code(verb_code),
_blur_tag(Glib::ustring(history_prefix) + ":blur"),
@@ -77,7 +87,8 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co
show_all_children();
- _desktop_activated = g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (&ObjectCompositeSettings::_on_desktop_switch), this );
+ _desktop_activated = g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (&ObjectCompositeSettings::_on_desktop_activate), this );
+ _desktop_activated = g_signal_connect ( G_OBJECT (INKSCAPE), "deactivate_desktop", G_CALLBACK (&ObjectCompositeSettings::_on_desktop_deactivate), this );
}
ObjectCompositeSettings::~ObjectCompositeSettings() {
diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h
index 725a8a42b..f778c3ac0 100644
--- a/src/ui/widget/object-composite-settings.h
+++ b/src/ui/widget/object-composite-settings.h
@@ -55,7 +55,8 @@ private:
Gtk::VBox _fe_vbox;
Gtk::Alignment _fe_alignment;
- static void _on_desktop_switch(Inkscape::Application *application, SPDesktop *desktop, ObjectCompositeSettings *w);
+ static void _on_desktop_activate(Inkscape::Application *application, SPDesktop *desktop, ObjectCompositeSettings *w);
+ static void _on_desktop_deactivate(Inkscape::Application *application, SPDesktop *desktop, ObjectCompositeSettings *w);
void _subjectChanged();
sigc::connection _subject_changed;