Logo Search packages:      
Sourcecode: inkscape version File versions

static void sp_svg_view_widget_size_request ( GtkWidget *  widget,
GtkRequisition *  req 
) [static]

Callback connected with size_request signal.

Definition at line 138 of file svg-view-widget.cpp.

References SPSVGView::_hscale, SPSVGView::_vscale, Inkscape::UI::View::View::doc(), SPSVGSPViewWidget::maxheight, SPSVGSPViewWidget::maxwidth, and SPSVGSPViewWidget::sw.

Referenced by sp_svg_view_widget_class_init().

{
      SPSVGSPViewWidget *vw = SP_SVG_VIEW_WIDGET (widget);
      Inkscape::UI::View::View *v = SP_VIEW_WIDGET_VIEW (widget);

      if (((GtkWidgetClass *) (widget_parent_class))->size_request)
            (* ((GtkWidgetClass *) (widget_parent_class))->size_request) (widget, req);

      if (v->doc()) {
            SPSVGView *svgv;
            GtkPolicyType hpol, vpol;
            gdouble width, height;

            svgv = static_cast<SPSVGView*> (v);
            width = sp_document_width (v->doc()) * svgv->_hscale;
            height = sp_document_height (v->doc()) * svgv->_vscale;

            if (width <= vw->maxwidth) {
                  hpol = GTK_POLICY_NEVER;
                  req->width = (gint) (width + 0.5);
            } else {
                  hpol = GTK_POLICY_AUTOMATIC;
                  req->width = (gint) (vw->maxwidth + 0.5);
            }
            if (height <= vw->maxheight) {
                  vpol = GTK_POLICY_NEVER;
                  req->height = (gint) (height + 8.0);
            } else {
                  vpol = GTK_POLICY_AUTOMATIC;
                  req->height = (gint) (vw->maxheight + 2.0);
            }
            gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (vw->sw), hpol, vpol);
      }
}


Generated by  Doxygen 1.6.0   Back to index