diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2012-01-17 22:30:48 +0000 |
|---|---|---|
| committer | Johan Engelen <goejendaagh@zonnet.nl> | 2012-01-17 22:30:48 +0000 |
| commit | d97dcb5d03fa3e063c597788fa7f2c766ae5916e (patch) | |
| tree | 471f294f631eca82850a50a6f281b71cc26f195b | |
| parent | documentation (diff) | |
| download | inkscape-d97dcb5d03fa3e063c597788fa7f2c766ae5916e.tar.gz inkscape-d97dcb5d03fa3e063c597788fa7f2c766ae5916e.zip | |
add underscores to some member variables.
add some const stuff
(bzr r10900)
| -rw-r--r-- | src/box3d-side.cpp | 2 | ||||
| -rw-r--r-- | src/connector-context.cpp | 2 | ||||
| -rw-r--r-- | src/display/nr-svgfonts.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/cairo-renderer.cpp | 16 | ||||
| -rw-r--r-- | src/extension/internal/javafx-out.cpp | 7 | ||||
| -rw-r--r-- | src/extension/internal/pov-out.cpp | 6 | ||||
| -rw-r--r-- | src/live_effects/lpe-copy_rotate.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-offset.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-parallel.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-powerstroke.cpp | 2 | ||||
| -rw-r--r-- | src/path-chemistry.cpp | 2 | ||||
| -rw-r--r-- | src/sp-conn-end.cpp | 6 | ||||
| -rw-r--r-- | src/sp-ellipse.cpp | 4 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 23 | ||||
| -rw-r--r-- | src/sp-lpe-item.h | 7 | ||||
| -rw-r--r-- | src/sp-offset.cpp | 2 | ||||
| -rw-r--r-- | src/sp-path.cpp | 69 | ||||
| -rw-r--r-- | src/sp-polygon.cpp | 2 | ||||
| -rw-r--r-- | src/sp-shape.cpp | 226 | ||||
| -rw-r--r-- | src/sp-shape.h | 31 | ||||
| -rw-r--r-- | src/sp-spiral.cpp | 10 | ||||
| -rw-r--r-- | src/sp-star.cpp | 6 | ||||
| -rw-r--r-- | src/splivarot.cpp | 12 | ||||
| -rw-r--r-- | src/ui/clipboard.cpp | 4 |
24 files changed, 225 insertions, 224 deletions
diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index e67867d08..031b16a7c 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -111,7 +111,7 @@ box3d_side_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: static_cast<SPShape *>(object)->setShape(); /* Duplicate the path */ - SPCurve const *curve = ((SPShape *) object)->curve; + SPCurve const *curve = ((SPShape *) object)->_curve; //Nulls might be possible if this called iteratively if ( !curve ) { return NULL; diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 395cf04ea..34210bbcd 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -1897,7 +1897,7 @@ void cc_remove_connection_point(SPConnectorContext* cc) static bool cc_item_is_shape(SPItem *item) { if (SP_IS_PATH(item)) { - SPCurve *curve = (SP_SHAPE(item))->curve; + const SPCurve * curve = (SP_SHAPE(item))->_curve; if ( curve && !(curve->is_closed()) ) { // Open paths are connectors. return false; diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp index 8869274d4..1ba158635 100644 --- a/src/display/nr-svgfonts.cpp +++ b/src/display/nr-svgfonts.cpp @@ -310,7 +310,7 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, //render the SVG described on this glyph's child nodes. for(node = node->children; node; node=node->next){ if (SP_IS_PATH(node)){ - pathv = ((SPShape*)node)->curve->get_pathvector(); + pathv = ((SPShape*)node)->_curve->get_pathvector(); pathv = flip_coordinate_system(spfont, pathv); this->render_glyph_path(cr, &pathv); } @@ -320,7 +320,7 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, if (SP_IS_USE(node)){ SPItem* item = SP_USE(node)->ref->getObject(); if (SP_IS_PATH(item)){ - pathv = ((SPShape*)item)->curve->get_pathvector(); + pathv = ((SPShape*)item)->_curve->get_pathvector(); pathv = flip_coordinate_system(spfont, pathv); this->render_glyph_path(cr, &pathv); } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 42c60f52c..3926cce29 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -181,7 +181,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) { SPShape *shape = SP_SHAPE(item); - if (!shape->curve) { + if (!shape->_curve) { return; } @@ -189,7 +189,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) SPStyle* style = item->style; - Geom::PathVector const & pathv = shape->curve->get_pathvector(); + Geom::PathVector const & pathv = shape->_curve->get_pathvector(); if (pathv.empty()) { return; } @@ -198,8 +198,8 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) // START marker for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( shape->marker[i] ) { - SPMarker* marker = SP_MARKER (shape->marker[i]); + if ( shape->_marker[i] ) { + SPMarker* marker = SP_MARKER (shape->_marker[i]); Geom::Affine tr; if (marker->orient_auto) { tr = sp_shape_marker_get_transform_at_start(pathv.begin()->front()); @@ -211,8 +211,8 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) } // MID marker for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - if ( !shape->marker[i] ) continue; - SPMarker* marker = SP_MARKER (shape->marker[i]); + if ( !shape->_marker[i] ) continue; + SPMarker* marker = SP_MARKER (shape->_marker[i]); for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { // START position if ( path_it != pathv.begin() @@ -263,8 +263,8 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) } // END marker for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if ( shape->marker[i] ) { - SPMarker* marker = SP_MARKER (shape->marker[i]); + if ( shape->_marker[i] ) { + SPMarker* marker = SP_MARKER (shape->_marker[i]); /* Get reference to last curve in the path. * For moveto-only path, this returns the "closing line segment". */ diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 7646946fd..f44640bf1 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -472,8 +472,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) } SPShape *shape = SP_SHAPE(item); - SPCurve *curve = shape->curve; - if (curve->is_empty()) { + if (shape->_curve->is_empty()) { return true; } @@ -494,7 +493,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) // convert the path to only lineto's and cubic curveto's: Geom::Scale yflip(1.0, -1.0); /// @fixme hardcoded desktop transform! Geom::Affine tf = item->i2dt_affine() * yflip; - Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); + Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( shape->_curve->get_pathvector() * tf ); //Count the NR_CURVETOs/LINETOs (including closing line segment) guint segmentCount = 0; @@ -789,7 +788,7 @@ bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj) //### Get the Shape if (SP_IS_SHAPE(item)) {//Bulia's suggestion. Allow all shapes SPShape *shape = SP_SHAPE(item); - SPCurve *curve = shape->curve; + SPCurve *curve = shape->_curve; if (!curve->is_empty()) { String jfxid = sanatize(id); out(" %s(),\n", jfxid.c_str()); diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index bb00de619..f501b97f1 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -264,9 +264,9 @@ bool PovOutput::doCurve(SPItem *item, const String &id) return true; SPShape *shape = SP_SHAPE(item); - SPCurve *curve = shape->curve; - if (curve->is_empty()) + if (shape->_curve->is_empty()) { return true; + } nrShapes++; @@ -302,7 +302,7 @@ bool PovOutput::doCurve(SPItem *item, const String &id) // convert the path to only lineto's and cubic curveto's: Geom::Affine tf = item->i2dt_affine(); - Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); + Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( shape->_curve->get_pathvector() * tf ); /* * We need to know the number of segments (NR_CURVETOs/LINETOs, including diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 38869cb97..e77d80994 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -74,7 +74,7 @@ LPECopyRotate::~LPECopyRotate() void LPECopyRotate::doOnApply(SPLPEItem *lpeitem) { - SPCurve *curve = SP_SHAPE(lpeitem)->curve; + SPCurve *curve = SP_SHAPE(lpeitem)->_curve; A = *(curve->first_point()); B = *(curve->last_point()); diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp index 9ee53267c..26e86335b 100644 --- a/src/live_effects/lpe-offset.cpp +++ b/src/live_effects/lpe-offset.cpp @@ -41,7 +41,7 @@ LPEOffset::~LPEOffset() void LPEOffset::doOnApply(SPLPEItem *lpeitem) { - offset_pt.param_set_and_write_new_value(*(SP_SHAPE(lpeitem)->curve->first_point())); + offset_pt.param_set_and_write_new_value(*(SP_SHAPE(lpeitem)->_curve->first_point())); } static void append_half_circle(Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2, diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp index 6b4a55504..5b373442b 100644 --- a/src/live_effects/lpe-parallel.cpp +++ b/src/live_effects/lpe-parallel.cpp @@ -65,7 +65,7 @@ LPEParallel::~LPEParallel() void LPEParallel::doOnApply (SPLPEItem *lpeitem) { - SPCurve *curve = SP_SHAPE(lpeitem)->curve; + SPCurve const *curve = SP_SHAPE(lpeitem)->_curve; A = *(curve->first_point()); B = *(curve->last_point()); diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 76ca60521..331b534dc 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -99,7 +99,7 @@ void LPEPowerStroke::doOnApply(SPLPEItem *lpeitem) { std::vector<Geom::Point> points; - Geom::PathVector pathv = SP_SHAPE(lpeitem)->curve->get_pathvector(); + Geom::PathVector pathv = SP_SHAPE(lpeitem)->_curve->get_pathvector(); Geom::Path::size_type size = pathv.empty() ? 1 : pathv.front().size_open(); points.push_back( Geom::Point(0,0) ); points.push_back( Geom::Point(0.5*size,0) ); diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 3714f3531..5f089476e 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -379,7 +379,7 @@ sp_item_list_to_curves(const GSList *items, GSList **selected, GSList **to_selec continue; } - if (SP_IS_PATH(item) && !SP_SHAPE(item)->curve_before_lpe) { + if (SP_IS_PATH(item) && !SP_SHAPE(item)->_curve_before_lpe) { continue; // already a path, and no path effect } diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp index 71b4f45a7..8f8b64386 100644 --- a/src/sp-conn-end.cpp +++ b/src/sp-conn-end.cpp @@ -99,7 +99,7 @@ static bool try_get_intersect_point_with_item(SPPath* conn, SPItem* item, const bool at_start, double& intersect_pos) { // Copy the curve and apply transformations up to common ancestor. - SPCurve* conn_curve = conn->curve->copy(); + SPCurve* conn_curve = conn->_curve->copy(); conn_curve->transform(conn_transform); Geom::PathVector conn_pv = conn_curve->get_pathvector(); @@ -149,7 +149,7 @@ sp_conn_get_route_and_redraw(SPPath *const path, // Set sensible values incase there the connector ends are not // attached to any shapes. - Geom::PathVector conn_pv = path->curve->get_pathvector(); + Geom::PathVector conn_pv = path->_curve->get_pathvector(); double endPos[2] = { 0, conn_pv[0].size() }; SPConnEnd** _connEnd = path->connEndPair.getConnEnds(); @@ -160,7 +160,7 @@ sp_conn_get_route_and_redraw(SPPath *const path, (h == 0), endPos[h]); } } - change_endpts(path->curve, endPos); + change_endpts(path->_curve, endPos); if (updatePathRepr) { path->updateRepr(); path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index ba100a1d7..d74eaa6fb 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -166,8 +166,8 @@ sp_genericellipse_update_patheffect(SPLPEItem *lpeitem, bool write) if (write) { Inkscape::XML::Node *repr = shape->getRepr(); - if ( shape->curve != NULL ) { - gchar *str = sp_svg_write_path(shape->curve->get_pathvector()); + if ( shape->_curve != NULL ) { + gchar *str = sp_svg_write_path(shape->_curve->get_pathvector()); repr->setAttribute("d", str); g_free(str); } else { diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index d0c548a6a..33b7dd4aa 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -594,14 +594,14 @@ void sp_lpe_item_up_current_path_effect(SPLPEItem *lpeitem) } /** used for shapes so they can see if they should also disable shape calculation and read from d= */ -bool sp_lpe_item_has_broken_path_effect(SPLPEItem *lpeitem) +bool sp_lpe_item_has_broken_path_effect(SPLPEItem const *lpeitem) { if (lpeitem->path_effect_list->empty()) return false; // go through the list; if some are unknown or invalid, return true - PathEffectList effect_list = sp_lpe_item_get_effect_list(lpeitem); - for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it) + PathEffectList const effect_list = sp_lpe_item_get_effect_list(lpeitem); + for (PathEffectList::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it) { LivePathEffectObject *lpeobj = (*it)->lpeobject; if (!lpeobj || !lpeobj->get_lpe()) @@ -612,14 +612,14 @@ bool sp_lpe_item_has_broken_path_effect(SPLPEItem *lpeitem) } -bool sp_lpe_item_has_path_effect(SPLPEItem *lpeitem) +bool sp_lpe_item_has_path_effect(SPLPEItem const *lpeitem) { if (lpeitem->path_effect_list->empty()) return false; // go through the list; if some are unknown or invalid, we are not an LPE item! - PathEffectList effect_list = sp_lpe_item_get_effect_list(lpeitem); - for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it) + PathEffectList const effect_list = sp_lpe_item_get_effect_list(lpeitem); + for (PathEffectList::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it) { LivePathEffectObject *lpeobj = (*it)->lpeobject; if (!lpeobj || !lpeobj->get_lpe()) @@ -629,9 +629,9 @@ bool sp_lpe_item_has_path_effect(SPLPEItem *lpeitem) return true; } -bool sp_lpe_item_has_path_effect_recursive(SPLPEItem *lpeitem) +bool sp_lpe_item_has_path_effect_recursive(SPLPEItem const *lpeitem) { - SPObject *parent = lpeitem->parent; + SPObject const *parent = lpeitem->parent; if (parent && SP_IS_LPE_ITEM(parent)) { return sp_lpe_item_has_path_effect(lpeitem) || sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(parent)); } @@ -737,7 +737,12 @@ static std::string hreflist_write_svg(HRefList const & list) // Return a copy of the effect list PathEffectList sp_lpe_item_get_effect_list(SPLPEItem *lpeitem) { - return *lpeitem->path_effect_list; + return *(lpeitem->path_effect_list); +} +// Return a copy of the effect list +PathEffectList const sp_lpe_item_get_effect_list(SPLPEItem const *lpeitem) +{ + return *(lpeitem->path_effect_list); } Inkscape::LivePathEffect::LPEObjectReference* sp_lpe_item_get_current_lpereference(SPLPEItem *lpeitem) diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h index d1baa4309..8f99ae1b0 100644 --- a/src/sp-lpe-item.h +++ b/src/sp-lpe-item.h @@ -70,13 +70,14 @@ void sp_lpe_item_remove_all_path_effects(SPLPEItem *lpeitem, bool keep_paths); void sp_lpe_item_remove_current_path_effect(SPLPEItem *lpeitem, bool keep_paths); void sp_lpe_item_down_current_path_effect(SPLPEItem *lpeitem); void sp_lpe_item_up_current_path_effect(SPLPEItem *lpeitem); -bool sp_lpe_item_has_path_effect(SPLPEItem *lpeitem); -bool sp_lpe_item_has_broken_path_effect(SPLPEItem *lpeitem); -bool sp_lpe_item_has_path_effect_recursive(SPLPEItem *lpeitem); +bool sp_lpe_item_has_path_effect(SPLPEItem const *lpeitem); +bool sp_lpe_item_has_broken_path_effect(SPLPEItem const *lpeitem); +bool sp_lpe_item_has_path_effect_recursive(SPLPEItem const *lpeitem); Inkscape::LivePathEffect::Effect* sp_lpe_item_has_path_effect_of_type(SPLPEItem *lpeitem, int type); bool sp_lpe_item_can_accept_freehand_shape(SPLPEItem *lpeitem); void sp_lpe_item_edit_next_param_oncanvas(SPLPEItem *lpeitem, SPDesktop *dt); PathEffectList sp_lpe_item_get_effect_list(SPLPEItem *lpeitem); +PathEffectList const sp_lpe_item_get_effect_list(SPLPEItem const *lpeitem); Inkscape::LivePathEffect::LPEObjectReference* sp_lpe_item_get_current_lpereference(SPLPEItem *lpeitem); Inkscape::LivePathEffect::Effect* sp_lpe_item_get_current_lpe(SPLPEItem *lpeitem); bool sp_lpe_item_set_current_path_effect(SPLPEItem *lpeitem, Inkscape::LivePathEffect::LPEObjectReference* lperef); diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index 8617c096a..817db92e8 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -286,7 +286,7 @@ sp_offset_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM } // write that curve to "d" - char *d = sp_svg_write_path (((SPShape *) offset)->curve->get_pathvector()); + char *d = sp_svg_write_path (offset->_curve->get_pathvector()); repr->setAttribute("d", d); g_free (d); diff --git a/src/sp-path.cpp b/src/sp-path.cpp index 3760ccd78..d5969e339 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -126,7 +126,7 @@ sp_path_class_init(SPPathClass * klass) gint SPPath::nodesInPath() const { - return curve ? curve->nodes_in_path() : 0; + return _curve ? _curve->nodes_in_path() : 0; } static gchar * @@ -162,14 +162,15 @@ sp_path_convert_to_guides(SPItem *item) { SPPath *path = SP_PATH(item); - SPCurve *curve = SP_SHAPE(path)->curve; - if (!curve) return; + if (!path->_curve) { + return; + } std::list<std::pair<Geom::Point, Geom::Point> > pts; Geom::Affine const i2dt(path->i2dt_affine()); - Geom::PathVector const & pv = curve->get_pathvector(); + Geom::PathVector const & pv = path->_curve->get_pathvector(); for(Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { for(Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_default(); ++cit) { // only add curves for straight line segments @@ -316,8 +317,8 @@ sp_path_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML: #ifdef PATH_VERBOSE g_message("sp_path_write writes 'd' attribute"); #endif - if ( shape->curve != NULL ) { - gchar *str = sp_svg_write_path(shape->curve->get_pathvector()); + if ( shape->_curve != NULL ) { + gchar *str = sp_svg_write_path(shape->_curve->get_pathvector()); repr->setAttribute("d", str); g_free(str); } else { @@ -325,8 +326,8 @@ g_message("sp_path_write writes 'd' attribute"); } if (flags & SP_OBJECT_WRITE_EXT) { - if ( shape->curve_before_lpe != NULL ) { - gchar *str = sp_svg_write_path(shape->curve_before_lpe->get_pathvector()); + if ( shape->_curve_before_lpe != NULL ) { + gchar *str = sp_svg_write_path(shape->_curve_before_lpe->get_pathvector()); repr->setAttribute("inkscape:original-d", str); g_free(str); } else { @@ -370,15 +371,15 @@ sp_path_set_transform(SPItem *item, Geom::Affine const &xform) } SPPath *path = SP_PATH(item); - if (!path->curve) { // 0 nodes, nothing to transform + if (!path->_curve) { // 0 nodes, nothing to transform return Geom::identity(); } // Transform the original-d path if this is a valid LPE item, other else the (ordinary) path - if (path->curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(item))) { - path->curve_before_lpe->transform(xform); + if (path->_curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(item))) { + path->_curve_before_lpe->transform(xform); } else { - path->curve->transform(xform); + path->_curve->transform(xform); } // Adjust stroke @@ -410,9 +411,9 @@ sp_path_update_patheffect(SPLPEItem *lpeitem, bool write) g_message("sp_path_update_patheffect"); #endif - if (shape->curve_before_lpe && sp_lpe_item_has_path_effect_recursive(lpeitem)) { - SPCurve *curve = shape->curve_before_lpe->copy(); - /* if a path has an lpeitem applied, then reset the curve to the curve_before_lpe. + if (shape->_curve_before_lpe && sp_lpe_item_has_path_effect_recursive(lpeitem)) { + SPCurve *curve = shape->_curve_before_lpe->copy(); + /* if a path has an lpeitem applied, then reset the curve to the _curve_before_lpe. * This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/ shape->setCurveInsync(curve, TRUE); @@ -422,8 +423,8 @@ g_message("sp_path_update_patheffect"); #ifdef PATH_VERBOSE g_message("sp_path_update_patheffect writes 'd' attribute"); #endif - if ( shape->curve != NULL ) { - gchar *str = sp_svg_write_path(shape->curve->get_pathvector()); + if ( shape->_curve != NULL ) { + gchar *str = sp_svg_write_path(shape->_curve->get_pathvector()); repr->setAttribute("d", str); g_free(str); } else { @@ -456,14 +457,14 @@ g_message("sp_path_update_patheffect writes 'd' attribute"); */ void SPPath::set_original_curve (SPCurve *new_curve, unsigned int owner, bool write) { - if (curve_before_lpe) { - curve_before_lpe = curve_before_lpe->unref(); + if (_curve_before_lpe) { + _curve_before_lpe = _curve_before_lpe->unref(); } if (new_curve) { if (owner) { - curve_before_lpe = new_curve->ref(); + _curve_before_lpe = new_curve->ref(); } else { - curve_before_lpe = new_curve->copy(); + _curve_before_lpe = new_curve->copy(); } } sp_lpe_item_update_patheffect(this, true, write); @@ -471,18 +472,18 @@ void SPPath::set_original_curve (SPCurve *new_curve, unsigned int owner, bool wr } /** - * Return duplicate of curve_before_lpe (if any exists) or NULL if there is no curve + * Return duplicate of _curve_before_lpe (if any exists) or NULL if there is no curve */ SPCurve * SPPath::get_original_curve () const { - if (curve_before_lpe) { - return curve_before_lpe->copy(); + if (_curve_before_lpe) { + return _curve_before_lpe->copy(); } return NULL; } /** - * Return duplicate of edittable curve which is curve_before_lpe if it exists or + * Return duplicate of edittable curve which is _curve_before_lpe if it exists or * shape->curve if not. */ SPCurve* SPPath::get_curve_for_edit () const @@ -490,7 +491,7 @@ SPCurve* SPPath::get_curve_for_edit () const if (!SP_IS_PATH(this)) { return NULL; } - if (curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(this))) { + if (_curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(this))) { return get_original_curve(); } else { return getCurve(); @@ -498,7 +499,7 @@ SPCurve* SPPath::get_curve_for_edit () const } /** - * Returns \c curve_before_lpe if it is not NULL and a valid LPE is applied or + * Returns \c _curve_before_lpe if it is not NULL and a valid LPE is applied or * \c curve if not. */ const SPCurve* SPPath::get_curve_reference () const @@ -506,15 +507,15 @@ const SPCurve* SPPath::get_curve_reference () const if (!SP_IS_PATH(this)) { return NULL; } - if (curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(this))) { - return curve_before_lpe; + if (_curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(this))) { + return _curve_before_lpe; } else { - return curve; + return _curve; } } /** - * Returns \c curve_before_lpe if it is not NULL and a valid LPE is applied or \c curve if not. + * Returns \c _curve_before_lpe if it is not NULL and a valid LPE is applied or \c curve if not. * \todo should only be available to class friends! */ SPCurve* SPPath::get_curve () @@ -522,10 +523,10 @@ SPCurve* SPPath::get_curve () if (!SP_IS_PATH(this)) { return NULL; } - if (curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(this))) { - return curve_before_lpe; + if (_curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(this))) { + return _curve_before_lpe; } else { - return curve; + return _curve; } } diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp index 1067da72e..eee8d50bc 100644 --- a/src/sp-polygon.cpp +++ b/src/sp-polygon.cpp @@ -122,7 +122,7 @@ static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Do } /* We can safely write points here, because all subclasses require it too (Lauris) */ - gchar *str = sp_svg_write_polygon(shape->curve->get_pathvector()); + gchar *str = sp_svg_write_polygon(shape->_curve->get_pathvector()); repr->setAttribute("points", str); g_free(str); diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index b946e52ce..efd0ed20d 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -117,12 +117,12 @@ void SPShapeClass::sp_shape_class_init(SPShapeClass *klass) void SPShape::sp_shape_init(SPShape *shape) { for ( int i = 0 ; i < SP_MARKER_LOC_QTY ; i++ ) { - new (&shape->release_connect[i]) sigc::connection(); - new (&shape->modified_connect[i]) sigc::connection(); - shape->marker[i] = NULL; + new (&shape->_release_connect[i]) sigc::connection(); + new (&shape->_modified_connect[i]) sigc::connection(); + shape->_marker[i] = NULL; } - shape->curve = NULL; - shape->curve_before_lpe = NULL; + shape->_curve = NULL; + shape->_curve_before_lpe = NULL; } void SPShape::sp_shape_finalize(GObject *object) @@ -130,10 +130,10 @@ void SPShape::sp_shape_finalize(GObject *object) SPShape *shape=(SPShape *)object; for ( int i = 0 ; i < SP_MARKER_LOC_QTY ; i++ ) { - shape->release_connect[i].disconnect(); - shape->release_connect[i].~connection(); - shape->modified_connect[i].disconnect(); - shape->modified_connect[i].~connection(); + shape->_release_connect[i].disconnect(); + shape->_release_connect[i].~connection(); + shape->_modified_connect[i].disconnect(); + shape->_modified_connect[i].~connection(); } if (((GObjectClass *) (SPShapeClass::parent_class))->finalize) { @@ -180,20 +180,20 @@ void SPShape::sp_shape_release(SPObject *object) shape = (SPShape *) object; for (i = 0; i < SP_MARKER_LOC_QTY; i++) { - if (shape->marker[i]) { + if (shape->_marker[i]) { for (v = item->display; v != NULL; v = v->next) { - sp_marker_hide ((SPMarker *) shape->marker[i], v->arenaitem->key() + i); + sp_marker_hide ((SPMarker *) shape->_marker[i], v->arenaitem->key() + i); } - shape->release_connect[i].disconnect(); - shape->modified_connect[i].disconnect(); - shape->marker[i] = sp_object_hunref (shape->marker[i], object); + shape->_release_connect[i].disconnect(); + shape->_modified_connect[i].disconnect(); + shape->_marker[i] = sp_object_hunref (shape->_marker[i], object); } } - if (shape->curve) { - shape->curve = shape->curve->unref(); + if (shape->_curve) { + shape->_curve = shape->_curve->unref(); } - if (shape->curve_before_lpe) { - shape->curve_before_lpe = shape->curve_before_lpe->unref(); + if (shape->_curve_before_lpe) { + shape->_curve_before_lpe = shape->_curve_before_lpe->unref(); } if (((SPObjectClass *) SPShapeClass::parent_class)->release) { @@ -259,7 +259,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) for (SPItemView *v = shape->display; v != NULL; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); if (flags & SP_OBJECT_MODIFIED_FLAG) { - sh->setPath(shape->curve); + sh->setPath(shape->_curve); } } } @@ -271,8 +271,8 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) v->arenaitem->setKey(SPItem::display_key_new (SP_MARKER_LOC_QTY)); } for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) { - if (shape->marker[i]) { - sp_marker_show_dimension ((SPMarker *) shape->marker[i], + if (shape->_marker[i]) { + sp_marker_show_dimension ((SPMarker *) shape->_marker[i], v->arenaitem->key() + i, shape->numberOfMarkers (i)); } @@ -379,8 +379,8 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem // position arguments to sp_marker_show_instance, basically counts the amount of markers. int counter[4] = {0}; - if (!shape->curve) return; - Geom::PathVector const & pathv = shape->curve->get_pathvector(); + if (!shape->_curve) return; + Geom::PathVector const & pathv = shape->_curve->get_pathvector(); if (pathv.empty()) return; // the first vertex should get a start marker, the last an end marker, and all the others a mid marker @@ -390,8 +390,8 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem { Geom::Affine const m (sp_shape_marker_get_transform_at_start(pathv.begin()->front())); for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( shape->marker[i] ) { - sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, + if ( shape->_marker[i] ) { + sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, style->stroke_width.computed); counter[i]++; @@ -400,7 +400,7 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem } // MID marker - if (shape->marker[SP_MARKER_LOC_MID] || shape->marker[SP_MARKER_LOC]) { + if (shape->_marker[SP_MARKER_LOC_MID] || shape->_marker[SP_MARKER_LOC]) { for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { // START position if ( path_it != pathv.begin() @@ -408,8 +408,8 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem { Geom::Affine const m (sp_shape_marker_get_transform_at_start(path_it->front())); for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - if ( shape->marker[i] ) { - sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, + if ( shape->_marker[i] ) { + sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, style->stroke_width.computed); counter[i]++; @@ -428,8 +428,8 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem */ Geom::Affine const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - if (shape->marker[i]) { - sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, + if (shape->_marker[i]) { + sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, style->stroke_width.computed); counter[i]++; @@ -445,8 +445,8 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem Geom::Curve const &lastcurve = path_it->back_default(); Geom::Affine const m = sp_shape_marker_get_transform_at_end(lastcurve); for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - if (shape->marker[i]) { - sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, + if (shape->_marker[i]) { + sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, style->stroke_width.computed); counter[i]++; @@ -457,7 +457,7 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem } // END marker - if ( shape->marker[SP_MARKER_LOC_END] || shape->marker[SP_MARKER_LOC] ) { + if ( shape->_marker[SP_MARKER_LOC_END] || shape->_marker[SP_MARKER_LOC] ) { /* Get reference to last curve in the path. * For moveto-only path, this returns the "closing line segment". */ Geom::Path const &path_last = pathv.back(); @@ -469,8 +469,8 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem Geom::Affine const m = sp_shape_marker_get_transform_at_end(lastcurve); for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if (shape->marker[i]) { - sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, + if (shape->_marker[i]) { + sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, style->stroke_width.computed); counter[i]++; @@ -507,8 +507,8 @@ Geom::OptRect SPShape::sp_shape_bbox(SPItem const *item, Geom::Affine const &tra SPShape const *shape = SP_SHAPE (item); Geom::OptRect bbox; - if (!shape->curve) return bbox; - bbox = bounds_exact_transformed(shape->curve->get_pathvector(), transform); + if (!shape->_curve) return bbox; + bbox = bounds_exact_transformed(shape->_curve->get_pathvector(), transform); if (!bbox) return bbox; if (bboxtype == SPItem::VISUAL_BBOX) { @@ -522,13 +522,13 @@ Geom::OptRect SPShape::sp_shape_bbox(SPItem const *item, Geom::Affine const &tra } } // Union with bboxes of the markers, if any - if ( shape->hasMarkers() && !shape->curve->get_pathvector().empty() ) { + if ( shape->hasMarkers() && !shape->_curve->get_pathvector().empty() ) { /** \todo make code prettier! */ - Geom::PathVector const & pathv = shape->curve->get_pathvector(); + Geom::PathVector const & pathv = shape->_curve->get_pathvector(); // START marker for (unsigned i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( shape->marker[i] ) { - SPMarker* marker = SP_MARKER (shape->marker[i]); + if ( shape->_marker[i] ) { + SPMarker* marker = SP_MARKER (shape->_marker[i]); SPItem* marker_item = sp_item_first_item_child( marker ); if (marker_item) { @@ -551,8 +551,8 @@ Geom::OptRect SPShape::sp_shape_bbox(SPItem const *item, Geom::Affine const &tra } // MID marker for (unsigned i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - SPMarker* marker = SP_MARKER (shape->marker[i]); - if ( !shape->marker[i] ) continue; + if ( !shape->_marker[i] ) continue; + SPMarker* marker = SP_MARKER (shape->_marker[i]); SPItem* marker_item = sp_item_first_item_child( marker ); if ( !marker_item ) continue; @@ -582,7 +582,7 @@ Geom::OptRect SPShape::sp_shape_bbox(SPItem const *item, Geom::Affine const &tra * Loop to end_default (so including closing segment), because when a path is closed, * there should be a midpoint marker between last segment and closing straight line segment */ - SPMarker* marker = SP_MARKER (shape->marker[i]); + SPMarker* marker = SP_MARKER (shape->_marker[i]); SPItem* marker_item = sp_item_first_item_child( marker ); if (marker_item) { @@ -620,8 +620,8 @@ Geom::OptRect SPShape::sp_shape_bbox(SPItem const *item, Geom::Affine const &tra } // END marker for (unsigned i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if ( shape->marker[i] ) { - SPMarker* marker = SP_MARKER (shape->marker[i]); + if ( shape->_marker[i] ) { + SPMarker* marker = SP_MARKER (shape->_marker[i]); SPItem* marker_item = sp_item_first_item_child( marker ); if (marker_item) { @@ -687,9 +687,9 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) SPShape *shape = SP_SHAPE(item); - if (!shape->curve) return; + if (!shape->_curve) return; - Geom::PathVector const & pathv = shape->curve->get_pathvector(); + Geom::PathVector const & pathv = shape->_curve->get_pathvector(); if (pathv.empty()) return; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -720,21 +720,21 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) /** \todo make code prettier */ // START marker for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( shape->marker[i] ) { + if ( shape->_marker[i] ) { Geom::Affine tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); - sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); + sp_shape_print_invoke_marker_printing(shape->_marker[i], tr, style, ctx); } } // MID marker for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - if (shape->marker[i]) { + if (shape->_marker[i]) { for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { // START position if ( path_it != pathv.begin() && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there { Geom::Affine tr(sp_shape_marker_get_transform_at_start(path_it->front())); - sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); + sp_shape_print_invoke_marker_printing(shape->_marker[i], tr, style, ctx); } // MID position if ( path_it->size_default() > 1) { @@ -747,7 +747,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) * there should be a midpoint marker between last segment and closing straight line segment */ Geom::Affine tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); - sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); + sp_shape_print_invoke_marker_printing(shape->_marker[i], tr, style, ctx); ++curve_it1; ++curve_it2; @@ -756,13 +756,13 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) if ( path_it != (pathv.end()-1) && !path_it->empty()) { Geom::Curve const &lastcurve = path_it->back_default(); Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve); - sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); + sp_shape_print_invoke_marker_printing(shape->_marker[i], tr, style, ctx); } } } } // END marker - if ( shape->marker[SP_MARKER_LOC_END] || shape->marker[SP_MARKER_LOC]) { + if ( shape->_marker[SP_MARKER_LOC_END] || shape->_marker[SP_MARKER_LOC]) { /* Get reference to last curve in the path. * For moveto-only path, this returns the "closing line segment". */ Geom::Path const &path_last = pathv.back(); @@ -775,8 +775,8 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve); for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if (shape->marker[i]) { - sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); + if (shape->_marker[i]) { + sp_shape_print_invoke_marker_printing(shape->_marker[i], tr, style, ctx); } } } @@ -799,7 +799,7 @@ Inkscape::DrawingItem * SPShape::sp_shape_show(SPItem *item, Inkscape::Drawing & Inkscape::DrawingShape *s = new Inkscape::DrawingShape(drawing); s->setStyle(object->style); - s->setPath(shape->curve); + s->setPath(shape->_curve); /* This stanza checks that an object's marker style agrees with * the marker objects it has allocated. sp_shape_set_marker ensures @@ -818,8 +818,8 @@ Inkscape::DrawingItem * SPShape::sp_shape_show(SPItem *item, Inkscape::Drawing & } for (int i = 0; i < SP_MARKER_LOC_QTY; i++) { - if (shape->marker[i]) { - sp_marker_show_dimension ((SPMarker *) shape->marker[i], + if (shape->_marker[i]) { + sp_marker_show_dimension ((SPMarker *) shape->_marker[i], s->key() + i, shape->numberOfMarkers (i)); } @@ -844,10 +844,10 @@ void SPShape::sp_shape_hide(SPItem *item, unsigned int key) shape = (SPShape *) item; for (i=0; i<SP_MARKER_LOC_QTY; i++) { - if (shape->marker[i]) { + if (shape->_marker[i]) { for (v = item->display; v != NULL; v = v->next) { if (key == v->key) { - sp_marker_hide ((SPMarker *) shape->marker[i], + sp_marker_hide ((SPMarker *) shape->_marker[i], v->arenaitem->key() + i); } } @@ -870,11 +870,11 @@ int SPShape::hasMarkers() const specified, then all three should appear. */ return ( - this->curve && - (this->marker[SP_MARKER_LOC] || - this->marker[SP_MARKER_LOC_START] || - this->marker[SP_MARKER_LOC_MID] || - this->marker[SP_MARKER_LOC_END]) + this->_curve && + (this->_marker[SP_MARKER_LOC] || + this->_marker[SP_MARKER_LOC_START] || + this->_marker[SP_MARKER_LOC_MID] || + this->_marker[SP_MARKER_LOC_END]) ); } @@ -886,7 +886,7 @@ int SPShape::hasMarkers() const */ int SPShape::numberOfMarkers(int type) { - Geom::PathVector const & pathv = this->curve->get_pathvector(); + Geom::PathVector const & pathv = this->_curve->get_pathvector(); if (pathv.size() == 0) { return 0; } @@ -894,7 +894,7 @@ int SPShape::numberOfMarkers(int type) switch(type) { case SP_MARKER_LOC: { - if ( this->marker[SP_MARKER_LOC] ) { + if ( this->_marker[SP_MARKER_LOC] ) { guint n = 0; for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { n += path_it->size_default() + 1; @@ -906,11 +906,11 @@ int SPShape::numberOfMarkers(int type) } case SP_MARKER_LOC_START: // there is only a start marker on the first path of a pathvector - return this->marker[SP_MARKER_LOC_START] ? 1 : 0; + return this->_marker[SP_MARKER_LOC_START] ? 1 : 0; case SP_MARKER_LOC_MID: { - if ( this->marker[SP_MARKER_LOC_MID] ) { + if ( this->_marker[SP_MARKER_LOC_MID] ) { guint n = 0; for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { n += path_it->size_default() + 1; @@ -924,7 +924,7 @@ int SPShape::numberOfMarkers(int type) case SP_MARKER_LOC_END: { // there is only an end marker on the last path of a pathvector - return this->marker[SP_MARKER_LOC_END] ? 1 : 0; + return this->_marker[SP_MARKER_LOC_END] ? 1 : 0; } default: @@ -946,16 +946,16 @@ sp_shape_marker_release (SPObject *marker, SPShape *shape) item = (SPItem *) shape; for (i = 0; i < SP_MARKER_LOC_QTY; i++) { - if (marker == shape->marker[i]) { + if (marker == shape->_marker[i]) { SPItemView *v; /* Hide marker */ for (v = item->display; v != NULL; v = v->next) { - sp_marker_hide ((SPMarker *) (shape->marker[i]), v->arenaitem->key() + i); + sp_marker_hide ((SPMarker *) (shape->_marker[i]), v->arenaitem->key() + i); } /* Detach marker */ - shape->release_connect[i].disconnect(); - shape->modified_connect[i].disconnect(); - shape->marker[i] = sp_object_hunref (shape->marker[i], item); + shape->_release_connect[i].disconnect(); + shape->_modified_connect[i].disconnect(); + shape->_marker[i] = sp_object_hunref (shape->_marker[i], item); } } } @@ -988,27 +988,27 @@ sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value) } SPObject *mrk = sp_css_uri_reference_resolve(object->document, value); - if (mrk != shape->marker[key]) { - if (shape->marker[key]) { + if (mrk != shape->_marker[key]) { + if (shape->_marker[key]) { SPItemView *v; /* Detach marker */ - shape->release_connect[key].disconnect(); - shape->modified_connect[key].disconnect(); + shape->_release_connect[key].disconnect(); + shape->_modified_connect[key].disconnect(); /* Hide marker */ for (v = item->display; v != NULL; v = v->next) { - sp_marker_hide ((SPMarker *) (shape->marker[key]), + sp_marker_hide ((SPMarker *) (shape->_marker[key]), v->arenaitem->key() + key); } /* Unref marker */ - shape->marker[key] = sp_object_hunref (shape->marker[key], object); + shape->_marker[key] = sp_object_hunref (shape->_marker[key], object); } if (SP_IS_MARKER (mrk)) { - shape->marker[key] = sp_object_href (mrk, object); - shape->release_connect[key] = mrk->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_shape_marker_release), shape)); - shape->modified_connect[key] = mrk->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_shape_marker_modified), shape)); + shape->_marker[key] = sp_object_href (mrk, object); + shape->_release_connect[key] = mrk->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_shape_marker_release), shape)); + shape->_modified_connect[key] = mrk->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_shape_marker_modified), shape)); } } } @@ -1033,32 +1033,32 @@ void SPShape::setShape() * Any existing curve in the shape will be unreferenced first. * This routine also triggers a request to update the display. */ -void SPShape::setCurve(SPCurve *curve, unsigned int owner) +void SPShape::setCurve(SPCurve *new_curve, unsigned int owner) { - if (this->curve) { - this->curve = this->curve->unref(); + if (_curve) { + _curve = _curve->unref(); } - if (curve) { + if (new_curve) { if (owner) { - this->curve = curve->ref(); + _curve = new_curve->ref(); } else { - this->curve = curve->copy(); + _curve = new_curve->copy(); } } this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } /** - * Sets curve_before_lpe to refer to the curve. + * Sets _curve_before_lpe to refer to the curve. */ void -SPShape::setCurveBeforeLPE (SPCurve *curve) +SPShape::setCurveBeforeLPE (SPCurve *new_curve) { - if (this->curve_before_lpe) { - this->curve_before_lpe = this->curve_before_lpe->unref(); + if (_curve_before_lpe) { + _curve_before_lpe = _curve_before_lpe->unref(); } - if (curve) { - this->curve_before_lpe = curve->ref(); + if (new_curve) { + _curve_before_lpe = new_curve->ref(); } } @@ -1067,8 +1067,8 @@ SPShape::setCurveBeforeLPE (SPCurve *curve) */ SPCurve * SPShape::getCurve() const { - if (this->curve) { - return this->curve->copy(); + if (_curve) { + return _curve->copy(); } return NULL; } @@ -1078,13 +1078,13 @@ SPCurve * SPShape::getCurve() const */ SPCurve * SPShape::getCurveBeforeLPE() const { - if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(this))) { - if (this->curve_before_lpe) { - return this->curve_before_lpe->copy(); + if (sp_lpe_item_has_path_effect(this)) { + if (_curve_before_lpe) { + return this->_curve_before_lpe->copy(); } } else { - if (this->curve) { - return this->curve->copy(); + if (_curve) { + return _curve->copy(); } } return NULL; @@ -1093,16 +1093,16 @@ SPCurve * SPShape::getCurveBeforeLPE() const /** * Same as sp_shape_set_curve but without updating the display */ -void SPShape::setCurveInsync(SPCurve *curve, unsigned int owner) +void SPShape::setCurveInsync(SPCurve *new_curve, unsigned int owner) { - if (this->curve) { - this->curve = this->curve->unref(); + if (_curve) { + _curve = _curve->unref(); } - if (curve) { + if (new_curve) { if (owner) { - this->curve = curve->ref(); + _curve = new_curve->ref(); } else { - this->curve = curve->copy(); + _curve = new_curve->copy(); } } } @@ -1116,11 +1116,11 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap g_assert(SP_IS_SHAPE(item)); SPShape const *shape = SP_SHAPE(item); - if (shape->curve == NULL) { + if (shape->_curve == NULL) { return; } - Geom::PathVector const &pathv = shape->curve->get_pathvector(); + Geom::PathVector const &pathv = shape->_curve->get_pathvector(); if (pathv.empty()) return; diff --git a/src/sp-shape.h b/src/sp-shape.h index 36fcef8e1..453750946 100644 --- a/src/sp-shape.h +++ b/src/sp-shape.h @@ -2,16 +2,15 @@ #define SEEN_SP_SHAPE_H /* - * Base class for shapes, including <path> element - * - * Author: + * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Abhishek Sharma * Jon A. Cruz <jon@joncruz.org> + * Johan Engelen * * Copyright (C) 1999-2002 Lauris Kaplinski * Copyright (C) 2000-2001 Ximian, Inc. - * Copyright (C) 2008 Johan Engelen + * Copyright (C) 1999-2012 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -32,21 +31,13 @@ #define SP_SHAPE_WRITE_PATH (1 << 2) class SPDesktop; +namespace Inkscape { class DrawingItem; } -namespace Inkscape { - -class DrawingItem; - -} // namespace Inkscape - +/** + * Base class for shapes, including <path> element + */ class SPShape : public SPLPEItem { public: - SPCurve *curve; - - SPObject *marker[SP_MARKER_LOC_QTY]; - sigc::connection release_connect [SP_MARKER_LOC_QTY]; - sigc::connection modified_connect [SP_MARKER_LOC_QTY]; - static GType getType (void); void setShape (); SPCurve * getCurve () const; @@ -58,7 +49,13 @@ public: int numberOfMarkers (int type); public: // temporarily public, until SPPath is properly classed, etc. - SPCurve *curve_before_lpe; + SPCurve *_curve_before_lpe; + SPCurve *_curve; + +public: + SPObject *_marker[SP_MARKER_LOC_QTY]; + sigc::connection _release_connect [SP_MARKER_LOC_QTY]; + sigc::connection _modified_connect [SP_MARKER_LOC_QTY]; private: static void sp_shape_init (SPShape *shape); diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index 5341f6fd9..63d7a2616 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -159,14 +159,12 @@ sp_spiral_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X // make sure the curve is rebuilt with all up-to-date parameters sp_spiral_set_shape(spiral); - //Duplicate the path - SPCurve *curve = spiral->curve; //Nulls might be possible if this called iteratively - if ( !curve ) { + if ( !spiral->_curve ) { //g_warning("sp_spiral_write(): No path to copy\n"); return NULL; } - char *d = sp_svg_write_path ( curve->get_pathvector() ); + char *d = sp_svg_write_path ( spiral->_curve->get_pathvector() ); repr->setAttribute("d", d); g_free (d); @@ -290,8 +288,8 @@ static void sp_spiral_update_patheffect(SPLPEItem *lpeitem, bool write) if (write) { Inkscape::XML::Node *repr = shape->getRepr(); - if ( shape->curve != NULL ) { - gchar *str = sp_svg_write_path(shape->curve->get_pathvector()); + if ( shape->_curve != NULL ) { + gchar *str = sp_svg_write_path(shape->_curve->get_pathvector()); repr->setAttribute("d", str); g_free(str); } else { diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 8ea10f52b..e0f05d0f4 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -146,7 +146,7 @@ sp_star_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML } sp_star_set_shape ((SPShape *) star); - char *d = sp_svg_write_path (((SPShape *) star)->curve->get_pathvector()); + char *d = sp_svg_write_path (star->_curve->get_pathvector()); repr->setAttribute("d", d); g_free (d); @@ -277,8 +277,8 @@ sp_star_update_patheffect(SPLPEItem *lpeitem, bool write) if (write) { Inkscape::XML::Node *repr = shape->getRepr(); - if ( shape->curve != NULL ) { - gchar *str = sp_svg_write_path(shape->curve->get_pathvector()); + if ( shape->_curve != NULL ) { + gchar *str = sp_svg_write_path(shape->_curve->get_pathvector()); repr->setAttribute("d", str); g_free(str); } else { diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 87a1563db..cf4e63ffa 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -821,7 +821,7 @@ Geom::PathVector* item_outline(SPItem const *item, bool coalesce) // START marker for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( SPObject *marker_obj = shape->marker[i] ) { + if ( SPObject *marker_obj = shape->_marker[i] ) { Geom::Affine const m (sp_shape_marker_get_transform_at_start(pathv.front().front())); item_outline_add_marker( marker_obj, m, Geom::Scale(i_style->stroke_width.computed), @@ -830,7 +830,7 @@ Geom::PathVector* item_outline(SPItem const *item, bool coalesce) } // MID marker for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - SPObject *midmarker_obj = shape->marker[i]; + SPObject *midmarker_obj = shape->_marker[i]; if (!midmarker_obj) continue; for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { // START position @@ -873,7 +873,7 @@ Geom::PathVector* item_outline(SPItem const *item, bool coalesce) } // END marker for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if ( SPObject *marker_obj = shape->marker[i] ) { + if ( SPObject *marker_obj = shape->_marker[i] ) { /* Get reference to last curve in the path. * For moveto-only path, this returns the "closing line segment". */ Geom::Path const &path_last = pathv.back(); @@ -1139,7 +1139,7 @@ sp_selected_path_outline(SPDesktop *desktop) // START marker for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( SPObject *marker_obj = shape->marker[i] ) { + if ( SPObject *marker_obj = shape->_marker[i] ) { Geom::Affine const m (sp_shape_marker_get_transform_at_start(pathv.front().front())); sp_selected_path_outline_add_marker( marker_obj, m, Geom::Scale(i_style->stroke_width.computed), transform, @@ -1148,7 +1148,7 @@ sp_selected_path_outline(SPDesktop *desktop) } // MID marker for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - SPObject *midmarker_obj = shape->marker[i]; + SPObject *midmarker_obj = shape->_marker[i]; if (!midmarker_obj) continue; for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { // START position @@ -1191,7 +1191,7 @@ sp_selected_path_outline(SPDesktop *desktop) } // END marker for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if ( SPObject *marker_obj = shape->marker[i] ) { + if ( SPObject *marker_obj = shape->_marker[i] ) { /* Get reference to last curve in the path. * For moveto-only path, this returns the "closing line segment". */ Geom::Path const &path_last = pathv.back(); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 1cdcefd1a..65141ca10 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -674,8 +674,8 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) if (SP_IS_SHAPE(item)) { SPShape *shape = SP_SHAPE (item); for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) { - if (shape->marker[i]) { - _copyNode(shape->marker[i]->getRepr(), _doc, _defs); + if (shape->_marker[i]) { + _copyNode(shape->_marker[i]->getRepr(), _doc, _defs); } } } |
