Code

Split SPCanvasItem and SPCanvasGroup to individual .h files. Removed forward header.
[inkscape.git] / src / svg-view-widget.cpp
index 10d9976566f04a3fed2b3b6f720a35e7e8504939..777c1b496031e7e2911d171a45a12c072584823d 100644 (file)
@@ -1,12 +1,13 @@
-#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>
+ *   Abhishek Sharma
+ *   Jon A. Cruz <jon@joncruz.org>
  *
+ * Copyright (C) 2010 authors
  * Copyright (C) 2001-2002 Lauris Kaplinski
  * Copyright (C) 2001 Ximian, Inc.
  *
@@ -14,6 +15,8 @@
  */
 
 #include <gtk/gtkscrolledwindow.h>
+#include "display/sp-canvas.h"
+#include "display/sp-canvas-group.h"
 #include "display/canvas-arena.h"
 #include "document.h"
 #include "svg-view.h"
@@ -149,8 +152,8 @@ sp_svg_view_widget_size_request (GtkWidget *widget, GtkRequisition *req)
                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;
@@ -221,22 +224,18 @@ sp_svg_view_widget_new (SPDocument *doc)
 /**
  * Flags the SPSVGSPViewWidget to have its size renegotiated with Gtk.
  */
-void
-sp_svg_view_widget_set_resize (SPSVGSPViewWidget *vw, bool resize, gdouble width, gdouble height)
+void SPSVGSPViewWidget::setResize(bool resize, gdouble width, gdouble height)
 {
-       g_return_if_fail (vw != NULL);
-
-       g_return_if_fail (SP_IS_SVG_VIEW_WIDGET (vw));
-       g_return_if_fail (!resize || (width > 0.0));
-       g_return_if_fail (!resize || (height > 0.0));
+    g_return_if_fail( !resize || (width > 0.0) );
+    g_return_if_fail( !resize || (height > 0.0) );
 
-       vw->resize = resize;
-       vw->maxwidth = width;
-       vw->maxheight = height;
+    this->resize = resize;
+    this->maxwidth = width;
+    this->maxheight = height;
 
-       if (resize) {
-               gtk_widget_queue_resize (GTK_WIDGET (vw));
-       }
+    if ( resize ) {
+        gtk_widget_queue_resize( GTK_WIDGET(this) );
+    }
 }