From: joncruz Date: Tue, 7 Apr 2009 06:42:08 +0000 (+0000) Subject: Ctor fixes and misc warning cleanups X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=20c5e43449059a494026d53fcde8be3d28b1b608;p=inkscape.git Ctor fixes and misc warning cleanups --- diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp index 4cf3e35e6..49073fd64 100644 --- a/src/live_effects/lpe-rough-hatches.cpp +++ b/src/live_effects/lpe-rough-hatches.cpp @@ -222,7 +222,7 @@ Piecewise > bend(Piecewise > const &f, Piecewise b //-------------------------------------------------------- LPERoughHatches::LPERoughHatches(LivePathEffectObject *lpeobject) : Effect(lpeobject), - direction(_("Hatches width and dir"), _("Defines hatches frequency and direction"), "direction", &wr, this, Geom::Point(50,0)), + hatch_dist(0), dist_rdm(_("Frequency randomness"), _("Variation of dist between hatches, in %."), "dist_rdm", &wr, this, 75), growth(_("Growth"), _("Growth of distance between hatches."), "growth", &wr, this, 0.), //FIXME: top/bottom names are inverted in the UI/svg and in the code!! @@ -230,23 +230,25 @@ LPERoughHatches::LPERoughHatches(LivePathEffectObject *lpeobject) : scale_tb(_("1st side, out"), _("Set smoothness/sharpness of path when leaving a 'bottom' halfturn. 0=sharp, 1=default"), "scale_bb", &wr, this, 1.), scale_bf(_("2nd side, in "), _("Set smoothness/sharpness of path when reaching a 'top' halfturn. 0=sharp, 1=default"), "scale_tf", &wr, this, 1.), scale_bb(_("2nd side, out"), _("Set smoothness/sharpness of path when leaving a 'top' halfturn. 0=sharp, 1=default"), "scale_tb", &wr, this, 1.), - top_smth_variation(_("variance: 1st side"), _("Randomness of 'bottom' halfturns smoothness"), "top_smth_variation", &wr, this, 0), - bot_smth_variation(_("2nd side"), _("Randomness of 'top' halfturns smoothness"), "bottom_smth_variation", &wr, this, 0), -// top_edge_variation(_("Magnitude jitter: 1st side"), _("Randomly moves 'bottom' halfsturns to produce magnitude variations."), "bottom_edge_variation", &wr, this, 0), bot_edge_variation(_("2nd side"), _("Randomly moves 'top' halfsturns to produce magnitude variations."), "top_edge_variation", &wr, this, 0), top_tgt_variation(_("Parallelism jitter: 1st side"), _("Add direction randomness by moving 'bottom' halfsturns tangentially to the boundary."), "bottom_tgt_variation", &wr, this, 0), bot_tgt_variation(_("2nd side"), _("Add direction randomness by randomly moving 'top' halfsturns tangentially to the boundary."), "top_tgt_variation", &wr, this, 0), -// - do_bend(_("Bend hatches"), _("Add a global bend to the hatches (slower)"), "do_bend", &wr, this, true), - //bender(_("Global bending"), _("Relative position to ref point defines global bending direction and amount"), "bender", &wr, this, NULL, Geom::Point(-5,0)), - bender(_("Global bending"), _("Relative position to ref point defines global bending direction and amount"), "bender", &wr, this, Geom::Point(-5,0)), + top_smth_variation(_("variance: 1st side"), _("Randomness of 'bottom' halfturns smoothness"), "top_smth_variation", &wr, this, 0), + bot_smth_variation(_("2nd side"), _("Randomness of 'top' halfturns smoothness"), "bottom_smth_variation", &wr, this, 0), // fat_output(_("Generate thick/thin path"), _("Simulate a stroke of varrying width"), "fat_output", &wr, this, true), + do_bend(_("Bend hatches"), _("Add a global bend to the hatches (slower)"), "do_bend", &wr, this, true), stroke_width_top(_("Thikness: at 1st side"), _("Width at 'bottom' half turns"), "stroke_width_top", &wr, this, 1.), stroke_width_bot(_("at 2nd side"), _("Width at 'top' halfturns"), "stroke_width_bottom", &wr, this, 1.), +// front_thickness(_("from 2nd to 1st side"), _("Width of paths from 'top' to 'bottom' halfturns"), "front_thickness", &wr, this, 1.), - back_thickness(_("from 1st to 2nd side"), _("Width of paths from 'top' to 'bottom' halfturns"), "back_thickness", &wr, this, .25) + back_thickness(_("from 1st to 2nd side"), _("Width of paths from 'top' to 'bottom' halfturns"), "back_thickness", &wr, this, .25), + + direction(_("Hatches width and dir"), _("Defines hatches frequency and direction"), "direction", &wr, this, Geom::Point(50,0)), +// + //bender(_("Global bending"), _("Relative position to ref point defines global bending direction and amount"), "bender", &wr, this, NULL, Geom::Point(-5,0)), + bender(_("Global bending"), _("Relative position to ref point defines global bending direction and amount"), "bender", &wr, this, Geom::Point(-5,0)) { registerParameter( dynamic_cast(&direction) ); registerParameter( dynamic_cast(&dist_rdm) ); diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp index 22c758d10..2fa96597f 100644 --- a/src/live_effects/lpe-sketch.cpp +++ b/src/live_effects/lpe-sketch.cpp @@ -32,25 +32,25 @@ LPESketch::LPESketch(LivePathEffectObject *lpeobject) : // initialise your parameters here: //testpointA(_("Test Point A"), _("Test A"), "ptA", &wr, this, Geom::Point(100,100)), nbiter_approxstrokes(_("Strokes"), _("Draw that many approximating strokes"), "nbiter_approxstrokes", &wr, this, 5), - strokelength(_("Max stroke length"), + strokelength(_("Max stroke length"), _("Maximum length of approximating strokes"), "strokelength", &wr, this, 100.), - strokelength_rdm(_("Stroke length variation"), + strokelength_rdm(_("Stroke length variation"), _("Random variation of stroke length (relative to maximum length)"), "strokelength_rdm", &wr, this, .3), - strokeoverlap(_("Max. overlap"), + strokeoverlap(_("Max. overlap"), _("How much successive strokes should overlap (relative to maximum length)"), "strokeoverlap", &wr, this, .3), - strokeoverlap_rdm(_("Overlap variation"), + strokeoverlap_rdm(_("Overlap variation"), _("Random variation of overlap (relative to maximum overlap)"), "strokeoverlap_rdm", &wr, this, .3), - ends_tolerance(_("Max. end tolerance"), + ends_tolerance(_("Max. end tolerance"), _("Maximum distance between ends of original and approximating paths (relative to maximum length)"), "ends_tolerance", &wr, this, .1), - parallel_offset(_("Parallel offset"), + parallel_offset(_("Parallel offset"), _("Average distance from approximating path to original path"), "parallel_offset", &wr, this, 5.), - tremble_size(_("Max. tremble"), + tremble_size(_("Max. tremble"), _("Maximum tremble magnitude"), "tremble_size", &wr, this, 5.), - tremble_frequency(_("Tremble frequency"), + tremble_frequency(_("Tremble frequency"), _("Average number of tremble periods in an approximating stroke"), "tremble_frequency", &wr, this, 1.), - nbtangents(_("Construction lines"), + nbtangents(_("Construction lines"), _("How many construction lines (tangents) to draw"), "nbtangents", &wr, this, 5), - tgtscale(_("Scale"), + tgtscale(_("Scale"), _("Scale factor relating curvature and length of construction lines (try 5*offset)"), "tgtscale", &wr, this, 10.0), tgtlength(_("Max. length"), _("Maximum length of construction lines"), "tgtlength", &wr, this, 100.0), tgtlength_rdm(_("Length variation"), _("Random variation of the length of construction lines"), "tgtlength_rdm", &wr, this, .3) @@ -134,11 +134,11 @@ addLinearEnds (Geom::Piecewise > & m){ //This returns a random perturbation. Notice the domain is [s0,s0+first multiple of period>s1]... -Geom::Piecewise > +Geom::Piecewise > LPESketch::computePerturbation (double s0, double s1){ using namespace Geom; Piecewise >res; - + //global offset for this stroke. double offsetX = parallel_offset-parallel_offset.get_value(); double offsetY = parallel_offset-parallel_offset.get_value(); @@ -149,7 +149,7 @@ LPESketch::computePerturbation (double s0, double s1){ dA[dim] = 2*tremble_size-tremble_size.get_value(); } //compute howmany deg 3 sbasis to concat according to frequency. - unsigned count = unsigned((s1-s0)/strokelength*tremble_frequency)+1; + unsigned count = unsigned((s1-s0)/strokelength*tremble_frequency)+1; for (unsigned i=0; i perturb = D2(SBasis(2, Linear()), SBasis(2, Linear())); for (unsigned dim=0; dim<2; dim++){ @@ -189,7 +189,7 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise > const & pwd2_ //----- Approximated Strokes. std::vector > > pieces_in = split_at_discontinuities (pwd2_in); - + //work separately on each component. for (unsigned pieceidx = 0; pieceidx < pieces_in.size(); pieceidx++){ @@ -198,22 +198,22 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise > const & pwd2_ double piece_total_length = piecelength.segs.back().at1()-piecelength.segs.front().at0(); pathlength.concat(piecelength + total_length); total_length += piece_total_length; - + //TODO: better check this on the Geom::Path. - bool closed = piece.segs.front().at0() == piece.segs.back().at1(); - if (closed){ + bool closed = piece.segs.front().at0() == piece.segs.back().at1(); + if (closed){ piece.concat(piece); piecelength.concat(piecelength+piece_total_length); } for (unsigned i = 0; i > const & pwd2_ if (!closed && s1>piece_total_length - ends_tolerance.get_value()*strokelength) break; if ( closed && s0>piece_total_length + s0_initial) break; - std::vector times; - times = roots(piecelength-s0); + std::vector times; + times = roots(piecelength-s0); t0 = times.at(0);//there should be one and only one solution!! - + // pick a new end point (s1 = s0 + strokelength). s1 = s0 + strokelength*(1-strokelength_rdm); // don't let it go beyond the end of the orgiginal path. @@ -242,10 +242,10 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise > const & pwd2_ s1 = 2*piece_total_length - strokeoverlap*(1-strokeoverlap_rdm)*strokelength-0.0001; } } - times = roots(piecelength-s1); + times = roots(piecelength-s1); if (times.size()==0) break;//we should not be there. t1 = times[0]; - + //pick a rdm perturbation, and collect the perturbed piece into output. Piecewise > pwperturb = computePerturbation(s0-0.01,s1+0.01); pwperturb = compose(pwperturb,portion(piecelength,t0,t1)); @@ -273,11 +273,11 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise > const & pwd2_ // pick a point where to draw a tangent (s = dist from start along path). double s = total_length * ( i + tgtlength_rdm ) / (nbtangents+1.); - std::vector times; + std::vector times; times = roots(pathlength-s); double t = times.at(0);//there should be one and only one solution! Point m_t = m(t), v_t = v(t), a_t = a(t); - //Compute tgt length according to curvature (not exceeding tgtlength) so that + //Compute tgt length according to curvature (not exceeding tgtlength) so that // dist to origninal curve ~ 4 * (parallel_offset+tremble_size). //TODO: put this 4 as a parameter in the UI... //TODO: what if with v=0? @@ -292,12 +292,12 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise > const & pwd2_ } output.concat(Piecewise >(tgt)); } - + return output; } void -LPESketch::doBeforeEffect (SPLPEItem *lpeitem) +LPESketch::doBeforeEffect (SPLPEItem */*lpeitem*/) { //init random parameters. parallel_offset.resetRandomizer(); diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index f18c4011b..32fb763d3 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -44,16 +44,16 @@ VonKochRefPathParam::param_readSVGValue(const gchar * strvalue) LPEVonKoch::LPEVonKoch(LivePathEffectObject *lpeobject) : Effect(lpeobject), - ref_path(_("Reference segment"), _("The reference segment. Defaults to bbox diameter."), "ref_path", &wr, this, "M0,0 L10,0"), - //refA(_("Ref Start"), _("Left side middle of the reference box"), "refA", &wr, this), - //refB(_("Ref End"), _("Right side middle of the reference box"), "refB", &wr, this), + nbgenerations(_("Nb of generations"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1), generator(_("Generating path"), _("Path whose segments define the iterated transforms"), "generator", &wr, this, "M0,0 L30,0 M0,10 L10,10 M 20,10 L30,10"), similar_only(_("Use uniform transforms only"), _("2 consecutive segments are used to reverse/preserve orientation only (otherwise, they define a general transform)."), "similar_only", &wr, this, false), - nbgenerations(_("Nb of generations"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1), drawall(_("Draw all generations"), _("If unchecked, draw only the last generation"), "drawall", &wr, this, true), + //,draw_boxes(_("Display boxes"), _("Display boxes instead of paths only"), "draw_boxes", &wr, this, true) + ref_path(_("Reference segment"), _("The reference segment. Defaults to bbox diameter."), "ref_path", &wr, this, "M0,0 L10,0"), + //refA(_("Ref Start"), _("Left side middle of the reference box"), "refA", &wr, this), + //refB(_("Ref End"), _("Right side middle of the reference box"), "refB", &wr, this), //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug. maxComplexity(_("Max complexity"), _("Disable effect if the output is too complex"), "maxComplexity", &wr, this, 1000) - //,draw_boxes(_("Display boxes"), _("Display boxes instead of paths only"), "draw_boxes", &wr, this, true) { //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug. registerParameter( dynamic_cast(&ref_path) ); diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp index abe3cee3a..35afe7f5d 100644 --- a/src/live_effects/parameter/vector.cpp +++ b/src/live_effects/parameter/vector.cpp @@ -164,7 +164,7 @@ public: VectorParamKnotHolderEntity_Vector(VectorParam *p) : param(p) { } virtual ~VectorParamKnotHolderEntity_Vector() {} - virtual void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { + virtual void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { Geom::Point const s = p - param->origin; /// @todo implement angle snapping when holding CTRL param->setVector(s);