summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2012-10-18 18:06:35 +0000
committer~suv <suv-sf@users.sourceforge.net>2012-10-18 18:06:35 +0000
commit9158a2ccc3f6238e3f511d078b4d0ef942f30e9b (patch)
treecb4a833c8d624bfb1d36052c8088c4f835cfb031 /src
parentFix SVG formatting (EMF import): (diff)
parentTranslations. Latvian translation update by Jānis Eisaks. (diff)
downloadinkscape-9158a2ccc3f6238e3f511d078b4d0ef942f30e9b.tar.gz
inkscape-9158a2ccc3f6238e3f511d078b4d0ef942f30e9b.zip
merge from trunk (r11808)
(bzr r11668.1.30)
Diffstat (limited to 'src')
-rw-r--r--src/desktop-events.cpp11
-rw-r--r--src/display/canvas-arena.cpp8
-rw-r--r--src/display/nr-filter-flood.cpp33
-rw-r--r--src/display/nr-filter-image.cpp132
-rw-r--r--src/display/nr-filter-image.h1
-rw-r--r--src/display/nr-filter-primitive.cpp29
-rw-r--r--src/extension/prefdialog.cpp10
-rw-r--r--src/knot-holder-entity.cpp16
-rw-r--r--src/knot-holder-entity.h4
-rw-r--r--src/live_effects/lpe-angle_bisector.cpp8
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp8
-rw-r--r--src/live_effects/lpe-knot.cpp2
-rw-r--r--src/live_effects/lpe-parallel.cpp8
-rw-r--r--src/live_effects/lpe-perp_bisector.cpp14
-rw-r--r--src/live_effects/lpe-perp_bisector.h4
-rw-r--r--src/live_effects/lpe-perspective_path.cpp4
-rw-r--r--src/live_effects/lpe-tangent_to_curve.cpp12
-rw-r--r--src/live_effects/parameter/parameter.cpp4
-rw-r--r--src/live_effects/parameter/point.cpp4
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp4
-rw-r--r--src/live_effects/parameter/vector.cpp4
-rw-r--r--src/object-edit.cpp40
-rw-r--r--src/ui/dialog/symbols.cpp43
-rw-r--r--src/ui/previewholder.cpp22
-rw-r--r--src/ui/previewholder.h1
-rw-r--r--src/ui/tool/node.cpp2
-rw-r--r--src/ui/widget/dock.cpp12
-rw-r--r--src/xml/simple-node.cpp2
28 files changed, 314 insertions, 128 deletions
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 1377fef9d..1cfe018ce 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -502,7 +502,16 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
guide_cursor = gdk_cursor_new (GDK_EXCHANGE);
gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(sp_desktop_canvas(desktop))), guide_cursor);
#if GTK_CHECK_VERSION(3,0,0)
- g_object_unref(guide_cursor);
+ g_object_unref(guide_cursor);
+#else
+ gdk_cursor_unref(guide_cursor);
+#endif
+ } else {
+ GdkCursor *guide_cursor;
+ guide_cursor = gdk_cursor_new (GDK_HAND1);
+ gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(sp_desktop_canvas(desktop))), guide_cursor);
+#if GTK_CHECK_VERSION(3,0,0)
+ g_object_unref(guide_cursor);
#else
gdk_cursor_unref(guide_cursor);
#endif
diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp
index f0fd63ef4..809f14500 100644
--- a/src/display/canvas-arena.cpp
+++ b/src/display/canvas-arena.cpp
@@ -316,6 +316,14 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event)
ret = sp_canvas_arena_send_event (arena, event);
break;
+ case GDK_SCROLL:
+ if (event->scroll.state & GDK_CONTROL_MASK) {
+ /* Zoom is emitted by the canvas as well, ignore here */
+ return FALSE;
+ }
+ ret = sp_canvas_arena_send_event (arena, event);
+ break;
+
default:
/* Just send event */
ret = sp_canvas_arena_send_event (arena, event);
diff --git a/src/display/nr-filter-flood.cpp b/src/display/nr-filter-flood.cpp
index 449255133..56a27ecd7 100644
--- a/src/display/nr-filter-flood.cpp
+++ b/src/display/nr-filter-flood.cpp
@@ -55,11 +55,34 @@ void FilterFlood::render_cairo(FilterSlot &slot)
#endif
cairo_surface_t *out = ink_cairo_surface_create_same_size(input, CAIRO_CONTENT_COLOR_ALPHA);
- cairo_t *ct = cairo_create(out);
- cairo_set_source_rgba(ct, r, g, b, a);
- cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
- cairo_paint(ct);
- cairo_destroy(ct);
+
+ // Get filter primitive area in user units
+ Geom::Rect fp = filter_primitive_area( slot.get_units() );
+
+ // Convert to Cairo units
+ Geom::Rect fp_cairo = fp * slot.get_units().get_matrix_user2pb();
+
+ // Get area in slot (tile to fill)
+ Geom::Rect sa = slot.get_slot_area();
+
+ // Get overlap
+ Geom::OptRect optoverlap = intersect( fp_cairo, sa );
+ if( optoverlap ) {
+
+ Geom::Rect overlap = *optoverlap;
+
+ double dx = fp_cairo.min()[Geom::X] - sa.min()[Geom::X];
+ double dy = fp_cairo.min()[Geom::Y] - sa.min()[Geom::Y];
+ if( dx < 0.0 ) dx = 0.0;
+ if( dy < 0.0 ) dy = 0.0;
+
+ cairo_t *ct = cairo_create(out);
+ cairo_set_source_rgba(ct, r, g, b, a);
+ cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
+ cairo_rectangle(ct, dx, dy, overlap.width(), overlap.height() );
+ cairo_fill(ct);
+ cairo_destroy(ct);
+ }
slot.set(_output, out);
cairo_surface_destroy(out);
diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp
index a9a5ec3e0..e03a56964 100644
--- a/src/display/nr-filter-image.cpp
+++ b/src/display/nr-filter-image.cpp
@@ -20,6 +20,7 @@
#include "display/nr-filter-image.h"
#include "display/nr-filter-slot.h"
#include "display/nr-filter-units.h"
+#include "enums.h"
#include <glibmm/fileutils.h>
namespace Inkscape {
@@ -50,22 +51,31 @@ void FilterImage::render_cairo(FilterSlot &slot)
//cairo_surface_t *input = slot.getcairo(_input);
+ // Viewport is filter primitive area (in user coordinates).
+ // Note: viewport calculation in non-trivial. Do not rely
+ // on get_matrix_primitiveunits2pb().
+ Geom::Rect vp = filter_primitive_area( slot.get_units() );
+ double feImageX = vp.min()[Geom::X];
+ double feImageY = vp.min()[Geom::Y];
+ double feImageWidth = vp.width();
+ double feImageHeight = vp.height();
+
+ // feImage is suppose to use the same parameters as a normal SVG image.
+ // If a width or height is set to zero, the image is not suppose to be displayed.
+ // This does not seem to be what Firefox or Opera does, nor does the W3C displacement
+ // filter test expect this behavior. If the width and/or height are zero, we use
+ // the width and height of the object bounding box.
Geom::Affine m = slot.get_units().get_matrix_user2filterunits().inverse();
Geom::Point bbox_00 = Geom::Point(0,0) * m;
Geom::Point bbox_w0 = Geom::Point(1,0) * m;
Geom::Point bbox_0h = Geom::Point(0,1) * m;
double bbox_width = Geom::distance(bbox_00, bbox_w0);
double bbox_height = Geom::distance(bbox_00, bbox_0h);
-
- // feImage is suppose to use the same parameters as a normal SVG image.
- // If a width or height is set to zero, the image is not suppose to be displayed.
- // This does not seem to be what Firefox or Opera does, nor does the W3C displacement
- // filter test expect this behavior. If the width and/or height are zero, we use
- // the width and height of the object bounding box.
if( feImageWidth == 0 ) feImageWidth = bbox_width;
if( feImageHeight == 0 ) feImageHeight = bbox_height;
+ // Internal image, like <use>
if (from_element) {
if (!SVGElem) return;
@@ -87,7 +97,7 @@ void FilterImage::render_cairo(FilterSlot &slot)
drawing.setRoot(ai);
Geom::Rect area = *optarea;
- Geom::Affine pu2pb = slot.get_units().get_matrix_primitiveunits2pb();
+ Geom::Affine user2pb = slot.get_units().get_matrix_user2pb();
double scaleX = feImageWidth / area.width();
double scaleY = feImageHeight / area.height();
@@ -96,9 +106,9 @@ void FilterImage::render_cairo(FilterSlot &slot)
cairo_surface_t *out = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
sa.width(), sa.height());
Inkscape::DrawingContext ct(out, sa.min());
- ct.transform(pu2pb); // we are now in primitive units
+ ct.transform(user2pb); // we are now in primitive units
ct.translate(feImageX, feImageY);
- ct.scale(scaleX, scaleY);
+// ct.scale(scaleX, scaleY); No scaling should be done
Geom::IntRect render_rect = area.roundOutwards();
ct.translate(render_rect.min());
@@ -113,6 +123,7 @@ void FilterImage::render_cairo(FilterSlot &slot)
return;
}
+ // External image, like <image>
if (!image && !broken_ref) {
broken_ref = true;
try {
@@ -158,9 +169,9 @@ void FilterImage::render_cairo(FilterSlot &slot)
}
// Native size of image
- //width = image->get_width();
- //height = image->get_height();
- //rowstride = image->get_rowstride();
+ // width = image->get_width();
+ // height = image->get_height();
+ // rowstride = image->get_rowstride();
convert_pixbuf_normal_to_argb32(image->gobj());
@@ -174,11 +185,94 @@ void FilterImage::render_cairo(FilterSlot &slot)
cairo_t *ct = cairo_create(out);
cairo_translate(ct, -sa.min()[Geom::X], -sa.min()[Geom::Y]);
- // now ct is in pb coordinates
- ink_cairo_transform(ct, slot.get_units().get_matrix_primitiveunits2pb());
+
+ // now ct is in pb coordinates, note the feWidth etc. are in user units
+ ink_cairo_transform(ct, slot.get_units().get_matrix_user2pb());
+
// now ct is in the coordinates of feImageX etc.
- // TODO: add preserveAspectRatio support here
+ // Now that we have the viewport, we must map image inside.
+ // Partially copied from sp-image.cpp.
+
+ // Do nothing if preserveAspectRatio is "none".
+ if( aspect_align != SP_ASPECT_NONE ) {
+
+ // Check aspect ratio of image vs. viewport
+ double feAspect = feImageHeight/feImageWidth;
+ double aspect = (double)image->get_height()/(double)image->get_width();
+ bool ratio = (feAspect < aspect);
+
+ double ax, ay; // Align side
+ switch( aspect_align ) {
+ case SP_ASPECT_XMIN_YMIN:
+ ax = 0.0;
+ ay = 0.0;
+ break;
+ case SP_ASPECT_XMID_YMIN:
+ ax = 0.5;
+ ay = 0.0;
+ break;
+ case SP_ASPECT_XMAX_YMIN:
+ ax = 1.0;
+ ay = 0.0;
+ break;
+ case SP_ASPECT_XMIN_YMID:
+ ax = 0.0;
+ ay = 0.5;
+ break;
+ case SP_ASPECT_XMID_YMID:
+ ax = 0.5;
+ ay = 0.5;
+ break;
+ case SP_ASPECT_XMAX_YMID:
+ ax = 1.0;
+ ay = 0.5;
+ break;
+ case SP_ASPECT_XMIN_YMAX:
+ ax = 0.0;
+ ay = 1.0;
+ break;
+ case SP_ASPECT_XMID_YMAX:
+ ax = 0.5;
+ ay = 1.0;
+ break;
+ case SP_ASPECT_XMAX_YMAX:
+ ax = 1.0;
+ ay = 1.0;
+ break;
+ default:
+ ax = 0.0;
+ ay = 0.0;
+ break;
+ }
+
+ if( aspect_clip == SP_ASPECT_SLICE ) {
+ // image clipped by viewbox
+
+ if( ratio ) {
+ // clip top/bottom
+ feImageY -= ay * (feImageWidth * aspect - feImageHeight);
+ feImageHeight = feImageWidth * aspect;
+ } else {
+ // clip sides
+ feImageX -= ax * (feImageHeight / aspect - feImageWidth);
+ feImageWidth = feImageHeight / aspect;
+ }
+
+ } else {
+ // image fits into viewbox
+
+ if( ratio ) {
+ // fit to height
+ feImageX += ax * (feImageWidth - feImageHeight / aspect );
+ feImageWidth = feImageHeight / aspect;
+ } else {
+ // fit to width
+ feImageY += ay * (feImageHeight - feImageWidth * aspect);
+ feImageHeight = feImageWidth * aspect;
+ }
+ }
+ }
double scaleX = feImageWidth / image->get_width();
double scaleY = feImageHeight / image->get_height();
@@ -204,6 +298,7 @@ double FilterImage::complexity(Geom::Affine const &)
}
void FilterImage::set_href(const gchar *href){
+
if (feImageHref) g_free (feImageHref);
feImageHref = (href) ? g_strdup (href) : NULL;
@@ -218,13 +313,6 @@ void FilterImage::set_document(SPDocument *doc){
document = doc;
}
-void FilterImage::set_region(SVGLength x, SVGLength y, SVGLength width, SVGLength height) {
- feImageX=x.computed;
- feImageY=y.computed;
- feImageWidth=width.computed;
- feImageHeight=height.computed;
-}
-
void FilterImage::set_align( unsigned int align ) {
aspect_align = align;
}
diff --git a/src/display/nr-filter-image.h b/src/display/nr-filter-image.h
index c0b9d6e81..05b7d65a8 100644
--- a/src/display/nr-filter-image.h
+++ b/src/display/nr-filter-image.h
@@ -35,7 +35,6 @@ public:
void set_document( SPDocument *document );
void set_href(const gchar *href);
- void set_region(SVGLength x, SVGLength y, SVGLength width, SVGLength height);
void set_align( unsigned int align );
void set_clip( unsigned int clip );
bool from_element;
diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp
index c6bd8a74e..93c6d4d6e 100644
--- a/src/display/nr-filter-primitive.cpp
+++ b/src/display/nr-filter-primitive.cpp
@@ -15,6 +15,12 @@
#include "display/nr-filter-types.h"
#include "svg/svg-length.h"
+#include "inkscape.h"
+#include "desktop.h"
+#include "desktop-handles.h"
+#include "document.h"
+#include "sp-root.h"
+
namespace Inkscape {
namespace Filters {
@@ -103,6 +109,19 @@ Geom::Rect FilterPrimitive::filter_primitive_area(FilterUnits const &units)
Geom::OptRect bb = units.get_item_bbox();
Geom::OptRect fa = units.get_filter_area();
+ // This is definitely a hack... but what else to do?
+ // Current viewport might not be document viewport... but how to find?
+ SPDesktop* desktop = inkscape_active_desktop();
+ SPDocument* document = sp_desktop_document(desktop);
+ SPRoot* root = document->getRoot();
+ Geom::Rect viewport;
+ if( root->viewBox_set ) {
+ viewport = root->viewBox;
+ } else {
+ // Pick some random values
+ viewport = Geom::Rect::from_xywh(0,0,480,360);
+ }
+
/* Update computed values for ex, em, %. For %, assumes primitive unit is objectBoundingBox. */
/* TODO: fetch somehow the object ex and em lengths; 12, 6 are just dummy values. */
double len_x = bb->width();
@@ -144,11 +163,11 @@ Geom::Rect FilterPrimitive::filter_primitive_area(FilterUnits const &units)
if( _subregion_y._set && _subregion_y.unit != SVGLength::PERCENT ) y = _subregion_y.computed;
if( _subregion_width._set && _subregion_width.unit != SVGLength::PERCENT ) width = _subregion_width.computed;
if( _subregion_height._set && _subregion_height.unit != SVGLength::PERCENT ) height = _subregion_height.computed;
- // TODO: add percent of viewport TEMPORARY HACK FOR TESTING...
- if( _subregion_x._set && _subregion_x.unit == SVGLength::PERCENT ) x = _subregion_x.value * 480; // viewport_x
- if( _subregion_y._set && _subregion_y.unit == SVGLength::PERCENT ) y = _subregion_y.value * 360;
- if( _subregion_width._set && _subregion_width.unit == SVGLength::PERCENT ) width = _subregion_width.value * 480;
- if( _subregion_height._set && _subregion_height.unit == SVGLength::PERCENT ) height = _subregion_height.value * 360;
+ // Percent of viewport
+ if( _subregion_x._set && _subregion_x.unit == SVGLength::PERCENT ) x = _subregion_x.value * viewport.width();
+ if( _subregion_y._set && _subregion_y.unit == SVGLength::PERCENT ) y = _subregion_y.value * viewport.height();
+ if( _subregion_width._set && _subregion_width.unit == SVGLength::PERCENT ) width = _subregion_width.value * viewport.width();
+ if( _subregion_height._set && _subregion_height.unit == SVGLength::PERCENT ) height = _subregion_height.value * viewport.height();
}
Geom::Point minp, maxp;
diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp
index 94f128a42..2d2604c7f 100644
--- a/src/extension/prefdialog.cpp
+++ b/src/extension/prefdialog.cpp
@@ -32,13 +32,13 @@ namespace Extension {
/** \brief Creates a new preference dialog for extension preferences
- \param name Name of the Extension who's dialog this is
+ \param name Name of the Extension whose dialog this is
\param help The help string for the extension (NULL if none)
\param controls The extension specific widgets in the dialog
This function initializes the dialog with the name of the extension
in the title. It adds a few buttons and sets up handlers for
- them. It also places the passed in widgets into the dialog.
+ them. It also places the passed-in widgets into the dialog.
*/
PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, Effect * effect) :
#if WITH_GTKMM_3_0
@@ -102,12 +102,10 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview);
if (hbox != NULL) {
#if WITH_GTKMM_3_0
- Gtk::Widget * back = hbox->get_children().back();
+ _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->get_children().front());
#else
- Gtk::Widget * back = hbox->children().back().get_widget();
+ _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->children().back().get_widget());
#endif
- Gtk::CheckButton * cb = dynamic_cast<Gtk::CheckButton *>(back);
- _checkbox_preview = cb;
}
preview_toggle();
diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp
index cb8f29f46..75732f805 100644
--- a/src/knot-holder-entity.cpp
+++ b/src/knot-holder-entity.cpp
@@ -89,8 +89,12 @@ KnotHolderEntity::update_knot()
}
Geom::Point
-KnotHolderEntity::snap_knot_position(Geom::Point const &p)
+KnotHolderEntity::snap_knot_position(Geom::Point const &p, guint state)
{
+ if (state & GDK_SHIFT_MASK) { // Don't snap when shift-key is held
+ return p;
+ }
+
Geom::Affine const i2dt (item->i2dt_affine());
Geom::Point s = p * i2dt;
@@ -103,8 +107,12 @@ KnotHolderEntity::snap_knot_position(Geom::Point const &p)
}
Geom::Point
-KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint)
+KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint, guint state)
{
+ if (state & GDK_SHIFT_MASK) { // Don't snap when shift-key is held
+ return p;
+ }
+
Geom::Affine const i2d (item->i2dt_affine());
Geom::Point s = p * i2d;
@@ -148,7 +156,7 @@ PatternKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &ori
SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
// FIXME: this snapping should be done together with knowing whether control was pressed. If GDK_CONTROL_MASK, then constrained snapping should be used.
- Geom::Point p_snapped = snap_knot_position(p);
+ Geom::Point p_snapped = snap_knot_position(p, state);
if ( state & GDK_CONTROL_MASK ) {
if (fabs((p - origin)[Geom::X]) > fabs((p - origin)[Geom::Y])) {
@@ -220,7 +228,7 @@ PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &
SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
// FIXME: this snapping should be done together with knowing whether control was pressed. If GDK_CONTROL_MASK, then constrained snapping should be used.
- Geom::Point p_snapped = snap_knot_position(p);
+ Geom::Point p_snapped = snap_knot_position(p, state);
// get angle from current transform
gdouble theta = sp_pattern_extract_theta(pat);
diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h
index 58dc89bfd..09d70f8c9 100644
--- a/src/knot-holder-entity.h
+++ b/src/knot-holder-entity.h
@@ -65,8 +65,8 @@ public:
void update_knot();
//private:
- Geom::Point snap_knot_position(Geom::Point const &p);
- Geom::Point snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint);
+ Geom::Point snap_knot_position(Geom::Point const &p, guint state);
+ Geom::Point snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint, guint state);
SPKnot *knot;
SPItem *item;
diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp
index ce152bb34..4e6176c92 100644
--- a/src/live_effects/lpe-angle_bisector.cpp
+++ b/src/live_effects/lpe-angle_bisector.cpp
@@ -99,11 +99,11 @@ LPEAngleBisector::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *deskt
namespace AB {
void
-KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
LPEAngleBisector *lpe = dynamic_cast<LPEAngleBisector *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir);
lpe->length_left.param_set_value(-lambda);
@@ -112,11 +112,11 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori
}
void
-KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
LPEAngleBisector *lpe = dynamic_cast<LPEAngleBisector *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir);
lpe->length_right.param_set_value(lambda);
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index 68242cc94..01c0e550c 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -152,7 +152,7 @@ KnotHolderEntityStartingAngle::knot_set(Geom::Point const &p, Geom::Point const
{
LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
@@ -172,7 +172,7 @@ KnotHolderEntityRotationAngle::knot_set(Geom::Point const &p, Geom::Point const
{
LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
@@ -191,14 +191,14 @@ Geom::Point
KnotHolderEntityStartingAngle::knot_get()
{
LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
- return snap_knot_position(lpe->start_pos);
+ return lpe->start_pos;
}
Geom::Point
KnotHolderEntityRotationAngle::knot_get()
{
LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
- return snap_knot_position(lpe->rot_pos);
+ return lpe->rot_pos;
}
} // namespace CR
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp
index 746dbbb7a..61e457d35 100644
--- a/src/live_effects/lpe-knot.cpp
+++ b/src/live_effects/lpe-knot.cpp
@@ -634,7 +634,7 @@ Geom::Point
KnotHolderEntityCrossingSwitcher::knot_get()
{
LPEKnot* lpe = dynamic_cast<LPEKnot *>(_effect);
- return snap_knot_position(lpe->switcher);
+ return lpe->switcher;
}
void
diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp
index a6b894ce3..5638bf6de 100644
--- a/src/live_effects/lpe-parallel.cpp
+++ b/src/live_effects/lpe-parallel.cpp
@@ -113,13 +113,13 @@ void LPEParallel::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *deskt
namespace Pl {
void
-KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
using namespace Geom;
LPEParallel *lpe = dynamic_cast<LPEParallel *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = L2(s - lpe->offset_pt) * sgn(dot(s - lpe->offset_pt, lpe->dir));
lpe->length_left.param_set_value(-lambda);
@@ -128,13 +128,13 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori
}
void
-KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
using namespace Geom;
LPEParallel *lpe = dynamic_cast<LPEParallel *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = L2(s - lpe->offset_pt) * sgn(dot(s - lpe->offset_pt, lpe->dir));
lpe->length_right.param_set_value(lambda);
diff --git a/src/live_effects/lpe-perp_bisector.cpp b/src/live_effects/lpe-perp_bisector.cpp
index 7417c166f..df7e18dcf 100644
--- a/src/live_effects/lpe-perp_bisector.cpp
+++ b/src/live_effects/lpe-perp_bisector.cpp
@@ -31,7 +31,7 @@ namespace PB {
class KnotHolderEntityEnd : public LPEKnotHolderEntity {
public:
KnotHolderEntityEnd(LPEPerpBisector *effect) : LPEKnotHolderEntity(effect) {};
- void bisector_end_set(Geom::Point const &p, bool left = true);
+ void bisector_end_set(Geom::Point const &p, guint state, bool left = true);
};
class KnotHolderEntityLeftEnd : public KnotHolderEntityEnd {
@@ -61,11 +61,11 @@ KnotHolderEntityRightEnd::knot_get() {
}
void
-KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, bool left) {
+KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, guint state, bool left) {
LPEPerpBisector *lpe = dynamic_cast<LPEPerpBisector *>(_effect);
if (!lpe) return;
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->M, lpe->perp_dir);
if (left) {
@@ -81,13 +81,13 @@ KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, bool left) {
}
void
-KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) {
- bisector_end_set(p);
+KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) {
+ bisector_end_set(p, state);
}
void
-KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) {
- bisector_end_set(p, false);
+KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) {
+ bisector_end_set(p, state, false);
}
} //namescape PB
diff --git a/src/live_effects/lpe-perp_bisector.h b/src/live_effects/lpe-perp_bisector.h
index 823717e62..f5a918028 100644
--- a/src/live_effects/lpe-perp_bisector.h
+++ b/src/live_effects/lpe-perp_bisector.h
@@ -27,7 +27,7 @@ namespace PB {
class KnotHolderEntityEnd;
class KnotHolderEntityLeftEnd;
class KnotHolderEntityRightEnd;
- void bisector_end_set(SPItem *item, Geom::Point const &p, bool left);
+ void bisector_end_set(SPItem *item, Geom::Point const &p, guint state, bool left);
}
class LPEPerpBisector : public Effect {
@@ -46,7 +46,7 @@ public:
friend class PB::KnotHolderEntityEnd;
friend class PB::KnotHolderEntityLeftEnd;
friend class PB::KnotHolderEntityRightEnd;
- friend void PB::bisector_end_set(SPItem *item, Geom::Point const &p, bool left = true);
+ friend void PB::bisector_end_set(SPItem *item, Geom::Point const &p, guint state, bool left = true);
void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
private:
diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp
index f3cf802a1..aeee77482 100644
--- a/src/live_effects/lpe-perspective_path.cpp
+++ b/src/live_effects/lpe-perspective_path.cpp
@@ -149,13 +149,13 @@ void LPEPerspectivePath::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop
namespace PP {
void
-KnotHolderEntityOffset::knot_set(Geom::Point const &p, Geom::Point const &origin, guint /*state*/)
+KnotHolderEntityOffset::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state)
{
using namespace Geom;
LPEPerspectivePath* lpe = dynamic_cast<LPEPerspectivePath *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
lpe->offsetx.param_set_value((s - origin)[Geom::X]);
lpe->offsety.param_set_value(-(s - origin)[Geom::Y]); // additional minus sign is due to coordinate system flipping
diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp
index 93dacf3e0..d76675467 100644
--- a/src/live_effects/lpe-tangent_to_curve.cpp
+++ b/src/live_effects/lpe-tangent_to_curve.cpp
@@ -122,13 +122,13 @@ LPETangentToCurve::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desk
namespace TtC {
void
-KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
using namespace Geom;
LPETangentToCurve* lpe = dynamic_cast<LPETangentToCurve *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
// FIXME: There must be a better way of converting the path's SPCurve* to pwd2.
SPCurve *curve = SP_PATH(item)->get_curve_for_edit();
@@ -146,11 +146,11 @@ KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*or
}
void
-KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
LPETangentToCurve *lpe = dynamic_cast<LPETangentToCurve *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA);
lpe->length_left.param_set_value(-lambda);
@@ -159,11 +159,11 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori
}
void
-KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
LPETangentToCurve *lpe = dynamic_cast<LPETangentToCurve *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA);
lpe->length_right.param_set_value(lambda);
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index f56df980e..8615721b0 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -51,8 +51,8 @@ ScalarParam::ScalarParam( const Glib::ustring& label, const Glib::ustring& tip,
Effect* effect, gdouble default_value)
: Parameter(label, tip, key, wr, effect),
value(default_value),
- min(-Geom::infinity()),
- max(Geom::infinity()),
+ min(-G_MAXDOUBLE),
+ max(G_MAXDOUBLE),
integer(false),
defvalue(default_value),
digits(2),
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index b751aeda3..2be87e048 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -141,9 +141,9 @@ private:
};
void
-PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
pparam->param_setValue(s);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
}
diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp
index 68d0175ca..93161ec0d 100644
--- a/src/live_effects/parameter/powerstrokepointarray.cpp
+++ b/src/live_effects/parameter/powerstrokepointarray.cpp
@@ -144,7 +144,7 @@ PowerStrokePointArrayParamKnotHolderEntity::PowerStrokePointArrayParamKnotHolder
}
void
-PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
using namespace Geom;
@@ -156,7 +156,7 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom:
Piecewise<D2<SBasis> > const & pwd2 = _pparam->get_pwd2();
Piecewise<D2<SBasis> > const & n = _pparam->get_pwd2_normal();
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double t = nearest_point(s, pwd2);
double offset = dot(s - pwd2.valueAt(t), n.valueAt(t));
_pparam->_vector.at(_index) = Geom::Point(t, offset);
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index 8b62ba91e..a20c46042 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -149,8 +149,8 @@ public:
VectorParamKnotHolderEntity_Origin(VectorParam *p) : param(p) { }
virtual ~VectorParamKnotHolderEntity_Origin() {}
- virtual void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) {
- Geom::Point const s = snap_knot_position(p);
+ virtual void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) {
+ Geom::Point const s = snap_knot_position(p, state);
param->setOrigin(s);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
};
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index b91a6d1e9..989d84c7f 100644
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -141,7 +141,7 @@ RectKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*orig
//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
- Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(-1, 0)));
+ Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(-1, 0)), state);
if (state & GDK_CONTROL_MASK) {
gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
@@ -190,7 +190,7 @@ RectKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*orig
//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
- Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(0, 1)));
+ Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(0, 1)), state);
if (state & GDK_CONTROL_MASK) { // When holding control then rx will be kept equal to ry,
// resulting in a perfect circle (and not an ellipse)
@@ -279,13 +279,13 @@ RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &or
// snap to horizontal or diagonal
if (minx != 0 && fabs(miny/minx) > 0.5 * 1/ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->height.computed = MAX(h_orig + minx / ratio, 0);
} else {
// closer to the horizontal, change only width, height is h_orig
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->height.computed = MAX(h_orig, 0);
@@ -296,13 +296,13 @@ RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &or
// snap to vertical or diagonal
if (miny != 0 && fabs(minx/miny) > 0.5 * ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->width.computed = MAX(w_orig + miny * ratio, 0);
} else {
// closer to the vertical, change only height, width is w_orig
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->width.computed = MAX(w_orig, 0);
@@ -315,7 +315,7 @@ RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &or
} else {
// move freely
- s = snap_knot_position(p);
+ s = snap_knot_position(p, state);
rect->width.computed = MAX(s[Geom::X] - rect->x.computed, 0);
rect->height.computed = MAX(s[Geom::Y] - rect->y.computed, 0);
rect->width._set = rect->height._set = true;
@@ -369,14 +369,14 @@ RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin
// snap to horizontal or diagonal
if (minx != 0 && fabs(miny/minx) > 0.5 * 1/ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->y.computed = MIN(origin[Geom::Y] + minx / ratio, opposite_y);
rect->height.computed = MAX(h_orig - minx / ratio, 0);
} else {
// closer to the horizontal, change only width, height is h_orig
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->y.computed = MIN(origin[Geom::Y], opposite_y);
@@ -388,14 +388,14 @@ RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin
// snap to vertical or diagonal
if (miny != 0 && fabs(minx/miny) > 0.5 *ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->x.computed = MIN(origin[Geom::X] + miny * ratio, opposite_x);
rect->width.computed = MAX(w_orig - miny * ratio, 0);
} else {
// closer to the vertical, change only height, width is w_orig
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->x.computed = MIN(origin[Geom::X], opposite_x);
@@ -409,7 +409,7 @@ RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin
} else {
// move freely
- s = snap_knot_position(p);
+ s = snap_knot_position(p, state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
@@ -483,7 +483,7 @@ Box3DKnotHolderEntity::knot_get_generic(SPItem *item, unsigned int knot_id)
void
Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom::Point const &new_pos, guint state)
{
- Geom::Point const s = snap_knot_position(new_pos);
+ Geom::Point const s = snap_knot_position(new_pos, state);
g_assert(item != NULL);
SPBox3D *box = SP_BOX3D(item);
@@ -660,7 +660,7 @@ Box3DKnotHolderEntity7::knot_set(Geom::Point const &new_pos, Geom::Point const &
void
Box3DKnotHolderEntityCenter::knot_set(Geom::Point const &new_pos, Geom::Point const &origin, guint state)
{
- Geom::Point const s = snap_knot_position(new_pos);
+ Geom::Point const s = snap_knot_position(new_pos, state);
SPBox3D *box = SP_BOX3D(item);
Geom::Affine const i2dt (item->i2dt_affine ());
@@ -875,7 +875,7 @@ ArcKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origi
{
SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
ge->rx.computed = fabs( ge->cx.computed - s[Geom::X] );
@@ -910,7 +910,7 @@ ArcKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origi
{
SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
ge->ry.computed = fabs( ge->cy.computed - s[Geom::Y] );
@@ -995,7 +995,7 @@ StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origi
{
SPStar *star = SP_STAR(item);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
Geom::Point d = s - star->center;
@@ -1021,7 +1021,7 @@ StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origi
{
SPStar *star = SP_STAR(item);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
if (star->flatsided == false) {
Geom::Point d = s - star->center;
@@ -1086,13 +1086,13 @@ sp_star_knot_click(SPItem *item, guint state)
void
StarKnotHolderEntity1::knot_click(guint state)
{
- return sp_star_knot_click(item, state);
+ sp_star_knot_click(item, state);
}
void
StarKnotHolderEntity2::knot_click(guint state)
{
- return sp_star_knot_click(item, state);
+ sp_star_knot_click(item, state);
}
StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler) :
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 21a178b57..82af60fc2 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -435,7 +435,6 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id,
Inkscape::Drawing* drawing,
unsigned /*visionkey*/)
{
-
// Retrieve the symbol named 'symbol_id' from the source SVG document
SPObject const* symbol = source->getObjectById(symbol_id);
if (symbol == NULL) {
@@ -465,6 +464,8 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id,
style = source->getReprRoot()->attribute("style");
}
}
+ // Last ditch effort to provide some default styling
+ if( !style ) style = "fill:#bbbbbb;stroke:#808080";
// This is for display in Symbols dialog only
if( style ) {
@@ -498,15 +499,6 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id,
SPItem *item = SP_ITEM(object_temp);
- // Find object's bbox in document.
- // Note symbols can have own viewport... ignore for now.
- //Geom::OptRect dbox = item->geometricBounds();
- Geom::OptRect dbox = item->documentVisualBounds();
- // if (!dbox) {
- // //std::cout << " No dbox" << std::endl;
- // //return NULL;
- // }
-
Glib::ustring previewSizeString = previewSize->get_active_text();
unsigned psize = atol( previewSizeString.c_str() );
@@ -520,22 +512,40 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id,
//Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(svg_preview_cache.get_preview_from_cache(key));
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::RefPtr<Gdk::Pixbuf>(0);
+ // Find object's bbox in document.
+ // Note symbols can have own viewport... ignore for now.
+ //Geom::OptRect dbox = item->geometricBounds();
+ Geom::OptRect dbox = item->documentVisualBounds();
+ if (!dbox) {
+ //std::cout << " No dbox" << std::endl;
+ return pixbuf;
+ }
+
if (!pixbuf) {
/* Scale symbols to fit */
double scale = 1.0;
+ double width = dbox->width();
+ double height = dbox->height();
+ if( width == 0.0 ) {
+ width = 1.0;
+ }
+ if( height == 0.0 ) {
+ height = 1.0;
+ }
+
switch (previewScaleRow) {
case 0:
/* Fit */
- scale = psize/std::max(dbox->width(),dbox->height());
+ scale = psize/std::max(width,height);
break;
case 1:
/* Fit width */
- scale = psize/dbox->width();
+ scale = psize/width;
break;
case 2:
/* Fit height */
- scale = psize/dbox->height();
+ scale = psize/height;
break;
default:
scale = atof( previewScaleString.c_str() );
@@ -560,8 +570,7 @@ SPDocument* SymbolsDialog::symbols_preview_doc()
"<svg xmlns=\"http://www.w3.org/2000/svg\""
" xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\""
" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\""
-" xmlns:xlink=\"http://www.w3.org/1999/xlink\""
-" style=\"fill:none;stroke:black;stroke-width:2\">"
+" xmlns:xlink=\"http://www.w3.org/1999/xlink\">"
" <defs id=\"defs\">"
" <symbol id=\"the_symbol\"/>"
" </defs>"
@@ -582,10 +591,6 @@ void SymbolsDialog::setTargetDesktop(SPDesktop *desktop)
}
}
-
} //namespace Dialogs
} //namespace UI
} //namespace Inkscape
-
-
-
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index 0dac18665..0b280ccb9 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -17,6 +17,7 @@
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/sizegroup.h>
#include <gtkmm/scrollbar.h>
+#include <gtkmm/adjustment.h>
#define COLUMNS_FOR_SMALL 16
#define COLUMNS_FOR_LARGE 8
@@ -56,9 +57,30 @@ PreviewHolder::PreviewHolder() :
PreviewHolder::~PreviewHolder()
{
+
}
+bool PreviewHolder::on_scroll_event(GdkEventScroll *event)
+{
+ // Scroll horizontally by page on mouse wheel
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> adj = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hadjustment();
+#else
+ Gtk::Adjustment *adj = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hadjustment();
+#endif
+
+ if (!adj) {
+ return FALSE;
+ }
+
+ int move = (event->direction == GDK_SCROLL_DOWN) ? adj->get_page_size() : -adj->get_page_size();
+
+ double value = std::min(adj->get_upper() - move, adj->get_value() + move );
+ adj->set_value(value);
+
+ return FALSE;
+}
void PreviewHolder::clear()
{
diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h
index 8363498a6..4c591bfaf 100644
--- a/src/ui/previewholder.h
+++ b/src/ui/previewholder.h
@@ -46,6 +46,7 @@ public:
protected:
virtual void on_size_allocate( Gtk::Allocation& allocation );
+ virtual bool on_scroll_event(GdkEventScroll*);
// virtual void on_size_request( Gtk::Requisition* requisition );
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index bda410856..dc6e0fbae 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -293,7 +293,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event)
Geom::Point parent_pos = _parent->position();
Geom::Point origin = _last_drag_origin();
SnapManager &sm = _desktop->namedview->snap_manager;
- bool snap = sm.someSnapperMightSnap();
+ bool snap = held_shift(*event) ? false : sm.someSnapperMightSnap();
boost::optional<Inkscape::Snapper::SnapConstraint> ctrl_constraint;
// with Alt, preserve length
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index a7dabef1c..a38a93fb1 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -81,9 +81,15 @@ Dock::Dock(Gtk::Orientation orientation)
static_cast<GdlSwitcherStyle>(prefs->getIntLimited("/options/dock/switcherstyle",
GDL_SWITCHER_STYLE_BOTH, 0, 4));
- g_object_set (GDL_DOCK_OBJECT(_gdl_dock)->master,
- "switcher-style", gdl_switcher_style,
- NULL);
+ GdlDockMaster* master = NULL;
+
+ g_object_get(GDL_DOCK_OBJECT(_gdl_dock),
+ "master", &master,
+ NULL);
+
+ g_object_set(master,
+ "switcher-style", gdl_switcher_style,
+ NULL);
GdlDockBarStyle gdl_dock_bar_style =
static_cast<GdlDockBarStyle>(prefs->getIntLimited("/options/dock/dockbarstyle",
diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp
index 55bd28afe..4965f81c8 100644
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
@@ -346,7 +346,7 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_
// tree (and thus has no parent), default values will not be tested.
if( !strcmp( name, "style" ) && (flags >= SP_ATTR_CLEAN_STYLE_WARN) ) {
g_free( cleaned_value );
- cleaned_value = const_cast<char*>(sp_attribute_clean_style( this, value, flags ).c_str());
+ cleaned_value = g_strdup( sp_attribute_clean_style( this, value, flags ).c_str() );
// if( g_strcmp0( value, cleaned_value ) ) {
// g_warning( "SimpleNode::setAttribute: %s", id.c_str() );
// g_warning( " original: %s", value);