summaryrefslogtreecommitdiffstats
path: root/src/ui/tools
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-03-02 22:50:04 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-03-02 22:50:04 +0000
commitfef7175272bbed79c874496c71092d3ba6e38d98 (patch)
tree5b93f3e70123b2df5930934bc561aa7715c1bd91 /src/ui/tools
parentFixed update to trunk, lot of changes vinícius (diff)
downloadinkscape-fef7175272bbed79c874496c71092d3ba6e38d98.tar.gz
inkscape-fef7175272bbed79c874496c71092d3ba6e38d98.zip
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)
Diffstat (limited to 'src/ui/tools')
-rw-r--r--src/ui/tools/freehand-base.cpp22
-rw-r--r--src/ui/tools/freehand-base.h4
-rw-r--r--src/ui/tools/pen-tool.cpp28
3 files changed, 45 insertions, 9 deletions
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);