Code

Adding axis detection to new input dialog
[inkscape.git] / src / object-edit.cpp
index 6eff465f8ab308b5bf19a3ce15c41f7be4fd7fd0..b3d661586a2b08b2f2e012052f8779e6706bb1e7 100644 (file)
@@ -30,6 +30,7 @@
 #include "desktop-affine.h"
 #include <style.h>
 #include "desktop.h"
+#include "desktop-handles.h"
 #include "sp-namedview.h"
 
 #include "sp-pattern.h"
@@ -41,7 +42,6 @@
 
 #include <libnr/nr-scale-ops.h>
 
-
 #include "xml/repr.h"
 
 #include "isnan.h"
@@ -49,8 +49,7 @@
 #define sp_round(v,m) (((v) < 0.0) ? ((ceil((v) / (m) - 0.5)) * (m)) : ((floor((v) / (m) + 0.5)) * (m)))
 
 static SPKnotHolder *sp_rect_knot_holder(SPItem *item, SPDesktop *desktop);
-//static 
-SPKnotHolder *sp_3dbox_knot_holder(SPItem *item, SPDesktop *desktop, guint number_of_handles);
+static SPKnotHolder *box3d_knot_holder(SPItem *item, SPDesktop *desktop);
 static SPKnotHolder *sp_arc_knot_holder(SPItem *item, SPDesktop *desktop);
 static SPKnotHolder *sp_star_knot_holder(SPItem *item, SPDesktop *desktop);
 static SPKnotHolder *sp_spiral_knot_holder(SPItem *item, SPDesktop *desktop);
@@ -64,8 +63,8 @@ sp_item_knot_holder(SPItem *item, SPDesktop *desktop)
 {
     if (SP_IS_RECT(item)) {
         return sp_rect_knot_holder(item, desktop);
-    } else if (SP_IS_3DBOX(item)) {
-        return sp_3dbox_knot_holder(item, desktop, SP3DBoxContext::number_of_handles);
+    } else if (SP_IS_BOX3D(item)) {
+        return box3d_knot_holder(item, desktop);
     } else if (SP_IS_ARC(item)) {
         return sp_arc_knot_holder(item, desktop);
     } else if (SP_IS_STAR(item)) {
@@ -151,7 +150,7 @@ static NR::Point sp_pattern_angle_get(SPItem *item)
 }
 
 static void
-sp_pattern_angle_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_pattern_angle_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     int const snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12);
 
@@ -176,7 +175,7 @@ sp_pattern_angle_set(SPItem *item, NR::Point const &p, NR::Point const &origin,
 }
 
 static void
-sp_pattern_scale_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_pattern_scale_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/)
 {
     SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
 
@@ -222,9 +221,9 @@ static NR::Point snap_knot_position(SPItem *item, NR::Point const &p)
 {
     SPDesktop const *desktop = inkscape_active_desktop();
     NR::Matrix const i2d (sp_item_i2d_affine (item));
-    NR::Point s = p * i2d;    
+    NR::Point s = p * i2d;
     SnapManager const &m = desktop->namedview->snap_manager;
-    s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_BBOX | Inkscape::Snapper::SNAPPOINT_NODE, s, item).getPoint();
+    s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, s, item).getPoint();
     return s * i2d.inverse();
 }
 
@@ -235,10 +234,10 @@ static NR::Point sp_rect_rx_get(SPItem *item)
     return NR::Point(rect->x.computed + rect->width.computed - rect->rx.computed, rect->y.computed);
 }
 
-static void sp_rect_rx_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+static void sp_rect_rx_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     SPRect *rect = SP_RECT(item);
-    
+
     //In general we cannot just snap this radius to an arbitrary point, as we have only a single
     //degree of freedom. For snapping to an arbitrary point we need two DOF. If we're going to snap
     //the radius then we should have a constrained snap. snap_knot_position() is unconstrained
@@ -264,10 +263,10 @@ static NR::Point sp_rect_ry_get(SPItem *item)
     return NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->ry.computed);
 }
 
-static void sp_rect_ry_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+static void sp_rect_ry_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     SPRect *rect = SP_RECT(item);
-    
+
     //In general we cannot just snap this radius to an arbitrary point, as we have only a single
     //degree of freedom. For snapping to an arbitrary point we need two DOF. If we're going to snap
     //the radius then we should have a constrained snap. snap_knot_position() is unconstrained
@@ -527,225 +526,166 @@ static SPKnotHolder *sp_rect_knot_holder(SPItem *item, SPDesktop *desktop)
     return knot_holder;
 }
 
-/* 3D Box */
+/* Box3D (= the new 3D box structure) */
 
-static void sp_3dbox_knot_set(SPItem *item, guint knot_id, Box3D::Axis direction,
-                              NR::Point const &new_pos, NR::Point const &origin, guint state)
+static NR::Point box3d_knot_get(SPItem *item, guint knot_id)
 {
-    g_assert(item != NULL);
-    SP3DBox *box = SP_3DBOX(item);
-
-    // FIXME: Why must the coordinates be flipped vertically???
-    SPDocument *doc = SP_OBJECT_DOCUMENT(box);
-    gdouble height = sp_document_height(doc);
-
-    NR::Matrix const i2d (sp_item_i2d_affine (item));
-    if (direction == Box3D::Z) {
-         sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d, !(state & GDK_SHIFT_MASK));
-    } else {
-        sp_3dbox_move_corner_in_XY_plane (box, knot_id, new_pos * i2d, (state & GDK_SHIFT_MASK) ? direction : Box3D::XY);
-    }
-    sp_3dbox_update_curves (box);
+    return box3d_get_corner_screen(SP_BOX3D(item), knot_id);
 }
 
-static NR::Point sp_3dbox_knot_get(SPItem *item, guint knot_id)
+static void box3d_knot_set(SPItem *item, guint knot_id, NR::Point const &new_pos, NR::Point const &/*origin*/, guint state)
 {
-    g_assert(item != NULL);
-    SP3DBox *box = SP_3DBOX(item);
+    NR::Point const s = snap_knot_position(item, new_pos);
 
+    g_assert(item != NULL);
+    SPBox3D *box = SP_BOX3D(item);
     NR::Matrix const i2d (sp_item_i2d_affine (item));
-    return sp_3dbox_get_corner(box, knot_id) * i2d;
-}
-
-static void sp_3dbox_knot1_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
-    sp_3dbox_knot_set (item, 1, Box3D::Y, new_pos, origin, state);
-}
-
-/*
-static void sp_3dbox_knot1_set_constrained(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
-    sp_3dbox_knot_set (item, 1, Box3D::Y, new_pos, origin, state ^ GDK_SHIFT_MASK);
-}
-*/
 
-static void sp_3dbox_knot2_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
-    sp_3dbox_knot_set (item, 2, Box3D::X, new_pos, origin, state);
-}
-
-/*
-static void sp_3dbox_knot2_set_constrained(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
-    sp_3dbox_knot_set (item, 2, Box3D::X, new_pos, origin, state ^ GDK_SHIFT_MASK);
-}
-
-static void sp_3dbox_knot3_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
-    if (!(state & GDK_SHIFT_MASK)) {
-        sp_3dbox_knot_set (item, 3, Box3D::Y, new_pos, origin, state);
+    Box3D::Axis movement;
+    if ((knot_id < 4) != (state & GDK_SHIFT_MASK)) {
+        movement = Box3D::XY;
     } else {
-        sp_3dbox_knot_set (item, 3, Box3D::Z, new_pos, origin, state ^ GDK_SHIFT_MASK);
+        movement = Box3D::Z;
     }
-}
-*/
 
-static void sp_3dbox_knot5_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
-{
-    sp_3dbox_knot_set (item, 5, Box3D::Z, new_pos, origin, state);
+    box3d_set_corner (box, knot_id, s * i2d, movement, (state & GDK_CONTROL_MASK));
+    box3d_set_z_orders(box);
+    box3d_position_set(box);
 }
 
-/*
-static void sp_3dbox_knot7_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static NR::Point box3d_knot_center_get (SPItem *item)
 {
-    sp_3dbox_knot_set (item, 7, Box3D::Z, new_pos, origin, state);
+    return box3d_get_center_screen (SP_BOX3D(item));
 }
-*/
 
-// defined a uniform behaviour for all knots
-static void sp_3dbox_knot_set_uniformly(SPItem *item, guint knot_id, Box3D::Axis direction, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot_center_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    g_assert(item != NULL);
-    SP3DBox *box = SP_3DBOX(item);
+    NR::Point const s = snap_knot_position(item, new_pos);
 
+    SPBox3D *box = SP_BOX3D(item);
     NR::Matrix const i2d (sp_item_i2d_affine (item));
-    if (direction == Box3D::Z) {
-        sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d, !(state & GDK_SHIFT_MASK));
-    } else {
-        sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d,  (state & GDK_SHIFT_MASK));
-    }
-    sp_3dbox_update_curves (box);
+
+    box3d_set_center (SP_BOX3D(item), s * i2d, origin * i2d, !(state & GDK_SHIFT_MASK) ? Box3D::XY : Box3D::Z,
+                      state & GDK_CONTROL_MASK);
+
+    box3d_set_z_orders(box);
+    box3d_position_set(box);
 }
 
-static void sp_3dbox_knot0_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot0_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    sp_3dbox_knot_set_uniformly(item, 0, Box3D::XY, new_pos, origin, state);
+    box3d_knot_set(item, 0, new_pos, origin, state);
 }
 
-static void sp_3dbox_knot1_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot1_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    sp_3dbox_knot_set_uniformly(item, 1, Box3D::XY, new_pos, origin, state);
+    box3d_knot_set(item, 1, new_pos, origin, state);
 }
 
-static void sp_3dbox_knot2_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot2_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    sp_3dbox_knot_set_uniformly(item, 2, Box3D::XY, new_pos, origin, state);
+    box3d_knot_set(item, 2, new_pos, origin, state);
 }
 
-static void sp_3dbox_knot3_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot3_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    sp_3dbox_knot_set_uniformly(item, 3, Box3D::XY, new_pos, origin, state);
+    box3d_knot_set(item, 3, new_pos, origin, state);
 }
 
-static void sp_3dbox_knot4_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot4_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    sp_3dbox_knot_set_uniformly(item, 4, Box3D::Z, new_pos, origin, state);
+    box3d_knot_set(item, 4, new_pos, origin, state);
 }
 
-static void sp_3dbox_knot5_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot5_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    sp_3dbox_knot_set_uniformly(item, 5, Box3D::Z, new_pos, origin, state);
+    box3d_knot_set(item, 5, new_pos, origin, state);
 }
 
-static void sp_3dbox_knot6_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot6_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    sp_3dbox_knot_set_uniformly(item, 6, Box3D::Z, new_pos, origin, state);
+    box3d_knot_set(item, 6, new_pos, origin, state);
 }
 
-static void sp_3dbox_knot7_set_uniformly(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
+static void box3d_knot7_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)
 {
-    sp_3dbox_knot_set_uniformly(item, 7, Box3D::Z, new_pos, origin, state);
+    box3d_knot_set(item, 7, new_pos, origin, state);
 }
 
-static NR::Point sp_3dbox_knot0_get(SPItem *item)
+static NR::Point box3d_knot0_get(SPItem *item)
 {
-    return sp_3dbox_knot_get(item, 0);
+    return box3d_knot_get(item, 0);
 }
 
-static NR::Point sp_3dbox_knot1_get(SPItem *item)
+static NR::Point box3d_knot1_get(SPItem *item)
 {
-    return sp_3dbox_knot_get(item, 1);
+    return box3d_knot_get(item, 1);
 }
 
-static NR::Point sp_3dbox_knot2_get(SPItem *item)
+static NR::Point box3d_knot2_get(SPItem *item)
 {
-    return sp_3dbox_knot_get(item, 2);
+    return box3d_knot_get(item, 2);
 }
 
-static NR::Point sp_3dbox_knot3_get(SPItem *item)
+static NR::Point box3d_knot3_get(SPItem *item)
 {
-    return sp_3dbox_knot_get(item, 3);
+    return box3d_knot_get(item, 3);
 }
 
-static NR::Point sp_3dbox_knot4_get(SPItem *item)
+static NR::Point box3d_knot4_get(SPItem *item)
 {
-    return sp_3dbox_knot_get(item, 4);
+    return box3d_knot_get(item, 4);
 }
 
-static NR::Point sp_3dbox_knot5_get(SPItem *item)
+static NR::Point box3d_knot5_get(SPItem *item)
 {
-    return sp_3dbox_knot_get(item, 5);
+    return box3d_knot_get(item, 5);
 }
 
-static NR::Point sp_3dbox_knot6_get(SPItem *item)
+static NR::Point box3d_knot6_get(SPItem *item)
 {
-    return sp_3dbox_knot_get(item, 6);
+    return box3d_knot_get(item, 6);
 }
 
-static NR::Point sp_3dbox_knot7_get(SPItem *item)
+static NR::Point box3d_knot7_get(SPItem *item)
 {
-    return sp_3dbox_knot_get(item, 7);
+    return box3d_knot_get(item, 7);
 }
 
-
-//static
 SPKnotHolder *
-sp_3dbox_knot_holder(SPItem *item, SPDesktop *desktop, guint number_of_handles)
+box3d_knot_holder(SPItem *item, SPDesktop *desktop)
 {
     g_assert(item != NULL);
     SPKnotHolder *knot_holder = sp_knot_holder_new(desktop, item, NULL);
 
-    switch (number_of_handles) {
-    case 3:
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot1_set, sp_3dbox_knot1_get, NULL,_("Resize box in X/Y direction"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot2_set, sp_3dbox_knot2_get, NULL,_("Resize box in X/Y direction"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot5_set, sp_3dbox_knot5_get, NULL,_("Resize box in Z direction"));
-        sp_pat_knot_holder(item, knot_holder);
-        break;
-    case 4:
-        /***
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot1_set_constrained, sp_3dbox_knot1_get, NULL,_("Resize box in X/Y direction"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot2_set_constrained, sp_3dbox_knot2_get, NULL,_("Resize box in X/Y direction"));
-        sp_knot_holder_add_full(knot_holder, sp_3dbox_knot3_set, sp_3dbox_knot3_get, NULL,
-                                SP_KNOT_SHAPE_CIRCLE,  SP_KNOT_MODE_XOR, _("Resize box in Y direction"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot7_set, sp_3dbox_knot7_get, NULL,_("Resize box in Z direction"));
-        ***/
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot0_set_uniformly, sp_3dbox_knot0_get, NULL,
-                           _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot1_set_uniformly, sp_3dbox_knot1_get, NULL,
-                           _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot2_set_uniformly, sp_3dbox_knot2_get, NULL,
-                           _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot3_set_uniformly, sp_3dbox_knot3_get, NULL,
-                           _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot4_set_uniformly, sp_3dbox_knot4_get, NULL,
-                           _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot5_set_uniformly, sp_3dbox_knot5_get, NULL,
-                           _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot6_set_uniformly, sp_3dbox_knot6_get, NULL,
-                           _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
-        sp_knot_holder_add(knot_holder, sp_3dbox_knot7_set_uniformly, sp_3dbox_knot7_get, NULL,
-                           _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction"));
-        sp_pat_knot_holder(item, knot_holder);
-        break;
-    default:
-        g_print ("Wrong number of handles (%d): Not implemented yet.\n", number_of_handles);
-        break;
-    }
+    sp_knot_holder_add(knot_holder, box3d_knot0_set, box3d_knot0_get, NULL,
+                       _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis; with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
+    sp_knot_holder_add(knot_holder, box3d_knot1_set, box3d_knot1_get, NULL,
+                       _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis; with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
+    sp_knot_holder_add(knot_holder, box3d_knot2_set, box3d_knot2_get, NULL,
+                       _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis; with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
+    sp_knot_holder_add(knot_holder, box3d_knot3_set, box3d_knot3_get, NULL,
+                       _("Resize box in X/Y direction; with <b>Shift</b> along the Z axis; with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
+    sp_knot_holder_add(knot_holder, box3d_knot4_set, box3d_knot4_get, NULL,
+                       _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction; with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
+    sp_knot_holder_add(knot_holder, box3d_knot5_set, box3d_knot5_get, NULL,
+                       _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction; with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
+    sp_knot_holder_add(knot_holder, box3d_knot6_set, box3d_knot6_get, NULL,
+                       _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction; with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
+    sp_knot_holder_add(knot_holder, box3d_knot7_set, box3d_knot7_get, NULL,
+                       _("Resize box along the Z axis; with <b>Shift</b> in X/Y direction; with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
+
+    // center dragging
+    sp_knot_holder_add_full(knot_holder, box3d_knot_center_set, box3d_knot_center_get, NULL,
+                            SP_KNOT_SHAPE_CROSS, SP_KNOT_MODE_XOR,_("Move the box in perspective"));
+
+    sp_pat_knot_holder(item, knot_holder);
 
     return knot_holder;
 }
 
+
+
 /* SPArc */
 
 /*
@@ -767,7 +707,7 @@ sp_genericellipse_side(SPGenericEllipse *ellipse, NR::Point const &p)
 }
 
 static void
-sp_arc_start_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_arc_start_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     int snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12);
 
@@ -797,7 +737,7 @@ static NR::Point sp_arc_start_get(SPItem *item)
 }
 
 static void
-sp_arc_end_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_arc_end_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     int snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12);
 
@@ -839,11 +779,11 @@ sp_arc_startend_click(SPItem *item, guint state)
 
 
 static void
-sp_arc_rx_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_arc_rx_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
     SPArc *arc = SP_ARC(item);
-    
+
     NR::Point const s = snap_knot_position(arc, p);
 
     ge->rx.computed = fabs( ge->cx.computed - s[NR::X] );
@@ -863,11 +803,11 @@ static NR::Point sp_arc_rx_get(SPItem *item)
 }
 
 static void
-sp_arc_ry_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_arc_ry_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
     SPArc *arc = SP_ARC(item);
-    
+
     NR::Point const s = snap_knot_position(arc, p);
 
     ge->ry.computed = fabs( ge->cy.computed - s[NR::Y] );
@@ -934,10 +874,10 @@ sp_arc_knot_holder(SPItem *item, SPDesktop *desktop)
 /* SPStar */
 
 static void
-sp_star_knot1_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_star_knot1_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     SPStar *star = SP_STAR(item);
-    
+
     NR::Point const s = snap_knot_position(star, p);
 
     NR::Point d = s - star->center;
@@ -960,12 +900,12 @@ sp_star_knot1_set(SPItem *item, NR::Point const &p, NR::Point const &origin, gui
 }
 
 static void
-sp_star_knot2_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_star_knot2_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     SPStar *star = SP_STAR(item);
-    
+
     NR::Point const s = snap_knot_position(star, p);
-    
+
     if (star->flatsided == false) {
         NR::Point d = s - star->center;
 
@@ -1053,7 +993,7 @@ sp_star_knot_holder(SPItem *item, SPDesktop *desktop)
  *   [control] constrain inner arg to round per PI/4
  */
 static void
-sp_spiral_inner_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_spiral_inner_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     int snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12);
 
@@ -1095,7 +1035,7 @@ sp_spiral_inner_set(SPItem *item, NR::Point const &p, NR::Point const &origin, g
  *   [control] constrain inner arg to round per PI/4
  */
 static void
-sp_spiral_outer_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_spiral_outer_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint state)
 {
     int snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12);
 
@@ -1213,7 +1153,7 @@ sp_spiral_knot_holder(SPItem *item, SPDesktop *desktop)
 /* SPOffset */
 
 static void
-sp_offset_offset_set(SPItem *item, NR::Point const &p, NR::Point const &origin, guint state)
+sp_offset_offset_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/)
 {
     SPOffset *offset = SP_OFFSET(item);
 
@@ -1250,7 +1190,7 @@ sp_offset_knot_holder(SPItem *item, SPDesktop *desktop)
 static SPKnotHolder *
 sp_misc_knot_holder(SPItem *item, SPDesktop *desktop) // FIXME: eliminate, instead make a pattern-drag similar to gradient-drag
 {
-    if ((SP_OBJECT(item)->style->fill.type == SP_PAINT_TYPE_PAINTSERVER)
+    if ((SP_OBJECT(item)->style->fill.isPaintserver())
         && SP_IS_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)))
     {
         SPKnotHolder *knot_holder = sp_knot_holder_new(desktop, item, NULL);
@@ -1265,7 +1205,7 @@ sp_misc_knot_holder(SPItem *item, SPDesktop *desktop) // FIXME: eliminate, inste
 static void
 sp_pat_knot_holder(SPItem *item, SPKnotHolder *knot_holder)
 {
-    if ((SP_OBJECT(item)->style->fill.type == SP_PAINT_TYPE_PAINTSERVER)
+    if ((SP_OBJECT(item)->style->fill.isPaintserver())
         && SP_IS_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)))
     {
         sp_knot_holder_add_full(knot_holder, sp_pattern_xy_set, sp_pattern_xy_get, NULL, SP_KNOT_SHAPE_CROSS, SP_KNOT_MODE_XOR,