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/clonetiler.cpp | 13 ++++++------- src/dialogs/export.cpp | 8 ++++---- src/dialogs/spellcheck.cpp | 6 +++--- 3 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 55884fe4a..550370e90 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -851,7 +851,7 @@ clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) for (SPObject *o = sp_object_first_child(from); o != NULL; o = SP_OBJECT_NEXT(o)) { if (SP_IS_ITEM(o) && clonetiler_is_a_clone_of (o, NULL)) - sp_item_invoke_hide(SP_ITEM(o), trace_visionkey); // FIXME: hide each tiled clone's original too! + SP_ITEM(o)->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too! clonetiler_trace_hide_tiled_clones_recursively (o); } } @@ -861,13 +861,12 @@ clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original) { trace_arena = NRArena::create(); /* Create ArenaItem and set transform */ - trace_visionkey = sp_item_display_key_new(1); + trace_visionkey = SPItem::display_key_new(1); trace_doc = doc; - trace_root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT (trace_doc)), - (NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY); + trace_root = SP_ITEM(SP_DOCUMENT_ROOT (trace_doc))->invoke_show((NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY); // hide the (current) original and any tiled clones, we only want to pick the background - sp_item_invoke_hide(original, trace_visionkey); + original->invoke_hide(trace_visionkey); clonetiler_trace_hide_tiled_clones_recursively (SP_OBJECT(SP_DOCUMENT_ROOT (trace_doc))); sp_document_root (trace_doc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -954,7 +953,7 @@ static void clonetiler_trace_finish () { if (trace_doc) { - sp_item_invoke_hide(SP_ITEM(sp_document_root(trace_doc)), trace_visionkey); + SP_ITEM(sp_document_root(trace_doc))->invoke_hide(trace_visionkey); } if (trace_arena) { ((NRObject *) trace_arena)->unreference(); @@ -1232,7 +1231,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) bool prefs_bbox = prefs->getBool("/tools/bounding_box", false); SPItem::BBoxType bbox_type = ( prefs_bbox ? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX ); - Geom::OptRect r = SP_ITEM(obj)->getBounds(sp_item_i2doc_affine(SP_ITEM(obj)), + Geom::OptRect r = SP_ITEM(obj)->getBounds(SP_ITEM(obj)->i2doc_affine(), bbox_type); if (r) { w = r->dimensions()[Geom::X]; 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) ) { diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 1645218c6..24890f8eb 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -236,8 +236,8 @@ gint compare_text_bboxes (gconstpointer a, gconstpointer b) SPItem *i1 = SP_ITEM(a); SPItem *i2 = SP_ITEM(b); - Geom::OptRect bbox1 = i1->getBounds(sp_item_i2d_affine(i1)); - Geom::OptRect bbox2 = i2->getBounds(sp_item_i2d_affine(i2)); + Geom::OptRect bbox1 = i1->getBounds(i1->i2d_affine()); + Geom::OptRect bbox2 = i2->getBounds(i2->i2d_affine()); if (!bbox1 || !bbox2) { return 0; } @@ -570,7 +570,7 @@ spellcheck_next_word() // draw rect std::vector points = - _layout->createSelectionShape(_begin_w, _end_w, sp_item_i2d_affine(_text)); + _layout->createSelectionShape(_begin_w, _end_w, _text->i2d_affine()); Geom::Point tl, br; tl = br = points.front(); for (unsigned i = 0 ; i < points.size() ; i ++) { -- 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/clonetiler.cpp | 6 +++--- src/dialogs/export.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 550370e90..8dd59425a 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -870,7 +870,7 @@ clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original) clonetiler_trace_hide_tiled_clones_recursively (SP_OBJECT(SP_DOCUMENT_ROOT (trace_doc))); sp_document_root (trace_doc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - sp_document_ensure_up_to_date(trace_doc); + trace_doc->ensure_up_to_date(); trace_zoom = zoom; } @@ -987,7 +987,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) } } - sp_document_ensure_up_to_date(sp_desktop_document(desktop)); + sp_desktop_document(desktop)->ensure_up_to_date(); unclump (to_unclump); @@ -1480,7 +1480,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) double radius = blur * perimeter; // this is necessary for all newly added clones to have correct bboxes, // otherwise filters won't work: - sp_document_ensure_up_to_date(sp_desktop_document(desktop)); + sp_desktop_document(desktop)->ensure_up_to_date(); // it's hard to figure out exact width/height of the tile without having an object // that we can take bbox of; however here we only need a lower bound so that blur // margins are not too small, and the perimeter should work 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/clonetiler.cpp | 6 +++--- src/dialogs/export.cpp | 12 ++++++------ src/dialogs/item-properties.cpp | 12 ++++++------ src/dialogs/spellcheck.cpp | 2 +- src/dialogs/text-edit.cpp | 2 +- src/dialogs/xml-tree.cpp | 24 ++++++++++++------------ 6 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 8dd59425a..b1c1cf74a 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -993,7 +993,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) g_slist_free (to_unclump); - sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER, _("Unclump tiled clones")); } @@ -1046,7 +1046,7 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) clonetiler_change_selection (NULL, selection, dlg); if (do_undo) - sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER, _("Delete tiled clones")); } @@ -1510,7 +1510,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) desktop->clearWaitingCursor(); - sp_document_done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, _("Create tiled clones")); } 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(); diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index abc45b44b..8d2b15e44 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -398,7 +398,7 @@ sp_item_widget_sensitivity_toggled (GtkWidget *widget, SPWidget *spw) item->setLocked(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))); - sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, + SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))? _("Lock object") : _("Unlock object")); gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE)); @@ -417,7 +417,7 @@ sp_item_widget_hidden_toggled(GtkWidget *widget, SPWidget *spw) item->setExplicitlyHidden(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); - sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, + SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))? _("Hide object") : _("Unhide object")); gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE)); @@ -450,7 +450,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id")); SP_EXCEPTION_INIT (&ex); sp_object_setAttribute (SP_OBJECT (item), "id", id, &ex); - sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, + SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object ID")); } @@ -465,7 +465,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) SPObject *obj = (SPObject*)item; if (strcmp (label, obj->defaultLabel())) { obj->setLabel(label); - sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, + SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object label")); } @@ -473,7 +473,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) GtkWidget *w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "title")); gchar *title = (gchar *)gtk_entry_get_text(GTK_ENTRY (w)); if (obj->setTitle(title)) - sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, + SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object title")); /* Retrieve the description */ @@ -483,7 +483,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) gtk_text_buffer_get_bounds(buf, &start, &end); gchar *desc = gtk_text_buffer_get_text(buf, &start, &end, TRUE); if (obj->setDesc(desc)) - sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, + SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object description")); g_free(desc); diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 24890f8eb..5372a8bb5 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -777,7 +777,7 @@ sp_spellcheck_accept (GObject *, GObject *dlg) // find the end of the word anew _end_w = _begin_w; _end_w.nextEndOfWord(); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_TEXT, _("Fix spelling")); } } diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index dc71de7c3..ab0de514a 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -661,7 +661,7 @@ sp_text_edit_dialog_apply( GtkButton */*button*/, GtkWidget *dlg ) } // complete the transaction - sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, _("Set text style")); gtk_widget_set_sensitive (apply, FALSE); sp_repr_css_attr_unref (css); diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index c8644fef9..515b49360 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -870,10 +870,10 @@ void after_tree_move(GtkCTree */*tree*/, if (GTK_CTREE_ROW(node)->parent == new_parent && GTK_CTREE_ROW(node)->sibling == new_sibling) { - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Drag XML subtree")); } else { - sp_document_cancel(current_document); + SPDocumentUndo::cancel(current_document); } } @@ -1371,7 +1371,7 @@ void cmd_new_element_node(GtkObject */*object*/, gpointer /*data*/) set_tree_select(new_repr); set_dt_select(new_repr); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Create new element node")); } @@ -1387,7 +1387,7 @@ void cmd_new_text_node(GtkObject */*object*/, gpointer /*data*/) Inkscape::XML::Node *text = xml_doc->createTextNode(""); selected_repr->appendChild(text); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Create new text node")); set_tree_select(text); @@ -1405,7 +1405,7 @@ void cmd_duplicate_node(GtkObject */*object*/, gpointer /*data*/) Inkscape::XML::Node *dup = selected_repr->duplicate(parent->document()); parent->addChild(dup, selected_repr); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Duplicate node")); GtkCTreeNode *node = sp_xmlview_tree_get_repr_node(SP_XMLVIEW_TREE(tree), dup); @@ -1422,7 +1422,7 @@ void cmd_delete_node(GtkObject */*object*/, gpointer /*data*/) g_assert(selected_repr != NULL); sp_repr_unparent(selected_repr); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, Q_("nodeAsInXMLinHistoryDialog|Delete node")); } @@ -1440,7 +1440,7 @@ void cmd_delete_attr(GtkObject */*object*/, gpointer /*data*/) updated->updateRepr(); } - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Delete attribute")); } @@ -1469,7 +1469,7 @@ void cmd_set_attr(GtkObject */*object*/, gpointer /*data*/) updated->updateRepr(); } - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Change attribute")); /* TODO: actually, the row won't have been created yet. why? */ @@ -1499,7 +1499,7 @@ void cmd_raise_node(GtkObject */*object*/, gpointer /*data*/) parent->changeOrder(selected_repr, ref); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Raise node")); set_tree_select(selected_repr); @@ -1516,7 +1516,7 @@ void cmd_lower_node(GtkObject */*object*/, gpointer /*data*/) parent->changeOrder(selected_repr, selected_repr->next()); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Lower node")); set_tree_select(selected_repr); @@ -1546,7 +1546,7 @@ void cmd_indent_node(GtkObject */*object*/, gpointer /*data*/) parent->removeChild(repr); prev->addChild(repr, ref); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Indent node")); set_tree_select(repr); set_dt_select(repr); @@ -1567,7 +1567,7 @@ void cmd_unindent_node(GtkObject */*object*/, gpointer /*data*/) parent->removeChild(repr); grandparent->addChild(repr, parent); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Unindent node")); set_tree_select(repr); set_dt_select(repr); -- 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/dialogs/clonetiler.cpp | 8 ++++---- src/dialogs/find.cpp | 2 +- src/dialogs/spellcheck.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index b1c1cf74a..e25f2602b 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -849,7 +849,7 @@ clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) if (!trace_arena) return; - for (SPObject *o = sp_object_first_child(from); o != NULL; o = SP_OBJECT_NEXT(o)) { + for (SPObject *o = from->first_child(); o != NULL; o = SP_OBJECT_NEXT(o)) { if (SP_IS_ITEM(o) && clonetiler_is_a_clone_of (o, NULL)) SP_ITEM(o)->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too! clonetiler_trace_hide_tiled_clones_recursively (o); @@ -981,7 +981,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) GSList *to_unclump = NULL; // not including the original - for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (clonetiler_is_a_clone_of (child, obj)) { to_unclump = g_slist_prepend (to_unclump, child); } @@ -1004,7 +1004,7 @@ clonetiler_number_of_clones (SPObject *obj) guint n = 0; - for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (clonetiler_is_a_clone_of (child, obj)) { n ++; } @@ -1033,7 +1033,7 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) // remove old tiling GSList *to_delete = NULL; - for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (clonetiler_is_a_clone_of (child, obj)) { to_delete = g_slist_prepend (to_delete, child); } diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index ed693f6ed..89b389d44 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -292,7 +292,7 @@ all_items (SPObject *r, GSList *l, bool hidden, bool locked) if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata")) return l; // we're not interested in metadata - for (SPObject *child = sp_object_first_child(r); child; child = SP_OBJECT_NEXT (child)) { + for (SPObject *child = r->first_child(); child; child = SP_OBJECT_NEXT (child)) { if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !desktop->isLayer(SP_ITEM(child))) { if ((hidden || !desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) { l = g_slist_prepend (l, child); diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 5372a8bb5..f95dce0e6 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -203,7 +203,7 @@ all_text_items (SPObject *r, GSList *l, bool hidden, bool locked) if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata")) return l; // we're not interested in metadata - for (SPObject *child = sp_object_first_child(r); child; child = SP_OBJECT_NEXT (child)) { + for (SPObject *child = r->first_child(); child; child = SP_OBJECT_NEXT (child)) { if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !_desktop->isLayer(SP_ITEM(child))) { if ((hidden || !_desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) { if (SP_IS_TEXT(child) || SP_IS_FLOWTEXT(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/dialogs/item-properties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dialogs') diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index 8d2b15e44..d96b364ef 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -449,7 +449,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) SPException ex; gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id")); SP_EXCEPTION_INIT (&ex); - sp_object_setAttribute (SP_OBJECT (item), "id", id, &ex); + SP_OBJECT (item)->setAttribute ("id", id, &ex); SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object ID")); } -- cgit v1.2.3