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

#include <select-tool.h>

Inheritance diagram for Inkscape::UI::Tools::SelectTool:
Inkscape::UI::Tools::ToolBase

Public Member Functions

 SelectTool (SPDesktop *desktop)
 
 ~SelectTool () override
 
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.
 
void updateDescriber (Selection *sel)
 Update the toolbar description to this selection.
 
- 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

bool moved = false
 
unsigned button_press_state = 0
 
std::vector< SPItem * > cycling_items
 
std::vector< SPItem * > cycling_items_cmp
 
SPItemcycling_cur_item = nullptr
 
bool cycling_wrap = true
 
SPItemitem = nullptr
 
CanvasItemgrabbed = nullptr
 
SelTrans_seltrans = nullptr
 
SelectionDescriber_describer = nullptr
 
char * no_selection_msg = nullptr
 
- 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
 

Private Member Functions

bool sp_select_context_abort ()
 
void sp_select_context_cycle_through_items (Selection *selection, ScrollEvent const &scroll_event)
 
void sp_select_context_reset_opacities ()
 

Static Private Member Functions

static std::pair< Rubberband::Mode, CanvasItemCtrlTypeget_default_rubberband_state ()
 Get the default rubberband state for select tool.
 

Private Attributes

bool _alt_on = false
 
bool _force_dragging = false
 
std::string _default_cursor
 

Additional Inherited Members

- 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.
 
- 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 28 of file select-tool.h.

Constructor & Destructor Documentation

◆ SelectTool()

◆ ~SelectTool()

Inkscape::UI::Tools::SelectTool::~SelectTool ( )
override

Member Function Documentation

◆ get_default_rubberband_state()

std::pair< Rubberband::Mode, CanvasItemCtrlType > Inkscape::UI::Tools::SelectTool::get_default_rubberband_state ( )
staticprivate

◆ item_handler()

bool Inkscape::UI::Tools::SelectTool::item_handler ( SPItem item,
CanvasEvent const &  event 
)
overridevirtual

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 197 of file select-tool.cpp.

References SPObject::document, Inkscape::UI::Tools::ToolBase::dragging, Inkscape::Preferences::get(), Inkscape::inspect_event(), item, sp_select_context_abort(), and Inkscape::UI::Tools::ToolBase::tolerance.

◆ root_handler()

◆ set()

void Inkscape::UI::Tools::SelectTool::set ( Preferences::Entry const &  val)
overridevirtual

◆ sp_select_context_abort()

◆ sp_select_context_cycle_through_items()

void Inkscape::UI::Tools::SelectTool::sp_select_context_cycle_through_items ( Selection selection,
ScrollEvent const &  scroll_event 
)
private

◆ sp_select_context_reset_opacities()

void Inkscape::UI::Tools::SelectTool::sp_select_context_reset_opacities ( )
private

◆ updateDescriber()

void Inkscape::UI::Tools::SelectTool::updateDescriber ( Inkscape::Selection selection)

Update the toolbar description to this selection.

Definition at line 1024 of file select-tool.cpp.

Member Data Documentation

◆ _alt_on

bool Inkscape::UI::Tools::SelectTool::_alt_on = false
private

Definition at line 60 of file select-tool.h.

◆ _default_cursor

std::string Inkscape::UI::Tools::SelectTool::_default_cursor
private

Definition at line 63 of file select-tool.h.

Referenced by SelectTool().

◆ _describer

SelectionDescriber* Inkscape::UI::Tools::SelectTool::_describer = nullptr

Definition at line 45 of file select-tool.h.

Referenced by SelectTool(), and ~SelectTool().

◆ _force_dragging

bool Inkscape::UI::Tools::SelectTool::_force_dragging = false
private

Definition at line 61 of file select-tool.h.

◆ _seltrans

SelTrans* Inkscape::UI::Tools::SelectTool::_seltrans = nullptr

Definition at line 44 of file select-tool.h.

Referenced by SelectTool(), set(), sp_select_context_abort(), and ~SelectTool().

◆ button_press_state

unsigned Inkscape::UI::Tools::SelectTool::button_press_state = 0

Definition at line 35 of file select-tool.h.

◆ cycling_cur_item

SPItem* Inkscape::UI::Tools::SelectTool::cycling_cur_item = nullptr

Definition at line 39 of file select-tool.h.

◆ cycling_items

std::vector<SPItem *> Inkscape::UI::Tools::SelectTool::cycling_items

Definition at line 37 of file select-tool.h.

◆ cycling_items_cmp

std::vector<SPItem *> Inkscape::UI::Tools::SelectTool::cycling_items_cmp

Definition at line 38 of file select-tool.h.

◆ cycling_wrap

bool Inkscape::UI::Tools::SelectTool::cycling_wrap = true

Definition at line 40 of file select-tool.h.

◆ grabbed

CanvasItem* Inkscape::UI::Tools::SelectTool::grabbed = nullptr

Definition at line 43 of file select-tool.h.

Referenced by ~SelectTool().

◆ item

SPItem* Inkscape::UI::Tools::SelectTool::item = nullptr

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

Referenced by item_handler(), sp_select_context_abort(), and ~SelectTool().

◆ moved

bool Inkscape::UI::Tools::SelectTool::moved = false

Definition at line 34 of file select-tool.h.

Referenced by sp_select_context_abort().

◆ no_selection_msg

char* Inkscape::UI::Tools::SelectTool::no_selection_msg = nullptr

Definition at line 46 of file select-tool.h.

Referenced by SelectTool(), and ~SelectTool().


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