From: speleo3 Date: Wed, 13 May 2009 17:32:33 +0000 (+0000) Subject: new "compensate" param for sp_selection_apply_affine and sp_selection_move_relative... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=844f18b003d9a9581c92ef4668f62a1b0ac931c7;p=inkscape.git new "compensate" param for sp_selection_apply_affine and sp_selection_move_relative to avoid temporary prefs changing --- diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 9d60399fe..b452d9302 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1176,7 +1176,7 @@ value of set_i2d==false is only used by seltrans when it's dragging objects live that case, items are already in the new position, but the repr is in the old, and this function then simply updates the repr from item->transform. */ -void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix const &affine, bool set_i2d) +void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix const &affine, bool set_i2d, bool compensate) { if (selection->isEmpty()) return; @@ -1240,7 +1240,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons continue; for (SPObject *use = region->firstChild() ; use ; use = SP_OBJECT_NEXT(use)) { if (!SP_IS_USE(use)) continue; - sp_item_write_transform(SP_USE(use), SP_OBJECT_REPR(use), item->transform.inverse(), NULL); + sp_item_write_transform(SP_USE(use), SP_OBJECT_REPR(use), item->transform.inverse(), NULL, compensate); } } } else if (transform_clone_with_original) { @@ -1266,25 +1266,25 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons if (prefs_parallel) { Geom::Matrix move = result * clone_move * t_inv; - sp_item_write_transform(item, SP_OBJECT_REPR(item), move, &move); + sp_item_write_transform(item, SP_OBJECT_REPR(item), move, &move, compensate); } else if (prefs_unmoved) { //if (SP_IS_USE(sp_use_get_original(SP_USE(item)))) // clone_move = Geom::identity(); Geom::Matrix move = result * clone_move; - sp_item_write_transform(item, SP_OBJECT_REPR(item), move, &t); + sp_item_write_transform(item, SP_OBJECT_REPR(item), move, &t, compensate); } } else { // just apply the result - sp_item_write_transform(item, SP_OBJECT_REPR(item), result, &t); + sp_item_write_transform(item, SP_OBJECT_REPR(item), result, &t, compensate); } } else { if (set_i2d) { sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine); } - sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, NULL); + sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, NULL, compensate); } // if we're moving the actual object, not just updating the repr, we can transform the @@ -1384,9 +1384,9 @@ sp_selection_skew_relative(Inkscape::Selection *selection, Geom::Point const &al sp_selection_apply_affine(selection, final); } -void sp_selection_move_relative(Inkscape::Selection *selection, Geom::Point const &move) +void sp_selection_move_relative(Inkscape::Selection *selection, Geom::Point const &move, bool compensate) { - sp_selection_apply_affine(selection, Geom::Matrix(Geom::Translate(move))); + sp_selection_apply_affine(selection, Geom::Matrix(Geom::Translate(move)), true, compensate); } void sp_selection_move_relative(Inkscape::Selection *selection, double dx, double dy) diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 770f36853..67e772a00 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -75,13 +75,13 @@ void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool a void sp_selection_to_next_layer( SPDesktop *desktop, bool suppressDone = false ); void sp_selection_to_prev_layer( SPDesktop *desktop, bool suppressDone = false ); -void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix const &affine, bool set_i2d = true); +void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix const &affine, bool set_i2d = true, bool compensate = true); void sp_selection_remove_transform (SPDesktop *desktop); void sp_selection_scale_absolute (Inkscape::Selection *selection, double x0, double x1, double y0, double y1); void sp_selection_scale_relative(Inkscape::Selection *selection, Geom::Point const &align, Geom::Scale const &scale); void sp_selection_rotate_relative (Inkscape::Selection *selection, Geom::Point const ¢er, gdouble angle); void sp_selection_skew_relative (Inkscape::Selection *selection, Geom::Point const &align, double dx, double dy); -void sp_selection_move_relative (Inkscape::Selection *selection, Geom::Point const &move); +void sp_selection_move_relative (Inkscape::Selection *selection, Geom::Point const &move, bool compensate = true); void sp_selection_move_relative (Inkscape::Selection *selection, double dx, double dy); void sp_selection_rotate_90 (SPDesktop *desktop, bool ccw);