diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/live_effects/effect-enum.h | 2 | ||||
| -rw-r--r-- | src/live_effects/effect.cpp | 36 | ||||
| -rw-r--r-- | src/live_effects/lpe-dashed-stroke.cpp (renamed from src/live_effects/lpe-dash-stroke.cpp) | 12 | ||||
| -rw-r--r-- | src/live_effects/lpe-dashed-stroke.h (renamed from src/live_effects/lpe-dash-stroke.h) | 12 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.cpp | 17 |
6 files changed, 47 insertions, 36 deletions
diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index a26a7f413..17a9d46ad 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -14,7 +14,7 @@ set(live_effects_SRC lpe-constructgrid.cpp lpe-copy_rotate.cpp lpe-curvestitch.cpp - lpe-dash-stroke.cpp + lpe-dashed-stroke.cpp lpe-dynastroke.cpp lpe-ellipse_5pts.cpp lpe-embrodery-stitch.cpp @@ -107,7 +107,7 @@ set(live_effects_SRC lpe-constructgrid.h lpe-copy_rotate.h lpe-curvestitch.h - lpe-dash-stroke.h + lpe-dashed-stroke.h lpe-dynastroke.h lpe-ellipse_5pts.h lpe-embrodery-stitch.h diff --git a/src/live_effects/effect-enum.h b/src/live_effects/effect-enum.h index c82471439..3ac25bd18 100644 --- a/src/live_effects/effect-enum.h +++ b/src/live_effects/effect-enum.h @@ -57,7 +57,7 @@ enum EffectType { POWERMASK, PTS2ELLIPSE, OFFSET, - DASH_STROKE, + DASHED_STROKE, DOEFFECTSTACK_TEST, ANGLE_BISECTOR, CIRCLE_WITH_RADIUS, diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 960831a5e..67a760d6f 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -344,7 +344,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "perspective-envelope" //key wrong key with "-" retain because historic , "perspective-envelope" //icon , "Perspective/Envelope" //untranslated name - , N_("Perspective or envelope a item by 4 corner ponts") //description + , N_("Transform the object to fit into a shape with four corners, either by stretching it or creating the illusion of a 3D-perspective.") //description , true //on_path , true //on_shape , true //on_group @@ -358,7 +358,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "interpolate_points" //key , "interpolate-points" //icon , "Interpolate points" //untranslated name - , N_("Interpolate points creating diferent conxions between: straight, smooth...") //description + , N_("Connect the nodes of the path (e.g. corresponding to data points) by different types of lines.") //description , true //on_path , true //on_shape , true //on_group @@ -386,7 +386,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "show_handles" //key , "show-handles" //icon , "Show handles" //untranslated name - , N_("Show handles of element, perfect to temporsty show path handles and nodes") //description + , N_("Draw the handles and nodes of paths (replaces the original styling with a black stroke).") //description , true //on_path , true //on_shape , true //on_group @@ -400,7 +400,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "roughen" //key , "roughen" //icon , "Roughen" //untranslated name - , N_("Roughen a item so looks a slight more natural or handcrafted or totaly deformed.") //description + , N_("Roughen an object by adding and randomly shifting new nodes.") //description , true //on_path , true //on_shape , true //on_group @@ -414,7 +414,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "bspline" //key , "bspline" //icon , "BSpline" //untranslated name - , N_("Add BSpline bsplie to a path, this usualy is added on path creation and not directly from here") //description + , N_("Create a BSpline that molds into the path's corners. This effect is usually used directly on the canvas with the BSpline mode of the drawing tools.") //description , true //on_path , false //on_shape , false //on_group @@ -428,7 +428,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "join_type" //key , "join-type" //icon , "Join type" //untranslated name - , N_("Join type convert a path stroke to a real fill path, act lice conbert stroke to path but non destructive. Also have the extrapolated arc option for line joins") //description + , N_("Select among various join types for a path's corner nodes (mitre, rounded, extrapolated arc, ...)") //description , true //on_path , true //on_shape , true //on_group @@ -485,7 +485,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "attach_path" //key , "attach-path" //icon , "Attach path" //untranslated name - , N_("Join starting and/or ending paths to current path") //description + , N_("Glue the current path's ends to a specific position on one or two other paths.") //description , true //on_path , true //on_shape , true //on_group @@ -499,7 +499,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "fill_between_strokes" //key , "fill-between-strokes" //icon , "Fill between strokes" //untranslated name - , N_("Create a updateable fill between 2 diferent paths") //description + , N_("Turn the path into a fill between two other open paths (e.g. between two paths with PowerStroke applied to them)") //description , true //on_path , true //on_shape , true //on_group @@ -513,7 +513,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "fill_between_many" //key , "fill-between-many" //icon , "Fill between many" //untranslated name - , N_("Create a updateable fill between many diferent paths") //description + , N_("Turn the path into a fill between multiple other open paths (e.g. between paths with PowerStroke applied to them)") //description , true //on_path , true //on_shape , true //on_group @@ -527,7 +527,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "ellipse_5pts" //key , "ellipse-5pts" //icon , "Ellipse by 5 points" //untranslated name - , N_("Create a ellipse by a path with 5 points") //description + , N_("Create an ellipse from 5 nodes on its circumference.") //description , true //on_path , true //on_shape , true //on_group @@ -556,7 +556,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "measure_segments" //key , "measure-segments" //icon , "Measure Segments" //untranslated name - , N_("Measure segments, add lines, units, projections...") //description + , N_("Add dimensioning for distances between nodes, optionally with projection and many other configuration options.") //description , true //on_path , true //on_shape , false //on_group @@ -654,7 +654,7 @@ const EnumEffectData<EffectType> LPETypeData[] = { , "offset" //key , "offset" //icon , "Offset" //untranslated name - , N_("Offset a item also with line joins cusp") //description + , N_("Offset the path, optionally keeping cusp corners cusp.") //description , true //on_path , true //on_shape , true //on_group @@ -663,12 +663,12 @@ const EnumEffectData<EffectType> LPETypeData[] = { , false //experimental }, { - DASH_STROKE - , N_("Dash Stroke") //label - , "dash_stroke" //key - , "dash-stroke" //icon - , "Dash Stroke" //untranslated name - , N_("Dash Stroke that fit exatly") //description + DASHED_STROKE + , N_("Dashed Stroke") //label + , "dashed_stroke" //key + , "dashed-stroke" //icon + , "Dashed Stroke" //untranslated name + , N_("Add a dashed stroke whose dashes end exactly on a node, optionally with the same number of dashes per path segment.") //description , true //on_path , true //on_shape , true //on_group diff --git a/src/live_effects/lpe-dash-stroke.cpp b/src/live_effects/lpe-dashed-stroke.cpp index 1972b583c..b29b50b43 100644 --- a/src/live_effects/lpe-dash-stroke.cpp +++ b/src/live_effects/lpe-dashed-stroke.cpp @@ -13,7 +13,7 @@ namespace Inkscape { namespace LivePathEffect { -LPEDashStroke::LPEDashStroke(LivePathEffectObject *lpeobject) +LPEDashedStroke::LPEDashedStroke(LivePathEffectObject *lpeobject) : Effect(lpeobject), numberdashes(_("Number of dashes"), _("Number of dashes"), "numberdashes", &wr, this, 3), holefactor(_("Hole factor"), _("Hole factor"), "holefactor", &wr, this, 0.0), @@ -37,16 +37,16 @@ LPEDashStroke::LPEDashStroke(LivePathEffectObject *lpeobject) message.param_set_min_height(30); } -LPEDashStroke::~LPEDashStroke() = default; +LPEDashedStroke::~LPEDashedStroke() = default; void -LPEDashStroke::doBeforeEffect (SPLPEItem const* lpeitem){ +LPEDashedStroke::doBeforeEffect (SPLPEItem const* lpeitem){ } ///Calculate the time in curve_in with a real time of A //TODO: find a better place to it double -LPEDashStroke::timeAtLength(double const A, Geom::Path const &segment) +LPEDashedStroke::timeAtLength(double const A, Geom::Path const &segment) { if ( A == 0 || segment[0].isDegenerate()) { return 0; @@ -59,7 +59,7 @@ LPEDashStroke::timeAtLength(double const A, Geom::Path const &segment) ///Calculate the time in curve_in with a real time of A //TODO: find a better place to it double -LPEDashStroke::timeAtLength(double const A, Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2) +LPEDashedStroke::timeAtLength(double const A, Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2) { if ( A == 0 || pwd2.size() == 0) { return 0; @@ -74,7 +74,7 @@ LPEDashStroke::timeAtLength(double const A, Geom::Piecewise<Geom::D2<Geom::SBasi } Geom::PathVector -LPEDashStroke::doEffect_path(Geom::PathVector const & path_in){ +LPEDashedStroke::doEffect_path(Geom::PathVector const & path_in){ Geom::PathVector const pv = pathv_to_linear_and_cubic_beziers(path_in); Geom::PathVector result; for (const auto & path_it : pv) { diff --git a/src/live_effects/lpe-dash-stroke.h b/src/live_effects/lpe-dashed-stroke.h index 3bc64d0cd..3ee18d2c2 100644 --- a/src/live_effects/lpe-dash-stroke.h +++ b/src/live_effects/lpe-dashed-stroke.h @@ -1,9 +1,9 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#ifndef INKSCAPE_LPE_DASH_STROKE_H -#define INKSCAPE_LPE_DASH_STROKE_H +#ifndef INKSCAPE_LPE_DASHED_STROKE_H +#define INKSCAPE_LPE_DASHED_STROKE_H /* - * Inkscape::LPEDashStroke + * Inkscape::LPEDashedStroke * * Released under GNU GPL v2+, read the file 'COPYING' for more information. */ @@ -14,10 +14,10 @@ namespace Inkscape { namespace LivePathEffect { -class LPEDashStroke : public Effect { +class LPEDashedStroke : public Effect { public: - LPEDashStroke(LivePathEffectObject *lpeobject); - ~LPEDashStroke() override; + LPEDashedStroke(LivePathEffectObject *lpeobject); + ~LPEDashedStroke() override; void doBeforeEffect (SPLPEItem const* lpeitem) override; Geom::PathVector doEffect_path (Geom::PathVector const & path_in) override; double timeAtLength(double const A, Geom::Path const &segment); diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index 3cd2ae4ee..47474aa00 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -159,6 +159,7 @@ LivePathEffectAdd::LivePathEffectAdd() LPESelectorEffect->signal_enter_notify_event().connect(sigc::bind<GtkWidget *>(sigc::mem_fun(*this, &LivePathEffectAdd::mouseover), GTK_WIDGET(LPESelectorEffect->gobj()))); LPESelectorEffect->signal_leave_notify_event().connect(sigc::bind<GtkWidget *>(sigc::mem_fun(*this, &LivePathEffectAdd::mouseout), GTK_WIDGET(LPESelectorEffect->gobj()))); _LPESelectorFlowBox->insert(*LPESelectorEffect, i); + LPESelectorEffect->get_parent()->get_style_context()->add_class(("LPEIndex" + Glib::ustring::format(i)).c_str()); } _visiblelpe = _LPESelectorFlowBox->get_children().size(); _LPEInfo->set_visible(false); @@ -168,7 +169,6 @@ LivePathEffectAdd::LivePathEffectAdd() _LPESelectorEffectInfoEventBox->signal_button_press_event().connect(sigc::mem_fun(*this, &LivePathEffectAdd::hide_pop_description)); _LPESelectorEffectInfoEventBox->signal_enter_notify_event().connect(sigc::bind<GtkWidget *>(sigc::mem_fun(*this, &LivePathEffectAdd::mouseover), GTK_WIDGET(_LPESelectorEffectInfoEventBox->gobj()))); _LPESelectorEffectInfoEventBox->signal_leave_notify_event().connect(sigc::bind<GtkWidget *>(sigc::mem_fun(*this, &LivePathEffectAdd::mouseout), GTK_WIDGET(_LPESelectorEffectInfoEventBox->gobj()))); - _LPESelectorFlowBox->set_filter_func(sigc::mem_fun(*this, &LivePathEffectAdd::on_filter)); _LPEExperimental->property_active().signal_changed().connect(sigc::mem_fun(*this, &LivePathEffectAdd::reload_effect_list)); _LPEDialogSelector->show_all_children(); } @@ -308,7 +308,16 @@ bool LivePathEffectAdd::apply(GdkEventButton* evt, Glib::RefPtr<Gtk::Builder> bu bool LivePathEffectAdd::on_filter(Gtk::FlowBoxChild *child) { - const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *data = &converter.data(child->get_index()); + std::vector<Glib::ustring> classes = child->get_style_context()->list_classes(); + int pos = 0; + for (auto childclass:classes) { + size_t s = childclass.find("LPEIndex", 0); + if (s != -1) { + childclass = childclass.erase(0,8); + pos = std::stoi(childclass); + } + } + const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *data = &converter.data(pos); bool disable = false; if (_item_type == "group" && !converter.get_on_group(data->id)) { disable = true; @@ -515,11 +524,13 @@ void LivePathEffectAdd::show(SPDesktop *desktop) if( width == width_2 && height == height_2 ){ Gtk::Window *window = desktop->getToplevel(); window->get_size (width, height); + std::cout << "dsdgsgdsdgsgdgdsgsdgsdgds" << std::endl; dial._LPEDialogSelector->resize(std::min( width - 300, 1440), std::min( height - 300, 900)); } dial._applied=false; dial._LPESelectorFlowBox->unset_sort_func(); - dial._LPESelectorFlowBox->invalidate_filter(); + dial._LPESelectorFlowBox->unset_filter_func(); + dial._LPESelectorFlowBox->set_filter_func(sigc::mem_fun(dial, &LivePathEffectAdd::on_filter)); dial._LPESelectorFlowBox->set_sort_func(sigc::mem_fun(dial, &LivePathEffectAdd::on_sort)); Glib::RefPtr< Gtk::Adjustment > vadjust = dial._LPEScrolled->get_vadjustment(); vadjust->set_value(vadjust->get_lower()); |
