diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2010-12-12 08:40:34 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2010-12-12 08:40:34 +0000 |
| commit | aadfea4113abc6863d7ab03d21b973802c41c503 (patch) | |
| tree | 3f890c0c112433fd850d59558208addf1baa85da /src/ui/dialog/swatches.cpp | |
| parent | Pot and Dutch translation update (diff) | |
| parent | A simple layout document as to what, why and how is cppification. (diff) | |
| download | inkscape-aadfea4113abc6863d7ab03d21b973802c41c503.tar.gz inkscape-aadfea4113abc6863d7ab03d21b973802c41c503.zip | |
Merge and cleanup of GSoC C++-ification project.
(bzr r9945.1.1)
Diffstat (limited to 'src/ui/dialog/swatches.cpp')
| -rw-r--r-- | src/ui/dialog/swatches.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 4c8a018fa..b2b1b26da 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -5,6 +5,7 @@ /* Authors: * Jon A. Cruz * John Bintz + * Abhishek Sharma * * Copyright (C) 2005 Jon A. Cruz * Copyright (C) 2008 John Bintz @@ -155,7 +156,7 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) SPDocument *doc = desktop ? desktop->doc() : 0; if (doc) { std::string targetName(bounceTarget->def.descr); - const GSList *gradients = sp_document_get_resource_list(doc, "gradient"); + const GSList *gradients = doc->getResourceList("gradient"); for (const GSList *item = gradients; item; item = item->next) { SPGradient* grad = SP_GRADIENT(item->data); if ( targetName == grad->getId() ) { @@ -177,13 +178,13 @@ void SwatchesPanelHook::convertGradient( GtkMenuItem * /*menuitem*/, gpointer us if ( doc && (index >= 0) && (static_cast<guint>(index) < popupItems.size()) ) { Glib::ustring targetName = popupItems[index]; - const GSList *gradients = sp_document_get_resource_list(doc, "gradient"); + const GSList *gradients = doc->getResourceList("gradient"); for (const GSList *item = gradients; item; item = item->next) { SPGradient* grad = SP_GRADIENT(item->data); if ( targetName == grad->getId() ) { grad->setSwatch(); - sp_document_done(doc, SP_VERB_CONTEXT_GRADIENT, - _("Add gradient stop")); + DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, + _("Add gradient stop")); break; } } @@ -199,13 +200,13 @@ void SwatchesPanelHook::deleteGradient( GtkMenuItem */*menuitem*/, gpointer /*us SPDocument *doc = desktop ? desktop->doc() : 0; if (doc) { std::string targetName(bounceTarget->def.descr); - const GSList *gradients = sp_document_get_resource_list(doc, "gradient"); + const GSList *gradients = doc->getResourceList("gradient"); for (const GSList *item = gradients; item; item = item->next) { SPGradient* grad = SP_GRADIENT(item->data); if ( targetName == grad->getId() ) { grad->setSwatch(false); - sp_document_done(doc, SP_VERB_CONTEXT_GRADIENT, - _("Delete")); + DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, + _("Delete")); break; } } @@ -320,7 +321,7 @@ gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, g SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt); if ( dtw && dtw->desktop ) { // Pick up all gradients with vectors - const GSList *gradients = sp_document_get_resource_list(dtw->desktop->doc(), "gradient"); + const GSList *gradients = (dtw->desktop->doc())->getResourceList("gradient"); gint index = 0; for (const GSList *curr = gradients; curr; curr = curr->next) { SPGradient* grad = SP_GRADIENT(curr->data); @@ -773,7 +774,7 @@ void SwatchesPanel::_trackDocument( SwatchesPanel *panel, SPDocument *document ) } docPerPanel[panel] = document; if (!found) { - sigc::connection conn1 = sp_document_resources_changed_connect( document, "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) ); + sigc::connection conn1 = document->connectResourcesChanged( "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) ); sigc::connection conn2 = SP_DOCUMENT_DEFS(document)->connectRelease( sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document)) ); sigc::connection conn3 = SP_DOCUMENT_DEFS(document)->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document))) ); @@ -811,7 +812,7 @@ static void recalcSwatchContents(SPDocument* doc, { std::vector<SPGradient*> newList; - const GSList *gradients = sp_document_get_resource_list(doc, "gradient"); + const GSList *gradients = doc->getResourceList("gradient"); for (const GSList *item = gradients; item; item = item->next) { SPGradient* grad = SP_GRADIENT(item->data); if ( grad->isSwatch() ) { @@ -967,7 +968,8 @@ void SwatchesPanel::_updateFromSelection() } } if ( target ) { - gchar const* id = target->repr->attribute("id"); + //XML Tree being used directly here while it shouldn't be + gchar const* id = target->getRepr()->attribute("id"); if ( id ) { fillId = id; } @@ -998,7 +1000,8 @@ void SwatchesPanel::_updateFromSelection() } } if ( target ) { - gchar const* id = target->repr->attribute("id"); + //XML Tree being used directly here while it shouldn't be + gchar const* id = target->getRepr()->attribute("id"); if ( id ) { strokeId = id; } |
