From 8867de5daf309e4cdd3fce177b408618490be4f3 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Tue, 29 Jun 2010 23:35:42 +0530 Subject: This is the first c++ification commit from me. It handles sp-line, sp-polyline, sp-item and marks the onset of document c++ification as well. Users can check performace increase with [/usr/bin/time -v inkscape_binary_with_commandline_options]. (bzr r9546.1.1) --- src/conn-avoid-ref.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/conn-avoid-ref.cpp') diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 88c84a84c..21df27637 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -387,14 +387,14 @@ Geom::Point SPAvoidRef::getConnectionPointPos(const int type, const int id) { g_assert(item); Geom::Point pos; - const Geom::Matrix& transform = sp_item_i2doc_affine(item); + const Geom::Matrix& transform = item->i2doc_affine(); // TODO investigate why this was asking for the active desktop: SPDesktop *desktop = inkscape_active_desktop(); if ( type == ConnPointDefault ) { // For now, just default to the centre of the item - Geom::OptRect bbox = item->getBounds(sp_item_i2doc_affine(item)); + Geom::OptRect bbox = item->getBounds(item->i2doc_affine()); pos = (bbox) ? bbox->midpoint() : Geom::Point(0, 0); } else @@ -504,7 +504,7 @@ static Avoid::Polygon avoid_item_poly(SPItem const *item) g_assert(desktop != NULL); double spacing = desktop->namedview->connector_spacing; - Geom::Matrix itd_mat = sp_item_i2doc_affine(item); + Geom::Matrix itd_mat = item->i2doc_affine(); std::vector hull_points; hull_points = approxItemWithPoints(item, itd_mat); -- cgit v1.2.3 From 121815791be2d24cb745663520b111ee914fbc09 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Thu, 1 Jul 2010 15:36:56 +0530 Subject: C++fied SPDocument added (bzr r9546.1.2) --- src/conn-avoid-ref.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/conn-avoid-ref.cpp') diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 21df27637..15cd97b28 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -196,7 +196,7 @@ void SPAvoidRef::setConnectionPointsAttrUndoable(const gchar* value, const gchar sp_object_setAttribute( SP_OBJECT(item), "inkscape:connection-points", value, 0 ); item->updateRepr(); - sp_document_ensure_up_to_date(doc); + doc->ensure_up_to_date(); sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, action); } -- cgit v1.2.3 From d25a9a072143eafa4a9823b84e977c4b85d45efe Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Fri, 2 Jul 2010 18:05:42 +0530 Subject: New Class SPDocumentUndo created which takes care of c++fying some non SPDocument based methods (bzr r9546.1.3) --- src/conn-avoid-ref.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/conn-avoid-ref.cpp') diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 15cd97b28..70e0c3856 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -197,7 +197,7 @@ void SPAvoidRef::setConnectionPointsAttrUndoable(const gchar* value, const gchar sp_object_setAttribute( SP_OBJECT(item), "inkscape:connection-points", value, 0 ); item->updateRepr(); doc->ensure_up_to_date(); - sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, action); + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, action); } void SPAvoidRef::addConnectionPoint(ConnectionPoint &cp) @@ -589,8 +589,8 @@ void init_avoided_shape_geometry(SPDesktop *desktop) // Don't count this as changes to the document, // it is basically just late initialisation. SPDocument *document = sp_desktop_document(desktop); - bool saved = sp_document_get_undo_sensitive(document); - sp_document_set_undo_sensitive(document, false); + bool saved = SPDocumentUndo::get_undo_sensitive(document); + SPDocumentUndo::set_undo_sensitive(document, false); bool initialised = false; GSList *items = get_avoided_items(NULL, desktop->currentRoot(), desktop, @@ -604,7 +604,7 @@ void init_avoided_shape_geometry(SPDesktop *desktop) if (items) { g_slist_free(items); } - sp_document_set_undo_sensitive(document, saved); + SPDocumentUndo::set_undo_sensitive(document, saved); } -- cgit v1.2.3 From 1aad26aea24f62b63c992118f36b12483f9a5414 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Sat, 3 Jul 2010 22:50:36 +0530 Subject: another c++ification for sp-object.h/cpp and still in progress... (bzr r9546.1.4) --- src/conn-avoid-ref.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/conn-avoid-ref.cpp') diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 70e0c3856..a6ac2387a 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -550,7 +550,7 @@ static Avoid::Polygon avoid_item_poly(SPItem const *item) GSList *get_avoided_items(GSList *list, SPObject *from, SPDesktop *desktop, bool initialised) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(from)) ; + for (SPObject *child = SP_OBJECT(from)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child) && !desktop->isLayer(SP_ITEM(child)) && -- cgit v1.2.3 From 6cc35b45eab6422a6b6f67d621aa259a0a73786f Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Mon, 12 Jul 2010 22:06:46 +0530 Subject: SPObject c++ification finalized along with the beginning of XML Privatisation tweaks (bzr r9546.1.6) --- src/conn-avoid-ref.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/conn-avoid-ref.cpp') diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index a6ac2387a..ed2aceb82 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -194,7 +194,7 @@ void SPAvoidRef::setConnectionPointsAttrUndoable(const gchar* value, const gchar { SPDocument* doc = SP_OBJECT_DOCUMENT(item); - sp_object_setAttribute( SP_OBJECT(item), "inkscape:connection-points", value, 0 ); + SP_OBJECT(item)->setAttribute( "inkscape:connection-points", value, 0 ); item->updateRepr(); doc->ensure_up_to_date(); SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, action); -- cgit v1.2.3 From cde0571b44ec5b108907bda85971c49f3ceb1de8 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Wed, 14 Jul 2010 23:40:35 +0530 Subject: SPShape c++ified to the extent it was possible and more changes done for XML privatisation. Major changes yet to come. (bzr r9546.1.7) --- src/conn-avoid-ref.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/conn-avoid-ref.cpp') diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index ed2aceb82..fd37fceed 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -484,7 +484,7 @@ static std::vector approxItemWithPoints(SPItem const *item, const G } else if (SP_IS_SHAPE(item)) { - SPCurve* item_curve = sp_shape_get_curve(SP_SHAPE(item)); + SPCurve* item_curve = SP_SHAPE(item)->getCurve(); // make sure it has an associated curve if (item_curve) { -- cgit v1.2.3 From 88fc01afa8ea80d5105961d9103cc8f33582e7fb Mon Sep 17 00:00:00 2001 From: Abhishek Sharma public Date: Tue, 20 Jul 2010 16:14:23 +0530 Subject: More on c++ification and some XML privatisation (bzr r9546.1.10) --- src/conn-avoid-ref.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/conn-avoid-ref.cpp') diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index fd37fceed..3e8359c57 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -314,7 +314,8 @@ void SPAvoidRef::handleSettingChange(void) _transformed_connection = item->connectTransformed( sigc::ptr_fun(&avoid_item_move)); - const char *id = SP_OBJECT_REPR(item)->attribute("id"); + //const char *id = SP_OBJECT_REPR(item)->attribute("id"); + const char *id = item->getAttribute("id"); g_assert(id != NULL); // Get a unique ID for the item. -- cgit v1.2.3