Inkscape
Vector Graphics Editor
|
PenTool: a context for pen tool events. More...
#include <pen-tool.h>
Public Types | |
enum | Mode { MODE_CLICK , MODE_DRAG } |
enum | State { POINT , CONTROL , CLOSE , STOP , DEAD } |
Public Member Functions | |
PenTool (SPDesktop *desktop, std::string &&prefs_path="/tools/freehand/pen", std::string &&cursor_filename="pen.svg") | |
~PenTool () override | |
void | nextParaxialDirection (Geom::Point const &pt, Geom::Point const &origin, guint state) |
void | setPolylineMode () |
bool | hasWaitingLPE () |
void | waitForLPEMouseClicks (Inkscape::LivePathEffect::EffectType effect_type, unsigned int num_clicks, bool use_polylines=true) |
![]() | |
FreehandBase (SPDesktop *desktop, std::string &&prefs_path, std::string &&cursor_filename) | |
~FreehandBase () override | |
std::optional< Geom::Point > | red_curve_get_last_point () const |
void | onSelectionModified () |
![]() | |
ToolBase (SPDesktop *desktop, std::string &&prefs_path, std::string &&cursor_filename, bool uses_snap=true) | |
virtual | ~ToolBase () |
virtual void | menu_popup (CanvasEvent const &event, SPObject *obj=nullptr) |
Create popup menu and tell Gtk to show it. | |
virtual bool | can_undo (bool redo=false) |
virtual bool | is_ready () const |
virtual void | switching_away (std::string const &new_tool) |
std::string const & | getPrefsPath () const |
void | enableSelectionCue (bool enable=true) |
Enables/disables the ToolBase's SelCue. | |
MessageContext * | defaultMessageContext () const |
SPDesktop * | getDesktop () const |
SPGroup * | currentLayer () const |
void | set_last_active_tool (Glib::ustring last_tool) |
const Glib::ustring & | get_last_active_tool () const |
bool | start_root_handler (CanvasEvent const &event) |
Handles snapping events for all tools and then passes to tool_root_handler. | |
bool | tool_root_handler (CanvasEvent const &event) |
Calls the right tool's event handler, depending on the selected tool and state. | |
bool | start_item_handler (SPItem *item, CanvasEvent const &event) |
Starts handling item snapping and pass to virtual_item_handler afterwards. | |
bool | virtual_item_handler (SPItem *item, CanvasEvent const &event) |
bool | is_panning () const |
True if we're panning with any method (space bar, middle-mouse, right-mouse+Ctrl) | |
bool | is_space_panning () const |
True if we're panning with the space bar. | |
void | snap_delay_handler (gpointer item, gpointer item2, MotionEvent const &event, DelayedSnapEvent::Origin origin) |
Analyses the current event, calculates the mouse speed, turns snapping off (temporarily) if the mouse speed is above a threshold, and stores the current event such that it can be re-triggered when needed (re-triggering is controlled by a timeout). | |
void | process_delayed_snap_event () |
When the delayed snap event timer expires, this method will be called and will re-inject the last motion event in an appropriate place, with snapping being turned on again. | |
void | discard_delayed_snap_event () |
If a delayed snap event has been scheduled, this function will cancel it. | |
void | set_cursor (std::string filename) |
Sets the current cursor to the given filename. | |
void | use_cursor (Glib::RefPtr< Gdk::Cursor > cursor) |
Set the cursor to this specific one, don't remember it. | |
Glib::RefPtr< Gdk::Cursor > | get_cursor (Gtk::Widget &widget, std::string const &filename) const |
Returns the Gdk Cursor for the given filename. | |
void | use_tool_cursor () |
Uses the saved cursor, based on the saved filename. | |
void | enableGrDrag (bool enable=true) |
bool | deleteSelectedDrag (bool just_one) |
Delete a selected GrDrag point. | |
bool | hasGradientDrag () const |
Return true if there is a gradient drag. | |
GrDrag * | get_drag () |
Static Public Attributes | |
static constexpr std::array< CanvasItemCtrlType, 4 > | ctrl_types |
Protected Member Functions | |
void | set (Inkscape::Preferences::Entry const &val) override |
Callback that sets key to value in pen context. | |
bool | root_handler (CanvasEvent const &event) override |
Callback to handle all pen events. | |
bool | item_handler (SPItem *item, CanvasEvent const &event) override |
Handles item specific events. | |
![]() | |
void | _attachSelection () |
![]() | |
void | setup_for_drag_start (ButtonPressEvent const &ev) |
void | saveDragOrigin (Geom::Point const &pos) |
bool | checkDragMoved (Geom::Point const &pos) |
Analyse the current position and return true once it has moved farther than tolerance from the drag origin (indicating they intend to move the object, not click). | |
void | grabCanvasEvents (EventMask mask=EventType::KEY_PRESS|EventType::BUTTON_RELEASE|EventType::MOTION|EventType::BUTTON_PRESS) |
Grab events from the Canvas Catchall. | |
void | ungrabCanvasEvents () |
Ungrab events from the Canvas Catchall. | |
bool | sp_event_context_knot_mouseover () const |
Returns true if we're hovering above a knot (needed because we don't want to pre-snap in that case). | |
void | set_high_motion_precision (bool high_precision=true) |
Enable (or disable) high precision for motion events. | |
Private Member Functions | |
bool | _handleButtonPress (ButtonPressEvent const &event) |
Handle mouse single button press event. | |
bool | _handle2ButtonPress (ButtonPressEvent const &event) |
Handle mouse double button press event. | |
bool | _handleMotionNotify (MotionEvent const &event) |
Handle motion_notify event. | |
bool | _handleButtonRelease (ButtonReleaseEvent const &event) |
Handle mouse button release event. | |
bool | _handleKeyPress (KeyPressEvent const &event) |
void | _bsplineSpiroColor () |
void | _bsplineSpiro (bool shift) |
void | _bsplineSpiroOn () |
void | _bsplineSpiroOff () |
void | _bsplineSpiroStartAnchor (bool shift) |
void | _bsplineSpiroStartAnchorOn () |
void | _bsplineSpiroStartAnchorOff () |
void | _bsplineSpiroMotion (guint const state) |
void | _bsplineSpiroEndAnchorOn () |
void | _bsplineSpiroEndAnchorOff () |
void | _bsplineSpiroBuild () |
void | _setInitialPoint (Geom::Point const p) |
void | _setSubsequentPoint (Geom::Point const p, bool statusbar, guint status=0) |
void | _setCtrl (Geom::Point const p, guint state) |
void | _finishSegment (Geom::Point p, guint state) |
bool | _undoLastPoint (bool user_undo=false) |
bool | _redoLastPoint () |
Re-add the last undone point to the path being drawn. | |
void | _finish (bool closed) |
void | _resetColors () |
void | _disableEvents () |
void | _enableEvents () |
void | _setToNearestHorizVert (Geom::Point &pt, guint const state) const |
void | _setAngleDistanceStatusMessage (Geom::Point const p, int pc_point_to_compare, gchar const *message) |
Show the status message for the current line/curve segment. | |
void | _lastpointToLine () |
void | _lastpointToCurve () |
void | _lastpointMoveScreen (gdouble x, gdouble y) |
void | _lastpointMove (gdouble x, gdouble y) |
void | _redrawAll () |
void | _endpointSnapHandle (Geom::Point &p, guint const state) |
Snaps new node's handle relative to the new node. | |
void | _endpointSnap (Geom::Point &p, guint const state) |
Snaps new node relative to the previous node. | |
void | _cancel () |
Private Attributes | |
sigc::connection | _desktop_destroy |
std::vector< Geom::PathVector > | _redo_stack |
History of undone events. | |
bool | _did_redo = false |
Util::ActionAccel | _acc_to_line |
Util::ActionAccel | _acc_to_curve |
Util::ActionAccel | _acc_to_guides |
Additional Inherited Members | |
![]() | |
uint32_t | red_color = 0xff00007f |
uint32_t | blue_color = 0x0000ff7f |
uint32_t | green_color = 0x00ff007f |
uint32_t | highlight_color = 0x0000007f |
![]() | |
Glib::RefPtr< Gdk::Cursor > | _cursor |
std::string | _cursor_filename = "select.svg" |
std::string | _cursor_default = "select.svg" |
Geom::IntPoint | xyp |
where drag started | |
bool | dragging = false |
are we dragging? | |
int | tolerance = 0 |
bool | within_tolerance = false |
are we still within tolerance of origin | |
bool | _button1on = false |
bool | _button2on = false |
bool | _button3on = false |
SPItem * | item_to_select = nullptr |
the item where mouse_press occurred, to be selected if this is a click not drag | |
SPDesktop * | _desktop = nullptr |
Util::ActionAccel | _acc_undo |
Util::ActionAccel | _acc_redo |
Util::ActionAccel | _acc_quick_preview |
Util::ActionAccel | _acc_quick_zoom |
Util::ActionAccel | _acc_quick_pan |
PenTool: a context for pen tool events.
Definition at line 37 of file pen-tool.h.
Enumerator | |
---|---|
MODE_CLICK | |
MODE_DRAG |
Definition at line 45 of file pen-tool.h.
Enumerator | |
---|---|
POINT | |
CONTROL | |
CLOSE | |
STOP | |
DEAD |
Definition at line 50 of file pen-tool.h.
Inkscape::UI::Tools::PenTool::PenTool | ( | SPDesktop * | desktop, |
std::string && | prefs_path = "/tools/freehand/pen" , |
||
std::string && | cursor_filename = "pen.svg" |
||
) |
Definition at line 62 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, _desktop_destroy, Inkscape::UI::Tools::FreehandBase::anchor_statusbar, cl0, cl1, SPDesktop::connectDestroy(), ctrl, ctrl_types, DEAD, desktop, Inkscape::UI::Tools::ToolBase::enableSelectionCue(), Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), SPDesktop::getCanvasControls(), setPolylineMode(), Inkscape::UI::Tools::sp_event_context_read(), state, and Inkscape::UI::Tools::FreehandBase::tablet_enabled.
|
override |
Definition at line 97 of file pen-tool.cpp.
References _desktop_destroy, _finish(), c, cl0, cl1, ctrl, DEAD, Inkscape::UI::Tools::ToolBase::discard_delayed_snap_event(), Inkscape::UI::Tools::FreehandBase::ea, expecting_clicks_for_LPE, npoints, SPLPEItem::removeCurrentPathEffect(), state, and waiting_item.
|
private |
Definition at line 1214 of file pen-tool.cpp.
References _bsplineSpiroBuild(), _bsplineSpiroOff(), _bsplineSpiroOn(), bspline, and spiro.
Referenced by _finishSegment().
|
private |
Definition at line 1521 of file pen-tool.cpp.
References Inkscape::UI::Tools::FreehandBase::anchor_statusbar, Geom::Path::appendNew(), Geom::are_near(), Geom::PathVector::back(), Inkscape::UI::Tools::FreehandBase::blue_bpath, Inkscape::UI::Tools::FreehandBase::blue_color, Inkscape::UI::Tools::FreehandBase::blue_curve, bspline, c, cl0, cl1, Geom::PathVector::clear(), closepath_current(), ctrl, SPDrawAnchor::curve, Geom::PathVector::curveCount(), Geom::PathVector::finalPoint(), Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::FreehandBase::green_curve, p_array, pathvector_append_continuous(), previous, Inkscape::UI::Tools::FreehandBase::red_bpath, Inkscape::UI::Tools::FreehandBase::red_curve, Inkscape::UI::Tools::FreehandBase::sa, Inkscape::UI::Tools::FreehandBase::sa_overwrited, Inkscape::LivePathEffect::sp_bspline_do_effect(), Inkscape::LivePathEffect::sp_spiro_do_effect(), spiro, and uniform().
Referenced by _bsplineSpiro(), _bsplineSpiroMotion(), _redoLastPoint(), _redrawAll(), and _undoLastPoint().
|
private |
Definition at line 1169 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::UI::Tools::FreehandBase::blue_bpath, bspline, Inkscape::UI::Tools::ToolBase::currentLayer(), Inkscape::Preferences::get(), SPDesktop::getCanvasSketch(), Inkscape::Preferences::getColor(), Inkscape::UI::Tools::FreehandBase::green_bpaths, Inkscape::UI::Tools::FreehandBase::green_color, Inkscape::UI::Tools::FreehandBase::green_curve, SPGroup::highlight_color(), Inkscape::UI::Tools::FreehandBase::highlight_color, Inkscape::UI::Tools::FreehandBase::red_bpath, Inkscape::UI::Tools::FreehandBase::red_color, SP_WIND_RULE_NONZERO, spiro, Inkscape::Colors::Color::toRGBA(), and value_or_empty().
Referenced by _bsplineSpiroStartAnchor(), _handleButtonPress(), and setPolylineMode().
|
private |
Definition at line 1479 of file pen-tool.cpp.
References Geom::Path::appendNew(), backspace(), Geom::PathVector::curveCount(), Geom::PathVector::finalPoint(), get_last_segment(), Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::FreehandBase::green_curve, Geom::Curve::initialPoint(), p_array, pathvector_append_continuous(), Geom::PathVector::reverse(), Geom::PathVector::reversed(), Inkscape::UI::Tools::FreehandBase::sa, and Inkscape::UI::Tools::FreehandBase::sa_overwrited.
Referenced by _bsplineSpiroMotion().
|
private |
Definition at line 1431 of file pen-tool.cpp.
References Geom::Path::appendNew(), backspace(), bspline, Geom::PathVector::curveCount(), Geom::PathVector::finalPoint(), get_last_segment(), Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::FreehandBase::green_curve, Geom::Curve::initialPoint(), p_array, pathvector_append_continuous(), Geom::PathVector::reverse(), Geom::PathVector::reversed(), Inkscape::UI::Tools::FreehandBase::sa, Inkscape::UI::Tools::FreehandBase::sa_overwrited, Geom::X, and Geom::Y.
Referenced by _bsplineSpiroMotion().
|
private |
Definition at line 1331 of file pen-tool.cpp.
References _bsplineSpiroBuild(), _bsplineSpiroEndAnchorOff(), _bsplineSpiroEndAnchorOn(), Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::UI::Tools::FreehandBase::anchor_statusbar, Geom::Path::appendNew(), Geom::are_near(), Geom::PathVector::back(), backspace(), bspline, Geom::PathVector::curveCount(), Geom::PathVector::finalPoint(), get_last_segment(), SPDesktop::getCanvasSketch(), Inkscape::UI::Tools::FreehandBase::green_bpaths, Inkscape::UI::Tools::FreehandBase::green_color, Inkscape::UI::Tools::FreehandBase::green_curve, Geom::Curve::initialPoint(), npoints, p_array, path_from_curve(), previous, Inkscape::UI::Tools::FreehandBase::red_bpath, Inkscape::UI::Tools::FreehandBase::red_curve, Inkscape::UI::Tools::FreehandBase::sa, Inkscape::UI::Tools::FreehandBase::sa_overwrited, shift(), SP_WIND_RULE_NONZERO, spiro, state, value_or_empty(), Geom::X, and Geom::Y.
Referenced by _bsplineSpiroOn(), and _handleMotionNotify().
|
private |
Definition at line 1235 of file pen-tool.cpp.
References Geom::PathVector::curveCount(), Geom::Curve::finalPoint(), get_first_segment(), Geom::PathVector::initialPoint(), npoints, p_array, and Inkscape::UI::Tools::FreehandBase::red_curve.
Referenced by _bsplineSpiro().
|
private |
Definition at line 1224 of file pen-tool.cpp.
References _bsplineSpiroMotion(), Geom::PathVector::curveCount(), Geom::Curve::finalPoint(), get_first_segment(), Geom::PathVector::initialPoint(), npoints, p_array, and Inkscape::UI::Tools::FreehandBase::red_curve.
Referenced by _bsplineSpiro().
|
private |
Definition at line 1245 of file pen-tool.cpp.
References _bsplineSpiroColor(), _bsplineSpiroStartAnchorOff(), _bsplineSpiroStartAnchorOn(), Inkscape::LivePathEffect::BSPLINE, bspline, SPDrawAnchor::curve, LivePathEffectObject::get_lpe(), Inkscape::LivePathEffect::Effect::getLPEObj(), Inkscape::UI::Tools::FreehandBase::sa, Inkscape::LivePathEffect::SPIRO, spiro, and Inkscape::UI::Tools::FreehandBase::white_item.
Referenced by _handleButtonPress(), _lastpointToCurve(), and _lastpointToLine().
|
private |
Definition at line 1314 of file pen-tool.cpp.
References Geom::Path::appendNew(), backspace(), get_last_segment(), pathvector_append_continuous(), and Inkscape::UI::Tools::FreehandBase::sa_overwrited.
Referenced by _bsplineSpiroStartAnchor().
|
private |
Definition at line 1290 of file pen-tool.cpp.
References backspace(), get_last_segment(), Geom::Curve::initialPoint(), pathvector_append_continuous(), Inkscape::UI::Tools::FreehandBase::sa_overwrited, Geom::X, and Geom::Y.
Referenced by _bsplineSpiroStartAnchor().
|
private |
Definition at line 136 of file pen-tool.cpp.
References _redo_stack, _resetColors(), c, cl0, cl1, ctrl, Inkscape::UI::Tools::ToolBase::message_context, Inkscape::NORMAL_MESSAGE, state, and STOP.
Referenced by _handleKeyPress(), and _undoLastPoint().
|
private |
|
private |
|
private |
Snaps new node relative to the previous node.
Definition at line 173 of file pen-tool.cpp.
References _setToNearestHorizVert(), Inkscape::UI::Tools::FreehandBase::green_curve, npoints, origin, p_array, polylines_paraxial, Inkscape::UI::Tools::spdc_endpoint_snap_free(), Inkscape::UI::Tools::spdc_endpoint_snap_rotation(), and state.
Referenced by _handleButtonPress(), _handleButtonRelease(), and _handleMotionNotify().
|
private |
Snaps new node's handle relative to the new node.
Definition at line 203 of file pen-tool.cpp.
References npoints, origin, p_array, Inkscape::UI::Tools::spdc_endpoint_snap_free(), Inkscape::UI::Tools::spdc_endpoint_snap_rotation(), and state.
Referenced by _handleMotionNotify().
|
private |
Definition at line 1852 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, _disableEvents(), _enableEvents(), _redo_stack, c, cl0, cl1, Geom::PathVector::clear(), ctrl, Inkscape::UI::Tools::FreehandBase::ea, expecting_clicks_for_LPE, Inkscape::MessageStack::flash(), Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::ToolBase::message_context, SPDesktop::messageStack(), Inkscape::NORMAL_MESSAGE, npoints, POINT, Inkscape::UI::Tools::FreehandBase::red_curve, Inkscape::UI::Tools::FreehandBase::sa, Inkscape::UI::Tools::spdc_concat_colors_and_flush(), and state.
Referenced by _handle2ButtonPress(), _handleButtonPress(), _handleButtonRelease(), _handleKeyPress(), and ~PenTool().
|
private |
Definition at line 1699 of file pen-tool.cpp.
References _bsplineSpiro(), Inkscape::UI::Tools::ToolBase::_desktop, _redo_stack, Geom::Path::appendNew(), Geom::are_near(), backspace(), Geom::PathVector::clear(), Geom::PathVector::curveCount(), get_last_segment(), SPDesktop::getCanvasSketch(), Inkscape::UI::Tools::FreehandBase::green_bpaths, Inkscape::UI::Tools::FreehandBase::green_color, Inkscape::UI::Tools::FreehandBase::green_curve, Geom::PathVector::initialPoint(), nextParaxialDirection(), npoints, p_array, pathvector_append_continuous(), polylines_paraxial, Inkscape::UI::Tools::FreehandBase::red_curve, SP_WIND_RULE_NONZERO, and state.
Referenced by _handleButtonPress(), _handleButtonRelease(), and _handleKeyPress().
|
private |
Handle mouse double button press event.
Definition at line 452 of file pen-tool.cpp.
References _finish(), Inkscape::ButtonEvent::button, CLOSE, npoints, and state.
|
private |
Handle mouse single button press event.
Definition at line 267 of file pen-tool.cpp.
References _bsplineSpiroColor(), _bsplineSpiroStartAnchor(), Inkscape::UI::Tools::ToolBase::_button1on, Inkscape::UI::Tools::ToolBase::_desktop, _endpointSnap(), _finish(), _finishSegment(), _setInitialPoint(), _setSubsequentPoint(), bspline, Inkscape::ButtonEvent::button, Inkscape::ObjectSet::clear(), CLOSE, CONTROL, SPDrawAnchor::curve, Inkscape::UI::Tools::ToolBase::defaultMessageContext(), SPDrawAnchor::dp, Inkscape::UI::Tools::FreehandBase::ea, events_disabled, expecting_clicks_for_LPE, Inkscape::MessageStack::flash(), SPDesktop::getNamedView(), SPDesktop::getSelection(), Inkscape::UI::Tools::ToolBase::grabCanvasEvents(), Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::FreehandBase::green_closed, Inkscape::UI::Tools::FreehandBase::green_curve, hasWaitingLPE(), Inkscape::have_viable_layer(), SPDesktop::messageStack(), mode, MODE_CLICK, MODE_DRAG, Inkscape::CanvasEvent::modifiers, Inkscape::NORMAL_MESSAGE, npoints, p_array, Inkscape::UI::Tools::pen_drag_origin_w, Inkscape::UI::Tools::pen_within_tolerance, POINT, polylines_only, polylines_paraxial, Inkscape::ButtonEvent::pos, Inkscape::UI::Tools::FreehandBase::sa, Inkscape::UI::Tools::FreehandBase::sa_overwrited, Inkscape::UI::Tools::FreehandBase::selection, SnapManager::setup(), Inkscape::ObjectSet::singleItem(), SPNamedView::snap_manager, Inkscape::SNAPSOURCE_NODE_HANDLE, Inkscape::UI::Tools::spdc_create_single_dot(), Inkscape::UI::Tools::spdc_test_inside(), spiro, SPDrawAnchor::start, state, STOP, and SPDesktop::w2d().
Referenced by item_handler().
|
private |
Handle mouse button release event.
Definition at line 633 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, _endpointSnap(), _finish(), _finishSegment(), Inkscape::LivePathEffect::Effect::acceptParamPath(), Inkscape::Selection::add(), bspline, Inkscape::ButtonEvent::button, CLOSE, CONTROL, ctrl, SPDrawAnchor::dp, Inkscape::UI::Tools::FreehandBase::ea, events_disabled, expecting_clicks_for_LPE, SPDesktop::getSelection(), Inkscape::UI::Tools::FreehandBase::green_closed, hasWaitingLPE(), mode, MODE_CLICK, MODE_DRAG, Inkscape::CanvasEvent::modifiers, npoints, p_array, POINT, Inkscape::ButtonEvent::pos, Inkscape::UI::Tools::FreehandBase::sa, Inkscape::UI::Tools::FreehandBase::selection, setPolylineMode(), Inkscape::ObjectSet::singleItem(), Inkscape::UI::Tools::spdc_test_inside(), spiro, state, STOP, Inkscape::UI::Tools::ToolBase::ungrabCanvasEvents(), SPDesktop::w2d(), waiting_item, and waiting_LPE.
Referenced by item_handler(), and root_handler().
|
private |
Definition at line 952 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_acc_redo, _acc_to_curve, _acc_to_guides, _acc_to_line, Inkscape::UI::Tools::ToolBase::_acc_undo, _cancel(), Inkscape::UI::Tools::ToolBase::_desktop, _finish(), _finishSegment(), _lastpointMove(), _lastpointMoveScreen(), _lastpointToCurve(), _lastpointToLine(), _redoLastPoint(), _undoLastPoint(), Geom::PathVector::curveCount(), Inkscape::UI::Tools::FreehandBase::ea, Inkscape::Preferences::get(), Inkscape::UI::Tools::get_latin_keyval(), SPDesktop::getSelection(), Inkscape::Util::ActionAccel::isTriggeredBy(), Inkscape::mod_alt(), Inkscape::mod_ctrl(), Inkscape::mod_shift(), Inkscape::mod_shift_only(), npoints, Geom::PathVector::push_back(), Inkscape::UI::Tools::FreehandBase::red_curve, and Inkscape::ObjectSet::toGuides().
Referenced by root_handler().
|
private |
Handle motion_notify event.
Definition at line 465 of file pen-tool.cpp.
References _bsplineSpiroMotion(), Inkscape::UI::Tools::ToolBase::_desktop, _endpointSnap(), _endpointSnapHandle(), _setCtrl(), _setSubsequentPoint(), Inkscape::UI::Tools::FreehandBase::anchor_statusbar, bspline, CLOSE, CONTROL, SPDrawAnchor::dp, events_disabled, Inkscape::Preferences::get(), Inkscape::Preferences::getIntLimited(), SPDesktop::getNamedView(), Inkscape::UI::Tools::gobble_motion_events(), Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::FreehandBase::green_curve, Geom::LInfty(), Inkscape::UI::Tools::ToolBase::message_context, mode, MODE_CLICK, MODE_DRAG, Inkscape::CanvasEvent::modifiers, Inkscape::NORMAL_MESSAGE, npoints, p_array, Inkscape::UI::Tools::pen_drag_origin_w, Inkscape::UI::Tools::pen_within_tolerance, POINT, polylines_only, Inkscape::MotionEvent::pos, SnapManager::preSnap(), SnapManager::setup(), SPNamedView::snap_manager, Inkscape::SNAPSOURCE_NODE_HANDLE, Inkscape::UI::Tools::ToolBase::sp_event_context_knot_mouseover(), Inkscape::UI::Tools::spdc_test_inside(), spiro, state, STOP, Inkscape::UI::Tools::ToolBase::tolerance, SnapManager::unSetup(), and SPDesktop::w2d().
Referenced by root_handler().
|
private |
Definition at line 815 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, _redrawAll(), SPDesktop::current_rotation(), delta, Inkscape::Preferences::get(), Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::FreehandBase::green_curve, Geom::Rotate::inverse(), last_point_additive_move(), npoints, p_array, and SPDesktop::yaxisdir().
Referenced by _handleKeyPress(), and _lastpointMoveScreen().
|
private |
Definition at line 846 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, _lastpointMove(), and SPDesktop::current_zoom().
Referenced by _handleKeyPress().
|
private |
Definition at line 851 of file pen-tool.cpp.
References _bsplineSpiroStartAnchor(), _redrawAll(), backspace(), bspline, SPDrawAnchor::curve, D, Geom::PathVector::finalPoint(), get_last_segment(), Inkscape::UI::Tools::FreehandBase::green_curve, Geom::Curve::initialPoint(), npoints, p_array, pathvector_append_continuous(), previous, Inkscape::UI::Tools::FreehandBase::red_curve, Inkscape::UI::Tools::FreehandBase::sa, and spiro.
Referenced by _handleKeyPress().
|
private |
Definition at line 906 of file pen-tool.cpp.
References _bsplineSpiroStartAnchor(), _redrawAll(), backspace(), bspline, SPDrawAnchor::curve, D, get_last_segment(), Inkscape::UI::Tools::FreehandBase::green_curve, Geom::Curve::initialPoint(), npoints, p_array, pathvector_append_continuous(), previous, Inkscape::UI::Tools::FreehandBase::sa, and spiro.
Referenced by _handleKeyPress().
|
private |
Re-add the last undone point to the path being drawn.
Definition at line 1825 of file pen-tool.cpp.
References _bsplineSpiroBuild(), Inkscape::UI::Tools::ToolBase::_desktop, _did_redo, _redo_stack, _setSubsequentPoint(), Geom::Path::append(), get_last_segment(), SPDesktop::getCanvasSketch(), Inkscape::UI::Tools::FreehandBase::green_bpaths, Inkscape::UI::Tools::FreehandBase::green_color, Inkscape::UI::Tools::FreehandBase::green_curve, p_array, and SP_WIND_RULE_NONZERO.
Referenced by _handleKeyPress().
|
private |
Definition at line 755 of file pen-tool.cpp.
References _bsplineSpiroBuild(), Inkscape::UI::Tools::ToolBase::_desktop, Geom::Path::appendNew(), Geom::PathVector::back(), bspline, c, cl0, cl1, ctrl, get_last_segment(), SPDesktop::getCanvasSketch(), Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::FreehandBase::green_bpaths, Inkscape::UI::Tools::FreehandBase::green_color, Inkscape::UI::Tools::FreehandBase::green_curve, npoints, p_array, Inkscape::UI::Tools::FreehandBase::red_bpath, Inkscape::UI::Tools::FreehandBase::red_curve, SP_WIND_RULE_NONZERO, spiro, and value_or_empty().
Referenced by _lastpointMove(), _lastpointToCurve(), _lastpointToLine(), and setPolylineMode().
|
private |
Definition at line 1103 of file pen-tool.cpp.
References Inkscape::UI::Tools::FreehandBase::blue_bpath, Inkscape::UI::Tools::FreehandBase::blue_curve, Geom::PathVector::clear(), Inkscape::UI::Tools::FreehandBase::ea, Inkscape::UI::Tools::FreehandBase::green_anchor, Inkscape::UI::Tools::FreehandBase::green_bpaths, Inkscape::UI::Tools::FreehandBase::green_curve, npoints, Inkscape::UI::Tools::FreehandBase::red_bpath, Inkscape::UI::Tools::FreehandBase::red_curve, Inkscape::UI::Tools::FreehandBase::red_curve_is_valid, Inkscape::UI::Tools::FreehandBase::sa, and Inkscape::UI::Tools::FreehandBase::sa_overwrited.
Referenced by _cancel().
|
private |
Show the status message for the current line/curve segment.
This type of message always shows angle/distance as the last two parameters ("angle %3.2f°, distance %s").
Definition at line 1144 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, SPNamedView::display_units, Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), SPDesktop::getNamedView(), Inkscape::IMMEDIATE_MESSAGE, SPDesktop::is_yaxisdown(), Geom::L2(), Inkscape::UI::Tools::ToolBase::message_context, p_array, Inkscape::Util::Quantity::string(), Geom::X, and Geom::Y.
Referenced by _setCtrl(), and _setSubsequentPoint().
|
private |
Definition at line 1645 of file pen-tool.cpp.
References _setAngleDistanceStatusMessage(), Geom::Path::appendNew(), Geom::PathVector::back(), c, cl0, cl1, ctrl, delta, Inkscape::UI::Tools::FreehandBase::green_curve, mode, MODE_CLICK, MODE_DRAG, npoints, p_array, Inkscape::UI::Tools::FreehandBase::red_bpath, and Inkscape::UI::Tools::FreehandBase::red_curve.
Referenced by _handleMotionNotify().
|
private |
Definition at line 1129 of file pen-tool.cpp.
References npoints, p_array, and Inkscape::UI::Tools::FreehandBase::red_bpath.
Referenced by _handleButtonPress().
|
private |
Definition at line 1592 of file pen-tool.cpp.
References _setAngleDistanceStatusMessage(), _setToNearestHorizVert(), Geom::Path::appendNew(), Geom::PathVector::back(), bspline, npoints, origin, p_array, polylines_paraxial, Inkscape::UI::Tools::FreehandBase::red_bpath, Inkscape::UI::Tools::FreehandBase::red_curve, spiro, Geom::X, and Geom::Y.
Referenced by _handleButtonPress(), _handleMotionNotify(), _redoLastPoint(), and _undoLastPoint().
|
private |
Definition at line 1925 of file pen-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Geom::Point::ccw(), SnapManager::constrainedSnapReturnByRef(), SPDesktop::getNamedView(), SPDesktop::getSelection(), origin, p_array, paraxial_angle, Inkscape::UI::Tools::FreehandBase::selection, SnapManager::setup(), Inkscape::ObjectSet::singleItem(), SPNamedView::snap_manager, Inkscape::SNAPSOURCE_NODE_HANDLE, state, and SnapManager::unSetup().
Referenced by _endpointSnap(), _setSubsequentPoint(), and _undoLastPoint().
|
private |
Definition at line 1735 of file pen-tool.cpp.
References _bsplineSpiroBuild(), _cancel(), _did_redo, _redo_stack, _setSubsequentPoint(), _setToNearestHorizVert(), backspace(), bspline, c, cl0, cl1, Geom::PathVector::clear(), ctrl, Geom::PathVector::curveCount(), Geom::Point::cw(), get_last_segment(), Inkscape::UI::Tools::FreehandBase::green_bpaths, Inkscape::UI::Tools::FreehandBase::green_curve, npoints, p_array, paraxial_angle, POINT, polylines_paraxial, Inkscape::UI::Tools::FreehandBase::red_curve, spiro, state, Geom::X, and Geom::Y.
Referenced by _handleKeyPress().
bool Inkscape::UI::Tools::PenTool::hasWaitingLPE | ( | ) |
Definition at line 164 of file pen-tool.cpp.
References Inkscape::LivePathEffect::INVALID_LPE, waiting_LPE, and Inkscape::UI::Tools::FreehandBase::waiting_LPE_type.
Referenced by _handleButtonPress(), _handleButtonRelease(), and Inkscape::UI::Tools::LpeTool::root_handler().
|
overrideprotectedvirtual |
Handles item specific events.
Gets called from Gdk.
Only reacts to right mouse button at the moment.
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 217 of file pen-tool.cpp.
References _handleButtonPress(), _handleButtonRelease(), Inkscape::inspect_event(), item, and Inkscape::UI::Tools::ToolBase::item_handler().
Referenced by Inkscape::UI::Tools::LpeTool::item_handler().
void Inkscape::UI::Tools::PenTool::nextParaxialDirection | ( | Geom::Point const & | pt, |
Geom::Point const & | origin, | ||
guint | state | ||
) |
Definition at line 1906 of file pen-tool.cpp.
References Geom::Point::ccw(), Inkscape::UI::Tools::FreehandBase::green_curve, origin, paraxial_angle, and state.
Referenced by _finishSegment().
|
overrideprotectedvirtual |
Callback to handle all pen events.
Reimplemented from Inkscape::UI::Tools::FreehandBase.
Definition at line 237 of file pen-tool.cpp.
References _handleButtonRelease(), _handleKeyPress(), _handleMotionNotify(), Inkscape::inspect_event(), and Inkscape::UI::Tools::FreehandBase::root_handler().
Referenced by Inkscape::UI::Tools::LpeTool::root_handler().
|
overrideprotectedvirtual |
Callback that sets key to value in pen context.
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 152 of file pen-tool.cpp.
References Inkscape::Preferences::Entry::getEntryName(), Inkscape::Preferences::Entry::getString(), mode, MODE_CLICK, MODE_DRAG, and name.
void Inkscape::UI::Tools::PenTool::setPolylineMode | ( | ) |
Definition at line 121 of file pen-tool.cpp.
References _bsplineSpiroColor(), _redrawAll(), bspline, Inkscape::Preferences::get(), Inkscape::Preferences::getInt(), Inkscape::UI::Tools::FreehandBase::green_bpaths, mode, polylines_only, polylines_paraxial, and spiro.
Referenced by _handleButtonRelease(), and PenTool().
void Inkscape::UI::Tools::PenTool::waitForLPEMouseClicks | ( | Inkscape::LivePathEffect::EffectType | effect_type, |
unsigned int | num_clicks, | ||
bool | use_polylines = true |
||
) |
Definition at line 1896 of file pen-tool.cpp.
References expecting_clicks_for_LPE, Inkscape::LivePathEffect::INVALID_LPE, polylines_only, polylines_paraxial, and Inkscape::UI::Tools::FreehandBase::waiting_LPE_type.
Referenced by Inkscape::UI::Tools::LpeTool::root_handler().
|
private |
Definition at line 163 of file pen-tool.h.
Referenced by _handleKeyPress().
|
private |
Definition at line 164 of file pen-tool.h.
Referenced by _handleKeyPress().
|
private |
Definition at line 162 of file pen-tool.h.
Referenced by _handleKeyPress().
|
private |
Definition at line 156 of file pen-tool.h.
Referenced by PenTool(), and ~PenTool().
|
private |
Definition at line 160 of file pen-tool.h.
Referenced by _redoLastPoint(), and _undoLastPoint().
|
private |
History of undone events.
Definition at line 159 of file pen-tool.h.
Referenced by _cancel(), _finish(), _finishSegment(), _redoLastPoint(), and _undoLastPoint().
bool Inkscape::UI::Tools::PenTool::bspline = false |
Definition at line 71 of file pen-tool.h.
Referenced by _bsplineSpiro(), _bsplineSpiroBuild(), _bsplineSpiroColor(), _bsplineSpiroEndAnchorOn(), _bsplineSpiroMotion(), _bsplineSpiroStartAnchor(), _handleButtonPress(), _handleButtonRelease(), _handleMotionNotify(), _lastpointToCurve(), _lastpointToLine(), _redrawAll(), _setSubsequentPoint(), _undoLastPoint(), and setPolylineMode().
CanvasItemPtr<CanvasItemCurve> Inkscape::UI::Tools::PenTool::cl0 |
Definition at line 82 of file pen-tool.h.
Referenced by _bsplineSpiroBuild(), _cancel(), _finish(), _redrawAll(), _setCtrl(), _undoLastPoint(), PenTool(), and ~PenTool().
CanvasItemPtr<CanvasItemCurve> Inkscape::UI::Tools::PenTool::cl1 |
Definition at line 83 of file pen-tool.h.
Referenced by _bsplineSpiroBuild(), _cancel(), _finish(), _redrawAll(), _setCtrl(), _undoLastPoint(), PenTool(), and ~PenTool().
CanvasItemPtr<CanvasItemCtrl> Inkscape::UI::Tools::PenTool::ctrl[4] |
Definition at line 77 of file pen-tool.h.
Referenced by _bsplineSpiroBuild(), _cancel(), _finish(), _handleButtonRelease(), _redrawAll(), _setCtrl(), _undoLastPoint(), PenTool(), and ~PenTool().
|
staticconstexpr |
Definition at line 78 of file pen-tool.h.
Referenced by PenTool().
bool Inkscape::UI::Tools::PenTool::events_disabled = false |
Definition at line 85 of file pen-tool.h.
Referenced by _disableEvents(), _enableEvents(), _handleButtonPress(), _handleButtonRelease(), and _handleMotionNotify().
unsigned int Inkscape::UI::Tools::PenTool::expecting_clicks_for_LPE = 0 |
Definition at line 73 of file pen-tool.h.
Referenced by _finish(), _handleButtonPress(), _handleButtonRelease(), waitForLPEMouseClicks(), and ~PenTool().
Mode Inkscape::UI::Tools::PenTool::mode = MODE_CLICK |
Definition at line 64 of file pen-tool.h.
Referenced by _handleButtonPress(), _handleButtonRelease(), _handleMotionNotify(), _setCtrl(), set(), Inkscape::UI::Tools::LpeTool::set(), and setPolylineMode().
gint Inkscape::UI::Tools::PenTool::npoints = 0 |
\invar npoints in {0, 2, 5}.
Definition at line 62 of file pen-tool.h.
Referenced by _bsplineSpiroMotion(), _bsplineSpiroOff(), _bsplineSpiroOn(), _endpointSnap(), _endpointSnapHandle(), _finish(), _finishSegment(), _handle2ButtonPress(), _handleButtonPress(), _handleButtonRelease(), _handleKeyPress(), _handleMotionNotify(), _lastpointMove(), _lastpointToCurve(), _lastpointToLine(), _redrawAll(), _resetColors(), _setCtrl(), _setInitialPoint(), _setSubsequentPoint(), _undoLastPoint(), and ~PenTool().
Geom::Point Inkscape::UI::Tools::PenTool::p_array[5] |
Definition at line 58 of file pen-tool.h.
Referenced by _bsplineSpiroBuild(), _bsplineSpiroEndAnchorOff(), _bsplineSpiroEndAnchorOn(), _bsplineSpiroMotion(), _bsplineSpiroOff(), _bsplineSpiroOn(), _endpointSnap(), _endpointSnapHandle(), _finishSegment(), _handleButtonPress(), _handleButtonRelease(), _handleMotionNotify(), _lastpointMove(), _lastpointToCurve(), _lastpointToLine(), _redoLastPoint(), _redrawAll(), _setAngleDistanceStatusMessage(), _setCtrl(), _setInitialPoint(), _setSubsequentPoint(), _setToNearestHorizVert(), and _undoLastPoint().
Geom::Point Inkscape::UI::Tools::PenTool::paraxial_angle |
Definition at line 68 of file pen-tool.h.
Referenced by _setToNearestHorizVert(), _undoLastPoint(), and nextParaxialDirection().
bool Inkscape::UI::Tools::PenTool::polylines_only = false |
Definition at line 66 of file pen-tool.h.
Referenced by _handleButtonPress(), _handleMotionNotify(), setPolylineMode(), and waitForLPEMouseClicks().
bool Inkscape::UI::Tools::PenTool::polylines_paraxial = false |
Definition at line 67 of file pen-tool.h.
Referenced by _endpointSnap(), _finishSegment(), _handleButtonPress(), _setSubsequentPoint(), _undoLastPoint(), setPolylineMode(), and waitForLPEMouseClicks().
Geom::Point Inkscape::UI::Tools::PenTool::previous |
Definition at line 59 of file pen-tool.h.
Referenced by _bsplineSpiroBuild(), _bsplineSpiroMotion(), _lastpointToCurve(), and _lastpointToLine().
bool Inkscape::UI::Tools::PenTool::spiro = false |
Definition at line 70 of file pen-tool.h.
Referenced by _bsplineSpiro(), _bsplineSpiroBuild(), _bsplineSpiroColor(), _bsplineSpiroMotion(), _bsplineSpiroStartAnchor(), _handleButtonPress(), _handleButtonRelease(), _handleMotionNotify(), _lastpointToCurve(), _lastpointToLine(), _redrawAll(), _setSubsequentPoint(), _undoLastPoint(), and setPolylineMode().
Definition at line 65 of file pen-tool.h.
Referenced by _bsplineSpiroMotion(), _cancel(), _endpointSnap(), _endpointSnapHandle(), _finish(), _finishSegment(), _handle2ButtonPress(), _handleButtonPress(), _handleButtonRelease(), _handleMotionNotify(), _setToNearestHorizVert(), _undoLastPoint(), nextParaxialDirection(), PenTool(), and ~PenTool().
SPLPEItem* Inkscape::UI::Tools::PenTool::waiting_item = nullptr |
Definition at line 75 of file pen-tool.h.
Referenced by _handleButtonRelease(), and ~PenTool().
Inkscape::LivePathEffect::Effect* Inkscape::UI::Tools::PenTool::waiting_LPE = nullptr |
Definition at line 74 of file pen-tool.h.
Referenced by _handleButtonRelease(), and hasWaitingLPE().