From 56d76b4861d034dad8b4eeb25e86308e233202e4 Mon Sep 17 00:00:00 2001 From: vanntile Date: Fri, 2 Aug 2019 19:23:28 +0300 Subject: Added knot holder entities --- src/knotholder.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 12 deletions(-) (limited to 'src/knotholder.cpp') diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 7d6fa776e..7f65cec2b 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -354,16 +354,15 @@ void KnotHolder::add_pattern_knotholder() PatternKnotHolderEntityScale *entity_scale = new PatternKnotHolderEntityScale(true); entity_xy->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT, // TRANSLATORS: This refers to the pattern that's inside the object - _("Move the pattern fill inside the object"), - SP_KNOT_SHAPE_CROSS); + _("Move the pattern fill inside the object"), SP_KNOT_SHAPE_CROSS); entity_scale->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER, - _("Scale the pattern fill; uniformly if with Ctrl"), - SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR); + _("Scale the pattern fill; uniformly if with Ctrl"), SP_KNOT_SHAPE_SQUARE, + SP_KNOT_MODE_XOR); entity_angle->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE, - _("Rotate the pattern fill; with Ctrl to snap angle"), - SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR); + _("Rotate the pattern fill; with Ctrl to snap angle"), SP_KNOT_SHAPE_CIRCLE, + SP_KNOT_MODE_XOR); entity.push_back(entity_xy); entity.push_back(entity_angle); @@ -376,15 +375,14 @@ void KnotHolder::add_pattern_knotholder() PatternKnotHolderEntityScale *entity_scale = new PatternKnotHolderEntityScale(false); entity_xy->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT, // TRANSLATORS: This refers to the pattern that's inside the object - _("Move the pattern fill inside the object"), - SP_KNOT_SHAPE_CROSS); + _("Move the pattern stroke inside the object"), SP_KNOT_SHAPE_CROSS); entity_scale->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER, - _("Scale the pattern fill; uniformly if with Ctrl"), - SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR); + _("Scale the pattern stroke; uniformly if with Ctrl"), SP_KNOT_SHAPE_SQUARE, + SP_KNOT_MODE_XOR); entity_angle->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE, - _("Rotate the pattern fill; with Ctrl to snap angle"), + _("Rotate the pattern stroke; with Ctrl to snap angle"), SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR); entity.push_back(entity_xy); @@ -397,8 +395,47 @@ void KnotHolder::add_pattern_knotholder() void KnotHolder::add_hatch_knotholder() { if ((item->style->fill.isPaintserver()) && dynamic_cast(item->style->getFillPaintServer())) { - std::cout << "add_hatch_knotholder: activated" << std::endl; + HatchKnotHolderEntityXY *entity_xy = new HatchKnotHolderEntityXY(true); + HatchKnotHolderEntityAngle *entity_angle = new HatchKnotHolderEntityAngle(true); + HatchKnotHolderEntityScale *entity_scale = new HatchKnotHolderEntityScale(true); + entity_xy->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT, + // TRANSLATORS: This refers to the hatch that's inside the object + _("Move the hatch fill inside the object"), SP_KNOT_SHAPE_CROSS); + + entity_scale->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER, + _("Scale the hatch fill; uniformly if with Ctrl"), SP_KNOT_SHAPE_SQUARE, + SP_KNOT_MODE_XOR); + + entity_angle->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE, + _("Rotate the hatch fill; with Ctrl to snap angle"), SP_KNOT_SHAPE_CIRCLE, + SP_KNOT_MODE_XOR); + + entity.push_back(entity_xy); + entity.push_back(entity_angle); + entity.push_back(entity_scale); } + + if ((item->style->stroke.isPaintserver()) && dynamic_cast(item->style->getStrokePaintServer())) { + HatchKnotHolderEntityXY *entity_xy = new HatchKnotHolderEntityXY(false); + HatchKnotHolderEntityAngle *entity_angle = new HatchKnotHolderEntityAngle(false); + HatchKnotHolderEntityScale *entity_scale = new HatchKnotHolderEntityScale(false); + entity_xy->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT, + // TRANSLATORS: This refers to the pattern that's inside the object + _("Move the hatch stroke inside the object"), SP_KNOT_SHAPE_CROSS); + + entity_scale->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER, + _("Scale the hatch stroke; uniformly if with Ctrl"), SP_KNOT_SHAPE_SQUARE, + SP_KNOT_MODE_XOR); + + entity_angle->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE, + _("Rotate the hatch stroke; with Ctrl to snap angle"), SP_KNOT_SHAPE_CIRCLE, + SP_KNOT_MODE_XOR); + + entity.push_back(entity_xy); + entity.push_back(entity_angle); + entity.push_back(entity_scale); + } + updateControlSizes(); } void KnotHolder::add_filter_knotholder() { -- cgit v1.2.3