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/dialogs/export.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dialogs/export.cpp') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 696f38b77..463339534 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -780,7 +780,7 @@ sp_export_selection_modified ( Inkscape::Application */*inkscape*/, if ( SP_ACTIVE_DESKTOP ) { SPDocument *doc; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); - Geom::OptRect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)), SPItem::RENDERING_BBOX); + Geom::OptRect bbox = SP_ITEM (SP_DOCUMENT_ROOT (doc))->getBboxDesktop (SPItem::RENDERING_BBOX); if (bbox) { sp_export_set_area (base, bbox->min()[Geom::X], bbox->min()[Geom::Y], @@ -861,7 +861,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base) /** \todo * This returns wrong values if the document has a viewBox. */ - bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)), SPItem::RENDERING_BBOX); + bbox = SP_ITEM (SP_DOCUMENT_ROOT (doc))->getBboxDesktop (SPItem::RENDERING_BBOX); /* If the drawing is valid, then we'll use it and break otherwise we drop through to the page settings */ if (bbox) { @@ -1127,7 +1127,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) } Geom::OptRect area; - sp_item_invoke_bbox(item, area, sp_item_i2d_affine((SPItem *) item), TRUE); + item->invoke_bbox( area, static_cast(item)->i2d_affine(), TRUE); if (area) { gint width = (gint) (area->width() * dpi / PX_PER_IN + 0.5); gint height = (gint) (area->height() * dpi / PX_PER_IN + 0.5); @@ -1498,7 +1498,7 @@ sp_export_detect_size(GtkObject * base) { case SELECTION_DRAWING: { SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); - Geom::OptRect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)), SPItem::RENDERING_BBOX); + Geom::OptRect bbox = SP_ITEM (SP_DOCUMENT_ROOT (doc))->getBboxDesktop (SPItem::RENDERING_BBOX); // std::cout << "Drawing " << bbox2; if ( bbox && sp_export_bbox_equal(*bbox,current_bbox) ) { -- 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/dialogs/export.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dialogs/export.cpp') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 463339534..6513813cc 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -871,7 +871,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base) } case SELECTION_PAGE: bbox = Geom::Rect(Geom::Point(0.0, 0.0), - Geom::Point(sp_document_width(doc), sp_document_height(doc))); + Geom::Point(doc->getWidth(), doc->getHeight())); // std::cout << "Using selection: PAGE" << std::endl; key = SELECTION_PAGE; @@ -1513,8 +1513,8 @@ sp_export_detect_size(GtkObject * base) { doc = sp_desktop_document (SP_ACTIVE_DESKTOP); Geom::Point x(0.0, 0.0); - Geom::Point y(sp_document_width(doc), - sp_document_height(doc)); + Geom::Point y(doc->getWidth(), + doc->getHeight()); Geom::Rect bbox(x, y); // std::cout << "Page " << bbox; -- 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/dialogs/export.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/dialogs/export.cpp') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 6513813cc..649918742 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -1243,8 +1243,8 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) bool modified = false; const gchar * temp_string; - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); temp_string = repr->attribute("inkscape:export-filename"); if (temp_string == NULL || strcmp(temp_string, filename_ext)) { @@ -1261,7 +1261,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi); modified = true; } - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); if (modified) { doc->setModifiedSinceSave(); @@ -1273,8 +1273,8 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) SPDocument * doc = SP_ACTIVE_DOCUMENT; bool modified = false; - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList(); for(; reprlst != NULL; reprlst = reprlst->next) { @@ -1302,7 +1302,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) modified = true; } } - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); if (modified) { doc->setModifiedSinceSave(); -- cgit v1.2.3