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

#include <pages-tool.h>

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

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
 
- 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 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.
 
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 ()
 

Private Member Functions

void selectionChanged (SPDocument *doc, SPPage *page)
 
void connectDocument (SPDocument *doc)
 
SPPagepageUnder (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
 
SPKnotoffset_knot = nullptr
 
SPPagehighlight_item = nullptr
 
SPPagedragging_item = nullptr
 
std::optional< Geom::Recton_screen_rect
 On-screen rectangle, in desktop coordinates.
 
CanvasItemPtr< CanvasItemRectvisual_box
 
CanvasItemPtr< CanvasItemGroupdrag_group
 
std::vector< Inkscape::CanvasItemBpath * > drag_shapes
 
std::vector< Inkscape::SnapCandidatePoint_bbox_points
 
std::unique_ptr< Inkscape::SelectionState_selection_state
 

Additional Inherited Members

- 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 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 42 of file pages-tool.h.

Constructor & Destructor Documentation

◆ PagesTool()

◆ ~PagesTool()

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

Member Function Documentation

◆ addDragShape() [1/2]

void Inkscape::UI::Tools::PagesTool::addDragShape ( Geom::PathVector &&  pth,
Geom::Affine  tr 
)
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.

◆ addDragShape() [2/2]

void Inkscape::UI::Tools::PagesTool::addDragShape ( SPItem item,
Geom::Affine  tr 
)
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().

◆ addDragShapes()

void Inkscape::UI::Tools::PagesTool::addDragShapes ( SPPage page,
Geom::Affine  tr 
)
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.

◆ clearDragShapes()

void Inkscape::UI::Tools::PagesTool::clearDragShapes ( )
private

Remove all drag shapes from the canvas.

Definition at line 580 of file pages-tool.cpp.

◆ connectDocument()

void Inkscape::UI::Tools::PagesTool::connectDocument ( SPDocument doc)
private

◆ getSnappedResizePoint()

Geom::Point Inkscape::UI::Tools::PagesTool::getSnappedResizePoint ( Geom::Point  point,
guint  state,
Geom::Point  origin,
SPObject target = nullptr 
)
private

◆ grabPage()

void Inkscape::UI::Tools::PagesTool::grabPage ( SPPage target)
private

◆ marginKnotFinished()

void Inkscape::UI::Tools::PagesTool::marginKnotFinished ( SPKnot knot,
guint  state 
)
private

Definition at line 302 of file pages-tool.cpp.

Referenced by PagesTool().

◆ marginKnotMoved()

◆ marginKnotSet()

void Inkscape::UI::Tools::PagesTool::marginKnotSet ( Geom::Rect  margin_rect)
private

◆ menu_popup()

void Inkscape::UI::Tools::PagesTool::menu_popup ( CanvasEvent const &  event,
SPObject obj = nullptr 
)
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().

◆ middleOfSide()

Geom::Point Inkscape::UI::Tools::PagesTool::middleOfSide ( int  side,
const Geom::Rect rect 
)
staticprivate

Definition at line 170 of file pages-tool.cpp.

References Geom::GenericRect< C >::corner(), and Geom::middle_point().

Referenced by marginKnotMoved(), and marginKnotSet().

◆ moveTo()

◆ offsetKnotFinished()

void Inkscape::UI::Tools::PagesTool::offsetKnotFinished ( SPKnot knot,
guint  state 
)
private

◆ offsetKnotMoved()

bool Inkscape::UI::Tools::PagesTool::offsetKnotMoved ( SPKnot knot,
Geom::Point point,
guint  state 
)
private

◆ pageModified()

void Inkscape::UI::Tools::PagesTool::pageModified ( SPObject object,
guint  flags 
)
private

Definition at line 679 of file pages-tool.cpp.

References page.

◆ pageUnder()

SPPage * Inkscape::UI::Tools::PagesTool::pageUnder ( Geom::Point  pt,
bool  retain_selected = true 
)
private

Find a page under the cursor point.

Definition at line 591 of file pages-tool.cpp.

◆ resizeKnotFinished()

void Inkscape::UI::Tools::PagesTool::resizeKnotFinished ( SPKnot knot,
guint  state 
)
private

◆ resizeKnotMoved()

◆ resizeKnotSet()

void Inkscape::UI::Tools::PagesTool::resizeKnotSet ( Geom::Rect  rect)
private

Definition at line 151 of file pages-tool.cpp.

References Geom::GenericRect< C >::corner(), and resize_knots.

◆ root_handler()

◆ selectionChanged()

void Inkscape::UI::Tools::PagesTool::selectionChanged ( SPDocument doc,
SPPage page 
)
private

◆ switching_away()

void Inkscape::UI::Tools::PagesTool::switching_away ( std::string const &  new_tool)
overridevirtual

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

Definition at line 480 of file pages-tool.cpp.

◆ updateOfsetKnot()

void Inkscape::UI::Tools::PagesTool::updateOfsetKnot ( )
private

◆ viewboxUnder()

bool Inkscape::UI::Tools::PagesTool::viewboxUnder ( Geom::Point  pt)
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().

Member Data Documentation

◆ _bbox_points

std::vector<Inkscape::SnapCandidatePoint> Inkscape::UI::Tools::PagesTool::_bbox_points
private

Definition at line 100 of file pages-tool.h.

◆ _doc_replaced_connection

sigc::connection Inkscape::UI::Tools::PagesTool::_doc_replaced_connection
private

Definition at line 81 of file pages-tool.h.

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

◆ _doc_root_connection

sigc::connection Inkscape::UI::Tools::PagesTool::_doc_root_connection
private

Definition at line 82 of file pages-tool.h.

◆ _page_modified_connection

sigc::connection Inkscape::UI::Tools::PagesTool::_page_modified_connection
private

Definition at line 80 of file pages-tool.h.

◆ _selection_state

std::unique_ptr<Inkscape::SelectionState> Inkscape::UI::Tools::PagesTool::_selection_state
private

Definition at line 101 of file pages-tool.h.

Referenced by PagesTool().

◆ _selector_changed_connection

sigc::connection Inkscape::UI::Tools::PagesTool::_selector_changed_connection
private

Definition at line 79 of file pages-tool.h.

◆ _zoom_connection

sigc::connection Inkscape::UI::Tools::PagesTool::_zoom_connection
private

Definition at line 83 of file pages-tool.h.

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

◆ drag_group

CanvasItemPtr<CanvasItemGroup> Inkscape::UI::Tools::PagesTool::drag_group
private

Definition at line 98 of file pages-tool.h.

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

◆ drag_origin_dt

Geom::Point Inkscape::UI::Tools::PagesTool::drag_origin_dt
private

Definition at line 88 of file pages-tool.h.

Referenced by root_handler().

◆ drag_origin_w

Geom::Point Inkscape::UI::Tools::PagesTool::drag_origin_w
private

Definition at line 87 of file pages-tool.h.

◆ drag_shapes

std::vector<Inkscape::CanvasItemBpath *> Inkscape::UI::Tools::PagesTool::drag_shapes
private

Definition at line 99 of file pages-tool.h.

Referenced by ~PagesTool().

◆ drag_tolerance

int Inkscape::UI::Tools::PagesTool::drag_tolerance = 5
private

Definition at line 89 of file pages-tool.h.

Referenced by PagesTool().

◆ dragging_item

SPPage* Inkscape::UI::Tools::PagesTool::dragging_item = nullptr
private

Definition at line 95 of file pages-tool.h.

◆ dragging_viewbox

bool Inkscape::UI::Tools::PagesTool::dragging_viewbox = false
private

Definition at line 85 of file pages-tool.h.

Referenced by root_handler().

◆ highlight_item

SPPage* Inkscape::UI::Tools::PagesTool::highlight_item = nullptr
private

Definition at line 94 of file pages-tool.h.

◆ margin_knots

std::vector<SPKnot *> Inkscape::UI::Tools::PagesTool::margin_knots
private

Definition at line 92 of file pages-tool.h.

Referenced by marginKnotMoved(), marginKnotSet(), and PagesTool().

◆ mouse_is_pressed

bool Inkscape::UI::Tools::PagesTool::mouse_is_pressed = false
private

Definition at line 86 of file pages-tool.h.

Referenced by resizeKnotFinished(), and resizeKnotMoved().

◆ offset_knot

SPKnot* Inkscape::UI::Tools::PagesTool::offset_knot = nullptr
private

Definition at line 93 of file pages-tool.h.

Referenced by PagesTool(), updateOfsetKnot(), and ~PagesTool().

◆ on_screen_rect

std::optional<Geom::Rect> Inkscape::UI::Tools::PagesTool::on_screen_rect
private

On-screen rectangle, in desktop coordinates.

Definition at line 96 of file pages-tool.h.

Referenced by resizeKnotFinished(), and resizeKnotMoved().

◆ resize_knots

std::vector<SPKnot *> Inkscape::UI::Tools::PagesTool::resize_knots
private

Definition at line 91 of file pages-tool.h.

Referenced by PagesTool(), resizeKnotMoved(), resizeKnotSet(), and ~PagesTool().

◆ visual_box

CanvasItemPtr<CanvasItemRect> Inkscape::UI::Tools::PagesTool::visual_box
private

Definition at line 97 of file pages-tool.h.

Referenced by PagesTool(), resizeKnotFinished(), resizeKnotMoved(), and ~PagesTool().


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