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/text-chemistry.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/text-chemistry.cpp') diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index f574b69fb..166799e38 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -133,7 +133,7 @@ text_put_on_path() parent->appendChild(repr); SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); - sp_item_write_transform(new_item, repr, text->transform); + new_item->doWriteTransform(repr, text->transform); SP_OBJECT(new_item)->updateRepr(); Inkscape::GC::release(repr); @@ -433,7 +433,7 @@ text_unflow () rtext->setAttribute("style", SP_OBJECT_REPR(flowtext)->attribute("style")); // fixme: transfer style attrs too; and from descendants NRRect bbox; - sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, sp_item_i2doc_affine(SP_ITEM(flowtext)), TRUE); + SP_ITEM(flowtext)->invoke_bbox( &bbox, SP_ITEM(flowtext)->i2doc_affine(), TRUE); Geom::Point xy(bbox.x0, bbox.y0); if (xy[Geom::X] != 1e18 && xy[Geom::Y] != 1e18) { sp_repr_set_svg_double(rtext, "x", xy[Geom::X]); @@ -518,7 +518,7 @@ flowtext_to_text() parent->addChild(repr, SP_OBJECT_REPR(item)); SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); - sp_item_write_transform(new_item, repr, item->transform); + new_item->doWriteTransform(repr, item->transform); SP_OBJECT(new_item)->updateRepr(); Inkscape::GC::release(repr); -- 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/text-chemistry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/text-chemistry.cpp') diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 166799e38..2cc6e30d9 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -139,7 +139,7 @@ text_put_on_path() Inkscape::GC::release(repr); text->deleteObject(); // delete the orignal flowtext - sp_document_ensure_up_to_date(sp_desktop_document(desktop)); + sp_desktop_document(desktop)->ensure_up_to_date(); selection->clear(); -- 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/text-chemistry.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/text-chemistry.cpp') diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 2cc6e30d9..5af97165e 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -188,7 +188,7 @@ text_put_on_path() SP_OBJECT_REPR(text)->setAttribute("x", NULL); SP_OBJECT_REPR(text)->setAttribute("y", NULL); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Put text on path")); g_slist_free(text_reprs); } @@ -225,7 +225,7 @@ text_remove_from_path() if (!did) { sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No texts-on-paths in the selection.")); } else { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Remove text from path")); selection->setList(g_slist_copy((GSList *) selection->itemList())); // reselect to update statusbar description } @@ -289,7 +289,7 @@ text_remove_all_kerns() if (!did) { sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("Select text(s) to remove kerns from.")); } else { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Remove manual kerns")); } } @@ -377,7 +377,7 @@ text_flow_into_shape() SP_OBJECT(text)->deleteObject (true); - sp_document_done(doc, SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT, _("Flow text into shape")); sp_desktop_selection(desktop)->set(SP_ITEM(root_object)); @@ -473,7 +473,7 @@ text_unflow () g_slist_free (old_objs); g_slist_free (new_objs); - sp_document_done(doc, SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT, _("Unflow flowed text")); } @@ -530,7 +530,7 @@ flowtext_to_text() g_slist_free(items); if (did) { - sp_document_done(sp_desktop_document(desktop), + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, _("Convert flowed text to text")); selection->setReprList(reprs); -- 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/text-chemistry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/text-chemistry.cpp') diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 5af97165e..9d4c23b25 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -215,7 +215,7 @@ text_remove_from_path() continue; } - SPObject *tp = sp_object_first_child(SP_OBJECT(items->data)); + SPObject *tp = SP_OBJECT(items->data)->first_child(); did = true; @@ -252,7 +252,7 @@ text_remove_all_kerns_recursively(SPObject *o) g_strfreev(xa_comma); } - for (SPObject *i = sp_object_first_child(o); i != NULL; i = SP_OBJECT_NEXT(i)) { + for (SPObject *i = o->first_child(); i != NULL; i = SP_OBJECT_NEXT(i)) { text_remove_all_kerns_recursively(i); } } -- cgit v1.2.3