summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d5ad05a)
raw | patch | inline | side by side (parent: d5ad05a)
author | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | |
Thu, 1 Jul 2010 10:06:56 +0000 (15:36 +0530) | ||
committer | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | |
Thu, 1 Jul 2010 10:06:56 +0000 (15:36 +0530) |
102 files changed:
index d2ccccbe3a7635f2778aee177d7baeb73add8ea5..b667459686a9ddf440736d4d5839da5025bf40a0 100644 (file)
//
gchar const *tmpl = g_build_filename ((INKSCAPE_TEMPLATESDIR), "default.svg", NULL);
bool have_default = Inkscape::IO::file_test (tmpl, G_FILE_TEST_IS_REGULAR);
- SPDocument *doc = SPDocument::createDoc (have_default? tmpl:0, true, true);
+ SPDocument *doc = SPDocument::createNewDoc (have_default? tmpl:0, true, true);
g_return_val_if_fail (doc != 0, false);
Inkscape::UI::View::EditWidget *ew = new Inkscape::UI::View::EditWidget (doc);
doc->doUnref ();
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 43709793ccfc1cbb343bb04bfdfba7200308a3aa..bda4e6e2377e582147217b4ae5d38d572a582b53 100644 (file)
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
// Unregister ourselves
SPDocument* document = SP_OBJECT_DOCUMENT(object);
if ( document ) {
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "iccprofile", SP_OBJECT (object));
+ SP_OBJECT_DOCUMENT (object)->remove_resource ("iccprofile", SP_OBJECT (object));
}
ColorProfile *cprof = COLORPROFILE(object);
@@ -254,7 +254,7 @@ void ColorProfile::build( SPObject *object, SPDocument *document, Inkscape::XML:
// Register
if ( document ) {
- sp_document_add_resource( document, "iccprofile", object );
+ document->add_resource( "iccprofile", object );
}
}
static SPObject* bruteFind( SPDocument* document, gchar const* name )
{
SPObject* result = 0;
- const GSList * current = sp_document_get_resource_list(document, "iccprofile");
+ const GSList * current = document->get_resource_list("iccprofile");
while ( current && !result ) {
if ( IS_COLORPROFILE(current->data) ) {
ColorProfile* prof = COLORPROFILE(current->data);
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index 21df27637222519cee17e0a3f64fbcf75809ce25..15cd97b28ca30419fb123bc2962fc3c99b15617a 100644 (file)
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
@@ -196,7 +196,7 @@ void SPAvoidRef::setConnectionPointsAttrUndoable(const gchar* value, const gchar
sp_object_setAttribute( SP_OBJECT(item), "inkscape:connection-points", value, 0 );
item->updateRepr();
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, action);
}
index 82be63de58d611a59c2413503dbe8f2c670855ac..90b16fddd3b8ff4a2d2010033a4e6616dbfd623e 100644 (file)
@@ -1064,7 +1064,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
cc_connector_rerouting_finish(cc, &p);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
return TRUE;
break;
@@ -1108,7 +1108,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
cp.dir = Avoid::ConnDirAll;
g_object_unref(cc->selected_handle);
cc->active_shape->avoidRef->addConnectionPoint(cp);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
for (ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end(); ++it)
if (it->second.type == ConnPointUserDefined && it->second.id == cp.id)
{
cp.dir = Avoid::ConnDirAll;
g_object_unref(cc->selected_handle);
cc->active_shape->avoidRef->addConnectionPoint(cp);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
for (ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end(); ++it)
if (it->second.type == ConnPointUserDefined && it->second.id == cp.id)
{
}
// Process pending updates.
cc->newconn->updateRepr();
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
if (connection) {
// Adjust endpoints to shape edge.
// Ensure the item's connection_points map
// has been updated
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
+ SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
std::set<int> seen;
for ( ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end() ;)
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 204807e983ad0e39481c843f13be6961686af131..d5e7974ea75a5f86839b796b62ba0e5ba67a7e19 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -185,7 +185,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
SPDocument *document = SP_OBJECT_DOCUMENT (namedview);
/* Kill flicker */
- sp_document_ensure_up_to_date (document);
+ document->ensure_up_to_date ();
/* Setup Dialog Manager */
_dlg_mgr = &Inkscape::UI::Dialog::DialogManager::getInstance();
@@ -255,7 +255,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
// display rect and zoom are now handled in sp_desktop_widget_realize()
Geom::Rect const d(Geom::Point(0.0, 0.0),
- Geom::Point(sp_document_width(document), sp_document_height(document)));
+ Geom::Point(document->getWidth(), document->getHeight()));
SP_CTRLRECT(page)->setRectangle(d);
SP_CTRLRECT(page_border)->setRectangle(d);
@@ -272,7 +272,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
/* Connect event for page resize */
- _doc2dt[5] = sp_document_height (document);
+ _doc2dt[5] = document->getHeight ();
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt);
_modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this));
SPDesktop::item_from_list_at_point_bottom (const GSList *list, Geom::Point const p) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_item_from_list_at_point_bottom (dkey, SP_GROUP (doc()->root), list, p);
+ return SPDocument::item_from_list_at_point_bottom (dkey, SP_GROUP (doc()->root), list, p);
}
/**
SPDesktop::item_at_point (Geom::Point const p, bool into_groups, SPItem *upto) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_item_at_point (doc(), dkey, p, into_groups, upto);
+ return doc()->item_at_point ( dkey, p, into_groups, upto);
}
/**
SPDesktop::group_at_point (Geom::Point const p) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_group_at_point (doc(), dkey, p);
+ return doc()->group_at_point (dkey, p);
}
/**
SPDesktop::zoom_page()
{
Geom::Rect d(Geom::Point(0, 0),
- Geom::Point(sp_document_width(doc()), sp_document_height(doc())));
+ Geom::Point(doc()->getWidth(), doc()->getHeight()));
if (d.minExtent() < 1.0) {
return;
{
Geom::Rect const a = get_display_area();
- if (sp_document_width(doc()) < 1.0) {
+ if (doc()->getWidth() < 1.0) {
return;
}
Geom::Rect d(Geom::Point(0, a.midpoint()[Geom::Y]),
- Geom::Point(sp_document_width(doc()), a.midpoint()[Geom::Y]));
+ Geom::Point(doc()->getWidth(), a.midpoint()[Geom::Y]));
set_display_area(d, 10);
}
index 550370e90e9a694dd9b74090d9d85423a5dfc414..8dd59425ae350b29774b31c3b243fbc62611a527 100644 (file)
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;
}
}
}
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
unclump (to_unclump);
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 463339534d0de8188b312c5f42102ef526de934a..6513813cc0e0ba49b151aec6860232c205573d3e 100644 (file)
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
}
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;
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;
index 215fc4d026ab51e00a2296c5992193bd28971fcb..73082f4c053ed14cdc47cd32c1165c4f87653f6f 100644 (file)
if (!SVGElem) return 0;
// prep the document
- sp_document_ensure_up_to_date(document);
+ document->ensure_up_to_date();
NRArena* arena = NRArena::create();
unsigned const key = SPItem::display_key_new(1);
NRArenaItem* ai = SVGElem->invoke_show(arena, key, SP_ITEM_SHOW_DISPLAY);
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index ae1c82e71f4e4d2e02b4ab2e6e480599ac26096f..ee15e480f820d639196e9c8a404c0c19bd1243a9 100644 (file)
--- a/src/document-undo.cpp
+++ b/src/document-undo.cpp
@@ -176,7 +176,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev
doc->collectOrphans();
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
sp_document_clear_redo (doc);
diff --git a/src/document.cpp b/src/document.cpp
index 0479569f6cdc031ad37be5ed709ccfa613fd0016..147c22b3c1dbd476a1399e139b94f67449836cbb 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
}
SPDocument *
-sp_document_create(Inkscape::XML::Document *rdoc,
+SPDocument::createDoc(Inkscape::XML::Document *rdoc,
gchar const *uri,
gchar const *base,
gchar const *name,
* appears in document list.
*/
SPDocument *
-SPDocument::createDoc(gchar const *uri, unsigned int keepalive, bool make_new)
+SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new)
{
SPDocument *doc;
Inkscape::XML::Document *rdoc;
//# These should be set by now
g_assert(name);
- doc = sp_document_create(rdoc, uri, base, name, keepalive);
+ doc = createDoc(rdoc, uri, base, name, keepalive);
g_free(base);
g_free(name);
}
SPDocument *
-SPDocument::createDocFromMem(gchar const *buffer, gint length, unsigned int keepalive)
+SPDocument::createNewDocFromMem(gchar const *buffer, gint length, unsigned int keepalive)
{
SPDocument *doc;
Inkscape::XML::Document *rdoc;
@@ -509,7 +509,7 @@ SPDocument::createDocFromMem(gchar const *buffer, gint length, unsigned int keep
name = g_strdup_printf(_("Memory document %d"), ++doc_count);
- doc = sp_document_create(rdoc, NULL, NULL, name, keepalive);
+ doc = createDoc(rdoc, NULL, NULL, name, keepalive);
return doc;
}
@@ -517,7 +517,7 @@ SPDocument::createDocFromMem(gchar const *buffer, gint length, unsigned int keep
SPDocument *
SPDocument::doRef()
{
- //g_return_val_if_fail(doc != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
Inkscape::GC::anchor(this);
return this;
}
SPDocument *
SPDocument::doUnref()
{
- //g_return_val_if_fail(doc != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
Inkscape::GC::release(this);
return NULL;
}
-gdouble sp_document_width(SPDocument *document)
+gdouble SPDocument::getWidth()
{
- g_return_val_if_fail(document != NULL, 0.0);
- g_return_val_if_fail(document->priv != NULL, 0.0);
- g_return_val_if_fail(document->root != NULL, 0.0);
+ g_return_val_if_fail(this != NULL, 0.0);
+ g_return_val_if_fail(this->priv != NULL, 0.0);
+ g_return_val_if_fail(this->root != NULL, 0.0);
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->width.unit == SVGLength::PERCENT && root->viewBox_set)
return root->viewBox.x1 - root->viewBox.x0;
}
void
-sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit)
+SPDocument::setWidth (gdouble width, const SPUnit *unit)
{
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox=
root->viewBox.x1 = root->viewBox.x0 + sp_units_get_pixels (width, *unit);
SP_OBJECT (root)->updateRepr();
}
-void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit *unit)
+void SPDocument::setHeight (gdouble height, const SPUnit *unit)
{
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox=
root->viewBox.y1 = root->viewBox.y0 + sp_units_get_pixels (height, *unit);
@@ -596,22 +596,22 @@ void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit
SP_OBJECT (root)->updateRepr();
}
-gdouble sp_document_height(SPDocument *document)
+gdouble SPDocument::getHeight()
{
- g_return_val_if_fail(document != NULL, 0.0);
- g_return_val_if_fail(document->priv != NULL, 0.0);
- g_return_val_if_fail(document->root != NULL, 0.0);
+ g_return_val_if_fail(this != NULL, 0.0);
+ g_return_val_if_fail(this->priv != NULL, 0.0);
+ g_return_val_if_fail(this->root != NULL, 0.0);
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->height.unit == SVGLength::PERCENT && root->viewBox_set)
return root->viewBox.y1 - root->viewBox.y0;
return root->height.computed;
}
-Geom::Point sp_document_dimensions(SPDocument *doc)
+Geom::Point SPDocument::getDimensions()
{
- return Geom::Point(sp_document_width(doc), sp_document_height(doc));
+ return Geom::Point(getWidth(), getHeight());
}
/**
double const w = rect.width();
double const h = rect.height();
- double const old_height = sp_document_height(this);
+ double const old_height = getHeight();
SPUnit const &px(sp_unit_get_by_id(SP_UNIT_PX));
/* in px */
rect.max() + Geom::Point(margin_right, margin_top));
- sp_document_set_width(this, rect_with_margins.width(), &px);
- sp_document_set_height(this, rect_with_margins.height(), &px);
+ setWidth(rect_with_margins.width(), &px);
+ setHeight(rect_with_margins.height(), &px);
Geom::Translate const tr(
Geom::Point(0, old_height - rect_with_margins.height())
@@ -774,11 +774,11 @@ do_change_uri(SPDocument *const document, gchar const *const filename, bool cons
*
* \see sp_document_change_uri_and_hrefs
*/
-void sp_document_set_uri(SPDocument *document, gchar const *filename)
+void SPDocument::setUri(gchar const *filename)
{
- g_return_if_fail(document != NULL);
+ g_return_if_fail(this != NULL);
- do_change_uri(document, filename, false);
+ do_change_uri(this, filename, false);
}
/**
*
* \see sp_document_set_uri
*/
-void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *filename)
+void SPDocument::change_uri_and_hrefs(gchar const *filename)
{
- g_return_if_fail(document != NULL);
+ g_return_if_fail(this != NULL);
- do_change_uri(document, filename, true);
+ do_change_uri(this, filename, true);
}
void
-sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height)
+SPDocument::resized_signal_emit(gdouble width, gdouble height)
{
- g_return_if_fail(doc != NULL);
+ g_return_if_fail(this != NULL);
- doc->priv->resized_signal.emit(width, height);
+ this->priv->resized_signal.emit(width, height);
}
sigc::connection SPDocument::connectModified(SPDocument::ModifiedSignal::slot_type slot)
/* Object modification root handler */
void
-sp_document_request_modified(SPDocument *doc)
+SPDocument::request_modified()
{
- if (!doc->modified_id) {
- doc->modified_id = g_idle_add_full(SP_DOCUMENT_UPDATE_PRIORITY,
- sp_document_idle_handler, doc, NULL);
+ if (!modified_id) {
+ modified_id = g_idle_add_full(SP_DOCUMENT_UPDATE_PRIORITY,
+ sp_document_idle_handler, this, NULL);
}
- if (!doc->rerouting_handler_id) {
- doc->rerouting_handler_id = g_idle_add_full(SP_DOCUMENT_REROUTING_PRIORITY,
- sp_document_rerouting_handler, doc, NULL);
+ if (!rerouting_handler_id) {
+ rerouting_handler_id = g_idle_add_full(SP_DOCUMENT_REROUTING_PRIORITY,
+ sp_document_rerouting_handler, this, NULL);
}
}
* since this typically indicates we're stuck in an update loop.
*/
gint
-sp_document_ensure_up_to_date(SPDocument *doc)
+SPDocument::ensure_up_to_date()
{
// Bring the document up-to-date, specifically via the following:
// 1a) Process all document updates.
int counter = 32;
for (unsigned int pass = 1; pass <= 2; ++pass) {
// Process document updates.
- while (!doc->_updateDocument()) {
+ while (!_updateDocument()) {
if (counter == 0) {
- g_warning("More than 32 iteration while updating document '%s'", doc->uri);
+ g_warning("More than 32 iteration while updating document '%s'", uri);
break;
}
counter--;
// changed objects and provide new routings. This may cause some objects
// to be modified, hence the second update pass.
if (pass == 1) {
- doc->router->processTransaction();
+ router->processTransaction();
}
}
- if (doc->modified_id) {
+ if (modified_id) {
/* Remove handler */
- g_source_remove(doc->modified_id);
- doc->modified_id = 0;
+ g_source_remove(modified_id);
+ modified_id = 0;
}
- if (doc->rerouting_handler_id) {
+ if (rerouting_handler_id) {
/* Remove handler */
- g_source_remove(doc->rerouting_handler_id);
- doc->rerouting_handler_id = 0;
+ g_source_remove(rerouting_handler_id);
+ rerouting_handler_id = 0;
}
return counter>0;
}
Returns the bottommost item from the list which is at the point, or NULL if none.
*/
SPItem*
-sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GSList const *list,
- Geom::Point const p, bool take_insensitive)
+SPDocument::item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GSList const *list,Geom::Point const p, bool take_insensitive)
{
g_return_val_if_fail(group, NULL);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -1176,7 +1175,7 @@ sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GS
}
if (SP_IS_GROUP(o)) {
- SPItem *found = sp_document_item_from_list_at_point_bottom(dkey, SP_GROUP(o), list, p, take_insensitive);
+ SPItem *found = item_from_list_at_point_bottom(dkey, SP_GROUP(o), list, p, take_insensitive);
if (found)
return found;
}
*
*/
-GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box)
+GSList *SPDocument::items_in_box(unsigned int dkey, Geom::Rect const &box)
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_items_in_area(NULL, SP_GROUP(document->root), dkey, box, is_within);
+ return find_items_in_area(NULL, SP_GROUP(this->root), dkey, box, is_within);
}
/*
@@ -1285,16 +1284,16 @@ GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::
*
*/
-GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box)
+GSList *SPDocument::partial_items_in_box(unsigned int dkey, Geom::Rect const &box)
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_items_in_area(NULL, SP_GROUP(document->root), dkey, box, overlaps);
+ return find_items_in_area(NULL, SP_GROUP(this->root), dkey, box, overlaps);
}
GSList *
-sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points)
+SPDocument::items_at_points(unsigned const key, std::vector<Geom::Point> points)
{
GSList *items = NULL;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -1306,7 +1305,7 @@ sp_document_items_at_points(SPDocument *document, unsigned const key, std::vecto
prefs->setDouble("/options/cursortolerance/value", 0.25);
for(unsigned int i = 0; i < points.size(); i++) {
- SPItem *item = sp_document_item_at_point(document, key, points[i],
+ SPItem *item = item_at_point(key, points[i],
false, NULL);
if (item && !g_slist_find(items, item))
items = g_slist_prepend (items, item);
@@ -1319,34 +1318,34 @@ sp_document_items_at_points(SPDocument *document, unsigned const key, std::vecto
}
SPItem *
-sp_document_item_at_point(SPDocument *document, unsigned const key, Geom::Point const p,
+SPDocument::item_at_point( unsigned const key, Geom::Point const p,
gboolean const into_groups, SPItem *upto)
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_item_at_point(key, SP_GROUP(document->root), p, into_groups, false, upto);
+ return find_item_at_point(key, SP_GROUP(this->root), p, into_groups, false, upto);
}
SPItem*
-sp_document_group_at_point(SPDocument *document, unsigned int key, Geom::Point const p)
+SPDocument::group_at_point(unsigned int key, Geom::Point const p)
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_group_at_point(key, SP_GROUP(document->root), p);
+ return find_group_at_point(key, SP_GROUP(this->root), p);
}
/* Resource management */
gboolean
-sp_document_add_resource(SPDocument *document, gchar const *key, SPObject *object)
+SPDocument::add_resource(gchar const *key, SPObject *object)
{
GSList *rlist;
GQuark q = g_quark_from_string(key);
- g_return_val_if_fail(document != NULL, FALSE);
+ g_return_val_if_fail(this != NULL, FALSE);
g_return_val_if_fail(key != NULL, FALSE);
g_return_val_if_fail(*key != '\0', FALSE);
g_return_val_if_fail(object != NULL, FALSE);
@@ -1355,23 +1354,23 @@ sp_document_add_resource(SPDocument *document, gchar const *key, SPObject *objec
if (SP_OBJECT_IS_CLONED(object))
return FALSE;
- rlist = (GSList*)g_hash_table_lookup(document->priv->resources, key);
+ rlist = (GSList*)g_hash_table_lookup(this->priv->resources, key);
g_return_val_if_fail(!g_slist_find(rlist, object), FALSE);
rlist = g_slist_prepend(rlist, object);
- g_hash_table_insert(document->priv->resources, (gpointer) key, rlist);
+ g_hash_table_insert(this->priv->resources, (gpointer) key, rlist);
- document->priv->resources_changed_signals[q].emit();
+ this->priv->resources_changed_signals[q].emit();
return TRUE;
}
gboolean
-sp_document_remove_resource(SPDocument *document, gchar const *key, SPObject *object)
+SPDocument::remove_resource(gchar const *key, SPObject *object)
{
GSList *rlist;
GQuark q = g_quark_from_string(key);
- g_return_val_if_fail(document != NULL, FALSE);
+ g_return_val_if_fail(this != NULL, FALSE);
g_return_val_if_fail(key != NULL, FALSE);
g_return_val_if_fail(*key != '\0', FALSE);
g_return_val_if_fail(object != NULL, FALSE);
@@ -1380,33 +1379,32 @@ sp_document_remove_resource(SPDocument *document, gchar const *key, SPObject *ob
if (SP_OBJECT_IS_CLONED(object))
return FALSE;
- rlist = (GSList*)g_hash_table_lookup(document->priv->resources, key);
+ rlist = (GSList*)g_hash_table_lookup(this->priv->resources, key);
g_return_val_if_fail(rlist != NULL, FALSE);
g_return_val_if_fail(g_slist_find(rlist, object), FALSE);
rlist = g_slist_remove(rlist, object);
- g_hash_table_insert(document->priv->resources, (gpointer) key, rlist);
+ g_hash_table_insert(this->priv->resources, (gpointer) key, rlist);
- document->priv->resources_changed_signals[q].emit();
+ this->priv->resources_changed_signals[q].emit();
return TRUE;
}
GSList const *
-sp_document_get_resource_list(SPDocument *document, gchar const *key)
+SPDocument::get_resource_list(gchar const *key)
{
- g_return_val_if_fail(document != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
g_return_val_if_fail(key != NULL, NULL);
g_return_val_if_fail(*key != '\0', NULL);
- return (GSList*)g_hash_table_lookup(document->priv->resources, key);
+ return (GSList*)g_hash_table_lookup(this->priv->resources, key);
}
-sigc::connection sp_document_resources_changed_connect(SPDocument *document,
- gchar const *key,
+sigc::connection SPDocument::resources_changed_connect(gchar const *key,
SPDocument::ResourcesChangedSignal::slot_type slot)
{
GQuark q = g_quark_from_string(key);
- return document->priv->resources_changed_signals[q].connect(slot);
+ return this->priv->resources_changed_signals[q].connect(slot);
}
/* Helpers */
}
unsigned int
-vacuum_document(SPDocument *document)
+SPDocument::vacuum_document()
{
- unsigned int start = objects_in_document(document);
+ unsigned int start = objects_in_document(this);
unsigned int end;
unsigned int newend = start;
do {
end = newend;
- vacuum_document_recursive(SP_DOCUMENT_ROOT(document));
- document->collectOrphans();
+ vacuum_document_recursive(SP_DOCUMENT_ROOT(this));
+ this->collectOrphans();
iterations++;
- newend = objects_in_document(document);
+ newend = objects_in_document(this);
} while (iterations < 100 && newend < end);
diff --git a/src/document.h b/src/document.h
index 2f9da781764328158f6e983ca71a602b120f9697..3fa83c779394f9ae6c00d8cddce4229f2beb0a6b 100644 (file)
--- a/src/document.h
+++ b/src/document.h
sigc::connection _desktop_activated_connection;
void fitToRect(Geom::Rect const &rect, bool with_margins = false);
- static SPDocument *createDoc(const gchar *uri, unsigned int keepalive, bool make_new = false);
- static SPDocument *createDocFromMem(const gchar *buffer, gint length, unsigned int keepalive);
+ static SPDocument *createNewDoc(const gchar *uri, unsigned int keepalive, bool make_new = false);
+ static SPDocument *createNewDocFromMem(const gchar *buffer, gint length, unsigned int keepalive);
+
+ /* ToDo - Merge createDoc with createNewDoc */
+ static SPDocument *createDoc(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
+
SPDocument *doRef();
SPDocument *doUnref();
+ gdouble getWidth();
+ gdouble getHeight();
+ Geom::Point getDimensions();
+ void setWidth(gdouble width, const SPUnit *unit);
+ void setHeight(gdouble height, const SPUnit *unit);
+ //void setUndoSensitive(bool sensitive);
+ void request_modified();
+ gint ensure_up_to_date();
+ gboolean add_resource(const gchar *key, SPObject *object);
+ gboolean remove_resource(const gchar *key, SPObject *object);
+ const GSList *get_resource_list(const gchar *key);
+ sigc::connection resources_changed_connect(const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
+ GSList * items_in_box(unsigned int dkey, Geom::Rect const &box);
+ GSList *partial_items_in_box(unsigned int dkey, Geom::Rect const &box);
+ static SPItem *item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
+ SPItem *item_at_point (unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
+ GSList *items_at_points(unsigned const key, std::vector<Geom::Point> points);
+ SPItem *group_at_point (unsigned int key, Geom::Point const p);
+
+ void setUri(gchar const *uri);
+ void change_uri_and_hrefs(gchar const *uri);
+ void resized_signal_emit(gdouble width, gdouble height);
+
+ unsigned int vacuum_document();
};
//SPDocument *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false);
//SPDocument *sp_document_unref(SPDocument *doc);
-SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
+//SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
/*
* Access methods
@@ -205,14 +233,14 @@ SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri,
#define sp_document_root(d) (d->root)
#define SP_DOCUMENT_ROOT(d) (d->root)
-gdouble sp_document_width(SPDocument *document);
-gdouble sp_document_height(SPDocument *document);
-Geom::Point sp_document_dimensions(SPDocument *document);
+//gdouble sp_document_width(SPDocument *document);
+//gdouble sp_document_height(SPDocument *document);
+//Geom::Point sp_document_dimensions(SPDocument *document);
struct SPUnit;
-void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit);
-void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit);
+//void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit);
+//void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit);
#define SP_DOCUMENT_URI(d) (d->uri)
#define SP_DOCUMENT_NAME(d) (d->name)
void sp_document_clear_undo(SPDocument *document);
void sp_document_clear_redo(SPDocument *document);
-void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
-void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
-void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval);
-void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent);
-void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref);
+//void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
+//void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
+//void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval);
+//void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent);
+//void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref);
/* Object modification root handler */
-void sp_document_request_modified(SPDocument *doc);
-gint sp_document_ensure_up_to_date(SPDocument *doc);
+//void sp_document_request_modified(SPDocument *doc);
+//gint sp_document_ensure_up_to_date(SPDocument *doc);
/* Save all previous actions to stack, as one undo step */
void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description);
gboolean sp_document_redo(SPDocument *document);
/* Resource management */
-gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object);
-gboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object);
-const GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key);
-sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
+//gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object);
+//gboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object);
+//const GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key);
+//sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
/*
@@ -279,19 +307,19 @@ sigc::connection sp_document_resources_changed_connect(SPDocument *document, con
* Misc
*/
-GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
-GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
-SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
-SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
-GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
-SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p);
+//GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
+//GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
+//SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
+//SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
+//GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
+//SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p);
-void sp_document_set_uri(SPDocument *document, gchar const *uri);
-void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri);
+//void sp_document_set_uri(SPDocument *document, gchar const *uri);
+//void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri);
-void sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height);
+//void sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height);
-unsigned int vacuum_document(SPDocument *document);
+//unsigned int vacuum_document(SPDocument *document);
#endif
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 52118eb16a8cfab590d9b1769a64b3d8a53f13af..ea25efc225f7712dd905e60b219efcc0b9480ea2 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
c->unref();
/* Flush pending updates */
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
}
/**
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 46efd403a5ce5e22c8f33832ee4bba06708766eb..db1aa46d9be7faa83c4c531e051d5f7e9f58ecb9 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
GSList* toWorkOn = 0;
if (selection->isEmpty()) {
if ( eraserMode ) {
- toWorkOn = sp_document_partial_items_in_box(sp_desktop_document(desktop), desktop->dkey, bounds);
+ toWorkOn = sp_desktop_document(desktop)->partial_items_in_box(desktop->dkey, bounds);
} else {
Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
- toWorkOn = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints());
+ toWorkOn = sp_desktop_document(desktop)->items_at_points(desktop->dkey, r->getPoints());
}
toWorkOn = g_slist_remove( toWorkOn, acid );
} else {
index e075feb913bb3b4a7820250dfd4fd99651f36491..36cc5787b0ab4d3862edfbb8fbdca3cfcacbc7e2 100644 (file)
if (mydoc != NULL) {
g_free(mydoc->base);
mydoc->base = NULL;
- sp_document_change_uri_and_hrefs(mydoc, filenameArg);
+ mydoc->change_uri_and_hrefs(filenameArg);
}
// make sure we don't leak file descriptors from g_file_open_tmp
index 143d7236241733875e347a1edaf7df85b1e09629..75edacdb759c5c165bf9f63a5cf7cc03ffa9d245 100644 (file)
}
g_free(s);
- SPDocument * doc = sp_document_create(rdoc, filename, base, name, true);
+ SPDocument * doc = SPDocument::createDoc(rdoc, filename, base, name, true);
g_free(base); g_free(name);
index d7b7cc862a8a6a890a41f9898d732b8128e99fa8..14a2f1b17006849d4b71234913e83b27cfa0a4e2 100644 (file)
CairoRenderer *renderer;
CairoRenderContext *ctx;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
/* Start */
/* Create new arena */
index 59daafb7ef5995752e130a61373ec1cc60e0e2af..76b68bf2c0ffb92a9e5d1c2ee4738cd23b0a29a9 100644 (file)
ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool omittext,
bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, bool eps = false)
{
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
SPItem *base = NULL;
diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp
index d7a0342914406c337f65704679e7e5d4753c57c4..6536361bdc13130bbf2e9ed478049857a2841ff0 100644 (file)
bool texttopath, bool omittext, bool filtertobitmap, int resolution,
const gchar * const exportId, bool exportDrawing, bool exportCanvas)
{
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
/* Start */
index 5b05cd96bbc25b920d313c24a4c6aac74f47a098..81531b2db915b8661355497b30ce2265a860998c 100644 (file)
@@ -608,8 +608,8 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page
NRRect d;
if (pageBoundingBox) {
d.x0 = d.y0 = 0;
- d.x1 = sp_document_width(doc);
- d.y1 = sp_document_height(doc);
+ d.x1 = doc->getWidth();
+ d.y1 = doc->getHeight();
} else {
base->invoke_bbox( &d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX);
}
@@ -631,7 +631,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page
if (ret && !pageBoundingBox)
{
- double high = sp_document_height(doc);
+ double high = doc->getHeight();
if (ctx->_vector_based_target)
high *= PT_PER_PX;
diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp
index 0d939427c494779f5f398af3a3e74bdf69c6df1c..aa856e910b40ef237725655cd6066da73b49d21c 100644 (file)
gchar *oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
mod = Inkscape::Extension::get_print(PRINT_EMF_WIN32);
oldconst = mod->get_param_string("destination");
// std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl;
- SPDocument *doc = SPDocument::createDocFromMem(d.outsvg->c_str(), d.outsvg->length(), TRUE);
+ SPDocument *doc = SPDocument::createNewDocFromMem(d.outsvg->c_str(), d.outsvg->length(), TRUE);
delete d.outsvg;
delete d.path;
diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp
index 21bb85331d507f6a7cf207f74b89b05990d700ff..e8e6b3187e30e3bc0ac9617543a74ef9b86e1887 100644 (file)
WCHAR *unicode_uri = (WCHAR *) unicode_fn;
// width and height in px
- _width = sp_document_width(doc);
- _height = sp_document_height(doc);
+ _width = doc->getWidth();
+ _height = doc->getHeight();
NRRect d;
bool pageBoundingBox;
g_free(local_fn);
g_free(unicode_fn);
- m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, sp_document_height(doc)));
+ m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight()));
return 0;
}
diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp
index 2e10dae58d0d5eadb6962e67889930764af83208..4983d7eff4069a994f253dbc6fb4d6f736109461 100644 (file)
mime_type = "image/png";
}
- doc = SPDocument::createDoc(NULL, TRUE, TRUE);
+ doc = SPDocument::createNewDoc(NULL, TRUE, TRUE);
bool saved = sp_document_get_undo_sensitive(doc);
sp_document_set_undo_sensitive(doc, false); // no need to undo in this temporary document
index d33975f9130217fbf59e61f49d589101e1d3591a..6b11aa994dd90159bae5aa072a437c2f0ffb212a 100644 (file)
fclose(gradient);
- return SPDocument::createDocFromMem(outsvg.c_str(), outsvg.length(), TRUE);
+ return SPDocument::createNewDocFromMem(outsvg.c_str(), outsvg.length(), TRUE);
}
error:
index 1593ffe795f394881f4cd04719324a1f29344417..8132ba1ad71295b731a20c44ec60d201c4cef0f9 100644 (file)
@@ -87,14 +87,14 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
/* get page size */
SPDocument * doc = document->doc();
bounding_area = Geom::Rect( Geom::Point(0,0),
- Geom::Point(sp_document_width(doc), sp_document_height(doc)) );
+ Geom::Point(doc->getWidth(), doc->getHeight()) );
} else {
Geom::OptRect bounds = selection->bounds();
if (bounds) {
bounding_area = *bounds;
}
- gdouble doc_height = sp_document_height(document->doc());
+ gdouble doc_height = (document->doc())->getHeight();
Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]),
Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y]));
diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp
index c2d14f6a5e76e6a1c7c7eb72c3e4d8682ea9b9cc..a474193651c0baf94e265f84fa2af08b0802ac48 100644 (file)
gchar * oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX);
oldconst = mod->get_param_string("destination");
index 34b7532cee112fe1038c09feef1fff12a8f47d53..63e9d3803fe7c37cc97fe5c3961446406fb842b5 100644 (file)
}
// width and height in pt
- _width = sp_document_width(doc) * PT_PER_PX;
- _height = sp_document_height(doc) * PT_PER_PX;
+ _width = doc->getWidth() * PT_PER_PX;
+ _height = doc->getHeight() * PT_PER_PX;
if (res >= 0) {
os << "\\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}\n";
// from now on we can output px, but they will be treated as pt
- os << "\\begin{pspicture}(" << sp_document_width(doc) << "," << sp_document_height(doc) << ")\n";
+ os << "\\begin{pspicture}(" << doc->getWidth() << "," << doc->getHeight() << ")\n";
}
- m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, sp_document_height(doc)));
+ m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight()));
return fprintf(_stream, "%s", os.str().c_str());
}
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index cd712e477741319475f4e91cdfc61afdeb3167a4..d944de71ad22bdde1aa0c59e63ac7b039a3d0899 100644 (file)
const gchar * const exportId, bool exportDrawing, bool exportCanvas,
bool pdflatex)
{
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
SPItem *base = NULL;
@@ -496,7 +496,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *
Geom::OptRect d;
if (pageBoundingBox) {
d = Geom::Rect( Geom::Point(0,0),
- Geom::Point(sp_document_width(doc), sp_document_height(doc)) );
+ Geom::Point(doc->getWidth(), doc->getHeight()) );
} else {
base->invoke_bbox( d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX);
}
@@ -517,7 +517,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *
}
// flip y-axis
- push_transform( Geom::Scale(1,-1) * Geom::Translate(0, sp_document_height(doc)) );
+ push_transform( Geom::Scale(1,-1) * Geom::Translate(0, doc->getHeight()) );
// write the info to LaTeX
Inkscape::SVGOStringStream os;
index 4e89ce7b2764eba692de005ea2fa1d8de9f5fdcf..aadb9ee171995866437803c5ff9b39f176c32f31 100644 (file)
//### Get SVG-to-ODF transform
Geom::Matrix tf (item->i2d_affine());
//Flip Y into document coordinates
- double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
+ double doc_height = SP_ACTIVE_DOCUMENT->getHeight();
Geom::Matrix doc2dt_tf = Geom::Matrix(Geom::Scale(1.0, -1.0));
doc2dt_tf = doc2dt_tf * Geom::Matrix(Geom::Translate(0, doc_height));
tf = tf * doc2dt_tf;
Geom::OptRect bbox;
if (bbox_temp) {
bbox = *bbox_temp;
- double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
+ double doc_height = SP_ACTIVE_DOCUMENT->getHeight();
Geom::Matrix doc2dt_tf = Geom::Matrix(Geom::Scale(1.0, -1.0));
doc2dt_tf = doc2dt_tf * Geom::Matrix(Geom::Translate(0, doc_height));
bbox = *bbox * doc2dt_tf;
diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp
index e3abc63d4d3c5d1477173fcac6ac62fbe428f960..62c6b7f369b3007d2883a66eb3e706128427e0af 100644 (file)
cairo_destroy(cr);
cairo_surface_destroy(surface);
- SPDocument * doc = SPDocument::createDocFromMem(output->c_str(), output->length(), TRUE);
+ SPDocument * doc = SPDocument::createNewDocFromMem(output->c_str(), output->length(), TRUE);
delete output;
g_object_unref(page);
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index e771d8b416c396ff5ef12920f8b3629f5176d0d9..9826addb6fb209624b8f08d36b5b39a0be2f8c6e 100644 (file)
Catalog *catalog = pdf_doc->getCatalog();
Page *page = catalog->getPage(page_num);
- SPDocument *doc = SPDocument::createDoc(NULL, TRUE, TRUE);
+ SPDocument *doc = SPDocument::createNewDoc(NULL, TRUE, TRUE);
bool saved = sp_document_get_undo_sensitive(doc);
sp_document_set_undo_sensitive(doc, false); // No need to undo in this temporary document
index c063be46c81434918159f69c3f810094013a38e2..e80e316cfe975ceb968f1663633c893d80435ba4 100644 (file)
#ifdef WITH_GNOME_VFS
if (!gnome_vfs_initialized() || gnome_vfs_uri_is_local(gnome_vfs_uri_new(uri))) {
// Use built-in loader instead of VFS for this
- return SPDocument::createDoc(uri, TRUE);
+ return SPDocument::createNewDoc(uri, TRUE);
}
gchar * buffer = _load_uri(uri);
if (buffer == NULL) {
g_warning("Error: Could not open file '%s' with VFS\n", uri);
return NULL;
}
- SPDocument * doc = SPDocument::createDocFromMem(buffer, strlen(buffer), 1);
+ SPDocument * doc = SPDocument::createNewDocFromMem(buffer, strlen(buffer), 1);
g_free(buffer);
return doc;
#else
- return SPDocument::createDoc(uri, TRUE);
+ return SPDocument::createNewDoc(uri, TRUE);
#endif
}
index 21f27885850115b34c7448be7815f5ce116fd8ff..3522ab2479442d76d395962598a5cfc4bc702f0f 100644 (file)
};
int res;
- _PageWidth = sp_document_width (doc);
- _PageHeight = sp_document_height (doc);
+ _PageWidth = doc->getWidth ();
+ _PageHeight = doc->getHeight ();
di.lpszDocName = SP_DOCUMENT_NAME (doc);
index 023bab8796b835d5aebae2b03da4c70e1c76a6c0..02247ffa049c68c9bac38738d654762f31130062 100644 (file)
//printf("I've got a doc: \n%s", painter.document.c_str());
- SPDocument * doc = SPDocument::createDocFromMem(output.cstr(), strlen(output.cstr()), TRUE);
+ SPDocument * doc = SPDocument::createNewDocFromMem(output.cstr(), strlen(output.cstr()), TRUE);
delete input;
return doc;
}
index 6ffa7f57f8428b6c3c60edf4efa48390c2e18b0a..67720235dd80eaa30db29bd939ce65a81c8606e5 100644 (file)
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
to make sure for this release -- TJG */
doc->setModifiedSinceSave(false);
- sp_document_set_uri(doc, filename);
+ doc->setUri(filename);
return doc;
}
saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss"));
if (official) {
/* The document is changing name/uri. */
- sp_document_change_uri_and_hrefs(doc, fileName);
+ doc->change_uri_and_hrefs(fileName);
}
// Update attributes:
repr->setAttribute("inkscape:dataloss", saved_dataloss);
}
sp_document_set_undo_sensitive(doc, saved);
- sp_document_change_uri_and_hrefs(doc, saved_uri);
+ doc->change_uri_and_hrefs(saved_uri);
}
doc->setModifiedSinceSave(saved_modified);
// free used ressources
diff --git a/src/file.cpp b/src/file.cpp
index 352362424feaea625fe1ec9f79be6cf291eecbb7..6b162c79978f404dde2ba936fdba45437f133c93 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
char *templName = NULL;
if (templ.size()>0)
templName = (char *)templ.c_str();
- SPDocument *doc = SPDocument::createDoc(templName, TRUE, true);
+ SPDocument *doc = SPDocument::createNewDoc(templName, TRUE, true);
g_return_val_if_fail(doc != NULL, NULL);
SPDesktop *dt;
if (existing && existing->virgin && replace_empty) {
// If the current desktop is empty, open the document there
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
desktop->change_document(doc);
- sp_document_resized_signal_emit (doc, sp_document_width(doc), sp_document_height(doc));
+ doc->resized_signal_emit (doc->getWidth(), doc->getHeight());
} else {
if (!Inkscape::NSApplication::Application::getNewGui()) {
// create a whole new desktop and window
{
SPDocument *doc = SP_ACTIVE_DOCUMENT;
- unsigned int diff = vacuum_document (doc);
+ unsigned int diff = doc->vacuum_document ();
sp_document_done(doc, SP_VERB_FILE_VACUUM,
_("Vacuum <defs>"));
// preserve parent and viewBox transformations
// c2p is identity matrix at this point unless sp_document_ensure_up_to_date is called
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
Geom::Matrix affine = SP_ROOT(SP_DOCUMENT_ROOT(doc))->c2p * SP_ITEM(place_to_insert)->i2doc_affine().inverse();
sp_selection_apply_affine(selection, desktop->dt2doc() * affine * desktop->doc2dt(), true, false);
// move to mouse pointer
{
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
Geom::OptRect sel_bbox = selection->bounds();
if (sel_bbox) {
Geom::Point m( desktop->point() - sel_bbox->midpoint() );
diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp
index 8edb9cf2d3df096bb21d314dd0fe11f11432995b..1dbf07dd51b59428ca8ace2382143c29c52db4fa 100644 (file)
//is this necessary?
- sp_document_add_resource(document, "fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
+ document->add_resource("fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fefuncnode", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("fefuncnode", SP_OBJECT(object));
}
//TODO: release resources here
index 27e63eaa608c74363cc34a4e245b17b612a5668e..e8a5739987630f8b33552667e9e4cc9495e7d682 100644 (file)
@@ -100,7 +100,7 @@ sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::X
/*LOAD ATTRIBUTES FROM REPR HERE*/
//do we need this?
- sp_document_add_resource(document, "feComponentTransfer", object);
+ document->add_resource("feComponentTransfer", object);
}
static void sp_feComponentTransfer_children_modified(SPFeComponentTransfer *sp_componenttransfer)
index 41584c4a4c17c664bdb41adf50b3727e9ca42cfd..55c51aa0e395e6985a8203e0cf55389ac02b9924 100644 (file)
@@ -105,7 +105,7 @@ sp_fedistantlight_build(SPObject *object, SPDocument *document, Inkscape::XML::N
sp_object_read_attr(object, "elevation");
//is this necessary?
- sp_document_add_resource(document, "fedistantlight", object);
+ document->add_resource("fedistantlight", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fedistantlight", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("fedistantlight", SP_OBJECT(object));
}
//TODO: release resources here
index ce58cf13e34f52d0719fb054a7ad2f87e33deccf..fed07ecf366e079802cdc76c8b452546f6c08084 100644 (file)
@@ -109,7 +109,7 @@ sp_fepointlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Nod
sp_object_read_attr(object, "z");
//is this necessary?
- sp_document_add_resource(document, "fepointlight", object);
+ document->add_resource("fepointlight", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fepointlight", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("fepointlight", SP_OBJECT(object));
}
//TODO: release resources here
index 3b518f0b430653e24f71ffa8a9f478f94e6fd3fe..613763751874f05a3e7e6b9be51c5b45e60e4a76 100644 (file)
@@ -124,7 +124,7 @@ sp_fespotlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node
sp_object_read_attr(object, "limitingConeAngle");
//is this necessary?
- sp_document_add_resource(document, "fespotlight", object);
+ document->add_resource("fespotlight", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fespotlight", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("fespotlight", SP_OBJECT(object));
}
//TODO: release resources here
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index f8c2e14a0165ae1798548eb93ec246d62f73f316..019cbbb0294c54c184bf92bcabffc8501de49039 100644 (file)
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -776,7 +776,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
NRArena *arena = NRArena::create();
unsigned dkey = SPItem::display_key_new(1);
- sp_document_ensure_up_to_date (document);
+ document->ensure_up_to_date ();
SPItem *document_root = SP_ITEM(SP_DOCUMENT_ROOT(document));
Geom::OptRect bbox = document_root->getBounds(Geom::identity());
@@ -798,7 +798,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
unsigned int height = (int)ceil(screen.height() * zoom_scale * padding);
Geom::Point origin(screen.min()[Geom::X],
- sp_document_height(document) - screen.height() - screen.min()[Geom::Y]);
+ document->getHeight() - screen.height() - screen.min()[Geom::Y]);
origin[Geom::X] = origin[Geom::X] + (screen.width() * ((1 - padding) / 2));
origin[Geom::Y] = origin[Geom::Y] + (screen.height() * ((1 - padding) / 2));
@@ -905,7 +905,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
}
for (unsigned int i = 0; i < fill_points.size(); i++) {
- Geom::Point pw = Geom::Point(fill_points[i][Geom::X] / zoom_scale, sp_document_height(document) + (fill_points[i][Geom::Y] / zoom_scale)) * affine;
+ Geom::Point pw = Geom::Point(fill_points[i][Geom::X] / zoom_scale, document->getHeight() + (fill_points[i][Geom::Y] / zoom_scale)) * affine;
pw[Geom::X] = (int)MIN(width - 1, MAX(0, pw[Geom::X]));
pw[Geom::Y] = (int)MIN(height - 1, MAX(0, pw[Geom::Y]));
index 56d4813fb4f7b55bf796f6956f7e54e2b9fbdb99..76b29bb0959eed217702a67b1a2e7ad4e3a927b6 100644 (file)
Inkscape::XML::Node *repr = SP_OBJECT_REPR(gr);
// calculate the bbox of the item
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
+ SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if (!bbox)
@@ -345,7 +345,7 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
Inkscape::XML::Node *repr = SP_OBJECT_REPR(gr);
// calculate the bbox of the item
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
+ SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
Geom::Matrix bbox2user;
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if ( bbox ) {
@@ -1040,7 +1040,7 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
}
if (SP_GRADIENT(gradient)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
+ SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if (bbox) {
p *= Geom::Matrix(bbox->dimensions()[Geom::X], 0,
index ebcee1a642e77c702565f67e0a0f6021d1dec50f..2b0d5781a6e1442078a87fd1c93634c228d49ef8 100644 (file)
nr_arena_set_renderoffscreen(arena);
unsigned dkey = SPItem::display_key_new(1);
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
Geom::Rect screen=Geom::Rect(Geom::Point(x0,y0), Geom::Point(x1, y1));
double padding = 1.0;
Geom::Point origin(screen.min()[Geom::X],
- sp_document_height(doc) - screen[Geom::Y].extent() - screen.min()[Geom::Y]);
+ doc->getHeight() - screen[Geom::Y].extent() - screen.min()[Geom::Y]);
origin[Geom::X] = origin[Geom::X] + (screen[Geom::X].extent() * ((1 - padding) / 2));
origin[Geom::Y] = origin[Geom::Y] + (screen[Geom::Y].extent() * ((1 - padding) / 2));
index 81c8612fbc41508e8c713713dc65ecedcd6e840f..f8321cc03ab7d73d287168d1267bf7229645228e 100644 (file)
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
return true;
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
/* Calculate translation by transforming to document coordinates (flipping Y)*/
- Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - sp_document_height(doc));
+ Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - doc->getHeight());
/* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2)
* 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0
index 72f97c6da05ab9c5c394e5c87e9215217c8cb462..cb2769c8ee83c3ec1299abe510cd31e9df40db3d 100644 (file)
@@ -56,11 +56,11 @@ static SPObject * sp_marker_load_from_svg(gchar const *name, SPDocument *current
if (!edoc && !doc) {
gchar *markers = g_build_filename(INKSCAPE_MARKERSDIR, "/markers.svg", NULL);
if (Inkscape::IO::file_test(markers, G_FILE_TEST_IS_REGULAR)) {
- doc = SPDocument::createDoc(markers, FALSE);
+ doc = SPDocument::createNewDoc(markers, FALSE);
}
g_free(markers);
if (doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
} else {
edoc = TRUE;
}
if (!edoc && !doc) {
gchar *patterns = g_build_filename(INKSCAPE_PATTERNSDIR, "/patterns.svg", NULL);
if (Inkscape::IO::file_test(patterns, G_FILE_TEST_IS_REGULAR)) {
- doc = SPDocument::createDoc(patterns, FALSE);
+ doc = SPDocument::createNewDoc(patterns, FALSE);
}
if (!doc) {
gchar *patterns = g_build_filename(CREATE_PATTERNSDIR, "/patterns.svg", NULL);
if (Inkscape::IO::file_test(patterns, G_FILE_TEST_IS_REGULAR)) {
- doc = SPDocument::createDoc(patterns, FALSE);
+ doc = SPDocument::createNewDoc(patterns, FALSE);
}
g_free(patterns);
if (doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
} else {
edoc = TRUE;
}
if (!edoc && !doc) {
gchar *gradients = g_build_filename(INKSCAPE_GRADIENTSDIR, "/gradients.svg", NULL);
if (Inkscape::IO::file_test(gradients, G_FILE_TEST_IS_REGULAR)) {
- doc = SPDocument::createDoc(gradients, FALSE);
+ doc = SPDocument::createNewDoc(gradients, FALSE);
}
if (!doc) {
gchar *gradients = g_build_filename(CREATE_GRADIENTSDIR, "/gradients.svg", NULL);
if (Inkscape::IO::file_test(gradients, G_FILE_TEST_IS_REGULAR)) {
- doc = SPDocument::createDoc(gradients, FALSE);
+ doc = SPDocument::createNewDoc(gradients, FALSE);
}
g_free(gradients);
if (doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
} else {
edoc = TRUE;
}
diff --git a/src/inkview.cpp b/src/inkview.cpp
index 1a13e356f8fb34ac51a5f9e3e5584ab546884f63..35f150707d16b1c8713bb712f0734e5f918f113f 100644 (file)
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
ss.slides = g_renew (char *, ss.slides, ss.size);
}
- ss.doc = SPDocument::createDocFromMem ((const gchar *)gba->data,
+ ss.doc = SPDocument::createNewDocFromMem ((const gchar *)gba->data,
gba->len,
TRUE);
gchar *last_filename = jar_file_reader.get_last_filename();
if (ss.doc) {
ss.slides[ss.length++] = strdup (last_filename);
- sp_document_set_uri (ss.doc, strdup(last_filename));
+ (ss.doc)->setUri (strdup(last_filename));
}
g_byte_array_free(gba, TRUE);
g_free(last_filename);
ss.slides[ss.length++] = strdup (argv[i]);
if (!ss.doc) {
- ss.doc = SPDocument::createDoc (ss.slides[ss.current], TRUE, false);
+ ss.doc = SPDocument::createNewDoc (ss.slides[ss.current], TRUE, false);
if (!ss.doc)
++ss.current;
}
w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (w), SP_DOCUMENT_NAME (ss.doc));
gtk_window_set_default_size (GTK_WINDOW (w),
- MIN ((int)sp_document_width (ss.doc), (int)gdk_screen_width () - 64),
- MIN ((int)sp_document_height (ss.doc), (int)gdk_screen_height () - 64));
+ MIN ((int)(ss.doc)->getWidth (), (int)gdk_screen_width () - 64),
+ MIN ((int)(ss.doc)->getHeight (), (int)gdk_screen_height () - 64));
gtk_window_set_policy (GTK_WINDOW (w), TRUE, TRUE, FALSE);
ss.window = w;
g_signal_connect (G_OBJECT (w), "delete_event", (GCallback) sp_svgview_main_delete, &ss);
g_signal_connect (G_OBJECT (w), "key_press_event", (GCallback) sp_svgview_main_key_press, &ss);
- sp_document_ensure_up_to_date (ss.doc);
+ (ss.doc)->ensure_up_to_date ();
ss.view = sp_svg_view_widget_new (ss.doc);
(ss.doc)->doUnref ();
sp_svg_view_widget_set_resize (SP_SVG_VIEW_WIDGET (ss.view), FALSE,
- sp_document_width (ss.doc), sp_document_height (ss.doc));
+ (ss.doc)->getWidth (), (ss.doc)->getHeight ());
gtk_widget_show (ss.view);
gtk_container_add (GTK_CONTAINER (w), ss.view);
sp_svgview_set_document(struct SPSlideShow *ss, SPDocument *doc, int current)
{
if (doc && doc != ss->doc) {
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
reinterpret_cast<SPSVGView*>(SP_VIEW_WIDGET_VIEW (ss->view))->setDocument (doc);
ss->doc = doc;
ss->current = current;
SPDocument *doc = NULL;
int current = ss->current;
while (!doc && (current < ss->length - 1)) {
- doc = SPDocument::createDoc (ss->slides[++current], TRUE, false);
+ doc = SPDocument::createNewDoc (ss->slides[++current], TRUE, false);
}
sp_svgview_set_document(ss, doc, current);
SPDocument *doc = NULL;
int current = ss->current;
while (!doc && (current > 0)) {
- doc = SPDocument::createDoc (ss->slides[--current], TRUE, false);
+ doc = SPDocument::createNewDoc (ss->slides[--current], TRUE, false);
}
sp_svgview_set_document(ss, doc, current);
while ( !doc && (current < ss->length - 1)) {
if (current == ss->current)
break;
- doc = SPDocument::createDoc (ss->slides[current++], TRUE, false);
+ doc = SPDocument::createNewDoc (ss->slides[current++], TRUE, false);
}
sp_svgview_set_document(ss, doc, current - 1);
while (!doc && (current >= 0)) {
if (current == ss->current)
break;
- doc = SPDocument::createDoc (ss->slides[current--], TRUE, false);
+ doc = SPDocument::createNewDoc (ss->slides[current--], TRUE, false);
}
sp_svgview_set_document(ss, doc, current + 1);
diff --git a/src/interface.cpp b/src/interface.cpp
index 4b3126680f7183ff8ef3bbd0de83e1c1001dcc4e..bdec992919cc2478448a93b77e9846c3f465b53d 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
unsigned int b = color.getB();
SPGradient* matches = 0;
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( color.descr == grad->getId() ) {
// move to mouse pointer
{
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
Geom::OptRect sel_bbox = selection->bounds();
if (sel_bbox) {
Geom::Point m( desktop->point() - sel_bbox->midpoint() );
index 7a39b6d81644a0c3654e03b9ac192e634bd93e1f..b46aacaaef4f96ca8bafa327a30678c6ffd54e45 100644 (file)
@@ -369,7 +369,7 @@ makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, G
Glib::ustring name = String::ucompose(
_("Inkboard session (%1 to %2)"), SessionManager::instance().getClient().getJid(), to);
- doc = sp_document_create(rdoc, NULL, NULL, name.c_str(), TRUE);
+ doc = SPDocument::createDoc(rdoc, NULL, NULL, name.c_str(), TRUE);
g_return_val_if_fail(doc != NULL, NULL);
return doc;
diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp
index db7384622ee6dc6d007b73e69588402baabfe551..5c96bcee14c7fecb96514654586435a5bf4f2fae 100644 (file)
--- a/src/layer-manager.cpp
+++ b/src/layer-manager.cpp
@@ -183,7 +183,7 @@ void LayerManager::renameLayer( SPObject* obj, gchar const *label, bool uniquify
}
std::set<Glib::ustring> currentNames;
- GSList const *layers=sp_document_get_resource_list(_document, "layer");
+ GSList const *layers=_document->get_resource_list("layer");
SPObject *root=_desktop->currentRoot();
if ( root ) {
for ( GSList const *iter=layers ; iter ; iter = iter->next ) {
}
_document = document;
if (document) {
- _resource_connection = sp_document_resources_changed_connect(document, "layer", sigc::mem_fun(*this, &LayerManager::_rebuild));
+ _resource_connection = document->resources_changed_connect("layer", sigc::mem_fun(*this, &LayerManager::_rebuild));
}
_rebuild();
}
if (!_document) // http://sourceforge.net/mailarchive/forum.php?thread_name=5747bce9a7ed077c1b4fc9f0f4f8a5e0%40localhost&forum_name=inkscape-devel
return;
- GSList const *layers = sp_document_get_resource_list(_document, "layer");
+ GSList const *layers = _document->get_resource_list("layer");
SPObject *root=_desktop->currentRoot();
if ( root ) {
_addOne(root);
index 438258cb3dd2810feb20e23022153ce8668583e4..8eafa1711436015595d96f336f96082004ebc7a4 100644 (file)
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
@@ -392,8 +392,8 @@ lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::Effe
void
lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B) {
- Geom::Coord w = sp_document_width(document);
- Geom::Coord h = sp_document_height(document);
+ Geom::Coord w = document->getWidth();
+ Geom::Coord h = document->getHeight();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
double ulx = prefs->getDouble("/tools/lpetool/bbox_upperleftx", 0);
diff --git a/src/main.cpp b/src/main.cpp
index 5cb317a44b6e9cce1c4c6839406cebcf81770b90..a25343991077ce4af4018041e76b1fe7b9fee625 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
g_warning("Specified document %s cannot be opened (does not exist or not a valid SVG file)", filename);
} else {
if (sp_vacuum_defs) {
- vacuum_document(doc);
+ doc->vacuum_document();
}
if (sp_vacuum_defs && !sp_export_svg) {
// save under the name given in the command line
@@ -1197,7 +1197,7 @@ do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const g
}
if (o) {
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
SPItem *item = ((SPItem *) o);
// "true" SVG bbox for scripting
o = SP_DOCUMENT_ROOT(doc);
if (o) {
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
do_query_all_recurse(o);
}
}
}
// write object bbox to area
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
Geom::OptRect areaMaybe;
static_cast<SPItem *>(o_area)->invoke_bbox( areaMaybe, static_cast<SPItem *>(o_area)->i2d_affine(), TRUE);
if (areaMaybe) {
area = Geom::Rect(Geom::Interval(x0,x1), Geom::Interval(y0,y1));
} else if (sp_export_area_page || !(sp_export_id || sp_export_area_drawing)) {
/* Export the whole page: note: Inkscape uses 'page' in all menus and dialogs, not 'canvas' */
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
Geom::Point origin (SP_ROOT(doc->root)->x.computed, SP_ROOT(doc->root)->y.computed);
- area = Geom::Rect(origin, origin + sp_document_dimensions(doc));
+ area = Geom::Rect(origin, origin + doc->getDimensions());
}
// set filename and dpi from options, if not yet set from the hints
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index cbf1dab6f75c44e41d5916fa0b33e57a389078b3..379626683445fcb9a5612ece6b9eab46874ce7bd 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
Geom::PathVector* Inkscape::ObjectSnapper::_getBorderPathv() const
{
- Geom::Rect const border_rect = Geom::Rect(Geom::Point(0,0), Geom::Point(sp_document_width(_snapmanager->getDocument()),sp_document_height(_snapmanager->getDocument())));
+ Geom::Rect const border_rect = Geom::Rect(Geom::Point(0,0), Geom::Point((_snapmanager->getDocument())->getWidth(),(_snapmanager->getDocument())->getHeight()));
return _getPathvFromRect(border_rect);
}
@@ -748,8 +748,8 @@ Geom::PathVector* Inkscape::ObjectSnapper::_getPathvFromRect(Geom::Rect const re
void Inkscape::ObjectSnapper::_getBorderNodes(std::vector<SnapCandidatePoint> *points) const
{
- Geom::Coord w = sp_document_width(_snapmanager->getDocument());
- Geom::Coord h = sp_document_height(_snapmanager->getDocument());
+ Geom::Coord w = (_snapmanager->getDocument())->getWidth();
+ Geom::Coord h = (_snapmanager->getDocument())->getHeight();
points->push_back(Inkscape::SnapCandidatePoint(Geom::Point(0,0), SNAPSOURCE_UNDEFINED, SNAPTARGET_PAGE_CORNER));
points->push_back(Inkscape::SnapCandidatePoint(Geom::Point(0,h), SNAPSOURCE_UNDEFINED, SNAPTARGET_PAGE_CORNER));
points->push_back(Inkscape::SnapCandidatePoint(Geom::Point(w,h), SNAPSOURCE_UNDEFINED, SNAPTARGET_PAGE_CORNER));
diff --git a/src/persp3d.cpp b/src/persp3d.cpp
index 6a697ec9b5e1d9893ed76b787144abc608c8bb50..d9839c556b02bda0b175a6230e02c483775b2d6f 100644 (file)
--- a/src/persp3d.cpp
+++ b/src/persp3d.cpp
@@ -216,10 +216,10 @@ persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup) {// if dup i
repr = xml_doc->createElement("inkscape:perspective");
repr->setAttribute("sodipodi:type", "inkscape:persp3d");
- Proj::Pt2 proj_vp_x = Proj::Pt2 (0.0, sp_document_height(document)/2, 1.0);
+ Proj::Pt2 proj_vp_x = Proj::Pt2 (0.0, document->getHeight()/2, 1.0);
Proj::Pt2 proj_vp_y = Proj::Pt2 (0.0, 1000.0, 0.0);
- Proj::Pt2 proj_vp_z = Proj::Pt2 (sp_document_width(document), sp_document_height(document)/2, 1.0);
- Proj::Pt2 proj_origin = Proj::Pt2 (sp_document_width(document)/2, sp_document_height(document)/3, 1.0);
+ Proj::Pt2 proj_vp_z = Proj::Pt2 (document->getWidth(), document->getHeight()/2, 1.0);
+ Proj::Pt2 proj_origin = Proj::Pt2 (document->getWidth()/2, document->getHeight()/3, 1.0);
if (dup) {
proj_vp_x = dup->tmat.column (Proj::X);
diff --git a/src/print.cpp b/src/print.cpp
index 7b582b0d1218218fd21e05e24bf6d8eebd700488..43f0113a0cccde3e9e68ad2007f8d724f81e4c1d 100644 (file)
--- a/src/print.cpp
+++ b/src/print.cpp
Inkscape::Extension::Print *mod;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_DEFAULT);
void
sp_print_document(Gtk::Window& parentWindow, SPDocument *doc)
{
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
// Build arena
SPItem *base = SP_ITEM(sp_document_root(doc));
gchar *oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_PS);
oldconst = mod->get_param_string("destination");
index 1cd965e390b526d89318918dd7569dfdaec4a049..d557fdd39f3bed216d80451737719a7c71b126e8 100644 (file)
--- a/src/profile-manager.cpp
+++ b/src/profile-manager.cpp
_doc(document),
_knownProfiles()
{
- _resource_connection = sp_document_resources_changed_connect( _doc, "iccprofile", sigc::mem_fun(*this, &ProfileManager::_resourcesChanged) );
+ _resource_connection = _doc->resources_changed_connect( "iccprofile", sigc::mem_fun(*this, &ProfileManager::_resourcesChanged) );
}
ProfileManager::~ProfileManager()
{
std::vector<SPObject*> newList;
if (_doc) {
- const GSList *current = sp_document_get_resource_list( _doc, "iccprofile" );
+ const GSList *current = _doc->get_resource_list( "iccprofile" );
while ( current ) {
newList.push_back(SP_OBJECT(current->data));
current = g_slist_next(current);
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 028c8634b62435475a926670ec97082a881c66f7..db25d3fad06518d7042d3736a4b1d3f39ca1647a 100644 (file)
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
GSList *items = NULL;
if (r->getMode() == RUBBERBAND_MODE_RECT) {
Geom::OptRect const b = r->getRectangle();
- items = sp_document_items_in_box(sp_desktop_document(desktop), desktop->dkey, *b);
+ items = sp_desktop_document(desktop)->items_in_box(desktop->dkey, *b);
} else if (r->getMode() == RUBBERBAND_MODE_TOUCHPATH) {
- items = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints());
+ items = sp_desktop_document(desktop)->items_at_points(desktop->dkey, r->getPoints());
}
seltrans->resetState();
index 8237537c8eb509ca1c8dce96821f8a782925823e..223fcee33c3d2a11f2b9bd0a8533f1f969b4682a 100644 (file)
return;
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
Geom::OptRect r = selection->bounds(SPItem::RENDERING_BBOX);
boost::optional<Geom::Point> c = selection->center();
if ( !r || !c ) {
}
// calculate the transform to be applied to objects to move them to 0,0
- Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - *c;
+ Geom::Point move_p = Geom::Point(0, doc->getHeight()) - *c;
move_p[Geom::Y] = -move_p[Geom::Y];
Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p));
return;
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
Geom::OptRect r = selection->bounds(SPItem::RENDERING_BBOX);
if ( !r ) {
return;
}
// calculate the transform to be applied to objects to move them to 0,0
- Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - (r->min() + Geom::Point(0, r->dimensions()[Geom::Y]));
+ Geom::Point move_p = Geom::Point(0, doc->getHeight()) - (r->min() + Geom::Point(0, r->dimensions()[Geom::Y]));
move_p[Geom::Y] = -move_p[Geom::Y];
Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p));
// use SPObject::setid when mental finishes it to steal ids of
// this is needed to make sure the new item has curve (simply requestDisplayUpdate does not work)
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
Geom::Matrix transform( i->transform * pat_transform );
i->doWriteTransform(SP_OBJECT_REPR(i), transform);
// Get the bounding box of the selection
NRRect bbox;
- sp_document_ensure_up_to_date(document);
+ document->ensure_up_to_date();
selection->bounds(&bbox);
if (NR_RECT_DFLS_TEST_EMPTY(&bbox)) {
desktop->clearWaitingCursor();
@@ -2855,7 +2855,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la
}
// /END FIXME
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
GSList *items = g_slist_copy((GSList *) selection->itemList());
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool remove_original = prefs->getBool("/options/maskobject/remove", true);
bool ungroup_masked = prefs->getBool("/options/maskobject/ungrouping", true);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
gchar const *attributeName = apply_clip_path ? "clip-path" : "mask";
std::map<SPObject*,SPItem*> referenced_objects;
{
g_return_val_if_fail(doc != NULL, false);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
SPItem const *const root = SP_ITEM(doc->root);
Geom::OptRect const bbox(root->getBounds(root->i2d_affine()));
if (bbox) {
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 9cd2b2ca4af60c8eb317df972b7e179a4274a31c..bae5f5e56bf017f4c75b123d567d34fe6c9dc1c0 100644 (file)
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
@@ -107,7 +107,7 @@ sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *r
sp_object_read_attr(object, "clipPathUnits");
/* Register ourselves */
- sp_document_add_resource(document, "clipPath", object);
+ document->add_resource("clipPath", object);
}
static void
{
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "clipPath", object);
+ SP_OBJECT_DOCUMENT(object)->remove_resource("clipPath", object);
}
SPClipPath *cp = SP_CLIPPATH(object);
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index 4cbafe50cf2e3b6ff7265c531925783fce1c05c6..1ac8a67331c44d7f7a1882cf161ca619c29291e1 100644 (file)
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
@@ -146,7 +146,7 @@ sp_filter_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
sp_object_read_attr(object, "xlink:href");
//is this necessary?
- sp_document_add_resource(document, "filter", object);
+ document->add_resource("filter", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "filter", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("filter", SP_OBJECT(object));
}
//TODO: release resources here
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index 5f3517f9234685bfb0c46baa6e3f6ceb1019edac..b18b7296800bc3237a505e3a8d12c0a072ef4c82 100644 (file)
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
NRRect dbox;
dbox.x0 = 0.0;
dbox.y0 = 0.0;
- dbox.x1 = sp_document_width(SP_OBJECT_DOCUMENT(item));
- dbox.y1 = sp_document_height(SP_OBJECT_DOCUMENT(item));
+ dbox.x1 = SP_OBJECT_DOCUMENT(item)->getWidth();
+ dbox.y1 = SP_OBJECT_DOCUMENT(item)->getHeight();
Geom::Matrix const ctm (item->i2d_affine());
group->layout.print(ctx, &pbox, &dbox, &bbox, ctm);
diff --git a/src/sp-font.cpp b/src/sp-font.cpp
index b2003cf08cd84eebfd25fd4756ad85b8df21349c..96973b657238d94d95dea9c9ac85c54bf2717a08 100644 (file)
--- a/src/sp-font.cpp
+++ b/src/sp-font.cpp
@@ -108,7 +108,7 @@ static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML:
sp_object_read_attr(object, "vert-origin-y");
sp_object_read_attr(object, "vert-adv-y");
- sp_document_add_resource(document, "font", object);
+ document->add_resource("font", object);
}
static void sp_font_release(SPObject *object)
{
//SPFont *font = SP_FONT(object);
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "font", object);
+ SP_OBJECT_DOCUMENT(object)->remove_resource("font", object);
if (((SPObjectClass *) parent_class)->release) {
((SPObjectClass *) parent_class)->release(object);
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index 0c0c947840aa148f86a2c3049dbf83e13a48c56f..bc86e21359e88b62c82c89d6cd53dbf4c826856c 100644 (file)
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -439,7 +439,7 @@ void SPGradientImpl::build(SPObject *object, SPDocument *document, Inkscape::XML
sp_object_read_attr(object, "xlink:href");
/* Register ourselves */
- sp_document_add_resource(document, "gradient", object);
+ document->add_resource("gradient", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "gradient", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("gradient", SP_OBJECT(object));
}
if (gradient->ref) {
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index f5edf7d97cf3a63baf9820d97bf57822ae640f1b..5bf7f664cee8b6c676a3bbd54f16c2e55b0d6f2e 100644 (file)
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
std::list<std::pair<Geom::Point, Geom::Point> > pts;
Geom::Point A(0, 0);
- Geom::Point C(sp_document_width(doc), sp_document_height(doc));
+ Geom::Point C(doc->getWidth(), doc->getHeight());
Geom::Point B(C[Geom::X], 0);
Geom::Point D(0, C[Geom::Y]);
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 367d2e4893294369b38206fc41fda5a44264587c..c1fb9a5715706e374f9faca35d891808c141a4ff 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -646,7 +646,7 @@ sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
sp_object_read_attr (object, "color-profile");
/* Register */
- sp_document_add_resource (document, "image", object);
+ document->add_resource ("image", object);
}
static void
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "image", SP_OBJECT (object));
+ SP_OBJECT_DOCUMENT (object)->remove_resource ("image", SP_OBJECT (object));
}
if (image->href) {
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 2369ce38a60f4763c89d9a13ad8d310654803fee..c178cfdd49796cd86d29e0ec5e07e72f4829f392 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -154,7 +154,7 @@ static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML
static void sp_group_release(SPObject *object) {
if ( SP_GROUP(object)->_layer_mode == SPGroup::LAYER ) {
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "layer", object);
+ SP_OBJECT_DOCUMENT(object)->remove_resource("layer", object);
}
if (((SPObjectClass *)parent_class)->release) {
((SPObjectClass *)parent_class)->release(object);
@@ -535,9 +535,9 @@ sp_item_group_get_child_by_name (SPGroup *group, SPObject *ref, const gchar *nam
void SPGroup::setLayerMode(LayerMode mode) {
if ( _layer_mode != mode ) {
if ( mode == LAYER ) {
- sp_document_add_resource(SP_OBJECT_DOCUMENT(this), "layer", this);
+ SP_OBJECT_DOCUMENT(this)->add_resource("layer", this);
} else if ( _layer_mode == LAYER ) {
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(this), "layer", this);
+ SP_OBJECT_DOCUMENT(this)->remove_resource("layer", this);
}
_layer_mode = mode;
_updateLayerMode();
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index e5f8eade1581a9aee91dde05b0ab42de2b6e114f..72f318a257ad6e5f2cf3dcbae726569f0f6a10ba 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
void
SPItem::setCenter(Geom::Point object_centre) {
// for getBounds() to work
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this));
+ SP_OBJECT_DOCUMENT(this)->ensure_up_to_date();
Geom::OptRect bbox = getBounds(i2d_affine());
if (bbox) {
Geom::Point SPItem::getCenter() const {
// for getBounds() to work
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this));
+ SP_OBJECT_DOCUMENT(this)->ensure_up_to_date();
Geom::OptRect bbox = getBounds(i2d_affine());
if (bbox) {
Geom::Matrix const ret( i2doc_affine()
* Geom::Scale(1, -1)
- * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(this))) );
+ * Geom::Translate(0, SP_OBJECT_DOCUMENT(this)->getHeight()) );
return ret;
}
if (SP_OBJECT_PARENT(this)) {
dt2p = static_cast<SPItem *>(SP_OBJECT_PARENT(this))->i2d_affine().inverse();
} else {
- dt2p = ( Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(this)))
+ dt2p = ( Geom::Translate(0, -SP_OBJECT_DOCUMENT(this)->getHeight())
* Geom::Scale(1, -1) );
}
diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp
index b0369efe51de5d7f331e6c3074ec9d81a9f93ab7..e57b5cc47aef3992bb3e2dc55c83593166b6cc7b 100644 (file)
--- a/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
@@ -108,7 +108,7 @@ sp_mask_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr
sp_object_read_attr (object, "maskContentUnits");
/* Register ourselves */
- sp_document_add_resource (document, "mask", object);
+ document->add_resource ("mask", object);
}
static void
{
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "mask", object);
+ SP_OBJECT_DOCUMENT (object)->remove_resource ("mask", object);
}
SPMask *cp = SP_MASK (object);
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 420c7b4a6ca2a545aaf5d12f56bf94c828c01954..08d13b2cc08f8be233c4bf72ff7352c7bce90cb0 100644 (file)
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
if (parent) {
parent->requestDisplayUpdate(SP_OBJECT_CHILD_MODIFIED_FLAG);
} else {
- sp_document_request_modified(SP_OBJECT_DOCUMENT(this));
+ SP_OBJECT_DOCUMENT(this)->request_modified();
}
}
}
if (parent) {
parent->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
} else {
- sp_document_request_modified(SP_OBJECT_DOCUMENT(this));
+ SP_OBJECT_DOCUMENT(this)->request_modified();
}
}
}
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index 56e7956b6bd64b7570bc35ffec280ba5e951fa3e..b076b5701abd9b760f160f5ae89d92c676a6ef0f 100644 (file)
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
@@ -167,7 +167,7 @@ sp_pattern_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *r
sp_object_read_attr (object, "xlink:href");
/* Register ourselves */
- sp_document_add_resource (document, "pattern", object);
+ document->add_resource ("pattern", object);
}
static void
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "pattern", SP_OBJECT (object));
+ SP_OBJECT_DOCUMENT (object)->remove_resource ("pattern", SP_OBJECT (object));
}
if (pat->ref) {
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index bd935074dec47dfba5663dbf6a68aebcdf5348c5..72c0b6de9690f429e426fa57e9217ff96c54d0ef 100644 (file)
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
/* fixme: (Lauris) */
if (!object->parent && (flags & SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
- sp_document_resized_signal_emit (SP_OBJECT_DOCUMENT(root), root->width.computed, root->height.computed);
+ SP_OBJECT_DOCUMENT(root)->resized_signal_emit (root->width.computed, root->height.computed);
}
}
diff --git a/src/sp-script.cpp b/src/sp-script.cpp
index ad41b8021dc2d2a73eb23ccdea9f58e2e41b0223..61418701307492253635f24fb63be43d1daba580 100644 (file)
--- a/src/sp-script.cpp
+++ b/src/sp-script.cpp
@@ -85,14 +85,14 @@ sp_script_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
//Read values of key attributes from XML nodes into object.
sp_object_read_attr(object, "xlink:href");
- sp_document_add_resource(document, "script", object);
+ document->add_resource("script", object);
}
static void sp_script_release(SPObject *object)
{
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "script", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("script", SP_OBJECT(object));
}
if (((SPObjectClass *) parent_class)->release)
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 4de6aeb800b58137e9f975d1deadb72121777310..8e8e222722d6aec6f08fe8cdbd818d1091ffdcf5 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
item->invoke_bbox( &pbox, Geom::identity(), TRUE);
dbox.x0 = 0.0;
dbox.y0 = 0.0;
- dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
- dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
+ dbox.x1 = SP_OBJECT_DOCUMENT (item)->getWidth ();
+ dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight ();
item->getBboxDesktop (&bbox);
Geom::Matrix const i2d(item->i2d_affine());
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 8f28ee25585a985c6d654c07a376e2acf2f8c7de..46e17a75a8ebe21504b535b84ff763caa203d935 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
item->getBboxDesktop (&bbox);
dbox.x0 = 0.0;
dbox.y0 = 0.0;
- dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
- dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
+ dbox.x1 = SP_OBJECT_DOCUMENT (item)->getWidth ();
+ dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight ();
Geom::Matrix const ctm (item->i2d_affine());
group->layout.print(ctx,&pbox,&dbox,&bbox,ctm);
index 10d9976566f04a3fed2b3b6f720a35e7e8504939..a60c93f0bd70cb5ec201a6a81840c6e721c1d8c4 100644 (file)
--- a/src/svg-view-widget.cpp
+++ b/src/svg-view-widget.cpp
gdouble width, height;
svgv = static_cast<SPSVGView*> (v);
- width = sp_document_width (v->doc()) * svgv->_hscale;
- height = sp_document_height (v->doc()) * svgv->_vscale;
+ width = (v->doc())->getWidth () * svgv->_hscale;
+ height = (v->doc())->getHeight () * svgv->_vscale;
if (width <= vw->maxwidth) {
hpol = GTK_POLICY_NEVER;
diff --git a/src/svg-view.cpp b/src/svg-view.cpp
index 31b54b36d727d2a01b8ac6ca8e7a8e09d39c6644..6d989a8f5188e6ba0f3f64a651ceecf231bcb1e6 100644 (file)
--- a/src/svg-view.cpp
+++ b/src/svg-view.cpp
SPSVGView::doRescale (bool event)
{
if (!doc()) return;
- if (sp_document_width (doc()) < 1e-9) return;
- if (sp_document_height (doc()) < 1e-9) return;
+ if (doc()->getWidth () < 1e-9) return;
+ if (doc()->getHeight () < 1e-9) return;
if (_rescale) {
- _hscale = _width / sp_document_width (doc());
- _vscale = _height / sp_document_height (doc());
+ _hscale = _width / doc()->getWidth ();
+ _vscale = _height / doc()->getHeight ();
if (_keepaspect) {
if (_hscale > _vscale) {
_hscale = _vscale;
}
if (event) {
- emitResized (sp_document_width (doc()) * _hscale,
- sp_document_height (doc()) * _vscale);
+ emitResized (doc()->getWidth () * _hscale,
+ doc()->getHeight () * _vscale);
}
}
diff --git a/src/test-helpers.h b/src/test-helpers.h
index 4ec1d4dc1045bd8d2ec4a3008b20aece2e0163ed..280935900e0f19d6c3b61f7aea26050a537f0bfa 100644 (file)
--- a/src/test-helpers.h
+++ b/src/test-helpers.h
static_cast<void>(g_object_new(inkscape_get_type(), NULL));
}
- SPDocument* tmp = SPDocument::createDoc( NULL, TRUE, true );
+ SPDocument* tmp = SPDocument::createNewDoc( NULL, TRUE, true );
if ( tmp ) {
fun( suite );
if ( suite )
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index 166799e388b22efd3aa7ec634f5479b4a789b00d..2cc6e30d99d1af36fd429e7c095ceb941a23a4b5 100644 (file)
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
Inkscape::GC::release(repr);
text->deleteObject(); // delete the orignal flowtext
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
selection->clear();
diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp
index 0c7f075b936840b067161422ffb55cb2d0b1862f..a2b0cd7909412091ebfd92bd14b1f8af7537386d 100644 (file)
--- a/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
return;
}
SPDocument *doc = SP_ACTIVE_DOCUMENT;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
SPImage *img = getSelectedSPImage();
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index d92d35ae16a5d636051e3f831177294e22008472..aa59a7b2344b922dbf3c165b76c2ee3d3204b0ed 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -851,7 +851,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDesktop *desktop, SPDocument *clipdo
sp_selection_apply_affine(selection, desktop->dt2doc() * doc2parent * desktop->doc2dt(), true, false);
// Update (among other things) all curves in paths, for bounds() to work
- sp_document_ensure_up_to_date(target_document);
+ target_document->ensure_up_to_date();
// move selection either to original position (in_place) or to mouse pointer
Geom::OptRect sel_bbox = selection->bounds();
guint32 bgcolor = 0x00000000;
Geom::Point origin (SP_ROOT(_clipboardSPDoc->root)->x.computed, SP_ROOT(_clipboardSPDoc->root)->y.computed);
- Geom::Rect area = Geom::Rect(origin, origin + sp_document_dimensions(_clipboardSPDoc));
+ Geom::Rect area = Geom::Rect(origin, origin + _clipboardSPDoc->getDimensions());
unsigned long int width = (unsigned long int) (area.width() * dpi / PX_PER_IN + 0.5);
unsigned long int height = (unsigned long int) (area.height() * dpi / PX_PER_IN + 0.5);
void ClipboardManagerImpl::_createInternalClipboard()
{
if ( _clipboardSPDoc == NULL ) {
- _clipboardSPDoc = SPDocument::createDoc(NULL, false, true);
+ _clipboardSPDoc = SPDocument::createNewDoc(NULL, false, true);
//g_assert( _clipboardSPDoc != NULL );
_defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(_clipboardSPDoc));
_doc = sp_document_repr_doc(_clipboardSPDoc);
index 7ed00ad19caa19f2a11924aec80a6a9a52c1a359..8c102b57f443d8b1fa99d4c3c725840ad15d4fa1 100644 (file)
// should be in UTF-*8..
char *about=g_build_filename(INKSCAPE_SCREENSDIR, _("about.svg"), NULL);
- SPDocument *doc=SPDocument::createDoc (about, TRUE);
+ SPDocument *doc=SPDocument::createNewDoc (about, TRUE);
g_free(about);
g_return_val_if_fail(doc != NULL, NULL);
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->ensure_up_to_date();
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();
doc->doUnref();
index d7e3d1766fd715e93a39d57063cf81a5858e48cc..0b47f42ab038bc36b70cfdc0e4ee7220596aafd8 100644 (file)
}
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:
it != selected.end();
it++)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
+ sp_desktop_document (desktop)->ensure_up_to_date();
if (!sel_as_group)
b = (*it)->getBboxDesktop();
if (b) {
it != selected.end();
++it)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
+ sp_desktop_document (desktop)->ensure_up_to_date();
Geom::OptRect item_box = (*it)->getBboxDesktop ();
if (item_box) {
// find new center, staying within bbox
index 33fdf8327932f5c5fdddd93cfdc6a04796df2fdf..970c609af28e94cbabea540d4f8cafe489526328 100644 (file)
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->get_resource_list( "iccprofile" );
if (current) _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
_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->get_resource_list( "defs" );
if (current) {
_emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
}
#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->get_resource_list( "script" );
if (current) {
_ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
}
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
SPScript* script = (SPScript*) obj;
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->get_resource_list( "script" );
if (current) _ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
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));
index eb2d33eeedd5520716f1ffda0f9913d071b88dea..5a9f37bf02aa7e06abedee97b094ceb10196fc13 100644 (file)
* 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 = SPDocument::createDoc (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;
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = SPDocument::createDocFromMem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createNewDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
index 8a0c70f7cb5109bdb5eac88e5325351d6fb5e400..aabb3c2dff60d3af900cdd5670ebeb122e4e4a71 100644 (file)
gchar *utf8string = g_utf16_to_utf8((const gunichar2*)_path_string,
_MAX_PATH, NULL, NULL, NULL);
- SPDocument *svgDoc = SPDocument::createDoc (utf8string, true);
+ SPDocument *svgDoc = SPDocument::createNewDoc (utf8string, true);
g_free(utf8string);
// Check the document loaded properly
}
// 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;
// write object bbox to area
Geom::OptRect maybeArea(area);
- sp_document_ensure_up_to_date (svgDoc);
+ svgDoc->ensure_up_to_date ();
static_cast<(SPItem *)>(svgDoc->root)->invoke_bbox( maybeArea,
static_cast<(SPItem *)>(svgDoc->root)->i2d_affine(), TRUE);
index 1672c4b696f4ddebad1fd88b8844e1df2a478c03..7baf2d71fb417a9b8a662b7921d68ea2d9812b6c 100644 (file)
@@ -1144,8 +1144,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)->resources_changed_connect("filter",sigc::mem_fun(me, &FilterModifier::update_filters));
me->_dialog.setDesktop(desktop);
{
SPDesktop* desktop = _dialog.getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* filters = sp_document_get_resource_list(document, "filter");
+ const GSList* filters = document->get_resource_list("filter");
_model->clear();
index 60cab06a27c1aacf804525344fba880600368387..80838617167fc998ae34831a527df9b5bbbfc19e 100644 (file)
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
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";
// 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);
index 998f4e1e1b343a908197cb07a83989fa65da3201..7f41c4d6b7350225f889b8bdf03dc6946290fd8e 100644 (file)
{
SPDesktop* desktop = this->getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* fonts = sp_document_get_resource_list(document, "font");
+ const GSList* fonts = document->get_resource_list("font");
_model->clear();
for(const GSList *l = fonts; l; l = l->next) {
index 90e9e5f7bcba5f414ab20358b068360d94407848..d5d48a5285c23fe34ef44c963628df7e85729427 100644 (file)
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->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
@@ -178,7 +178,7 @@ 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->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
@@ -306,7 +306,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())->get_resource_list("gradient");
gint index = 0;
for (const GSList *curr = gradients; curr; curr = curr->next) {
SPGradient* grad = SP_GRADIENT(curr->data);
@@ -759,7 +759,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->resources_changed_connect( "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))) );
{
std::vector<SPGradient*> newList;
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( grad->isSwatch() ) {
diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp
index dfb319f9029957a93e4bfeba5eecc3df1e2e86cd..546fdd8f0482b5735116e9fda22e7483af72655b 100644 (file)
--- a/src/ui/dialog/tile.cpp
+++ b/src/ui/dialog/tile.cpp
grid_top = 99999;
SPDesktop *desktop = getDesktop();
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
const GSList *items = selection ? selection->itemList() : 0;
index 570d53f0557177e4929712ce367cfb03ceb95221..d10f46313d6a1dbfa7d1df8302fb01b8b31e81ca 100644 (file)
@@ -593,8 +593,7 @@ void ink_node_tool_select_area(InkNodeTool *nt, Geom::Rect const &sel, GdkEventB
if (nt->_multipath->empty()) {
// if multipath is empty, select rubberbanded items rather than nodes
Inkscape::Selection *selection = nt->desktop->selection;
- GSList *items = sp_document_items_in_box(
- sp_desktop_document(nt->desktop), nt->desktop->dkey, sel);
+ GSList *items = sp_desktop_document(nt->desktop)->items_in_box(nt->desktop->dkey, sel);
selection->setList(items);
g_slist_free(items);
} else {
index 2c325a5ee3b4a9ff9f8cc8eb2daf65f0afbf322d..0248e73d519ea1f704d2eb6244592d05610d1933 100644 (file)
/* The desktop region we always show unconditionally */
SPDocument *doc = _desktop->doc();
- Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)),
- Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) );
+ Geom::Rect darea ( Geom::Point(-doc->getWidth(), -doc->getHeight()),
+ Geom::Point(2 * doc->getWidth(), 2 * doc->getHeight()) );
SPObject* root = doc->root;
SPItem* item = SP_ITEM(root);
Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop());
EditWidget::onWindowRealize()
{
- if ( (sp_document_width(_desktop->doc()) < 1.0) || (sp_document_height(_desktop->doc()) < 1.0) ) {
+ if ( ((_desktop->doc())->getWidth() < 1.0) || ((_desktop->doc())->getHeight() < 1.0) ) {
return;
}
Geom::Rect d( Geom::Point(0, 0),
- Geom::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())) );
+ Geom::Point((_desktop->doc())->getWidth(), (_desktop->doc())->getHeight()) );
_desktop->set_display_area(d.min()[Geom::X], d.min()[Geom::Y], d.max()[Geom::X], d.max()[Geom::Y], 10);
_namedview_modified(_desktop->namedview, SP_OBJECT_MODIFIED_FLAG);
index 79cc8ca42cce8882ca8ee646139cd45d31128931..f5dd3e9fafdd740f91edb520b375e364b0bb0e7f 100644 (file)
fileName = Glib::filename_to_utf8(fileName);
- SPDocument *doc = SPDocument::createDoc (fileName.c_str(), 0);
+ SPDocument *doc = SPDocument::createNewDoc (fileName.c_str(), 0);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = SPDocument::createDocFromMem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createNewDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
index 26763cc77e1a6aa41d2142971d6c9c29bbd91821..1f70a26fd80f9176a48d9183b19341c6fa2fd63d 100644 (file)
if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) {
SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP);
- double const old_height = sp_document_height(doc);
- sp_document_set_width (doc, w, &_px_unit);
- sp_document_set_height (doc, h, &_px_unit);
+ double const old_height = doc->getHeight();
+ doc->setWidth (w, &_px_unit);
+ doc->setHeight (h, &_px_unit);
// The origin for the user is in the lower left corner; this point should remain stationary when
// changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this
Geom::Translate const vert_offset(Geom::Point(0, (old_height - h)));
index dfb22b6d0d9425616147c49d789322ef615c78ac..591ea62531ed0add2689ab3aa119bf080f2c7059 100644 (file)
NRRect d;
d.x0 = 0.0;
d.y0 = 0.0;
- d.x1 = sp_document_width (dtw->desktop->doc());
- d.y1 = sp_document_height (dtw->desktop->doc());
+ d.x1 = (dtw->desktop->doc())->getWidth ();
+ d.y1 = (dtw->desktop->doc())->getHeight ();
if ((fabs (d.x1 - d.x0) < 1.0) || (fabs (d.y1 - d.y0) < 1.0)) return;
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/options/bitmapautoreload/value", true)) {
- GSList const *imageList = sp_document_get_resource_list(desktop->doc(), "image");
+ GSList const *imageList = (desktop->doc())->get_resource_list("image");
for (GSList const *p = imageList; p; p = p->next) {
SPImage* image = SP_IMAGE(p->data);
sp_image_refresh_if_outdated( image );
/* The desktop region we always show unconditionally */
SPDocument *doc = dtw->desktop->doc();
- Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)),
- Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) );
+ Geom::Rect darea ( Geom::Point(-doc->getWidth(), -doc->getHeight()),
+ Geom::Point(2 * doc->getWidth(), 2 * doc->getHeight()) );
SPObject* root = doc->root;
SPItem* item = SP_ITEM(root);
Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop());
index 1d3187985b8a0395a4b526da077dadfe56ed3608..fe003319f70640be2b135e6f9be3730f781394d5 100644 (file)
@@ -172,7 +172,7 @@ GtkWidget *gr_vector_list(SPDesktop *desktop, bool selection_empty, SPGradient *
GtkWidget *m = gtk_menu_new ();
GSList *gl = NULL;
- const GSList *gradients = sp_document_get_resource_list (document, "gradient");
+ const GSList *gradients = document->get_resource_list ("gradient");
for (const GSList *i = gradients; i != NULL; i = i->next) {
SPGradient *grad = SP_GRADIENT(i->data);
if ( grad->hasStops() && !grad->isSolid() ) {
index 454c120015364949d684eade3245f17907b15d13..132aff4555351271537e0656fb20c73b688d6a36 100644 (file)
/* Pick up all gradients with vectors */
GSList *gl = NULL;
if (gvs->gr) {
- const GSList *gradients = sp_document_get_resource_list(SP_OBJECT_DOCUMENT(gvs->gr), "gradient");
+ const GSList *gradients = SP_OBJECT_DOCUMENT(gvs->gr)->get_resource_list("gradient");
for (const GSList *curr = gradients; curr; curr = curr->next) {
SPGradient* grad = SP_GRADIENT(curr->data);
if ( grad->hasStops() && (grad->isSwatch() == gvs->swatched) ) {
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index e90cc1c4687e3f14cd85fc5b50a173b35bb4c84f..570502253cc7601e241cd4883b7847d8123223ec 100644 (file)
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
if ( SP_OBJECT_PARENT(object) == NULL )
{
dbox = Geom::Rect(Geom::Point(0, 0),
- Geom::Point(sp_document_width(doc), sp_document_height(doc)));
+ Geom::Point(doc->getWidth(), doc->getHeight()));
}
/* This is in document coordinates, i.e. pixels */
/* Try to load from document. */
if (!info &&
Inkscape::IO::file_test( doc_filename, G_FILE_TEST_IS_REGULAR ) &&
- (doc = SPDocument::createDoc( doc_filename, FALSE )) ) {
+ (doc = SPDocument::createNewDoc( doc_filename, FALSE )) ) {
//g_message("Loaded icon file %s", doc_filename);
// prep the document
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
/* Create new arena */
NRArena *arena = NRArena::create();
/* Create ArenaItem and set transform */
index 55dc80f6fc19faadbad8fa0285a6919a2b8ddcee..aadda9e2005d2071f9c22e9f569f61846c28b1d4 100644 (file)
return NULL;
GSList *pl = NULL;
- GSList const *patterns = sp_document_get_resource_list(source, "pattern");
+ GSList const *patterns = source->get_resource_list("pattern");
for (GSList *l = (GSList *) patterns; l != NULL; l = l->next) {
if (SP_PATTERN(l->data) == pattern_getroot(SP_PATTERN(l->data))) { // only if this is a root pattern
pl = g_slist_prepend(pl, l->data);
if (patterns_doc == NULL) {
char *patterns_source = g_build_filename(INKSCAPE_PATTERNSDIR, "patterns.svg", NULL);
if (Inkscape::IO::file_test(patterns_source, G_FILE_TEST_IS_REGULAR)) {
- patterns_doc = SPDocument::createDoc(patterns_source, FALSE);
+ patterns_doc = SPDocument::createNewDoc(patterns_source, FALSE);
}
g_free(patterns_source);
}
// suck in from patterns.svg
if (patterns_doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
sp_pattern_list_from_doc ( m, doc, patterns_doc, NULL );
}
index e2ad61e2d7cb58bf9c0428559944b2b80e1b1e07..487e3a2743f37d3b2d1bcb353f339484136ddb68 100644 (file)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
SPDocument *document = sp_desktop_document(desktop);
- sp_document_ensure_up_to_date (document);
+ document->ensure_up_to_date ();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int prefs_bbox = prefs->getInt("/tools/bounding_box");
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
index 6bd1957a86fdfe51d779dfa89142f2825da1808d..17324967ecb642bb35d38e2d81e88e2fed086f56 100644 (file)
gtk_combo_box_set_active( combo, 0 );
int index = 1;
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
index a8c0788e632b767cd7c2fe3f6562d8daffe0e6be..1843c8edbdba85d49d1eff201591a4ef35f6cc26 100644 (file)
// object to render; note that the id is the same as that of the menu we're building
SPObject *object = sandbox->getObjectById(menu_id);
sp_document_root (sandbox)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
- sp_document_ensure_up_to_date(sandbox);
+ sandbox->ensure_up_to_date();
if (object == NULL || !SP_IS_ITEM(object))
return NULL; // sandbox broken?
@@ -342,7 +342,7 @@ gchar const *buffer = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:sodipodi=
"</svg>";
- return SPDocument::createDocFromMem (buffer, strlen(buffer), FALSE);
+ return SPDocument::createNewDocFromMem (buffer, strlen(buffer), FALSE);
}
static void
@@ -373,7 +373,7 @@ ink_marker_menu_create_menu(Gtk::Menu *m, gchar const *menu_id, SPDocument *doc,
if (markers_doc == NULL) {
char *markers_source = g_build_filename(INKSCAPE_MARKERSDIR, "markers.svg", NULL);
if (Inkscape::IO::file_test(markers_source, G_FILE_TEST_IS_REGULAR)) {
- markers_doc = SPDocument::createDoc(markers_source, FALSE);
+ markers_doc = SPDocument::createNewDoc(markers_source, FALSE);
}
g_free(markers_source);
}
@@ -391,7 +391,7 @@ ink_marker_menu_create_menu(Gtk::Menu *m, gchar const *menu_id, SPDocument *doc,
// suck in from markers.svg
if (markers_doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
sp_marker_list_from_doc(m, doc, markers_doc, NULL, sandbox, menu_id);
}
index c3876725d3849c657add39369178cc10fc4f27f5..33978420c61b3afa0044995bcf9ff8d62576e46f 100644 (file)
--- a/src/xml/rebase-hrefs.cpp
+++ b/src/xml/rebase-hrefs.cpp
@@ -227,7 +227,7 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b
*
* Note also that Inkscape only supports fragment hrefs (href="#pattern257") for many of these
* cases. */
- GSList const *images = sp_document_get_resource_list(doc, "image");
+ GSList const *images = doc->get_resource_list("image");
for (GSList const *l = images; l != NULL; l = l->next) {
Inkscape::XML::Node *ir = SP_OBJECT_REPR(l->data);