From 724f7df54133afed0f2b5952e33ac9d4cf1e6e78 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 7 Mar 2015 16:35:26 +0100 Subject: Add a smooth angles parameter to Simplify LPE (bzr r13972) --- src/live_effects/lpe-simplify.cpp | 73 +++++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 14 deletions(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 2b2efb1a9..c60fe06db 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -29,6 +29,7 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 2.), + smooth_angles(_("Smooth anglesº:"), _("Smooth anglesº, 0 no smooth"), "smooth_angles", &wr, this, 20.), nodes(_("Helper nodes"), _("Show helper nodes"), "nodes", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), handles(_("Helper handles"), _("Show helper handles"), "handles", &wr, this, false, @@ -40,6 +41,7 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) { registerParameter(dynamic_cast(&steps)); registerParameter(dynamic_cast(&threshold)); + registerParameter(dynamic_cast(&smooth_angles)); registerParameter(dynamic_cast(&helper_size)); registerParameter(dynamic_cast(&nodes)); registerParameter(dynamic_cast(&handles)); @@ -54,6 +56,9 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) helper_size.param_set_range(0.1, 100); helper_size.param_set_increments(1, 1); helper_size.param_set_digits(1); + smooth_angles.param_set_range(0.0, 365.0); + smooth_angles.param_set_increments(10, 10); + smooth_angles.param_set_digits(2); } LPESimplify::~LPESimplify() {} @@ -154,9 +159,9 @@ LPESimplify::doEffect(SPCurve *curve) { pathliv->Simplify(threshold * size); } } - Geom::PathVector outres = Geom::parse_svg_path(pathliv->svg_dump_path()); - generateHelperPath(outres); - curve->set_pathvector(outres); + Geom::PathVector result = Geom::parse_svg_path(pathliv->svg_dump_path()); + generateHelperPathAndSmooth(result); + curve->set_pathvector(result); SPDesktop* desktop = SP_ACTIVE_DESKTOP; if(desktop && INK_IS_NODE_TOOL(desktop->event_context)){ Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); @@ -165,16 +170,16 @@ LPESimplify::doEffect(SPCurve *curve) { } void -LPESimplify::generateHelperPath(Geom::PathVector result) +LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) { - if(!handles && !nodes){ + if(!handles && !nodes && smooth_angles == 0){ return; } if(steps < 1){ return; } - + Geom::PathVector tmpPath; Geom::CubicBezier const *cubic = NULL; for (Geom::PathVector::iterator path_it = result.begin(); path_it != result.end(); ++path_it) { //Si está vacío... @@ -183,11 +188,9 @@ LPESimplify::generateHelperPath(Geom::PathVector result) } //Itreadores Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve - Geom::Path::const_iterator curve_it2 = - ++(path_it->begin()); // outgoing curve - Geom::Path::const_iterator curve_endit = - path_it->end_default(); // this determines when the loop has to stop - + Geom::Path::const_iterator curve_it2 = ++(path_it->begin());// outgoing curve + Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop + SPCurve *nCurve = new SPCurve(); if (path_it->closed()) { // if the path is closed, maybe we have to stop a bit earlier because the // closing line segment has zerolength. @@ -205,9 +208,46 @@ LPESimplify::generateHelperPath(Geom::PathVector result) if(nodes){ drawNode(curve_it1->initialPoint()); } + nCurve->moveto(curve_it1->initialPoint()); + Geom::Point start = Geom::Point(0,0); while (curve_it1 != curve_endit) { cubic = dynamic_cast(&*curve_it1); + Geom::Point pointAt1 = curve_it1->initialPoint(); + Geom::Point pointAt2 = curve_it1->finalPoint(); + Geom::Point pointAt3 = curve_it1->finalPoint(); + Geom::Point pointAt4 = curve_it1->finalPoint(); if (cubic) { + pointAt1 = (*cubic)[1]; + pointAt2 = (*cubic)[2]; + } + if(start == Geom::Point(0,0)){ + start = pointAt1; + } + + if(path_it->closed() && curve_it2 == curve_endit){ + pointAt4 = start; + } + if(curve_it2 != curve_endit){ + cubic = dynamic_cast(&*curve_it2); + if (cubic) { + pointAt4 = (*cubic)[1]; + } + } + Geom::Ray ray1(pointAt2, pointAt3); + Geom::Ray ray2(pointAt3, pointAt4); + double angle1 = Geom::rad_to_deg(ray1.angle()); + double angle2 = Geom::rad_to_deg(ray2.angle()); + if((smooth_angles >= angle2 - angle1) && !are_near(pointAt4,pointAt3) && !are_near(pointAt2,pointAt3)){ + double dist = Geom::distance(pointAt2,pointAt3); + Geom::Angle angleFixed = ray2.angle(); + angleFixed -= Geom::Angle::from_degrees(180.0); + pointAt2 = Geom::Point::polar(angleFixed,dist) + pointAt3; + } + nCurve->curveto(pointAt1, pointAt2, curve_it1->finalPoint()); + cubic = dynamic_cast(nCurve->last_segment()); + if (cubic) { + pointAt1 = (*cubic)[1]; + pointAt2 = (*cubic)[2]; if(handles) { if(!are_near((*cubic)[0],(*cubic)[1])){ drawHandle((*cubic)[1]); @@ -223,11 +263,16 @@ LPESimplify::generateHelperPath(Geom::PathVector result) drawNode(curve_it1->finalPoint()); } ++curve_it1; - if(curve_it2 != curve_endit){ - ++curve_it2; - } + ++curve_it2; + } + if (path_it->closed()) { + nCurve->closepath_current(); } + tmpPath.push_back(nCurve->get_pathvector()[0]); + nCurve->reset(); + delete nCurve; } + result = tmpPath; } void -- cgit v1.2.3 From 6fc4eb0e7a2a57a22f7c7830766b2b31e47316b0 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 7 Mar 2015 18:43:58 +0100 Subject: Improved popup mesage to a LPE Simplify parameter (bzr r13973) --- src/live_effects/lpe-simplify.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index c60fe06db..9e4d97f51 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -29,7 +29,7 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 2.), - smooth_angles(_("Smooth anglesº:"), _("Smooth anglesº, 0 no smooth"), "smooth_angles", &wr, this, 20.), + smooth_angles(_("Smooth angles:"), _("Max degree diference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), nodes(_("Helper nodes"), _("Show helper nodes"), "nodes", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), handles(_("Helper handles"), _("Show helper handles"), "handles", &wr, this, false, -- cgit v1.2.3 From 3f5a54f867784d1606ebd21a804c356cfc6ef6a4 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 8 Mar 2015 15:00:33 +0100 Subject: Update simplify and bspline to auto size some helper paths based on current zoom (bzr r13974) --- src/live_effects/lpe-simplify.cpp | 57 +++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 14 deletions(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 9e4d97f51..12bd9dc60 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -20,6 +20,7 @@ #include <2geom/generic-rect.h> #include <2geom/interval.h> #include "ui/icon-names.h" +#include "util/units.h" namespace Inkscape { namespace LivePathEffect { @@ -28,8 +29,9 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) : Effect(lpeobject), steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), - helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 2.), smooth_angles(_("Smooth angles:"), _("Max degree diference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), + helper(_("Helper"), _("Show helper"), "helper", &wr, this, false, + "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), nodes(_("Helper nodes"), _("Show helper nodes"), "nodes", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), handles(_("Helper handles"), _("Show helper handles"), "handles", &wr, this, false, @@ -39,10 +41,11 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) simplifyJustCoalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplifyJustCoalesce", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")) { + radiusHelperNodes = 6.0; registerParameter(dynamic_cast(&steps)); registerParameter(dynamic_cast(&threshold)); registerParameter(dynamic_cast(&smooth_angles)); - registerParameter(dynamic_cast(&helper_size)); + registerParameter(dynamic_cast(&helper)); registerParameter(dynamic_cast(&nodes)); registerParameter(dynamic_cast(&handles)); registerParameter(dynamic_cast(&simplifyindividualpaths)); @@ -53,9 +56,6 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) steps.param_set_range(0, 100); steps.param_set_increments(1, 1); steps.param_set_digits(0); - helper_size.param_set_range(0.1, 100); - helper_size.param_set_increments(1, 1); - helper_size.param_set_digits(1); smooth_angles.param_set_range(0.0, 365.0); smooth_angles.param_set_increments(10, 10); smooth_angles.param_set_digits(2); @@ -71,9 +71,24 @@ LPESimplify::doBeforeEffect (SPLPEItem const* lpeitem) } bbox = SP_ITEM(lpeitem)->visualBounds(); SPLPEItem * item = const_cast(lpeitem); + radiusHelperNodes = 12.0; + if(current_zoom != 0){ + if(current_zoom < 0.5){ + radiusHelperNodes *= current_zoom + 0.4; + } else if(current_zoom > 1) { + radiusHelperNodes *= 1/current_zoom; + } + Geom::Affine i2doc = i2anc_affine(SP_ITEM(lpeitem), SP_OBJECT(SP_ITEM(lpeitem)->document->getRoot())); + double expand = (i2doc.expansionX() + i2doc.expansionY())/2; + if(expand != 0){ + radiusHelperNodes /= expand; + } + radiusHelperNodes = Inkscape::Util::Quantity::convert(radiusHelperNodes, "px", defaultUnit); + } else { + radiusHelperNodes = 0; + } item->apply_to_clippath(item); item->apply_to_mask(item); - } Gtk::Widget * @@ -85,18 +100,31 @@ LPESimplify::newWidget() vbox->set_homogeneous(false); vbox->set_spacing(2); std::vector::iterator it = param_vector.begin(); + Gtk::HBox * buttonTop = Gtk::manage(new Gtk::HBox(true,0)); Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0)); - Gtk::HBox * buttonsTwo = Gtk::manage(new Gtk::HBox(true,0)); + Gtk::HBox * buttonsBottom = Gtk::manage(new Gtk::HBox(true,0)); while (it != param_vector.end()) { if ((*it)->widget_is_visible) { Parameter * param = *it; Gtk::Widget * widg = dynamic_cast(param->param_newWidget()); - if (param->param_key == "simplifyindividualpaths" || + if (param->param_key == "helper") + { + Glib::ustring * tip = param->param_getTooltip(); + if (widg) { + buttonTop->pack_start(*widg, true, true, 2); + if (tip) { + widg->set_tooltip_text(*tip); + } else { + widg->set_tooltip_text(""); + widg->set_has_tooltip(false); + } + } + } else if (param->param_key == "simplifyindividualpaths" || param->param_key == "simplifyJustCoalesce") { Glib::ustring * tip = param->param_getTooltip(); if (widg) { - buttonsTwo->pack_start(*widg, true, true, 2); + buttonsBottom->pack_start(*widg, true, true, 2); if (tip) { widg->set_tooltip_text(*tip); } else { @@ -137,8 +165,9 @@ LPESimplify::newWidget() ++it; } + vbox->pack_start(*buttonTop,true, true, 2); vbox->pack_start(*buttons,true, true, 2); - vbox->pack_start(*buttonsTwo,true, true, 2); + vbox->pack_start(*buttonsBottom,true, true, 2); return dynamic_cast(vbox); } @@ -278,7 +307,7 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) void LPESimplify::drawNode(Geom::Point p) { - double r = helper_size/0.67; + double r = radiusHelperNodes; char const * svgd; svgd = "M 0.55,0.5 A 0.05,0.05 0 0 1 0.5,0.55 0.05,0.05 0 0 1 0.45,0.5 0.05,0.05 0 0 1 0.5,0.45 0.05,0.05 0 0 1 0.55,0.5 Z M 0,0 1,0 1,1 0,1 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); @@ -291,7 +320,7 @@ LPESimplify::drawNode(Geom::Point p) void LPESimplify::drawHandle(Geom::Point p) { - double r = helper_size/0.67; + double r = radiusHelperNodes; char const * svgd; svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); @@ -306,8 +335,8 @@ LPESimplify::drawHandleLine(Geom::Point p,Geom::Point p2) { Geom::Path path; path.start( p ); - double diameter = helper_size/0.67; - if(helper_size > 0.0 && Geom::distance(p,p2) > (diameter * 0.35)){ + double diameter = radiusHelperNodes; + if(helper && Geom::distance(p,p2) > (diameter * 0.35)){ Geom::Ray ray2(p, p2); p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35)); } -- cgit v1.2.3 From e7aeaa6686b087d1226f08936971371cd640e089 Mon Sep 17 00:00:00 2001 From: Yuri Chornoivan <> Date: Sun, 8 Mar 2015 17:10:20 +0100 Subject: i10n. Fix for Bug #1429579 (Various typos in the trunk code). Fixed bugs: - https://launchpad.net/bugs/1429579 (bzr r13976) --- src/live_effects/lpe-simplify.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 12bd9dc60..99439f5ab 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -29,7 +29,7 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) : Effect(lpeobject), steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), - smooth_angles(_("Smooth angles:"), _("Max degree diference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), + smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), helper(_("Helper"), _("Show helper"), "helper", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), nodes(_("Helper nodes"), _("Show helper nodes"), "nodes", &wr, this, false, -- cgit v1.2.3 From 83305e2e2653961e7f2ff2b074b1457f1d2915f8 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 8 Mar 2015 17:29:49 +0100 Subject: Fixed a bug on simplify pointed by su_v (bzr r13978) --- src/live_effects/lpe-simplify.cpp | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 99439f5ab..590ad92af 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -30,8 +30,6 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), - helper(_("Helper"), _("Show helper"), "helper", &wr, this, false, - "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), nodes(_("Helper nodes"), _("Show helper nodes"), "nodes", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), handles(_("Helper handles"), _("Show helper handles"), "handles", &wr, this, false, @@ -45,7 +43,6 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) registerParameter(dynamic_cast(&steps)); registerParameter(dynamic_cast(&threshold)); registerParameter(dynamic_cast(&smooth_angles)); - registerParameter(dynamic_cast(&helper)); registerParameter(dynamic_cast(&nodes)); registerParameter(dynamic_cast(&handles)); registerParameter(dynamic_cast(&simplifyindividualpaths)); @@ -72,7 +69,7 @@ LPESimplify::doBeforeEffect (SPLPEItem const* lpeitem) bbox = SP_ITEM(lpeitem)->visualBounds(); SPLPEItem * item = const_cast(lpeitem); radiusHelperNodes = 12.0; - if(current_zoom != 0){ + if(current_zoom != 0 && (nodes || handles)){ if(current_zoom < 0.5){ radiusHelperNodes *= current_zoom + 0.4; } else if(current_zoom > 1) { @@ -100,26 +97,13 @@ LPESimplify::newWidget() vbox->set_homogeneous(false); vbox->set_spacing(2); std::vector::iterator it = param_vector.begin(); - Gtk::HBox * buttonTop = Gtk::manage(new Gtk::HBox(true,0)); Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0)); Gtk::HBox * buttonsBottom = Gtk::manage(new Gtk::HBox(true,0)); while (it != param_vector.end()) { if ((*it)->widget_is_visible) { Parameter * param = *it; Gtk::Widget * widg = dynamic_cast(param->param_newWidget()); - if (param->param_key == "helper") - { - Glib::ustring * tip = param->param_getTooltip(); - if (widg) { - buttonTop->pack_start(*widg, true, true, 2); - if (tip) { - widg->set_tooltip_text(*tip); - } else { - widg->set_tooltip_text(""); - widg->set_has_tooltip(false); - } - } - } else if (param->param_key == "simplifyindividualpaths" || + if (param->param_key == "simplifyindividualpaths" || param->param_key == "simplifyJustCoalesce") { Glib::ustring * tip = param->param_getTooltip(); @@ -165,7 +149,6 @@ LPESimplify::newWidget() ++it; } - vbox->pack_start(*buttonTop,true, true, 2); vbox->pack_start(*buttons,true, true, 2); vbox->pack_start(*buttonsBottom,true, true, 2); return dynamic_cast(vbox); @@ -201,10 +184,6 @@ LPESimplify::doEffect(SPCurve *curve) { void LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) { - if(!handles && !nodes && smooth_angles == 0){ - return; - } - if(steps < 1){ return; } @@ -336,7 +315,7 @@ LPESimplify::drawHandleLine(Geom::Point p,Geom::Point p2) Geom::Path path; path.start( p ); double diameter = radiusHelperNodes; - if(helper && Geom::distance(p,p2) > (diameter * 0.35)){ + if(handles && Geom::distance(p,p2) > (diameter * 0.35)){ Geom::Ray ray2(p, p2); p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35)); } -- cgit v1.2.3 From 4d1f27791fc1e87c514c15cedc0793ffb244bdb7 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 9 Mar 2015 20:33:21 +0100 Subject: Removed auto size helper paths because strange result (bzr r13981) --- src/live_effects/lpe-simplify.cpp | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 590ad92af..561e64c8a 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -30,6 +30,7 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), + helper_size(_("Helper size with direction:"), _("Helper size with direction"), "helper_size", &wr, this, 5), nodes(_("Helper nodes"), _("Show helper nodes"), "nodes", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), handles(_("Helper handles"), _("Show helper handles"), "handles", &wr, this, false, @@ -39,23 +40,32 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) simplifyJustCoalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplifyJustCoalesce", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")) { - radiusHelperNodes = 6.0; - registerParameter(dynamic_cast(&steps)); - registerParameter(dynamic_cast(&threshold)); - registerParameter(dynamic_cast(&smooth_angles)); - registerParameter(dynamic_cast(&nodes)); - registerParameter(dynamic_cast(&handles)); - registerParameter(dynamic_cast(&simplifyindividualpaths)); - registerParameter(dynamic_cast(&simplifyJustCoalesce)); + registerParameter(&steps); + registerParameter(&threshold); + registerParameter(&smooth_angles); + registerParameter(&helper_size); + registerParameter(&nodes); + registerParameter(&handles); + registerParameter(&simplifyindividualpaths); + registerParameter(&simplifyJustCoalesce); + threshold.param_set_range(0.0001, Geom::infinity()); threshold.param_set_increments(0.0001, 0.0001); threshold.param_set_digits(6); + steps.param_set_range(0, 100); steps.param_set_increments(1, 1); steps.param_set_digits(0); + smooth_angles.param_set_range(0.0, 365.0); smooth_angles.param_set_increments(10, 10); smooth_angles.param_set_digits(2); + + helper_size.param_set_range(0.0, 999.0); + helper_size.param_set_increments(5, 5); + helper_size.param_set_digits(2); + + radiusHelperNodes = 6.0; } LPESimplify::~LPESimplify() {} @@ -68,19 +78,8 @@ LPESimplify::doBeforeEffect (SPLPEItem const* lpeitem) } bbox = SP_ITEM(lpeitem)->visualBounds(); SPLPEItem * item = const_cast(lpeitem); - radiusHelperNodes = 12.0; - if(current_zoom != 0 && (nodes || handles)){ - if(current_zoom < 0.5){ - radiusHelperNodes *= current_zoom + 0.4; - } else if(current_zoom > 1) { - radiusHelperNodes *= 1/current_zoom; - } - Geom::Affine i2doc = i2anc_affine(SP_ITEM(lpeitem), SP_OBJECT(SP_ITEM(lpeitem)->document->getRoot())); - double expand = (i2doc.expansionX() + i2doc.expansionY())/2; - if(expand != 0){ - radiusHelperNodes /= expand; - } - radiusHelperNodes = Inkscape::Util::Quantity::convert(radiusHelperNodes, "px", defaultUnit); + if(nodes || handles){ + radiusHelperNodes = helper_size; } else { radiusHelperNodes = 0; } -- cgit v1.2.3 From 5d1333683072c1d6c499a887f9eed6f245e2ff24 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 9 Mar 2015 20:35:25 +0100 Subject: Fix a bad string (bzr r13982) --- src/live_effects/lpe-simplify.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 561e64c8a..3a0659244 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -30,7 +30,7 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), - helper_size(_("Helper size with direction:"), _("Helper size with direction"), "helper_size", &wr, this, 5), + helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 5), nodes(_("Helper nodes"), _("Show helper nodes"), "nodes", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), handles(_("Helper handles"), _("Show helper handles"), "handles", &wr, this, false, -- cgit v1.2.3 From c95ef43008cc2f6580c4d8c604a56bca9fc3d942 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 10 Mar 2015 19:29:10 +0100 Subject: Remove redundant buttons on simplify LPE (bzr r13986) --- src/live_effects/lpe-simplify.cpp | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 3a0659244..1fe18dd5e 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -31,10 +31,6 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 5), - nodes(_("Helper nodes"), _("Show helper nodes"), "nodes", &wr, this, false, - "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), - handles(_("Helper handles"), _("Show helper handles"), "handles", &wr, this, false, - "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), simplifyindividualpaths(_("Paths separately"), _("Simplifying paths (separately)"), "simplifyindividualpaths", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), simplifyJustCoalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplifyJustCoalesce", &wr, this, false, @@ -44,8 +40,6 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) registerParameter(&threshold); registerParameter(&smooth_angles); registerParameter(&helper_size); - registerParameter(&nodes); - registerParameter(&handles); registerParameter(&simplifyindividualpaths); registerParameter(&simplifyJustCoalesce); @@ -78,11 +72,7 @@ LPESimplify::doBeforeEffect (SPLPEItem const* lpeitem) } bbox = SP_ITEM(lpeitem)->visualBounds(); SPLPEItem * item = const_cast(lpeitem); - if(nodes || handles){ - radiusHelperNodes = helper_size; - } else { - radiusHelperNodes = 0; - } + radiusHelperNodes = helper_size; item->apply_to_clippath(item); item->apply_to_mask(item); } @@ -97,26 +87,12 @@ LPESimplify::newWidget() vbox->set_spacing(2); std::vector::iterator it = param_vector.begin(); Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0)); - Gtk::HBox * buttonsBottom = Gtk::manage(new Gtk::HBox(true,0)); while (it != param_vector.end()) { if ((*it)->widget_is_visible) { Parameter * param = *it; Gtk::Widget * widg = dynamic_cast(param->param_newWidget()); if (param->param_key == "simplifyindividualpaths" || param->param_key == "simplifyJustCoalesce") - { - Glib::ustring * tip = param->param_getTooltip(); - if (widg) { - buttonsBottom->pack_start(*widg, true, true, 2); - if (tip) { - widg->set_tooltip_text(*tip); - } else { - widg->set_tooltip_text(""); - widg->set_has_tooltip(false); - } - } - } else if (param->param_key == "nodes" || - param->param_key == "handles") { Glib::ustring * tip = param->param_getTooltip(); if (widg) { @@ -128,7 +104,7 @@ LPESimplify::newWidget() widg->set_has_tooltip(false); } } - }else{ + } else{ Glib::ustring * tip = param->param_getTooltip(); if (widg) { Gtk::HBox * scalarParameter = dynamic_cast(widg); @@ -149,7 +125,6 @@ LPESimplify::newWidget() ++it; } vbox->pack_start(*buttons,true, true, 2); - vbox->pack_start(*buttonsBottom,true, true, 2); return dynamic_cast(vbox); } @@ -212,7 +187,7 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) curve_endit = path_it->end_open(); } } - if(nodes){ + if(helper_size > 0){ drawNode(curve_it1->initialPoint()); } nCurve->moveto(curve_it1->initialPoint()); @@ -255,7 +230,7 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) if (cubic) { pointAt1 = (*cubic)[1]; pointAt2 = (*cubic)[2]; - if(handles) { + if(helper_size > 0) { if(!are_near((*cubic)[0],(*cubic)[1])){ drawHandle((*cubic)[1]); drawHandleLine((*cubic)[0],(*cubic)[1]); @@ -266,7 +241,7 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) } } } - if(nodes) { + if(helper_size > 0) { drawNode(curve_it1->finalPoint()); } ++curve_it1; @@ -314,7 +289,7 @@ LPESimplify::drawHandleLine(Geom::Point p,Geom::Point p2) Geom::Path path; path.start( p ); double diameter = radiusHelperNodes; - if(handles && Geom::distance(p,p2) > (diameter * 0.35)){ + if(helper_size > 0 && Geom::distance(p,p2) > (diameter * 0.35)){ Geom::Ray ray2(p, p2); p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35)); } -- cgit v1.2.3 From a9469b254f4d9546f3619a688f845da53b065178 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 9 Apr 2015 21:38:17 +0200 Subject: Fix coding style issues in simplify LPE (bzr r14046) --- src/live_effects/lpe-simplify.cpp | 190 +++++++++++++++++++------------------- 1 file changed, 95 insertions(+), 95 deletions(-) (limited to 'src/live_effects/lpe-simplify.cpp') diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index 1fe18dd5e..7fc20ede1 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -27,39 +27,39 @@ namespace LivePathEffect { LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) : Effect(lpeobject), - steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), - threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), - smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), - helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 5), - simplifyindividualpaths(_("Paths separately"), _("Simplifying paths (separately)"), "simplifyindividualpaths", &wr, this, false, - "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), - simplifyJustCoalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplifyJustCoalesce", &wr, this, false, - "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")) - { - registerParameter(&steps); - registerParameter(&threshold); - registerParameter(&smooth_angles); - registerParameter(&helper_size); - registerParameter(&simplifyindividualpaths); - registerParameter(&simplifyJustCoalesce); + steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), + threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), + smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), + helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 5), + simplify_individual_paths(_("Paths separately"), _("Simplifying paths (separately)"), "simplify_individual_paths", &wr, this, false, + "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), + simplify_just_coalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplify_just_coalesce", &wr, this, false, + "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")) +{ + registerParameter(&steps); + registerParameter(&threshold); + registerParameter(&smooth_angles); + registerParameter(&helper_size); + registerParameter(&simplify_individual_paths); + registerParameter(&simplify_just_coalesce); - threshold.param_set_range(0.0001, Geom::infinity()); - threshold.param_set_increments(0.0001, 0.0001); - threshold.param_set_digits(6); + threshold.param_set_range(0.0001, Geom::infinity()); + threshold.param_set_increments(0.0001, 0.0001); + threshold.param_set_digits(6); - steps.param_set_range(0, 100); - steps.param_set_increments(1, 1); - steps.param_set_digits(0); + steps.param_set_range(0, 100); + steps.param_set_increments(1, 1); + steps.param_set_digits(0); - smooth_angles.param_set_range(0.0, 365.0); - smooth_angles.param_set_increments(10, 10); - smooth_angles.param_set_digits(2); + smooth_angles.param_set_range(0.0, 365.0); + smooth_angles.param_set_increments(10, 10); + smooth_angles.param_set_digits(2); - helper_size.param_set_range(0.0, 999.0); - helper_size.param_set_increments(5, 5); - helper_size.param_set_digits(2); + helper_size.param_set_range(0.0, 999.0); + helper_size.param_set_increments(5, 5); + helper_size.param_set_digits(2); - radiusHelperNodes = 6.0; + radius_helper_nodes = 6.0; } LPESimplify::~LPESimplify() {} @@ -67,12 +67,12 @@ LPESimplify::~LPESimplify() {} void LPESimplify::doBeforeEffect (SPLPEItem const* lpeitem) { - if(!hp.empty()){ + if(!hp.empty()) { hp.clear(); } bbox = SP_ITEM(lpeitem)->visualBounds(); SPLPEItem * item = const_cast(lpeitem); - radiusHelperNodes = helper_size; + radius_helper_nodes = helper_size; item->apply_to_clippath(item); item->apply_to_mask(item); } @@ -91,9 +91,8 @@ LPESimplify::newWidget() if ((*it)->widget_is_visible) { Parameter * param = *it; Gtk::Widget * widg = dynamic_cast(param->param_newWidget()); - if (param->param_key == "simplifyindividualpaths" || - param->param_key == "simplifyJustCoalesce") - { + if (param->param_key == "simplify_individual_paths" || + param->param_key == "simplify_just_coalesce") { Glib::ustring * tip = param->param_getTooltip(); if (widg) { buttons->pack_start(*widg, true, true, 2); @@ -104,13 +103,13 @@ LPESimplify::newWidget() widg->set_has_tooltip(false); } } - } else{ + } else { Glib::ustring * tip = param->param_getTooltip(); if (widg) { - Gtk::HBox * scalarParameter = dynamic_cast(widg); - std::vector< Gtk::Widget* > childList = scalarParameter->get_children(); - Gtk::Entry* entryWidg = dynamic_cast(childList[1]); - entryWidg->set_width_chars(8); + Gtk::HBox * horizontal_box = dynamic_cast(widg); + std::vector< Gtk::Widget* > child_list = horizontal_box->get_children(); + Gtk::Entry* entry_widg = dynamic_cast(child_list[1]); + entry_widg->set_width_chars(8); vbox->pack_start(*widg, true, true, 2); if (tip) { widg->set_tooltip_text(*tip); @@ -128,28 +127,29 @@ LPESimplify::newWidget() return dynamic_cast(vbox); } -void -LPESimplify::doEffect(SPCurve *curve) { +void +LPESimplify::doEffect(SPCurve *curve) +{ Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(curve->get_pathvector()); gdouble size = Geom::L2(bbox->dimensions()); //size /= Geom::Affine(0,0,0,0,0,0).descrim(); Path* pathliv = Path_for_pathvector(original_pathv); - if(simplifyindividualpaths){ + if(simplify_individual_paths) { size = Geom::L2(Geom::bounds_fast(original_pathv)->dimensions()); } - for (int unsigned i = 0; i < steps; i++){ - if ( simplifyJustCoalesce ) { - pathliv->Coalesce(threshold * size); - }else{ - pathliv->ConvertEvenLines(threshold * size); - pathliv->Simplify(threshold * size); + for (int unsigned i = 0; i < steps; i++) { + if ( simplify_just_coalesce ) { + pathliv->Coalesce(threshold * size); + } else { + pathliv->ConvertEvenLines(threshold * size); + pathliv->Simplify(threshold * size); } } Geom::PathVector result = Geom::parse_svg_path(pathliv->svg_dump_path()); generateHelperPathAndSmooth(result); curve->set_pathvector(result); SPDesktop* desktop = SP_ACTIVE_DESKTOP; - if(desktop && INK_IS_NODE_TOOL(desktop->event_context)){ + if(desktop && INK_IS_NODE_TOOL(desktop->event_context)) { Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); nt->update_helperpath(); } @@ -158,15 +158,15 @@ LPESimplify::doEffect(SPCurve *curve) { void LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) { - if(steps < 1){ + if(steps < 1) { return; } - Geom::PathVector tmpPath; + Geom::PathVector tmp_path; Geom::CubicBezier const *cubic = NULL; for (Geom::PathVector::iterator path_it = result.begin(); path_it != result.end(); ++path_it) { //Si está vacío... - if (path_it->empty()){ - continue; + if (path_it->empty()) { + continue; } //Itreadores Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve @@ -174,68 +174,68 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop SPCurve *nCurve = new SPCurve(); if (path_it->closed()) { - // if the path is closed, maybe we have to stop a bit earlier because the - // closing line segment has zerolength. - const Geom::Curve &closingline = - path_it->back_closed(); // the closing line segment is always of type - // Geom::LineSegment. - if (are_near(closingline.initialPoint(), closingline.finalPoint())) { - // closingline.isDegenerate() did not work, because it only checks for - // *exact* zero length, which goes wrong for relative coordinates and - // rounding errors... - // the closing line segment has zero-length. So stop before that one! - curve_endit = path_it->end_open(); - } + // if the path is closed, maybe we have to stop a bit earlier because the + // closing line segment has zerolength. + const Geom::Curve &closingline = + path_it->back_closed(); // the closing line segment is always of type + // Geom::LineSegment. + if (are_near(closingline.initialPoint(), closingline.finalPoint())) { + // closingline.isDegenerate() did not work, because it only checks for + // *exact* zero length, which goes wrong for relative coordinates and + // rounding errors... + // the closing line segment has zero-length. So stop before that one! + curve_endit = path_it->end_open(); + } } - if(helper_size > 0){ + if(helper_size > 0) { drawNode(curve_it1->initialPoint()); } nCurve->moveto(curve_it1->initialPoint()); Geom::Point start = Geom::Point(0,0); while (curve_it1 != curve_endit) { cubic = dynamic_cast(&*curve_it1); - Geom::Point pointAt1 = curve_it1->initialPoint(); - Geom::Point pointAt2 = curve_it1->finalPoint(); - Geom::Point pointAt3 = curve_it1->finalPoint(); - Geom::Point pointAt4 = curve_it1->finalPoint(); + Geom::Point point_at1 = curve_it1->initialPoint(); + Geom::Point point_at2 = curve_it1->finalPoint(); + Geom::Point point_at3 = curve_it1->finalPoint(); + Geom::Point point_at4 = curve_it1->finalPoint(); if (cubic) { - pointAt1 = (*cubic)[1]; - pointAt2 = (*cubic)[2]; + point_at1 = (*cubic)[1]; + point_at2 = (*cubic)[2]; } - if(start == Geom::Point(0,0)){ - start = pointAt1; + if(start == Geom::Point(0,0)) { + start = point_at1; } - - if(path_it->closed() && curve_it2 == curve_endit){ - pointAt4 = start; + + if(path_it->closed() && curve_it2 == curve_endit) { + point_at4 = start; } - if(curve_it2 != curve_endit){ + if(curve_it2 != curve_endit) { cubic = dynamic_cast(&*curve_it2); if (cubic) { - pointAt4 = (*cubic)[1]; + point_at4 = (*cubic)[1]; } } - Geom::Ray ray1(pointAt2, pointAt3); - Geom::Ray ray2(pointAt3, pointAt4); + Geom::Ray ray1(point_at2, point_at3); + Geom::Ray ray2(point_at3, point_at4); double angle1 = Geom::rad_to_deg(ray1.angle()); double angle2 = Geom::rad_to_deg(ray2.angle()); - if((smooth_angles >= angle2 - angle1) && !are_near(pointAt4,pointAt3) && !are_near(pointAt2,pointAt3)){ - double dist = Geom::distance(pointAt2,pointAt3); + if((smooth_angles >= angle2 - angle1) && !are_near(point_at4,point_at3) && !are_near(point_at2,point_at3)) { + double dist = Geom::distance(point_at2,point_at3); Geom::Angle angleFixed = ray2.angle(); angleFixed -= Geom::Angle::from_degrees(180.0); - pointAt2 = Geom::Point::polar(angleFixed,dist) + pointAt3; + point_at2 = Geom::Point::polar(angleFixed,dist) + point_at3; } - nCurve->curveto(pointAt1, pointAt2, curve_it1->finalPoint()); + nCurve->curveto(point_at1, point_at2, curve_it1->finalPoint()); cubic = dynamic_cast(nCurve->last_segment()); if (cubic) { - pointAt1 = (*cubic)[1]; - pointAt2 = (*cubic)[2]; + point_at1 = (*cubic)[1]; + point_at2 = (*cubic)[2]; if(helper_size > 0) { - if(!are_near((*cubic)[0],(*cubic)[1])){ + if(!are_near((*cubic)[0],(*cubic)[1])) { drawHandle((*cubic)[1]); drawHandleLine((*cubic)[0],(*cubic)[1]); } - if(!are_near((*cubic)[3],(*cubic)[2])){ + if(!are_near((*cubic)[3],(*cubic)[2])) { drawHandle((*cubic)[2]); drawHandleLine((*cubic)[3],(*cubic)[2]); } @@ -250,17 +250,17 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) if (path_it->closed()) { nCurve->closepath_current(); } - tmpPath.push_back(nCurve->get_pathvector()[0]); + tmp_path.push_back(nCurve->get_pathvector()[0]); nCurve->reset(); delete nCurve; } - result = tmpPath; + result = tmp_path; } -void +void LPESimplify::drawNode(Geom::Point p) { - double r = radiusHelperNodes; + double r = radius_helper_nodes; char const * svgd; svgd = "M 0.55,0.5 A 0.05,0.05 0 0 1 0.5,0.55 0.05,0.05 0 0 1 0.45,0.5 0.05,0.05 0 0 1 0.5,0.45 0.05,0.05 0 0 1 0.55,0.5 Z M 0,0 1,0 1,1 0,1 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); @@ -273,7 +273,7 @@ LPESimplify::drawNode(Geom::Point p) void LPESimplify::drawHandle(Geom::Point p) { - double r = radiusHelperNodes; + double r = radius_helper_nodes; char const * svgd; svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); @@ -288,8 +288,8 @@ LPESimplify::drawHandleLine(Geom::Point p,Geom::Point p2) { Geom::Path path; path.start( p ); - double diameter = radiusHelperNodes; - if(helper_size > 0 && Geom::distance(p,p2) > (diameter * 0.35)){ + double diameter = radius_helper_nodes; + if(helper_size > 0 && Geom::distance(p,p2) > (diameter * 0.35)) { Geom::Ray ray2(p, p2); p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35)); } -- cgit v1.2.3