seltrans.cpp revision a03892eb86a8e456dc27d653df8e897dbc89ff18
/** @file
* Helper object for transforming selected items.
*/
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Carl Hetherington <inkscape@carlh.net>
* Diederik van Lierop <mail@diedenrezi.nl>
* Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 1999-2014 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <cstring>
#include <string>
#include <gdk/gdkkeysyms.h>
#include "document.h"
#include "document-undo.h"
#include "sp-namedview.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "desktop-style.h"
#include "knot.h"
#include "message-stack.h"
#include "snap.h"
#include "selection.h"
#include "ui/tools/select-tool.h"
#include "sp-item.h"
#include "sp-item-transform.h"
#include "sp-root.h"
#include "seltrans-handles.h"
#include "seltrans.h"
#include "selection-chemistry.h"
#include "verbs.h"
#include "display/sp-ctrlline.h"
#include "display/sodipodi-ctrl.h"
#include "preferences.h"
#include "mod360.h"
#include "display/snap-indicator.h"
#include "ui/control-manager.h"
#include "seltrans-handles.h"
using Inkscape::ControlManager;
using Inkscape::DocumentUndo;
static void sp_sel_trans_handle_new_event(SPKnot *knot, Geom::Point const &position, guint32 state, SPSelTransHandle const* data);
static gboolean sp_sel_trans_handle_request(SPKnot *knot, Geom::Point *p, guint state, SPSelTransHandle const *data);
{
case GDK_MOTION_NOTIFY:
break;
case GDK_KEY_PRESS:
/* stamping mode: both mode(show content and outline) operation with knot */
if (!SP_KNOT_IS_GRABBED(knot)) {
return FALSE;
}
return TRUE;
}
break;
default:
break;
}
return FALSE;
}
Observer("/tools/bounding_box"),
{
}
{
}
_grabbed(false),
_show_handles(true),
_bbox(),
_visual_bbox(),
_bounding_box_prefs_observer(*this)
{
_center_is_set = false; // reread _center from items, or set to bbox midpoint
_makeHandles();
"anchor", SP_ANCHOR_CENTER,
"mode", SP_CTRL_MODE_COLOR,
"shape", SP_CTRL_SHAPE_BITMAP,
"size", 13.0,
"filled", TRUE,
"fill_color", 0x00000000,
"stroked", TRUE,
"stroke_color", 0x000000a0,
NULL);
"anchor", SP_ANCHOR_CENTER,
"mode", SP_CTRL_MODE_XOR,
"shape", SP_CTRL_SHAPE_CROSS,
"size", 7.0,
"filled", TRUE,
"fill_color", 0xffffff7f,
"stroked", TRUE,
"stroke_color", 0xffffffff,
NULL);
for (int i = 0; i < 4; i++) {
sp_canvas_item_hide(_l[i]);
}
);
);
}
{
for (int i = 0; i < NUMHANDS; i++) {
knot_unref(knots[i]);
}
if (_norm) {
}
if (_grip) {
}
for (int i = 0; i < 4; i++) {
if (_l[i]) {
sp_canvas_item_destroy(_l[i]);
}
}
}
}
{
}
{
if (_state == STATE_SCALE) {
} else {
}
_center_is_set = true; // no need to reread center
}
{
_center = p;
_center_is_set = true;
// Write the new center position into all selected items
// only set the value; updating repr and document_done will be done once, on ungrab
}
}
void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles, bool translating)
{
// While dragging a handle, we will either scale, skew, or rotate and the "translating" parameter will be false
// When dragging the selected item itself however, we will translate the selection and that parameter will be true
_grabbed = true;
_changed = false;
if (_empty) {
return;
}
_items_centers.push_back(it->getCenter()); // for content-dragging, we need to remember original centers
}
_handle_x = x;
_handle_y = y;
// The selector tool should snap the bbox, special snappoints, and path nodes
// (The special points are the handles, center, rotation axis, font baseline, ends of spiral, etc.)
// First, determine the bounding box
_point = p;
if (_geometric_bbox) {
} else {
_point_geom = p;
}
// Next, get all points to consider for snapping
if (m.someSnapperMightSnap(false)) { // Only search for snap sources when really needed, to avoid unnecessary delays
}
/* Snapping a huge number of nodes will take way too long, so limit the number of snappable nodes
A typical user would rarely ever try to snap such a large number of nodes anyway, because
(s)he would hardly be able to discern which node would be snapping */
// Unfortunately, by now we will have lost the font-baseline snappoints :-(
}
// Find bbox hulling all special points, which excludes stroke width. Here we need to include the
// path nodes, for example because a rectangle which has been converted to a path doesn't have
// any other special points
// Collect the bounding box's corners and midpoints for each selected item
// Preferably we'd use the bbox of each selected item, but for example 50 items will produce at least 200 bbox points,
// which might make Inkscape crawl(see the comment a few lines above). In that case we will use the bbox of the selection as a whole
// Get the bounding box points for each item in the selection
}
} else {
// Only get the bounding box points of the selection as a whole
}
}
if (_bbox) {
// There are two separate "opposites" (i.e. opposite w.r.t. the handle being dragged):
// - one for snapping the boundingbox, which can be either visual or geometric
// - one for snapping the special points
// The "opposite" in case of a geometric boundingbox always coincides with the "opposite" for the special points
// These distinct "opposites" are needed in the snapmanager to avoid bugs such as LP167905 (in which
// a box is caught between two guides)
if (snap_points_bbox) {
_opposite_for_specpoints = (*snap_points_bbox).min() + (*snap_points_bbox).dimensions() * Geom::Scale(1-x, 1-y);
} else {
}
}
// When snapping the node closest to the mouse pointer is absolutely preferred over the closest snap
// (i.e. when weight == 1), then we will not even try to snap to other points and disregard those other points
}
if ((x != -1) && (y != -1)) {
}
if (_show == SHOW_OUTLINE) {
for (int i = 0; i < 4; i++)
sp_canvas_item_show(_l[i]);
}
}
{
if (_show == SHOW_CONTENT) {
// update the content
if( SP_IS_ROOT(&item) ) {
break;
}
// The new affine will only have been applied if the transformation is different from the previous one, see SPItem::set_item_transform
}
} else {
if (_bbox) {
/* update the outline */
for (unsigned i = 0 ; i < 4 ; i++) {
}
for (unsigned i = 0 ; i < 4 ; i++) {
}
}
}
_changed = true;
}
{
_grabbed = false;
_show_handles = true;
}
if (_show == SHOW_OUTLINE) {
for (int i = 0; i < 4; i++)
sp_canvas_item_hide(_l[i]);
}
if (_stamp_cache) {
_stamp_cache = NULL;
}
// when trying to stretch a perfectly vertical line in horizontal direction, which will not be allowed by the handles;
sp_selection_apply_affine(selection, _current_relative_affine, (_show == SHOW_OUTLINE)? true : false);
if (_center) {
_center_is_set = true;
}
// If dragging showed content live, sp_selection_apply_affine cannot change the centers
// appropriately - it does not know the original positions of the centers (all objects already have
// the new bboxes). So we need to reset the centers from our saved array.
for (unsigned i = 0; i < _items_centers.size(); i++) {
}
}
}
}
// when trying to stretch a perfectly vertical line in horizontal direction, which will not be allowed
// by the handles; this would be identified as a (zero) translation by isTranslation()
if (_current_relative_affine.isTranslation()) {
_("Move"));
_("Scale"));
_("Rotate"));
} else {
_("Skew"));
}
}
} else {
if (_center_is_set) {
// we were dragging center; update reprs and commit undoable action
it->updateRepr();
}
_("Set center"));
}
}
}
/* fixme: This is really bad, as we compare positions for each stamp (Lauris) */
/* fixme: IMHO the best way to keep sort cache would be to implement timestamping at last */
{
if ( fixup && _stamp_cache ) {
// TODO - give a proper fix. Simple temporary work-around for the grab() issue
_stamp_cache = NULL;
}
/* stamping mode */
if (!_empty) {
GSList *l;
if (_stamp_cache) {
l = _stamp_cache;
} else {
/* Build cache */
_stamp_cache = l;
}
while (l) {
// remember the position of the item
// remember parent
// add the new repr to the parent
// move to the saved position
if (_show == SHOW_OUTLINE) {
} else {
}
}
l = l->next;
}
_("Stamp"));
}
if ( fixup && _stamp_cache ) {
// TODO - give a proper fix. Simple temporary work-around for the grab() issue
_stamp_cache = NULL;
}
}
{
for (int i = 0; i < NUMHANDS; i++)
if ( !_show_handles || _empty )
return;
if (!_center_is_set) {
_center_is_set = true;
}
if ( _state == STATE_SCALE ) {
} else {
}
}
{
if (_empty) {
return;
}
//Update the bboxes
if (!_bbox) {
_empty = true;
return;
}
}
{
// shouldn't have nullary bbox, but knots
for (int i = 0; i < NUMHANDS; i++) {
continue;
// Position knots to scale the selection bbox
// This controls the center handle's position, because the default can
// be moved and needs to be remembered.
}
}
{
for (int i = 0; i < NUMHANDS; i++) {
knots[i]->updateCtrl();
knots[i]->request_signal.connect(sigc::bind(sigc::ptr_fun(sp_sel_trans_handle_request), &hands[i]));
knots[i]->moved_signal.connect(sigc::bind(sigc::ptr_fun(sp_sel_trans_handle_new_event), &hands[i]));
knots[i]->ungrabbed_signal.connect(sigc::bind(sigc::ptr_fun(sp_sel_trans_handle_ungrab), &hands[i]));
}
}
{
);
}
static void sp_sel_trans_handle_ungrab(SPKnot *knot, guint /*state*/, SPSelTransHandle const* /*data*/)
{
}
static void sp_sel_trans_handle_new_event(SPKnot *knot, Geom::Point const& position, guint state, SPSelTransHandle const *data)
{
);
}
static gboolean sp_sel_trans_handle_request(SPKnot *knot, Geom::Point *position, guint state, SPSelTransHandle const *data)
{
);
}
{
);
}
{
case HANDLE_CENTER:
if (state & GDK_SHIFT_MASK) {
// Unset the center position for all selected items
it->unsetCenter();
it->updateRepr();
_center_is_set = false; // center has changed
}
_("Reset center"));
}
break;
default:
break;
}
}
{
case HANDLE_CENTER:
"shape", SP_CTRL_SHAPE_BITMAP,
"size", 13.0,
NULL);
break;
default:
"shape", SP_CTRL_SHAPE_CROSS,
"size", 7.0,
NULL);
break;
}
}
void Inkscape::SelTrans::handleNewEvent(SPKnot *knot, Geom::Point *position, guint state, SPSelTransHandle const &handle)
{
if (!SP_KNOT_IS_GRABBED(knot)) {
return;
}
// in case items have been unhooked from the document, don't
// try to continue processing events for them.
return;
}
}
case HANDLE_SCALE:
break;
case HANDLE_STRETCH:
break;
case HANDLE_SKEW:
break;
case HANDLE_ROTATE:
break;
case HANDLE_CENTER:
break;
}
}
gboolean Inkscape::SelTrans::handleRequest(SPKnot *knot, Geom::Point *position, guint state, SPSelTransHandle const &handle)
{
if (!SP_KNOT_IS_GRABBED(knot))
return TRUE;
// When holding shift while rotating or skewing, the transformation will be
// relative to the point opposite of the handle; otherwise it will be relative
// to the center as set for the selection
} else if (_center) {
} else {
// FIXME
return TRUE;
}
} else {
}
}
return TRUE;
}
{
if (!_grabbed) {
// reread in case it changed on the fly:
_center_is_set = false; // center(s) may have changed
}
}
{
if (!_grabbed) {
// reset internal flag
_changed = false;
_center_is_set = false; // center(s) may have changed
}
}
{
}
/*
* handlers for handle move-request
*/
/** Returns -1 or 1 according to the sign of x. Returns 1 for 0 and NaN. */
static double sign(double const x)
{
return ( x < 0
? -1
: 1 );
}
{
// Calculate the scale factors, which can be either visual or geometric
// depending on which type of bbox is currently being used (see preferences -> selector tool)
// Find the scale factors for the geometric bbox
// We're scaling either the visual or the geometric bbox here (see the comment above)
for ( unsigned int i = 0 ; i < 2 ; i++ ) {
} else if (default_scale[i] != 0) {
}
}
// Update the knot position
// When scaling by an integer, snapping is not needed
} else {
// In all other cases we should try to snap now
// Scale is locked to a 1:1 aspect ratio, so that s[X] must be made to equal s[Y].
//
// The aspect-ratio must be locked before snapping
} else {
}
// Snap along a suitable constraint vector from the origin.
} else {
/* Scale aspect ratio is unlocked */
}
// These lines below are duplicated in stretchRequest
if (bb.getSnapped()) {
// We snapped the bbox (which is either visual or geometric)
// Calculate the new transformation and update the handle position
}
} else if (sn.getSnapped()) {
// We snapped the special points (e.g. nodes), which are not at the visual bbox
// The handle location however (pt) might however be at the visual bbox, so we
// will have to calculate pt taking the stroke width into account
}
} else {
// We didn't snap at all! Don't update the handle position, just calculate the new transformation
}
m.unSetup();
}
/* Status text */
_("<b>Scale</b>: %0.2f%% x %0.2f%%; with <b>Ctrl</b> to lock ratio"),
return TRUE;
}
gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, Geom::Point &pt, guint state)
{
case GDK_TOP_SIDE:
case GDK_BOTTOM_SIDE:
break;
case GDK_LEFT_SIDE:
case GDK_RIGHT_SIDE:
break;
default:
return TRUE;
};
// Calculate the scale factors, which can be either visual or geometric
// depending on which type of bbox is currently being used (see preferences -> selector tool)
// Find the scale factors for the geometric bbox
} else if (default_scale[axis] != 0) {
}
// Calculate the new transformation and update the handle position
// When stretching by an integer, snapping is not needed
} else {
// In all other cases we should try to snap now
bb = m.constrainedSnapStretch(_bbox_points, _point, Geom::Coord(default_scale[axis]), _origin_for_bboxpoints, Geom::Dim2(axis), symmetrical);
sn = m.constrainedSnapStretch(_snap_points, _point, Geom::Coord(geom_scale[axis]), _origin_for_specpoints, Geom::Dim2(axis), symmetrical);
if (bb.getSnapped()) {
// We snapped the bbox (which is either visual or geometric)
}
if (sn.getSnapped()) {
}
if (symmetrical) {
// on ctrl, apply symmetrical scaling instead of stretching
// Preserve aspect ratio, but never flip in the dimension not being edited (by using fabs())
}
// These lines below are duplicated in scaleRequest
if (bb.getSnapped()) {
// We snapped the bbox (which is either visual or geometric)
// Calculate the new transformation and update the handle position
}
} else if (sn.getSnapped()) {
// We snapped the special points (e.g. nodes), which are not at the visual bbox
// The handle location however (pt) might however be at the visual bbox, so we
// will have to calculate pt taking the stroke width into account
}
} else {
// We didn't snap at all! Don't update the handle position, just calculate the new transformation
}
m.unSetup();
}
// status text
_("<b>Scale</b>: %0.2f%% x %0.2f%%; with <b>Ctrl</b> to lock ratio"),
return TRUE;
}
{
// These _should_ be in the handstype somewhere instead
case HANDLE_SCALE:
case HANDLE_STRETCH:
case HANDLE_SKEW:
case HANDLE_ROTATE:
case HANDLE_CENTER:
}
return FALSE;
}
gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, Geom::Point &pt, guint state)
{
/* When skewing (or rotating):
* 1) the stroke width will not change. This makes life much easier because we don't have to
* account for that (like for scaling or stretching). As a consequence, all points will
* have the same origin for the transformation and for the snapping.
* 2) When holding shift, the transformation will be relative to the point opposite of
* the handle; otherwise it will be relative to the center as set for the selection
*/
case GDK_SB_H_DOUBLE_ARROW:
break;
case GDK_SB_V_DOUBLE_ARROW:
break;
default:
abort();
break;
}
// _point and _origin are noisy, ranging from 1 to 1e-9 or even smaller; this is due to the
// limited SVG output precision, which can be arbitrarily set in the preferences
// The handle and the origin shouldn't be too close to each other; let's check for that!
// Due to the limited resolution though (see above), we'd better use a relative error here
if (_bbox) {
return false;
}
}
// Calculate the scale factors, which can be either visual or geometric
// depending on which type of bbox is currently being used (see preferences -> selector tool)
// Prevent shrinking of the selected object, while allowing mirroring
} else {
// Allow expanding of the selected object by integer multiples
}
if (state & GDK_CONTROL_MASK) {
// Snap to defined angle increments
if (snaps) {
}
}
} else {
// Snap to objects, grids, guides
// When skewing, we cannot snap the corners of the bounding box, see the comment in "constrainedSnapSkew" for details
Inkscape::SnappedPoint sn = m.constrainedSnapSkew(_snap_points, _point, constraint, s, _origin, Geom::Dim2(dim_b));
if (sn.getSnapped()) {
// We snapped something, so change the skew to reflect it
} else {
}
m.unSetup();
}
// Update the handle position
// Calculate the relative affine
for (int i = 0; i < 2; i++) {
}
}
// Update the status text
// TRANSLATORS: don't modify the first ";"
// (it will NOT be displayed as ";" - only the second one will be)
_("<b>Skew</b>: %0.2f°; with <b>Ctrl</b> to snap angle"),
degrees);
return TRUE;
}
{
/* When rotating (or skewing):
* 1) the stroke width will not change. This makes life much easier because we don't have to
* account for that (like for scaling or stretching). As a consequence, all points will
* have the same origin for the transformation and for the snapping.
* 2) When holding shift, the transformation will be relative to the point opposite of
* the handle; otherwise it will be relative to the center as set for the selection
*/
// rotate affine in rotate
if (state & GDK_CONTROL_MASK) {
// Snap to defined angle increments
if (snaps) {
}
} else {
// When rotating, we cannot snap the corners of the bounding box, see the comment in "constrainedSnapRotate" for details
m.unSetup();
if (sn.getSnapped()) {
// We snapped something, so change the rotation to reflect it
} else {
}
}
// Calculate the relative affine
// Update the handle position
// Update the status text
// TRANSLATORS: don't modify the first ";"
// (it will NOT be displayed as ";" - only the second one will be)
_("<b>Rotate</b>: %0.2f°; with <b>Ctrl</b> to snap angle"), degrees);
return TRUE;
}
// Move the item's transformation center
{
// When dragging the transformation center while multiple items have been selected, then those
// items will share a single center. While dragging that single center, it should never snap to the
// centers of any of the selected objects. Therefore we will have to pass the list of selected items
// to the snapper, to avoid self-snapping of the rotation center
Inkscape::SnappedPoint sp = m.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER), constraints, state & GDK_SHIFT_MASK);
}
else {
}
}
m.unSetup();
// status text
_message_context.setF(Inkscape::NORMAL_MESSAGE, _("Move <b>center</b> to %s, %s"), xs->str, ys->str);
return TRUE;
}
/*
* handlers for handle movement
*
*/
void Inkscape::SelTrans::stretch(SPSelTransHandle const &/*handle*/, Geom::Point &/*pt*/, guint /*state*/)
{
transform(_absolute_affine, Geom::Point(0, 0)); // we have already accounted for origin, so pass 0,0
}
{
transform(_absolute_affine, Geom::Point(0, 0)); // we have already accounted for origin, so pass 0,0
}
void Inkscape::SelTrans::skew(SPSelTransHandle const &/*handle*/, Geom::Point &/*pt*/, guint /*state*/)
{
}
{
}
{
/* The amount that we've moved by during this drag */
if (alt) {
// Alt pressed means: move only by integer multiples of the grid spacing
if (control) { // ... if also constrained to the orthogonal axes
} else {
}
}
m.unSetup();
} else if (shift) {
if (control) { // shift & control: constrained movement without snapping
} else {
}
}
} else { //!shift: with snapping
/* We're snapping to things, possibly with a constraint to horizontal or
** vertical movement. Obtain a list of possible translations and then
** pick the smallest.
*/
/* This will be our list of possible translations */
if (control) { // constrained movement with snapping
/* Snap to things, and also constrain to horizontal or vertical movement */
// When doing a constrained translation, all points will move in the same direction, i.e.
// either horizontally or vertically. Therefore we only have to specify the direction of
// the constraint-line once. The constraint lines are parallel, but might not be colinear.
// Therefore we will have to set the point through which the constraint-line runs
// individually for each point to be snapped; this will be handled however by _snapTransformed()
dxy));
dxy));
} else { // !control
// Let's leave this timer code here for a while. I'll probably need it in the near future (Diederik van Lierop)
/* GTimeVal starttime;
GTimeVal endtime;
g_get_current_time(&starttime); */
/* Snap to things with no constraint */
/*g_get_current_time(&endtime);
double elapsed = ((((double)endtime.tv_sec - starttime.tv_sec) * G_USEC_PER_SEC + (endtime.tv_usec - starttime.tv_usec))) / 1000.0;
std::cout << "Time spent snapping: " << elapsed << std::endl; */
}
m.unSetup();
/* Pick one */
if (i->getSnapped()) {
if (best_snapped_point.isOtherSnapBetter(*i, true)) {
best_snapped_point = *i;
dxy = i->getTransformation();
}
}
}
if (best_snapped_point.getSnapped()) {
} else {
// We didn't snap, so remove any previous snap indicator
if (control) {
// If we didn't snap, then we should still constrain horizontally or vertically
// (When we did snap, then this constraint has already been enforced by
// calling constrainedSnapTranslate() above)
} else {
}
}
}
}
// status text
_message_context.setF(Inkscape::NORMAL_MESSAGE, _("<b>Move</b> by %s, %s; with <b>Ctrl</b> to restrict to horizontal/vertical; with <b>Shift</b> to disable snapping"), xs->str, ys->str);
}
// Given a location of a handle at the visual bounding box, find the corresponding location at the
// geometrical bounding box
{
// When the selector tool is using geometric bboxes, then the handle is already
// located at one of the geometric bbox corners
return visual_handle_pos;
}
if (!_geometric_bbox) {
//_getGeomHandlePos() can only be used after _geometric_bbox has been defined!
return visual_handle_pos;
}
// Using the Geom::Rect constructor below ensures that "min() < max()", which is important
// because this will also hold for _bbox, and which is required for get_scale_transform_for_stroke()
Geom::Rect new_bbox = Geom::Rect(_origin_for_bboxpoints, visual_handle_pos); // new visual bounding box
// Please note that the new_bbox might in fact be just a single line, for example when stretching (in
// which case the handle and origin will be aligned vertically or horizontally)
Geom::Point normalized_handle_pos = (visual_handle_pos - new_bbox.min()) * Geom::Scale(new_bbox.dimensions()).inverse();
// Calculate the absolute affine while taking into account the scaling of the stroke width
Geom::Affine abs_affine = get_scale_transform_for_uniform_stroke (*_bbox, _strokewidth, _strokewidth, transform_stroke, preserve,
new_bbox.min()[Geom::X], new_bbox.min()[Geom::Y], new_bbox.max()[Geom::X], new_bbox.max()[Geom::Y]);
// Calculate the scaled geometrical bbox
Geom::Rect new_geom_bbox = Geom::Rect(_geometric_bbox->min() * abs_affine, _geometric_bbox->max() * abs_affine);
// Find the location of the handle on this new geometrical bbox
return normalized_handle_pos * Geom::Scale(new_geom_bbox.dimensions()) + new_geom_bbox.min(); //new position of the geometric handle
}
Geom::Scale Inkscape::calcScaleFactors(Geom::Point const &initial_point, Geom::Point const &new_point, Geom::Point const &origin, bool const skew)
{
// Work out the new scale factors for the bbox
for ( unsigned int i = 0 ; i < 2 ; i++ ) {
if (skew) {
} else {
}
}
}
return scale;
}
// Only for scaling/stretching
{
Geom::Affine abs_affine = Geom::Translate(-_origin) * Geom::Affine(default_scale) * Geom::Translate(_origin);
bool transform_stroke = false;
bool preserve = false;
}
_absolute_affine = get_scale_transform_for_uniform_stroke (*_visual_bbox, stroke_x, stroke_y, transform_stroke, preserve,
// return the new handle position
}
// Only for scaling/stretching
{
_absolute_affine = Geom::Translate(-_origin_for_specpoints) * _relative_affine * Geom::Translate(_origin_for_specpoints);
if (_geometric_bbox) {
Geom::Rect visual_bbox = get_visual_bbox(_geometric_bbox, _absolute_affine, _strokewidth, transform_stroke);
// return the new handle position
}
// Fall back scenario, in case we don't have a geometric bounding box at hand;
// (Due to some bugs related to bounding boxes having at least one zero dimension; For more details
g_warning("No geometric bounding box has been calculated; this is a bug that needs fixing!");
}
{
// If we're not going to snap nodes, then we might just as well get rid of their snappoints right away
if (!(m.snapprefs.isTargetSnappable(SNAPTARGET_NODE_CATEGORY, SNAPTARGET_OTHERS_CATEGORY) || m.snapprefs.isAnyDatumSnappable())) {
}
// If we're not going to snap bounding boxes, then we might just as well get rid of their snappoints right away
}
_all_snap_sources_sorted.insert(_all_snap_sources_sorted.end(), _bbox_points.begin(), _bbox_points.end());
// Calculate and store the distance to the reference point for each snap candidate point
for(std::vector<Inkscape::SnapCandidatePoint>::iterator i = _all_snap_sources_sorted.begin(); i != _all_snap_sources_sorted.end(); ++i) {
}
// Sort them ascending, using the distance calculated above as the single criteria
// Now get the closest snap source
if (!_all_snap_sources_sorted.empty()) {
} else {
}
}
}
{
if (!_all_snap_sources_sorted.empty()) {
if (reverse) { // Shift-tab will find a closer point
}
} else { // Tab will find a point further away
}
}
} else {
}
}
}
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :