From 3ed9b4ff7ebbae3ba6446d911001688bcbbdc847 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 10 Nov 2013 12:17:23 +0100 Subject: Update to trunk (bzr r11950.1.196) --- src/ui/tools/node-tool.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/tools') diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index 4d15ab70e..b3acb79ad 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -14,6 +14,7 @@ #include #include #include "ui/tools/tool-base.h" +#include "selection.h" namespace Inkscape { namespace Display { -- cgit v1.2.3 From fb006b59b6d7b6d059dffe3389a829d2213f648d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 28 Dec 2013 23:34:45 +0100 Subject: Fix crash bug continuing empty paths (bzr r11950.1.210) --- src/ui/tools/pen-tool.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index ebbc533b8..178a940a2 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1648,6 +1648,7 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc) Geom::Point C(0,0); if(!pc->sa || pc->sa->curve->is_empty()){ tmpCurve = pc->green_curve->create_reverse(); + if(pc->green_curve->get_segment_count()==0)return; Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); if(pc->bspline){ C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint()); @@ -1715,6 +1716,7 @@ static void bspline_spiro_end_anchor_off(PenTool *const pc) SPCurve *lastSeg = new SPCurve(); if(!pc->sa || pc->sa->curve->is_empty()){ tmpCurve = pc->green_curve->create_reverse(); + if(pc->green_curve->get_segment_count()==0)return; Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); if(cubic){ lastSeg->moveto((*cubic)[0]); -- cgit v1.2.3 From 4c6918c72721a35e0347e9e087396238e72eb62e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 20:41:32 +0100 Subject: Refactorizing (bzr r11950.1.212) --- src/ui/tools/freehand-base.cpp | 8 ----- src/ui/tools/freehand-base.h | 2 -- src/ui/tools/node-tool.h | 1 - src/ui/tools/pen-tool.cpp | 74 ++++++++---------------------------------- src/ui/tools/pen-tool.h | 2 -- src/ui/tools/pencil-tool.cpp | 8 ----- 6 files changed, 13 insertions(+), 82 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 14a5b5b35..b6efaebd9 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -247,12 +247,10 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1) { Effect::createAndApply(SPIRO, dc->desktop->doc(), item); } - //BSpline //Añadimos el modo BSpline a los efectos en espera if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) { Effect::createAndApply(BSPLINE, dc->desktop->doc(), item); } - //BSPline End int shape = prefs->getInt(tool_name(dc) + "/shape", 0); bool shape_applied = false; @@ -489,7 +487,6 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), NULL); - if (c->is_empty()) { c->unref(); return; @@ -520,7 +517,6 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->sa->curve->append_continuous(c, 0.0625); c->unref(); dc->sa->curve->closepath_current(); - //BSpline //Si la curva tiene un LPE del tipo BSpline ejecutamos spdc_flush_white //pasándole la curva de inicio necesaria Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -529,7 +525,6 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); spdc_flush_white(dc, dc->sa->curve); }else - //BSpline End spdc_flush_white(dc, NULL); return; } @@ -657,7 +652,6 @@ SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p) } } - //BSpline //Modificamos la curva del "anchor" final para que sea igual que la curva de inicio. //Esta curva fue modificada al continuar la curva y necesitamos que sea igual que la curva en //la que cerramos el trazado. @@ -670,7 +664,6 @@ SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p) active->curve->ref(); } } - //BSpline End return active; } @@ -815,4 +808,3 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : - diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h index 7d60e217f..7e53684e3 100644 --- a/src/ui/tools/freehand-base.h +++ b/src/ui/tools/freehand-base.h @@ -57,7 +57,6 @@ public: SPCanvasItem *blue_bpath; SPCurve *blue_curve; - // Green GSList *green_bpaths; SPCurve *green_curve; @@ -143,4 +142,3 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : - diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index b3acb79ad..4d15ab70e 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -14,7 +14,6 @@ #include #include #include "ui/tools/tool-base.h" -#include "selection.h" namespace Inkscape { namespace Display { diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 178a940a2..f8d8d4c90 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1,4 +1,4 @@ - /** \file +/** \file * Pen event context implementation. */ @@ -20,7 +20,6 @@ #include #include - #include "ui/tools/pen-tool.h" #include "sp-namedview.h" #include "desktop.h" @@ -43,7 +42,6 @@ #include "context-fns.h" #include "tools-switch.h" #include "ui/control-manager.h" -//BSpline //Incluimos los archivos necesarios para las BSpline y Spiro #define INKSCAPE_LPE_SPIRO_C #include "live_effects/lpe-spiro.h" @@ -64,11 +62,9 @@ #include "live_effects/spiro.h" - #define INKSCAPE_LPE_BSPLINE_C #include "live_effects/lpe-bspline.h" #include <2geom/nearest-point.h> -//BSpline End #include "tool-factory.h" @@ -80,10 +76,6 @@ namespace UI { namespace Tools { static void spdc_pen_set_initial_point(PenTool *pc, Geom::Point const p); -/* - *BSpline - *Added functions -*/ //Añade los modos spiro y bspline static void sp_pen_context_set_mode(PenTool *const pc, guint mode); //Esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro @@ -112,7 +104,7 @@ static void bspline_spiro_build(PenTool *const pc); static void bspline_doEffect(SPCurve * curve); //function spiro cloned from lpe-spiro.cpp static void spiro_doEffect(SPCurve * curve); -//BSpline end + static void spdc_pen_set_subsequent_point(PenTool *const pc, Geom::Point const p, bool statusbar, guint status = 0); static void spdc_pen_set_ctrl(PenTool *pc, Geom::Point const p, guint state); static void spdc_pen_finish_segment(PenTool *pc, Geom::Point p, guint state); @@ -205,14 +197,11 @@ void sp_pen_context_set_polyline_mode(PenTool *const pc) { guint mode = prefs->getInt("/tools/freehand/pen/freehand-mode", 0); pc->polylines_only = (mode == 3 || mode == 4); pc->polylines_paraxial = (mode == 4); - //BSpline //we call the function which defines the Spiro modes and the BSpline //todo: merge to one function only sp_pen_context_set_mode(pc, mode); - //BSpline End } -//BSpline /* *.Set the mode of draw spiro, and bsplines */ @@ -220,7 +209,6 @@ void sp_pen_context_set_mode(PenTool *const pc, guint mode) { pc->spiro = (mode == 1); pc->bspline = (mode == 2); } -//BSpline End /** * Callback to initialize PenTool object. @@ -422,12 +410,11 @@ static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bev if(!bevent.button == 3 && (pc->spiro || pc->bspline) && pc->npoints > 0 && pc->p[0] == pc->p[3]){ return FALSE; } - //BSpline end gint ret = FALSE; if (bevent.button == 1 && !event_context->space_panning // make sure this is not the last click for a waiting LPE (otherwise we want to finish the path) - && (pc->expecting_clicks_for_LPE != 1)) { + && pc->expecting_clicks_for_LPE != 1) { if (Inkscape::have_viable_layer(desktop, dc->message_context) == false) { return TRUE; @@ -487,12 +474,10 @@ static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bev // Set start anchor pc->sa = anchor; - //BSpline //Continuamos una curva existente if(anchor){ bspline_spiro_start_anchor(pc,(bevent.state & GDK_SHIFT_MASK)); } - //BSpline End if (anchor && !sp_pen_context_has_waiting_LPE(pc)) { // Adjust point to anchor if needed; if we have a waiting LPE, we need // a fresh path to be created so don't continue an existing one @@ -544,10 +529,8 @@ static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bev } } - //BSpline //Evitamos la creación de un punto de control para que se cree el nodo en el evento de soltar pc->state = (pc->spiro || pc->bspline || pc->polylines_only) ? PenTool::POINT : PenTool::CONTROL; - //BSpline End ret = TRUE; break; @@ -585,6 +568,7 @@ static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bev if (pc->expecting_clicks_for_LPE > 0) { --pc->expecting_clicks_for_LPE; } + return ret; } @@ -609,8 +593,7 @@ static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &me } Geom::Point const event_w(mevent.x, - mevent.y); - //BSpline + mevent.y); //we take out the function the const "tolerance" because we need it later Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gint const tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -620,7 +603,6 @@ static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &me return FALSE; // Do not drag if we're within tolerance from origin. } } - //BSpline END // Once the user has moved farther than tolerance from the original location // (indicating they intend to move the object, not click), then always process the // motion notify coordinates as given (no snapping back to origin) @@ -736,7 +718,6 @@ static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &me default: break; } - //BSpline //Lanzamos la función "bspline_spiro_motion" al moverse el ratón o cuando se para. if(pc->bspline){ bspline_spiro_color(pc); @@ -748,7 +729,7 @@ static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &me pen_drag_origin_w = event_w; } } - //BSpline End + return ret; } @@ -761,7 +742,7 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r // skip event processing if events are disabled return FALSE; } - + gint ret = FALSE; ToolBase *event_context = SP_EVENT_CONTEXT(pc); @@ -776,7 +757,6 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r // Test whether we hit any anchor. SPDrawAnchor *anchor = spdc_test_inside(pc, event_w); - //BSpline //with this we avoid creating a new point over the existing one if(pc->spiro || pc->bspline){ //Si intentamos crear un nodo en el mismo sitio que el origen, paramos. @@ -784,7 +764,7 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r return FALSE; } } - //BSpline End + switch (pc->mode) { case PenTool::MODE_CLICK: switch (pc->state) { @@ -795,14 +775,12 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r p = anchor->dp; } pc->sa = anchor; - //BSpline //continuamos una curva existente if (anchor) { if(pc->bspline || pc->spiro){ bspline_spiro_start_anchor(pc,(revent.state & GDK_SHIFT_MASK)); } } - //BSpline End spdc_pen_set_initial_point(pc, p); } else { // Set end anchor here @@ -827,12 +805,10 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r spdc_endpoint_snap(pc, p, revent.state); } spdc_pen_finish_segment(pc, p, revent.state); - //BSpline //Ocultamos la guia del penultimo nodo al cerrar la curva if(pc->spiro){ sp_canvas_item_hide(pc->c1); } - //BSpline End spdc_pen_finish(pc, TRUE); pc->state = PenTool::POINT; ret = TRUE; @@ -856,12 +832,10 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r case PenTool::CLOSE: spdc_endpoint_snap(pc, p, revent.state); spdc_pen_finish_segment(pc, p, revent.state); - //BSpline //Ocultamos la guia del penultimo nodo al cerrar la curva if(pc->spiro){ sp_canvas_item_hide(pc->c1); } - //BSpline End if (pc->green_closed) { // finishing at the start anchor, close curve spdc_pen_finish(pc, TRUE); @@ -873,7 +847,7 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r case PenTool::STOP: // This is allowed, if we just cancelled curve break; - default: + default: break; } pc->state = PenTool::POINT; @@ -911,6 +885,7 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r // handled in spdc_check_for_and_apply_waiting_LPE() in draw-context.cpp } } + return ret; } @@ -938,20 +913,20 @@ static void pen_redraw_all (PenTool *const pc) SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(pc->desktop), pc->green_curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cshape), 0, SP_WIND_RULE_NONZERO); + pc->green_bpaths = g_slist_prepend(pc->green_bpaths, cshape); } if (pc->green_anchor) SP_CTRL(pc->green_anchor->ctrl)->moveto(pc->green_anchor->dp); + pc->red_curve->reset(); pc->red_curve->moveto(pc->p[0]); pc->red_curve->curveto(pc->p[1], pc->p[2], pc->p[3]); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve); // handles - //BSpline //Ocultamos los tiradores en modo BSpline y spiro if (pc->p[0] != pc->p[1] && !pc->spiro && !pc->bspline) { - //BSpline End SP_CTRL(pc->c1)->moveto(pc->p[1]); pc->cl1->setCoords(pc->p[0], pc->p[1]); sp_canvas_item_show(pc->c1); @@ -964,12 +939,10 @@ static void pen_redraw_all (PenTool *const pc) Geom::Curve const * last_seg = pc->green_curve->last_segment(); if (last_seg) { Geom::CubicBezier const * cubic = dynamic_cast( last_seg ); - //BSpline //Ocultamos los tiradores en modo BSpline y spiro if ( cubic && (*cubic)[2] != pc->p[0] && !pc->spiro && !pc->bspline ) { - //BSpline End Geom::Point p2 = (*cubic)[2]; SP_CTRL(pc->c0)->moveto(p2); pc->cl0->setCoords(p2, pc->p[0]); @@ -980,15 +953,12 @@ static void pen_redraw_all (PenTool *const pc) sp_canvas_item_hide(pc->cl0); } } - //BSpline + //Simplemente redibujamos la spiro teniendo en cuenta si el nodo es cusp o symm. //como es un redibujo simplemente no llamamos a la función global //sino al final de esta - - //BSpline //Lanzamos solamente el redibujado bspline_spiro_build(pc); - //BSpline End } static void pen_lastpoint_move (PenTool *const pc, gdouble x, gdouble y) @@ -1019,11 +989,9 @@ static void pen_lastpoint_move_screen (PenTool *const pc, gdouble x, gdouble y) static void pen_lastpoint_tocurve (PenTool *const pc) { - //BSpline //Evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. if (pc->npoints != 5 && !pc->spiro && !pc->bspline) return; - //BSpline Geom::CubicBezier const * cubic; pc->p[1] = pc->red_curve->last_segment()->initialPoint() + (1./3)* (Geom::Point)(pc->red_curve->last_segment()->finalPoint() - pc->red_curve->last_segment()->initialPoint()); //Modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos @@ -1070,13 +1038,11 @@ static void pen_lastpoint_tocurve (PenTool *const pc) } } - //Spiro Live pen_redraw_all(pc); } static void pen_lastpoint_toline (PenTool *const pc) { - //BSpline //Evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. if (pc->npoints != 5 && !pc->bspline) return; @@ -1312,7 +1278,6 @@ static gint pen_handle_key_press(PenTool *const pc, GdkEvent *event) : pc->p[3])); pc->npoints = 2; - //BSpline //Eliminamos el último segmento de la curva verde if( pc->green_curve->get_segment_count() == 1){ pc->npoints = 5; @@ -1335,16 +1300,13 @@ static gint pen_handle_key_press(PenTool *const pc, GdkEvent *event) pc->p[1] = pc->p[0]; } } - //BSpline End sp_canvas_item_hide(pc->cl0); sp_canvas_item_hide(pc->cl1); pc->state = PenTool::POINT; spdc_pen_set_subsequent_point(pc, pt, true); pen_last_paraxial_dir = !pen_last_paraxial_dir; - //BSpline //Redibujamos bspline_spiro_build(pc); - //BSpline End ret = TRUE; } break; @@ -1358,12 +1320,10 @@ static void spdc_reset_colors(PenTool *pc) { // Red pc->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL); // Blue pc->blue_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->blue_bpath), NULL); - // Green while (pc->green_bpaths) { sp_canvas_item_destroy(SP_CANVAS_ITEM(pc->green_bpaths->data)); @@ -2111,8 +2071,6 @@ static void spiro_doEffect(SPCurve * curve) g_free (path); } -//BSpline end - static void spdc_pen_set_subsequent_point(PenTool *const pc, Geom::Point const p, bool statusbar, guint status) { g_assert( pc->npoints != 0 ); @@ -2139,9 +2097,7 @@ static void spdc_pen_set_subsequent_point(PenTool *const pc, Geom::Point const p is_curve = false; } else { // one of the 'regular' modes - //SpiroLive if (pc->p[1] != pc->p[0] || pc->spiro) { - //SpiroLive End pc->red_curve->curveto(pc->p[1], p, p); is_curve = true; } else { @@ -2156,13 +2112,11 @@ static void spdc_pen_set_subsequent_point(PenTool *const pc, Geom::Point const p gchar *message = is_curve ? _("Curve segment: angle %3.2f°, distance %s; with Ctrl to snap angle, Enter to finish the path" ): _("Line segment: angle %3.2f°, distance %s; with Ctrl to snap angle, Enter to finish the path"); - //BSpline if(pc->spiro || pc->bspline){ message = is_curve ? _("Curve segment: angle %3.2f°, distance %s; with Shift to cusp node, Enter to finish the path" ): _("Line segment: angle %3.2f°, distance %s; with Shift to cusp node, Enter to finish the path"); } - //BSpline End spdc_pen_set_angle_distance_status_message(pc, p, 0, message); } } @@ -2369,5 +2323,3 @@ void pen_set_to_nearest_horiz_vert(const PenTool *const pc, Geom::Point &pt, gui End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : - - diff --git a/src/ui/tools/pen-tool.h b/src/ui/tools/pen-tool.h index 553e4c557..b0b56feb4 100644 --- a/src/ui/tools/pen-tool.h +++ b/src/ui/tools/pen-tool.h @@ -48,11 +48,9 @@ public: bool polylines_only; bool polylines_paraxial; - //SpiroLive //Propiedad que guarda si el modo Spiro está activo o no bool spiro; bool bspline; - //SpiroLIve End int num_clicks; unsigned int expecting_clicks_for_LPE; // if positive, finish the path after this many clicks diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index c10bd15a3..2027f0981 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -692,10 +692,8 @@ interpolate(PencilTool *pc) return; } - //BSpline using Geom::X; using Geom::Y; - //BSpline end Inkscape::Preferences *prefs = Inkscape::Preferences::get(); double const tol = prefs->getDoubleLimited("/tools/freehand/pencil/tolerance", 10.0, 1.0, 100.0) * 0.4; @@ -727,12 +725,9 @@ interpolate(PencilTool *pc) { /* Fit and draw and reset state */ pc->green_curve->moveto(b[0]); - //BSpline Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); - //BSpline End for (int c = 0; c < n_segs; c++) { - //BSpline //Si el modo es BSpline modificamos para que el trazado cree los nodos adhoc if(mode == 2){ Geom::Point BP = b[4*c+0] + (1./3)*(b[4*c+3] - b[4*c+0]); @@ -743,7 +738,6 @@ interpolate(PencilTool *pc) }else{ pc->green_curve->curveto(b[4*c+1], b[4*c+2], b[4*c+3]); } - //BSpline } sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->green_curve); @@ -884,7 +878,6 @@ fit_and_split(PencilTool *pc) /* Fit and draw and reset state */ pc->red_curve->reset(); pc->red_curve->moveto(b[0]); - //BSpline using Geom::X; using Geom::Y; //Si el modo es BSpline modificamos para que el trazado cree los nodos adhoc @@ -899,7 +892,6 @@ fit_and_split(PencilTool *pc) }else{ pc->red_curve->curveto(b[1], b[2], b[3]); } - //BSpline End sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve); pc->red_curve_is_valid = true; } else { -- cgit v1.2.3 From 8c6ae51081f4d1d63ba84f9dd339b9f530f06c87 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 21:30:44 +0100 Subject: Start refactor, simplify node.cpp operations,general cleanup, changed brehabiour to need 'Shift' Key to move handles because it handle better operations with small zoom (bzr r11950.1.214) --- src/ui/tools/node-tool.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/tools') diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index 4d15ab70e..b3acb79ad 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -14,6 +14,7 @@ #include #include #include "ui/tools/tool-base.h" +#include "selection.h" namespace Inkscape { namespace Display { -- cgit v1.2.3 From c288aa062e611031f54f6ad8e5e3ee2f581cc783 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 31 Dec 2013 00:29:07 +0100 Subject: Spanish comment of freehand-base.cpp (bzr r11950.1.224) --- src/ui/tools/freehand-base.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index b6efaebd9..5825a149c 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -247,7 +247,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1) { Effect::createAndApply(SPIRO, dc->desktop->doc(), item); } - //Añadimos el modo BSpline a los efectos en espera + //spanish: añadimos el modo bspline a los efectos en espera if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) { Effect::createAndApply(BSPLINE, dc->desktop->doc(), item); } @@ -517,7 +517,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->sa->curve->append_continuous(c, 0.0625); c->unref(); dc->sa->curve->closepath_current(); - //Si la curva tiene un LPE del tipo BSpline ejecutamos spdc_flush_white + //spanish: Si la curva tiene un LPE del tipo bspline o spiro ejecutamos spdc_flush_white //pasándole la curva de inicio necesaria Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || @@ -652,8 +652,8 @@ SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p) } } - //Modificamos la curva del "anchor" final para que sea igual que la curva de inicio. - //Esta curva fue modificada al continuar la curva y necesitamos que sea igual que la curva en + //spanish: modificamos la curva de anclaje para que sea igual que la curva de inicio. + //esta curva fue modificada al continuar la curva y necesitamos que sea igual que la curva en //la que cerramos el trazado. Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if((prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || -- cgit v1.2.3 From cb0d2fad1fa3b8055b86f8d7e911b295e09cf27a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 31 Dec 2013 00:31:15 +0100 Subject: Spanish comment of node-tool.cpp (bzr r11950.1.225) --- src/ui/tools/node-tool.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/tools') diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index b3acb79ad..168ec995a 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -14,6 +14,7 @@ #include #include #include "ui/tools/tool-base.h" +//spanish: lo necesitamos para llamarlo desde el Live Effect #include "selection.h" namespace Inkscape { -- cgit v1.2.3 From 14a50ad8c16b1d840e7a68ba8a75e2cec174a0a5 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 31 Dec 2013 01:02:40 +0100 Subject: Spanish comment of pencil-tool.cpp/.h (bzr r11950.1.226) --- src/ui/tools/pen-tool.cpp | 150 ++++++++++++++++------------------------------ src/ui/tools/pen-tool.h | 2 +- 2 files changed, 54 insertions(+), 98 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index f8d8d4c90..9b5acb6cc 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -42,7 +42,7 @@ #include "context-fns.h" #include "tools-switch.h" #include "ui/control-manager.h" -//Incluimos los archivos necesarios para las BSpline y Spiro +//spanish: incluimos los archivos necesarios para las BSpline y Spiro #define INKSCAPE_LPE_SPIRO_C #include "live_effects/lpe-spiro.h" @@ -76,29 +76,29 @@ namespace UI { namespace Tools { static void spdc_pen_set_initial_point(PenTool *pc, Geom::Point const p); -//Añade los modos spiro y bspline +//spanish: añade los modos spiro y bspline static void sp_pen_context_set_mode(PenTool *const pc, guint mode); -//Esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro +//spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro static void bspline_spiro_color(PenTool *const pc); -//Crea un nodo en modo bspline o spiro +//spanish: crea un nodo en modo bspline o spiro static void bspline_spiro(PenTool *const pc,bool shift); -//Crea un nodo de modo spiro o bspline +//spanish: crea un nodo de modo spiro o bspline static void bspline_spiro_on(PenTool *const pc); -//Crea un nodo de tipo CUSP +//spanish: crea un nodo de tipo CUSP static void bspline_spiro_off(PenTool *const pc); -//Continua una curva existente en modo bspline o spiro +//spanish: continua una curva existente en modo bspline o spiro static void bspline_spiro_start_anchor(PenTool *const pc,bool shift); -//Continua una curva exsitente con el nodo de union en modo bspline o spiro +//spanish: continua una curva exsitente con el nodo de union en modo bspline o spiro static void bspline_spiro_start_anchor_on(PenTool *const pc); -//Continua una curva existente con el nodo de union en modo CUSP +//spanish: continua una curva existente con el nodo de union en modo CUSP static void bspline_spiro_start_anchor_off(PenTool *const pc); -//Modifica la "red_curve" cuando se detecta movimiento +//spanish: modifica la "red_curve" cuando se detecta movimiento static void bspline_spiro_motion(PenTool *const pc,bool shift); -//Cierra la curva con el último nodo en modo bspline o spiro +//spanish: cierra la curva con el último nodo en modo bspline o spiro static void bspline_spiro_end_anchor_on(PenTool *const pc); -//Cierra la curva con el último nodo en modo CUSP +//spanish: cierra la curva con el último nodo en modo CUSP static void bspline_spiro_end_anchor_off(PenTool *const pc); -//Unimos todas las curvas en juego y llamamos a la función doEffect. +//spanish: unimos todas las curvas en juego y llamamos a la función doEffect. static void bspline_spiro_build(PenTool *const pc); //function bspline cloned from lpe-bspline.cpp static void bspline_doEffect(SPCurve * curve); @@ -195,6 +195,7 @@ PenTool::~PenTool() { void sp_pen_context_set_polyline_mode(PenTool *const pc) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pen/freehand-mode", 0); + //spanish: cambiamos los modos para dar cabida al modo bspline pc->polylines_only = (mode == 3 || mode == 4); pc->polylines_paraxial = (mode == 4); //we call the function which defines the Spiro modes and the BSpline @@ -206,6 +207,7 @@ void sp_pen_context_set_polyline_mode(PenTool *const pc) { *.Set the mode of draw spiro, and bsplines */ void sp_pen_context_set_mode(PenTool *const pc, guint mode) { + //spanish: definimos los modos pc->spiro = (mode == 1); pc->bspline = (mode == 2); } @@ -474,7 +476,7 @@ static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bev // Set start anchor pc->sa = anchor; - //Continuamos una curva existente + //spanish: continuamos una curva existente if(anchor){ bspline_spiro_start_anchor(pc,(bevent.state & GDK_SHIFT_MASK)); } @@ -529,7 +531,7 @@ static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bev } } - //Evitamos la creación de un punto de control para que se cree el nodo en el evento de soltar + //spanish: evitamos la creación de un punto de control para que se cree el nodo en el evento de soltar pc->state = (pc->spiro || pc->bspline || pc->polylines_only) ? PenTool::POINT : PenTool::CONTROL; ret = TRUE; @@ -597,9 +599,8 @@ static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &me //we take out the function the const "tolerance" because we need it later Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gint const tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); - //"spiro_color" lo ejecutamos siempre sea o no spiro if (pen_within_tolerance) { - if ( Geom::LInfty( event_w - pen_drag_origin_w ) < tolerance) { + if ( Geom::LInfty( event_w - pen_drag_origin_w ) < tolerance ) { return FALSE; // Do not drag if we're within tolerance from origin. } } @@ -610,8 +611,10 @@ static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &me // Find desktop coordinates Geom::Point p = dt->w2d(event_w); + // Test, whether we hit any anchor SPDrawAnchor *anchor = spdc_test_inside(pc, event_w); + switch (pc->mode) { case PenTool::MODE_CLICK: switch (pc->state) { @@ -691,7 +694,9 @@ static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &me case PenTool::CONTROL: case PenTool::CLOSE: // Placing controls is last operation in CLOSE state + // snap the handle + spdc_endpoint_snap_handle(pc, p, mevent.state); if (!pc->polylines_only) { spdc_pen_set_ctrl(pc, p, mevent.state); @@ -718,7 +723,7 @@ static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &me default: break; } - //Lanzamos la función "bspline_spiro_motion" al moverse el ratón o cuando se para. + //spanish: lanzamos la función "bspline_spiro_motion" al moverse el ratón o cuando se para. if(pc->bspline){ bspline_spiro_color(pc); bspline_spiro_motion(pc,(mevent.state & GDK_SHIFT_MASK)); @@ -759,7 +764,7 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r SPDrawAnchor *anchor = spdc_test_inside(pc, event_w); //with this we avoid creating a new point over the existing one if(pc->spiro || pc->bspline){ - //Si intentamos crear un nodo en el mismo sitio que el origen, paramos. + //spanish: si intentamos crear un nodo en el mismo sitio que el origen, paramos. if(pc->npoints > 0 && pc->p[0] == pc->p[3]){ return FALSE; } @@ -775,7 +780,7 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r p = anchor->dp; } pc->sa = anchor; - //continuamos una curva existente + //spanish: continuamos una curva existente if (anchor) { if(pc->bspline || pc->spiro){ bspline_spiro_start_anchor(pc,(revent.state & GDK_SHIFT_MASK)); @@ -805,7 +810,7 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r spdc_endpoint_snap(pc, p, revent.state); } spdc_pen_finish_segment(pc, p, revent.state); - //Ocultamos la guia del penultimo nodo al cerrar la curva + //spanish: ocultamos la guia del penultimo nodo al cerrar la curva if(pc->spiro){ sp_canvas_item_hide(pc->c1); } @@ -832,7 +837,7 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r case PenTool::CLOSE: spdc_endpoint_snap(pc, p, revent.state); spdc_pen_finish_segment(pc, p, revent.state); - //Ocultamos la guia del penultimo nodo al cerrar la curva + //spanish: ocultamos la guia del penultimo nodo al cerrar la curva if(pc->spiro){ sp_canvas_item_hide(pc->c1); } @@ -925,7 +930,7 @@ static void pen_redraw_all (PenTool *const pc) sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve); // handles - //Ocultamos los tiradores en modo BSpline y spiro + //spanish: ocultamos los tiradores en modo bspline y spiro if (pc->p[0] != pc->p[1] && !pc->spiro && !pc->bspline) { SP_CTRL(pc->c1)->moveto(pc->p[1]); pc->cl1->setCoords(pc->p[0], pc->p[1]); @@ -939,7 +944,7 @@ static void pen_redraw_all (PenTool *const pc) Geom::Curve const * last_seg = pc->green_curve->last_segment(); if (last_seg) { Geom::CubicBezier const * cubic = dynamic_cast( last_seg ); - //Ocultamos los tiradores en modo BSpline y spiro + //spanish: ocultamos los tiradores en modo bspline y spiro if ( cubic && (*cubic)[2] != pc->p[0] && !pc->spiro && !pc->bspline ) { @@ -954,9 +959,8 @@ static void pen_redraw_all (PenTool *const pc) } } - //Simplemente redibujamos la spiro teniendo en cuenta si el nodo es cusp o symm. - //como es un redibujo simplemente no llamamos a la función global - //sino al final de esta + //spanish: simplemente redibujamos la spiro teniendo en cuenta si el nodo es cusp o symm. + //como es un redibujo simplemente no llamamos a la función global sino al final de esta //Lanzamos solamente el redibujado bspline_spiro_build(pc); } @@ -989,12 +993,12 @@ static void pen_lastpoint_move_screen (PenTool *const pc, gdouble x, gdouble y) static void pen_lastpoint_tocurve (PenTool *const pc) { - //Evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. + //spanish: evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. if (pc->npoints != 5 && !pc->spiro && !pc->bspline) return; Geom::CubicBezier const * cubic; pc->p[1] = pc->red_curve->last_segment()->initialPoint() + (1./3)* (Geom::Point)(pc->red_curve->last_segment()->finalPoint() - pc->red_curve->last_segment()->initialPoint()); - //Modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos + //spanish: modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos if(pc->spiro||pc->bspline){ if(!pc->green_curve->is_empty()){ Geom::Point A(0,0); @@ -1032,7 +1036,7 @@ static void pen_lastpoint_tocurve (PenTool *const pc) pc->green_curve->append_continuous(previous, 0.0625); } } - //Si el último nodo es una union con otra curva + //spanish: si el último nodo es una union con otra curva if(pc->green_curve->is_empty() && pc->sa && !pc->sa->curve->is_empty()){ bspline_spiro_start_anchor(pc, false); } @@ -1043,11 +1047,11 @@ static void pen_lastpoint_tocurve (PenTool *const pc) static void pen_lastpoint_toline (PenTool *const pc) { - //Evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. + //spanish: evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. if (pc->npoints != 5 && !pc->bspline) return; - //Modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos + //spanish: modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos if(pc->spiro || pc->bspline){ if(!pc->green_curve->is_empty()){ Geom::Point A(0,0); @@ -1079,7 +1083,7 @@ static void pen_lastpoint_toline (PenTool *const pc) pc->green_curve->append_continuous(previous, 0.0625); } } - //Si el último nodo es una union con otra curva + //spanish: si el último nodo es una union con otra curva if(pc->green_curve->is_empty() && pc->sa && !pc->sa->curve->is_empty()){ bspline_spiro_start_anchor(pc, true); } @@ -1268,7 +1272,7 @@ static gint pen_handle_key_press(PenTool *const pc, GdkEvent *event) } else { pc->p[1] = pc->p[0]; } - //Asignamos el valor a un tercio de distancia del último segmento. + //spanish: asignamos el valor a un tercio de distancia del último segmento. if(pc->bspline){ pc->p[1] = pc->p[0] + (1./3)*(pc->p[3] - pc->p[0]); } @@ -1278,7 +1282,7 @@ static gint pen_handle_key_press(PenTool *const pc, GdkEvent *event) : pc->p[3])); pc->npoints = 2; - //Eliminamos el último segmento de la curva verde + //spanish: eliminamos el último segmento de la curva verde if( pc->green_curve->get_segment_count() == 1){ pc->npoints = 5; if (pc->green_bpaths) { @@ -1290,7 +1294,7 @@ static gint pen_handle_key_press(PenTool *const pc, GdkEvent *event) }else{ pc->green_curve->backspace(); } - //Asignamos el valor de pc->p[1] a el opuesto de el ultimo segmento de la línea verde + //spanish: asignamos el valor de pc->p[1] a el opuesto de el ultimo segmento de la línea verde if(pc->spiro){ cubic = dynamic_cast(pc->green_curve->last_segment()); if ( cubic ) { @@ -1305,7 +1309,7 @@ static gint pen_handle_key_press(PenTool *const pc, GdkEvent *event) pc->state = PenTool::POINT; spdc_pen_set_subsequent_point(pc, pt, true); pen_last_paraxial_dir = !pen_last_paraxial_dir; - //Redibujamos + //spanish: redibujamos bspline_spiro_build(pc); ret = TRUE; } @@ -1381,7 +1385,7 @@ static void spdc_pen_set_angle_distance_status_message(PenTool *const pc, Geom:: } -//Esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro +//spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro static void bspline_spiro_color(PenTool *const pc) { bool remake_green_bpaths = false; @@ -1719,7 +1723,7 @@ static void bspline_spiro_end_anchor_off(PenTool *const pc) } -//preparates the curves for its trasformation into BSline curves. +//spanish: preparates the curves for its trasformation into BSline curves. static void bspline_spiro_build(PenTool *const pc) { if(!pc->spiro && !pc->bspline) @@ -1748,7 +1752,7 @@ static void bspline_spiro_build(PenTool *const pc) } if(!curve->is_empty()){ - //cerramos la curva si estan cerca los puntos finales de la curva spiro + //spanish: cerramos la curva si estan cerca los puntos finales de la curva spiro if(Geom::are_near(curve->first_path()->initialPoint(), curve->last_path()->finalPoint())){ curve->closepath_current(); } @@ -1787,26 +1791,19 @@ static void bspline_spiro_build(PenTool *const pc) static void bspline_doEffect(SPCurve * curve) { + //spanish: comentado en funcion "doEffect" de src/live_effects/lpe-bspline.cpp if(curve->get_segment_count() < 2) return; - // Make copy of old path as it is changed during processing Geom::PathVector const original_pathv = curve->get_pathvector(); curve->reset(); - //Recorremos todos los paths a los que queremos aplicar el efecto, hasta el penúltimo for(Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) { - //Si está vacío... if (path_it->empty()) continue; - //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 - //Creamos las lineas rectas que unen todos los puntos del trazado y donde se calcularán - //los puntos clave para los manejadores. - //Esto hace que la curva BSpline no pierda su condición aunque se trasladen - //dichos manejadores SPCurve *nCurve = new SPCurve(); Geom::Point previousNode(0,0); Geom::Point node(0,0); @@ -1820,23 +1817,13 @@ static void bspline_doEffect(SPCurve * curve) Geom::D2< Geom::SBasis > SBasisHelper; Geom::CubicBezier const *cubic = NULL; 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(); } } - //Si la curva está cerrada calculamos el punto donde - //deveria estar el nodo BSpline de cierre/inicio de la curva - //en posible caso de que se cierre con una linea recta creando un nodo BSPline - - //Recorremos todos los segmentos menos el último while ( curve_it2 != curve_endit ) { - //previousPointAt3 = pointAt3; - //Calculamos los puntos que dividirían en tres segmentos iguales el path recto de entrada y de salida SPCurve * in = new SPCurve(); in->moveto(curve_it1->initialPoint()); in->lineto(curve_it1->finalPoint()); @@ -1851,8 +1838,6 @@ static void bspline_doEffect(SPCurve * curve) } in->reset(); delete in; - //Y hacemos lo propio con el path de salida - //nextPointAt0 = curveOut.valueAt(0); SPCurve * out = new SPCurve(); out->moveto(curve_it2->initialPoint()); out->lineto(curve_it2->finalPoint()); @@ -1869,37 +1854,25 @@ static void bspline_doEffect(SPCurve * curve) } out->reset(); delete out; - //La curva BSpline se forma calculando el centro del segmanto de unión - //de el punto situado en las 2/3 partes de el segmento de entrada - //con el punto situado en la posición 1/3 del segmento de salida - //Estos dos puntos ademas estan posicionados en el lugas correspondiente de - //los manejadores de la curva SPCurve *lineHelper = new SPCurve(); lineHelper->moveto(pointAt2); lineHelper->lineto(nextPointAt1); SBasisHelper = lineHelper->first_segment()->toSBasis(); lineHelper->reset(); delete lineHelper; - //almacenamos el punto del anterior bucle -o el de cierre- que nos hara de principio de curva previousNode = node; - //Y este hará de final de curva node = SBasisHelper.valueAt(0.5); SPCurve *curveHelper = new SPCurve(); curveHelper->moveto(previousNode); curveHelper->curveto(pointAt1, pointAt2, node); - //añadimos la curva generada a la curva pricipal nCurve->append_continuous(curveHelper, 0.0625); curveHelper->reset(); delete curveHelper; - //aumentamos los valores para el siguiente paso en el bucle ++curve_it1; ++curve_it2; } - //Aberiguamos la ultima parte de la curva correspondiente al último segmento SPCurve *curveHelper = new SPCurve(); curveHelper->moveto(node); - //Si está cerrada la curva, la cerramos sobre el valor guardado previamente - //Si no finalizamos en el punto final Geom::Point startNode(0,0); if (path_it->closed()) { SPCurve * start = new SPCurve(); @@ -1920,7 +1893,6 @@ static void bspline_doEffect(SPCurve * curve) end->moveto(curve_it1->initialPoint()); end->lineto(curve_it1->finalPoint()); Geom::D2< Geom::SBasis > SBasisEnd = end->first_segment()->toSBasis(); - //Geom::BezierCurve const *bezier = dynamic_cast(&*curve_endit); cubic = dynamic_cast(&*curve_it1); if(cubic){ lineHelper->lineto(SBasisEnd.valueAt(Geom::nearest_point((*cubic)[2],*end->first_segment()))); @@ -1932,7 +1904,6 @@ static void bspline_doEffect(SPCurve * curve) SBasisHelper = lineHelper->first_segment()->toSBasis(); lineHelper->reset(); delete lineHelper; - //Guardamos el principio de la curva startNode = SBasisHelper.valueAt(0.5); curveHelper->curveto(nextPointAt1, nextPointAt2, startNode); nCurve->append_continuous(curveHelper, 0.0625); @@ -1950,7 +1921,6 @@ static void bspline_doEffect(SPCurve * curve) } curveHelper->reset(); delete curveHelper; - //y cerramos la curva if (path_it->closed()) { nCurve->closepath_current(); } @@ -1961,12 +1931,12 @@ static void bspline_doEffect(SPCurve * curve) } //Spiro function cloned from lpe-spiro.cpp +//spanish: comentado en funcion "doEffect" de src/live_effects/lpe-spiro.cpp static void spiro_doEffect(SPCurve * curve) { using Geom::X; using Geom::Y; - // Make copy of old path as it is changed during processing Geom::PathVector const original_pathv = curve->get_pathvector(); guint len = curve->get_segment_count() + 2; @@ -1978,41 +1948,31 @@ static void spiro_doEffect(SPCurve * curve) if (path_it->empty()) continue; - // start of path { Geom::Point p = path_it->front().pointAt(0); path[ip].x = p[X]; path[ip].y = p[Y]; - path[ip].ty = '{' ; // for closed paths, this is overwritten + path[ip].ty = '{' ; ip++; } - // midpoints - 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_it1 = path_it->begin(); + Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); - Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop + Geom::Path::const_iterator curve_endit = path_it->end_default(); 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. + const Geom::Curve &closingline = path_it->back_closed(); 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(); } } while ( curve_it2 != curve_endit ) { - /* This deals with the node between curve_it1 and curve_it2. - * Loop to end_default (so without last segment), loop ends when curve_it2 hits the end - * and then curve_it1 points to end or closing segment */ Geom::Point p = curve_it1->finalPoint(); path[ip].x = p[X]; path[ip].y = p[Y]; - // Determine type of spiro node this is, determined by the tangents (angles) of the curves - // TODO: see if this can be simplified by using /helpers/geom-nodetype.cpp:get_nodetype bool this_is_line = is_straight_curve(*curve_it1); bool next_is_line = is_straight_curve(*curve_it2); @@ -2036,15 +1996,13 @@ static void spiro_doEffect(SPCurve * curve) ip++; } - // add last point to the spiropath Geom::Point p = curve_it1->finalPoint(); path[ip].x = p[X]; path[ip].y = p[Y]; if (path_it->closed()) { - // curve_it1 points to the (visually) closing segment. determine the match between first and this last segment (the closing node) Geom::NodeType nodetype = Geom::get_nodetype(*curve_it1, path_it->front()); switch (nodetype) { - case Geom::NODE_NONE: // can't happen! but if it does, it means the path isn't closed :-) + case Geom::NODE_NONE: path[ip].ty = '}'; ip++; break; @@ -2057,12 +2015,10 @@ static void spiro_doEffect(SPCurve * curve) break; } } else { - // set type to path closer path[ip].ty = '}'; ip++; } - // run subpath through spiro int sp_len = ip; Spiro::spiro_run(path, sp_len, *curve); ip = 0; diff --git a/src/ui/tools/pen-tool.h b/src/ui/tools/pen-tool.h index b0b56feb4..4f87429f4 100644 --- a/src/ui/tools/pen-tool.h +++ b/src/ui/tools/pen-tool.h @@ -48,7 +48,7 @@ public: bool polylines_only; bool polylines_paraxial; - //Propiedad que guarda si el modo Spiro está activo o no + //spanish: propiedad que guarda si el modo Spiro está activo o no bool spiro; bool bspline; int num_clicks; -- cgit v1.2.3 From d8a7188e7a73050e329103b79e769b8fa498ede5 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 31 Dec 2013 01:04:31 +0100 Subject: Spanish comment of pencil-tool.cpp (bzr r11950.1.227) --- src/ui/tools/pencil-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 2027f0981..883b3fa36 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -728,7 +728,7 @@ interpolate(PencilTool *pc) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); for (int c = 0; c < n_segs; c++) { - //Si el modo es BSpline modificamos para que el trazado cree los nodos adhoc + //spanish: si el modo es BSpline modificamos para que el trazado cree los nodos adhoc if(mode == 2){ Geom::Point BP = b[4*c+0] + (1./3)*(b[4*c+3] - b[4*c+0]); BP = Geom::Point(BP[X] + 0.0001,BP[Y] + 0.0001); @@ -880,7 +880,7 @@ fit_and_split(PencilTool *pc) pc->red_curve->moveto(b[0]); using Geom::X; using Geom::Y; - //Si el modo es BSpline modificamos para que el trazado cree los nodos adhoc + //spanish: si el modo es BSpline modificamos para que el trazado cree los nodos adhoc Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); if(mode == 2){ -- cgit v1.2.3 From c08c28e9a22f0fe5f06e9dc34430c3acb16f3c13 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 2 Jan 2014 16:15:27 +0100 Subject: Fixed a boring bug sometimes curves be converted to lines, increasing a bit the distance from the handle to the line (bzr r11950.1.230) --- src/ui/tools/pen-tool.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 9b5acb6cc..a48f8911a 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -959,7 +959,7 @@ static void pen_redraw_all (PenTool *const pc) } } - //spanish: simplemente redibujamos la spiro teniendo en cuenta si el nodo es cusp o symm. + //spanish: simplemente redibujamos la spiro. //como es un redibujo simplemente no llamamos a la función global sino al final de esta //Lanzamos solamente el redibujado bspline_spiro_build(pc); @@ -1451,7 +1451,7 @@ static void bspline_spiro_on(PenTool *const pc) pc->p[0] = pc->red_curve->first_segment()->initialPoint(); pc->p[3] = pc->red_curve->first_segment()->finalPoint(); pc->p[2] = pc->p[3] + (1./3)*(pc->p[0] - pc->p[3]); - pc->p[2] = Geom::Point(pc->p[2][X] + 0.0001,pc->p[2][Y] + 0.0001); + pc->p[2] = Geom::Point(pc->p[2][X] + 0.005,pc->p[2][Y] + 0.005); } } @@ -1492,7 +1492,7 @@ static void bspline_spiro_start_anchor_on(PenTool *const pc) Geom::Point A = tmpCurve->last_segment()->initialPoint(); Geom::Point D = tmpCurve->last_segment()->finalPoint(); Geom::Point C = D + (1./3)*(A - D); - C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001); + C = Geom::Point(C[X] + 0.005,C[Y] + 0.005); if(cubic){ lastSeg->moveto(A); lastSeg->curveto((*cubic)[1],C,D); @@ -1549,19 +1549,23 @@ static void bspline_spiro_motion(PenTool *const pc, bool shift){ using Geom::X; using Geom::Y; + if(pc->red_curve->is_empty()) return; + pc->npoints = 5; SPCurve *tmpCurve = new SPCurve(); pc->p[2] = pc->p[3] + (1./3)*(pc->p[0] - pc->p[3]); + pc->p[2] = Geom::Point(pc->p[2][X] + 0.005,pc->p[2][Y] + 0.005); if(pc->green_curve->is_empty() && !pc->sa){ pc->p[1] = pc->p[0] + (1./3)*(pc->p[3] - pc->p[0]); + pc->p[1] = Geom::Point(pc->p[1][X] + 0.005,pc->p[1][Y] + 0.005); }else if(!pc->green_curve->is_empty()){ tmpCurve = pc->green_curve->copy(); }else{ tmpCurve = pc->sa->curve->copy(); if(pc->sa->start) tmpCurve = tmpCurve->create_reverse(); - } - if(!tmpCurve->is_empty() && !pc->red_curve->is_empty()){ + + if(!tmpCurve->is_empty()){ Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); if(cubic){ if(pc->bspline){ @@ -1577,16 +1581,17 @@ static void bspline_spiro_motion(PenTool *const pc, bool shift){ WPower->reset(); pc->p[1] = SBasisWPower.valueAt(WP); if(!Geom::are_near(pc->p[1],pc->p[0])) - pc->p[1] = Geom::Point(pc->p[1][X] + 0.0001,pc->p[1][Y] + 0.0001); + pc->p[1] = Geom::Point(pc->p[1][X] + 0.005,pc->p[1][Y] + 0.005); if(shift) - pc->p[2]=pc->p[3]; - else - pc->p[2] = pc->p[3] + (1./3)*(pc->p[0] - pc->p[3]); + pc->p[2] = pc->p[3]; }else{ pc->p[1] = (*cubic)[3] + (Geom::Point)((*cubic)[3] - (*cubic)[2] ); + pc->p[1] = Geom::Point(pc->p[1][X] + 0.005,pc->p[1][Y] + 0.005); } }else{ pc->p[1] = pc->p[0]; + if(shift) + pc->p[2] = pc->p[3]; } } @@ -1606,7 +1611,7 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc) using Geom::X; using Geom::Y; pc->p[2] = pc->p[3] + (1./3)*(pc->p[0] - pc->p[3]); - pc->p[2] = Geom::Point(pc->p[2][X] + 0.0001,pc->p[2][Y] + 0.0001); + pc->p[2] = Geom::Point(pc->p[2][X] + 0.005,pc->p[2][Y] + 0.005); SPCurve *tmpCurve = new SPCurve(); SPCurve *lastSeg = new SPCurve(); Geom::Point C(0,0); @@ -1616,7 +1621,7 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc) Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); if(pc->bspline){ C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint()); - C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001); + C = Geom::Point(C[X] + 0.005,C[Y] + 0.005); }else{ C = pc->p[3] + (Geom::Point)(pc->p[3] - pc->p[2] ); } @@ -1645,7 +1650,7 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc) Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); if(pc->bspline){ C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint()); - C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001); + C = Geom::Point(C[X] + 0.005,C[Y] + 0.005); }else{ C = pc->p[3] + (Geom::Point)(pc->p[3] - pc->p[2] ); } -- cgit v1.2.3 From 1e8014478b4185861ec348250a88d8476140b35f Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 1 Feb 2014 12:33:03 +0100 Subject: Add correct preview for coninuing paths whith pencil and draw modes (bzr r11950.1.245) --- src/ui/tools/pen-tool.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index a48f8911a..8c13a0584 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -43,6 +43,10 @@ #include "tools-switch.h" #include "ui/control-manager.h" //spanish: incluimos los archivos necesarios para las BSpline y Spiro +#include "live_effects/effect.h" +#include "live_effects/lpeobject.h" +#include "live_effects/lpeobject-reference.h" +#include "live_effects/parameter/path.h" #define INKSCAPE_LPE_SPIRO_C #include "live_effects/lpe-spiro.h" @@ -68,6 +72,8 @@ #include "tool-factory.h" +#include "live_effects/effect.h" + using Inkscape::ControlManager; @@ -1467,6 +1473,32 @@ static void bspline_spiro_off(PenTool *const pc) static void bspline_spiro_start_anchor(PenTool *const pc, bool shift) { + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + + if (SP_IS_LPE_ITEM(pc->white_item) && SP_LPE_ITEM(pc->white_item)->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(pc->white_item)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + } + } + if(lpe_bsp){ + pc->bspline = true; + }else{ + pc->bspline = false; + } + LivePathEffect::LPESpiro *lpe_spi = NULL; + + if (SP_IS_LPE_ITEM(pc->white_item) && SP_LPE_ITEM(pc->white_item)->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(pc->white_item)->getPathEffectOfType(Inkscape::LivePathEffect::SPIRO); + if(thisEffect){ + lpe_spi = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + } + } + if(lpe_spi){ + pc->spiro = true; + }else{ + pc->spiro = false; + } if(!pc->spiro && !pc->bspline) return; -- cgit v1.2.3 From b9f1c85c61ce91fedca5486ef371bf6301e76128 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 5 Feb 2014 17:31:55 +0100 Subject: fixing su_v advertising memory bug (bzr r11950.1.247) --- src/ui/tools/freehand-base.cpp | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 5825a149c..6561a0c2f 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -531,22 +531,33 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) // Step C - test start if (dc->sa) { - SPCurve *s = dc->sa->curve; - dc->white_curves = g_slist_remove(dc->white_curves, s); - if (dc->sa->start) { - s = reverse_then_unref(s); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) != 1 && + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) != 2){ + dc->sa->curve->unref() + }else{ + SPCurve *s = dc->sa->curve; + dc->white_curves = g_slist_remove(dc->white_curves, s); + if (dc->sa->start) { + s = reverse_then_unref(s); + } + s->append_continuous(c, 0.0625); + c->unref(); + c = s; } - s->append_continuous(c, 0.0625); - c->unref(); - c = s; } else /* Step D - test end */ if (dc->ea) { - SPCurve *e = dc->ea->curve; - dc->white_curves = g_slist_remove(dc->white_curves, e); - if (!dc->ea->start) { - e = reverse_then_unref(e); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) != 1 && + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) != 2){ + dc->ea->curve->unref() + SPCurve *e = dc->ea->curve; + dc->white_curves = g_slist_remove(dc->white_curves, e); + if (!dc->ea->start) { + e = reverse_then_unref(e); + } + c->append_continuous(e, 0.0625); + e->unref(); } - c->append_continuous(e, 0.0625); - e->unref(); } -- cgit v1.2.3 From 46c24197ff9e17b30d97cab8893d5017b9b99dc3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 8 Feb 2014 20:10:00 +0100 Subject: update to trunk (bzr r11950.1.249) --- src/ui/tools/freehand-base.cpp | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 6561a0c2f..5825a149c 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -531,33 +531,22 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) // Step C - test start if (dc->sa) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) != 1 && - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) != 2){ - dc->sa->curve->unref() - }else{ - SPCurve *s = dc->sa->curve; - dc->white_curves = g_slist_remove(dc->white_curves, s); - if (dc->sa->start) { - s = reverse_then_unref(s); - } - s->append_continuous(c, 0.0625); - c->unref(); - c = s; + SPCurve *s = dc->sa->curve; + dc->white_curves = g_slist_remove(dc->white_curves, s); + if (dc->sa->start) { + s = reverse_then_unref(s); } + s->append_continuous(c, 0.0625); + c->unref(); + c = s; } else /* Step D - test end */ if (dc->ea) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) != 1 && - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) != 2){ - dc->ea->curve->unref() - SPCurve *e = dc->ea->curve; - dc->white_curves = g_slist_remove(dc->white_curves, e); - if (!dc->ea->start) { - e = reverse_then_unref(e); - } - c->append_continuous(e, 0.0625); - e->unref(); + SPCurve *e = dc->ea->curve; + dc->white_curves = g_slist_remove(dc->white_curves, e); + if (!dc->ea->start) { + e = reverse_then_unref(e); } + c->append_continuous(e, 0.0625); + e->unref(); } -- cgit v1.2.3 From be22cb94d23816986838e9636ce44ee8537a8570 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 26 Feb 2014 22:29:31 +0100 Subject: Fixed some/all bugs related to continuing bspline/spiro curves advertaising by suv (bzr r11950.1.257) --- src/ui/tools/freehand-base.cpp | 37 +++++++++++++++++++++---------- src/ui/tools/pen-tool.cpp | 50 +++++++++++++++++++++++------------------- 2 files changed, 52 insertions(+), 35 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 5e406a0d4..d8a8e901a 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -469,7 +469,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) { // Concat RBG SPCurve *c = dc->green_curve; - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // Green dc->green_curve = new SPCurve(); while (dc->green_bpaths) { @@ -490,12 +490,16 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), NULL); if (c->is_empty()) { + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ + SPDesktop *desktop = dc->desktop; + spdc_selection_modified(sp_desktop_selection(desktop), 0, dc); + } c->unref(); return; } // Step A - test, whether we ended on green anchor - if ( forceclosed || ( dc->green_anchor && dc->green_anchor->active ) ) { + if ( forceclosed || (dc->green_anchor && dc->green_anchor->active) ) { // We hit green anchor, closing Green-Blue-Red dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed.")); c->closepath_current(); @@ -513,21 +517,33 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) { // We hit bot start and end of single curve, closing paths dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Closing path.")); - if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { - c = reverse_then_unref(c); + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ + if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { + dc->sa->curve = reverse_then_unref(dc->sa->curve); + } + dc->sa->curve->append_continuous(c, 0.0625); + c->unref(); + if(Geom::are_near(dc->sa->curve->first_path()->initialPoint(), dc->ea->dp)){ + dc->sa->curve->closepath_current(); + } + }else{ + if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { + c = reverse_then_unref(c); + } + dc->sa->curve->append_continuous(c, 0.0625); + c->unref(); + dc->sa->curve->closepath_current(); } - dc->sa->curve->append_continuous(c, 0.0625); - c->unref(); - dc->sa->curve->closepath_current(); //spanish: Si la curva tiene un LPE del tipo bspline o spiro ejecutamos spdc_flush_white //pasándole la curva de inicio necesaria - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); spdc_flush_white(dc, dc->sa->curve); - }else + }else{ spdc_flush_white(dc, NULL); + } return; } @@ -550,10 +566,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) c->append_continuous(e, 0.0625); e->unref(); } - - spdc_flush_white(dc, c); - c->unref(); } diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 8c13a0584..a344dc7a6 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -414,11 +414,18 @@ static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bev ToolBase *event_context = SP_EVENT_CONTEXT(pc); //Test whether we hit any anchor. SPDrawAnchor * const anchor = spdc_test_inside(pc, event_w); + //with this we avoid creating a new point over the existing one - if(!bevent.button == 3 && (pc->spiro || pc->bspline) && pc->npoints > 0 && pc->p[0] == pc->p[3]){ + if(bevent.button != 3 && (pc->spiro || pc->bspline) && pc->npoints > 0 && pc->p[0] == pc->p[3]){ + pc->state = PenTool::STOP; + if( anchor && anchor == pc->sa && pc->green_curve->is_empty()){ + //spanish Borrar siguiente linea para evitar un nodo encima de otro + spdc_pen_finish_segment(pc, event_dt, bevent.state); + spdc_pen_finish(pc, FALSE); + return TRUE; + } return FALSE; } - gint ret = FALSE; if (bevent.button == 1 && !event_context->space_panning // make sure this is not the last click for a waiting LPE (otherwise we want to finish the path) @@ -486,7 +493,7 @@ static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bev if(anchor){ bspline_spiro_start_anchor(pc,(bevent.state & GDK_SHIFT_MASK)); } - if (anchor && !sp_pen_context_has_waiting_LPE(pc)) { + if (anchor && (!sp_pen_context_has_waiting_LPE(pc) || pc->bspline || pc->spiro)) { // Adjust point to anchor if needed; if we have a waiting LPE, we need // a fresh path to be created so don't continue an existing one p = anchor->dp; @@ -755,7 +762,6 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r } gint ret = FALSE; - ToolBase *event_context = SP_EVENT_CONTEXT(pc); if ( revent.button == 1 && !event_context->space_panning) { @@ -769,11 +775,10 @@ static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &r // Test whether we hit any anchor. SPDrawAnchor *anchor = spdc_test_inside(pc, event_w); //with this we avoid creating a new point over the existing one - if(pc->spiro || pc->bspline){ - //spanish: si intentamos crear un nodo en el mismo sitio que el origen, paramos. - if(pc->npoints > 0 && pc->p[0] == pc->p[3]){ - return FALSE; - } + //spanish: si intentamos crear un nodo en el mismo sitio que el origen, paramos. + + if((!anchor || anchor == pc->sa) && (pc->spiro || pc->bspline) && pc->npoints > 0 && pc->p[0] == pc->p[3]){ + return TRUE; } switch (pc->mode) { @@ -1442,9 +1447,7 @@ static void bspline_spiro(PenTool *const pc, bool shift) if(!pc->spiro && !pc->bspline) return; - if(!pc->anchor_statusbar) - shift?bspline_spiro_off(pc):bspline_spiro_on(pc); - + shift?bspline_spiro_off(pc):bspline_spiro_on(pc); bspline_spiro_build(pc); } @@ -1628,10 +1631,11 @@ static void bspline_spiro_motion(PenTool *const pc, bool shift){ } if(pc->anchor_statusbar && !pc->red_curve->is_empty()){ - if(shift) + if(shift){ bspline_spiro_end_anchor_off(pc); - else + }else{ bspline_spiro_end_anchor_on(pc); + } } bspline_spiro_build(pc); @@ -1675,10 +1679,9 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc) tmpCurve = tmpCurve->create_reverse(); pc->green_curve->reset(); pc->green_curve = tmpCurve; - }else{ + }else { tmpCurve = pc->sa->curve->copy(); - if(!pc->sa->start) - tmpCurve = tmpCurve->create_reverse(); + if(!pc->sa->start) tmpCurve = tmpCurve->create_reverse(); Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); if(pc->bspline){ C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint()); @@ -1712,10 +1715,11 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc) static void bspline_spiro_end_anchor_off(PenTool *const pc) { - pc->p[2] = pc->p[3]; SPCurve *tmpCurve = new SPCurve(); SPCurve *lastSeg = new SPCurve(); + pc->p[2] = pc->p[3]; if(!pc->sa || pc->sa->curve->is_empty()){ + tmpCurve = pc->green_curve->create_reverse(); if(pc->green_curve->get_segment_count()==0)return; Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); @@ -1734,10 +1738,9 @@ static void bspline_spiro_end_anchor_off(PenTool *const pc) pc->green_curve->reset(); pc->green_curve = tmpCurve; } - }else{ + }else { tmpCurve = pc->sa->curve->copy(); - if(!pc->sa->start) - tmpCurve = tmpCurve->create_reverse(); + if(!pc->sa->start) tmpCurve = tmpCurve->create_reverse(); Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); if(cubic){ lastSeg->moveto((*cubic)[0]); @@ -1789,7 +1792,7 @@ static void bspline_spiro_build(PenTool *const pc) } if(!curve->is_empty()){ - //spanish: cerramos la curva si estan cerca los puntos finales de la curva spiro + //spanish: cerramos la curva si estan cerca los puntos finales de la curva if(Geom::are_near(curve->first_path()->initialPoint(), curve->last_path()->finalPoint())){ curve->closepath_current(); } @@ -2194,7 +2197,8 @@ static void spdc_pen_finish(PenTool *const pc, gboolean const closed) SPDesktop *const desktop = pc->desktop; pc->message_context->clear(); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Drawing finished")); - + if(pc->spiro || pc->bspline) pc->blue_curve->reset(); + //spanish para cancelar linea sin un segmento creado pc->red_curve->reset(); spdc_concat_colors_and_flush(pc, closed); pc->sa = NULL; -- cgit v1.2.3 From 1f76e96f90e3badb3b9693d477e6e75fbaaa1bd1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 28 Feb 2014 20:12:44 +0100 Subject: adding some comments (bzr r11950.1.260) --- src/ui/tools/freehand-base.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index c65d8133b..861ea0503 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -483,6 +483,9 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), NULL); + //spanish: si c esta vacio, puede ser que se haya tratado de contnuar una curva existente + //y se haya cancelado. Si es asi y el modo es bspline o spirolive la curva previa necesita volver a ser seleccionada + //porque la modificamos al continuar por un anchor if (c->is_empty()) { if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ SPDesktop *desktop = dc->desktop; @@ -493,7 +496,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) } // Step A - test, whether we ended on green anchor - if ( forceclosed || (dc->green_anchor && dc->green_anchor->active) ) { + if ( forceclosed || ( dc->green_anchor && dc->green_anchor->active ) ) { // We hit green anchor, closing Green-Blue-Red dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed.")); c->closepath_current(); @@ -511,6 +514,8 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) { // We hit bot start and end of single curve, closing paths dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Closing path.")); + //spanish: si estamos en modo bspline o spirolive, la curva de continuación y finalización es actualizada al continuar o finalizar la curva en un anchor + //esto proboca que la función original no detecte si es la misma curva en el caso de curvas con multiples partes -shift- y cierre de manera erronea una de las partes if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { -- cgit v1.2.3 From 9f066846c116c7a963bfaa805282b9b8d4c014e4 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 2 Mar 2014 03:07:44 +0100 Subject: =?UTF-8?q?Fixed=20update=20to=20trunk,=20lot=20of=20changes=20vin?= =?UTF-8?q?=C3=ADcius?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r11950.1.265) --- src/ui/tools/pen-tool.cpp | 122 +++++++++++++++------------------------------- src/ui/tools/pen-tool.h | 29 ++++++++++- 2 files changed, 66 insertions(+), 85 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index c6d87e2d8..65823b642 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -81,52 +81,6 @@ namespace Inkscape { namespace UI { namespace Tools { -static void spdc_pen_set_initial_point(PenTool *pc, Geom::Point const p); -//spanish: añade los modos spiro y bspline -static void sp_pen_context_set_mode(PenTool *const pc, guint mode); -//spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro -static void bspline_spiro_color(PenTool *const pc); -//spanish: crea un nodo en modo bspline o spiro -static void bspline_spiro(PenTool *const pc,bool shift); -//spanish: crea un nodo de modo spiro o bspline -static void bspline_spiro_on(PenTool *const pc); -//spanish: crea un nodo de tipo CUSP -static void bspline_spiro_off(PenTool *const pc); -//spanish: continua una curva existente en modo bspline o spiro -static void bspline_spiro_start_anchor(PenTool *const pc,bool shift); -//spanish: continua una curva exsitente con el nodo de union en modo bspline o spiro -static void bspline_spiro_start_anchor_on(PenTool *const pc); -//spanish: continua una curva existente con el nodo de union en modo CUSP -static void bspline_spiro_start_anchor_off(PenTool *const pc); -//spanish: modifica la "red_curve" cuando se detecta movimiento -static void bspline_spiro_motion(PenTool *const pc,bool shift); -//spanish: cierra la curva con el último nodo en modo bspline o spiro -static void bspline_spiro_end_anchor_on(PenTool *const pc); -//spanish: cierra la curva con el último nodo en modo CUSP -static void bspline_spiro_end_anchor_off(PenTool *const pc); -//spanish: unimos todas las curvas en juego y llamamos a la función doEffect. -static void bspline_spiro_build(PenTool *const pc); -//function bspline cloned from lpe-bspline.cpp -static void bspline_doEffect(SPCurve * curve); -//function spiro cloned from lpe-spiro.cpp -static void spiro_doEffect(SPCurve * curve); - -static void spdc_pen_set_subsequent_point(PenTool *const pc, Geom::Point const p, bool statusbar, guint status = 0); -static void spdc_pen_set_ctrl(PenTool *pc, Geom::Point const p, guint state); -static void spdc_pen_finish_segment(PenTool *pc, Geom::Point p, guint state); - -static void spdc_pen_finish(PenTool *pc, gboolean closed); - -static gint pen_handle_button_press(PenTool *const pc, GdkEventButton const &bevent); -static gint pen_handle_motion_notify(PenTool *const pc, GdkEventMotion const &mevent); -static gint pen_handle_button_release(PenTool *const pc, GdkEventButton const &revent); -static gint pen_handle_2button_press(PenTool *const pc, GdkEventButton const &bevent); -static gint pen_handle_key_press(PenTool *const pc, GdkEvent *event); -static void spdc_reset_colors(PenTool *pc); - -static void pen_disable_events(PenTool *const pc); -static void pen_enable_events(PenTool *const pc); - static Geom::Point pen_drag_origin_w(0, 0); static bool pen_within_tolerance = false; static int pen_last_paraxial_dir = 0; // last used direction in horizontal/vertical mode; 0 = horizontal, 1 = vertical @@ -217,13 +171,13 @@ void PenTool::setPolylineMode() { this->polylines_paraxial = (mode == 4); //we call the function which defines the Spiro modes and the BSpline //todo: merge to one function only - sp_pen_context_set_mode(this, mode); + this->_pen_context_set_mode(mode); } /* *.Set the mode of draw spiro, and bsplines */ -void sp_pen_context_set_mode(PenTool *const pc, guint mode) { +void PenTool::_pen_context_set_mode(guint mode) { //spanish: definimos los modos this->spiro = (mode == 1); this->bspline = (mode == 2); @@ -425,7 +379,7 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { Geom::Point const event_w(bevent.x, bevent.y); Geom::Point event_dt(desktop->w2d(event_w)); //Test whether we hit any anchor. - SPDrawAnchor * const anchor = spdc_test_inside(pc, event_w); + SPDrawAnchor * const anchor = spdc_test_inside(this, event_w); ToolBase *event_context = SP_EVENT_CONTEXT(this); //with this we avoid creating a new point over the existing one @@ -433,8 +387,8 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { this->state = PenTool::STOP; if( anchor && anchor == this->sa && this->green_curve->is_empty()){ //spanish Borrar siguiente linea para evitar un nodo encima de otro - spdc_pen_finish_segment(pc, event_dt, bevent.state); - spdc_pen_finish(pc, FALSE); + _finishSegment(event_dt, bevent.state); + _finish( FALSE); return TRUE; } return FALSE; @@ -505,7 +459,7 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { this->sa = anchor; if(anchor){ - bspline_spiro_start_anchor(pc,(bevent.state & GDK_SHIFT_MASK)); + this->_bspline_spiro_start_anchor(bevent.state & GDK_SHIFT_MASK); } if (anchor && (!this->hasWaitingLPE()|| this->bspline || this->spiro)) { // Adjust point to anchor if needed; if we have a waiting LPE, we need @@ -753,12 +707,12 @@ gint PenTool::_handleMotionNotify(GdkEventMotion const &mevent) { } //spanish: lanzamos la función "bspline_spiro_motion" al moverse el ratón o cuando se para. if(this->bspline){ - bspline_spiro_color(pc); - bspline_spiro_motion(pc,(mevent.state & GDK_SHIFT_MASK)); + this->_bspline_spiro_color(); + this->_bspline_spiro_motion(mevent.state & GDK_SHIFT_MASK); }else{ if ( Geom::LInfty( event_w - pen_drag_origin_w ) > tolerance || mevent.time == 0) { - bspline_spiro_color(pc); - bspline_spiro_motion(pc,(mevent.state & GDK_SHIFT_MASK)); + this->_bspline_spiro_color(); + this->_bspline_spiro_motion(mevent.state & GDK_SHIFT_MASK); pen_drag_origin_w = event_w; } } @@ -809,7 +763,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { //spanish: continuamos una curva existente if (anchor) { if(this->bspline || this->spiro){ - bspline_spiro_start_anchor(pc,(revent.state & GDK_SHIFT_MASK)); + this->_bspline_spiro_start_anchor(revent.state & GDK_SHIFT_MASK);; } } this->_setInitialPoint(p); @@ -986,7 +940,7 @@ void PenTool::_redrawAll() { //spanish: simplemente redibujamos la spiro. //como es un redibujo simplemente no llamamos a la función global sino al final de esta //Lanzamos solamente el redibujado - bspline_spiro_build(pc); + this->_bspline_spiro_build(); } void PenTool::_lastpointMove(gdouble x, gdouble y) { @@ -1060,7 +1014,7 @@ void PenTool::_lastpointToCurve() { } //spanish: si el último nodo es una union con otra curva if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ - bspline_spiro_start_anchor(pc, false); + this->_bspline_spiro_start_anchor(false); } } @@ -1107,7 +1061,7 @@ void PenTool::_lastpointToLine() { } //spanish: si el último nodo es una union con otra curva if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ - bspline_spiro_start_anchor(pc, true); + this->_bspline_spiro_start_anchor(true); } } @@ -1332,7 +1286,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { this->_setSubsequentPoint(pt, true); pen_last_paraxial_dir = !pen_last_paraxial_dir; //spanish: redibujamos - bspline_spiro_build(pc); + this->_bspline_spiro_build(); ret = TRUE; } break; @@ -1406,7 +1360,7 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t //spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro -static void bspline_spiro_color(PenTool *const pc) +void PenTool::_bspline_spiro_color() { bool remake_green_bpaths = false; if(this->spiro){ @@ -1451,16 +1405,16 @@ static void bspline_spiro_color(PenTool *const pc) } -static void bspline_spiro(PenTool *const pc, bool shift) +void PenTool::_bspline_spiro(bool shift) { if(!this->spiro && !this->bspline) return; - shift?bspline_spiro_off(pc):bspline_spiro_on(pc); - bspline_spiro_build(pc); + shift?this->_bspline_spiro_off():this->_bspline_spiro_on(); + this->_bspline_spiro_build(); } -static void bspline_spiro_on(PenTool *const pc) +void PenTool::_bspline_spiro_on() { if(!this->red_curve->is_empty()){ using Geom::X; @@ -1473,7 +1427,7 @@ static void bspline_spiro_on(PenTool *const pc) } } -static void bspline_spiro_off(PenTool *const pc) +void PenTool::_bspline_spiro_off() { if(!this->red_curve->is_empty()){ this->npoints = 5; @@ -1483,7 +1437,7 @@ static void bspline_spiro_off(PenTool *const pc) } } -static void bspline_spiro_start_anchor(PenTool *const pc, bool shift) +void PenTool::_bspline_spiro_start_anchor(bool shift) { LivePathEffect::LPEBSpline *lpe_bsp = NULL; @@ -1518,12 +1472,12 @@ static void bspline_spiro_start_anchor(PenTool *const pc, bool shift) return; if(shift) - bspline_spiro_start_anchor_off(pc); + this->_bspline_spiro_start_anchor_off(); else - bspline_spiro_start_anchor_on(pc); + this->_bspline_spiro_start_anchor_on(); } -static void bspline_spiro_start_anchor_on(PenTool *const pc) +void PenTool::_bspline_spiro_start_anchor_on() { using Geom::X; using Geom::Y; @@ -1559,7 +1513,7 @@ static void bspline_spiro_start_anchor_on(PenTool *const pc) this->sa->curve = tmpCurve; } -static void bspline_spiro_start_anchor_off(PenTool *const pc) +void PenTool::_bspline_spiro_start_anchor_off() { SPCurve *tmpCurve = new SPCurve(); tmpCurve = this->sa->curve->copy(); @@ -1587,7 +1541,7 @@ static void bspline_spiro_start_anchor_off(PenTool *const pc) } -static void bspline_spiro_motion(PenTool *const pc, bool shift){ +void PenTool::_bspline_spiro_motion(bool shift){ if(!this->spiro && !this->bspline) return; @@ -1641,16 +1595,16 @@ static void bspline_spiro_motion(PenTool *const pc, bool shift){ if(this->anchor_statusbar && !this->red_curve->is_empty()){ if(shift){ - bspline_spiro_end_anchor_off(pc); + this->_bspline_spiro_end_anchor_off(); }else{ - bspline_spiro_end_anchor_on(pc); + this->_bspline_spiro_end_anchor_on(); } } - bspline_spiro_build(pc); + this->_bspline_spiro_build(); } -static void bspline_spiro_end_anchor_on(PenTool *const pc) +void PenTool::_bspline_spiro_end_anchor_on() { using Geom::X; @@ -1721,7 +1675,7 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc) } } -static void bspline_spiro_end_anchor_off(PenTool *const pc) +void PenTool::_bspline_spiro_end_anchor_off() { SPCurve *tmpCurve = new SPCurve(); @@ -1773,7 +1727,7 @@ static void bspline_spiro_end_anchor_off(PenTool *const pc) //spanish: preparates the curves for its trasformation into BSline curves. -static void bspline_spiro_build(PenTool *const pc) +void PenTool::_bspline_spiro_build() { if(!this->spiro && !this->bspline) return; @@ -1812,9 +1766,9 @@ static void bspline_spiro_build(PenTool *const pc) //Effect *spr = static_cast ( new LPEbspline(lpeobj) ); //spr->doEffect(curve); if(this->bspline){ - bspline_doEffect(curve); + this->_bspline_doEffect(curve); }else{ - spiro_doEffect(curve); + this->_spiro_doEffect(curve); } sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), curve); @@ -1838,7 +1792,7 @@ static void bspline_spiro_build(PenTool *const pc) } } -static void bspline_doEffect(SPCurve * curve) +void PenTool::_bspline_doEffect(SPCurve * curve) { //spanish: comentado en funcion "doEffect" de src/live_effects/lpe-bspline.cpp if(curve->get_segment_count() < 2) @@ -1981,7 +1935,7 @@ static void bspline_doEffect(SPCurve * curve) //Spiro function cloned from lpe-spiro.cpp //spanish: comentado en funcion "doEffect" de src/live_effects/lpe-spiro.cpp -static void spiro_doEffect(SPCurve * curve) +void PenTool::_spiro_doEffect(SPCurve * curve) { using Geom::X; using Geom::Y; @@ -2178,7 +2132,7 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) { if (!this->red_curve->is_empty()) { - bspline_spiro(pc,(state & GDK_SHIFT_MASK)); + this->_bspline_spiro(state & GDK_SHIFT_MASK); this->green_curve->append_continuous(this->red_curve, 0.0625); SPCurve *curve = this->red_curve->copy(); diff --git a/src/ui/tools/pen-tool.h b/src/ui/tools/pen-tool.h index 07fc037be..88e528b22 100644 --- a/src/ui/tools/pen-tool.h +++ b/src/ui/tools/pen-tool.h @@ -88,7 +88,34 @@ private: gint _handleButtonRelease(GdkEventButton const &revent); gint _handle2ButtonPress(GdkEventButton const &bevent); gint _handleKeyPress(GdkEvent *event); - + //spanish: añade los modos spiro y bspline + void _pen_context_set_mode(guint mode); + //spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro + void _bspline_spiro_color(); + //spanish: crea un nodo en modo bspline o spiro + void _bspline_spiro(bool shift); + //spanish: crea un nodo de modo spiro o bspline + void _bspline_spiro_on(); + //spanish: crea un nodo de tipo CUSP + void _bspline_spiro_off(); + //spanish: continua una curva existente en modo bspline o spiro + void _bspline_spiro_start_anchor(bool shift); + //spanish: continua una curva exsitente con el nodo de union en modo bspline o spiro + void _bspline_spiro_start_anchor_on(); + //spanish: continua una curva existente con el nodo de union en modo CUSP + void _bspline_spiro_start_anchor_off(); + //spanish: modifica la "red_curve" cuando se detecta movimiento + void _bspline_spiro_motion(bool shift); + //spanish: cierra la curva con el último nodo en modo bspline o spiro + void _bspline_spiro_end_anchor_on(); + //spanish: cierra la curva con el último nodo en modo CUSP + void _bspline_spiro_end_anchor_off(); + //spanish: unimos todas las curvas en juego y llamamos a la función doEffect. + void _bspline_spiro_build(); + //function bspline cloned from lpe-bspline.cpp + void _bspline_doEffect(SPCurve * curve); + //function spiro cloned from lpe-spiro.cpp + void _spiro_doEffect(SPCurve * curve); void _setInitialPoint(Geom::Point const p); void _setSubsequentPoint(Geom::Point const p, bool statusbar, guint status = 0); void _setCtrl(Geom::Point const p, guint state); -- cgit v1.2.3 From fef7175272bbed79c874496c71092d3ba6e38d98 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 2 Mar 2014 23:50:04 +0100 Subject: Add new curve structure to show temporay item while draw on bspline and spiro, maybe the previous usage of the blue_curve give the strange errors in mac noticed by suv (bzr r11950.1.266) --- src/ui/tools/freehand-base.cpp | 22 ++++++++++++++++++++++ src/ui/tools/freehand-base.h | 4 ++++ src/ui/tools/pen-tool.cpp | 28 +++++++++++++++++++--------- 3 files changed, 45 insertions(+), 9 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 31d2f6191..cb6111bd5 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -82,6 +82,8 @@ FreehandBase::FreehandBase(gchar const *const *cursor_shape, gint hot_x, gint ho , red_curve(NULL) , blue_bpath(NULL) , blue_curve(NULL) + , blue2_bpath(NULL) + , blue2_curve(NULL) , green_bpaths(NULL) , green_curve(NULL) , green_anchor(NULL) @@ -137,6 +139,13 @@ void FreehandBase::setup() { // Create blue curve this->blue_curve = new SPCurve(); + // Create blue2 bpath + this->blue2_bpath = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), NULL); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->blue2_bpath), this->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + + // Create blue2 curve + this->blue2_curve = new SPCurve(); + // Create green curve this->green_curve = new SPCurve(); @@ -483,6 +492,10 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), NULL); + // Blue2 + dc->blue2_curve->reset(); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue2_bpath), NULL); + //spanish: si c esta vacio, puede ser que se haya tratado de contnuar una curva existente //y se haya cancelado. Si es asi y el modo es bspline o spirolive la curva previa necesita volver a ser seleccionada //porque la modificamos al continuar por un anchor @@ -718,6 +731,15 @@ static void spdc_free_colors(FreehandBase *dc) dc->blue_curve = dc->blue_curve->unref(); } + // Blue2 + if (dc->blue2_bpath) { + sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->blue2_bpath)); + dc->blue2_bpath = NULL; + } + if (dc->blue2_curve) { + dc->blue2_curve = dc->blue2_curve->unref(); + } + // Green while (dc->green_bpaths) { sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->green_bpaths->data)); diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h index c8da9faed..d5c2fc9ba 100644 --- a/src/ui/tools/freehand-base.h +++ b/src/ui/tools/freehand-base.h @@ -57,6 +57,10 @@ public: SPCanvasItem *blue_bpath; SPCurve *blue_curve; + // Blue2 + SPCanvasItem *blue2_bpath; + SPCurve *blue2_curve; + // Green GSList *green_bpaths; SPCurve *green_curve; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 65823b642..5846c3cec 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1303,6 +1303,9 @@ void PenTool::_resetColors() { // Blue this->blue_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), NULL); + // Blue2 + this->blue2_curve->reset(); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue2_bpath), NULL); // Green while (this->green_bpaths) { sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data)); @@ -1373,6 +1376,16 @@ void PenTool::_bspline_spiro_color() this->green_color = 0x00ff000; remake_green_bpaths = true; } + }else if(this->bspline){ + //If we come from working with the spiro curve and change the mode the "green_curve" colour is transparent + if(this->green_color != 0xff00007f){ + //since we are not im spiro mode, we assign the original colours + //to the red and the green curve, removing their transparency + this->red_color = 0xff00007f; + //Damos color rojo a la linea verde + this->green_color = 0xff00007f; + remake_green_bpaths = true; + } }else{ //If we come from working with the spiro curve and change the mode the "green_curve" colour is transparent if(this->green_color != 0x00ff007f){ @@ -1383,9 +1396,7 @@ void PenTool::_bspline_spiro_color() remake_green_bpaths = true; } //we hide the spiro/bspline rests - if(!this->bspline){ - sp_canvas_item_hide(this->blue_bpath); - } + sp_canvas_item_hide(this->blue2_bpath); } //We erase all the "green_bpaths" to recreate them after with the colour //transparency recently modified @@ -1771,11 +1782,11 @@ void PenTool::_bspline_spiro_build() this->_spiro_doEffect(curve); } - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), curve); - sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->blue_bpath), this->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); - sp_canvas_item_show(this->blue_bpath); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue2_bpath), curve); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->blue2_bpath), this->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + sp_canvas_item_show(this->blue2_bpath); curve->unref(); - this->blue_curve->reset(); + this->blue2_curve->reset(); //We hide the holders that doesn't contribute anything if(this->spiro){ sp_canvas_item_show(this->c1); @@ -1787,7 +1798,7 @@ void PenTool::_bspline_spiro_build() sp_canvas_item_hide(this->cl0); }else{ //if the curve is empty - sp_canvas_item_hide(this->blue_bpath); + sp_canvas_item_hide(this->blue2_bpath); } } @@ -2167,7 +2178,6 @@ void PenTool::_finish(gboolean const closed) { desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Drawing finished")); - if(this->spiro || this->bspline) this->blue_curve->reset(); //spanish para cancelar linea sin un segmento creado this->red_curve->reset(); spdc_concat_colors_and_flush(this, closed); -- cgit v1.2.3 From 224de42669ff754155838d37c48a56fa70c9bc94 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 4 Mar 2014 12:38:20 +0100 Subject: Reduce a half the spiro distance to redraw (bzr r11950.1.273) --- src/ui/tools/pen-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 5846c3cec..0c97bd445 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -710,7 +710,7 @@ gint PenTool::_handleMotionNotify(GdkEventMotion const &mevent) { this->_bspline_spiro_color(); this->_bspline_spiro_motion(mevent.state & GDK_SHIFT_MASK); }else{ - if ( Geom::LInfty( event_w - pen_drag_origin_w ) > tolerance || mevent.time == 0) { + if ( Geom::LInfty( event_w - pen_drag_origin_w ) > (tolerance/2) || mevent.time == 0) { this->_bspline_spiro_color(); this->_bspline_spiro_motion(mevent.state & GDK_SHIFT_MASK); pen_drag_origin_w = event_w; -- cgit v1.2.3 From 3d7f15d8b4adc83c04a2ba5c654529beeeec0c3b Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 4 Mar 2014 20:23:58 +0100 Subject: Change tooltip to one more explicit to make cusp nodes (bzr r11950.1.275) --- src/ui/tools/pen-tool.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 0c97bd445..ad77fcb53 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -642,7 +642,7 @@ gint PenTool::_handleMotionNotify(GdkEventMotion const &mevent) { if(!this->spiro && !this->bspline){ this->message_context->set(Inkscape::NORMAL_MESSAGE, _("Click or click and drag to close and finish the path.")); }else{ - this->message_context->set(Inkscape::NORMAL_MESSAGE, _("Click or click and drag to close and finish the path. Shift to cusp node")); + this->message_context->set(Inkscape::NORMAL_MESSAGE, _("Click or click and drag to close and finish the path. Shift+Click make a cusp node")); } this->anchor_statusbar = true; } else if (!anchor && this->anchor_statusbar) { @@ -656,7 +656,7 @@ gint PenTool::_handleMotionNotify(GdkEventMotion const &mevent) { if(!this->spiro && !this->bspline){ this->message_context->set(Inkscape::NORMAL_MESSAGE, _("Click or click and drag to continue the path from this point.")); }else{ - this->message_context->set(Inkscape::NORMAL_MESSAGE, _("Click or click and drag to continue the path from this point. Shift to cusp node")); + this->message_context->set(Inkscape::NORMAL_MESSAGE, _("Click or click and drag to continue the path from this point. Shift+Click make a cusp node")); } this->anchor_statusbar = true; } else if (!anchor && this->anchor_statusbar) { @@ -2084,8 +2084,8 @@ void PenTool::_setSubsequentPoint(Geom::Point const p, bool statusbar, guint sta _("Line segment: angle %3.2f°, distance %s; with Ctrl to snap angle, Enter to finish the path"); if(this->spiro || this->bspline){ message = is_curve ? - _("Curve segment: angle %3.2f°, distance %s; with Shift to cusp node, Enter to finish the path" ): - _("Line segment: angle %3.2f°, distance %s; with Shift to cusp node, Enter to finish the path"); + _("Curve segment: angle %3.2f°, distance %s; with Shift+Click make a cusp node, Enter to finish the path" ): + _("Line segment: angle %3.2f°, distance %s; with Shift+Click make a cusp node, Enter to finish the path"); } this->_setAngleDistanceStatusMessage(p, 0, message); } -- cgit v1.2.3 From 9ae7e81723f4ea4e2640ed01d55d94e73874804f Mon Sep 17 00:00:00 2001 From: Guiu Rocafort Date: Wed, 5 Mar 2014 12:37:27 +0100 Subject: translations from spanish to english done, it might need a little review, but everything seems ok (bzr r11950.5.1) --- src/ui/tools/freehand-base.cpp | 23 ++++++++------- src/ui/tools/node-tool.h | 3 +- src/ui/tools/pen-tool.cpp | 67 +++++++++++++++++++----------------------- src/ui/tools/pen-tool.h | 26 ++++++++-------- src/ui/tools/pencil-tool.cpp | 4 +-- 5 files changed, 60 insertions(+), 63 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index cb6111bd5..40a257de9 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -252,7 +252,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1) { Effect::createAndApply(SPIRO, dc->desktop->doc(), item); } - //spanish: añadimos el modo bspline a los efectos en espera + //add the bspline node in the waiting effects if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) { Effect::createAndApply(BSPLINE, dc->desktop->doc(), item); } @@ -496,9 +496,9 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->blue2_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue2_bpath), NULL); - //spanish: si c esta vacio, puede ser que se haya tratado de contnuar una curva existente - //y se haya cancelado. Si es asi y el modo es bspline o spirolive la curva previa necesita volver a ser seleccionada - //porque la modificamos al continuar por un anchor + /* if c is empty, it might be that the user was trying to continue an existing curve and cancelled. + if this is the case and we are in bspline or spirolive the previous curve needs to be selected again because + we modify it when continuing through an anchor. */ if (c->is_empty()) { if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ SPDesktop *desktop = dc->desktop; @@ -527,8 +527,10 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) { // We hit bot start and end of single curve, closing paths dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Closing path.")); - //spanish: si estamos en modo bspline o spirolive, la curva de continuación y finalización es actualizada al continuar o finalizar la curva en un anchor - //esto proboca que la función original no detecte si es la misma curva en el caso de curvas con multiples partes -shift- y cierre de manera erronea una de las partes + + /* if we are in bspline or spirolive mode, the continuation and ending curve are updated when continuing or ending the curve in an anchor. + this causes that the original function doesn't detect if it's the same curve in case the curves have multiples parts -shift- and + close incorrectly one of the parts */ if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { @@ -547,8 +549,8 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) c->unref(); dc->sa->curve->closepath_current(); } - //spanish: Si la curva tiene un LPE del tipo bspline o spiro ejecutamos spdc_flush_white - //pasándole la curva de inicio necesaria + + //if the curve has an bspline or spiro LPE, we execute spdc_flush_white, passing the necessary starting curve. if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); @@ -679,9 +681,8 @@ SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p) } } - //spanish: modificamos la curva de anclaje para que sea igual que la curva de inicio. - //esta curva fue modificada al continuar la curva y necesitamos que sea igual que la curva en - //la que cerramos el trazado. + /* modify the anchoring curve so it is equal to the starting curve. + this curve is modified when it's modified and we need them to be equal to the closing curve */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if((prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) && diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index 168ec995a..42f89cd1c 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -14,7 +14,8 @@ #include #include #include "ui/tools/tool-base.h" -//spanish: lo necesitamos para llamarlo desde el Live Effect + +// we need it to call it from Live Effect #include "selection.h" namespace Inkscape { diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 5846c3cec..bb1a03b7c 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -42,7 +42,7 @@ #include "context-fns.h" #include "tools-switch.h" #include "ui/control-manager.h" -//spanish: incluimos los archivos necesarios para las BSpline y Spiro +// we include the necessary files for BSpline & Spiro #include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" @@ -166,7 +166,7 @@ PenTool::~PenTool() { void PenTool::setPolylineMode() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pen/freehand-mode", 0); - //spanish: cambiamos los modos para dar cabida al modo bspline + // change the nodes to make space for bspline mode this->polylines_only = (mode == 3 || mode == 4); this->polylines_paraxial = (mode == 4); //we call the function which defines the Spiro modes and the BSpline @@ -178,7 +178,7 @@ void PenTool::setPolylineMode() { *.Set the mode of draw spiro, and bsplines */ void PenTool::_pen_context_set_mode(guint mode) { - //spanish: definimos los modos + // define the nodes this->spiro = (mode == 1); this->bspline = (mode == 2); } @@ -386,7 +386,7 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { if(bevent.button != 3 && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ this->state = PenTool::STOP; if( anchor && anchor == this->sa && this->green_curve->is_empty()){ - //spanish Borrar siguiente linea para evitar un nodo encima de otro + //remove the following line to avoid having one node on top of another _finishSegment(event_dt, bevent.state); _finish( FALSE); return TRUE; @@ -512,7 +512,7 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { } } - //spanish: evitamos la creación de un punto de control para que se cree el nodo en el evento de soltar + // avoid the creation of a control point so a node is created in the release event this->state = (this->spiro || this->bspline || this->polylines_only) ? PenTool::POINT : PenTool::CONTROL; ret = TRUE; @@ -705,7 +705,7 @@ gint PenTool::_handleMotionNotify(GdkEventMotion const &mevent) { default: break; } - //spanish: lanzamos la función "bspline_spiro_motion" al moverse el ratón o cuando se para. + // calls the function "bspline_spiro_motion" when the mouse starts or stops moving if(this->bspline){ this->_bspline_spiro_color(); this->_bspline_spiro_motion(mevent.state & GDK_SHIFT_MASK); @@ -743,9 +743,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { // Test whether we hit any anchor. SPDrawAnchor *anchor = spdc_test_inside(this, event_w); - //with this we avoid creating a new point over the existing one - //spanish: si intentamos crear un nodo en el mismo sitio que el origen, paramos. - + // if we try to create a node in the same place as another node, we skip if((!anchor || anchor == this->sa) && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ return TRUE; } @@ -760,7 +758,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { p = anchor->dp; } this->sa = anchor; - //spanish: continuamos una curva existente + // continue the existing curve if (anchor) { if(this->bspline || this->spiro){ this->_bspline_spiro_start_anchor(revent.state & GDK_SHIFT_MASK);; @@ -790,7 +788,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { this->_endpointSnap(p, revent.state); } this->_finishSegment(p, revent.state); - //spanish: ocultamos la guia del penultimo nodo al cerrar la curva + // hude the guide of the penultimate node when closing the curve if(this->spiro){ sp_canvas_item_hide(this->c1); } @@ -817,7 +815,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { case PenTool::CLOSE: this->_endpointSnap(p, revent.state); this->_finishSegment(p, revent.state); - //spanish: ocultamos la guia del penultimo nodo al cerrar la curva + // hide the penultimate node guide when closing the curve if(this->spiro){ sp_canvas_item_hide(this->c1); } @@ -908,7 +906,7 @@ void PenTool::_redrawAll() { sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); // handles - //spanish: ocultamos los tiradores en modo bspline y spiro + // hide the handlers in bspline and spiro modes if (this->p[0] != this->p[1] && !this->spiro && !this->bspline) { SP_CTRL(this->c1)->moveto(this->p[1]); this->cl1->setCoords(this->p[0], this->p[1]); @@ -922,7 +920,7 @@ void PenTool::_redrawAll() { Geom::Curve const * last_seg = this->green_curve->last_segment(); if (last_seg) { Geom::CubicBezier const * cubic = dynamic_cast( last_seg ); - //spanish: ocultamos los tiradores en modo bspline y spiro + // hide the handlers in bspline and spiro modes if ( cubic && (*cubic)[2] != this->p[0] && !this->spiro && !this->bspline ) { @@ -937,9 +935,8 @@ void PenTool::_redrawAll() { } } - //spanish: simplemente redibujamos la spiro. - //como es un redibujo simplemente no llamamos a la función global sino al final de esta - //Lanzamos solamente el redibujado + // simply redraw the spiro. because its a redrawing, we don't call the global function, + // but we call the redrawing at the ending. this->_bspline_spiro_build(); } @@ -969,12 +966,12 @@ void PenTool::_lastpointMoveScreen(gdouble x, gdouble y) { } void PenTool::_lastpointToCurve() { - //spanish: evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. + // avoid that if the "red_curve" contains only two points ( rect ), it doesn't stop here. if (this->npoints != 5 && !this->spiro && !this->bspline) return; Geom::CubicBezier const * cubic; this->p[1] = this->red_curve->last_segment()->initialPoint() + (1./3)* (Geom::Point)(this->red_curve->last_segment()->finalPoint() - this->red_curve->last_segment()->initialPoint()); - //spanish: modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos + //modificate the last segment of the green curve so it creates the type of node we need if(this->spiro||this->bspline){ if(!this->green_curve->is_empty()){ Geom::Point A(0,0); @@ -1012,7 +1009,7 @@ void PenTool::_lastpointToCurve() { this->green_curve->append_continuous(previous, 0.0625); } } - //spanish: si el último nodo es una union con otra curva + //if the last node is an union with another curve if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ this->_bspline_spiro_start_anchor(false); } @@ -1023,11 +1020,11 @@ void PenTool::_lastpointToCurve() { void PenTool::_lastpointToLine() { - //spanish: evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. + // avoid that if the "red_curve" contains only two points ( rect) it doesn't stop here. if (this->npoints != 5 && !this->bspline) return; - //spanish: modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos + // modify the last segment of the green curve so the type of node we want is created. if(this->spiro || this->bspline){ if(!this->green_curve->is_empty()){ Geom::Point A(0,0); @@ -1059,7 +1056,7 @@ void PenTool::_lastpointToLine() { this->green_curve->append_continuous(previous, 0.0625); } } - //spanish: si el último nodo es una union con otra curva + // if the last node is an union with another curve if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ this->_bspline_spiro_start_anchor(true); } @@ -1248,7 +1245,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { this->p[1] = this->p[0]; } - //spanish: asignamos el valor a un tercio de distancia del último segmento. + // asign the value in a third of the distance of the last segment. if(this->bspline){ this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]); } @@ -1258,7 +1255,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { : this->p[3])); this->npoints = 2; - //spanish: eliminamos el último segmento de la curva verde + // delete the last segment of the green curve if( this->green_curve->get_segment_count() == 1){ this->npoints = 5; if (this->green_bpaths) { @@ -1270,7 +1267,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { }else{ this->green_curve->backspace(); } - //spanish: asignamos el valor de this->p[1] a el opuesto de el ultimo segmento de la línea verde + // assign the value of this->p[1] to the oposite of the green line last segment if(this->spiro){ cubic = dynamic_cast(this->green_curve->last_segment()); if ( cubic ) { @@ -1285,7 +1282,8 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { this->state = PenTool::POINT; this->_setSubsequentPoint(pt, true); pen_last_paraxial_dir = !pen_last_paraxial_dir; - //spanish: redibujamos + + //redraw this->_bspline_spiro_build(); ret = TRUE; } @@ -1360,9 +1358,7 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t g_string_free(dist, FALSE); } - - -//spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro +// this function changes the colors red, green and blue making them transparent or not, depending on if spiro is being used. void PenTool::_bspline_spiro_color() { bool remake_green_bpaths = false; @@ -1736,8 +1732,7 @@ void PenTool::_bspline_spiro_end_anchor_off() } } - -//spanish: preparates the curves for its trasformation into BSline curves. +//prepares the curves for its transformation into BSpline curve. void PenTool::_bspline_spiro_build() { if(!this->spiro && !this->bspline) @@ -1766,7 +1761,7 @@ void PenTool::_bspline_spiro_build() } if(!curve->is_empty()){ - //spanish: cerramos la curva si estan cerca los puntos finales de la curva + // close the curve if the final points of the curve are close enough if(Geom::are_near(curve->first_path()->initialPoint(), curve->last_path()->finalPoint())){ curve->closepath_current(); } @@ -1805,7 +1800,7 @@ void PenTool::_bspline_spiro_build() void PenTool::_bspline_doEffect(SPCurve * curve) { - //spanish: comentado en funcion "doEffect" de src/live_effects/lpe-bspline.cpp + // commenting the function doEffect in src/live_effects/lpe-bspline.cpp if(curve->get_segment_count() < 2) return; Geom::PathVector const original_pathv = curve->get_pathvector(); @@ -1945,7 +1940,7 @@ void PenTool::_bspline_doEffect(SPCurve * curve) } //Spiro function cloned from lpe-spiro.cpp -//spanish: comentado en funcion "doEffect" de src/live_effects/lpe-spiro.cpp +// commenting the function "doEffect" from src/live_effects/lpe-spiro.cpp void PenTool::_spiro_doEffect(SPCurve * curve) { using Geom::X; @@ -2178,7 +2173,7 @@ void PenTool::_finish(gboolean const closed) { desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Drawing finished")); - //spanish para cancelar linea sin un segmento creado + // cancelate line without a created segment this->red_curve->reset(); spdc_concat_colors_and_flush(this, closed); this->sa = NULL; diff --git a/src/ui/tools/pen-tool.h b/src/ui/tools/pen-tool.h index 88e528b22..95565abc9 100644 --- a/src/ui/tools/pen-tool.h +++ b/src/ui/tools/pen-tool.h @@ -49,7 +49,7 @@ public: bool polylines_only; bool polylines_paraxial; - //spanish: propiedad que guarda si el modo Spiro está activo o no + // propiety which saves if Spiro mode is active or not bool spiro; bool bspline; int num_clicks; @@ -88,29 +88,29 @@ private: gint _handleButtonRelease(GdkEventButton const &revent); gint _handle2ButtonPress(GdkEventButton const &bevent); gint _handleKeyPress(GdkEvent *event); - //spanish: añade los modos spiro y bspline + //adds spiro & bspline modes void _pen_context_set_mode(guint mode); - //spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro + //this function changes the colors red, green and blue making them transparent or not depending on if the function uses spiro void _bspline_spiro_color(); - //spanish: crea un nodo en modo bspline o spiro + //creates a node in bspline or spiro modes void _bspline_spiro(bool shift); - //spanish: crea un nodo de modo spiro o bspline + //creates a node in bspline or spiro modes void _bspline_spiro_on(); - //spanish: crea un nodo de tipo CUSP + //creates a CUSP node void _bspline_spiro_off(); - //spanish: continua una curva existente en modo bspline o spiro + //continues the existing curve in bspline or spiro mode void _bspline_spiro_start_anchor(bool shift); - //spanish: continua una curva exsitente con el nodo de union en modo bspline o spiro + //continues the existing curve with the union node in bspline or spiro modes void _bspline_spiro_start_anchor_on(); - //spanish: continua una curva existente con el nodo de union en modo CUSP + //continues an existing curve with the union node in CUSP mode void _bspline_spiro_start_anchor_off(); - //spanish: modifica la "red_curve" cuando se detecta movimiento + //modifies the "red_curve" when it detects movement void _bspline_spiro_motion(bool shift); - //spanish: cierra la curva con el último nodo en modo bspline o spiro + //closes the curve with the last node in bspline or spiro mode void _bspline_spiro_end_anchor_on(); - //spanish: cierra la curva con el último nodo en modo CUSP + //closes the curve with the last node in CUSP mode void _bspline_spiro_end_anchor_off(); - //spanish: unimos todas las curvas en juego y llamamos a la función doEffect. + //CHECK: join all the curves "in game" and we call doEffect function void _bspline_spiro_build(); //function bspline cloned from lpe-bspline.cpp void _bspline_doEffect(SPCurve * curve); diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index bd50672af..1ccdee637 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -685,7 +685,7 @@ void PencilTool::_interpolate() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); for (int c = 0; c < n_segs; c++) { - //spanish: si el modo es BSpline modificamos para que el trazado cree los nodos adhoc + // if we are in BSpline we modify the trace to create adhoc nodes if(mode == 2){ Geom::Point BP = b[4*c+0] + (1./3)*(b[4*c+3] - b[4*c+0]); BP = Geom::Point(BP[X] + 0.0001,BP[Y] + 0.0001); @@ -835,7 +835,7 @@ void PencilTool::_fitAndSplit() { this->red_curve->moveto(b[0]); using Geom::X; using Geom::Y; - //spanish: si el modo es BSpline modificamos para que el trazado cree los nodos adhoc + // if we are in BSpline we modify the trace to create adhoc nodes Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); if(mode == 2){ -- cgit v1.2.3 From a9eea1cea2a13f129bcb30f175cea82ffcbcee29 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 5 Mar 2014 20:03:46 +0100 Subject: Translations (bzr r11950.1.279) --- src/ui/tools/freehand-base.cpp | 23 +++++++-------- src/ui/tools/node-tool.h | 3 +- src/ui/tools/pen-tool.cpp | 67 +++++++++++++++++++++++------------------- src/ui/tools/pen-tool.h | 26 ++++++++-------- src/ui/tools/pencil-tool.cpp | 4 +-- 5 files changed, 63 insertions(+), 60 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 40a257de9..cb6111bd5 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -252,7 +252,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1) { Effect::createAndApply(SPIRO, dc->desktop->doc(), item); } - //add the bspline node in the waiting effects + //spanish: añadimos el modo bspline a los efectos en espera if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) { Effect::createAndApply(BSPLINE, dc->desktop->doc(), item); } @@ -496,9 +496,9 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->blue2_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue2_bpath), NULL); - /* if c is empty, it might be that the user was trying to continue an existing curve and cancelled. - if this is the case and we are in bspline or spirolive the previous curve needs to be selected again because - we modify it when continuing through an anchor. */ + //spanish: si c esta vacio, puede ser que se haya tratado de contnuar una curva existente + //y se haya cancelado. Si es asi y el modo es bspline o spirolive la curva previa necesita volver a ser seleccionada + //porque la modificamos al continuar por un anchor if (c->is_empty()) { if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ SPDesktop *desktop = dc->desktop; @@ -527,10 +527,8 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) { // We hit bot start and end of single curve, closing paths dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Closing path.")); - - /* if we are in bspline or spirolive mode, the continuation and ending curve are updated when continuing or ending the curve in an anchor. - this causes that the original function doesn't detect if it's the same curve in case the curves have multiples parts -shift- and - close incorrectly one of the parts */ + //spanish: si estamos en modo bspline o spirolive, la curva de continuación y finalización es actualizada al continuar o finalizar la curva en un anchor + //esto proboca que la función original no detecte si es la misma curva en el caso de curvas con multiples partes -shift- y cierre de manera erronea una de las partes if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { @@ -549,8 +547,8 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) c->unref(); dc->sa->curve->closepath_current(); } - - //if the curve has an bspline or spiro LPE, we execute spdc_flush_white, passing the necessary starting curve. + //spanish: Si la curva tiene un LPE del tipo bspline o spiro ejecutamos spdc_flush_white + //pasándole la curva de inicio necesaria if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); @@ -681,8 +679,9 @@ SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p) } } - /* modify the anchoring curve so it is equal to the starting curve. - this curve is modified when it's modified and we need them to be equal to the closing curve */ + //spanish: modificamos la curva de anclaje para que sea igual que la curva de inicio. + //esta curva fue modificada al continuar la curva y necesitamos que sea igual que la curva en + //la que cerramos el trazado. Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if((prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) && diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index 42f89cd1c..168ec995a 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -14,8 +14,7 @@ #include #include #include "ui/tools/tool-base.h" - -// we need it to call it from Live Effect +//spanish: lo necesitamos para llamarlo desde el Live Effect #include "selection.h" namespace Inkscape { diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index e3bbc72b1..ad77fcb53 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -42,7 +42,7 @@ #include "context-fns.h" #include "tools-switch.h" #include "ui/control-manager.h" -// we include the necessary files for BSpline & Spiro +//spanish: incluimos los archivos necesarios para las BSpline y Spiro #include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" @@ -166,7 +166,7 @@ PenTool::~PenTool() { void PenTool::setPolylineMode() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pen/freehand-mode", 0); - // change the nodes to make space for bspline mode + //spanish: cambiamos los modos para dar cabida al modo bspline this->polylines_only = (mode == 3 || mode == 4); this->polylines_paraxial = (mode == 4); //we call the function which defines the Spiro modes and the BSpline @@ -178,7 +178,7 @@ void PenTool::setPolylineMode() { *.Set the mode of draw spiro, and bsplines */ void PenTool::_pen_context_set_mode(guint mode) { - // define the nodes + //spanish: definimos los modos this->spiro = (mode == 1); this->bspline = (mode == 2); } @@ -386,7 +386,7 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { if(bevent.button != 3 && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ this->state = PenTool::STOP; if( anchor && anchor == this->sa && this->green_curve->is_empty()){ - //remove the following line to avoid having one node on top of another + //spanish Borrar siguiente linea para evitar un nodo encima de otro _finishSegment(event_dt, bevent.state); _finish( FALSE); return TRUE; @@ -512,7 +512,7 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { } } - // avoid the creation of a control point so a node is created in the release event + //spanish: evitamos la creación de un punto de control para que se cree el nodo en el evento de soltar this->state = (this->spiro || this->bspline || this->polylines_only) ? PenTool::POINT : PenTool::CONTROL; ret = TRUE; @@ -705,7 +705,7 @@ gint PenTool::_handleMotionNotify(GdkEventMotion const &mevent) { default: break; } - // calls the function "bspline_spiro_motion" when the mouse starts or stops moving + //spanish: lanzamos la función "bspline_spiro_motion" al moverse el ratón o cuando se para. if(this->bspline){ this->_bspline_spiro_color(); this->_bspline_spiro_motion(mevent.state & GDK_SHIFT_MASK); @@ -743,7 +743,9 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { // Test whether we hit any anchor. SPDrawAnchor *anchor = spdc_test_inside(this, event_w); - // if we try to create a node in the same place as another node, we skip + //with this we avoid creating a new point over the existing one + //spanish: si intentamos crear un nodo en el mismo sitio que el origen, paramos. + if((!anchor || anchor == this->sa) && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ return TRUE; } @@ -758,7 +760,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { p = anchor->dp; } this->sa = anchor; - // continue the existing curve + //spanish: continuamos una curva existente if (anchor) { if(this->bspline || this->spiro){ this->_bspline_spiro_start_anchor(revent.state & GDK_SHIFT_MASK);; @@ -788,7 +790,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { this->_endpointSnap(p, revent.state); } this->_finishSegment(p, revent.state); - // hude the guide of the penultimate node when closing the curve + //spanish: ocultamos la guia del penultimo nodo al cerrar la curva if(this->spiro){ sp_canvas_item_hide(this->c1); } @@ -815,7 +817,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { case PenTool::CLOSE: this->_endpointSnap(p, revent.state); this->_finishSegment(p, revent.state); - // hide the penultimate node guide when closing the curve + //spanish: ocultamos la guia del penultimo nodo al cerrar la curva if(this->spiro){ sp_canvas_item_hide(this->c1); } @@ -906,7 +908,7 @@ void PenTool::_redrawAll() { sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); // handles - // hide the handlers in bspline and spiro modes + //spanish: ocultamos los tiradores en modo bspline y spiro if (this->p[0] != this->p[1] && !this->spiro && !this->bspline) { SP_CTRL(this->c1)->moveto(this->p[1]); this->cl1->setCoords(this->p[0], this->p[1]); @@ -920,7 +922,7 @@ void PenTool::_redrawAll() { Geom::Curve const * last_seg = this->green_curve->last_segment(); if (last_seg) { Geom::CubicBezier const * cubic = dynamic_cast( last_seg ); - // hide the handlers in bspline and spiro modes + //spanish: ocultamos los tiradores en modo bspline y spiro if ( cubic && (*cubic)[2] != this->p[0] && !this->spiro && !this->bspline ) { @@ -935,8 +937,9 @@ void PenTool::_redrawAll() { } } - // simply redraw the spiro. because its a redrawing, we don't call the global function, - // but we call the redrawing at the ending. + //spanish: simplemente redibujamos la spiro. + //como es un redibujo simplemente no llamamos a la función global sino al final de esta + //Lanzamos solamente el redibujado this->_bspline_spiro_build(); } @@ -966,12 +969,12 @@ void PenTool::_lastpointMoveScreen(gdouble x, gdouble y) { } void PenTool::_lastpointToCurve() { - // avoid that if the "red_curve" contains only two points ( rect ), it doesn't stop here. + //spanish: evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. if (this->npoints != 5 && !this->spiro && !this->bspline) return; Geom::CubicBezier const * cubic; this->p[1] = this->red_curve->last_segment()->initialPoint() + (1./3)* (Geom::Point)(this->red_curve->last_segment()->finalPoint() - this->red_curve->last_segment()->initialPoint()); - //modificate the last segment of the green curve so it creates the type of node we need + //spanish: modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos if(this->spiro||this->bspline){ if(!this->green_curve->is_empty()){ Geom::Point A(0,0); @@ -1009,7 +1012,7 @@ void PenTool::_lastpointToCurve() { this->green_curve->append_continuous(previous, 0.0625); } } - //if the last node is an union with another curve + //spanish: si el último nodo es una union con otra curva if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ this->_bspline_spiro_start_anchor(false); } @@ -1020,11 +1023,11 @@ void PenTool::_lastpointToCurve() { void PenTool::_lastpointToLine() { - // avoid that if the "red_curve" contains only two points ( rect) it doesn't stop here. + //spanish: evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. if (this->npoints != 5 && !this->bspline) return; - // modify the last segment of the green curve so the type of node we want is created. + //spanish: modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos if(this->spiro || this->bspline){ if(!this->green_curve->is_empty()){ Geom::Point A(0,0); @@ -1056,7 +1059,7 @@ void PenTool::_lastpointToLine() { this->green_curve->append_continuous(previous, 0.0625); } } - // if the last node is an union with another curve + //spanish: si el último nodo es una union con otra curva if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ this->_bspline_spiro_start_anchor(true); } @@ -1245,7 +1248,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { this->p[1] = this->p[0]; } - // asign the value in a third of the distance of the last segment. + //spanish: asignamos el valor a un tercio de distancia del último segmento. if(this->bspline){ this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]); } @@ -1255,7 +1258,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { : this->p[3])); this->npoints = 2; - // delete the last segment of the green curve + //spanish: eliminamos el último segmento de la curva verde if( this->green_curve->get_segment_count() == 1){ this->npoints = 5; if (this->green_bpaths) { @@ -1267,7 +1270,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { }else{ this->green_curve->backspace(); } - // assign the value of this->p[1] to the oposite of the green line last segment + //spanish: asignamos el valor de this->p[1] a el opuesto de el ultimo segmento de la línea verde if(this->spiro){ cubic = dynamic_cast(this->green_curve->last_segment()); if ( cubic ) { @@ -1282,8 +1285,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { this->state = PenTool::POINT; this->_setSubsequentPoint(pt, true); pen_last_paraxial_dir = !pen_last_paraxial_dir; - - //redraw + //spanish: redibujamos this->_bspline_spiro_build(); ret = TRUE; } @@ -1358,7 +1360,9 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t g_string_free(dist, FALSE); } -// this function changes the colors red, green and blue making them transparent or not, depending on if spiro is being used. + + +//spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro void PenTool::_bspline_spiro_color() { bool remake_green_bpaths = false; @@ -1732,7 +1736,8 @@ void PenTool::_bspline_spiro_end_anchor_off() } } -//prepares the curves for its transformation into BSpline curve. + +//spanish: preparates the curves for its trasformation into BSline curves. void PenTool::_bspline_spiro_build() { if(!this->spiro && !this->bspline) @@ -1761,7 +1766,7 @@ void PenTool::_bspline_spiro_build() } if(!curve->is_empty()){ - // close the curve if the final points of the curve are close enough + //spanish: cerramos la curva si estan cerca los puntos finales de la curva if(Geom::are_near(curve->first_path()->initialPoint(), curve->last_path()->finalPoint())){ curve->closepath_current(); } @@ -1800,7 +1805,7 @@ void PenTool::_bspline_spiro_build() void PenTool::_bspline_doEffect(SPCurve * curve) { - // commenting the function doEffect in src/live_effects/lpe-bspline.cpp + //spanish: comentado en funcion "doEffect" de src/live_effects/lpe-bspline.cpp if(curve->get_segment_count() < 2) return; Geom::PathVector const original_pathv = curve->get_pathvector(); @@ -1940,7 +1945,7 @@ void PenTool::_bspline_doEffect(SPCurve * curve) } //Spiro function cloned from lpe-spiro.cpp -// commenting the function "doEffect" from src/live_effects/lpe-spiro.cpp +//spanish: comentado en funcion "doEffect" de src/live_effects/lpe-spiro.cpp void PenTool::_spiro_doEffect(SPCurve * curve) { using Geom::X; @@ -2173,7 +2178,7 @@ void PenTool::_finish(gboolean const closed) { desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Drawing finished")); - // cancelate line without a created segment + //spanish para cancelar linea sin un segmento creado this->red_curve->reset(); spdc_concat_colors_and_flush(this, closed); this->sa = NULL; diff --git a/src/ui/tools/pen-tool.h b/src/ui/tools/pen-tool.h index 95565abc9..88e528b22 100644 --- a/src/ui/tools/pen-tool.h +++ b/src/ui/tools/pen-tool.h @@ -49,7 +49,7 @@ public: bool polylines_only; bool polylines_paraxial; - // propiety which saves if Spiro mode is active or not + //spanish: propiedad que guarda si el modo Spiro está activo o no bool spiro; bool bspline; int num_clicks; @@ -88,29 +88,29 @@ private: gint _handleButtonRelease(GdkEventButton const &revent); gint _handle2ButtonPress(GdkEventButton const &bevent); gint _handleKeyPress(GdkEvent *event); - //adds spiro & bspline modes + //spanish: añade los modos spiro y bspline void _pen_context_set_mode(guint mode); - //this function changes the colors red, green and blue making them transparent or not depending on if the function uses spiro + //spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro void _bspline_spiro_color(); - //creates a node in bspline or spiro modes + //spanish: crea un nodo en modo bspline o spiro void _bspline_spiro(bool shift); - //creates a node in bspline or spiro modes + //spanish: crea un nodo de modo spiro o bspline void _bspline_spiro_on(); - //creates a CUSP node + //spanish: crea un nodo de tipo CUSP void _bspline_spiro_off(); - //continues the existing curve in bspline or spiro mode + //spanish: continua una curva existente en modo bspline o spiro void _bspline_spiro_start_anchor(bool shift); - //continues the existing curve with the union node in bspline or spiro modes + //spanish: continua una curva exsitente con el nodo de union en modo bspline o spiro void _bspline_spiro_start_anchor_on(); - //continues an existing curve with the union node in CUSP mode + //spanish: continua una curva existente con el nodo de union en modo CUSP void _bspline_spiro_start_anchor_off(); - //modifies the "red_curve" when it detects movement + //spanish: modifica la "red_curve" cuando se detecta movimiento void _bspline_spiro_motion(bool shift); - //closes the curve with the last node in bspline or spiro mode + //spanish: cierra la curva con el último nodo en modo bspline o spiro void _bspline_spiro_end_anchor_on(); - //closes the curve with the last node in CUSP mode + //spanish: cierra la curva con el último nodo en modo CUSP void _bspline_spiro_end_anchor_off(); - //CHECK: join all the curves "in game" and we call doEffect function + //spanish: unimos todas las curvas en juego y llamamos a la función doEffect. void _bspline_spiro_build(); //function bspline cloned from lpe-bspline.cpp void _bspline_doEffect(SPCurve * curve); diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 1ccdee637..bd50672af 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -685,7 +685,7 @@ void PencilTool::_interpolate() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); for (int c = 0; c < n_segs; c++) { - // if we are in BSpline we modify the trace to create adhoc nodes + //spanish: si el modo es BSpline modificamos para que el trazado cree los nodos adhoc if(mode == 2){ Geom::Point BP = b[4*c+0] + (1./3)*(b[4*c+3] - b[4*c+0]); BP = Geom::Point(BP[X] + 0.0001,BP[Y] + 0.0001); @@ -835,7 +835,7 @@ void PencilTool::_fitAndSplit() { this->red_curve->moveto(b[0]); using Geom::X; using Geom::Y; - // if we are in BSpline we modify the trace to create adhoc nodes + //spanish: si el modo es BSpline modificamos para que el trazado cree los nodos adhoc Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); if(mode == 2){ -- cgit v1.2.3 From c15e77cc2670408ab725ba60c064743a9b61a375 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 5 Mar 2014 20:18:54 +0100 Subject: Fixing branch problems (bzr r11950.1.281) --- src/ui/tools/freehand-base.cpp | 23 ++++++++------- src/ui/tools/node-tool.h | 3 +- src/ui/tools/pen-tool.cpp | 67 +++++++++++++++++++----------------------- src/ui/tools/pen-tool.h | 26 ++++++++-------- src/ui/tools/pencil-tool.cpp | 4 +-- 5 files changed, 60 insertions(+), 63 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index cb6111bd5..40a257de9 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -252,7 +252,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1) { Effect::createAndApply(SPIRO, dc->desktop->doc(), item); } - //spanish: añadimos el modo bspline a los efectos en espera + //add the bspline node in the waiting effects if (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) { Effect::createAndApply(BSPLINE, dc->desktop->doc(), item); } @@ -496,9 +496,9 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->blue2_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue2_bpath), NULL); - //spanish: si c esta vacio, puede ser que se haya tratado de contnuar una curva existente - //y se haya cancelado. Si es asi y el modo es bspline o spirolive la curva previa necesita volver a ser seleccionada - //porque la modificamos al continuar por un anchor + /* if c is empty, it might be that the user was trying to continue an existing curve and cancelled. + if this is the case and we are in bspline or spirolive the previous curve needs to be selected again because + we modify it when continuing through an anchor. */ if (c->is_empty()) { if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ SPDesktop *desktop = dc->desktop; @@ -527,8 +527,10 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) { // We hit bot start and end of single curve, closing paths dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Closing path.")); - //spanish: si estamos en modo bspline o spirolive, la curva de continuación y finalización es actualizada al continuar o finalizar la curva en un anchor - //esto proboca que la función original no detecte si es la misma curva en el caso de curvas con multiples partes -shift- y cierre de manera erronea una de las partes + + /* if we are in bspline or spirolive mode, the continuation and ending curve are updated when continuing or ending the curve in an anchor. + this causes that the original function doesn't detect if it's the same curve in case the curves have multiples parts -shift- and + close incorrectly one of the parts */ if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { @@ -547,8 +549,8 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) c->unref(); dc->sa->curve->closepath_current(); } - //spanish: Si la curva tiene un LPE del tipo bspline o spiro ejecutamos spdc_flush_white - //pasándole la curva de inicio necesaria + + //if the curve has an bspline or spiro LPE, we execute spdc_flush_white, passing the necessary starting curve. if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); @@ -679,9 +681,8 @@ SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p) } } - //spanish: modificamos la curva de anclaje para que sea igual que la curva de inicio. - //esta curva fue modificada al continuar la curva y necesitamos que sea igual que la curva en - //la que cerramos el trazado. + /* modify the anchoring curve so it is equal to the starting curve. + this curve is modified when it's modified and we need them to be equal to the closing curve */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if((prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) && diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index 168ec995a..42f89cd1c 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -14,7 +14,8 @@ #include #include #include "ui/tools/tool-base.h" -//spanish: lo necesitamos para llamarlo desde el Live Effect + +// we need it to call it from Live Effect #include "selection.h" namespace Inkscape { diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index ad77fcb53..e3bbc72b1 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -42,7 +42,7 @@ #include "context-fns.h" #include "tools-switch.h" #include "ui/control-manager.h" -//spanish: incluimos los archivos necesarios para las BSpline y Spiro +// we include the necessary files for BSpline & Spiro #include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" @@ -166,7 +166,7 @@ PenTool::~PenTool() { void PenTool::setPolylineMode() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pen/freehand-mode", 0); - //spanish: cambiamos los modos para dar cabida al modo bspline + // change the nodes to make space for bspline mode this->polylines_only = (mode == 3 || mode == 4); this->polylines_paraxial = (mode == 4); //we call the function which defines the Spiro modes and the BSpline @@ -178,7 +178,7 @@ void PenTool::setPolylineMode() { *.Set the mode of draw spiro, and bsplines */ void PenTool::_pen_context_set_mode(guint mode) { - //spanish: definimos los modos + // define the nodes this->spiro = (mode == 1); this->bspline = (mode == 2); } @@ -386,7 +386,7 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { if(bevent.button != 3 && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ this->state = PenTool::STOP; if( anchor && anchor == this->sa && this->green_curve->is_empty()){ - //spanish Borrar siguiente linea para evitar un nodo encima de otro + //remove the following line to avoid having one node on top of another _finishSegment(event_dt, bevent.state); _finish( FALSE); return TRUE; @@ -512,7 +512,7 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { } } - //spanish: evitamos la creación de un punto de control para que se cree el nodo en el evento de soltar + // avoid the creation of a control point so a node is created in the release event this->state = (this->spiro || this->bspline || this->polylines_only) ? PenTool::POINT : PenTool::CONTROL; ret = TRUE; @@ -705,7 +705,7 @@ gint PenTool::_handleMotionNotify(GdkEventMotion const &mevent) { default: break; } - //spanish: lanzamos la función "bspline_spiro_motion" al moverse el ratón o cuando se para. + // calls the function "bspline_spiro_motion" when the mouse starts or stops moving if(this->bspline){ this->_bspline_spiro_color(); this->_bspline_spiro_motion(mevent.state & GDK_SHIFT_MASK); @@ -743,9 +743,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { // Test whether we hit any anchor. SPDrawAnchor *anchor = spdc_test_inside(this, event_w); - //with this we avoid creating a new point over the existing one - //spanish: si intentamos crear un nodo en el mismo sitio que el origen, paramos. - + // if we try to create a node in the same place as another node, we skip if((!anchor || anchor == this->sa) && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ return TRUE; } @@ -760,7 +758,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { p = anchor->dp; } this->sa = anchor; - //spanish: continuamos una curva existente + // continue the existing curve if (anchor) { if(this->bspline || this->spiro){ this->_bspline_spiro_start_anchor(revent.state & GDK_SHIFT_MASK);; @@ -790,7 +788,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { this->_endpointSnap(p, revent.state); } this->_finishSegment(p, revent.state); - //spanish: ocultamos la guia del penultimo nodo al cerrar la curva + // hude the guide of the penultimate node when closing the curve if(this->spiro){ sp_canvas_item_hide(this->c1); } @@ -817,7 +815,7 @@ gint PenTool::_handleButtonRelease(GdkEventButton const &revent) { case PenTool::CLOSE: this->_endpointSnap(p, revent.state); this->_finishSegment(p, revent.state); - //spanish: ocultamos la guia del penultimo nodo al cerrar la curva + // hide the penultimate node guide when closing the curve if(this->spiro){ sp_canvas_item_hide(this->c1); } @@ -908,7 +906,7 @@ void PenTool::_redrawAll() { sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); // handles - //spanish: ocultamos los tiradores en modo bspline y spiro + // hide the handlers in bspline and spiro modes if (this->p[0] != this->p[1] && !this->spiro && !this->bspline) { SP_CTRL(this->c1)->moveto(this->p[1]); this->cl1->setCoords(this->p[0], this->p[1]); @@ -922,7 +920,7 @@ void PenTool::_redrawAll() { Geom::Curve const * last_seg = this->green_curve->last_segment(); if (last_seg) { Geom::CubicBezier const * cubic = dynamic_cast( last_seg ); - //spanish: ocultamos los tiradores en modo bspline y spiro + // hide the handlers in bspline and spiro modes if ( cubic && (*cubic)[2] != this->p[0] && !this->spiro && !this->bspline ) { @@ -937,9 +935,8 @@ void PenTool::_redrawAll() { } } - //spanish: simplemente redibujamos la spiro. - //como es un redibujo simplemente no llamamos a la función global sino al final de esta - //Lanzamos solamente el redibujado + // simply redraw the spiro. because its a redrawing, we don't call the global function, + // but we call the redrawing at the ending. this->_bspline_spiro_build(); } @@ -969,12 +966,12 @@ void PenTool::_lastpointMoveScreen(gdouble x, gdouble y) { } void PenTool::_lastpointToCurve() { - //spanish: evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. + // avoid that if the "red_curve" contains only two points ( rect ), it doesn't stop here. if (this->npoints != 5 && !this->spiro && !this->bspline) return; Geom::CubicBezier const * cubic; this->p[1] = this->red_curve->last_segment()->initialPoint() + (1./3)* (Geom::Point)(this->red_curve->last_segment()->finalPoint() - this->red_curve->last_segment()->initialPoint()); - //spanish: modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos + //modificate the last segment of the green curve so it creates the type of node we need if(this->spiro||this->bspline){ if(!this->green_curve->is_empty()){ Geom::Point A(0,0); @@ -1012,7 +1009,7 @@ void PenTool::_lastpointToCurve() { this->green_curve->append_continuous(previous, 0.0625); } } - //spanish: si el último nodo es una union con otra curva + //if the last node is an union with another curve if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ this->_bspline_spiro_start_anchor(false); } @@ -1023,11 +1020,11 @@ void PenTool::_lastpointToCurve() { void PenTool::_lastpointToLine() { - //spanish: evitamos que si la "red_curve" tiene solo dos puntos -recta- no se pare aqui. + // avoid that if the "red_curve" contains only two points ( rect) it doesn't stop here. if (this->npoints != 5 && !this->bspline) return; - //spanish: modificamos el último segmento de la curva verde para que forme el tipo de nodo que deseamos + // modify the last segment of the green curve so the type of node we want is created. if(this->spiro || this->bspline){ if(!this->green_curve->is_empty()){ Geom::Point A(0,0); @@ -1059,7 +1056,7 @@ void PenTool::_lastpointToLine() { this->green_curve->append_continuous(previous, 0.0625); } } - //spanish: si el último nodo es una union con otra curva + // if the last node is an union with another curve if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ this->_bspline_spiro_start_anchor(true); } @@ -1248,7 +1245,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { this->p[1] = this->p[0]; } - //spanish: asignamos el valor a un tercio de distancia del último segmento. + // asign the value in a third of the distance of the last segment. if(this->bspline){ this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]); } @@ -1258,7 +1255,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { : this->p[3])); this->npoints = 2; - //spanish: eliminamos el último segmento de la curva verde + // delete the last segment of the green curve if( this->green_curve->get_segment_count() == 1){ this->npoints = 5; if (this->green_bpaths) { @@ -1270,7 +1267,7 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { }else{ this->green_curve->backspace(); } - //spanish: asignamos el valor de this->p[1] a el opuesto de el ultimo segmento de la línea verde + // assign the value of this->p[1] to the oposite of the green line last segment if(this->spiro){ cubic = dynamic_cast(this->green_curve->last_segment()); if ( cubic ) { @@ -1285,7 +1282,8 @@ gint PenTool::_handleKeyPress(GdkEvent *event) { this->state = PenTool::POINT; this->_setSubsequentPoint(pt, true); pen_last_paraxial_dir = !pen_last_paraxial_dir; - //spanish: redibujamos + + //redraw this->_bspline_spiro_build(); ret = TRUE; } @@ -1360,9 +1358,7 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t g_string_free(dist, FALSE); } - - -//spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro +// this function changes the colors red, green and blue making them transparent or not, depending on if spiro is being used. void PenTool::_bspline_spiro_color() { bool remake_green_bpaths = false; @@ -1736,8 +1732,7 @@ void PenTool::_bspline_spiro_end_anchor_off() } } - -//spanish: preparates the curves for its trasformation into BSline curves. +//prepares the curves for its transformation into BSpline curve. void PenTool::_bspline_spiro_build() { if(!this->spiro && !this->bspline) @@ -1766,7 +1761,7 @@ void PenTool::_bspline_spiro_build() } if(!curve->is_empty()){ - //spanish: cerramos la curva si estan cerca los puntos finales de la curva + // close the curve if the final points of the curve are close enough if(Geom::are_near(curve->first_path()->initialPoint(), curve->last_path()->finalPoint())){ curve->closepath_current(); } @@ -1805,7 +1800,7 @@ void PenTool::_bspline_spiro_build() void PenTool::_bspline_doEffect(SPCurve * curve) { - //spanish: comentado en funcion "doEffect" de src/live_effects/lpe-bspline.cpp + // commenting the function doEffect in src/live_effects/lpe-bspline.cpp if(curve->get_segment_count() < 2) return; Geom::PathVector const original_pathv = curve->get_pathvector(); @@ -1945,7 +1940,7 @@ void PenTool::_bspline_doEffect(SPCurve * curve) } //Spiro function cloned from lpe-spiro.cpp -//spanish: comentado en funcion "doEffect" de src/live_effects/lpe-spiro.cpp +// commenting the function "doEffect" from src/live_effects/lpe-spiro.cpp void PenTool::_spiro_doEffect(SPCurve * curve) { using Geom::X; @@ -2178,7 +2173,7 @@ void PenTool::_finish(gboolean const closed) { desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Drawing finished")); - //spanish para cancelar linea sin un segmento creado + // cancelate line without a created segment this->red_curve->reset(); spdc_concat_colors_and_flush(this, closed); this->sa = NULL; diff --git a/src/ui/tools/pen-tool.h b/src/ui/tools/pen-tool.h index 88e528b22..95565abc9 100644 --- a/src/ui/tools/pen-tool.h +++ b/src/ui/tools/pen-tool.h @@ -49,7 +49,7 @@ public: bool polylines_only; bool polylines_paraxial; - //spanish: propiedad que guarda si el modo Spiro está activo o no + // propiety which saves if Spiro mode is active or not bool spiro; bool bspline; int num_clicks; @@ -88,29 +88,29 @@ private: gint _handleButtonRelease(GdkEventButton const &revent); gint _handle2ButtonPress(GdkEventButton const &bevent); gint _handleKeyPress(GdkEvent *event); - //spanish: añade los modos spiro y bspline + //adds spiro & bspline modes void _pen_context_set_mode(guint mode); - //spanish: esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro + //this function changes the colors red, green and blue making them transparent or not depending on if the function uses spiro void _bspline_spiro_color(); - //spanish: crea un nodo en modo bspline o spiro + //creates a node in bspline or spiro modes void _bspline_spiro(bool shift); - //spanish: crea un nodo de modo spiro o bspline + //creates a node in bspline or spiro modes void _bspline_spiro_on(); - //spanish: crea un nodo de tipo CUSP + //creates a CUSP node void _bspline_spiro_off(); - //spanish: continua una curva existente en modo bspline o spiro + //continues the existing curve in bspline or spiro mode void _bspline_spiro_start_anchor(bool shift); - //spanish: continua una curva exsitente con el nodo de union en modo bspline o spiro + //continues the existing curve with the union node in bspline or spiro modes void _bspline_spiro_start_anchor_on(); - //spanish: continua una curva existente con el nodo de union en modo CUSP + //continues an existing curve with the union node in CUSP mode void _bspline_spiro_start_anchor_off(); - //spanish: modifica la "red_curve" cuando se detecta movimiento + //modifies the "red_curve" when it detects movement void _bspline_spiro_motion(bool shift); - //spanish: cierra la curva con el último nodo en modo bspline o spiro + //closes the curve with the last node in bspline or spiro mode void _bspline_spiro_end_anchor_on(); - //spanish: cierra la curva con el último nodo en modo CUSP + //closes the curve with the last node in CUSP mode void _bspline_spiro_end_anchor_off(); - //spanish: unimos todas las curvas en juego y llamamos a la función doEffect. + //CHECK: join all the curves "in game" and we call doEffect function void _bspline_spiro_build(); //function bspline cloned from lpe-bspline.cpp void _bspline_doEffect(SPCurve * curve); diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index bd50672af..1ccdee637 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -685,7 +685,7 @@ void PencilTool::_interpolate() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); for (int c = 0; c < n_segs; c++) { - //spanish: si el modo es BSpline modificamos para que el trazado cree los nodos adhoc + // if we are in BSpline we modify the trace to create adhoc nodes if(mode == 2){ Geom::Point BP = b[4*c+0] + (1./3)*(b[4*c+3] - b[4*c+0]); BP = Geom::Point(BP[X] + 0.0001,BP[Y] + 0.0001); @@ -835,7 +835,7 @@ void PencilTool::_fitAndSplit() { this->red_curve->moveto(b[0]); using Geom::X; using Geom::Y; - //spanish: si el modo es BSpline modificamos para que el trazado cree los nodos adhoc + // if we are in BSpline we modify the trace to create adhoc nodes Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0); if(mode == 2){ -- cgit v1.2.3 From eb7c3f5dc2737bb22388b040f857117c3a25da6f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 6 Mar 2014 15:21:30 +0100 Subject: Fixed a bug when click over the previuos node in bspline/spiro mode (bzr r11950.1.285) --- src/ui/tools/pen-tool.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index e3bbc72b1..d79803644 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -384,7 +384,6 @@ gint PenTool::_handleButtonPress(GdkEventButton const &bevent) { //with this we avoid creating a new point over the existing one if(bevent.button != 3 && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ - this->state = PenTool::STOP; if( anchor && anchor == this->sa && this->green_curve->is_empty()){ //remove the following line to avoid having one node on top of another _finishSegment(event_dt, bevent.state); -- cgit v1.2.3 From 9e33a22a12381e538c26580798934eb418f62bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20dos=20Santos=20Oliveira?= Date: Sun, 9 Mar 2014 22:06:46 -0300 Subject: Shortening code through removal of variable declaration used only at one place. (bzr r11950.6.1) --- src/ui/tools/freehand-base.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 40a257de9..4b7a310e3 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -501,8 +501,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) we modify it when continuing through an anchor. */ if (c->is_empty()) { if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - SPDesktop *desktop = dc->desktop; - spdc_selection_modified(sp_desktop_selection(desktop), 0, dc); + spdc_selection_modified(sp_desktop_selection(dc->desktop), 0, dc); } c->unref(); return; -- cgit v1.2.3 From 4b8c6b64ba7ac54955cc68aa6ad18c67b57ef5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20dos=20Santos=20Oliveira?= Date: Sun, 9 Mar 2014 23:20:18 -0300 Subject: Removing repeated condition logical test to make the code more readable and easier to follow. (bzr r11950.6.2) --- src/ui/tools/freehand-base.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 4b7a310e3..3f74a5147 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -540,6 +540,11 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) if(Geom::are_near(dc->sa->curve->first_path()->initialPoint(), dc->ea->dp)){ dc->sa->curve->closepath_current(); } + + // if the curve has an bspline or spiro LPE, we execute + // spdc_flush_white, passing the necessary starting curve. + dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); + spdc_flush_white(dc, dc->sa->curve); }else{ if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { c = reverse_then_unref(c); @@ -547,16 +552,9 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->sa->curve->append_continuous(c, 0.0625); c->unref(); dc->sa->curve->closepath_current(); - } - - //if the curve has an bspline or spiro LPE, we execute spdc_flush_white, passing the necessary starting curve. - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); - spdc_flush_white(dc, dc->sa->curve); - }else{ spdc_flush_white(dc, NULL); } + return; } -- cgit v1.2.3 From c1c76126846e36fab78a51e5acec475b4de5ea44 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 19 Mar 2014 21:54:30 +0100 Subject: This think fix su_v related bug on continuous paths in BSpline or Spiro mode (bzr r11950.1.301) --- src/ui/tools/freehand-base.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 3f74a5147..67b603ab0 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -495,7 +495,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) // Blue2 dc->blue2_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue2_bpath), NULL); - + /* if c is empty, it might be that the user was trying to continue an existing curve and cancelled. if this is the case and we are in bspline or spirolive the previous curve needs to be selected again because we modify it when continuing through an anchor. */ @@ -614,6 +614,18 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) bool has_lpe = false; Inkscape::XML::Node *repr; + + /* if we are in bspline or spirolive the anchors curves, if exist, needs to be selected again because + we modify it when continuing through an anchor. */ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if ( ((dc->sa && !dc->sa->curve->is_empty()) || + (dc->ea && !dc->ea->curve->is_empty())) && + (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) + ) { + spdc_selection_modified(sp_desktop_selection(dc->desktop), 0, dc); + } + if (dc->white_item) { repr = dc->white_item->getRepr(); has_lpe = SP_LPE_ITEM(dc->white_item)->hasPathEffectRecursive(); -- cgit v1.2.3 From c6e50a519c55220ccd4efdd6a7a7dbe51cf9fa04 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Mar 2014 22:49:07 +0100 Subject: Fixing suv mac bug continuing existing bsplines/spiro paths (bzr r11950.1.303) --- src/ui/tools/freehand-base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 67b603ab0..d34ca2142 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -566,7 +566,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) s = reverse_then_unref(s); } s->append_continuous(c, 0.0625); - c->unref(); + c->reset(); c = s; } else /* Step D - test end */ if (dc->ea) { SPCurve *e = dc->ea->curve; -- cgit v1.2.3 From 988c4a1639ca097634e336d49ad92eb1eb576f31 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 19 Mar 2014 23:05:50 +0100 Subject: Fix a bug when starting path with change from bspline to spiro and inverse (bzr r11950.1.304) --- src/ui/tools/pen-tool.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index d79803644..75dd6a32b 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1445,6 +1445,10 @@ void PenTool::_bspline_spiro_off() void PenTool::_bspline_spiro_start_anchor(bool shift) { + if(this->sa->curve->is_empty()){ + return; + } + LivePathEffect::LPEBSpline *lpe_bsp = NULL; if (SP_IS_LPE_ITEM(this->white_item) && SP_LPE_ITEM(this->white_item)->hasPathEffect()){ @@ -1474,9 +1478,6 @@ void PenTool::_bspline_spiro_start_anchor(bool shift) if(!this->spiro && !this->bspline) return; - if(this->sa->curve->is_empty()) - return; - if(shift) this->_bspline_spiro_start_anchor_off(); else -- cgit v1.2.3 From 67a180fdd31fd8dd06be4df75356509001295458 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 20 Mar 2014 01:48:37 +0100 Subject: Refactor of anchors (bzr r11950.1.306) --- src/ui/tools/freehand-base.cpp | 97 +++++++++++++++++------------------------- src/ui/tools/freehand-base.h | 2 + src/ui/tools/pen-tool.cpp | 18 ++++---- 3 files changed, 50 insertions(+), 67 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index d34ca2142..5897ce0ee 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -492,17 +492,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), NULL); - // Blue2 - dc->blue2_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue2_bpath), NULL); - - /* if c is empty, it might be that the user was trying to continue an existing curve and cancelled. - if this is the case and we are in bspline or spirolive the previous curve needs to be selected again because - we modify it when continuing through an anchor. */ if (c->is_empty()) { - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - spdc_selection_modified(sp_desktop_selection(dc->desktop), 0, dc); - } c->unref(); return; } @@ -526,50 +516,43 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) { // We hit bot start and end of single curve, closing paths dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Closing path.")); - - /* if we are in bspline or spirolive mode, the continuation and ending curve are updated when continuing or ending the curve in an anchor. - this causes that the original function doesn't detect if it's the same curve in case the curves have multiples parts -shift- and - close incorrectly one of the parts */ + if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { + c = reverse_then_unref(c); + } if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { - dc->sa->curve = reverse_then_unref(dc->sa->curve); - } - dc->sa->curve->append_continuous(c, 0.0625); + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ + dc->sc->append_continuous(c, 0.0625); c->unref(); - if(Geom::are_near(dc->sa->curve->first_path()->initialPoint(), dc->ea->dp)){ - dc->sa->curve->closepath_current(); - } - - // if the curve has an bspline or spiro LPE, we execute - // spdc_flush_white, passing the necessary starting curve. - dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); - spdc_flush_white(dc, dc->sa->curve); + dc->sc->closepath_current(); }else{ - if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { - c = reverse_then_unref(c); - } dc->sa->curve->append_continuous(c, 0.0625); c->unref(); dc->sa->curve->closepath_current(); - spdc_flush_white(dc, NULL); } - + spdc_flush_white(dc, NULL); return; } // Step C - test start if (dc->sa) { SPCurve *s = dc->sa->curve; + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ + s = dc->sc; + } dc->white_curves = g_slist_remove(dc->white_curves, s); if (dc->sa->start) { s = reverse_then_unref(s); } s->append_continuous(c, 0.0625); - c->reset(); + c->unref(); c = s; } else /* Step D - test end */ if (dc->ea) { SPCurve *e = dc->ea->curve; + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ + e = dc->ec; + } dc->white_curves = g_slist_remove(dc->white_curves, e); if (!dc->ea->start) { e = reverse_then_unref(e); @@ -577,16 +560,30 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) c->append_continuous(e, 0.0625); e->unref(); } + + spdc_flush_white(dc, c); + c->unref(); } static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) { SPCurve *c; - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (dc->white_curves) { g_assert(dc->white_item); + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ + if(dc->sa){ + dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); + dc->white_curves = g_slist_append(dc->white_curves, dc->sc); + } + if(dc->ea){ + dc->white_curves = g_slist_remove(dc->white_curves, dc->ea->curve); + dc->white_curves = g_slist_append(dc->white_curves, dc->ec); + } + } c = SPCurve::concat(dc->white_curves); g_slist_free(dc->white_curves); dc->white_curves = NULL; @@ -615,17 +612,6 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) bool has_lpe = false; Inkscape::XML::Node *repr; - /* if we are in bspline or spirolive the anchors curves, if exist, needs to be selected again because - we modify it when continuing through an anchor. */ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if ( ((dc->sa && !dc->sa->curve->is_empty()) || - (dc->ea && !dc->ea->curve->is_empty())) && - (prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) - ) { - spdc_selection_modified(sp_desktop_selection(dc->desktop), 0, dc); - } - if (dc->white_item) { repr = dc->white_item->getRepr(); has_lpe = SP_LPE_ITEM(dc->white_item)->hasPathEffectRecursive(); @@ -689,19 +675,6 @@ SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p) active = na; } } - - /* modify the anchoring curve so it is equal to the starting curve. - this curve is modified when it's modified and we need them to be equal to the closing curve */ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if((prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2) && - dc->sa && !dc->red_curve->is_empty() && !dc->green_anchor){ - if(active){ - active->curve = dc->sa->curve; - active->curve->ref(); - } - } - return active; } @@ -750,6 +723,14 @@ static void spdc_free_colors(FreehandBase *dc) dc->blue2_curve = dc->blue2_curve->unref(); } + if (dc->sc) { + dc->sc = dc->sc->unref(); + } + + if (dc->ec) { + dc->ec = dc->ec->unref(); + } + // Green while (dc->green_bpaths) { sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->green_bpaths->data)); diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h index d5c2fc9ba..266e22783 100644 --- a/src/ui/tools/freehand-base.h +++ b/src/ui/tools/freehand-base.h @@ -74,9 +74,11 @@ public: // Start anchor SPDrawAnchor *sa; + SPCurve * sc; // End anchor SPDrawAnchor *ea; + SPCurve * ec; /* type of the LPE that is to be applied automatically to a finished path (if any) */ Inkscape::LivePathEffect::EffectType waiting_LPE_type; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 75dd6a32b..1701cf5d9 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1516,8 +1516,8 @@ void PenTool::_bspline_spiro_start_anchor_on() if (this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sa->curve->reset(); - this->sa->curve = tmpCurve; + this->sc->reset(); + this->sc = tmpCurve; } void PenTool::_bspline_spiro_start_anchor_off() @@ -1542,8 +1542,8 @@ void PenTool::_bspline_spiro_start_anchor_off() if (this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sa->curve->reset(); - this->sa->curve = tmpCurve; + this->sc->reset(); + this->sc = tmpCurve; } } @@ -1677,8 +1677,8 @@ void PenTool::_bspline_spiro_end_anchor_on() if (!this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sa->curve->reset(); - this->sa->curve = tmpCurve; + this->sc->reset(); + this->sc = tmpCurve; } } @@ -1726,8 +1726,8 @@ void PenTool::_bspline_spiro_end_anchor_off() if (!this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sa->curve->reset(); - this->sa->curve = tmpCurve; + this->sc->reset(); + this->sc = tmpCurve; } } } @@ -1742,7 +1742,7 @@ void PenTool::_bspline_spiro_build() SPCurve *curve = new SPCurve(); //If we continuate the existing curve we add it at the start if(this->sa && !this->sa->curve->is_empty()){ - curve = this->sa->curve->copy(); + curve = this->sc->copy(); if (this->sa->start) { curve = curve->create_reverse(); } -- cgit v1.2.3 From 9c0d852d84da8af9cbb07ee2ed0488390225f126 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 20 Mar 2014 03:27:13 +0100 Subject: Full refactor of path continuations in bspline-spirolive mode, I think no more suv mac crashes, but need to be full tested again because a lot of things changed. (bzr r11950.1.308) --- src/ui/tools/freehand-base.cpp | 37 +++++++++++++++---------------------- src/ui/tools/freehand-base.h | 4 ++-- src/ui/tools/pen-tool.cpp | 5 ++--- src/ui/tools/pencil-tool.cpp | 3 +++ 4 files changed, 22 insertions(+), 27 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 5897ce0ee..cecf0c0ca 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -92,7 +92,9 @@ FreehandBase::FreehandBase(gchar const *const *cursor_shape, gint hot_x, gint ho , white_curves(NULL) , white_anchors(NULL) , sa(NULL) + , sc(NULL) , ea(NULL) + , ec(NULL) , waiting_LPE_type(Inkscape::LivePathEffect::INVALID_LPE) , red_curve_is_valid(false) , anchor_statusbar(false) @@ -153,6 +155,12 @@ void FreehandBase::setup() { this->green_anchor = NULL; this->green_closed = FALSE; + // Create start anchor alternative curve + this->sc = new SPCurve(); + + // Create end anchor alternative curve + this->ec = new SPCurve(); + this->attach = TRUE; spdc_attach_selection(this, this->selection); } @@ -524,6 +532,10 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->sc->append_continuous(c, 0.0625); c->unref(); dc->sc->closepath_current(); + if(dc->sa){ + dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); + dc->white_curves = g_slist_append(dc->white_curves, dc->sc); + } }else{ dc->sa->curve->append_continuous(c, 0.0625); c->unref(); @@ -536,11 +548,11 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) // Step C - test start if (dc->sa) { SPCurve *s = dc->sa->curve; + dc->white_curves = g_slist_remove(dc->white_curves, s); if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ s = dc->sc; } - dc->white_curves = g_slist_remove(dc->white_curves, s); if (dc->sa->start) { s = reverse_then_unref(s); } @@ -549,11 +561,11 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) c = s; } else /* Step D - test end */ if (dc->ea) { SPCurve *e = dc->ea->curve; + dc->white_curves = g_slist_remove(dc->white_curves, e); if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ e = dc->ec; } - dc->white_curves = g_slist_remove(dc->white_curves, e); if (!dc->ea->start) { e = reverse_then_unref(e); } @@ -570,20 +582,9 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) { SPCurve *c; - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (dc->white_curves) { g_assert(dc->white_item); - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - if(dc->sa){ - dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); - dc->white_curves = g_slist_append(dc->white_curves, dc->sc); - } - if(dc->ea){ - dc->white_curves = g_slist_remove(dc->white_curves, dc->ea->curve); - dc->white_curves = g_slist_append(dc->white_curves, dc->ec); - } - } c = SPCurve::concat(dc->white_curves); g_slist_free(dc->white_curves); dc->white_curves = NULL; @@ -723,14 +724,6 @@ static void spdc_free_colors(FreehandBase *dc) dc->blue2_curve = dc->blue2_curve->unref(); } - if (dc->sc) { - dc->sc = dc->sc->unref(); - } - - if (dc->ec) { - dc->ec = dc->ec->unref(); - } - // Green while (dc->green_bpaths) { sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->green_bpaths->data)); diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h index 266e22783..c134c5352 100644 --- a/src/ui/tools/freehand-base.h +++ b/src/ui/tools/freehand-base.h @@ -74,11 +74,11 @@ public: // Start anchor SPDrawAnchor *sa; - SPCurve * sc; + SPCurve *sc; // End anchor SPDrawAnchor *ea; - SPCurve * ec; + SPCurve *ec; /* type of the LPE that is to be applied automatically to a finished path (if any) */ Inkscape::LivePathEffect::EffectType waiting_LPE_type; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 1701cf5d9..3ef9b96af 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1516,7 +1516,6 @@ void PenTool::_bspline_spiro_start_anchor_on() if (this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sc->reset(); this->sc = tmpCurve; } @@ -1542,7 +1541,6 @@ void PenTool::_bspline_spiro_start_anchor_off() if (this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sc->reset(); this->sc = tmpCurve; } @@ -1677,7 +1675,6 @@ void PenTool::_bspline_spiro_end_anchor_on() if (!this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sc->reset(); this->sc = tmpCurve; } } @@ -2176,6 +2173,8 @@ void PenTool::_finish(gboolean const closed) { // cancelate line without a created segment this->red_curve->reset(); spdc_concat_colors_and_flush(this, closed); + this->sc = NULL; + this->ec = NULL; this->sa = NULL; this->ea = NULL; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 1ccdee637..8fe01a852 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -203,6 +203,7 @@ gint PencilTool::_handleButtonPress(GdkEventButton const &bevent) { } if (anchor) { p = anchor->dp; + this->sc = anchor->curve; desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path")); } else { m.setup(desktop); @@ -380,6 +381,7 @@ gint PencilTool::_handleButtonRelease(GdkEventButton const &revent) { /* Finish segment now */ if (anchor) { p = anchor->dp; + this->ec = anchor->curve; } else { this->_endpointSnap(p, revent.state); } @@ -406,6 +408,7 @@ gint PencilTool::_handleButtonRelease(GdkEventButton const &revent) { /// \todo fixme: Clean up what follows (Lauris) if (anchor) { p = anchor->dp; + this->ec = anchor->curve; } else { Geom::Point p_end = p; this->_endpointSnap(p_end, revent.state); -- cgit v1.2.3 From 8dee559ebb54fa7e1ef995b71713c0685b333d60 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 20 Mar 2014 03:35:35 +0100 Subject: Removed persistent blue line (bzr r11950.1.309) --- src/ui/tools/freehand-base.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index cecf0c0ca..ac98be2cf 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -493,6 +493,10 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->blue_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue_bpath), NULL); + // Blue2 + dc->blue2_curve->reset(); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue2_bpath), NULL); + // Red if (dc->red_curve_is_valid) { c->append_continuous(dc->red_curve, 0.0625); -- cgit v1.2.3 From 1ee8c21b5cfe9efa827eed7ab5e31fe28a9b4ae1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 20 Mar 2014 03:39:27 +0100 Subject: Fixed bug continuing cusp nodes (bzr r11950.1.310) --- src/ui/tools/pen-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 3ef9b96af..cea8e67e6 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1563,7 +1563,7 @@ void PenTool::_bspline_spiro_motion(bool shift){ }else if(!this->green_curve->is_empty()){ tmpCurve = this->green_curve->copy(); }else{ - tmpCurve = this->sa->curve->copy(); + tmpCurve = this->sc->copy(); if(this->sa->start) tmpCurve = tmpCurve->create_reverse(); } -- cgit v1.2.3 From e65f0ccd07f3b1278ba389025af29df498a3b3ab Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 31 Mar 2014 16:38:26 +0200 Subject: =?UTF-8?q?clarify=20the=20'sc'=20and=20'ec'=20SPCurve,=20by=20poi?= =?UTF-8?q?nt=20of=20Vin=C3=ADcius,=20whith=20the=20result=20of=20one=20cu?= =?UTF-8?q?rve=20less=20in=20the=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r11950.1.320) --- src/ui/tools/freehand-base.cpp | 20 ++++++-------------- src/ui/tools/freehand-base.h | 7 +++++-- src/ui/tools/pen-tool.cpp | 18 ++++++++---------- src/ui/tools/pencil-tool.cpp | 4 +--- 4 files changed, 20 insertions(+), 29 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index ac98be2cf..04796c2a6 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -91,10 +91,9 @@ FreehandBase::FreehandBase(gchar const *const *cursor_shape, gint hot_x, gint ho , white_item(NULL) , white_curves(NULL) , white_anchors(NULL) + , overwriteCurve(NULL) , sa(NULL) - , sc(NULL) , ea(NULL) - , ec(NULL) , waiting_LPE_type(Inkscape::LivePathEffect::INVALID_LPE) , red_curve_is_valid(false) , anchor_statusbar(false) @@ -156,10 +155,7 @@ void FreehandBase::setup() { this->green_closed = FALSE; // Create start anchor alternative curve - this->sc = new SPCurve(); - - // Create end anchor alternative curve - this->ec = new SPCurve(); + this->overwriteCurve = new SPCurve(); this->attach = TRUE; spdc_attach_selection(this, this->selection); @@ -533,12 +529,12 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) } if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - dc->sc->append_continuous(c, 0.0625); + dc->overwriteCurve->append_continuous(c, 0.0625); c->unref(); - dc->sc->closepath_current(); + dc->overwriteCurve->closepath_current(); if(dc->sa){ dc->white_curves = g_slist_remove(dc->white_curves, dc->sa->curve); - dc->white_curves = g_slist_append(dc->white_curves, dc->sc); + dc->white_curves = g_slist_append(dc->white_curves, dc->overwriteCurve); } }else{ dc->sa->curve->append_continuous(c, 0.0625); @@ -555,7 +551,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->white_curves = g_slist_remove(dc->white_curves, s); if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - s = dc->sc; + s = dc->overwriteCurve; } if (dc->sa->start) { s = reverse_then_unref(s); @@ -566,10 +562,6 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) } else /* Step D - test end */ if (dc->ea) { SPCurve *e = dc->ea->curve; dc->white_curves = g_slist_remove(dc->white_curves, e); - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - e = dc->ec; - } if (!dc->ea->start) { e = reverse_then_unref(e); } diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h index 2422c3563..6e04e03b7 100644 --- a/src/ui/tools/freehand-base.h +++ b/src/ui/tools/freehand-base.h @@ -79,13 +79,16 @@ public: GSList *white_curves; GSList *white_anchors; + //ALternative curve to use on continuing exisiting curve in case of bspline or spirolive + //because usigh anchor curves give memory and random bugs, - and obscure code- in some plataform reported by su_v in mac + SPCurve *overwriteCurve; + // Start anchor SPDrawAnchor *sa; - SPCurve *sc; // End anchor SPDrawAnchor *ea; - SPCurve *ec; + /* type of the LPE that is to be applied automatically to a finished path (if any) */ Inkscape::LivePathEffect::EffectType waiting_LPE_type; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 053f1ac3d..1c0394e15 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -378,7 +378,6 @@ bool PenTool::_handleButtonPress(GdkEventButton const &bevent) { Geom::Point event_dt(desktop->w2d(event_w)); //Test whether we hit any anchor. SPDrawAnchor * const anchor = spdc_test_inside(this, event_w); - ToolBase *event_context = SP_EVENT_CONTEXT(this); //with this we avoid creating a new point over the existing one if(bevent.button != 3 && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ @@ -1535,7 +1534,7 @@ void PenTool::_bspline_spiro_start_anchor_on() if (this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sc = tmpCurve; + this->overwriteCurve = tmpCurve; } void PenTool::_bspline_spiro_start_anchor_off() @@ -1560,7 +1559,7 @@ void PenTool::_bspline_spiro_start_anchor_off() if (this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sc = tmpCurve; + this->overwriteCurve = tmpCurve; } } @@ -1582,7 +1581,7 @@ void PenTool::_bspline_spiro_motion(bool shift){ }else if(!this->green_curve->is_empty()){ tmpCurve = this->green_curve->copy(); }else{ - tmpCurve = this->sc->copy(); + tmpCurve = this->overwriteCurve->copy(); if(this->sa->start) tmpCurve = tmpCurve->create_reverse(); } @@ -1694,7 +1693,7 @@ void PenTool::_bspline_spiro_end_anchor_on() if (!this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sc = tmpCurve; + this->overwriteCurve = tmpCurve; } } @@ -1742,8 +1741,8 @@ void PenTool::_bspline_spiro_end_anchor_off() if (!this->sa->start) { tmpCurve = tmpCurve->create_reverse(); } - this->sc->reset(); - this->sc = tmpCurve; + this->overwriteCurve->reset(); + this->overwriteCurve = tmpCurve; } } } @@ -1758,7 +1757,7 @@ void PenTool::_bspline_spiro_build() SPCurve *curve = new SPCurve(); //If we continuate the existing curve we add it at the start if(this->sa && !this->sa->curve->is_empty()){ - curve = this->sc->copy(); + curve = this->overwriteCurve->copy(); if (this->sa->start) { curve = curve->create_reverse(); } @@ -2191,8 +2190,7 @@ void PenTool::_finish(gboolean const closed) { // cancelate line without a created segment this->red_curve->reset(); spdc_concat_colors_and_flush(this, closed); - this->sc = NULL; - this->ec = NULL; + this->overwriteCurve = NULL; this->sa = NULL; this->ea = NULL; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 6f55d361f..0e8660248 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -200,7 +200,7 @@ bool PencilTool::_handleButtonPress(GdkEventButton const &bevent) { } if (anchor) { p = anchor->dp; - this->sc = anchor->curve; + this->overwriteCurve = anchor->curve; desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path")); } else { m.setup(desktop); @@ -372,7 +372,6 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) { /* Finish segment now */ if (anchor) { p = anchor->dp; - this->ec = anchor->curve; } else { this->_endpointSnap(p, revent.state); } @@ -398,7 +397,6 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) { /// \todo fixme: Clean up what follows (Lauris) if (anchor) { p = anchor->dp; - this->ec = anchor->curve; } else { Geom::Point p_end = p; this->_endpointSnap(p_end, revent.state); -- cgit v1.2.3 From 064e0f756b7525d4af0b8a34b3ef6fe89c007064 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 2 Apr 2014 01:56:31 +0200 Subject: Refactor of end anchors. (bzr r11950.1.325) --- src/ui/tools/freehand-base.cpp | 19 +++++ src/ui/tools/pen-tool.cpp | 169 ++++++++++++++++++++--------------------- 2 files changed, 101 insertions(+), 87 deletions(-) (limited to 'src/ui/tools') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 04796c2a6..1c5b7b8e3 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -565,6 +565,25 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) if (!dc->ea->start) { e = reverse_then_unref(e); } + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ + e = reverse_then_unref(e); + Geom::CubicBezier const * cubic = dynamic_cast(&*e->last_segment()); + SPCurve *lastSeg = new SPCurve(); + if(cubic){ + lastSeg->moveto((*cubic)[0]); + lastSeg->curveto((*cubic)[1],(*cubic)[3],(*cubic)[3]); + if( e->get_segment_count() == 1){ + e = lastSeg; + }else{ + //we eliminate the last segment + e->backspace(); + //and we add it again with the recreation + e->append_continuous(lastSeg, 0.0625); + } + } + e = reverse_then_unref(e); + } c->append_continuous(e, 0.0625); e->unref(); } diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 1c0394e15..9e4df5031 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1637,62 +1637,53 @@ void PenTool::_bspline_spiro_end_anchor_on() SPCurve *tmpCurve = new SPCurve(); SPCurve *lastSeg = new SPCurve(); Geom::Point C(0,0); - if(!this->sa || this->sa->curve->is_empty()){ + bool reverse = false; + if( this->green_anchor && this->green_anchor->active ){ tmpCurve = this->green_curve->create_reverse(); - if(this->green_curve->get_segment_count()==0)return; - Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); - if(this->bspline){ - C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint()); - C = Geom::Point(C[X] + 0.005,C[Y] + 0.005); - }else{ - C = this->p[3] + (Geom::Point)(this->p[3] - this->p[2] ); - } - if(cubic){ - lastSeg->moveto((*cubic)[0]); - lastSeg->curveto((*cubic)[1],C,(*cubic)[3]); - }else{ - lastSeg->moveto(tmpCurve->last_segment()->initialPoint()); - lastSeg->curveto(tmpCurve->last_segment()->initialPoint(),C,tmpCurve->last_segment()->finalPoint()); + if(this->green_curve->get_segment_count()==0){ + return; } - if( tmpCurve->get_segment_count() == 1){ - tmpCurve = lastSeg; - }else{ - //we eliminate the last segment - tmpCurve->backspace(); - //and we add it again with the recreation - tmpCurve->append_continuous(lastSeg, 0.0625); + reverse = true; + } else if(this->sa){ + tmpCurve = this->overwriteCurve; + if(!this->sa->start){ + tmpCurve = tmpCurve->create_reverse(); + reverse = true; } + }else{ + return; + } + Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); + if(this->bspline){ + C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint()); + C = Geom::Point(C[X] + 0.005,C[Y] + 0.005); + }else{ + C = this->p[3] + (Geom::Point)(this->p[3] - this->p[2] ); + } + if(cubic){ + lastSeg->moveto((*cubic)[0]); + lastSeg->curveto((*cubic)[1],C,(*cubic)[3]); + }else{ + lastSeg->moveto(tmpCurve->last_segment()->initialPoint()); + lastSeg->curveto(tmpCurve->last_segment()->initialPoint(),C,tmpCurve->last_segment()->finalPoint()); + } + if( tmpCurve->get_segment_count() == 1){ + tmpCurve = lastSeg; + }else{ + //we eliminate the last segment + tmpCurve->backspace(); + //and we add it again with the recreation + tmpCurve->append_continuous(lastSeg, 0.0625); + } + if (reverse) { tmpCurve = tmpCurve->create_reverse(); + } + if( this->green_anchor && this->green_anchor->active ) + { this->green_curve->reset(); this->green_curve = tmpCurve; - }else { - tmpCurve = this->sa->curve->copy(); - if(!this->sa->start) tmpCurve = tmpCurve->create_reverse(); - Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); - if(this->bspline){ - C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint()); - C = Geom::Point(C[X] + 0.005,C[Y] + 0.005); - }else{ - C = this->p[3] + (Geom::Point)(this->p[3] - this->p[2] ); - } - if(cubic){ - lastSeg->moveto((*cubic)[0]); - lastSeg->curveto((*cubic)[1],C,(*cubic)[3]); - }else{ - lastSeg->moveto(tmpCurve->last_segment()->initialPoint()); - lastSeg->curveto(tmpCurve->last_segment()->initialPoint(),C,tmpCurve->last_segment()->finalPoint()); - } - if( tmpCurve->get_segment_count() == 1){ - tmpCurve = lastSeg; - }else{ - //we eliminate the last segment - tmpCurve->backspace(); - //and we add it again with the recreation - tmpCurve->append_continuous(lastSeg, 0.0625); - } - if (!this->sa->start) { - tmpCurve = tmpCurve->create_reverse(); - } + }else{ + this->overwriteCurve->reset(); this->overwriteCurve = tmpCurve; } } @@ -1702,45 +1693,43 @@ void PenTool::_bspline_spiro_end_anchor_off() SPCurve *tmpCurve = new SPCurve(); SPCurve *lastSeg = new SPCurve(); + bool reverse = false; this->p[2] = this->p[3]; - if(!this->sa || this->sa->curve->is_empty()){ - + if( this->green_anchor && this->green_anchor->active ){ tmpCurve = this->green_curve->create_reverse(); - if(this->green_curve->get_segment_count()==0)return; - Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); - if(cubic){ - lastSeg->moveto((*cubic)[0]); - lastSeg->curveto((*cubic)[1],(*cubic)[3],(*cubic)[3]); - if( tmpCurve->get_segment_count() == 1){ - tmpCurve = lastSeg; - }else{ - //we eliminate the last segment - tmpCurve->backspace(); - //and we add it again with the recreation - tmpCurve->append_continuous(lastSeg, 0.0625); - } + if(this->green_curve->get_segment_count()==0){ + return; + } + reverse = true; + } else if(this->sa){ + tmpCurve = this->overwriteCurve; + if(!this->sa->start){ + tmpCurve = tmpCurve->create_reverse(); + reverse = true; + } + }else{ + return; + } + Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); + if(cubic){ + lastSeg->moveto((*cubic)[0]); + lastSeg->curveto((*cubic)[1],(*cubic)[3],(*cubic)[3]); + if( tmpCurve->get_segment_count() == 1){ + tmpCurve = lastSeg; + }else{ + //we eliminate the last segment + tmpCurve->backspace(); + //and we add it again with the recreation + tmpCurve->append_continuous(lastSeg, 0.0625); + } + if (reverse) { tmpCurve = tmpCurve->create_reverse(); + } + if( this->green_anchor && this->green_anchor->active ) + { this->green_curve->reset(); this->green_curve = tmpCurve; - } - }else { - tmpCurve = this->sa->curve->copy(); - if(!this->sa->start) tmpCurve = tmpCurve->create_reverse(); - Geom::CubicBezier const * cubic = dynamic_cast(&*tmpCurve->last_segment()); - if(cubic){ - lastSeg->moveto((*cubic)[0]); - lastSeg->curveto((*cubic)[1],(*cubic)[3],(*cubic)[3]); - if( tmpCurve->get_segment_count() == 1){ - tmpCurve = lastSeg; - }else{ - //we eliminate the last segment - tmpCurve->backspace(); - //and we add it again with the recreation - tmpCurve->append_continuous(lastSeg, 0.0625); - } - if (!this->sa->start) { - tmpCurve = tmpCurve->create_reverse(); - } + }else{ this->overwriteCurve->reset(); this->overwriteCurve = tmpCurve; } @@ -1750,8 +1739,9 @@ void PenTool::_bspline_spiro_end_anchor_off() //prepares the curves for its transformation into BSpline curve. void PenTool::_bspline_spiro_build() { - if(!this->spiro && !this->bspline) + if(!this->spiro && !this->bspline){ return; + } //We create the base curve SPCurve *curve = new SPCurve(); @@ -1763,14 +1753,19 @@ void PenTool::_bspline_spiro_build() } } - if (!this->green_curve->is_empty()) + if (!this->green_curve->is_empty()){ curve->append_continuous(this->green_curve, 0.0625); + } //and the red one if (!this->red_curve->is_empty()){ this->red_curve->reset(); this->red_curve->moveto(this->p[0]); - this->red_curve->curveto(this->p[1],this->p[2],this->p[3]); + if(this->anchor_statusbar && !this->sa && !(this->green_anchor && this->green_anchor->active)){ + this->red_curve->curveto(this->p[1],this->p[3],this->p[3]); + }else{ + this->red_curve->curveto(this->p[1],this->p[2],this->p[3]); + } sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); curve->append_continuous(this->red_curve, 0.0625); } -- cgit v1.2.3