diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-11-03 23:42:23 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2013-11-03 23:42:23 +0000 |
| commit | 48ac54f0234671b23afeaad33af6168037ef552c (patch) | |
| tree | 3a937530c745c958f8da1e788a8dfe94cff847d4 /src/sp-item.cpp | |
| parent | Update to trunk (diff) | |
| parent | Remove antiquated Perl extensions and modules, which were mostly useless. (diff) | |
| download | inkscape-48ac54f0234671b23afeaad33af6168037ef552c.tar.gz inkscape-48ac54f0234671b23afeaad33af6168037ef552c.zip | |
Update to trunk
(bzr r12588.1.25)
Diffstat (limited to 'src/sp-item.cpp')
| -rw-r--r-- | src/sp-item.cpp | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp index e8338046b..c6daa853c 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -255,7 +255,7 @@ SPItem::unsetCenter() { transform_center_y = 0; } -bool SPItem::isCenterSet() { +bool SPItem::isCenterSet() const { return (transform_center_x != 0 || transform_center_y != 0); } @@ -562,7 +562,7 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item) } } -void SPItem::update(SPCtx *ctx, guint flags) { +void SPItem::update(SPCtx* /*ctx*/, guint flags) { SPItem *item = this; SPItem* object = item; @@ -688,7 +688,7 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X } // CPPIFY: make pure virtual -Geom::OptRect SPItem::bbox(Geom::Affine const &transform, SPItem::BBoxType type) { +Geom::OptRect SPItem::bbox(Geom::Affine const & /*transform*/, SPItem::BBoxType /*type*/) const { //throw; return Geom::OptRect(); } @@ -848,18 +848,17 @@ Geom::OptRect SPItem::desktopBounds(BBoxType type) const } } -unsigned SPItem::pos_in_parent() -{ +unsigned int SPItem::pos_in_parent() const { g_assert(parent != NULL); g_assert(SP_IS_OBJECT(parent)); - SPObject *object = this; + unsigned int pos = 0; - unsigned pos=0; for ( SPObject *iter = parent->firstChild() ; iter ; iter = iter->next) { - if ( iter == object ) { + if (iter == this) { return pos; } + if (SP_IS_ITEM(iter)) { pos++; } @@ -870,7 +869,7 @@ unsigned SPItem::pos_in_parent() } // CPPIFY: make pure virtual, see below! -void SPItem::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) { +void SPItem::snappoints(std::vector<Inkscape::SnapCandidatePoint> & /*p*/, Inkscape::SnapPreferences const */*snapprefs*/) const { //throw; } /* This will only be called if the derived class doesn't override this. @@ -920,7 +919,7 @@ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscap } // CPPIFY: make pure virtual -void SPItem::print(SPPrintContext* ctx) { +void SPItem::print(SPPrintContext* /*ctx*/) { //throw; } @@ -937,11 +936,11 @@ void SPItem::invoke_print(SPPrintContext *ctx) } } -const char* SPItem::displayName() { +const char* SPItem::displayName() const { return _("Object"); } -gchar* SPItem::description() { +gchar* SPItem::description() const { return g_strdup(""); } @@ -950,8 +949,7 @@ gchar* SPItem::description() { * * Must be freed by caller. */ -gchar *SPItem::detailedDescription() -{ +gchar *SPItem::detailedDescription() const { gchar* s = g_strdup_printf("<b>%s</b> %s", this->displayName(), this->description()); @@ -985,17 +983,11 @@ gchar *SPItem::detailedDescription() } /** - * Returns 1 if the item is filtered, 0 otherwise. Used with groups/lists to determine how many, or if any, are filtered + * Returns true if the item is filtered, false otherwise. Used with groups/lists to determine how many, or if any, are filtered * */ -int SPItem::ifilt() -{ - int retval=0; - if ( style && style->filter.href && style->filter.href->getObject() ) { - retval=1; - } - - return retval; +bool SPItem::isFiltered() const { + return (style && style->filter.href && style->filter.href->getObject()); } /** @@ -1014,7 +1006,7 @@ unsigned SPItem::display_key_new(unsigned numkeys) } // CPPIFY: make pure virtual -Inkscape::DrawingItem* SPItem::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { +Inkscape::DrawingItem* SPItem::show(Inkscape::Drawing& /*drawing*/, unsigned int /*key*/, unsigned int /*flags*/) { //throw; return 0; } @@ -1073,7 +1065,7 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned } // CPPIFY: make pure virtual -void SPItem::hide(unsigned int key) { +void SPItem::hide(unsigned int /*key*/) { //throw; } @@ -1382,11 +1374,12 @@ void SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &tra if ( // run the object's set_transform (i.e. embed transform) only if: !preserve && // user did not chose to preserve all transforms - !clip_ref->getObject() && // the object does not have a clippath - !mask_ref->getObject() && // the object does not have a mask + (!clip_ref || !clip_ref->getObject()) && // the object does not have a clippath + (!mask_ref || !mask_ref->getObject()) && // the object does not have a mask !(!transform.isTranslation() && style && style->getFilter()) // the object does not have a filter, or the transform is translation (which is supposed to not affect filters) - ) { - transform_attr = this->set_transform(transform); + ) + { + transform_attr = this->set_transform(transform); if (freeze_stroke_width) { freeze_stroke_width_recursive(false); @@ -1419,7 +1412,7 @@ void SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &tra } // CPPIFY: see below, do not make pure? -gint SPItem::event(SPEvent* event) { +gint SPItem::event(SPEvent* /*event*/) { return FALSE; } @@ -1443,8 +1436,8 @@ void SPItem::set_item_transform(Geom::Affine const &transform_matrix) } } -//void SPItem::convert_to_guides() { -// // CPPIFY: If not overridden, call SPItem::convert_to_guides(), see below! +//void SPItem::convert_to_guides() const { +// // CPPIFY: If not overridden, call SPItem::convert_to_guides() const, see below! // this->convert_to_guides(); //} @@ -1607,7 +1600,7 @@ SPItem *sp_item_first_item_child(SPObject *obj) return child; } -void SPItem::convert_to_guides() { +void SPItem::convert_to_guides() const { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int prefs_bbox = prefs->getInt("/tools/bounding_box", 0); |
