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

#include <box3d-tool.h>

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

Public Member Functions

 Box3dTool (SPDesktop *desktop)
 
 ~Box3dTool () override
 
bool root_handler (CanvasEvent const &event) override
 
bool item_handler (SPItem *item, CanvasEvent const &event) override
 Handles item specific events.
 
- 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 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

std::unique_ptr< Box3D::VPDrag_vpdrag
 
- 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

void selection_changed (Selection *selection)
 Callback that processes the "changed" signal on the selection; destroys old and creates new knotholder.
 
void drag ()
 
void finishItem ()
 
void cancel ()
 

Private Attributes

SPWeakPtr< SPBox3Dbox3d
 
Geom::Point center
 
Geom::Point drag_origin
 save three corners while dragging: 1) the starting point (already done by the event_context) 2) drag_ptB --> the opposite corner of the front face (before pressing shift) 3) drag_ptC --> the "extruded corner" (which coincides with the mouse pointer location if we are ctrl-dragging but is constrained to the perspective line from drag_ptC to the vanishing point Y otherwise)
 
Geom::Point drag_ptB
 
Geom::Point drag_ptC
 
Proj::Pt3 drag_origin_proj
 
Proj::Pt3 drag_ptB_proj
 
Proj::Pt3 drag_ptC_proj
 
bool ctrl_dragged = false
 whether we are ctrl-dragging
 
bool extruded = false
 whether shift-dragging already occurred (i.e. the box is already extruded)
 
sigc::scoped_connection sel_changed_connection
 

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 32 of file box3d-tool.h.

Constructor & Destructor Documentation

◆ Box3dTool()

◆ ~Box3dTool()

Member Function Documentation

◆ cancel()

◆ drag()

◆ finishItem()

◆ item_handler()

bool Inkscape::UI::Tools::Box3dTool::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 109 of file box3d-tool.cpp.

References Inkscape::BUTTON_PRESS, item, Inkscape::UI::Tools::ToolBase::item_handler(), Inkscape::UI::Tools::ToolBase::setup_for_drag_start(), and Inkscape::CanvasEvent::type().

◆ root_handler()

bool Inkscape::UI::Tools::Box3dTool::root_handler ( CanvasEvent const &  event)
overridevirtual

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

Definition at line 121 of file box3d-tool.cpp.

References Inkscape::UI::Tools::ToolBase::_desktop, _vpdrag, box3d, cancel(), center, Inkscape::UI::Tools::ToolBase::checkDragMoved(), ctrl_dragged, Inkscape::UI::Tools::ToolBase::deleteSelectedDrag(), Inkscape::UI::Tools::ToolBase::discard_delayed_snap_event(), Inkscape::DocumentUndo::done(), drag(), drag_origin, drag_origin_proj, drag_ptB, drag_ptB_proj, drag_ptC, drag_ptC_proj, Inkscape::UI::Tools::ToolBase::dragging, Inkscape::UI::Tools::ensure_persp_in_defs(), extruded, finishItem(), Inkscape::Preferences::get(), Inkscape::SPWeakPtr< T >::get(), Inkscape::UI::Tools::get_latin_keyval(), SPDesktop::getDocument(), SPDesktop::getNamedView(), SPDesktop::getSelection(), Inkscape::UI::Tools::ToolBase::grabCanvasEvents(), Inkscape::inspect_event(), Inkscape::UI::Tools::ToolBase::item_to_select, Inkscape::mod_alt(), Inkscape::mod_alt_only(), Inkscape::mod_ctrl_only(), Inkscape::mod_shift_only(), Inkscape::CanvasEvent::modifiers, Proj::Pt3::normalize(), Inkscape::UI::Tools::ToolBase::root_handler(), Inkscape::UI::Tools::ToolBase::saveDragOrigin(), Inkscape::Selection::set(), SPDesktop::setToolboxFocusTo(), SnapManager::setup(), SPNamedView::snap_manager, Inkscape::SNAPSOURCE_NODE_HANDLE, Inkscape::UI::Tools::sp_event_context_find_item(), Inkscape::UI::Tools::ToolBase::sp_event_context_knot_mouseover(), sp_lpe_item_update_patheffect(), Persp3D::toggle_VPs(), Inkscape::ObjectSet::toGuides(), Inkscape::UI::Tools::ToolBase::tolerance, Inkscape::UI::Tools::ToolBase::ungrabCanvasEvents(), SPDesktop::w2d(), Inkscape::UI::Tools::ToolBase::within_tolerance, Proj::X, Inkscape::UI::Tools::ToolBase::xyp, Proj::Y, SPDesktop::yaxisdir(), and Proj::Z.

◆ selection_changed()

void Inkscape::UI::Tools::Box3dTool::selection_changed ( Selection selection)
private

Member Data Documentation

◆ _vpdrag

std::unique_ptr<Box3D::VPDrag> Inkscape::UI::Tools::Box3dTool::_vpdrag

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

Referenced by Box3dTool(), and root_handler().

◆ box3d

SPWeakPtr<SPBox3D> Inkscape::UI::Tools::Box3dTool::box3d
private

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

Referenced by cancel(), drag(), finishItem(), and root_handler().

◆ center

Geom::Point Inkscape::UI::Tools::Box3dTool::center
private

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

Referenced by root_handler().

◆ ctrl_dragged

bool Inkscape::UI::Tools::Box3dTool::ctrl_dragged = false
private

whether we are ctrl-dragging

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

Referenced by finishItem(), and root_handler().

◆ drag_origin

Geom::Point Inkscape::UI::Tools::Box3dTool::drag_origin
private

save three corners while dragging: 1) the starting point (already done by the event_context) 2) drag_ptB --> the opposite corner of the front face (before pressing shift) 3) drag_ptC --> the "extruded corner" (which coincides with the mouse pointer location if we are ctrl-dragging but is constrained to the perspective line from drag_ptC to the vanishing point Y otherwise)

Definition at line 55 of file box3d-tool.h.

Referenced by root_handler().

◆ drag_origin_proj

Proj::Pt3 Inkscape::UI::Tools::Box3dTool::drag_origin_proj
private

Definition at line 59 of file box3d-tool.h.

Referenced by drag(), finishItem(), and root_handler().

◆ drag_ptB

Geom::Point Inkscape::UI::Tools::Box3dTool::drag_ptB
private

Definition at line 56 of file box3d-tool.h.

Referenced by root_handler().

◆ drag_ptB_proj

Proj::Pt3 Inkscape::UI::Tools::Box3dTool::drag_ptB_proj
private

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

Referenced by root_handler().

◆ drag_ptC

Geom::Point Inkscape::UI::Tools::Box3dTool::drag_ptC
private

Definition at line 57 of file box3d-tool.h.

Referenced by root_handler().

◆ drag_ptC_proj

Proj::Pt3 Inkscape::UI::Tools::Box3dTool::drag_ptC_proj
private

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

Referenced by drag(), finishItem(), and root_handler().

◆ extruded

bool Inkscape::UI::Tools::Box3dTool::extruded = false
private

whether shift-dragging already occurred (i.e. the box is already extruded)

Definition at line 64 of file box3d-tool.h.

Referenced by finishItem(), and root_handler().

◆ sel_changed_connection

sigc::scoped_connection Inkscape::UI::Tools::Box3dTool::sel_changed_connection
private

Definition at line 66 of file box3d-tool.h.

Referenced by Box3dTool().


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