Inkscape
Vector Graphics Editor
|
#include <select-tool.h>
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. | |
![]() | |
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 () |
Public Attributes | |
bool | moved = false |
unsigned | button_press_state = 0 |
std::vector< SPItem * > | cycling_items |
std::vector< SPItem * > | cycling_items_cmp |
SPItem * | cycling_cur_item = nullptr |
bool | cycling_wrap = true |
SPItem * | item = nullptr |
CanvasItem * | grabbed = nullptr |
SelTrans * | _seltrans = nullptr |
SelectionDescriber * | _describer = nullptr |
char * | no_selection_msg = nullptr |
![]() | |
std::unique_ptr< MessageContext > | message_context |
SelCue * | _selcue = nullptr |
GrDrag * | _grdrag = nullptr |
ShapeEditor * | shape_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, CanvasItemCtrlType > | get_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 | |
![]() | |
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. | |
![]() | |
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 |
Definition at line 28 of file select-tool.h.
Inkscape::UI::Tools::SelectTool::SelectTool | ( | SPDesktop * | desktop | ) |
Definition at line 55 of file select-tool.cpp.
References _default_cursor, _describer, _seltrans, desktop, Inkscape::UI::Tools::ToolBase::enableGrDrag(), Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), SPDesktop::getSelection(), SPDesktop::messageStack(), no_selection_msg, Inkscape::Modifiers::SELECT_ADD_TO, Inkscape::Modifiers::SELECT_CYCLE, and Inkscape::UI::Tools::sp_event_context_read().
|
override |
Definition at line 86 of file select-tool.cpp.
References _describer, _seltrans, Inkscape::UI::Tools::ToolBase::enableGrDrag(), grabbed, item, no_selection_msg, sp_object_unref(), and Inkscape::CanvasItem::ungrab().
|
staticprivate |
Get the default rubberband state for select tool.
Definition at line 1032 of file select-tool.cpp.
References Inkscape::Rubberband::default_handle, Inkscape::Rubberband::default_mode, Inkscape::Preferences::get(), mode, Inkscape::RUBBERBAND_TOUCHRECT, and Inkscape::Rubberband::TOUCHRECT.
|
overridevirtual |
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 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.
|
overridevirtual |
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 393 of file select-tool.cpp.
References Inkscape::BUTTON_PRESS, Inkscape::BUTTON_RELEASE, SPObject::document, Inkscape::UI::Tools::drag_escaped, Inkscape::Preferences::get(), Inkscape::Rubberband::get(), Inkscape::inspect_event(), item, Inkscape::KEY_PRESS, Inkscape::KEY_RELEASE, mode, Inkscape::CanvasEvent::modifiers, Inkscape::MOTION, Inkscape::UI::Tools::rb_escaped, Inkscape::RUBBERBAND_TOUCHPATH_SELECT, Inkscape::Modifiers::SELECT_TOUCH_PATH, and Inkscape::Rubberband::TOUCHPATH.
|
overridevirtual |
Called by our pref_observer if a preference has been changed.
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 108 of file select-tool.cpp.
References _seltrans, Inkscape::Preferences::Entry::getEntryName(), Inkscape::Preferences::Entry::getString(), Inkscape::SelTrans::setShow(), Inkscape::SelTrans::SHOW_CONTENT, and Inkscape::SelTrans::SHOW_OUTLINE.
|
private |
Definition at line 120 of file select-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, _seltrans, Inkscape::MessageContext::clear(), Inkscape::UI::Tools::ToolBase::defaultMessageContext(), Inkscape::UI::Tools::ToolBase::discard_delayed_snap_event(), SPObject::document, Inkscape::UI::Tools::drag_escaped, Inkscape::UI::Tools::ToolBase::dragging, Inkscape::MessageStack::flash(), Inkscape::Rubberband::get(), SPDesktop::getDocument(), item, SPDesktop::messageStack(), moved, Inkscape::NORMAL_MESSAGE, Inkscape::UI::Tools::rb_escaped, sp_object_unref(), Inkscape::Rubberband::stop(), Inkscape::DocumentUndo::undo(), and Inkscape::SelTrans::ungrab().
Referenced by item_handler().
|
private |
Definition at line 315 of file select-tool.cpp.
References Inkscape::Selection::add(), scroll_event(), Inkscape::Modifiers::SELECT_ADD_TO, Inkscape::Selection::set(), and Inkscape::DrawingItem::setOpacity().
|
private |
Definition at line 379 of file select-tool.cpp.
References SPItem::get_arenaitem(), item, SPStyle::opacity, Inkscape::DrawingItem::setOpacity(), and SPObject::style.
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.
|
private |
Definition at line 60 of file select-tool.h.
|
private |
Definition at line 63 of file select-tool.h.
Referenced by SelectTool().
SelectionDescriber* Inkscape::UI::Tools::SelectTool::_describer = nullptr |
Definition at line 45 of file select-tool.h.
Referenced by SelectTool(), and ~SelectTool().
|
private |
Definition at line 61 of file select-tool.h.
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().
unsigned Inkscape::UI::Tools::SelectTool::button_press_state = 0 |
Definition at line 35 of file select-tool.h.
SPItem* Inkscape::UI::Tools::SelectTool::cycling_cur_item = nullptr |
Definition at line 39 of file select-tool.h.
std::vector<SPItem *> Inkscape::UI::Tools::SelectTool::cycling_items |
Definition at line 37 of file select-tool.h.
std::vector<SPItem *> Inkscape::UI::Tools::SelectTool::cycling_items_cmp |
Definition at line 38 of file select-tool.h.
bool Inkscape::UI::Tools::SelectTool::cycling_wrap = true |
Definition at line 40 of file select-tool.h.
CanvasItem* Inkscape::UI::Tools::SelectTool::grabbed = nullptr |
Definition at line 43 of file select-tool.h.
Referenced by ~SelectTool().
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().
bool Inkscape::UI::Tools::SelectTool::moved = false |
Definition at line 34 of file select-tool.h.
Referenced by sp_select_context_abort().
char* Inkscape::UI::Tools::SelectTool::no_selection_msg = nullptr |
Definition at line 46 of file select-tool.h.
Referenced by SelectTool(), and ~SelectTool().