context-fns.cpp revision 55dd1351535fdbc7d4087cef62b2c3f59de8726e
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "sp-item.h"
#include "desktop.h"
#include "message-context.h"
#include "message-stack.h"
#include "context-fns.h"
#include "snap.h"
#include "desktop-affine.h"
#include "event-context.h"
#include "sp-namedview.h"
#include "display/snap-indicator.h"
/* FIXME: could probably use a template here */
/**
* Check to see if the current layer is both unhidden and unlocked. If not,
* set a message about it on the given context.
*
* \param desktop Desktop.
* \param message Message context to put messages on.
* \return true if the current layer is both unhidden and unlocked, otherwise false.
*/
{
_("<b>Current layer is hidden</b>. Unhide it to be able to draw on it."));
return false;
}
_("<b>Current layer is locked</b>. Unlock it to be able to draw on it."));
return false;
}
return true;
}
/**
* Check to see if the current layer is both unhidden and unlocked. If not,
* set a message about it on the given context.
*
* \param desktop Desktop.
* \param message Message context to put messages on.
* \return true if the current layer is both unhidden and unlocked, otherwise false.
*/
{
_("<b>Current layer is hidden</b>. Unhide it to be able to draw on it."));
return false;
}
_("<b>Current layer is locked</b>. Unlock it to be able to draw on it."));
return false;
}
return true;
}
{
if (control) {
/* Control is down: we are constrained to producing integer-ratio rectangles */
/* Vector from the centre of the box to the point we are dragging to */
/* Round it so that we have an integer-ratio (or golden ratio) box */
} else {
}
} else {
}
}
/* p[1] is the dragged point with the integer-ratio constraint */
if (shift) {
/* Shift is down, so our origin is the centre point rather than the corner
** point; this means that corner-point movements are bound to each other.
*/
/* p[0] is the opposite corner of our box */
/* Try to snap p[0] (the opposite corner) along the constraint vector */
/* Try to snap p[1] (the dragged corner) along the constraint vector */
/* Choose the best snap and update points accordingly */
if (s[0].getSnapped()) {
p[0] = s[0].getPoint();
snappoint = s[0];
}
} else {
if (s[1].getSnapped()) {
snappoint = s[1];
}
}
} else {
/* Our origin is the opposite corner. Snap the drag point along the constraint vector */
p[0] = center;
if (snappoint.getSnapped()) {
}
}
} else if (shift) {
/* Shift is down, so our origin is the centre point rather than the corner point;
** this means that corner-point movements are bound to each other.
*/
p[1] = pt;
if (s[0].getSnapped()) {
p[0] = s[0].getPoint();
snappoint = s[0];
}
} else {
if (s[1].getSnapped()) {
snappoint = s[1];
}
}
} else {
/* There's no constraint on the corner point, so just snap it to anything */
p[0] = center;
p[1] = pt;
if (snappoint.getSnapped()) {
}
}
if (snappoint.getSnapped()) {
}
p[0] = sp_desktop_dt2root_xy_point(desktop, p[0]);
return Geom::Rect(Geom::Point(MIN(p[0][Geom::X], p[1][Geom::X]), MIN(p[0][Geom::Y], p[1][Geom::Y])),
}
{
ec->within_tolerance = true;
ec->item_to_select = sp_event_context_find_item(desktop, p, ev->button.state & GDK_MOD1_MASK, TRUE);
}
/*
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:encoding=utf-8:textwidth=99 :