summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp15
-rw-r--r--src/document.cpp11
-rw-r--r--src/extension/internal/grid.cpp18
-rw-r--r--src/flood-context.cpp4
-rw-r--r--src/helper/pixbuf-ops.cpp2
-rw-r--r--src/helper/png-write.cpp21
-rw-r--r--src/knot-holder-entity.cpp129
-rw-r--r--src/select-context.cpp24
-rw-r--r--src/selection-chemistry.cpp14
-rw-r--r--src/seltrans-handles.cpp24
-rw-r--r--src/sp-item.cpp6
-rw-r--r--src/spray-context.cpp6
-rw-r--r--src/tweak-context.cpp8
-rw-r--r--src/ui/dialog/align-and-distribute.cpp12
-rw-r--r--src/ui/tool/control-point-selection.cpp8
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp6
-rw-r--r--src/ui/tool/path-manipulator.cpp2
-rw-r--r--src/ui/tool/transform-handle-set.cpp24
-rw-r--r--src/widgets/desktop-widget.cpp8
19 files changed, 146 insertions, 196 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 52f172577..1953ae2a6 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -158,7 +158,7 @@ SPDesktop::SPDesktop() :
_active( false ),
_w2d(),
_d2w(),
- _doc2dt( Geom::Scale(1, -1) ),
+ _doc2dt( Geom::identity() ),
grids_visible( false )
{
_d2w.setIdentity();
@@ -272,7 +272,6 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
/* Connect event for page resize */
- _doc2dt[5] = sp_document_height (document);
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt);
_modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this));
@@ -793,8 +792,8 @@ SPDesktop::set_display_area (double x0, double y0, double x1, double y1, double
int clear = FALSE;
if (!NR_DF_TEST_CLOSE (newscale, scale, 1e-4 * scale)) {
// zoom changed - set new zoom factors
- _d2w = Geom::Scale(newscale, -newscale);
- _w2d = Geom::Scale(1/newscale, 1/-newscale);
+ _d2w = Geom::Scale(newscale);
+ _w2d = Geom::Scale(1/newscale);
sp_canvas_item_affine_absolute(SP_CANVAS_ITEM(main), _d2w);
clear = TRUE;
signal_zoom_changed.emit(_d2w.descrim());
@@ -802,10 +801,10 @@ SPDesktop::set_display_area (double x0, double y0, double x1, double y1, double
/* Calculate top left corner (in document pixels) */
x0 = cx - 0.5 * viewbox.dimensions()[Geom::X] / newscale;
- y1 = cy + 0.5 * viewbox.dimensions()[Geom::Y] / newscale;
+ y0 = cy - 0.5 * viewbox.dimensions()[Geom::Y] / newscale;
/* Scroll */
- sp_canvas_scroll_to (canvas, x0 * newscale - border, y1 * -newscale - border, clear);
+ sp_canvas_scroll_to (canvas, x0 * newscale - border, y0 * newscale - border, clear);
/* update perspective lines if we are in the 3D box tool (so that infinite ones are shown correctly) */
sp_box3d_context_update_lines(event_context);
@@ -829,8 +828,7 @@ Geom::Rect SPDesktop::get_display_area() const
double const scale = _d2w[0];
- return Geom::Rect(Geom::Point(viewbox.min()[Geom::X] / scale, viewbox.max()[Geom::Y] / -scale),
- Geom::Point(viewbox.max()[Geom::X] / scale, viewbox.min()[Geom::Y] / -scale));
+ return viewbox * (1./scale);
}
/**
@@ -1545,7 +1543,6 @@ SPDesktop::onDocumentURISet (gchar const* uri)
void
SPDesktop::onDocumentResized (gdouble width, gdouble height)
{
- _doc2dt[5] = height;
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt);
Geom::Rect const a(Geom::Point(0, 0), Geom::Point(width, height));
SP_CTRLRECT(page)->setRectangle(a);
diff --git a/src/document.cpp b/src/document.cpp
index 101c54e30..f137ba60d 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -662,7 +662,6 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins)
double const w = rect.width();
double const h = rect.height();
- double const old_height = sp_document_height(this);
SPUnit const &px(sp_unit_get_by_id(SP_UNIT_PX));
/* in px */
@@ -696,16 +695,14 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins)
}
Geom::Rect const rect_with_margins(
- rect.min() - Geom::Point(margin_left, margin_bottom),
- rect.max() + Geom::Point(margin_right, margin_top));
+ rect.min() - Geom::Point(margin_left, margin_top),
+ rect.max() + Geom::Point(margin_right, margin_bottom));
sp_document_set_width(this, rect_with_margins.width(), &px);
sp_document_set_height(this, rect_with_margins.height(), &px);
- Geom::Translate const tr(
- Geom::Point(0, old_height - rect_with_margins.height())
- - to_2geom(rect_with_margins.min()));
+ Geom::Translate const tr(-to_2geom(rect_with_margins.min()));
SP_GROUP(root)->translateChildItems(tr);
if(nv) {
@@ -713,7 +710,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins)
nv->translateGuides(tr2);
// update the viewport so the drawing appears to stay where it was
- nv->scrollAllDesktops(-tr2[0], tr2[1], false);
+ nv->scrollAllDesktops(-tr2[0], -tr2[1], false);
}
}
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp
index d4b35b261..deef367a4 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -46,13 +46,12 @@ Grid::load (Inkscape::Extension::Extension */*module*/)
namespace {
-Glib::ustring build_lines(int axis, Geom::Rect bounding_area,
- float offset, float spacing)
+void build_lines(int axis, Geom::Rect bounding_area, float offset,
+ float spacing, SVG::PathString &path_data)
{
Geom::Point point_offset(0.0, 0.0);
point_offset[axis] = offset;
- SVG::PathString path_data;
for (Geom::Point start_point = bounding_area.min();
start_point[axis] + offset <= (bounding_area.max())[axis];
start_point[axis] += spacing) {
@@ -62,8 +61,6 @@ Glib::ustring build_lines(int axis, Geom::Rect bounding_area,
path_data.moveTo(start_point + point_offset)
.lineTo(end_point + point_offset);
}
-
- return path_data;
}
}
@@ -89,10 +86,8 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
if (bounds) {
bounding_area = *bounds;
}
-
- gdouble doc_height = sp_document_height(document->doc());
- Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]),
- Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y]));
+ Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], bounding_area.min()[Geom::Y]),
+ Geom::Point(bounding_area.max()[Geom::X], bounding_area.max()[Geom::Y]));
bounding_area = temprec;
}
@@ -103,10 +98,9 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
float offsets[2] = { module->get_param_float("xoffset"),
module->get_param_float("yoffset") };
- Glib::ustring path_data("");
+ SVG::PathString path_data;
for ( int axis = 0 ; axis < 2 ; ++axis ) {
- path_data += build_lines(axis, bounding_area,
- offsets[axis], spacings[axis]);
+ build_lines(axis, bounding_area, offsets[axis], spacings[axis], path_data);
}
Inkscape::XML::Document * xml_doc = sp_document_repr_doc(document->doc());
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index 612ae1cfc..910b5dd80 100644
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -798,7 +798,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
unsigned int height = (int)ceil(screen.height() * zoom_scale * padding);
Geom::Point origin(screen.min()[Geom::X],
- sp_document_height(document) - screen.height() - screen.min()[Geom::Y]);
+ screen.min()[Geom::Y]);
origin[Geom::X] = origin[Geom::X] + (screen.width() * ((1 - padding) / 2));
origin[Geom::Y] = origin[Geom::Y] + (screen.height() * ((1 - padding) / 2));
@@ -905,7 +905,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
}
for (unsigned int i = 0; i < fill_points.size(); i++) {
- Geom::Point pw = Geom::Point(fill_points[i][Geom::X] / zoom_scale, sp_document_height(document) + (fill_points[i][Geom::Y] / zoom_scale)) * affine;
+ Geom::Point pw = Geom::Point(fill_points[i][Geom::X] / zoom_scale, (fill_points[i][Geom::Y] / zoom_scale)) * affine;
pw[Geom::X] = (int)MIN(width - 1, MAX(0, pw[Geom::X]));
pw[Geom::Y] = (int)MIN(height - 1, MAX(0, pw[Geom::Y]));
diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp
index 3be63aa68..c26d55b8b 100644
--- a/src/helper/pixbuf-ops.cpp
+++ b/src/helper/pixbuf-ops.cpp
@@ -113,7 +113,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
double padding = 1.0;
Geom::Point origin(screen.min()[Geom::X],
- sp_document_height(doc) - screen[Geom::Y].extent() - screen.min()[Geom::Y]);
+ screen.min()[Geom::Y]);
origin[Geom::X] = origin[Geom::X] + (screen[Geom::X].extent() * ((1 - padding) / 2));
origin[Geom::Y] = origin[Geom::Y] + (screen[Geom::Y].extent() * ((1 - padding) / 2));
diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp
index b1c135db0..8eb9e27bf 100644
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
@@ -424,24 +424,9 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
sp_document_ensure_up_to_date(doc);
- /* Calculate translation by transforming to document coordinates (flipping Y)*/
- Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - sp_document_height(doc));
-
- /* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2)
- * 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0
- * 2) a[1] * x0 + a[3] * y1 + a[5] = 0.0
- * 3) a[0] * x1 + a[2] * y1 + a[4] = width
- * 4) a[1] * x0 + a[3] * y0 + a[5] = height
- * 5) a[1] = 0.0;
- * 6) a[2] = 0.0;
- *
- * (1,3) a[0] * x1 - a[0] * x0 = width
- * a[0] = width / (x1 - x0)
- * (2,4) a[3] * y0 - a[3] * y1 = height
- * a[3] = height / (y0 - y1)
- * (1) a[4] = -a[0] * x0
- * (2) a[5] = -a[3] * y1
- */
+ /* Calculate translation */
+ Geom::Point translation = Geom::Point(-area[Geom::X][0], -area[Geom::Y][0]);
+
Geom::Matrix const affine(Geom::Translate(translation)
* Geom::Scale(width / area.width(),
diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp
index 2d0d5eb02..6fcb26247 100644
--- a/src/knot-holder-entity.cpp
+++ b/src/knot-holder-entity.cpp
@@ -135,21 +135,16 @@ KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape:
/* TODO: this pattern manipulation is not able to handle general transformation matrices. Only matrices that are the result of a pure scale times a pure rotation. */
-static gdouble sp_pattern_extract_theta(SPPattern *pat)
+Geom::Point
+PatternKnotHolderEntityXY::knot_get()
{
- Geom::Matrix transf = pat->patternTransform;
- return Geom::atan2(transf.xAxis());
-}
+ SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
-static Geom::Point sp_pattern_extract_scale(SPPattern *pat)
-{
- Geom::Matrix transf = pat->patternTransform;
- return Geom::Point( transf.expansionX(), transf.expansionY() );
-}
+ gdouble x = 0;
+ gdouble y = -pattern_height(pat);
-static Geom::Point sp_pattern_extract_trans(SPPattern const *pat)
-{
- return Geom::Point(pat->patternTransform[4], pat->patternTransform[5]);
+ Geom::Point delta = Geom::Point(x,y) * pat->patternTransform;
+ return delta;
}
void
@@ -169,7 +164,8 @@ PatternKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &ori
}
if (state) {
- Geom::Point const q = p_snapped - sp_pattern_extract_trans(pat);
+ Geom::Point knot_relpos(0, -pattern_height(pat));
+ Geom::Point const q = p_snapped - (knot_relpos * pat->patternTransform);
sp_item_adjust_pattern(item, Geom::Matrix(Geom::Translate(q)));
}
@@ -177,24 +173,14 @@ PatternKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &ori
}
Geom::Point
-PatternKnotHolderEntityXY::knot_get()
-{
- SPPattern const *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
- return sp_pattern_extract_trans(pat);
-}
-
-Geom::Point
PatternKnotHolderEntityAngle::knot_get()
{
SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
- gdouble x = (pattern_width(pat));
- gdouble y = 0;
- Geom::Point delta = Geom::Point(x,y);
- Geom::Point scale = sp_pattern_extract_scale(pat);
- gdouble theta = sp_pattern_extract_theta(pat);
- delta = delta * Geom::Matrix(Geom::Scale(scale))*Geom::Matrix(Geom::Rotate(theta));
- delta = delta + sp_pattern_extract_trans(pat);
+ gdouble x = pattern_width(pat);
+ gdouble y = -pattern_height(pat);
+
+ Geom::Point delta = Geom::Point(x,y) * pat->patternTransform;
return delta;
}
@@ -206,24 +192,38 @@ PatternKnotHolderEntityAngle::knot_set(Geom::Point const &p, Geom::Point const &
SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
- // get the angle from pattern 0,0 to the cursor pos
- Geom::Point delta = p - sp_pattern_extract_trans(pat);
- gdouble theta = atan2(delta);
+ // rotate pattern around XY knot position
+ Geom::Point knot_relpos(pattern_width(pat), -pattern_height(pat));
+ Geom::Point xy_knot_relpos(0, -pattern_height(pat));
+ Geom::Point transform_origin = xy_knot_relpos * pat->patternTransform;
+
+ Geom::Point oldp = (knot_relpos * pat->patternTransform) - transform_origin;
+ Geom::Point newp = p - transform_origin;
+
+ gdouble theta = Geom::angle_between(oldp, newp);
if ( state & GDK_CONTROL_MASK ) {
theta = sp_round(theta, M_PI/snaps);
}
- // get the scale from the current transform so we can keep it.
- Geom::Point scl = sp_pattern_extract_scale(pat);
- Geom::Matrix rot = Geom::Matrix(Geom::Scale(scl)) * Geom::Matrix(Geom::Rotate(theta));
- Geom::Point const t = sp_pattern_extract_trans(pat);
- rot[4] = t[Geom::X];
- rot[5] = t[Geom::Y];
- sp_item_adjust_pattern(item, rot, true);
+ Geom::Matrix rot = Geom::Matrix(Geom::Translate(-transform_origin))
+ * Geom::Rotate(theta)
+ * Geom::Translate(transform_origin);
+ sp_item_adjust_pattern(item, rot);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
+Geom::Point
+PatternKnotHolderEntityScale::knot_get()
+{
+ SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
+
+ gdouble x = pattern_width(pat);
+ gdouble y = 0;
+ Geom::Point delta = Geom::Point(x,y) * pat->patternTransform;
+ return delta;
+}
+
void
PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
@@ -232,49 +232,32 @@ PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &
// 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);
- // get angle from current transform
- gdouble theta = sp_pattern_extract_theta(pat);
+ Geom::Point knot_relpos(pattern_width(pat), 0);
+ Geom::Point xy_knot_relpos(0, -pattern_height(pat));
+ Geom::Point transform_origin = xy_knot_relpos * pat->patternTransform;
- // Get the new scale from the position of the knotholder
- Geom::Point d = p_snapped - sp_pattern_extract_trans(pat);
- gdouble pat_x = pattern_width(pat);
- gdouble pat_y = pattern_height(pat);
- Geom::Scale scl(1);
- if ( state & GDK_CONTROL_MASK ) {
- // if ctrl is pressed: use 1:1 scaling
- gdouble pat_h = hypot(pat_x, pat_y);
- scl = Geom::Scale(d.length() / pat_h);
+ // do the scaling in pattern coordinate space
+ Geom::Point oldp = knot_relpos - xy_knot_relpos;
+ Geom::Point newp = p_snapped * pat->patternTransform.inverse() - xy_knot_relpos;
+
+ if (Geom::are_near(newp.length(), 0)) return;
+
+ Geom::Scale s(1);
+ if (state & GDK_CONTROL_MASK) {
+ // uniform scaling
+ s = Geom::Scale(oldp * (newp.length() * oldp.length()));
} else {
- d *= Geom::Rotate(-theta);
- scl = Geom::Scale(d[Geom::X] / pat_x, d[Geom::Y] / pat_y);
+ s = Geom::Scale(newp[Geom::X] / oldp[Geom::X], newp[Geom::Y] / oldp[Geom::Y]);
}
- Geom::Matrix rot = (Geom::Matrix)scl * Geom::Rotate(theta);
-
- Geom::Point const t = sp_pattern_extract_trans(pat);
- rot[4] = t[Geom::X];
- rot[5] = t[Geom::Y];
- sp_item_adjust_pattern(item, rot, true);
+ Geom::Matrix scl = Geom::Matrix(Geom::Translate(-xy_knot_relpos))
+ * s
+ * Geom::Translate(xy_knot_relpos)
+ * pat->patternTransform;
+ sp_item_adjust_pattern(item, scl, true);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
-
-Geom::Point
-PatternKnotHolderEntityScale::knot_get()
-{
- SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
-
- gdouble x = pattern_width(pat);
- gdouble y = pattern_height(pat);
- Geom::Point delta = Geom::Point(x,y);
- Geom::Matrix a = pat->patternTransform;
- a[4] = 0;
- a[5] = 0;
- delta = delta * a;
- delta = delta + sp_pattern_extract_trans(pat);
- return delta;
-}
-
/*
Local Variables:
mode:c++
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 028c8634b..9035021d6 100644
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
@@ -765,12 +765,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__ALT) { // alt
- if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*10); // shift
- else sp_selection_move_screen(desktop, 0, mul*1); // no shift
+ if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*-10); // shift
+ else sp_selection_move_screen(desktop, 0, mul*-1); // no shift
}
else { // no alt
- if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*10*nudge); // shift
- else sp_selection_move(desktop, 0, mul*nudge); // no shift
+ if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*-10*nudge); // shift
+ else sp_selection_move(desktop, 0, mul*-nudge); // no shift
}
ret = TRUE;
}
@@ -799,12 +799,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__ALT) { // alt
- if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*-10); // shift
- else sp_selection_move_screen(desktop, 0, mul*-1); // no shift
+ if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*10); // shift
+ else sp_selection_move_screen(desktop, 0, mul*1); // no shift
}
else { // no alt
- if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*-10*nudge); // shift
- else sp_selection_move(desktop, 0, mul*-nudge); // no shift
+ if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*10*nudge); // shift
+ else sp_selection_move(desktop, 0, mul*nudge); // no shift
}
ret = TRUE;
}
@@ -842,9 +842,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
get_group0_keyval(&event->key), 0); // with any mask
sp_selection_rotate_screen(selection, mul*1);
} else if (MOD__CTRL) {
- sp_selection_rotate(selection, 90);
+ sp_selection_rotate(selection, -90);
} else if (snaps) {
- sp_selection_rotate(selection, 180/snaps);
+ sp_selection_rotate(selection, -180/snaps);
}
ret = TRUE;
break;
@@ -854,9 +854,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
get_group0_keyval(&event->key), 0); // with any mask
sp_selection_rotate_screen(selection, -1*mul);
} else if (MOD__CTRL) {
- sp_selection_rotate(selection, -90);
+ sp_selection_rotate(selection, 90);
} else if (snaps) {
- sp_selection_rotate(selection, -180/snaps);
+ sp_selection_rotate(selection, 180/snaps);
}
ret = TRUE;
break;
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 730467ee5..452a4ff9d 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2273,9 +2273,8 @@ void sp_selection_to_marker(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)) - *c;
- move_p[Geom::Y] = -move_p[Geom::Y];
- Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p));
+ Geom::Point move_p = -*c;
+ Geom::Matrix move = Geom::Translate(move_p);
GSList *items = g_slist_copy((GSList *) selection->itemList());
@@ -2396,8 +2395,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()[Geom::Y]));
- move_p[Geom::Y] = -move_p[Geom::Y];
+ Geom::Point move_p = -(r->min() + Geom::Point(0, r->dimensions()[Geom::Y]));
Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p));
GSList *items = g_slist_copy((GSList *) selection->itemList());
@@ -2748,12 +2746,12 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop)
Geom::Matrix t;
double shift_x = bbox.x0;
- double shift_y = bbox.y1;
+ double shift_y = bbox.y0;
if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid
shift_x = round(shift_x);
- shift_y = -round(-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone
+ shift_y = round(shift_y);
}
- t = Geom::Scale(1, -1) * Geom::Translate(shift_x, shift_y) * eek.inverse();
+ t = Geom::Translate(shift_x, shift_y) * eek.inverse();
// Do the export
sp_export_png_file(document, filepath,
diff --git a/src/seltrans-handles.cpp b/src/seltrans-handles.cpp
index 95b680c5e..ba18b2a5b 100644
--- a/src/seltrans-handles.cpp
+++ b/src/seltrans-handles.cpp
@@ -5,24 +5,24 @@
SPSelTransHandle const handles_scale[] = {
//anchor cursor control action request x y
- {GTK_ANCHOR_SE, GDK_TOP_LEFT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 1},
- {GTK_ANCHOR_S, GDK_TOP_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 1},
- {GTK_ANCHOR_SW, GDK_TOP_RIGHT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 1},
+ {GTK_ANCHOR_NE, GDK_TOP_LEFT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 1},
+ {GTK_ANCHOR_N, GDK_TOP_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 1},
+ {GTK_ANCHOR_NW, GDK_TOP_RIGHT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 1},
{GTK_ANCHOR_W, GDK_RIGHT_SIDE, 2, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 1, 0.5},
- {GTK_ANCHOR_NW, GDK_BOTTOM_RIGHT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 0},
- {GTK_ANCHOR_N, GDK_BOTTOM_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 0},
- {GTK_ANCHOR_NE, GDK_BOTTOM_LEFT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 0},
+ {GTK_ANCHOR_SW, GDK_BOTTOM_RIGHT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 0},
+ {GTK_ANCHOR_S, GDK_BOTTOM_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 0},
+ {GTK_ANCHOR_SE, GDK_BOTTOM_LEFT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 0},
{GTK_ANCHOR_E, GDK_LEFT_SIDE, 2, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0, 0.5}
};
SPSelTransHandle const handles_rotate[] = {
- {GTK_ANCHOR_SE, GDK_EXCHANGE, 4, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 1},
- {GTK_ANCHOR_S, GDK_SB_H_DOUBLE_ARROW, 5, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 1},
- {GTK_ANCHOR_SW, GDK_EXCHANGE, 6, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 1},
+ {GTK_ANCHOR_NE, GDK_EXCHANGE, 10, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 1},
+ {GTK_ANCHOR_N, GDK_SB_H_DOUBLE_ARROW, 5, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 1},
+ {GTK_ANCHOR_NW, GDK_EXCHANGE, 8, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 1},
{GTK_ANCHOR_W, GDK_SB_V_DOUBLE_ARROW, 7, sp_sel_trans_skew, sp_sel_trans_skew_request, 1, 0.5},
- {GTK_ANCHOR_NW, GDK_EXCHANGE, 8, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 0},
- {GTK_ANCHOR_N, GDK_SB_H_DOUBLE_ARROW, 9, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 0},
- {GTK_ANCHOR_NE, GDK_EXCHANGE, 10, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 0},
+ {GTK_ANCHOR_SW, GDK_EXCHANGE, 6, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 0},
+ {GTK_ANCHOR_S, GDK_SB_H_DOUBLE_ARROW, 9, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 0},
+ {GTK_ANCHOR_SE, GDK_EXCHANGE, 4, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 0},
{GTK_ANCHOR_E, GDK_SB_V_DOUBLE_ARROW, 11, sp_sel_trans_skew, sp_sel_trans_skew_request, 0, 0.5}
};
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index c4411e47d..f60a2b27a 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -1574,8 +1574,7 @@ Geom::Matrix sp_item_i2d_affine(SPItem const *item)
g_assert(SP_IS_ITEM(item));
Geom::Matrix const ret( sp_item_i2doc_affine(item)
- * Geom::Scale(1, -1)
- * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) );
+ );
return ret;
}
@@ -1588,8 +1587,7 @@ void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &i2dt)
if (SP_OBJECT_PARENT(item)) {
dt2p = sp_item_i2d_affine((SPItem *) SP_OBJECT_PARENT(item)).inverse();
} else {
- dt2p = ( Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item)))
- * Geom::Scale(1, -1) );
+ dt2p = ( Geom::identity() );
}
Geom::Matrix const i2p( i2dt * dt2p );
diff --git a/src/spray-context.cpp b/src/spray-context.cpp
index 2bdac197f..9b9caee15 100644
--- a/src/spray-context.cpp
+++ b/src/spray-context.cpp
@@ -501,7 +501,7 @@ bool sp_spray_recursive(SPDesktop *desktop,
sp_spray_rotate_rel(center,desktop,item_copied, Geom::Rotate(angle));
//Move the cursor p
Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio),-sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint());
- sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y]));
+ sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], move[Geom::Y]));
did = true;
}
}
@@ -556,7 +556,7 @@ bool sp_spray_recursive(SPDesktop *desktop,
sp_spray_scale_rel(center,desktop,item_copied, Geom::Scale(_scale,_scale));
sp_spray_scale_rel(center,desktop,item_copied, Geom::Scale(scale,scale));
sp_spray_rotate_rel(center,desktop,item_copied, Geom::Rotate(angle));
- sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y]));
+ sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], move[Geom::Y]));
// union and duplication
selection->clear();
@@ -593,7 +593,7 @@ bool sp_spray_recursive(SPDesktop *desktop,
sp_spray_scale_rel(center,desktop,item_copied, Geom::Scale(scale,scale));
sp_spray_rotate_rel(center,desktop,item_copied, Geom::Rotate(angle));
Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio),-sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint());
- sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y]));
+ sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], move[Geom::Y]));
Inkscape::GC::release(clone);
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index 13299b5a4..a34a61f53 100644
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -448,7 +448,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
if (a->contains(p)) x = 0;
if (x < 1) {
Geom::Point move = force * 0.5 * (cos(M_PI * x) + 1) * vector;
- sp_item_move_rel(item, Geom::Translate(move[Geom::X], -move[Geom::Y]));
+ sp_item_move_rel(item, Geom::Translate(move[Geom::X], move[Geom::Y]));
did = true;
}
}
@@ -462,7 +462,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
if (x < 1) {
Geom::Point move = force * 0.5 * (cos(M_PI * x) + 1) *
(reverse? (a->midpoint() - p) : (p - a->midpoint()));
- sp_item_move_rel(item, Geom::Translate(move[Geom::X], -move[Geom::Y]));
+ sp_item_move_rel(item, Geom::Translate(move[Geom::X], move[Geom::Y]));
did = true;
}
}
@@ -477,7 +477,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
if (a->contains(p)) x = 0;
if (x < 1) {
Geom::Point move = force * 0.5 * (cos(M_PI * x) + 1) * Geom::Point(cos(dp)*dr, sin(dp)*dr);
- sp_item_move_rel(item, Geom::Translate(move[Geom::X], -move[Geom::Y]));
+ sp_item_move_rel(item, Geom::Translate(move[Geom::X], move[Geom::Y]));
did = true;
}
}
@@ -502,7 +502,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
double x = Geom::L2(a->midpoint() - p)/radius;
if (a->contains(p)) x = 0;
if (x < 1) {
- double angle = (reverse? force : -force) * 0.05 * (cos(M_PI * x) + 1) * M_PI;
+ double angle = (reverse? -force : force) * 0.05 * (cos(M_PI * x) + 1) * M_PI;
sp_item_rotate_rel(item, Geom::Rotate(angle));
did = true;
}
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index a75a8d68d..f27c49f61 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -252,11 +252,11 @@ ActionAlign::Coeffs const ActionAlign::_allCoeffs[10] = {
{.5, .5, 0., 0., .5, .5, 0., 0.},
{0., 1., 0., 0., 0., 1., 0., 0.},
{0., 1., 0., 0., 1., 0., 0., 0.},
- {0., 0., 0., 1., 0., 0., 1., 0.},
- {0., 0., 0., 1., 0., 0., 0., 1.},
- {0., 0., .5, .5, 0., 0., .5, .5},
+ {0., 0., 1., 0., 0., 0., 0., 1.},
{0., 0., 1., 0., 0., 0., 1., 0.},
- {0., 0., 1., 0., 0., 0., 0., 1.}
+ {0., 0., .5, .5, 0., 0., .5, .5},
+ {0., 0., 0., 1., 0., 0., 0., 1.},
+ {0., 0., 0., 1., 0., 0., 1., 0.}
};
BBoxSort::BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd) :
@@ -866,13 +866,13 @@ AlignAndDistribute::AlignAndDistribute()
addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_TOP,
_("Distribute top edges equidistantly"),
- 1, 1, false, Geom::Y, 0, 1);
+ 1, 1, false, Geom::Y, 1., 0.);
addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_CENTER,
_("Distribute centers equidistantly vertically"),
1, 2, false, Geom::Y, .5, .5);
addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_BOTTOM,
_("Distribute bottom edges equidistantly"),
- 1, 3, false, Geom::Y, 1., 0.);
+ 1, 3, false, Geom::Y, 0., 1.);
//Baseline distribs
addBaselineButton(INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_BASELINE,
diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp
index f880d2ddf..c7fc8a3cc 100644
--- a/src/ui/tool/control-point-selection.cpp
+++ b/src/ui/tool/control-point-selection.cpp
@@ -545,11 +545,11 @@ bool ControlPointSelection::event(GdkEvent *event)
case GDK_Up:
case GDK_KP_Up:
case GDK_KP_8:
- return _keyboardMove(event->key, Geom::Point(0, 1));
+ return _keyboardMove(event->key, Geom::Point(0, -1));
case GDK_Down:
case GDK_KP_Down:
case GDK_KP_2:
- return _keyboardMove(event->key, Geom::Point(0, -1));
+ return _keyboardMove(event->key, Geom::Point(0, 1));
case GDK_Right:
case GDK_KP_Right:
case GDK_KP_6:
@@ -561,9 +561,9 @@ bool ControlPointSelection::event(GdkEvent *event)
// rotates
case GDK_bracketleft:
- return _keyboardRotate(event->key, 1);
- case GDK_bracketright:
return _keyboardRotate(event->key, -1);
+ case GDK_bracketright:
+ return _keyboardRotate(event->key, 1);
// scaling
case GDK_less:
diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp
index 2025a12d7..392518207 100644
--- a/src/ui/tool/multi-path-manipulator.cpp
+++ b/src/ui/tool/multi-path-manipulator.cpp
@@ -470,12 +470,10 @@ bool MultiPathManipulator::event(GdkEvent *event)
// single handle functions
// rotation
case GDK_bracketleft:
- case GDK_braceleft:
- pm.rotateHandle(n, which, 1, one_pixel);
+ pm.rotateHandle(n, which, -1, one_pixel);
break;
case GDK_bracketright:
- case GDK_braceright:
- pm.rotateHandle(n, which, -1, one_pixel);
+ pm.rotateHandle(n, which, 1, one_pixel);
break;
// adjust length
case GDK_period:
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 66f72f379..a50be873a 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -1193,7 +1193,7 @@ void PathManipulator::_updateOutline()
Geom::Point at = j->pointAt(0.5);
Geom::Point ut = j->unitTangentAt(0.5);
// rotate the point
- ut *= Geom::Rotate(150.0 / 180.0 * M_PI);
+ ut *= Geom::Rotate(210.0 / 180.0 * M_PI);
Geom::Point arrow_end = _desktop->w2d(
_desktop->d2w(at) + Geom::unit_vector(_desktop->d2w(ut)) * 10.0);
diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp
index 1af848b96..4cbc5ed4d 100644
--- a/src/ui/tool/transform-handle-set.cpp
+++ b/src/ui/tool/transform-handle-set.cpp
@@ -34,17 +34,17 @@ namespace UI {
namespace {
Gtk::AnchorType corner_to_anchor(unsigned c) {
switch (c % 4) {
- case 0: return Gtk::ANCHOR_NE;
- case 1: return Gtk::ANCHOR_NW;
- case 2: return Gtk::ANCHOR_SW;
- default: return Gtk::ANCHOR_SE;
+ case 0: return Gtk::ANCHOR_SE;
+ case 1: return Gtk::ANCHOR_SW;
+ case 2: return Gtk::ANCHOR_NW;
+ default: return Gtk::ANCHOR_NE;
}
}
Gtk::AnchorType side_to_anchor(unsigned s) {
switch (s % 4) {
- case 0: return Gtk::ANCHOR_N;
+ case 0: return Gtk::ANCHOR_S;
case 1: return Gtk::ANCHOR_W;
- case 2: return Gtk::ANCHOR_S;
+ case 2: return Gtk::ANCHOR_N;
default: return Gtk::ANCHOR_E;
}
}
@@ -208,8 +208,8 @@ private:
static Glib::RefPtr<Gdk::Pixbuf> _corner_to_pixbuf(unsigned c) {
sp_select_context_get_type();
switch (c % 2) {
- case 0: return Glib::wrap(handles[1], true);
- default: return Glib::wrap(handles[0], true);
+ case 0: return Glib::wrap(handles[0], true);
+ default: return Glib::wrap(handles[1], true);
}
}
Geom::Point _sc_center;
@@ -332,10 +332,10 @@ private:
static Glib::RefPtr<Gdk::Pixbuf> _corner_to_pixbuf(unsigned c) {
sp_select_context_get_type();
switch (c % 4) {
- case 0: return Glib::wrap(handles[10], true);
- case 1: return Glib::wrap(handles[8], true);
- case 2: return Glib::wrap(handles[6], true);
- default: return Glib::wrap(handles[4], true);
+ case 0: return Glib::wrap(handles[4], true);
+ case 1: return Glib::wrap(handles[6], true);
+ case 2: return Glib::wrap(handles[8], true);
+ default: return Glib::wrap(handles[10], true);
}
}
Geom::Point _rot_center;
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index ab440595f..48317aa3e 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -1493,8 +1493,8 @@ sp_desktop_widget_update_vruler (SPDesktopWidget *dtw)
NR::IRect viewbox = dtw->canvas->getViewboxIntegers();
double const scale = dtw->desktop->current_zoom();
- double s = viewbox.min()[Geom::Y] / -scale - dtw->ruler_origin[Geom::Y];
- double e = viewbox.max()[Geom::Y] / -scale - dtw->ruler_origin[Geom::Y];
+ double s = viewbox.min()[Geom::Y] / scale - dtw->ruler_origin[Geom::Y];
+ double e = viewbox.max()[Geom::Y] / scale - dtw->ruler_origin[Geom::Y];
gtk_ruler_set_range(GTK_RULER(dtw->vruler), s, e, GTK_RULER(dtw->vruler)->position, (e - s));
}
@@ -1809,8 +1809,8 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale)
Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item));
/* Canvas region we always show unconditionally */
- Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64),
- Geom::Point(deskarea->max()[Geom::X] * scale + 64, deskarea->min()[Geom::Y] * -scale + 64) );
+ Geom::Rect carea( Geom::Point(deskarea->left() * scale - 64, deskarea->top() * scale - 64),
+ Geom::Point(deskarea->right() * scale + 64, deskarea->bottom() * scale + 64) );
Geom::Rect viewbox = dtw->canvas->getViewbox();