diff options
| author | Shlomi Fish <shlomif@shlomifish.org> | 2016-09-29 16:32:49 +0000 |
|---|---|---|
| committer | Shlomi Fish <shlomif@shlomifish.org> | 2016-09-29 16:32:49 +0000 |
| commit | f51ad5ea1ef1c96a93a64910cb263a360fc32d00 (patch) | |
| tree | 29626e107bf83f920304192ccacb3d538a4676e3 /src/gradient-drag.cpp | |
| parent | Remove "== true" and trailing whitespace. (diff) | |
| parent | fix tabs in src/main-cmdlineact (diff) | |
| download | inkscape-f51ad5ea1ef1c96a93a64910cb263a360fc32d00.tar.gz inkscape-f51ad5ea1ef1c96a93a64910cb263a360fc32d00.zip | |
Merged.
(bzr r15100.1.23)
Diffstat (limited to 'src/gradient-drag.cpp')
| -rw-r--r-- | src/gradient-drag.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index d50a67490..fc75054a0 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -40,7 +40,7 @@ #include "knot.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" -#include "sp-mesh.h" +#include "sp-mesh-gradient.h" #include "gradient-chemistry.h" #include "gradient-drag.h" #include "sp-stop.h" @@ -407,7 +407,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler //r1_knot = false; } } - } else if (SP_IS_MESH(gradient)) { + } else if (SP_IS_MESHGRADIENT(gradient)) { // add_stop_near_point() // Find out which curve pointer is over and use that curve to determine @@ -415,7 +415,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler // This is silly as we already should know which line we are over... // but that information is not saved (sp_gradient_context_is_over_line). - SPMesh *mg = SP_MESH(gradient); + SPMeshGradient *mg = SP_MESHGRADIENT(gradient); Geom::Affine transform = Geom::Affine(mg->gradientTransform)*(Geom::Affine)item->i2dt_affine(); guint rows = mg->array.patch_rows(); @@ -543,7 +543,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler } else { - SPMesh *mg = SP_MESH(gradient); + SPMeshGradient *mg = SP_MESHGRADIENT(gradient); if( divide_row > -1 ) { mg->array.split_row( divide_row, divide_coord ); @@ -552,7 +552,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler } // Update repr - sp_mesh_repr_write( mg ); + mg->array.write( mg ); mg->array.built = false; mg->ensureArray(); // How do we do this? @@ -901,7 +901,7 @@ static void gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui dragger->point = p; dragger->fireDraggables (false, scale_radial); dragger->updateDependencies(false); - dragger->updateHandles( p_old, MG_NODE_NO_SCALE ); + dragger->moveMeshHandles( p_old, MG_NODE_NO_SCALE ); } } @@ -1076,7 +1076,7 @@ static void gr_knot_ungrabbed_handler(SPKnot *knot, unsigned int state, gpointer } else { dragger->fireDraggables (true); } - dragger->updateHandles( dragger->point_original, MG_NODE_NO_SCALE ); + dragger->moveMeshHandles( dragger->point_original, MG_NODE_NO_SCALE ); for (std::set<GrDragger *>::const_iterator it = dragger->parent->selected.begin(); it != dragger->parent->selected.end() ; ++it ) { if (*it == dragger) @@ -1306,9 +1306,8 @@ bool GrDragger::mayMerge(GrDraggable *da2) * Ooops, needs to be reimplemented. */ void -GrDragger::updateHandles ( Geom::Point pc_old, MeshNodeOperation op ) +GrDragger::moveMeshHandles ( Geom::Point pc_old, MeshNodeOperation op ) { - // This routine might more properly be in mesh-context.cpp but moving knots is // handled here rather than there. @@ -1342,7 +1341,7 @@ GrDragger::updateHandles ( Geom::Point pc_old, MeshNodeOperation op ) // Must be a mesh gradient SPGradient *gradient = getGradient(draggable->item, draggable->fill_or_stroke); - if ( !SP_IS_MESH( gradient ) ) continue; + if ( !SP_IS_MESHGRADIENT( gradient ) ) continue; selected_corners[ gradient ].push_back( draggable->point_i ); } @@ -1368,8 +1367,8 @@ GrDragger::updateHandles ( Geom::Point pc_old, MeshNodeOperation op ) // Must be a mesh gradient SPGradient *gradient = getGradient(item, fill_or_stroke); - if ( !SP_IS_MESH( gradient ) ) continue; - SPMesh *mg = SP_MESH( gradient ); + if ( !SP_IS_MESHGRADIENT( gradient ) ) continue; + SPMeshGradient *mg = SP_MESHGRADIENT( gradient ); // pc_old is the old corner position in desktop coordinates, we need it in gradient coordinate. gradient = sp_gradient_convert_to_userspace (gradient, item, (fill_or_stroke == Inkscape::FOR_FILL) ? "fill" : "stroke"); @@ -1947,8 +1946,9 @@ void GrDrag::addDraggersLinear(SPLinearGradient *lg, SPItem *item, Inkscape::Pai /** *Add draggers for the mesh gradient mg on item */ -void GrDrag::addDraggersMesh(SPMesh *mg, SPItem *item, Inkscape::PaintTarget fill_or_stroke) +void GrDrag::addDraggersMesh(SPMeshGradient *mg, SPItem *item, Inkscape::PaintTarget fill_or_stroke) { + mg->ensureArray(); std::vector< std::vector< SPMeshNode* > > nodes = mg->array.nodes; // Show/hide mesh on fill/stroke. This doesn't work at the moment... and prevents node color updating. @@ -1966,7 +1966,7 @@ void GrDrag::addDraggersMesh(SPMesh *mg, SPItem *item, Inkscape::PaintTarget fil // Make sure we have at least one patch defined. if( mg->array.patch_rows() == 0 || mg->array.patch_columns() == 0 ) { - std::cout << "Empty Mesh, No Draggers to Add" << std::endl; + std::cerr << "Empty Mesh, No Draggers to Add" << std::endl; return; } @@ -2021,14 +2021,14 @@ void GrDrag::addDraggersMesh(SPMesh *mg, SPItem *item, Inkscape::PaintTarget fil } default: - std::cout << "Bad Mesh draggable type" << std::endl; + std::cerr << "Bad Mesh draggable type" << std::endl; break; } } } } - mg->array.drag_valid = true; + mg->array.draggers_valid = true; } /** @@ -2083,8 +2083,8 @@ void GrDrag::updateDraggers() addDraggersLinear( SP_LINEARGRADIENT(server), item, Inkscape::FOR_FILL ); } else if ( SP_IS_RADIALGRADIENT(server) ) { addDraggersRadial( SP_RADIALGRADIENT(server), item, Inkscape::FOR_FILL ); - } else if ( SP_IS_MESH(server) ) { - addDraggersMesh( SP_MESH(server), item, Inkscape::FOR_FILL ); + } else if ( SP_IS_MESHGRADIENT(server) ) { + addDraggersMesh( SP_MESHGRADIENT(server), item, Inkscape::FOR_FILL ); } } } @@ -2099,8 +2099,8 @@ void GrDrag::updateDraggers() addDraggersLinear( SP_LINEARGRADIENT(server), item, Inkscape::FOR_STROKE ); } else if ( SP_IS_RADIALGRADIENT(server) ) { addDraggersRadial( SP_RADIALGRADIENT(server), item, Inkscape::FOR_STROKE ); - } else if ( SP_IS_MESH(server) ) { - addDraggersMesh( SP_MESH(server), item, Inkscape::FOR_STROKE ); + } else if ( SP_IS_MESHGRADIENT(server) ) { + addDraggersMesh( SP_MESHGRADIENT(server), item, Inkscape::FOR_STROKE ); } } } @@ -2154,9 +2154,9 @@ void GrDrag::updateLines() Geom::Point center = getGradientCoords(item, POINT_RG_CENTER, 0, Inkscape::FOR_FILL); addLine(item, center, getGradientCoords(item, POINT_RG_R1, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL); addLine(item, center, getGradientCoords(item, POINT_RG_R2, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL); - } else if ( SP_IS_MESH(server) ) { + } else if ( SP_IS_MESHGRADIENT(server) ) { - SPMesh *mg = SP_MESH(server); + SPMeshGradient *mg = SP_MESHGRADIENT(server); guint rows = mg->array.patch_rows(); guint columns = mg->array.patch_columns(); @@ -2216,10 +2216,10 @@ void GrDrag::updateLines() Geom::Point center = getGradientCoords(item, POINT_RG_CENTER, 0, Inkscape::FOR_STROKE); addLine(item, center, getGradientCoords(item, POINT_RG_R1, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE); addLine(item, center, getGradientCoords(item, POINT_RG_R2, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE); - } else if ( SP_IS_MESH(server) ) { + } else if ( SP_IS_MESHGRADIENT(server) ) { // MESH FIXME: TURN ROUTINE INTO FUNCTION AND CALL FOR BOTH FILL AND STROKE. - SPMesh *mg = SP_MESH(server); + SPMeshGradient *mg = SP_MESHGRADIENT(server); guint rows = mg->array.patch_rows(); guint columns = mg->array.patch_columns(); @@ -2351,7 +2351,7 @@ void GrDrag::selected_move(double x, double y, bool write_repr, bool scale_radia d->knot->moveto(d->point); d->fireDraggables (write_repr, scale_radial); - d->updateHandles( p_old, MG_NODE_NO_SCALE ); + d->moveMeshHandles( p_old, MG_NODE_NO_SCALE ); d->updateDependencies(write_repr); } } |
