diff options
| author | Markus Engel <markus.engel@tum.de> | 2012-10-06 21:56:27 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2012-10-06 21:56:27 +0000 |
| commit | 99cb30e28d4ee193f39e23464abbd7630cac8a2d (patch) | |
| tree | 493559e086a9e6cf1e252e79765053be55277825 | |
| parent | Removed old calls to set_shape and update_patheffect. (diff) | |
| download | inkscape-99cb30e28d4ee193f39e23464abbd7630cac8a2d.tar.gz inkscape-99cb30e28d4ee193f39e23464abbd7630cac8a2d.zip | |
Added virtual pad to SPFlowtext; removed old calls to virtual SPItem methods.
(bzr r11608.1.46)
| -rw-r--r-- | src/box3d.cpp | 6 | ||||
| -rw-r--r-- | src/marker.cpp | 42 | ||||
| -rw-r--r-- | src/sp-anchor.cpp | 4 | ||||
| -rw-r--r-- | src/sp-ellipse.cpp | 8 | ||||
| -rw-r--r-- | src/sp-flowregion.cpp | 4 | ||||
| -rw-r--r-- | src/sp-flowtext.cpp | 183 | ||||
| -rw-r--r-- | src/sp-flowtext.h | 34 | ||||
| -rw-r--r-- | src/sp-image.cpp | 12 | ||||
| -rw-r--r-- | src/sp-item-group.cpp | 12 | ||||
| -rw-r--r-- | src/sp-item.cpp | 18 | ||||
| -rw-r--r-- | src/sp-item.h | 56 | ||||
| -rw-r--r-- | src/sp-line.cpp | 6 | ||||
| -rw-r--r-- | src/sp-offset.cpp | 4 | ||||
| -rw-r--r-- | src/sp-path.cpp | 6 | ||||
| -rw-r--r-- | src/sp-polygon.cpp | 2 | ||||
| -rw-r--r-- | src/sp-polyline.cpp | 2 | ||||
| -rw-r--r-- | src/sp-rect.cpp | 8 | ||||
| -rw-r--r-- | src/sp-root.cpp | 12 | ||||
| -rw-r--r-- | src/sp-shape.cpp | 10 | ||||
| -rw-r--r-- | src/sp-spiral.cpp | 4 | ||||
| -rw-r--r-- | src/sp-star.cpp | 4 | ||||
| -rw-r--r-- | src/sp-symbol.cpp | 8 | ||||
| -rw-r--r-- | src/sp-text.cpp | 14 | ||||
| -rw-r--r-- | src/sp-tref.cpp | 4 | ||||
| -rw-r--r-- | src/sp-tspan.cpp | 4 | ||||
| -rw-r--r-- | src/sp-use.cpp | 12 |
26 files changed, 309 insertions, 170 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp index de1acdc7e..1aea69313 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -96,9 +96,9 @@ box3d_class_init(SPBox3DClass *klass) sp_object_class->write = box3d_write; sp_object_class->update = box3d_update; - item_class->description = box3d_description; - item_class->set_transform = box3d_set_transform; - item_class->convert_to_guides = box3d_convert_to_guides; +// item_class->description = box3d_description; +// item_class->set_transform = box3d_set_transform; +// item_class->convert_to_guides = box3d_convert_to_guides; } CBox3D::CBox3D(SPBox3D* box) : CGroup(box) { diff --git a/src/marker.cpp b/src/marker.cpp index 58cd8ea7c..50426a2cd 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -92,10 +92,10 @@ static void sp_marker_class_init(SPMarkerClass *klass) sp_object_class->update = sp_marker_update; sp_object_class->write = sp_marker_write; - sp_item_class->show = sp_marker_private_show; - sp_item_class->hide = sp_marker_private_hide; - sp_item_class->bbox = sp_marker_bbox; - sp_item_class->print = sp_marker_print; +// sp_item_class->show = sp_marker_private_show; +// sp_item_class->hide = sp_marker_private_hide; +// sp_item_class->bbox = sp_marker_bbox; +// sp_item_class->print = sp_marker_print; } CMarker::CMarker(SPMarker* marker) : CGroup(marker) { @@ -162,7 +162,11 @@ void CMarker::onRelease() { while (marker->views) { // Destroy all DrawingItems etc. // Parent class ::hide method - reinterpret_cast<SPItemClass *>(parent_class)->hide(marker, marker->views->key); + //reinterpret_cast<SPItemClass *>(parent_class)->hide(marker, marker->views->key); + // CPPIFY: correct one? + CGroup::onHide(marker->views->key); + + sp_marker_view_remove (marker, marker->views, TRUE); } @@ -548,8 +552,10 @@ sp_marker_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X return ((SPMarker*)object)->cmarker->onWrite(xml_doc, repr, flags); } -Inkscape::DrawingItem* CMarker::onShow(Inkscape::Drawing &/*drawing*/, unsigned int /*key*/, unsigned int /*flags*/) { - return 0; +Inkscape::DrawingItem* CMarker::onShow(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { + // CPPIFY: correct? + return CGroup::onShow(drawing, key, flags); + //return 0; } // CPPIFY: remove @@ -564,7 +570,8 @@ sp_marker_private_show (SPItem */*item*/, Inkscape::Drawing &/*drawing*/, unsign } void CMarker::onHide(unsigned int key) { - + // CPPIFY: correct? + CGroup::onHide(key); } // CPPIFY: remove @@ -631,7 +638,10 @@ sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size) if (view && (view->items.size() != size)) { /* Free old view and allocate new */ /* Parent class ::hide method */ - ((SPItemClass *) parent_class)->hide ((SPItem *) marker, key); + // CPPIFY: correct one? + //((SPItemClass *) parent_class)->hide ((SPItem *) marker, key); + marker->cmarker->onHide(key); + sp_marker_view_remove (marker, view, TRUE); view = NULL; } @@ -670,9 +680,12 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent, } if (!v->items[pos]) { /* Parent class ::show method */ - v->items[pos] = ((SPItemClass *) parent_class)->show ((SPItem *) marker, - parent->drawing(), key, - SP_ITEM_REFERENCE_FLAGS); +// v->items[pos] = ((SPItemClass *) parent_class)->show ((SPItem *) marker, +// parent->drawing(), key, +// SP_ITEM_REFERENCE_FLAGS); + // CPPIFY: correct one? + v->items[pos] = marker->cmarker->onShow(parent->drawing(), key, SP_ITEM_REFERENCE_FLAGS); + if (v->items[pos]) { /* fixme: Position (Lauris) */ parent->prependChild(v->items[pos]); @@ -717,7 +730,10 @@ sp_marker_hide (SPMarker *marker, unsigned int key) next = v->next; if (v->key == key) { /* Parent class ::hide method */ - ((SPItemClass *) parent_class)->hide ((SPItem *) marker, key); + // CPPIFY: correct one? + //((SPItemClass *) parent_class)->hide ((SPItem *) marker, key); + marker->cmarker->onHide(key); + sp_marker_view_remove (marker, v, TRUE); return; } diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp index b6cfd6f52..84804bfc8 100644 --- a/src/sp-anchor.cpp +++ b/src/sp-anchor.cpp @@ -73,8 +73,8 @@ static void sp_anchor_class_init(SPAnchorClass *ac) sp_object_class->set = sp_anchor_set; sp_object_class->write = sp_anchor_write; - item_class->description = sp_anchor_description; - item_class->event = sp_anchor_event; +// item_class->description = sp_anchor_description; +// item_class->event = sp_anchor_event; } CAnchor::CAnchor(SPAnchor* anchor) : CGroup(anchor) { diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 73965dfcb..0a0e37434 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -115,7 +115,7 @@ static void sp_genericellipse_class_init(SPGenericEllipseClass *klass) sp_object_class->update = sp_genericellipse_update; sp_object_class->write = sp_genericellipse_write; - item_class->snappoints = sp_genericellipse_snappoints; + //item_class->snappoints = sp_genericellipse_snappoints; //shape_class->set_shape = sp_genericellipse_set_shape; //lpe_item_class->update_patheffect = sp_genericellipse_update_patheffect; @@ -465,7 +465,7 @@ static void sp_ellipse_class_init(SPEllipseClass *klass) sp_object_class->write = sp_ellipse_write; sp_object_class->set = sp_ellipse_set; - item_class->description = sp_ellipse_description; +// item_class->description = sp_ellipse_description; } CEllipse::CEllipse(SPEllipse* ellipse) : CGenericEllipse(ellipse) { @@ -640,7 +640,7 @@ sp_circle_class_init(SPCircleClass *klass) sp_object_class->write = sp_circle_write; sp_object_class->set = sp_circle_set; - item_class->description = sp_circle_description; +// item_class->description = sp_circle_description; } CCircle::CCircle(SPCircle* circle) : CGenericEllipse(circle) { @@ -793,7 +793,7 @@ sp_arc_class_init(SPArcClass *klass) sp_object_class->set = sp_arc_set; sp_object_class->modified = sp_arc_modified; - item_class->description = sp_arc_description; +// item_class->description = sp_arc_description; } CArc::CArc(SPArc* arc) : CGenericEllipse(arc) { diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index 8dc8ebf8a..a72b2bea0 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -98,7 +98,7 @@ sp_flowregion_class_init (SPFlowregionClass *klass) sp_object_class->modified = sp_flowregion_modified; sp_object_class->write = sp_flowregion_write; - item_class->description = sp_flowregion_description; +// item_class->description = sp_flowregion_description; } CFlowregion::CFlowregion(SPFlowregion* flowregion) : CItem(flowregion) { @@ -343,7 +343,7 @@ sp_flowregionexclude_class_init (SPFlowregionExcludeClass *klass) sp_object_class->modified = sp_flowregionexclude_modified; sp_object_class->write = sp_flowregionexclude_write; - item_class->description = sp_flowregionexclude_description; +// item_class->description = sp_flowregionexclude_description; } CFlowregionExclude::CFlowregionExclude(SPFlowregionExclude* flowregionexclude) : CItem(flowregionexclude) { diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index dc5b1d8bd..3779a19b5 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -82,7 +82,7 @@ sp_flowtext_class_init(SPFlowtextClass *klass) { GObjectClass *object_class = (GObjectClass *) klass; SPObjectClass *sp_object_class = (SPObjectClass *) klass; - SPItemClass *item_class = (SPItemClass *) klass; + //SPItemClass *item_class = (SPItemClass *) klass; parent_class = (SPItemClass *)g_type_class_ref(SP_TYPE_ITEM); @@ -96,17 +96,28 @@ sp_flowtext_class_init(SPFlowtextClass *klass) sp_object_class->build = sp_flowtext_build; sp_object_class->set = sp_flowtext_set; - item_class->bbox = sp_flowtext_bbox; - item_class->print = sp_flowtext_print; - item_class->description = sp_flowtext_description; - item_class->snappoints = sp_flowtext_snappoints; - item_class->show = sp_flowtext_show; - item_class->hide = sp_flowtext_hide; +// item_class->bbox = sp_flowtext_bbox; +// item_class->print = sp_flowtext_print; +// item_class->description = sp_flowtext_description; +// item_class->snappoints = sp_flowtext_snappoints; +// item_class->show = sp_flowtext_show; +// item_class->hide = sp_flowtext_hide; +} + +CFlowtext::CFlowtext(SPFlowtext* flowtext) : CItem(flowtext) { + this->spflowtext = flowtext; +} + +CFlowtext::~CFlowtext() { } static void sp_flowtext_init(SPFlowtext *group) { + group->cflowtext = new CFlowtext(group); + group->citem = group->cflowtext; + group->cobject = group->cflowtext; + group->par_indent = 0; new (&group->layout) Inkscape::Text::Layout(); } @@ -119,35 +130,49 @@ sp_flowtext_dispose(GObject *object) group->layout.~Layout(); } +void CFlowtext::onChildAdded(Inkscape::XML::Node* child, Inkscape::XML::Node* ref) { + CItem::onChildAdded(child, ref); + + this->spflowtext->requestModified(SP_OBJECT_MODIFIED_FLAG); +} + static void sp_flowtext_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - if (((SPObjectClass *) (parent_class))->child_added) - (* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref); - - object->requestModified(SP_OBJECT_MODIFIED_FLAG); +// if (((SPObjectClass *) (parent_class))->child_added) +// (* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref); +// +// object->requestModified(SP_OBJECT_MODIFIED_FLAG); } /* fixme: hide (Lauris) */ +void CFlowtext::onRemoveChild(Inkscape::XML::Node* child) { + CItem::onRemoveChild(child); + + this->spflowtext->requestModified(SP_OBJECT_MODIFIED_FLAG); +} + static void sp_flowtext_remove_child(SPObject *object, Inkscape::XML::Node *child) { - if (((SPObjectClass *) (parent_class))->remove_child) - (* ((SPObjectClass *) (parent_class))->remove_child)(object, child); - - object->requestModified(SP_OBJECT_MODIFIED_FLAG); +// if (((SPObjectClass *) (parent_class))->remove_child) +// (* ((SPObjectClass *) (parent_class))->remove_child)(object, child); +// +// object->requestModified(SP_OBJECT_MODIFIED_FLAG); } -static void sp_flowtext_update(SPObject *object, SPCtx *ctx, unsigned flags) -{ +void CFlowtext::onUpdate(SPCtx* ctx, unsigned int flags) { + SPFlowtext* object = this->spflowtext; + SPFlowtext *group = SP_FLOWTEXT(object); SPItemCtx *ictx = (SPItemCtx *) ctx; SPItemCtx cctx = *ictx; - if (((SPObjectClass *) (parent_class))->update) { - ((SPObjectClass *) (parent_class))->update(object, ctx, flags); - } +// if (((SPObjectClass *) (parent_class))->update) { +// ((SPObjectClass *) (parent_class))->update(object, ctx, flags); +// } + CItem::onUpdate(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; flags &= SP_OBJECT_MODIFIED_CASCADE; @@ -186,8 +211,13 @@ static void sp_flowtext_update(SPObject *object, SPCtx *ctx, unsigned flags) } } -static void sp_flowtext_modified(SPObject *object, guint flags) +static void sp_flowtext_update(SPObject *object, SPCtx *ctx, unsigned flags) { + ((SPFlowtext*)object)->cflowtext->onUpdate(ctx, flags); +} + +void CFlowtext::onModified(unsigned int flags) { + SPFlowtext* object = this->spflowtext; SPObject *ft = object; SPObject *region = NULL; @@ -220,21 +250,32 @@ static void sp_flowtext_modified(SPObject *object, guint flags) } } -static void -sp_flowtext_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_flowtext_modified(SPObject *object, guint flags) { + ((SPFlowtext*)object)->cflowtext->onModified(flags); +} + +void CFlowtext::onBuild(SPDocument* doc, Inkscape::XML::Node* repr) { + SPFlowtext* object = this->spflowtext; + object->_requireSVGVersion(Inkscape::Version(1, 2)); - if (((SPObjectClass *) (parent_class))->build) { - (* ((SPObjectClass *) (parent_class))->build)(object, document, repr); - } +// if (((SPObjectClass *) (parent_class))->build) { +// (* ((SPObjectClass *) (parent_class))->build)(object, document, repr); +// } + CItem::onBuild(doc, repr); object->readAttr( "inkscape:layoutOptions" ); // must happen after css has been read } static void -sp_flowtext_set(SPObject *object, unsigned key, gchar const *value) +sp_flowtext_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { + ((SPFlowtext*)object)->cflowtext->onBuild(document, repr); +} + +void CFlowtext::onSet(unsigned int key, const gchar* value) { + SPFlowtext* object = this->spflowtext; SPFlowtext *group = (SPFlowtext *) object; switch (key) { @@ -284,24 +325,32 @@ sp_flowtext_set(SPObject *object, unsigned key, gchar const *value) break; } default: - if (((SPObjectClass *) (parent_class))->set) { - (* ((SPObjectClass *) (parent_class))->set)(object, key, value); - } +// if (((SPObjectClass *) (parent_class))->set) { +// (* ((SPObjectClass *) (parent_class))->set)(object, key, value); +// } + CItem::onSet(key, value); break; } } -static Inkscape::XML::Node *sp_flowtext_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +static void +sp_flowtext_set(SPObject *object, unsigned key, gchar const *value) { + ((SPFlowtext*)object)->cflowtext->onSet(key, value); +} + +Inkscape::XML::Node* CFlowtext::onWrite(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags) { + SPFlowtext* object = this->spflowtext; + if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { - repr = xml_doc->createElement("svg:flowRoot"); + repr = doc->createElement("svg:flowRoot"); } GSList *l = NULL; for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { Inkscape::XML::Node *c_repr = NULL; if ( SP_IS_FLOWDIV(child) || SP_IS_FLOWPARA(child) || SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child)) { - c_repr = child->updateRepr(xml_doc, NULL, flags); + c_repr = child->updateRepr(doc, NULL, flags); } if ( c_repr ) { l = g_slist_prepend(l, c_repr); @@ -320,16 +369,22 @@ static Inkscape::XML::Node *sp_flowtext_write(SPObject *object, Inkscape::XML::D } } - if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); - } +// if (((SPObjectClass *) (parent_class))->write) { +// ((SPObjectClass *) (parent_class))->write(object, doc, repr, flags); +// } + CItem::onWrite(doc, repr, flags); return repr; } -static Geom::OptRect -sp_flowtext_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type) +static Inkscape::XML::Node *sp_flowtext_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + return ((SPFlowtext*)object)->cflowtext->onWrite(xml_doc, repr, flags); +} + +Geom::OptRect CFlowtext::onBbox(Geom::Affine const &transform, SPItem::BBoxType type) { + SPFlowtext* item = this->spflowtext; + SPFlowtext *group = SP_FLOWTEXT(item); Geom::OptRect bbox = group->layout.bounds(transform); @@ -342,9 +397,15 @@ sp_flowtext_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBox return bbox; } -static void -sp_flowtext_print(SPItem *item, SPPrintContext *ctx) +static Geom::OptRect +sp_flowtext_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type) { + return ((SPFlowtext*)item)->cflowtext->onBbox(transform, type); +} + +void CFlowtext::onPrint(SPPrintContext *ctx) { + SPFlowtext* item = this->spflowtext; + SPFlowtext *group = SP_FLOWTEXT(item); Geom::OptRect pbox, bbox, dbox; @@ -356,9 +417,15 @@ sp_flowtext_print(SPItem *item, SPPrintContext *ctx) group->layout.print(ctx, pbox, dbox, bbox, ctm); } - -static gchar *sp_flowtext_description(SPItem *item) +static void +sp_flowtext_print(SPItem *item, SPPrintContext *ctx) { + ((SPFlowtext*)item)->cflowtext->onPrint(ctx); +} + +gchar* CFlowtext::onDescription() { + SPFlowtext* item = this->spflowtext; + Inkscape::Text::Layout const &layout = SP_FLOWTEXT(item)->layout; int const nChars = layout.iteratorToCharIndex(layout.end()); @@ -371,8 +438,14 @@ static gchar *sp_flowtext_description(SPItem *item) } } -static void sp_flowtext_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) +static gchar *sp_flowtext_description(SPItem *item) { + return ((SPFlowtext*)item)->cflowtext->onDescription(); +} + +void CFlowtext::onSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) { + SPFlowtext* item = this->spflowtext; + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_TEXT_BASELINE)) { // Choose a point on the baseline for snapping from or to, with the horizontal position // of this point depending on the text alignment (left vs. right) @@ -386,9 +459,14 @@ static void sp_flowtext_snappoints(SPItem const *item, std::vector<Inkscape::Sna } } -static Inkscape::DrawingItem * -sp_flowtext_show(SPItem *item, Inkscape::Drawing &drawing, unsigned/* key*/, unsigned /*flags*/) +static void sp_flowtext_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) { + ((SPFlowtext*)item)->cflowtext->onSnappoints(p, snapprefs); +} + +Inkscape::DrawingItem* CFlowtext::onShow(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { + SPFlowtext* item = this->spflowtext; + SPFlowtext *group = (SPFlowtext *) item; Inkscape::DrawingGroup *flowed = new Inkscape::DrawingGroup(drawing); flowed->setPickChildren(false); @@ -401,11 +479,22 @@ sp_flowtext_show(SPItem *item, Inkscape::Drawing &drawing, unsigned/* key*/, uns return flowed; } +static Inkscape::DrawingItem * +sp_flowtext_show(SPItem *item, Inkscape::Drawing &drawing, unsigned key, unsigned flags) +{ + return ((SPFlowtext*)item)->cflowtext->onShow(drawing, key, flags); +} + +void CFlowtext::onHide(unsigned int key) { + CItem::onHide(key); +} + static void sp_flowtext_hide(SPItem *item, unsigned int key) { - if (((SPItemClass *) parent_class)->hide) - ((SPItemClass *) parent_class)->hide(item, key); +// if (((SPItemClass *) parent_class)->hide) +// ((SPItemClass *) parent_class)->hide(item, key); + ((SPFlowtext*)item)->cflowtext->onHide(key); } diff --git a/src/sp-flowtext.h b/src/sp-flowtext.h index 944503a1e..9f1681636 100644 --- a/src/sp-flowtext.h +++ b/src/sp-flowtext.h @@ -22,8 +22,12 @@ class DrawingGroup; } // namespace Inkscape +class CFlowtext; + +class SPFlowtext : public SPItem { +public: + CFlowtext* cflowtext; -struct SPFlowtext : public SPItem { /** Completely recalculates the layout. */ void rebuildLayout(); @@ -57,6 +61,34 @@ struct SPFlowtextClass { SPItemClass parent_class; }; +class CFlowtext : public CItem { +public: + CFlowtext(SPFlowtext* flowtext); + virtual ~CFlowtext(); + + virtual void onBuild(SPDocument* doc, Inkscape::XML::Node* repr); + + virtual void onChildAdded(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); + virtual void onRemoveChild(Inkscape::XML::Node* child); + + virtual void onSet(unsigned int key, const gchar* value); + + virtual void onUpdate(SPCtx* ctx, unsigned int flags); + virtual void onModified(unsigned int flags); + + virtual Inkscape::XML::Node* onWrite(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + + virtual Geom::OptRect onBbox(Geom::Affine const &transform, SPItem::BBoxType type); + virtual void onPrint(SPPrintContext *ctx); + virtual gchar* onDescription(); + virtual Inkscape::DrawingItem* onShow(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); + virtual void onHide(unsigned int key); + virtual void onSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs); +protected: + SPFlowtext* spflowtext; +}; + + GType sp_flowtext_get_type (void); SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p1, Geom::Point p2); diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 15f565bc4..3d5a9a08b 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -594,12 +594,12 @@ static void sp_image_class_init( SPImageClass * klass ) sp_object_class->modified = sp_image_modified; sp_object_class->write = sp_image_write; - item_class->bbox = sp_image_bbox; - item_class->print = sp_image_print; - item_class->description = sp_image_description; - item_class->show = sp_image_show; - item_class->snappoints = sp_image_snappoints; - item_class->set_transform = sp_image_set_transform; +// item_class->bbox = sp_image_bbox; +// item_class->print = sp_image_print; +// item_class->description = sp_image_description; +// item_class->show = sp_image_show; +// item_class->snappoints = sp_image_snappoints; +// item_class->set_transform = sp_image_set_transform; } CImage::CImage(SPImage* image) : CItem(image) { diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 507dab20b..e3b48d4cf 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -128,12 +128,12 @@ sp_group_class_init (SPGroupClass *klass) sp_object_class->release = sp_group_release; sp_object_class->build = sp_group_build; - item_class->bbox = sp_group_bbox; - item_class->print = sp_group_print; - item_class->description = sp_group_description; - item_class->show = sp_group_show; - item_class->hide = sp_group_hide; - item_class->snappoints = sp_group_snappoints; +// item_class->bbox = sp_group_bbox; +// item_class->print = sp_group_print; +// item_class->description = sp_group_description; +// item_class->show = sp_group_show; +// item_class->hide = sp_group_hide; +// item_class->snappoints = sp_group_snappoints; //lpe_item_class->update_patheffect = sp_group_update_patheffect; } diff --git a/src/sp-item.cpp b/src/sp-item.cpp index ea78e2e99..3058d8974 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -116,8 +116,8 @@ SPItemClass::sp_item_class_init(SPItemClass *klass) sp_object_class->update = SPItem::sp_item_update; sp_object_class->write = SPItem::sp_item_write; - klass->description = SPItem::sp_item_private_description; - klass->snappoints = SPItem::sp_item_private_snappoints; +// klass->description = SPItem::sp_item_private_description; +// klass->snappoints = SPItem::sp_item_private_snappoints; } // CPPIFY: remove @@ -946,14 +946,14 @@ void CItem::onSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape: } // CPPIFY: remove -void SPItem::sp_item_private_snappoints(SPItem const * /*item*/, std::vector<Inkscape::SnapCandidatePoint> &/*p*/, Inkscape::SnapPreferences const * /*snapprefs*/) -{ +//void SPItem::sp_item_private_snappoints(SPItem const * /*item*/, std::vector<Inkscape::SnapCandidatePoint> &/*p*/, Inkscape::SnapPreferences const * /*snapprefs*/) +//{ /* This will only be called if the derived class doesn't override this. * see for example sp_genericellipse_snappoints in sp-ellipse.cpp * We don't know what shape we could be dealing with here, so we'll just * do nothing */ -} +//} void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const { @@ -1017,10 +1017,10 @@ gchar* CItem::onDescription() { } // CPPIFY: remove -gchar *SPItem::sp_item_private_description(SPItem *item) -{ - return item->citem->onDescription(); -} +//gchar *SPItem::sp_item_private_description(SPItem *item) +//{ +// return item->citem->onDescription(); +//} /** * Returns a string suitable for status bar, formatted in pango markup language. diff --git a/src/sp-item.h b/src/sp-item.h index 69300e093..d28769b2c 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -238,8 +238,8 @@ private: static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); - static gchar *sp_item_private_description(SPItem *item); - static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs); +// static gchar *sp_item_private_description(SPItem *item); +// static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs); static SPItemView *sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, Inkscape::DrawingItem *arenaitem); static SPItemView *sp_item_view_list_remove(SPItemView *list, SPItemView *view); @@ -255,32 +255,32 @@ class SPItemClass { public: SPObjectClass parent_class; - /** BBox union in given coordinate system */ - Geom::OptRect (* bbox) (SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type); - - /** Printing method. Assumes ctm is set to item affine matrix */ - /* \todo Think about it, and maybe implement generic export method instead (Lauris) */ - void (* print) (SPItem *item, SPPrintContext *ctx); - - /** Give short description of item (for status display) */ - gchar * (* description) (SPItem * item); - - Inkscape::DrawingItem * (* show) (SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); - void (* hide) (SPItem *item, unsigned int key); - - /** Write to an iterator the points that should be considered for snapping - * as the item's `nodes'. - */ - void (* snappoints) (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs); - - /** Apply the transform optimally, and return any residual transformation */ - Geom::Affine (* set_transform)(SPItem *item, Geom::Affine const &transform); - - /** Convert the item to guidelines */ - void (* convert_to_guides)(SPItem *item); - - /** Emit event, if applicable */ - gint (* event) (SPItem *item, SPEvent *event); +// /** BBox union in given coordinate system */ +// Geom::OptRect (* bbox) (SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type); +// +// /** Printing method. Assumes ctm is set to item affine matrix */ +// /* \todo Think about it, and maybe implement generic export method instead (Lauris) */ +// void (* print) (SPItem *item, SPPrintContext *ctx); +// +// /** Give short description of item (for status display) */ +// gchar * (* description) (SPItem * item); +// +// Inkscape::DrawingItem * (* show) (SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); +// void (* hide) (SPItem *item, unsigned int key); +// +// /** Write to an iterator the points that should be considered for snapping +// * as the item's `nodes'. +// */ +// void (* snappoints) (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs); +// +// /** Apply the transform optimally, and return any residual transformation */ +// Geom::Affine (* set_transform)(SPItem *item, Geom::Affine const &transform); +// +// /** Convert the item to guidelines */ +// void (* convert_to_guides)(SPItem *item); +// +// /** Emit event, if applicable */ +// gint (* event) (SPItem *item, SPEvent *event); private: static SPObjectClass *static_parent_class; diff --git a/src/sp-line.cpp b/src/sp-line.cpp index b39117d9e..4d017cf49 100644 --- a/src/sp-line.cpp +++ b/src/sp-line.cpp @@ -58,9 +58,9 @@ void SPLineClass::sp_line_class_init(SPLineClass *klass) sp_object_class->write = SPLine::write; SPItemClass *item_class = (SPItemClass *) klass; - item_class->description = SPLine::getDescription; - item_class->set_transform = SPLine::setTransform; - item_class->convert_to_guides = SPLine::convertToGuides; +// item_class->description = SPLine::getDescription; +// item_class->set_transform = SPLine::setTransform; +// item_class->convert_to_guides = SPLine::convertToGuides; sp_object_class->update = SPLine::update; diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index 08a57234b..652f4fdb7 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -156,8 +156,8 @@ sp_offset_class_init(SPOffsetClass *klass) sp_object_class->update = sp_offset_update; sp_object_class->release = sp_offset_release; - item_class->description = sp_offset_description; - item_class->snappoints = sp_offset_snappoints; +// item_class->description = sp_offset_description; +// item_class->snappoints = sp_offset_snappoints; //shape_class->set_shape = sp_offset_set_shape; } diff --git a/src/sp-path.cpp b/src/sp-path.cpp index d68e87d29..f96e516b7 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -116,9 +116,9 @@ sp_path_class_init(SPPathClass * klass) sp_object_class->write = sp_path_write; sp_object_class->update = sp_path_update; - item_class->description = sp_path_description; - item_class->set_transform = sp_path_set_transform; - item_class->convert_to_guides = sp_path_convert_to_guides; +// item_class->description = sp_path_description; +// item_class->set_transform = sp_path_set_transform; +// item_class->convert_to_guides = sp_path_convert_to_guides; //lpe_item_class->update_patheffect = sp_path_update_patheffect; } diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp index 8aa66f15f..ee930c691 100644 --- a/src/sp-polygon.cpp +++ b/src/sp-polygon.cpp @@ -69,7 +69,7 @@ static void sp_polygon_class_init(SPPolygonClass *pc) sp_object_class->write = sp_polygon_write; sp_object_class->set = sp_polygon_set; - item_class->description = sp_polygon_description; +// item_class->description = sp_polygon_description; } CPolygon::CPolygon(SPPolygon* polygon) : CShape(polygon) { diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp index 16980bcb6..111bca390 100644 --- a/src/sp-polyline.cpp +++ b/src/sp-polyline.cpp @@ -56,7 +56,7 @@ void SPPolyLineClass::sp_polyline_class_init(SPPolyLineClass *klass) sp_object_class->set = SPPolyLine::set; sp_object_class->write = SPPolyLine::write; - item_class->description = SPPolyLine::getDescription; +// item_class->description = SPPolyLine::getDescription; } CPolyLine::CPolyLine(SPPolyLine* polyline) : CShape(polyline) { diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index cf814ccb6..f0363d9a8 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -85,10 +85,10 @@ sp_rect_class_init(SPRectClass *klass) sp_object_class->set = sp_rect_set; sp_object_class->update = sp_rect_update; - item_class->description = sp_rect_description; - item_class->set_transform = sp_rect_set_transform; - item_class->convert_to_guides = sp_rect_convert_to_guides; - item_class->snappoints = sp_rect_snappoints; //override the default sp_shape_snappoints; see sp_rect_snappoints for details +// item_class->description = sp_rect_description; +// item_class->set_transform = sp_rect_set_transform; +// item_class->convert_to_guides = sp_rect_convert_to_guides; +// item_class->snappoints = sp_rect_snappoints; //override the default sp_shape_snappoints; see sp_rect_snappoints for details //shape_class->set_shape = sp_rect_set_shape; } diff --git a/src/sp-root.cpp b/src/sp-root.cpp index 2b1ab3884..96b9f4ef9 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -92,8 +92,8 @@ static void sp_root_class_init(SPRootClass *klass) sp_object_class->modified = sp_root_modified; sp_object_class->write = sp_root_write; - sp_item_class->show = sp_root_show; - sp_item_class->print = sp_root_print; +// sp_item_class->show = sp_root_show; +// sp_item_class->print = sp_root_print; } CRoot::CRoot(SPRoot* root) : CGroup(root) { @@ -673,9 +673,11 @@ void CRoot::onPrint(SPPrintContext* ctx) { sp_print_bind(ctx, root->c2p, 1.0); - if (((SPItemClass *) (parent_class))->print) { - ((SPItemClass *) (parent_class))->print(item, ctx); - } +// if (((SPItemClass *) (parent_class))->print) { +// ((SPItemClass *) (parent_class))->print(item, ctx); +// } + // CPPIFY: correct one? + CGroup::onPrint(ctx); sp_print_release(ctx); } diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 64ddff20e..9fa338f8f 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -101,11 +101,11 @@ void SPShapeClass::sp_shape_class_init(SPShapeClass *klass) sp_object_class->modified = SPShape::sp_shape_modified; sp_object_class->write = SPShape::sp_shape_write; - item_class->bbox = SPShape::sp_shape_bbox; - item_class->print = sp_shape_print; - item_class->show = SPShape::sp_shape_show; - item_class->hide = SPShape::sp_shape_hide; - item_class->snappoints = SPShape::sp_shape_snappoints; +// item_class->bbox = SPShape::sp_shape_bbox; +// item_class->print = sp_shape_print; +// item_class->show = SPShape::sp_shape_show; +// item_class->hide = SPShape::sp_shape_hide; +// item_class->snappoints = SPShape::sp_shape_snappoints; //lpe_item_class->update_patheffect = NULL; diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index d549c2192..f6663ca12 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -89,8 +89,8 @@ static void sp_spiral_class_init(SPSpiralClass *klass) sp_object_class->set = sp_spiral_set; sp_object_class->update = sp_spiral_update; - item_class->description = sp_spiral_description; - item_class->snappoints = sp_spiral_snappoints; +// item_class->description = sp_spiral_description; +// item_class->snappoints = sp_spiral_snappoints; //lpe_item_class->update_patheffect = sp_spiral_update_patheffect; diff --git a/src/sp-star.cpp b/src/sp-star.cpp index fca4d6f35..cbc4d4520 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -83,8 +83,8 @@ static void sp_star_class_init(SPStarClass *klass) sp_object_class->set = sp_star_set; sp_object_class->update = sp_star_update; - item_class->description = sp_star_description; - item_class->snappoints = sp_star_snappoints; +// item_class->description = sp_star_description; +// item_class->snappoints = sp_star_snappoints; //lpe_item_class->update_patheffect = sp_star_update_patheffect; diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index bd8a0ea53..11c14bc4e 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -79,10 +79,10 @@ static void sp_symbol_class_init(SPSymbolClass *klass) sp_object_class->modified = sp_symbol_modified; sp_object_class->write = sp_symbol_write; - sp_item_class->show = sp_symbol_show; - sp_item_class->hide = sp_symbol_hide; - sp_item_class->bbox = sp_symbol_bbox; - sp_item_class->print = sp_symbol_print; +// sp_item_class->show = sp_symbol_show; +// sp_item_class->hide = sp_symbol_hide; +// sp_item_class->bbox = sp_symbol_bbox; +// sp_item_class->print = sp_symbol_print; } CSymbol::CSymbol(SPSymbol* symbol) : CGroup(symbol) { diff --git a/src/sp-text.cpp b/src/sp-text.cpp index d9c4df702..56b76a94f 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -123,13 +123,13 @@ sp_text_class_init (SPTextClass *classname) sp_object_class->modified = sp_text_modified; sp_object_class->write = sp_text_write; - item_class->bbox = sp_text_bbox; - item_class->show = sp_text_show; - item_class->hide = sp_text_hide; - item_class->description = sp_text_description; - item_class->snappoints = sp_text_snappoints; - item_class->set_transform = sp_text_set_transform; - item_class->print = sp_text_print; +// item_class->bbox = sp_text_bbox; +// item_class->show = sp_text_show; +// item_class->hide = sp_text_hide; +// item_class->description = sp_text_description; +// item_class->snappoints = sp_text_snappoints; +// item_class->set_transform = sp_text_set_transform; +// item_class->print = sp_text_print; } CText::CText(SPText* text) : CItem(text) { diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp index 0c7e52d60..4296fd416 100644 --- a/src/sp-tref.cpp +++ b/src/sp-tref.cpp @@ -111,8 +111,8 @@ sp_tref_class_init(SPTRefClass *tref_class) SPItemClass *item_class = (SPItemClass *) tref_class; - item_class->bbox = sp_tref_bbox; - item_class->description = sp_tref_description; +// item_class->bbox = sp_tref_bbox; +// item_class->description = sp_tref_description; } CTRef::CTRef(SPTRef* tref) : CItem(tref) { diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp index 3a83cb70d..e94733dee 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -105,8 +105,8 @@ sp_tspan_class_init(SPTSpanClass *classname) sp_object_class->modified = sp_tspan_modified; sp_object_class->write = sp_tspan_write; - item_class->bbox = sp_tspan_bbox; - item_class->description = sp_tspan_description; +// item_class->bbox = sp_tspan_bbox; +// item_class->description = sp_tspan_description; } CTSpan::CTSpan(SPTSpan* span) : CItem(span) { diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 1abda0d05..a7e3a7b36 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -105,12 +105,12 @@ sp_use_class_init(SPUseClass *classname) sp_object_class->update = sp_use_update; sp_object_class->modified = sp_use_modified; - item_class->bbox = sp_use_bbox; - item_class->description = sp_use_description; - item_class->print = sp_use_print; - item_class->show = sp_use_show; - item_class->hide = sp_use_hide; - item_class->snappoints = sp_use_snappoints; +// item_class->bbox = sp_use_bbox; +// item_class->description = sp_use_description; +// item_class->print = sp_use_print; +// item_class->show = sp_use_show; +// item_class->hide = sp_use_hide; +// item_class->snappoints = sp_use_snappoints; } CUse::CUse(SPUse* use) : CItem(use) { |
