+// Adjusts the scrollbars for the current scale
+void wxPrintPreviewBase::AdjustScrollbars(wxPreviewCanvas *canvas)
+{
+ if (!canvas)
+ return ;
+
+ int canvasWidth, canvasHeight;
+ canvas->GetSize(&canvasWidth, &canvasHeight);
+
+ double zoomScale = ((float)m_currentZoom/(float)100);
+ double actualWidth = (zoomScale*m_pageWidth*m_previewScale);
+ double actualHeight = (zoomScale*m_pageHeight*m_previewScale);
+
+ // Set the scrollbars appropriately
+ int totalWidth = (int)(actualWidth + 2*m_leftMargin);
+ int totalHeight = (int)(actualHeight + 2*m_topMargin);
+ int scrollUnitsX = totalWidth/10;
+ int scrollUnitsY = totalHeight/10;
+ wxSize virtualSize = canvas->GetVirtualSize();
+ if (virtualSize.GetWidth() != totalWidth || virtualSize.GetHeight() != totalHeight)
+ canvas->SetScrollbars(10, 10, scrollUnitsX, scrollUnitsY, 0, 0, TRUE);
+}
+