Inkscape
Vector Graphics Editor
|
#include <booleans-tool.h>
Public Member Functions | |
InteractiveBooleansTool (SPDesktop *desktop) | |
~InteractiveBooleansTool () override | |
void | switching_away (std::string const &new_tool) override |
void | set (Preferences::Entry const &val) override |
Called by our pref_observer if a preference has been changed. | |
bool | is_ready () const override |
bool | root_handler (CanvasEvent const &event) override |
void | shape_commit () |
void | shape_cancel () |
void | set_opacity (double opacity=1.0) |
Set the variable transparency of the rest of the canvas. | |
![]() | |
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) |
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 | update_status () |
void | hide_selected_objects (bool hide=true) |
Hide all selected items, because they are going to be re-drawn as a fractured pattern and we don't want them to appear twice. | |
bool | should_add (unsigned state) const |
Returns true if the shape builder should add items, false if shape builder should delete items. | |
bool | event_button_press_handler (ButtonPressEvent const &event) |
bool | event_button_release_handler (ButtonReleaseEvent const &event) |
bool | event_motion_handler (MotionEvent const &event) |
bool | event_key_press_handler (KeyPressEvent const &event) |
Private Attributes | |
std::unique_ptr< BooleanBuilder > | boolean_builder |
sigc::scoped_connection | _sel_modified |
sigc::scoped_connection | _sel_changed |
bool | to_commit = false |
std::optional< Geom::Point > | last_cursor_position |
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 30 of file booleans-tool.h.
Inkscape::UI::Tools::InteractiveBooleansTool::InteractiveBooleansTool | ( | SPDesktop * | desktop | ) |
Definition at line 36 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, _sel_changed, _sel_modified, boolean_builder, SPDesktop::clearWaitingCursor(), desktop, SPDesktop::doc(), Inkscape::Preferences::get(), SPDocument::get_event_log(), SPDesktop::getSelection(), hide_selected_objects(), set_opacity(), SPDesktop::setWaitingCursor(), shape_cancel(), to_commit, update_status(), and Inkscape::EventLog::updateUndoVerbs().
|
override |
Definition at line 57 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, SPDesktop::doc(), SPDocument::get_event_log(), hide_selected_objects(), set_opacity(), and Inkscape::EventLog::updateUndoVerbs().
|
private |
Definition at line 209 of file booleans-tool.cpp.
References boolean_builder, Inkscape::ButtonEvent::button, Inkscape::CanvasEvent::modifiers, Inkscape::ButtonPressEvent::num_press, Inkscape::ButtonEvent::pos, and should_add().
Referenced by root_handler().
|
private |
Definition at line 242 of file booleans-tool.cpp.
References boolean_builder, and Inkscape::ButtonEvent::button.
Referenced by root_handler().
|
private |
Definition at line 250 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_acc_redo, Inkscape::UI::Tools::ToolBase::_acc_undo, boolean_builder, Inkscape::UI::Tools::get_latin_keyval(), Inkscape::Util::ActionAccel::isTriggeredBy(), shape_cancel(), and shape_commit().
Referenced by root_handler().
|
private |
Definition at line 226 of file booleans-tool.cpp.
References boolean_builder, last_cursor_position, Inkscape::CanvasEvent::modifiers, Inkscape::MotionEvent::pos, and should_add().
Referenced by root_handler().
|
private |
Hide all selected items, because they are going to be re-drawn as a fractured pattern and we don't want them to appear twice.
Definition at line 68 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, boolean_builder, SPDesktop::dkey, SPItem::get_arenaitem(), SPDesktop::getSelection(), item, SPStyle::opacity, and SPObject::style.
Referenced by InteractiveBooleansTool(), switching_away(), and ~InteractiveBooleansTool().
|
overridevirtual |
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 110 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, boolean_builder, SPDesktop::getSelection(), Inkscape::ObjectSet::isEmpty(), and SPDesktop::showNotice().
|
overridevirtual |
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 147 of file booleans-tool.cpp.
References boolean_builder, event_button_press_handler(), event_button_release_handler(), event_key_press_handler(), event_motion_handler(), Inkscape::inspect_event(), last_cursor_position, Inkscape::CanvasEvent::modifiersAfter(), Inkscape::UI::Tools::ToolBase::root_handler(), Inkscape::UI::Tools::ToolBase::set_cursor(), should_add(), and update_status().
|
overridevirtual |
Called by our pref_observer if a preference has been changed.
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 123 of file booleans-tool.cpp.
References boolean_builder, Inkscape::Preferences::Entry::getEntryName(), and update_status().
void Inkscape::UI::Tools::InteractiveBooleansTool::set_opacity | ( | double | opacity = 1.0 | ) |
Set the variable transparency of the rest of the canvas.
Definition at line 87 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, Inkscape::CanvasItemDrawing::get_drawing(), and SPDesktop::getCanvasDrawing().
Referenced by InteractiveBooleansTool(), and ~InteractiveBooleansTool().
void Inkscape::UI::Tools::InteractiveBooleansTool::shape_cancel | ( | ) |
Definition at line 141 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, boolean_builder, and set_active_tool().
Referenced by Inkscape::UI::Toolbar::BooleansToolbar::BooleansToolbar(), event_key_press_handler(), and InteractiveBooleansTool().
void Inkscape::UI::Tools::InteractiveBooleansTool::shape_commit | ( | ) |
Definition at line 132 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, _sel_changed, _sel_modified, set_active_tool(), and to_commit.
Referenced by Inkscape::UI::Toolbar::BooleansToolbar::BooleansToolbar(), and event_key_press_handler().
|
private |
Returns true if the shape builder should add items, false if shape builder should delete items.
Definition at line 190 of file booleans-tool.cpp.
References Inkscape::Modifiers::BOOL_SHIFT, and Inkscape::Preferences::get().
Referenced by event_button_press_handler(), event_motion_handler(), and root_handler().
|
overridevirtual |
Reimplemented from Inkscape::UI::Tools::ToolBase.
Definition at line 94 of file booleans-tool.cpp.
References Inkscape::UI::Tools::ToolBase::_desktop, boolean_builder, SPDesktop::doc(), Inkscape::DocumentUndo::done(), Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), SPDesktop::getSelection(), hide_selected_objects(), Inkscape::ObjectSet::setList(), and to_commit.
|
private |
Definition at line 198 of file booleans-tool.cpp.
References Inkscape::Modifiers::BOOL_SHIFT, Inkscape::Preferences::get(), Inkscape::IMMEDIATE_MESSAGE, and Inkscape::UI::Tools::ToolBase::message_context.
Referenced by InteractiveBooleansTool(), root_handler(), and set().
|
private |
Definition at line 63 of file booleans-tool.h.
Referenced by InteractiveBooleansTool(), and shape_commit().
|
private |
Definition at line 62 of file booleans-tool.h.
Referenced by InteractiveBooleansTool(), and shape_commit().
|
private |
Definition at line 60 of file booleans-tool.h.
Referenced by event_button_press_handler(), event_button_release_handler(), event_key_press_handler(), event_motion_handler(), hide_selected_objects(), InteractiveBooleansTool(), is_ready(), root_handler(), set(), shape_cancel(), and switching_away().
|
private |
Definition at line 66 of file booleans-tool.h.
Referenced by event_motion_handler(), and root_handler().
|
private |
Definition at line 65 of file booleans-tool.h.
Referenced by InteractiveBooleansTool(), shape_commit(), and switching_away().