Inkscape
Vector Graphics Editor
|
#include <mesh-tool.h>
Public Member Functions | |
MeshTool (SPDesktop *desktop) | |
~MeshTool () 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 |
Handles all keyboard and mouse input for meshs. | |
void | fit_mesh_in_bbox () |
Scale mesh to just fit into bbox of selected items. | |
void | corner_operation (MeshCornerOperation operation) |
Wrapper for various mesh operations that require a list of selected corner nodes. | |
![]() | |
ToolBase (SPDesktop *desktop, std::string &&prefs_path, std::string &&cursor_filename, bool uses_snap=true) | |
virtual | ~ToolBase () |
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 () |
Public Attributes | |
Geom::Point | origin |
Geom::Point | mousepoint_doc |
sigc::connection * | selcon |
![]() | |
std::unique_ptr< MessageContext > | message_context |
SelCue * | _selcue = nullptr |
GrDrag * | _grdrag = nullptr |
ShapeEditor * | shape_editor = nullptr |
bool | _uses_snap = false |
Private Member Functions | |
void | selection_changed (Inkscape::Selection *sel) |
void | select_next () |
void | select_prev () |
void | new_default () |
void | split_near_point (SPItem *item, Geom::Point mouse_p) |
Split row/column near the mouse point. | |
std::vector< GrDrag::ItemCurve * > | over_curve (Geom::Point event_p, bool first=true) |
Returns vector of control curves mouse is over. | |
Private Attributes | |
bool | cursor_addnode |
bool | show_handles |
bool | edit_fill |
bool | edit_stroke |
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 31 of file mesh-tool.h.
Inkscape::UI::Tools::MeshTool::MeshTool | ( | SPDesktop * | desktop | ) |
Definition at line 52 of file mesh-tool.cpp.
References Inkscape::Selection::connectChanged(), desktop, Inkscape::UI::Tools::ToolBase::enableGrDrag(), Inkscape::UI::Tools::ToolBase::enableSelectionCue(), Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), SPDesktop::getSelection(), selcon, selection_changed(), Inkscape::UI::Tools::sp_event_context_read(), and Inkscape::UI::Tools::ToolBase::tolerance.
|
override |
Definition at line 83 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::enableGrDrag(), and selcon.
void Inkscape::UI::Tools::MeshTool::corner_operation | ( | MeshCornerOperation | operation | ) |
Wrapper for various mesh operations that require a list of selected corner nodes.
Definition at line 231 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_grdrag, SPGradient::array, SPMeshNodeArray::color_pick(), SPMeshNodeArray::color_smooth(), SPObject::document, Inkscape::DocumentUndo::done(), Inkscape::FOR_FILL, Inkscape::FOR_STROKE, getGradient(), SPMeshNodeArray::insert(), items, GrDrag::local_change, MG_CORNER_COLOR_PICK, MG_CORNER_COLOR_SMOOTH, MG_CORNER_INSERT, MG_CORNER_SIDE_ARC, MG_CORNER_SIDE_TOGGLE, MG_CORNER_TENSOR_TOGGLE, POINT_MG_CORNER, SPObject::requestModified(), GrDrag::selected, SPMeshNodeArray::side_arc(), SPMeshNodeArray::side_toggle(), SPMeshNodeArray::tensor_toggle(), and SPMeshNodeArray::write().
void Inkscape::UI::Tools::MeshTool::fit_mesh_in_bbox | ( | ) |
Scale mesh to just fit into bbox of selected items.
Definition at line 351 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::DocumentUndo::done(), SPStyle::fill, SPItem::geometricBounds(), SPDesktop::getDocument(), SPStyle::getFillPaintServer(), SPDesktop::getSelection(), SPStyle::getStrokePaintServer(), item, Inkscape::ObjectSet::items(), SPStyle::stroke, SPObject::style, and SPItem::visualBounds().
|
private |
Definition at line 812 of file mesh-tool.cpp.
References Inkscape::XML::Node::appendChild(), SPGradient::array, SPMeshNodeArray::create(), Inkscape::XML::Document::createElement(), css, Inkscape::DocumentUndo::done(), Inkscape::FOR_FILL, Inkscape::Preferences::get(), SPDocument::getDefs(), Inkscape::Preferences::getEntry(), Inkscape::Preferences::getInt(), SPDocument::getObjectByRepr(), SPObject::getRepr(), SPDocument::getReprDoc(), Inkscape::ObjectSet::isEmpty(), Inkscape::Preferences::Entry::isSet(), items, Inkscape::ObjectSet::items(), Inkscape::NORMAL_MESSAGE, Inkscape::GC::release(), Inkscape::XML::Node::setAttribute(), Inkscape::Preferences::setBool(), sp_repr_css_attr_new(), sp_repr_css_attr_unref(), sp_repr_css_change_recursive(), sp_repr_css_set_property(), sp_style_set_property_url(), and Inkscape::WARNING_MESSAGE.
Referenced by root_handler().
|
private |
Returns vector of control curves mouse is over.
Returns only first if 'first' is true. event_p is in canvas (world) units.
Definition at line 196 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::UI::Tools::ToolBase::_grdrag, GrDrag::item_curves, mousepoint_doc, Inkscape::UI::Tools::ToolBase::tolerance, and SPDesktop::w2d().
Referenced by root_handler().
|
overridevirtual |
Handles all keyboard and mouse input for meshs.
Note: node/handle events are take care of elsewhere.
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 428 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::UI::Tools::ToolBase::_grdrag, GrDrag::deselectAll(), Inkscape::UI::Tools::ToolBase::dragging, Inkscape::FOR_FILL, Inkscape::FOR_STROKE, SnapManager::freeSnapReturnByRef(), Inkscape::Preferences::get(), Inkscape::Rubberband::get(), GrDrag::getDraggerFor(), SPDesktop::getNamedView(), SPDesktop::getSelection(), Inkscape::UI::Tools::has_mesh(), Inkscape::inspect_event(), Inkscape::UI::Tools::ToolBase::item_to_select, Inkscape::CanvasEvent::modifiers, new_default(), origin, over_curve(), POINT_MG_CORNER, Inkscape::UI::Tools::ToolBase::saveDragOrigin(), GrDrag::setSelected(), SnapManager::setup(), SPNamedView::snap_manager, Inkscape::SNAPSOURCE_NODE_HANDLE, Inkscape::UI::Tools::sp_event_context_find_item(), Inkscape::Rubberband::start(), Inkscape::UI::Tools::ToolBase::tolerance, SnapManager::unSetup(), and SPDesktop::w2d().
|
private |
Definition at line 178 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::UI::Tools::ToolBase::_grdrag, GrDragger::point, SPDesktop::scroll_to_point(), and GrDrag::select_next().
|
private |
Definition at line 185 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::UI::Tools::ToolBase::_grdrag, GrDragger::point, SPDesktop::scroll_to_point(), and GrDrag::select_prev().
|
private |
Definition at line 108 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::UI::Tools::ToolBase::_grdrag, SPDesktop::getSelection(), Inkscape::ObjectSet::isEmpty(), GrDrag::isNonEmpty(), Inkscape::ObjectSet::items(), Inkscape::UI::Tools::ToolBase::message_context, Inkscape::UI::Tools::ms_handle_descr, Inkscape::NORMAL_MESSAGE, GrDrag::numDraggers(), GrDrag::numSelected(), GrDrag::singleSelectedDraggerNumDraggables(), and GrDrag::singleSelectedDraggerSingleDraggableType().
Referenced by MeshTool().
|
overridevirtual |
Called by our pref_observer if a preference has been changed.
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 165 of file mesh-tool.cpp.
References edit_fill, edit_stroke, Inkscape::Preferences::Entry::getBool(), Inkscape::Preferences::Entry::getEntryName(), Inkscape::UI::Tools::ToolBase::set(), and show_handles.
|
private |
Split row/column near the mouse point.
Definition at line 216 of file mesh-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, GrDrag::addStopNearPoint(), SPDesktop::current_zoom(), Inkscape::DocumentUndo::done(), Inkscape::UI::Tools::ToolBase::get_drag(), SPDesktop::getDocument(), item, Inkscape::UI::Tools::ToolBase::tolerance, and GrDrag::updateDraggers().
|
private |
Definition at line 49 of file mesh-tool.h.
|
private |
Definition at line 51 of file mesh-tool.h.
Referenced by set().
|
private |
Definition at line 52 of file mesh-tool.h.
Referenced by set().
Geom::Point Inkscape::UI::Tools::MeshTool::mousepoint_doc |
Definition at line 39 of file mesh-tool.h.
Referenced by over_curve().
Geom::Point Inkscape::UI::Tools::MeshTool::origin |
Definition at line 37 of file mesh-tool.h.
Referenced by root_handler().
sigc::connection* Inkscape::UI::Tools::MeshTool::selcon |
Definition at line 41 of file mesh-tool.h.
Referenced by MeshTool(), and ~MeshTool().
|
private |
Definition at line 50 of file mesh-tool.h.
Referenced by set().