Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::Tools::LpeTool Class Reference

#include <lpe-tool.h>

Inheritance diagram for Inkscape::UI::Tools::LpeTool:
Inkscape::UI::Tools::PenTool Inkscape::UI::Tools::FreehandBase Inkscape::UI::Tools::ToolBase

Public Member Functions

 LpeTool (SPDesktop *desktop)
 
 ~LpeTool () override
 
void switch_mode (LivePathEffect::EffectType type)
 
void reset_limiting_bbox ()
 
void create_measuring_items (Selection *selection=nullptr)
 
void delete_measuring_items ()
 
void update_measuring_items ()
 
void show_measuring_info (bool show=true)
 
- Public Member Functions inherited from Inkscape::UI::Tools::PenTool
 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)
 
- Public Member Functions inherited from Inkscape::UI::Tools::FreehandBase
 FreehandBase (SPDesktop *desktop, std::string &&prefs_path, std::string &&cursor_filename)
 
 ~FreehandBase () override
 
std::optional< Geom::Pointred_curve_get_last_point () const
 
void onSelectionModified ()
 
- Public Member Functions inherited from Inkscape::UI::Tools::ToolBase
 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.
 
MessageContextdefaultMessageContext () const
 
SPDesktopgetDesktop () const
 
SPGroupcurrentLayer () 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.
 
GrDragget_drag ()
 

Public Attributes

LivePathEffect::EffectType mode = LivePathEffect::BEND_PATH
 
- Public Attributes inherited from Inkscape::UI::Tools::PenTool
Geom::Point p_array [5]
 
Geom::Point previous
 
gint npoints = 0
 \invar npoints in {0, 2, 5}.
 
Mode mode = MODE_CLICK
 
State state = POINT
 
bool polylines_only = false
 
bool polylines_paraxial = false
 
Geom::Point paraxial_angle
 
bool spiro = false
 
bool bspline = false
 
unsigned int expecting_clicks_for_LPE = 0
 
Inkscape::LivePathEffect::Effectwaiting_LPE = nullptr
 
SPLPEItemwaiting_item = nullptr
 
CanvasItemPtr< CanvasItemCtrlctrl [4]
 
CanvasItemPtr< CanvasItemCurvecl0
 
CanvasItemPtr< CanvasItemCurvecl1
 
bool events_disabled = false
 
- Public Attributes inherited from Inkscape::UI::Tools::FreehandBase
Selectionselection = nullptr
 
CanvasItemPtr< CanvasItemBpathred_bpath
 
Geom::PathVector red_curve
 
CanvasItemPtr< CanvasItemBpathblue_bpath
 
Geom::PathVector blue_curve
 
std::vector< CanvasItemPtr< CanvasItemBpath > > green_bpaths
 
std::shared_ptr< Geom::PathVectorgreen_curve
 
std::unique_ptr< SPDrawAnchorgreen_anchor
 
bool green_closed = false
 
SPItemwhite_item = nullptr
 
std::vector< std::shared_ptr< Geom::PathVector > > white_curves
 
std::vector< std::unique_ptr< SPDrawAnchor > > white_anchors
 
std::shared_ptr< Geom::PathVectorsa_overwrited
 
SPDrawAnchorsa = nullptr
 
SPDrawAnchorea = nullptr
 
LivePathEffect::EffectType waiting_LPE_type = LivePathEffect::INVALID_LPE
 
sigc::connection sel_changed_connection
 
sigc::connection sel_modified_connection
 
bool red_curve_is_valid = false
 
bool anchor_statusbar = false
 
bool tablet_enabled = false
 
bool is_tablet = false
 
double pressure = 1.0
 
- Public Attributes inherited from Inkscape::UI::Tools::ToolBase
std::unique_ptr< MessageContextmessage_context
 
SelCue_selcue = nullptr
 
GrDrag_grdrag = nullptr
 
ShapeEditorshape_editor = nullptr
 
bool _uses_snap = false
 

Protected Member Functions

void set (Preferences::Entry const &val) override
 Called by our pref_observer if a preference has been changed.
 
bool root_handler (CanvasEvent const &event) override
 
bool item_handler (SPItem *item, CanvasEvent const &event) override
 Handles item specific events.
 
- Protected Member Functions inherited from Inkscape::UI::Tools::PenTool
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.
 
- Protected Member Functions inherited from Inkscape::UI::Tools::FreehandBase
void _attachSelection ()
 
- Protected Member Functions inherited from Inkscape::UI::Tools::ToolBase
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

void selection_changed (Selection *selection)
 Callback that processes the "changed" signal on the selection; destroys old and creates new nodepath and reassigns listeners to the new selected item's repr.
 

Private Attributes

std::unique_ptr< ShapeEditorshape_editor
 
CanvasItemPtr< CanvasItemRectcanvas_bbox
 
std::unordered_map< SPPath *, CanvasItemPtr< CanvasItemText > > measuring_items
 
sigc::scoped_connection sel_changed_connection
 

Additional Inherited Members

- Public Types inherited from Inkscape::UI::Tools::PenTool
enum  Mode { MODE_CLICK , MODE_DRAG }
 
enum  State {
  POINT , CONTROL , CLOSE , STOP ,
  DEAD
}
 
- Static Public Attributes inherited from Inkscape::UI::Tools::PenTool
static constexpr std::array< CanvasItemCtrlType, 4 > ctrl_types
 
- Protected Attributes inherited from Inkscape::UI::Tools::FreehandBase
uint32_t red_color = 0xff00007f
 
uint32_t blue_color = 0x0000ff7f
 
uint32_t green_color = 0x00ff007f
 
uint32_t highlight_color = 0x0000007f
 
- Protected Attributes inherited from Inkscape::UI::Tools::ToolBase
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
 
SPItemitem_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
 

Detailed Description

Definition at line 42 of file lpe-tool.h.

Constructor & Destructor Documentation

◆ LpeTool()

◆ ~LpeTool()

Inkscape::UI::Tools::LpeTool::~LpeTool ( )
overridedefault

Member Function Documentation

◆ create_measuring_items()

◆ delete_measuring_items()

void Inkscape::UI::Tools::LpeTool::delete_measuring_items ( )

Definition at line 328 of file lpe-tool.cpp.

◆ item_handler()

bool Inkscape::UI::Tools::LpeTool::item_handler ( SPItem item,
CanvasEvent const &  event 
)
overrideprotectedvirtual

Handles item specific events.

Gets called from Gdk.

Only reacts to right mouse button at the moment.

Todo:
Fixme: do context sensitive popup menu on items.

Reimplemented from Inkscape::UI::Tools::ToolBase.

Definition at line 102 of file lpe-tool.cpp.

References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::Selection::add(), Inkscape::ObjectSet::clear(), SPDesktop::getSelection(), Inkscape::inspect_event(), item, Inkscape::UI::Tools::PenTool::item_handler(), and Inkscape::UI::Tools::FreehandBase::selection.

◆ reset_limiting_bbox()

void Inkscape::UI::Tools::LpeTool::reset_limiting_bbox ( )

◆ root_handler()

◆ selection_changed()

void Inkscape::UI::Tools::LpeTool::selection_changed ( Selection selection)
private

Callback that processes the "changed" signal on the selection; destroys old and creates new nodepath and reassigns listeners to the new selected item's repr.

Definition at line 88 of file lpe-tool.cpp.

References Inkscape::UI::Tools::FreehandBase::selection, shape_editor, and Inkscape::ObjectSet::singleItem().

Referenced by LpeTool().

◆ set()

void Inkscape::UI::Tools::LpeTool::set ( Preferences::Entry const &  val)
overrideprotectedvirtual

◆ show_measuring_info()

void Inkscape::UI::Tools::LpeTool::show_measuring_info ( bool  show = true)

Definition at line 361 of file lpe-tool.cpp.

◆ switch_mode()

void Inkscape::UI::Tools::LpeTool::switch_mode ( LivePathEffect::EffectType  type)

Definition at line 216 of file lpe-tool.cpp.

References index, Inkscape::UI::Tools::lpetool_mode_to_index(), and mode.

Referenced by LpeTool().

◆ update_measuring_items()

Member Data Documentation

◆ canvas_bbox

CanvasItemPtr<CanvasItemRect> Inkscape::UI::Tools::LpeTool::canvas_bbox
private

Definition at line 66 of file lpe-tool.h.

◆ measuring_items

std::unordered_map<SPPath*, CanvasItemPtr<CanvasItemText> > Inkscape::UI::Tools::LpeTool::measuring_items
private

Definition at line 68 of file lpe-tool.h.

◆ mode

LivePathEffect::EffectType Inkscape::UI::Tools::LpeTool::mode = LivePathEffect::BEND_PATH

Definition at line 55 of file lpe-tool.h.

Referenced by root_handler().

◆ sel_changed_connection

sigc::scoped_connection Inkscape::UI::Tools::LpeTool::sel_changed_connection
private

Definition at line 70 of file lpe-tool.h.

Referenced by LpeTool().

◆ shape_editor

std::unique_ptr<ShapeEditor> Inkscape::UI::Tools::LpeTool::shape_editor
private

Definition at line 65 of file lpe-tool.h.

Referenced by LpeTool(), and selection_changed().


The documentation for this class was generated from the following files: