summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2010-12-12 09:05:21 +0000
committerJon A. Cruz <jon@joncruz.org>2010-12-12 09:05:21 +0000
commit7ddc9f155a2a0822e2e56d828bbdccc65c141081 (patch)
tree3f890c0c112433fd850d59558208addf1baa85da /src/ui/dialog
parentPot and Dutch translation update (diff)
parentMerge and cleanup of GSoC C++-ification project. (diff)
downloadinkscape-7ddc9f155a2a0822e2e56d828bbdccc65c141081.tar.gz
inkscape-7ddc9f155a2a0822e2e56d828bbdccc65c141081.zip
GSoC C++-ificiation merge and cleanup.
(bzr r9946)
Diffstat (limited to 'src/ui/dialog')
-rw-r--r--src/ui/dialog/aboutbox.cpp11
-rw-r--r--src/ui/dialog/align-and-distribute.cpp66
-rw-r--r--src/ui/dialog/color-item.cpp7
-rw-r--r--src/ui/dialog/document-properties.cpp40
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp13
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp19
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp70
-rw-r--r--src/ui/dialog/find.cpp10
-rw-r--r--src/ui/dialog/glyphs.cpp5
-rw-r--r--src/ui/dialog/guides.cpp13
-rw-r--r--src/ui/dialog/icon-preview.cpp8
-rw-r--r--src/ui/dialog/layer-properties.cpp9
-rw-r--r--src/ui/dialog/layers.cpp11
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp21
-rw-r--r--src/ui/dialog/print.cpp11
-rw-r--r--src/ui/dialog/session-player.cpp3
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp85
-rw-r--r--src/ui/dialog/swatches.cpp27
-rw-r--r--src/ui/dialog/tile.cpp25
-rw-r--r--src/ui/dialog/transformation.cpp31
-rw-r--r--src/ui/dialog/undo-history.cpp11
21 files changed, 276 insertions, 220 deletions
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index 8d467d53f..8db5e7c0b 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -6,6 +6,7 @@
* MenTaLguY <mental@rydia.net>
* Kees Cook <kees@outflux.net>
* Jon Phillips <jon@rejon.org>
+ * Abhishek Sharma
*
* Copyright (C) 2004 Derek P. Moore
* Copyright 2004 Kees Cook
@@ -147,7 +148,7 @@ Gtk::Widget *build_splash_widget() {
// should be in UTF-*8..
char *about=g_build_filename(INKSCAPE_SCREENSDIR, _("about.svg"), NULL);
- SPDocument *doc=sp_document_new (about, TRUE);
+ SPDocument *doc=SPDocument::createNewDoc (about, TRUE);
g_free(about);
g_return_val_if_fail(doc != NULL, NULL);
@@ -155,14 +156,14 @@ Gtk::Widget *build_splash_widget() {
if ( version && SP_IS_TEXT(version) ) {
sp_te_set_repr_text_multiline (SP_TEXT (version), Inkscape::version_string);
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensureUpToDate();
GtkWidget *v=sp_svg_view_widget_new(doc);
- double width=sp_document_width(doc);
- double height=sp_document_height(doc);
+ double width=doc->getWidth();
+ double height=doc->getHeight();
- sp_document_unref(doc);
+ doc->doUnref();
sp_svg_view_widget_set_resize(SP_SVG_VIEW_WIDGET(v), FALSE, (int)width, (int)height);
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index ba8cc939b..48f0fbf22 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -7,6 +7,8 @@
* Frank Felfe <innerspace@iname.com>
* Lauris Kaplinski <lauris@kaplinski.com>
* Tim Dwyer <tgdwyer@gmail.com>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 1999-2004, 2005 Authors
*
@@ -152,7 +154,7 @@ private :
selected.erase(master);
/*}*/
//Compute the anchor point
- Geom::OptRect b = sp_item_bbox_desktop (thing);
+ Geom::OptRect b = thing->getBboxDesktop ();
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
@@ -163,14 +165,13 @@ private :
}
case AlignAndDistribute::PAGE:
- mp = Geom::Point(a.mx1 * sp_document_width(sp_desktop_document(desktop)),
- a.my1 * sp_document_height(sp_desktop_document(desktop)));
+ mp = Geom::Point(a.mx1 * sp_desktop_document(desktop)->getWidth(),
+ a.my1 * sp_desktop_document(desktop)->getHeight());
break;
case AlignAndDistribute::DRAWING:
{
- Geom::OptRect b = sp_item_bbox_desktop
- ( (SPItem *) sp_document_root (sp_desktop_document (desktop)) );
+ Geom::OptRect b = static_cast<SPItem *>( sp_desktop_document(desktop)->getRoot() )->getBboxDesktop();
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
@@ -216,9 +217,9 @@ private :
it != selected.end();
it++)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
+ sp_desktop_document (desktop)->ensureUpToDate();
if (!sel_as_group)
- b = sp_item_bbox_desktop (*it);
+ b = (*it)->getBboxDesktop();
if (b) {
Geom::Point const sp(a.sx0 * b->min()[Geom::X] + a.sx1 * b->max()[Geom::X],
a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]);
@@ -234,8 +235,8 @@ private :
prefs->setInt("/options/clonecompensation/value", saved_compensation);
if (changed) {
- sp_document_done ( sp_desktop_document (desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Align"));
+ DocumentUndo::done( sp_desktop_document(desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Align"));
}
@@ -322,7 +323,7 @@ private :
it != selected.end();
++it)
{
- Geom::OptRect bbox = sp_item_bbox_desktop(*it);
+ Geom::OptRect bbox = (*it)->getBboxDesktop();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, _orientation, _kBegin, _kEnd));
}
@@ -393,8 +394,8 @@ private :
prefs->setInt("/options/clonecompensation/value", saved_compensation);
if (changed) {
- sp_document_done ( sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Distribute"));
+ DocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Distribute"));
}
}
guint _index;
@@ -504,8 +505,8 @@ private :
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Remove overlaps"));
+ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Remove overlaps"));
}
};
@@ -535,8 +536,8 @@ private :
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Arrange connector network"));
+ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Arrange connector network"));
}
};
@@ -628,10 +629,11 @@ private :
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Exchange Positions"));
+ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Exchange Positions"));
}
};
+
// instantiae the private static member
boost::optional<Geom::Point> ActionExchangePositions::center;
@@ -661,8 +663,8 @@ private :
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done (sp_desktop_document (_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Unclump"));
+ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Unclump"));
}
};
@@ -715,8 +717,8 @@ private :
it != selected.end();
++it)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- Geom::OptRect item_box = sp_item_bbox_desktop (*it);
+ sp_desktop_document (desktop)->ensureUpToDate();
+ Geom::OptRect item_box = (*it)->getBboxDesktop ();
if (item_box) {
// find new center, staying within bbox
double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box)[Geom::X].extent() /2 +
@@ -732,8 +734,8 @@ private :
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Randomize positions"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Randomize positions"));
}
};
@@ -801,7 +803,7 @@ private :
Inkscape::Text::Layout const *layout = te_get_layout(*it);
boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
if (pt) {
- Geom::Point base = *pt * sp_item_i2d_affine(*it);
+ Geom::Point base = *pt * (*it)->i2d_affine();
if (base[Geom::X] < b_min[Geom::X]) b_min[Geom::X] = base[Geom::X];
if (base[Geom::Y] < b_min[Geom::Y]) b_min[Geom::Y] = base[Geom::Y];
if (base[Geom::X] > b_max[Geom::X]) b_max[Geom::X] = base[Geom::X];
@@ -831,8 +833,8 @@ private :
}
if (changed) {
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Distribute text baselines"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Distribute text baselines"));
}
} else {
@@ -844,7 +846,7 @@ private :
Inkscape::Text::Layout const *layout = te_get_layout(*it);
boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
if (pt) {
- Geom::Point base = *pt * sp_item_i2d_affine(*it);
+ Geom::Point base = *pt * (*it)->i2d_affine();
Geom::Point t(0.0, 0.0);
t[_orientation] = b_min[_orientation] - base[_orientation];
sp_item_move_rel(*it, Geom::Translate(t));
@@ -854,8 +856,8 @@ private :
}
if (changed) {
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Align text baselines"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ _("Align text baselines"));
}
}
}
@@ -1239,7 +1241,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
{
gdouble max = -1e18;
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
- Geom::OptRect b = sp_item_bbox_desktop (*it);
+ Geom::OptRect b = (*it)->getBboxDesktop ();
if (b) {
gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent();
if (dim > max) {
@@ -1256,7 +1258,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
{
gdouble max = 1e18;
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
- Geom::OptRect b = sp_item_bbox_desktop (*it);
+ Geom::OptRect b = (*it)->getBboxDesktop ();
if (b) {
gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent();
if (dim < max) {
diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp
index 97603a8a2..9f163c00c 100644
--- a/src/ui/dialog/color-item.cpp
+++ b/src/ui/dialog/color-item.cpp
@@ -3,6 +3,7 @@
*/
/* Authors:
* Jon A. Cruz
+ * Abhishek Sharma
*
* Copyright (C) 2010 Jon A. Cruz
*
@@ -458,7 +459,7 @@ void ColorItem::_updatePreviews()
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if ( desktop ) {
SPDocument* document = sp_desktop_document( desktop );
- Inkscape::XML::Node *rroot = sp_document_repr_root( document );
+ Inkscape::XML::Node *rroot = document->getReprRoot();
if ( rroot ) {
// Find where this thing came from
@@ -486,7 +487,7 @@ void ColorItem::_updatePreviews()
str = 0;
if ( bruteForce( document, rroot, paletteName, def.getR(), def.getG(), def.getB() ) ) {
- sp_document_done( document , SP_VERB_DIALOG_SWATCHES,
+ SPDocumentUndo::done( document , SP_VERB_DIALOG_SWATCHES,
_("Change color definition"));
}
}
@@ -720,7 +721,7 @@ void ColorItem::buttonClicked(bool secondary)
sp_desktop_set_style(desktop, css);
sp_repr_css_attr_unref(css);
- sp_document_done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() );
+ DocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() );
}
}
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index f22509496..16212bef7 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -8,6 +8,8 @@
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
* Diederik van Lierop <mail@diedenrezi.nl>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2006-2008 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2000 - 2008 Authors
@@ -404,7 +406,7 @@ DocumentProperties::linkSelectedProfile()
g_warning("No color profile available.");
return;
}
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *cprofRepr = xml_doc->createElement("svg:color-profile");
gchar* tmp = static_cast<gchar*>(_menu.get_active()->get_data("name"));
Glib::ustring nameStr = tmp ? tmp : "profile"; // TODO add some auto-numbering to avoid collisions
@@ -426,7 +428,7 @@ DocumentProperties::linkSelectedProfile()
//Inkscape::GC::release(defsRepr);
// inform the document, so we can undo
- sp_document_done(desktop->doc(), SP_VERB_EDIT_LINK_COLOR_PROFILE, _("Link Color Profile"));
+ DocumentUndo::done(desktop->doc(), SP_VERB_EDIT_LINK_COLOR_PROFILE, _("Link Color Profile"));
populate_linked_profiles_box();
}
@@ -436,7 +438,7 @@ void
DocumentProperties::populate_linked_profiles_box()
{
_LinkedProfilesListStore->clear();
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
if (current) _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
@@ -493,13 +495,15 @@ void DocumentProperties::removeSelectedProfile(){
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
if (!name.compare(prof->name)){
- sp_repr_unparent(obj->repr);
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile"));
+
+ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(obj->getRepr());
+ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile"));
}
current = g_slist_next(current);
}
@@ -565,7 +569,7 @@ DocumentProperties::build_cms()
_LinkedProfilesList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::linked_profiles_list_button_release));
cms_create_popup_menu(_LinkedProfilesList, sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile));
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "defs" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "defs" );
if (current) {
_emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
}
@@ -623,7 +627,7 @@ DocumentProperties::build_scripting()
#endif // ENABLE_LCMS
//TODO: review this observers code:
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
if (current) {
_ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
}
@@ -636,7 +640,7 @@ void DocumentProperties::addExternalScript(){
if (!desktop){
g_warning("No active desktop");
} else {
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *scriptRepr = xml_doc->createElement("svg:script");
scriptRepr->setAttribute("xlink:href", (gchar*) _script_entry.get_text().c_str());
_script_entry.set_text("");
@@ -644,7 +648,7 @@ void DocumentProperties::addExternalScript(){
xml_doc->root()->addChild(scriptRepr, NULL);
// inform the document, so we can undo
- sp_document_done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script..."));
+ DocumentUndo::done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script..."));
populate_external_scripts_box();
}
@@ -662,13 +666,15 @@ void DocumentProperties::removeExternalScript(){
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
SPScript* script = (SPScript*) obj;
if (name == script->xlinkhref){
- sp_repr_unparent(obj->repr);
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script"));
+
+ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(obj->getRepr());
+ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script"));
}
current = g_slist_next(current);
}
@@ -679,7 +685,7 @@ void DocumentProperties::removeExternalScript(){
void DocumentProperties::populate_external_scripts_box(){
_ExternalScriptsListStore->clear();
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
if (current) _ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
@@ -798,8 +804,8 @@ DocumentProperties::update()
if (nv->doc_units)
_rum_deflt.setUnit (nv->doc_units);
- double const doc_w_px = sp_document_width(sp_desktop_document(dt));
- double const doc_h_px = sp_document_height(sp_desktop_document(dt));
+ double const doc_w_px = sp_desktop_document(dt)->getWidth();
+ double const doc_h_px = sp_desktop_document(dt)->getHeight();
_page_sizer.setDim (doc_w_px, doc_h_px);
_page_sizer.updateFitMarginsUI(SP_OBJECT_REPR(nv));
@@ -961,7 +967,7 @@ DocumentProperties::onRemoveGrid()
// delete the grid that corresponds with the selected tab
// when the grid is deleted from SVG, the SPNamedview handler automatically deletes the object, so found_grid becomes an invalid pointer!
found_grid->repr->parent()->removeChild(found_grid->repr);
- sp_document_done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid"));
+ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid"));
}
}
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index fbfdc4a9b..855d5a223 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -6,6 +6,7 @@
* Joel Holdsworth
* Bruno Dilly
* Other dudes from The Inkscape Organization
+ * Abhishek Sharma
*
* Copyright (C) 2004-2007 Bob Jamison
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
@@ -123,9 +124,9 @@ findExpanderWidgets(Gtk::Container *parent,
bool SVGPreview::setDocument(SPDocument *doc)
{
if (document)
- sp_document_unref(document);
+ document->doUnref();
- sp_document_ref(doc);
+ doc->doRef();
document = doc;
//This should remove it from the box, and free resources
@@ -151,7 +152,7 @@ bool SVGPreview::setFileName(Glib::ustring &theFileName)
* I don't know why passing false to keepalive is bad. But it
* prevents the display of an svg with a non-ascii filename
*/
- SPDocument *doc = sp_document_new (fileName.c_str(), true);
+ SPDocument *doc = SPDocument::createNewDoc (fileName.c_str(), true);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
@@ -159,7 +160,7 @@ bool SVGPreview::setFileName(Glib::ustring &theFileName)
setDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
return true;
}
@@ -172,7 +173,7 @@ bool SVGPreview::setFromMem(char const *xmlBuffer)
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = sp_document_new_from_mem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createNewDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
@@ -180,7 +181,7 @@ bool SVGPreview::setFromMem(char const *xmlBuffer)
setDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
Inkscape::GC::request_early_collection();
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index e2bf47db9..65bb49f13 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -4,6 +4,7 @@
/* Authors:
* Joel Holdsworth
* The Inkscape Organization
+ * Abhishek Sharma
*
* Copyright (C) 2004-2008 The Inkscape Organization
*
@@ -906,20 +907,20 @@ bool FileOpenDialogImplWin32::set_svg_preview()
gchar *utf8string = g_utf16_to_utf8((const gunichar2*)_path_string,
_MAX_PATH, NULL, NULL, NULL);
- SPDocument *svgDoc = sp_document_new (utf8string, true);
+ SPDocument *svgDoc = SPDocument::createNewDoc (utf8string, true);
g_free(utf8string);
// Check the document loaded properly
if(svgDoc == NULL) return false;
if(svgDoc->root == NULL)
{
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
return false;
}
// Get the size of the document
- const double svgWidth = sp_document_width(svgDoc);
- const double svgHeight = sp_document_height(svgDoc);
+ const double svgWidth = svgDoc->getWidth();
+ const double svgHeight = svgDoc->getHeight();
// Find the minimum scale to fit the image inside the preview area
const double scaleFactorX = PreviewSize / svgWidth;
@@ -936,9 +937,9 @@ bool FileOpenDialogImplWin32::set_svg_preview()
// write object bbox to area
Geom::OptRect maybeArea(area);
- sp_document_ensure_up_to_date (svgDoc);
- sp_item_invoke_bbox((SPItem *) svgDoc->root, maybeArea,
- sp_item_i2d_affine((SPItem *)(svgDoc->root)), TRUE);
+ svgDoc->ensureUpToDate ();
+ static_cast<(SPItem *)>(svgDoc->root)->invoke_bbox( maybeArea,
+ static_cast<(SPItem *)>(svgDoc->root)->i2d_affine(), TRUE);
NRArena *const arena = NRArena::create();
@@ -968,7 +969,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
// Fail if the pixblock failed to allocate
if(pixBlock.data.px == NULL)
{
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
return false;
}
@@ -980,7 +981,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
nr_arena_item_invoke_render(NULL, root, &bbox, &pixBlock, /*0*/NR_ARENA_ITEM_RENDER_NO_CACHE);
// Tidy up
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
sp_item_invoke_hide((SPItem*)(svgDoc->root), key);
nr_object_unref((NRObject *) arena);
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index bee6b7c9d..ed7103be3 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -5,6 +5,8 @@
* Nicholas Bishop <nicholasbishop@gmail.org>
* Rodrigo Kumpera <kumpera@gmail.com>
* Felipe C. da S. Sanches <juca@members.fsf.org>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
*
@@ -1021,16 +1023,18 @@ private:
!(ls == 1 && SP_IS_FEPOINTLIGHT(child)) &&
!(ls == 2 && SP_IS_FESPOTLIGHT(child))) {
if(child)
- sp_repr_unparent(child->repr);
+ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(child->getRepr());
if(ls != -1) {
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document);
+ Inkscape::XML::Document *xml_doc = prim->document->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement(_light_source.get_active_data()->key.c_str());
- prim->repr->appendChild(repr);
+ //XML Tree being used directly here while it shouldn't be.
+ prim->getRepr()->appendChild(repr);
Inkscape::GC::release(repr);
}
- sp_document_done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source"));
+ DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source"));
update();
}
@@ -1142,8 +1146,7 @@ void FilterEffectsDialog::FilterModifier::on_activate_desktop(Application*, SPDe
me->_resource_changed.disconnect();
me->_resource_changed =
- sp_document_resources_changed_connect(sp_desktop_document(desktop), "filter",
- sigc::mem_fun(me, &FilterModifier::update_filters));
+ sp_desktop_document(desktop)->connectResourcesChanged("filter",sigc::mem_fun(me, &FilterModifier::update_filters));
me->_dialog.setDesktop(desktop);
@@ -1214,7 +1217,7 @@ void FilterEffectsDialog::FilterModifier::on_name_edited(const Glib::ustring& pa
if(iter) {
SPFilter* filter = (*iter)[_columns.filter];
filter->setLabel(text.c_str());
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter"));
+ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter"));
if(iter)
(*iter)[_columns.label] = text;
}
@@ -1250,7 +1253,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri
}
update_selection(sel);
- sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter"));
}
}
@@ -1260,7 +1263,7 @@ void FilterEffectsDialog::FilterModifier::update_filters()
{
SPDesktop* desktop = _dialog.getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* filters = sp_document_get_resource_list(document, "filter");
+ const GSList* filters = document->getResourceList("filter");
_model->clear();
@@ -1326,7 +1329,7 @@ void FilterEffectsDialog::FilterModifier::add_filter()
select_filter(filter);
- sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter"));
}
void FilterEffectsDialog::FilterModifier::remove_filter()
@@ -1335,9 +1338,11 @@ void FilterEffectsDialog::FilterModifier::remove_filter()
if(filter) {
SPDocument* doc = filter->document;
- sp_repr_unparent(filter->repr);
- sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter"));
+ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(filter->getRepr());
+
+ DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter"));
update_filters();
}
@@ -1352,7 +1357,7 @@ void FilterEffectsDialog::FilterModifier::duplicate_filter()
repr = repr->duplicate(repr->document());
parent->appendChild(repr);
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter"));
+ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter"));
update_filters();
}
@@ -1487,7 +1492,9 @@ void FilterEffectsDialog::PrimitiveList::update()
if(prim) {
Gtk::TreeModel::Row row = *_model->append();
row[_columns.primitive] = prim;
- row[_columns.type_id] = FPConverter.get_id_from_key(prim->repr->name());
+
+ //XML Tree being used directly here while it shouldn't be.
+ row[_columns.type_id] = FPConverter.get_id_from_key(prim->getRepr()->name());
row[_columns.type] = _(FPConverter.get_label(row[_columns.type_id]).c_str());
row[_columns.id] = prim->getId();
@@ -1540,10 +1547,11 @@ void FilterEffectsDialog::PrimitiveList::remove_selected()
if(prim) {
_observer->set(0);
- sp_repr_unparent(prim->repr);
+ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(prim->getRepr());
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS,
- _("Remove filter primitive"));
+ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS,
+ _("Remove filter primitive"));
update();
}
@@ -1913,9 +1921,11 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton*
if(c == _in_drag && SP_IS_FEMERGENODE(o)) {
// If input is null, delete it
if(!in_val) {
- sp_repr_unparent(o->repr);
- sp_document_done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS,
- _("Remove merge node"));
+
+ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(o->getRepr());
+ DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS,
+ _("Remove merge node"));
(*get_selection()->get_selected())[_columns.primitive] = prim;
}
else
@@ -1925,10 +1935,12 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton*
}
// Add new input?
if(!handled && c == _in_drag && in_val) {
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document);
+ Inkscape::XML::Document *xml_doc = prim->document->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:feMergeNode");
repr->setAttribute("inkscape:collect", "always");
- prim->repr->appendChild(repr);
+
+ //XML Tree being used directly here while it shouldn't be.
+ prim->getRepr()->appendChild(repr);
SPFeMergeNode *node = SP_FEMERGENODE(prim->document->getObjectByRepr(repr));
Inkscape::GC::release(repr);
_dialog.set_attr(node, SP_ATTR_IN, in_val);
@@ -2031,7 +2043,7 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtr<Gdk::Dra
filter->requestModified(SP_OBJECT_MODIFIED_FLAG);
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive"));
+ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive"));
}
// If a connection is dragged towards the top or bottom of the list, the list should scroll to follow.
@@ -2263,7 +2275,7 @@ void FilterEffectsDialog::add_primitive()
_primitive_list.select(prim);
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive"));
+ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive"));
}
}
@@ -2359,7 +2371,7 @@ void FilterEffectsDialog::duplicate_primitive()
repr = SP_OBJECT_REPR(origprim)->duplicate(SP_OBJECT_REPR(origprim)->document());
SP_OBJECT_REPR(filter)->appendChild(repr);
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive"));
+ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive"));
_primitive_list.update();
}
@@ -2411,8 +2423,8 @@ void FilterEffectsDialog::set_attr(SPObject* o, const SPAttributeEnum attr, cons
Glib::ustring undokey = "filtereffects:";
undokey += name;
- sp_document_maybe_done(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS,
- _("Set filter primitive attribute"));
+ DocumentUndo::maybeDone(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS,
+ _("Set filter primitive attribute"));
}
_attr_lock = false;
@@ -2467,7 +2479,9 @@ void FilterEffectsDialog::update_settings_view()
SPFilterPrimitive* prim = _primitive_list.get_selected();
if(prim) {
- _settings->show_and_update(FPConverter.get_id_from_key(prim->repr->name()), prim);
+
+ //XML Tree being used directly here while it shouldn't be.
+ _settings->show_and_update(FPConverter.get_id_from_key(prim->getRepr()->name()), prim);
_empty_settings.hide();
}
diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp
index 7fad00f56..b6d6a0319 100644
--- a/src/ui/dialog/find.cpp
+++ b/src/ui/dialog/find.cpp
@@ -4,6 +4,8 @@
* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
* Johan Engelen <goejendaagh@zonnet.nl>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Authors
*
@@ -76,8 +78,8 @@ Find::Find()
_check_texts(_("Texts"), _("Search text objects")),
_check_groups(_("Groups"), _("Search groups")),
_check_clones(
- //TRANSLATORS: "Clones" is a noun indicating type of object to find
- C_("Find dialog", "Clones"), _("Search clones")),
+ //TRANSLATORS: "Clones" is a noun indicating type of object to find
+ C_("Find dialog", "Clones"), _("Search clones")),
_check_images(_("Images"), _("Search images")),
_check_offsets(_("Offsets"), _("Search offset objects")),
@@ -346,7 +348,7 @@ Find::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->firstChild(); child; child = child->getNext()) {
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);
@@ -415,7 +417,7 @@ Find::onFind()
if (_check_search_layer.get_active()) {
l = all_items (desktop->currentLayer(), l, hidden, locked);
} else {
- l = all_items (SP_DOCUMENT_ROOT (sp_desktop_document (desktop)), l, hidden, locked);
+ l = all_items(sp_desktop_document(desktop)->getRoot(), l, hidden, locked);
}
}
guint all = g_slist_length (l);
diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp
index 5e66ca9b8..f3d7ed971 100644
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
@@ -4,6 +4,7 @@
/* Authors:
* Jon A. Cruz
+ * Abhishek Sharma
*
* Copyright (C) 2010 Jon A. Cruz
* Released under GNU GPL, read the file 'COPYING' for more information
@@ -28,7 +29,7 @@
#include "glyphs.h"
#include "desktop.h"
-#include "document.h" // for sp_document_done()
+#include "document.h" // for SPDocumentUndo::done()
#include "libnrtype/font-instance.h"
#include "sp-flowtext.h"
#include "sp-text.h"
@@ -571,7 +572,7 @@ void GlyphsPanel::insertText()
}
combined += glyphs;
sp_te_set_repr_text_multiline(textItem, combined.c_str());
- sp_document_done(targetDesktop->doc(), SP_VERB_CONTEXT_TEXT, _("Append text"));
+ DocumentUndo::done(targetDesktop->doc(), SP_VERB_CONTEXT_TEXT, _("Append text"));
}
}
}
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index aac6024b9..1ab0d51bc 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -5,6 +5,7 @@
* Lauris Kaplinski <lauris@kaplinski.com>
* Andrius R. <knutux@gmail.com>
* Johan Engelen
+ * Abhishek Sharma
*
* Copyright (C) 1999-2007 Authors
*
@@ -108,8 +109,8 @@ void GuidelinePropertiesDialog::_onApply()
sp_guide_moveto(*_guide, newpos, true);
- sp_document_done(SP_OBJECT_DOCUMENT(_guide), SP_VERB_NONE,
- _("Set guide properties"));
+ DocumentUndo::done(SP_OBJECT_DOCUMENT(_guide), SP_VERB_NONE,
+ _("Set guide properties"));
}
void GuidelinePropertiesDialog::_onOK()
@@ -121,8 +122,8 @@ void GuidelinePropertiesDialog::_onDelete()
{
SPDocument *doc = SP_OBJECT_DOCUMENT(_guide);
sp_guide_remove(_guide);
- sp_document_done(doc, SP_VERB_NONE,
- _("Delete guide"));
+ DocumentUndo::done(doc, SP_VERB_NONE,
+ _("Delete guide"));
}
void GuidelinePropertiesDialog::_response(gint response)
@@ -225,9 +226,9 @@ void GuidelinePropertiesDialog::_setup() {
// initialize dialog
_oldpos = _guide->point_on_line;
- if (_guide->is_vertical()) {
+ if (_guide->isVertical()) {
_oldangle = 90;
- } else if (_guide->is_horizontal()) {
+ } else if (_guide->isHorizontal()) {
_oldangle = 0;
} else {
_oldangle = Geom::rad_to_deg( std::atan2( - _guide->normal_to_line[Geom::X], _guide->normal_to_line[Geom::Y] ) );
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 07e1ff430..b507d9f9a 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -5,6 +5,7 @@
* Jon A. Cruz
* Bob Jamison
* Other dudes from The Inkscape Organization
+ * Abhishek Sharma
*
* Copyright (C) 2004 Bob Jamison
* Copyright (C) 2005,2010 Jon A. Cruz
@@ -443,10 +444,9 @@ void IconPreviewPanel::renderPreview( SPObject* obj )
NRArena *arena = NRArena::create();
/* Create ArenaItem and set transform */
- unsigned int visionkey = sp_item_display_key_new(1);
+ unsigned int visionkey = SPItem::display_key_new(1);
- root = sp_item_invoke_show ( SP_ITEM( SP_DOCUMENT_ROOT(doc) ),
- arena, visionkey, SP_ITEM_SHOW_DISPLAY );
+ root = SP_ITEM( doc->getRoot() )->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY );
for ( int i = 0; i < numEntries; i++ ) {
guchar * px = sp_icon_doc_icon( doc, root, id, sizes[i] );
@@ -462,7 +462,7 @@ void IconPreviewPanel::renderPreview( SPObject* obj )
}
updateMagnify();
- sp_item_invoke_hide(SP_ITEM(sp_document_root(doc)), visionkey);
+ SP_ITEM(doc->getRoot())->invoke_hide(visionkey);
nr_object_unref((NRObject *) arena);
renderTimer->stop();
minDelay = std::max( 0.1, renderTimer->elapsed() * 3.0 );
diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index 1728ff3a6..bf15bcd76 100644
--- a/src/ui/dialog/layer-properties.cpp
+++ b/src/ui/dialog/layer-properties.cpp
@@ -4,6 +4,7 @@
/* Author:
* Bryce W. Harrington <bryce@bryceharrington.com>
* Andrius R. <knutux@gmail.com>
+ * Abhishek Sharma
*
* Copyright (C) 2004 Bryce Harrington
* Copyright (C) 2006 Andrius R.
@@ -105,8 +106,8 @@ LayerPropertiesDialog::_apply()
g_assert(_strategy != NULL);
_strategy->perform(*this);
- sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE,
- _("Add layer"));
+ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE,
+ _("Add layer"));
_close();
}
@@ -188,8 +189,8 @@ void LayerPropertiesDialog::Rename::perform(LayerPropertiesDialog &dialog) {
(gchar *)name.c_str(),
FALSE
);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
- _("Rename layer"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
+ _("Rename layer"));
// TRANSLATORS: This means "The layer has been renamed"
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Renamed layer"));
}
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index c3c0ae3c5..0eca5bbca 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -3,6 +3,7 @@
*
* Authors:
* Jon A. Cruz
+ * Abhishek Sharma
*
* Copyright (C) 2006,2010 Jon A. Cruz
*
@@ -468,8 +469,8 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol )
row[_model->_colVisible] = newValue;
item->setHidden( !newValue );
item->updateRepr();
- sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
- newValue? _("Unhide layer") : _("Hide layer"));
+ DocumentUndo::done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
+ newValue? _("Unhide layer") : _("Hide layer"));
}
break;
@@ -479,8 +480,8 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol )
row[_model->_colLocked] = newValue;
item->setLocked( newValue );
item->updateRepr();
- sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
- newValue? _("Lock layer") : _("Unlock layer"));
+ DocumentUndo::done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
+ newValue? _("Lock layer") : _("Unlock layer"));
}
break;
}
@@ -766,7 +767,7 @@ void LayersPanel::setDesktop( SPDesktop* desktop )
}
}
/*
- GSList const *layers=sp_document_get_resource_list( _desktop->doc(), "layer" );
+ GSList const *layers = _desktop->doc()->getResourceList( "layer" );
g_message( "layers list starts at %p", layers );
for ( GSList const *iter=layers ; iter ; iter = iter->next ) {
SPObject *layer=static_cast<SPObject *>(iter->data);
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index 706a84733..bf60fe059 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -5,6 +5,7 @@
* Johan Engelen <j.b.c.engelen@utwente.nl>
* Steren Giannini <steren.giannini@gmail.com>
* Bastien Bouclet <bgkweb@gmail.com>
+ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
* Released under GNU GPL. Read the file 'COPYING' for more information.
@@ -376,8 +377,8 @@ LivePathEffectEditor::onApply()
LivePathEffect::Effect::createAndApply(data->key.c_str(), doc, item);
- sp_document_done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- _("Create and apply path effect"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ _("Create and apply path effect"));
lpe_list_locked = false;
onSelectionChanged(sel);
@@ -394,8 +395,8 @@ LivePathEffectEditor::onRemove()
if ( item && SP_IS_LPE_ITEM(item) ) {
sp_lpe_item_remove_current_path_effect(SP_LPE_ITEM(item), false);
- sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- _("Remove path effect") );
+ DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ _("Remove path effect") );
effect_list_reload(SP_LPE_ITEM(item));
}
@@ -410,8 +411,8 @@ void LivePathEffectEditor::onUp()
if ( item && SP_IS_LPE_ITEM(item) ) {
sp_lpe_item_up_current_path_effect(SP_LPE_ITEM(item));
- sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- _("Move path effect up") );
+ DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ _("Move path effect up") );
effect_list_reload(SP_LPE_ITEM(item));
}
@@ -426,8 +427,8 @@ void LivePathEffectEditor::onDown()
if ( item && SP_IS_LPE_ITEM(item) ) {
sp_lpe_item_down_current_path_effect(SP_LPE_ITEM(item));
- sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- _("Move path effect down") );
+ DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ _("Move path effect down") );
effect_list_reload(SP_LPE_ITEM(item));
}
@@ -465,8 +466,8 @@ void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str )
/* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack.
* So one can call: lpe_item->setActive(lpeobjref->lpeobject); */
lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false");
- sp_document_done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- newValue ? _("Activate path effect") : _("Deactivate path effect"));
+ DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ newValue ? _("Activate path effect") : _("Deactivate path effect"));
}
}
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index 2456e10da..a56cbfd9d 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -3,6 +3,7 @@
*/
/* Authors:
* Kees Cook <kees@outflux.net>
+ * Abhishek Sharma
*
* Copyright (C) 2007 Kees Cook
* Released under GNU GPL. Read the file 'COPYING' for more information.
@@ -46,8 +47,8 @@ static void draw_page(
if (junk->_tab->as_bitmap()) {
// Render as exported PNG
- gdouble width = sp_document_width(junk->_doc);
- gdouble height = sp_document_height(junk->_doc);
+ gdouble width = (junk->_doc)->getWidth();
+ gdouble height = (junk->_doc)->getHeight();
gdouble dpi = junk->_tab->bitmap_dpi();
std::string tmp_png;
std::string tmp_base = "inkscape-print-png-XXXXXX";
@@ -181,7 +182,7 @@ Print::Print(SPDocument *doc, SPItem *base) :
_printop = gtk_print_operation_new ();
// set up dialog title, based on document name
- gchar *jobname = _doc->name ? _doc->name : _("SVG Document");
+ gchar const *jobname = _doc->getName() ? _doc->getName() : _("SVG Document");
Glib::ustring title = _("Print");
title += " ";
title += jobname;
@@ -190,8 +191,8 @@ Print::Print(SPDocument *doc, SPItem *base) :
// set up paper size to match the document size
gtk_print_operation_set_unit (_printop, GTK_UNIT_POINTS);
GtkPageSetup *page_setup = gtk_page_setup_new();
- gdouble doc_width = sp_document_width(_doc) * PT_PER_PX;
- gdouble doc_height = sp_document_height(_doc) * PT_PER_PX;
+ gdouble doc_width = _doc->getWidth() * PT_PER_PX;
+ gdouble doc_height = _doc->getHeight() * PT_PER_PX;
GtkPaperSize *paper_size;
if (doc_width > doc_height) {
gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
diff --git a/src/ui/dialog/session-player.cpp b/src/ui/dialog/session-player.cpp
index 51b206a85..d8ff8ca56 100644
--- a/src/ui/dialog/session-player.cpp
+++ b/src/ui/dialog/session-player.cpp
@@ -3,6 +3,7 @@
*/
/* Authors:
* David Yip <yipdw@rose-hulman.edu>
+ * Abhishek Sharma
*
* Copyright (c) 2005 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
@@ -171,7 +172,7 @@ SessionPlaybackDialogImpl::_respCallback(int resp)
switch (result) {
case Gtk::RESPONSE_OK:
this->_sm->clearDocument();
- sp_document_done(sp_desktop_document(this->_desktop), SP_VERB_NONE,
+ SPDocumentUndo::done(sp_desktop_document(this->_desktop), SP_VERB_NONE,
/* TODO: annotate */ "session-player.cpp:186");
this->_sm->loadSessionFile(sessionfiledlg.get_filename());
this->_openfile.set_text(this->_sfp->filename());
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 1f11a412e..042acb6e1 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -3,6 +3,8 @@
*/
/* Authors:
* Felipe C. da S. Sanches <juca@members.fsf.org>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2008 Authors
* Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
@@ -117,8 +119,8 @@ void SvgFontsDialog::AttrEntry::on_attr_changed(){
Glib::ustring undokey = "svgfonts:";
undokey += name;
- sp_document_maybe_done(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS,
- _("Set SVG Font attribute"));
+ DocumentUndo::maybeDone(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS,
+ _("Set SVG Font attribute"));
}
}
@@ -163,15 +165,17 @@ void SvgFontsDialog::on_kerning_value_changed(){
if (!this->kerning_pair) return;
SPDocument* document = sp_desktop_document(this->getDesktop());
- //TODO: I am unsure whether this is the correct way of calling sp_document_maybe_done
+ //TODO: I am unsure whether this is the correct way of calling SPDocumentUndo::maybe_done
Glib::ustring undokey = "svgfonts:hkern:k:";
undokey += this->kerning_pair->u1->attribute_string();
undokey += ":";
undokey += this->kerning_pair->u2->attribute_string();
//slider values increase from right to left so that they match the kerning pair preview
- this->kerning_pair->repr->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str());
- sp_document_maybe_done(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value"));
+
+ //XML Tree being directly used here while it shouldn't be.
+ this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str());
+ DocumentUndo::maybeDone(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value"));
//populate_kerning_pairs_box();
kerning_preview.redraw();
@@ -243,7 +247,7 @@ void SvgFontsDialog::update_fonts()
{
SPDesktop* desktop = this->getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* fonts = sp_document_get_resource_list(document, "font");
+ const GSList* fonts = document->getResourceList("font");
_model->clear();
for(const GSList *l = fonts; l; l = l->next) {
@@ -423,7 +427,7 @@ SvgFontsDialog::populate_kerning_pairs_box()
SPGlyph *new_glyph(SPDocument* document, SPFont *font, const int count)
{
g_return_val_if_fail(font != NULL, NULL);
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new glyph
Inkscape::XML::Node *repr;
@@ -462,7 +466,7 @@ void SvgFontsDialog::add_glyph(){
SPDocument* doc = sp_desktop_document(this->getDesktop());
/* SPGlyph* glyph =*/ new_glyph(doc, get_selected_spfont(), count+1);
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph"));
update_glyphs();
}
@@ -505,8 +509,9 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){
msgStack->flash(Inkscape::ERROR_MESSAGE, msg);
return;
}
- glyph->repr->setAttribute("d", (char*) sp_svg_write_path (pathv));
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
+ //XML Tree being directly used here while it shouldn't be.
+ glyph->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
update_glyphs();
}
@@ -547,8 +552,10 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){
SPObject* obj;
for (obj = get_selected_spfont()->children; obj; obj=obj->next){
if (SP_IS_MISSING_GLYPH(obj)){
- obj->repr->setAttribute("d", (char*) sp_svg_write_path (pathv));
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
+
+ //XML Tree being directly used here while it shouldn't be.
+ obj->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
}
}
@@ -566,8 +573,9 @@ void SvgFontsDialog::reset_missing_glyph_description(){
SPObject* obj;
for (obj = get_selected_spfont()->children; obj; obj=obj->next){
if (SP_IS_MISSING_GLYPH(obj)){
- obj->repr->setAttribute("d", (char*) "M0,0h1000v1024h-1000z");
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph"));
+ //XML Tree being directly used here while it shouldn't be.
+ obj->getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z");
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph"));
}
}
@@ -579,10 +587,11 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring&
if (!i) return;
SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node];
- glyph->repr->setAttribute("glyph-name", str.c_str());
+ //XML Tree being directly used here while it shouldn't be.
+ glyph->getRepr()->setAttribute("glyph-name", str.c_str());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name"));
update_glyphs();
}
@@ -592,10 +601,11 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin
if (!i) return;
SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node];
- glyph->repr->setAttribute("unicode", str.c_str());
+ //XML Tree being directly used here while it shouldn't be.
+ glyph->getRepr()->setAttribute("unicode", str.c_str());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode"));
update_glyphs();
}
@@ -604,9 +614,10 @@ void SvgFontsDialog::remove_selected_font(){
SPFont* font = get_selected_spfont();
if (!font) return;
- sp_repr_unparent(font->repr);
+ //XML Tree being directly used here while it shouldn't be.
+ sp_repr_unparent(font->getRepr());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font"));
update_fonts();
}
@@ -618,10 +629,12 @@ void SvgFontsDialog::remove_selected_glyph(){
if(!i) return;
SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node];
- sp_repr_unparent(glyph->repr);
+
+ //XML Tree being directly used here while it shouldn't be.
+ sp_repr_unparent(glyph->getRepr());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph"));
update_glyphs();
}
@@ -633,10 +646,12 @@ void SvgFontsDialog::remove_selected_kerning_pair(){
if(!i) return;
SPGlyphKerning* pair = (*i)[_KerningPairsListColumns.spnode];
- sp_repr_unparent(pair->repr);
+
+ //XML Tree being directly used here while it shouldn't be.
+ sp_repr_unparent(pair->getRepr());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair"));
update_glyphs();
}
@@ -707,11 +722,10 @@ void SvgFontsDialog::add_kerning_pair(){
if (this->kerning_pair) return; //We already have this kerning pair
SPDocument* document = sp_desktop_document(this->getDesktop());
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new hkern node
- Inkscape::XML::Node *repr;
- repr = xml_doc->createElement("svg:hkern");
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:hkern");
repr->setAttribute("u1", first_glyph.get_active_text().c_str());
repr->setAttribute("u2", second_glyph.get_active_text().c_str());
@@ -724,7 +738,7 @@ void SvgFontsDialog::add_kerning_pair(){
// get corresponding object
this->kerning_pair = SP_HKERN( document->getObjectByRepr(repr) );
- sp_document_done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair"));
+ DocumentUndo::done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair"));
}
Gtk::VBox* SvgFontsDialog::kerning_tab(){
@@ -774,11 +788,10 @@ SPFont *new_font(SPDocument *document)
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new font
- Inkscape::XML::Node *repr;
- repr = xml_doc->createElement("svg:font");
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:font");
//By default, set the horizontal advance to 1024 units
repr->setAttribute("horiz-adv-x", "1024");
@@ -813,11 +826,12 @@ void set_font_family(SPFont* font, char* str){
SPObject* obj;
for (obj=font->children; obj; obj=obj->next){
if (SP_IS_FONTFACE(obj)){
- obj->repr->setAttribute("font-family", str);
+ //XML Tree being directly used here while it shouldn't be.
+ obj->getRepr()->setAttribute("font-family", str);
}
}
- sp_document_done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family"));
+ DocumentUndo::done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family"));
}
void SvgFontsDialog::add_font(){
@@ -833,14 +847,15 @@ void SvgFontsDialog::add_font(){
SPObject* obj;
for (obj=font->children; obj; obj=obj->next){
if (SP_IS_FONTFACE(obj)){
- obj->repr->setAttribute("font-family", os2.str().c_str());
+ //XML Tree being directly used here while it shouldn't be.
+ obj->getRepr()->setAttribute("font-family", os2.str().c_str());
}
}
update_fonts();
// select_font(font);
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font"));
+ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font"));
}
SvgFontsDialog::SvgFontsDialog()
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;
}
diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp
index b50610938..fccf5c105 100644
--- a/src/ui/dialog/tile.cpp
+++ b/src/ui/dialog/tile.cpp
@@ -5,6 +5,7 @@
* Bob Jamison ( based off trace dialog)
* John Cliff
* Other dudes from The Inkscape Organization
+ * Abhishek Sharma
*
* Copyright (C) 2004 Bob Jamison
* Copyright (C) 2004 John Cliff
@@ -46,8 +47,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
using Geom::X;
using Geom::Y;
- Geom::OptRect a = first->getBounds(sp_item_i2doc_affine(first));
- Geom::OptRect b = second->getBounds(sp_item_i2doc_affine(second));
+ Geom::OptRect a = first->getBounds(first->i2doc_affine());
+ Geom::OptRect b = second->getBounds(second->i2doc_affine());
if ( !a || !b ) {
// FIXME?
@@ -86,8 +87,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- Geom::OptRect a = first->getBounds(sp_item_i2doc_affine(first));
- Geom::OptRect b = second->getBounds(sp_item_i2doc_affine(second));
+ Geom::OptRect a = first->getBounds(first->i2doc_affine());
+ Geom::OptRect b = second->getBounds(second->i2doc_affine());
if ( !a || !b ) {
// FIXME?
@@ -159,14 +160,14 @@ void TileDialog::Grid_Arrange ()
grid_top = 99999;
SPDesktop *desktop = getDesktop();
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensureUpToDate();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
const GSList *items = selection ? selection->itemList() : 0;
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- Geom::OptRect b = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect b = item->getBounds(item->i2doc_affine());
if (!b) {
continue;
}
@@ -209,7 +210,7 @@ void TileDialog::Grid_Arrange ()
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- Geom::OptRect b = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect b = item->getBounds(item->i2doc_affine());
if (b) {
width = b->dimensions()[Geom::X];
height = b->dimensions()[Geom::Y];
@@ -316,7 +317,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(item);
- Geom::OptRect b = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect b = item->getBounds(item->i2doc_affine());
Geom::Point min;
if (b) {
width = b->dimensions()[Geom::X];
@@ -336,16 +337,16 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
// signs are inverted between x and y due to y inversion
Geom::Point move = Geom::Point(new_x - min[Geom::X], min[Geom::Y] - new_y);
Geom::Matrix const affine = Geom::Matrix(Geom::Translate(move));
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * affine);
- sp_item_write_transform(item, repr, item->transform, NULL);
+ item->set_i2d_affine(item->i2d_affine() * affine);
+ item->doWriteTransform(repr, item->transform, NULL);
SP_OBJECT (current_row->data)->updateRepr();
cnt +=1;
}
g_slist_free (current_row);
}
- sp_document_done (sp_desktop_document (desktop), SP_VERB_SELECTION_GRIDTILE,
- _("Arrange in a grid"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_GRIDTILE,
+ _("Arrange in a grid"));
}
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 338e11d38..c895f0be9 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -4,6 +4,7 @@
/* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
* buliabyak@gmail.com
+ * Abhishek Sharma
*
* Copyright (C) 2004, 2005 Authors
* Released under GNU GPL. Read the file 'COPYING' for more information.
@@ -636,7 +637,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
it != selected.end();
++it)
{
- Geom::OptRect bbox = sp_item_bbox_desktop(*it);
+ Geom::OptRect bbox = (*it)->getBboxDesktop();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.));
}
@@ -660,7 +661,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
it != selected.end();
++it)
{
- Geom::OptRect bbox = sp_item_bbox_desktop(*it);
+ Geom::OptRect bbox = (*it)->getBboxDesktop();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.));
}
@@ -687,8 +688,8 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
}
}
- sp_document_done ( sp_desktop_document (selection->desktop()) , SP_VERB_DIALOG_TRANSFORM,
- _("Move"));
+ DocumentUndo::done( sp_desktop_document(selection->desktop()) , SP_VERB_DIALOG_TRANSFORM,
+ _("Move"));
}
void
@@ -704,7 +705,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
Geom::Scale scale (0,0);
// the values are increments!
if (_units_scale.isAbsolute()) {
- Geom::OptRect bbox(sp_item_bbox_desktop(item));
+ Geom::OptRect bbox(item->getBboxDesktop());
if (bbox) {
double new_width = scaleX;
if (fabs(new_width) < 1e-6) new_width = 1e-6; // not 0, as this would result in a nasty no-bbox object
@@ -744,8 +745,8 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
}
}
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
- _("Scale"));
+ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
+ _("Scale"));
}
void
@@ -766,8 +767,8 @@ Transformation::applyPageRotate(Inkscape::Selection *selection)
}
}
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
- _("Rotate"));
+ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
+ _("Rotate"));
}
void
@@ -791,7 +792,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
} else { // absolute displacement
double skewX = _scalar_skew_horizontal.getValue("px");
double skewY = _scalar_skew_vertical.getValue("px");
- Geom::OptRect bbox(sp_item_bbox_desktop(item));
+ Geom::OptRect bbox(item->getBboxDesktop());
if (bbox) {
double width = bbox->dimensions()[Geom::X];
double height = bbox->dimensions()[Geom::Y];
@@ -825,8 +826,8 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
}
}
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
- _("Skew"));
+ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
+ _("Skew"));
}
@@ -845,15 +846,15 @@ Transformation::applyPageTransform(Inkscape::Selection *selection)
if (_check_replace_matrix.get_active()) {
for (GSList const *l = selection->itemList(); l != NULL; l = l->next) {
SPItem *item = SP_ITEM(l->data);
- sp_item_set_item_transform(item, displayed);
+ item->set_item_transform(displayed);
SP_OBJECT(item)->updateRepr();
}
} else {
sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform
}
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
- _("Edit transformation matrix"));
+ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
+ _("Edit transformation matrix"));
}
diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp
index 111dc014d..17d032758 100644
--- a/src/ui/dialog/undo-history.cpp
+++ b/src/ui/dialog/undo-history.cpp
@@ -3,6 +3,7 @@
*/
/* Author:
* Gustav Broberg <broberg@kth.se>
+ * Abhishek Sharma
*
* Copyright (C) 2006 Authors
* Released under GNU GPL. Read the file 'COPYING' for more information.
@@ -214,7 +215,7 @@ UndoHistory::_onListSelectionChange()
_event_log->blockNotifications();
for ( --last ; curr_event != last ; ++curr_event ) {
- sp_document_redo(_document);
+ DocumentUndo::redo(_document);
}
_event_log->blockNotifications(false);
@@ -248,7 +249,7 @@ UndoHistory::_onListSelectionChange()
while ( selected != last_selected ) {
- sp_document_undo(_document);
+ DocumentUndo::undo(_document);
if ( last_selected->parent() &&
last_selected == last_selected->parent()->children().begin() )
@@ -273,7 +274,7 @@ UndoHistory::_onListSelectionChange()
while ( selected != last_selected ) {
- sp_document_redo(_document);
+ DocumentUndo::redo(_document);
if ( !last_selected->children().empty() ) {
_event_log->setCurrEventParent(last_selected);
@@ -317,10 +318,10 @@ UndoHistory::_onCollapseEvent(const Gtk::TreeModel::iterator &iter, const Gtk::T
EventLog::const_iterator last = curr_event_parent->children().end();
_event_log->blockNotifications();
- sp_document_redo(_document);
+ DocumentUndo::redo(_document);
for ( --last ; curr_event != last ; ++curr_event ) {
- sp_document_redo(_document);
+ DocumentUndo::redo(_document);
}
_event_log->blockNotifications(false);