19#include <glibmm/i18n.h>
50 , repr(
item ?
item->getRepr() : nullptr)
53 g_warning (
"Error! Throw an exception, please!");
84 if ((*e)->knot_missing()) {
99 const SPKnot *knot = i->knot;
114 const SPKnot *knot = i->knot;
126 if (!(state & GDK_SHIFT_MASK)) {
129 for (
auto &_shape_editor : nt->_shape_editors) {
131 if (shape_editor && shape_editor->
knotholder) {
137 for(
auto e : this->
entity) {
138 if (!(state & GDK_SHIFT_MASK)) {
139 e->knot->selectKnot(
false);
141 if (e->knot == knot) {
142 if (!(e->knot->is_selected()) || !(state & GDK_SHIFT_MASK)){
143 e->knot->selectKnot(
true);
145 e->knot->selectKnot(
false);
156 for(
auto e : this->
entity) {
159 e->knot_click(state);
163 auto savedShape = cast<SPShape>(saved_item);
165 savedShape->set_shape();
171 Glib::ustring icon_name;
174 if (is<SPRect>(saved_item)) {
175 icon_name = INKSCAPE_ICON(
"draw-rectangle");
176 }
else if (is<SPBox3D>(saved_item)) {
177 icon_name = INKSCAPE_ICON(
"draw-cuboid");
178 }
else if (is<SPGenericEllipse>(saved_item)) {
179 icon_name = INKSCAPE_ICON(
"draw-ellipse");
180 }
else if (is<SPStar>(saved_item)) {
181 icon_name = INKSCAPE_ICON(
"draw-polygon-star");
182 }
else if (is<SPSpiral>(saved_item)) {
183 icon_name = INKSCAPE_ICON(
"draw-spiral");
184 }
else if (is<SPMarker>(saved_item)) {
185 icon_name = INKSCAPE_ICON(
"tool-pointer");
187 auto offset = cast<SPOffset>(saved_item);
190 icon_name = INKSCAPE_ICON(
"path-offset-linked");
192 icon_name = INKSCAPE_ICON(
"path-offset-dynamic");
199 if (saved_item && saved_item->
document) {
200 DocumentUndo::done(saved_item->
document, _(
"Change handle"), icon_name);
220 if (e->knot->is_selected()) {
221 e->knot->selectKnot(
false);
229 auto grab_entity = std::find_if(
entity.begin(),
entity.end(),
231 if (grab_entity ==
entity.end()) {
234 auto const item_origin = (*grab_entity)->knot->drag_origin *
item->
dt2i_affine()
236 (*grab_entity)->knot_grabbed(item_origin, state);
251 for(
auto e : this->
entity) {
252 if (e->knot == knot) {
259 auto shape = cast<SPShape>(
item);
279 if (e->knot == knot) {
280 e->knot_ungrabbed(e->knot->position(),
283 if (e->knot->is_lpe) {
303 Glib::ustring icon_name;
306 if (is<SPRect>(
object)) {
307 icon_name = INKSCAPE_ICON(
"draw-rectangle");
308 }
else if (is<SPBox3D>(
object)) {
309 icon_name = INKSCAPE_ICON(
"draw-cuboid");
310 }
else if (is<SPGenericEllipse>(
object)) {
311 icon_name = INKSCAPE_ICON(
"draw-ellipse");
312 }
else if (is<SPStar>(
object)) {
313 icon_name = INKSCAPE_ICON(
"draw-polygon-star");
314 }
else if (is<SPSpiral>(
object)) {
315 icon_name = INKSCAPE_ICON(
"draw-spiral");
316 }
else if (is<SPMarker>(
object)) {
317 icon_name = INKSCAPE_ICON(
"tool-pointer");
318 }
else if (
auto offset = cast<SPOffset>(
object)) {
319 icon_name =
offset->sourceHref ? INKSCAPE_ICON(
"path-offset-linked") : INKSCAPE_ICON(
"path-offset-dynamic");
321 DocumentUndo::done(object->
document, _(
"Move handle"), icon_name);
336 entity.remove_if([i=&i](
auto& x){
return &x==i;});
352 _(
"<b>Move</b> the pattern fill inside the object"));
355 _(
"<b>Scale</b> the pattern fill; uniformly if with <b>Ctrl</b>"));
358 _(
"<b>Rotate</b> the pattern fill; with <b>Ctrl</b> to snap angle"));
360 entity.push_back(entity_xy);
361 entity.push_back(entity_angle);
362 entity.push_back(entity_scale);
371 _(
"<b>Move</b> the stroke's pattern inside the object"));
374 _(
"<b>Scale</b> the stroke's pattern; uniformly if with <b>Ctrl</b>"));
377 _(
"<b>Rotate</b> the stroke's pattern; with <b>Ctrl</b> to snap angle"));
379 entity.push_back(entity_xy);
380 entity.push_back(entity_angle);
381 entity.push_back(entity_scale);
396 _(
"<b>Move</b> the hatch fill inside the object"));
399 _(
"<b>Scale</b> the hatch fill; uniformly if with <b>Ctrl</b>"));
402 _(
"<b>Rotate</b> the hatch fill; with <b>Ctrl</b> to snap angle"));
404 entity.push_back(entity_xy);
405 entity.push_back(entity_angle);
406 entity.push_back(entity_scale);
415 _(
"<b>Move</b> the hatch stroke inside the object"));
418 _(
"<b>Scale</b> the hatch stroke; uniformly if with <b>Ctrl</b>"));
421 _(
"<b>Rotate</b> the hatch stroke; with <b>Ctrl</b> to snap angle"));
423 entity.push_back(entity_xy);
424 entity.push_back(entity_angle);
425 entity.push_back(entity_scale);
431 if (!filter->auto_region) {
435 _(
"<b>Resize</b> the filter effect region"));
437 _(
"<b>Resize</b> the filter effect region"));
438 entity.push_back(entity_tl);
439 entity.push_back(entity_br);
447 _(
"<b>Drag</b> to <b>adjust</b> blur in x direction; <b>Ctrl</b>+<b>Drag</b> makes x equal to y; <b>Shift</b>+<b>Ctrl</b>+<b>Drag</b> scales blur proportionately "));
449 _(
"<b>Drag</b> to <b>adjust</b> blur in y direction; <b>Ctrl</b>+<b>Drag</b> makes y equal to x; <b>Shift</b>+<b>Ctrl</b>+<b>Drag</b> scales blur proportionately "));
450 entity.push_back(entity_x);
451 entity.push_back(entity_y);
462 ret = i->set_item_clickpos(loc) || ret;
3x3 matrix representing an affine transformation.
Affine inverse() const
Compute the inverse matrix.
Two-dimensional point that doubles as a vector.
void remove_snaptarget(bool only_if_presnap=false)
std::unique_ptr< KnotHolder > knotholder
KnotHolderEntity definition.
void create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, Inkscape::CanvasItemCtrlType type=Inkscape::CANVAS_ITEM_CTRL_TYPE_DEFAULT, Glib::ustring const &name="unknown", char const *tip="", uint32_t color=0xffffff00)
void add_filter_knotholder()
bool knot_selected() const
Returns true if at least one of the KnotHolderEntities is selected.
void add_hatch_knotholder()
void knot_mousedown_handler(SPKnot *knot, unsigned int state)
bool set_item_clickpos(Geom::Point loc)
When editing an object, this extra information tells out knots where the user has clicked on the item...
void transform_selected(Geom::Affine transform)
Geom::Affine _edit_transform
void knot_moved_handler(SPKnot *knot, Geom::Point const &p, unsigned int state)
void add_pattern_knotholder()
bool knot_mouseover() const
Returns true if at least one of the KnotHolderEntities has the mouse hovering above it.
void remove(KnotHolderEntity *e)
bool local_change
if true, no need to recreate knotholder if repr was changed.
void knot_grabbed_handler(SPKnot *knot, unsigned state)
Notifies an entity that its knot has just been grabbed.
sigc::scoped_connection _watch_fill
void setEditTransform(Geom::Affine edit_transform)
void install_modification_watch()
When object being edited has some attributes changed (fill, stroke) update what objects we watch.
void knot_ungrabbed_handler(SPKnot *knot, unsigned int state)
void knot_clicked_handler(SPKnot *knot, unsigned int state)
sigc::scoped_connection _watch_stroke
std::list< KnotHolderEntity * > entity
void add(KnotHolderEntity *e)
To do: update description of desktop.
Inkscape::Display::SnapIndicator * getSnapIndicator() const
Inkscape::UI::Tools::ToolBase * getTool() const
Base class for visual SVG elements.
Geom::Affine i2dt_affine() const
Returns the transformation from item to desktop coords.
Geom::Affine dt2i_affine() const
Returns the transformation from desktop to item coords.
Desktop-bound visual control object.
Geom::Point pos
Our desktop coordinates.
bool is_mouseover() const
void selectKnot(bool select)
Select knot.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
Inkscape::XML::Node * updateRepr(unsigned int flags=SP_OBJECT_WRITE_EXT)
Updates the object's repr based on the object's state.
SPPaintServer * getFillPaintServer()
T< SPAttr::FILL, SPIPaint > fill
fill
T< SPAttr::STROKE, SPIPaint > stroke
stroke
SPPaintServer * getStrokePaintServer()
Editable view implementation.
TODO: insert short description here.
Macro for icon names used in Inkscape.
Declarations for SPKnot: Desktop-bound visual control object.
@ CANVAS_ITEM_CTRL_TYPE_SIZER
@ CANVAS_ITEM_CTRL_TYPE_MARKER
@ CANVAS_ITEM_CTRL_TYPE_ROTATE
Inkscape::ShapeEditor This is a container class which contains a knotholder for shapes.
Provides a class that shows a temporary indicator on the canvas of where the snap was,...
SVG <hatch> implementation.
SPObject * sp_object_unref(SPObject *object, SPObject *owner)
Decrease reference count of object, with possible debugging and finalization.
SPObject * sp_object_ref(SPObject *object, SPObject *owner)
Increase reference count of object, with possible debugging.
SVG <pattern> implementation.
SPStyle - a style object for SPItem objects.