diff options
| author | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | 2010-06-29 18:05:42 +0000 |
|---|---|---|
| committer | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | 2010-06-29 18:05:42 +0000 |
| commit | 8867de5daf309e4cdd3fce177b408618490be4f3 (patch) | |
| tree | 19a528d472e7a63f9cab97daa5c979d977db821b /src/widgets | |
| parent | minor fix in Dutch translation of win32 installer (diff) | |
| download | inkscape-8867de5daf309e4cdd3fce177b408618490be4f3.tar.gz inkscape-8867de5daf309e4cdd3fce177b408618490be4f3.zip | |
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)
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 14 | ||||
| -rw-r--r-- | src/widgets/icon.cpp | 9 | ||||
| -rw-r--r-- | src/widgets/paint-selector.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/stroke-style.cpp | 12 |
4 files changed, 18 insertions, 19 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 36047e81b..dfb22b6d0 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -879,12 +879,12 @@ SPDesktopWidget::shutdown() { Gtk::Window *window = (Gtk::Window*)gtk_object_get_data (GTK_OBJECT(this), "window"); - sp_document_ref(doc); + doc->doRef(); sp_namedview_document_from_window(desktop); if (sp_file_save_document(*window, doc)) { - sp_document_unref(doc); + doc->doUnref(); } else { // save dialog cancelled or save failed - sp_document_unref(doc); + doc->doUnref(); return TRUE; } @@ -937,14 +937,14 @@ SPDesktopWidget::shutdown() switch (response) { case GTK_RESPONSE_YES: { - sp_document_ref(doc); + doc->doRef(); Gtk::Window *window = (Gtk::Window*)gtk_object_get_data (GTK_OBJECT(this), "window"); if (sp_file_save_dialog(*window, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG)) { - sp_document_unref(doc); + doc->doUnref(); } else { // save dialog cancelled or save failed - sp_document_unref(doc); + doc->doUnref(); return TRUE; } @@ -1806,7 +1806,7 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale) Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); SPObject* root = doc->root; SPItem* item = SP_ITEM(root); - Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item)); + Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop()); /* Canvas region we always show unconditionally */ Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64), diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 5d91d3532..e90cc1c46 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -918,7 +918,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, SPObject *object = doc->getObjectById(name); if (object && SP_IS_ITEM(object)) { /* Find bbox in document */ - Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); + Geom::Matrix const i2doc(SP_ITEM(object)->i2doc_affine()); Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc); if ( SP_OBJECT_PARENT(object) == NULL ) @@ -1105,7 +1105,7 @@ static guchar *load_svg_pixels(gchar const *name, /* Try to load from document. */ if (!info && Inkscape::IO::file_test( doc_filename, G_FILE_TEST_IS_REGULAR ) && - (doc = sp_document_new( doc_filename, FALSE )) ) { + (doc = SPDocument::createDoc( doc_filename, FALSE )) ) { //g_message("Loaded icon file %s", doc_filename); // prep the document @@ -1113,7 +1113,7 @@ static guchar *load_svg_pixels(gchar const *name, /* Create new arena */ NRArena *arena = NRArena::create(); /* Create ArenaItem and set transform */ - unsigned visionkey = sp_item_display_key_new(1); + unsigned visionkey = SPItem::display_key_new(1); /* fixme: Memory manage root if needed (Lauris) */ // This needs to be fixed indeed; this leads to a memory leak of a few megabytes these days // because shapes are being rendered which are not being freed @@ -1135,8 +1135,7 @@ static guchar *load_svg_pixels(gchar const *name, ==7014== by 0x5E9DDE: nr_arena_group_render(_cairo*, NRArenaItem*, NRRectL*, NRPixBlock*, unsigned int) (nr-arena-group.cpp:228) ==7014== by 0x5E72FB: nr_arena_item_invoke_render(_cairo*, NRArenaItem*, NRRectL const*, NRPixBlock*, unsigned int) (nr-arena-item.cpp:578) */ - root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT(doc)), - arena, visionkey, SP_ITEM_SHOW_DISPLAY ); + root = SP_ITEM(SP_DOCUMENT_ROOT(doc))->invoke_show(arena, visionkey, SP_ITEM_SHOW_DISPLAY ); // store into the cache info = new svg_doc_cache_t; diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 8759854a0..55dc80f6f 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -875,7 +875,7 @@ ink_pattern_menu_populate_menu(GtkWidget *m, SPDocument *doc) if (patterns_doc == NULL) { char *patterns_source = g_build_filename(INKSCAPE_PATTERNSDIR, "patterns.svg", NULL); if (Inkscape::IO::file_test(patterns_source, G_FILE_TEST_IS_REGULAR)) { - patterns_doc = sp_document_new(patterns_source, FALSE); + patterns_doc = SPDocument::createDoc(patterns_source, FALSE); } g_free(patterns_source); } diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index f020b0c3a..a8c0788e6 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -182,7 +182,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, return NULL; // sandbox broken? // Find object's bbox in document - Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); + Geom::Matrix const i2doc(SP_ITEM(object)->i2doc_affine()); Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc); if (!dbox) { @@ -242,8 +242,8 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD { // Do this here, outside of loop, to speed up preview generation: NRArena const *arena = NRArena::create(); - unsigned const visionkey = sp_item_display_key_new(1); - NRArenaItem *root = sp_item_invoke_show(SP_ITEM(SP_DOCUMENT_ROOT (sandbox)), (NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY); + unsigned const visionkey = SPItem::display_key_new(1); + NRArenaItem *root = SP_ITEM(SP_DOCUMENT_ROOT (sandbox))->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY); for (; marker_list != NULL; marker_list = marker_list->next) { Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) marker_list->data); @@ -280,7 +280,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD m->append(*i); } - sp_item_invoke_hide(SP_ITEM(sp_document_root(sandbox)), visionkey); + SP_ITEM(sp_document_root(sandbox))->invoke_hide(visionkey); nr_object_unref((NRObject *) arena); } @@ -342,7 +342,7 @@ gchar const *buffer = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:sodipodi= "</svg>"; - return sp_document_new_from_mem (buffer, strlen(buffer), FALSE); + return SPDocument::createDocFromMem (buffer, strlen(buffer), FALSE); } static void @@ -373,7 +373,7 @@ ink_marker_menu_create_menu(Gtk::Menu *m, gchar const *menu_id, SPDocument *doc, if (markers_doc == NULL) { char *markers_source = g_build_filename(INKSCAPE_MARKERSDIR, "markers.svg", NULL); if (Inkscape::IO::file_test(markers_source, G_FILE_TEST_IS_REGULAR)) { - markers_doc = sp_document_new(markers_source, FALSE); + markers_doc = SPDocument::createDoc(markers_source, FALSE); } g_free(markers_source); } |
