Code

Merge from trunk.
[inkscape.git] / src / svg-view.cpp
index 31b54b36d727d2a01b8ac6ca8e7a8e09d39c6644..ef87b38efecbf8dd5fac4887b7252091d6c81661 100644 (file)
@@ -1,11 +1,11 @@
-#define __SP_SVG_VIEW_C__
-
 /** \file
  * Functions and callbacks for generic SVG view and widget
  *
  * Authors:
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   Ralf Stephan <ralf@ark.in-berlin.de>
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2001-2002 Lauris Kaplinski
  * Copyright (C) 2001 Ximian, Inc.
@@ -41,7 +41,7 @@ SPSVGView::~SPSVGView()
 {
     if (doc() && _drawing)
     {
-        SP_ITEM (sp_document_root (doc()))->invoke_hide (_dkey);
+        SP_ITEM( doc()->getRoot() )->invoke_hide(_dkey);
         _drawing = NULL;
     }
 }
@@ -84,12 +84,12 @@ void
 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;
@@ -104,8 +104,8 @@ SPSVGView::doRescale (bool event)
     }
 
     if (event) {
-        emitResized (sp_document_width (doc()) * _hscale,
-                sp_document_height (doc()) * _vscale);
+        emitResized (doc()->getWidth () * _hscale,
+                doc()->getHeight () * _vscale);
     }
 }
 
@@ -191,7 +191,7 @@ void
 SPSVGView::setDocument (SPDocument *document)
 {
     if (doc()) {
-        SP_ITEM (sp_document_root (doc()))->invoke_hide (_dkey);
+        SP_ITEM( doc()->getRoot() )->invoke_hide(_dkey);
     }
 
     if (!_drawing) {
@@ -200,7 +200,7 @@ SPSVGView::setDocument (SPDocument *document)
     }
 
     if (document) {
-        NRArenaItem *ai = SP_ITEM (sp_document_root (document))->invoke_show (
+        NRArenaItem *ai = SP_ITEM( document->getRoot() )->invoke_show(
                 SP_CANVAS_ARENA (_drawing)->arena,
                 _dkey,
                 SP_ITEM_SHOW_DISPLAY);