Inkscape
Vector Graphics Editor
|
#include <dynamic-base.h>
Public Member Functions | |
DynamicBase (SPDesktop *desktop, std::string &&prefs_path, std::string &&cursor_filename) | |
~DynamicBase () override | |
void | set (Preferences::Entry const &val) override |
Called by our pref_observer if a preference has been changed. | |
![]() | |
ToolBase (SPDesktop *desktop, std::string &&prefs_path, std::string &&cursor_filename, bool uses_snap=true) | |
virtual | ~ToolBase () |
virtual bool | root_handler (CanvasEvent const &event) |
virtual bool | item_handler (SPItem *item, CanvasEvent const &event) |
Handles item specific events. | |
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 () |
Protected Member Functions | |
Geom::Point | getViewPoint (Geom::Point const &n) const |
Geom::Point | getNormalizedPoint (Geom::Point const &v) const |
![]() | |
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. | |
Protected Attributes | |
Geom::Path | accumulated |
accumulated shape which ultimately goes in svg:path | |
std::vector< CanvasItemPtr< CanvasItemBpath > > | segments |
canvas items for "committed" segments | |
CanvasItemPtr< CanvasItemBpath > | currentshape |
canvas item for red "leading" segment | |
Geom::Path | currentcurve |
shape of red "leading" segment | |
Geom::Path | cal1 |
left edge of the stroke; combined to get accumulated | |
Geom::Path | cal2 |
right edge of the stroke; combined to get accumulated | |
Geom::Point | point1 [SAMPLING_SIZE] |
left edge points for this segment | |
Geom::Point | point2 [SAMPLING_SIZE] |
right edge points for this segment | |
int | npoints = 0 |
number of edge points for this segment | |
XML::Node * | repr = nullptr |
Geom::Point | cur |
Geom::Point | vel |
double | vel_max = 0.0 |
Geom::Point | acc |
Geom::Point | ang |
Geom::Point | last |
Geom::Point | del |
double | pressure = 1.0 |
double | xtilt = 0.0 |
double | ytilt = 0.0 |
bool | usepressure = false |
bool | usetilt = false |
double | mass = 0.3 |
double | drag = 1.0 |
double | angle = 30.0 |
double | width = 0.2 |
double | vel_thin = 0.1 |
double | flatness = 0.9 |
double | tremor = 0.0 |
double | cap_rounding = 0.0 |
bool | is_drawing = false |
bool | abs_width = false |
uses absolute width independent of zoom | |
![]() | |
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 |
Additional Inherited Members | |
![]() | |
std::unique_ptr< MessageContext > | message_context |
SelCue * | _selcue = nullptr |
GrDrag * | _grdrag = nullptr |
ShapeEditor * | shape_editor = nullptr |
bool | _uses_snap = false |
Definition at line 38 of file dynamic-base.h.
Inkscape::UI::Tools::DynamicBase::DynamicBase | ( | SPDesktop * | desktop, |
std::string && | prefs_path, | ||
std::string && | cursor_filename | ||
) |
Definition at line 24 of file dynamic-base.cpp.
|
overridedefault |
|
protected |
Definition at line 71 of file dynamic-base.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, and SPDesktop::get_display_area().
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_reset(), Inkscape::UI::Tools::CalligraphicTool::apply(), and Inkscape::UI::Tools::CalligraphicTool::reset().
|
protected |
Definition at line 78 of file dynamic-base.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, and SPDesktop::get_display_area().
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), and Inkscape::UI::Tools::CalligraphicTool::brush().
|
overridevirtual |
Called by our pref_observer if a preference has been changed.
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 31 of file dynamic-base.cpp.
References abs_width, angle, cap_rounding, drag, DRAG_MAX, DRAG_MIN, flatness, Inkscape::Preferences::get(), Inkscape::Util::UnitTable::get(), Inkscape::Preferences::Entry::getBool(), Inkscape::Preferences::Entry::getDouble(), Inkscape::Preferences::Entry::getEntryName(), Inkscape::Preferences::Entry::getInt(), Inkscape::Preferences::Entry::getPath(), Inkscape::UI::Tools::ToolBase::getPrefsPath(), Inkscape::Util::UnitTable::getUnit(), mass, tremor, usepressure, usetilt, vel_thin, and width.
Referenced by Inkscape::UI::Tools::CalligraphicTool::set().
|
protected |
uses absolute width independent of zoom
Definition at line 107 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::CalligraphicTool::brush(), and set().
|
protected |
Definition at line 81 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_reset(), Inkscape::UI::Tools::CalligraphicTool::apply(), and Inkscape::UI::Tools::CalligraphicTool::reset().
|
protected |
accumulated shape which ultimately goes in svg:path
Definition at line 48 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_cancel(), Inkscape::UI::Tools::CalligraphicTool::cancel(), Inkscape::UI::Tools::EraserTool::root_handler(), and Inkscape::UI::Tools::CalligraphicTool::root_handler().
|
protected |
Definition at line 82 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::EraserTool::_reset(), Inkscape::UI::Tools::CalligraphicTool::apply(), Inkscape::UI::Tools::CalligraphicTool::brush(), and Inkscape::UI::Tools::CalligraphicTool::reset().
|
protected |
Definition at line 96 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::CalligraphicTool::apply(), and set().
|
protected |
left edge of the stroke; combined to get accumulated
Definition at line 60 of file dynamic-base.h.
|
protected |
right edge of the stroke; combined to get accumulated
Definition at line 63 of file dynamic-base.h.
|
protected |
Definition at line 102 of file dynamic-base.h.
Referenced by set().
|
protected |
Definition at line 78 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::EraserTool::_reset(), Inkscape::UI::Tools::CalligraphicTool::apply(), Inkscape::UI::Tools::CalligraphicTool::brush(), and Inkscape::UI::Tools::CalligraphicTool::reset().
|
protected |
shape of red "leading" segment
Definition at line 57 of file dynamic-base.h.
|
protected |
canvas item for red "leading" segment
Definition at line 54 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::CalligraphicTool::CalligraphicTool(), and Inkscape::UI::Tools::EraserTool::EraserTool().
|
protected |
Definition at line 84 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::EraserTool::_reset(), Inkscape::UI::Tools::CalligraphicTool::brush(), and Inkscape::UI::Tools::CalligraphicTool::reset().
|
protected |
Definition at line 95 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::CalligraphicTool::apply(), and set().
|
protected |
Definition at line 100 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::CalligraphicTool::apply(), and set().
|
protected |
Definition at line 104 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_cancel(), Inkscape::UI::Tools::CalligraphicTool::cancel(), Inkscape::UI::Tools::EraserTool::EraserTool(), Inkscape::UI::Tools::EraserTool::root_handler(), and Inkscape::UI::Tools::CalligraphicTool::root_handler().
|
protected |
Definition at line 83 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_reset(), Inkscape::UI::Tools::CalligraphicTool::apply(), and Inkscape::UI::Tools::CalligraphicTool::reset().
|
protected |
Definition at line 94 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::CalligraphicTool::apply(), and set().
|
protected |
number of edge points for this segment
Definition at line 72 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::CalligraphicTool::brush(), Inkscape::UI::Tools::EraserTool::root_handler(), and Inkscape::UI::Tools::CalligraphicTool::root_handler().
|
protected |
left edge points for this segment
Definition at line 66 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), and Inkscape::UI::Tools::CalligraphicTool::brush().
|
protected |
right edge points for this segment
Definition at line 69 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), and Inkscape::UI::Tools::CalligraphicTool::brush().
|
protected |
Definition at line 87 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::EraserTool::_extinput(), Inkscape::UI::Tools::CalligraphicTool::brush(), and Inkscape::UI::Tools::CalligraphicTool::extinput().
|
protected |
Definition at line 75 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_cancel(), Inkscape::UI::Tools::CalligraphicTool::cancel(), Inkscape::UI::Tools::EraserTool::root_handler(), and Inkscape::UI::Tools::CalligraphicTool::root_handler().
|
protected |
canvas items for "committed" segments
Definition at line 51 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_cancel(), and Inkscape::UI::Tools::CalligraphicTool::cancel().
|
protected |
Definition at line 101 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::CalligraphicTool::brush(), and set().
|
protected |
Definition at line 92 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::CalligraphicTool::brush(), and set().
|
protected |
Definition at line 93 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::CalligraphicTool::apply(), and set().
|
protected |
Definition at line 79 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::EraserTool::_reset(), Inkscape::UI::Tools::CalligraphicTool::apply(), Inkscape::UI::Tools::CalligraphicTool::brush(), and Inkscape::UI::Tools::CalligraphicTool::reset().
|
protected |
Definition at line 80 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_reset(), Inkscape::UI::Tools::CalligraphicTool::apply(), and Inkscape::UI::Tools::CalligraphicTool::reset().
|
protected |
Definition at line 99 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::CalligraphicTool::brush(), and set().
|
protected |
Definition at line 97 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_brush(), Inkscape::UI::Tools::CalligraphicTool::brush(), and set().
|
protected |
Definition at line 88 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_extinput(), Inkscape::UI::Tools::CalligraphicTool::apply(), and Inkscape::UI::Tools::CalligraphicTool::extinput().
|
protected |
Definition at line 89 of file dynamic-base.h.
Referenced by Inkscape::UI::Tools::EraserTool::_apply(), Inkscape::UI::Tools::EraserTool::_extinput(), Inkscape::UI::Tools::CalligraphicTool::apply(), and Inkscape::UI::Tools::CalligraphicTool::extinput().