curve-drag-point.cpp revision 75458f6ee84203a1d06b7f2d9221dad9335c0245
/* Authors:
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2009 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "ui/tool/curve-drag-point.h"
#include "desktop.h"
#include "ui/tool/control-point-selection.h"
#include "ui/tool/event-utils.h"
#include "ui/tool/multi-path-manipulator.h"
#include "ui/tool/path-manipulator.h"
namespace Inkscape {
namespace UI {
bool CurveDragPoint::_drags_stroke = false;
bool CurveDragPoint::_segment_was_degenerate = false;
ControlPoint(pm._multi_path_manipulator._path_data.node_data.desktop, Geom::Point(), SP_ANCHOR_CENTER,
{
setVisible(false);
}
{
// do not process any events when the manipulator is empty
setVisible(false);
return false;
}
}
{
// move the handles to 1/3 the length of the segment for line segments
_segment_was_degenerate = true;
// delta is a vector equal 1/3 of distance from first to second
// only update the nodes if the mode is bspline
}
} else {
_segment_was_degenerate = false;
}
return false;
}
{
// special cancel handling - retract handles when if the segment was degenerate
return;
}
// Magic Bezier Drag Equations follow!
// "weight" describes how the influence of the drag should be distributed
// among the handles; 0 = front handle only, 1 = back handle only.
else weight = 1;
//modified so that, if the trace is bspline, it only acts if the SHIFT key is pressed
}else if(weight>=0.8){
if(held_shift(*event)){
} else {
}
}else if(weight<=0.2){
if(held_shift(*event)){
} else {
}
}else{
}
}
{
}
{
// This check is probably redundant
// the next iterator can be invalid if we click very near the end of path
if (!second) return false;
// insert nodes on Ctrl+Alt+click
_insertNode(false);
return true;
}
if (held_shift(*event)) {
// if both nodes of the segment are selected, deselect;
// otherwise add to selection
} else {
}
} else {
// without Shift, take selection
}
return true;
}
{
_insertNode(true);
return true;
}
{
// The purpose of this call is to make way for the just created node.
// Otherwise clicks on the new node would only work after the user moves the mouse a bit.
// PathManipulator will restore visibility when necessary.
setVisible(false);
if (take_selection) {
}
}
{
if (state_held_shift(state)) {
return C_("Path segment tip",
"<b>Shift</b>: click to toggle segment selection");
}
return C_("Path segment tip",
"<b>Ctrl+Alt</b>: click to insert a node");
}
if (linear) {
return C_("Path segment tip",
"<b>Linear segment</b>: drag to convert to a Bezier segment, "
"doubleclick to insert node, click to select (more: Shift, Ctrl+Alt)");
} else {
return C_("Path segment tip",
"<b>Bezier segment</b>: drag to shape the segment, doubleclick to insert node, "
"click to select (more: Shift, Ctrl+Alt)");
}
}
} // namespace UI
} // namespace Inkscape
/*
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 :