Inkscape
Vector Graphics Editor
|
#include <pages-tool.h>
Public Member Functions | |
PagesTool (SPDesktop *desktop) | |
~PagesTool () override | |
bool | root_handler (CanvasEvent const &event) override |
void | menu_popup (CanvasEvent const &event, SPObject *obj=nullptr) override |
Create popup menu and tell Gtk to show it. | |
void | switching_away (std::string const &new_tool) override |
![]() | |
ToolBase (SPDesktop *desktop, std::string &&prefs_path, std::string &&cursor_filename, bool uses_snap=true) | |
virtual | ~ToolBase () |
virtual void | set (Preferences::Entry const &val) |
Called by our pref_observer if a preference has been changed. | |
virtual bool | item_handler (SPItem *item, CanvasEvent const &event) |
Handles item specific events. | |
virtual bool | can_undo (bool redo=false) |
virtual bool | is_ready () const |
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 () |
Private Member Functions | |
void | selectionChanged (SPDocument *doc, SPPage *page) |
void | connectDocument (SPDocument *doc) |
SPPage * | pageUnder (Geom::Point pt, bool retain_selected=true) |
Find a page under the cursor point. | |
bool | viewboxUnder (Geom::Point pt) |
Returns true if the document contains no pages AND the point is within the document viewbox. | |
void | addDragShapes (SPPage *page, Geom::Affine tr) |
Add all the shapes needed to see it being dragged. | |
void | addDragShape (SPItem *item, Geom::Affine tr) |
Add an SPItem to the things being dragged. | |
void | addDragShape (Geom::PathVector &&pth, Geom::Affine tr) |
Add a shape to the set of dragging shapes, these are deleted when dragging stops. | |
void | clearDragShapes () |
Remove all drag shapes from the canvas. | |
Geom::Point | getSnappedResizePoint (Geom::Point point, guint state, Geom::Point origin, SPObject *target=nullptr) |
Resize snapping allows knot and tool point snapping consistency. | |
void | resizeKnotSet (Geom::Rect rect) |
void | resizeKnotMoved (SPKnot *knot, Geom::Point const &ppointer, guint state) |
void | resizeKnotFinished (SPKnot *knot, guint state) |
void | pageModified (SPObject *object, guint flags) |
void | marginKnotSet (Geom::Rect margin_rect) |
bool | marginKnotMoved (SPKnot *knot, Geom::Point *point, guint state) |
void | marginKnotFinished (SPKnot *knot, guint state) |
void | updateOfsetKnot () |
bool | offsetKnotMoved (SPKnot *knot, Geom::Point *point, guint state) |
void | offsetKnotFinished (SPKnot *knot, guint state) |
void | grabPage (SPPage *target) |
Creates the right snapping setup for dragging items around. | |
Geom::Affine | moveTo (Geom::Point xy, bool snap) |
Static Private Member Functions | |
static Geom::Point | middleOfSide (int side, const Geom::Rect &rect) |
Private Attributes | |
sigc::connection | _selector_changed_connection |
sigc::connection | _page_modified_connection |
sigc::connection | _doc_replaced_connection |
sigc::connection | _doc_root_connection |
sigc::connection | _zoom_connection |
bool | dragging_viewbox = false |
bool | mouse_is_pressed = false |
Geom::Point | drag_origin_w |
Geom::Point | drag_origin_dt |
int | drag_tolerance = 5 |
std::vector< SPKnot * > | resize_knots |
std::vector< SPKnot * > | margin_knots |
SPKnot * | offset_knot = nullptr |
SPPage * | highlight_item = nullptr |
SPPage * | dragging_item = nullptr |
std::optional< Geom::Rect > | on_screen_rect |
On-screen rectangle, in desktop coordinates. | |
CanvasItemPtr< CanvasItemRect > | visual_box |
CanvasItemPtr< CanvasItemGroup > | drag_group |
std::vector< Inkscape::CanvasItemBpath * > | drag_shapes |
std::vector< Inkscape::SnapCandidatePoint > | _bbox_points |
std::unique_ptr< Inkscape::SelectionState > | _selection_state |
Additional Inherited Members | |
![]() | |
std::unique_ptr< MessageContext > | message_context |
SelCue * | _selcue = nullptr |
GrDrag * | _grdrag = nullptr |
ShapeEditor * | shape_editor = nullptr |
bool | _uses_snap = false |
![]() | |
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 42 of file pages-tool.h.
Inkscape::UI::Tools::PagesTool::PagesTool | ( | SPDesktop * | desktop | ) |
Definition at line 40 of file pages-tool.cpp.
References _doc_replaced_connection, _selection_state, _zoom_connection, Inkscape::CANVAS_ITEM_CTRL_TYPE_CENTER, Inkscape::CANVAS_ITEM_CTRL_TYPE_MARGIN, Inkscape::CANVAS_ITEM_CTRL_TYPE_SIZER, Inkscape::ObjectSet::clear(), connectDocument(), SPDesktop::connectDocumentReplaced(), desktop, drag_group, drag_tolerance, Inkscape::Preferences::get(), Inkscape::UI::Tools::ToolBase::get_cursor(), SPDesktop::getCanvas(), SPDesktop::getCanvasControls(), SPDesktop::getCanvasTemp(), SPDesktop::getDocument(), Inkscape::Preferences::getIntLimited(), SPDocument::getPageManager(), SPDesktop::getSelection(), Inkscape::Selection::getState(), Inkscape::PageManager::hasPages(), SPKnot::hide(), margin_knots, marginKnotFinished(), marginKnotMoved(), offset_knot, offsetKnotFinished(), offsetKnotMoved(), SPKnot::request_signal, resize_knots, resizeKnotFinished(), resizeKnotMoved(), SPKnot::setAnchor(), SPKnot::setCursor(), SPDesktop::signal_zoom_changed, SP_ANCHOR_CENTER, SP_KNOT_STATE_DRAGGING, SP_KNOT_STATE_MOUSEOVER, SPKnot::ungrabbed_signal, SPKnot::updateCtrl(), and visual_box.
|
override |
Definition at line 111 of file pages-tool.cpp.
References _doc_replaced_connection, _zoom_connection, connectDocument(), drag_group, drag_shapes, offset_knot, resize_knots, Inkscape::UI::Tools::ToolBase::ungrabCanvasEvents(), and visual_box.
|
private |
Add a shape to the set of dragging shapes, these are deleted when dragging stops.
Definition at line 569 of file pages-tool.cpp.
References SP_WIND_RULE_EVENODD.
|
private |
Add an SPItem to the things being dragged.
Definition at line 559 of file pages-tool.cpp.
References SPItem::i2dt_affine(), item, and item_to_outline().
|
private |
Add all the shapes needed to see it being dragged.
Definition at line 536 of file pages-tool.cpp.
References Inkscape::Preferences::get(), SPItem::isLocked(), item, and page.
|
private |
Remove all drag shapes from the canvas.
Definition at line 580 of file pages-tool.cpp.
|
private |
Definition at line 619 of file pages-tool.cpp.
References SPObject::connectModified(), Inkscape::PageManager::connectPageSelected(), SPDocument::getPageManager(), SPDocument::getRoot(), and page.
Referenced by PagesTool(), and ~PagesTool().
|
private |
Resize snapping allows knot and tool point snapping consistency.
Definition at line 240 of file pages-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::SnapCandidatePoint::addOrigin(), SnapManager::freeSnap(), SPDesktop::getNamedView(), Inkscape::SnappedPoint::getPoint(), origin, SnapManager::setup(), SPNamedView::snap_manager, Inkscape::SNAPSOURCE_PAGE_CORNER, and SnapManager::unSetup().
Referenced by marginKnotMoved(), offsetKnotMoved(), resizeKnotMoved(), and root_handler().
|
private |
Creates the right snapping setup for dragging items around.
Definition at line 491 of file pages-tool.cpp.
References Inkscape::getBBoxPoints(), SPPage::getDesktopRect(), Inkscape::SNAPSOURCE_PAGE_CENTER, Inkscape::SNAPSOURCE_PAGE_CORNER, Inkscape::SNAPSOURCE_UNDEFINED, and Inkscape::SNAPTARGET_UNDEFINED.
|
private |
Definition at line 302 of file pages-tool.cpp.
Referenced by PagesTool().
|
private |
Definition at line 267 of file pages-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::Modifiers::Modifier::active(), delta, SPKnot::drag_origin, Inkscape::PageManager::enablePages(), Inkscape::Modifiers::Modifier::get(), SPDesktop::getDocument(), SPDocument::getPageManager(), getSnappedResizePoint(), INDEX_OF(), margin_knots, Inkscape::DocumentUndo::maybeDone(), middleOfSide(), Inkscape::Modifiers::MOVE_SNAPPING, page, scale, SPKnot::setPosition(), Inkscape::Modifiers::TRANS_CONFINE, Geom::X, and Geom::Y.
Referenced by PagesTool().
|
private |
Definition at line 159 of file pages-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, SPDesktop::doc2dt(), margin_knots, and middleOfSide().
|
overridevirtual |
Create popup menu and tell Gtk to show it.
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 465 of file pages-tool.cpp.
References Inkscape::inspect_event(), and page.
Referenced by root_handler().
|
staticprivate |
Definition at line 170 of file pages-tool.cpp.
References Geom::GenericRect< C >::corner(), and Geom::middle_point().
Referenced by marginKnotMoved(), and marginKnotSet().
|
private |
Definition at line 501 of file pages-tool.cpp.
References Inkscape::PureTransform::best_snapped_point, Inkscape::SnapPreferences::clearTargetMask(), SnapManager::getNamedView(), Inkscape::SnappedPoint::getSnapped(), Inkscape::PureTranslate::getTranslationSnapped(), Inkscape::SnapPreferences::setTargetMask(), SnapManager::setup(), SPNamedView::snap_manager, SnapManager::snapprefs, Inkscape::SNAPTARGET_ALIGNMENT_CATEGORY, Inkscape::SNAPTARGET_ALIGNMENT_PAGE_EDGE_CENTER, Inkscape::SNAPTARGET_ALIGNMENT_PAGE_EDGE_CORNER, Inkscape::SNAPTARGET_GRID_INTERSECTION, Inkscape::SNAPTARGET_GUIDE, Inkscape::SNAPTARGET_GUIDE_INTERSECTION, Inkscape::SNAPTARGET_PAGE_EDGE_CENTER, Inkscape::SNAPTARGET_PAGE_EDGE_CORNER, SnapManager::snapTransformed(), and SnapManager::unSetup().
|
private |
Definition at line 225 of file pages-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, SPDesktop::getDocument(), SPDocument::getRoot(), Inkscape::DocumentUndo::maybeDone(), SPKnot::position(), root, Geom::X, and Geom::Y.
Referenced by PagesTool().
|
private |
Definition at line 215 of file pages-tool.cpp.
References Inkscape::Modifiers::Modifier::get(), getSnappedResizePoint(), Inkscape::Modifiers::MOVE_SNAPPING, SPKnot::position(), and SPKnot::setPosition().
Referenced by PagesTool().
|
private |
Definition at line 679 of file pages-tool.cpp.
References page.
|
private |
Find a page under the cursor point.
Definition at line 591 of file pages-tool.cpp.
|
private |
Definition at line 254 of file pages-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::DocumentUndo::done(), SPDesktop::getDocument(), SPDocument::getPageManager(), Inkscape::PageManager::getSelected(), mouse_is_pressed, on_screen_rect, page, and visual_box.
Referenced by PagesTool().
|
private |
< Page rectangle in desktop coordinates.
Definition at line 175 of file pages-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Geom::GenericRect< C >::corner(), SPDesktop::getDocument(), SPDocument::getPageManager(), Inkscape::PageManager::getSelected(), getSnappedResizePoint(), index, mouse_is_pressed, on_screen_rect, page, SPKnot::position(), resize_knots, Geom::GenericRect< C >::setMax(), Geom::GenericRect< C >::setMin(), Inkscape::UI::start, visual_box, Geom::X, and Geom::Y.
Referenced by PagesTool().
|
private |
Definition at line 151 of file pages-tool.cpp.
References Geom::GenericRect< C >::corner(), and resize_knots.
|
overridevirtual |
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 307 of file pages-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, drag_origin_dt, dragging_viewbox, SPDesktop::getDocument(), SPDocument::getPageManager(), getSnappedResizePoint(), Inkscape::inspect_event(), menu_popup(), Inkscape::CanvasEvent::modifiers, Inkscape::UI::Tools::ToolBase::set_cursor(), and viewboxUnder().
|
private |
Definition at line 638 of file pages-tool.cpp.
References SPDocument::connectModified(), page, and SPDocument::preferredBounds().
|
overridevirtual |
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 480 of file pages-tool.cpp.
|
private |
Definition at line 135 of file pages-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, SPDesktop::doc2dt(), SPDesktop::getDocument(), SPKnot::hide(), SPKnot::moveto(), offset_knot, root, and SPKnot::show().
|
private |
Returns true if the document contains no pages AND the point is within the document viewbox.
Definition at line 609 of file pages-tool.cpp.
Referenced by root_handler().
|
private |
Definition at line 100 of file pages-tool.h.
|
private |
Definition at line 81 of file pages-tool.h.
Referenced by PagesTool(), and ~PagesTool().
|
private |
Definition at line 82 of file pages-tool.h.
|
private |
Definition at line 80 of file pages-tool.h.
|
private |
Definition at line 101 of file pages-tool.h.
Referenced by PagesTool().
|
private |
Definition at line 79 of file pages-tool.h.
|
private |
Definition at line 83 of file pages-tool.h.
Referenced by PagesTool(), and ~PagesTool().
|
private |
Definition at line 98 of file pages-tool.h.
Referenced by PagesTool(), and ~PagesTool().
|
private |
Definition at line 88 of file pages-tool.h.
Referenced by root_handler().
|
private |
Definition at line 87 of file pages-tool.h.
|
private |
Definition at line 99 of file pages-tool.h.
Referenced by ~PagesTool().
|
private |
Definition at line 89 of file pages-tool.h.
Referenced by PagesTool().
|
private |
Definition at line 95 of file pages-tool.h.
|
private |
Definition at line 85 of file pages-tool.h.
Referenced by root_handler().
|
private |
Definition at line 94 of file pages-tool.h.
|
private |
Definition at line 92 of file pages-tool.h.
Referenced by marginKnotMoved(), marginKnotSet(), and PagesTool().
|
private |
Definition at line 86 of file pages-tool.h.
Referenced by resizeKnotFinished(), and resizeKnotMoved().
|
private |
Definition at line 93 of file pages-tool.h.
Referenced by PagesTool(), updateOfsetKnot(), and ~PagesTool().
|
private |
On-screen rectangle, in desktop coordinates.
Definition at line 96 of file pages-tool.h.
Referenced by resizeKnotFinished(), and resizeKnotMoved().
|
private |
Definition at line 91 of file pages-tool.h.
Referenced by PagesTool(), resizeKnotMoved(), resizeKnotSet(), and ~PagesTool().
|
private |
Definition at line 97 of file pages-tool.h.
Referenced by PagesTool(), resizeKnotFinished(), resizeKnotMoved(), and ~PagesTool().