Commit f72480e2 authored by Jan Hambrecht's avatar Jan Hambrecht

Move the zoomChanged signal where it was before and

set the document size to the zoom controller which
tells the canvas controller that size when zoom changes.
Set the document size whereever the page size was set.


svn path=/trunk/koffice/; revision=648839
parent f867ebc8
......@@ -70,6 +70,7 @@ void KisZoomManager::setup( KActionCollection * actionCollection )
KisImageSP img = m_view->image();
m_zoomController->setPageSize(QSizeF(img->width() / img->xRes(), img->height() / img->yRes() ));
m_zoomController->setDocumentSize(QSizeF(img->width() / img->xRes(), img->height() / img->yRes() ));
m_zoomAction = m_zoomController->zoomAction();
m_view->viewBar()->addAction(m_zoomAction);
......
......@@ -68,6 +68,14 @@ void KoZoomController::setPageSize(const QSizeF &pageSize)
setZoom(KoZoomMode::ZOOM_PAGE, 0);
}
void KoZoomController::setDocumentSize( const QSizeF &documentSize )
{
m_documentSize = documentSize;
m_canvasController->setDocumentSize(
QSize( int(0.5 + m_zoomHandler->documentToViewX(m_documentSize.width())),
int(0.5 + m_zoomHandler->documentToViewY(m_documentSize.height())) ) );
}
void KoZoomController::setZoom(KoZoomMode::Mode mode, double zoom)
{
m_zoomHandler->setZoomMode(mode);
......@@ -93,15 +101,14 @@ void KoZoomController::setZoom(KoZoomMode::Mode mode, double zoom)
}
m_zoomHandler->setZoom(zoom);
emit zoomChanged(mode, zoom);
// Tell the canvasController that the zoom has changed
// Actually canvasController doesn't know about zoom, but the document in pixels
// has change as a result of the zoom change
m_canvasController->setDocumentSize(
QSize( int(0.5 + m_zoomHandler->documentToViewX(m_pageSize.width())),
int(0.5 + m_zoomHandler->documentToViewY(m_pageSize.height())) ) );
emit zoomChanged(mode, zoom);
QSize( int(0.5 + m_zoomHandler->documentToViewX(m_documentSize.width())),
int(0.5 + m_zoomHandler->documentToViewY(m_documentSize.height())) ) );
// Finally ask the canvasController to recenter
m_canvasController->recenterPreferred();
......
......@@ -72,6 +72,14 @@ public slots:
/// every time the canvas changes content size, tell us. Note that the size is in pt.
void setPageSize(const QSizeF &pageSize);
/**
* Every time the document changes size, tell us.
* For most applictaions the document size equals the page size.
* Note that the size is in pt.
* @param documentSize the new document size in points
*/
void setDocumentSize( const QSizeF &documentSize );
signals:
// the document can use the emitted data for persistency purposes.
void zoomChanged (KoZoomMode::Mode mode, double zoom);
......@@ -99,6 +107,7 @@ private:
KoZoomHandler *m_zoomHandler;
KoZoomAction *m_action;
QSizeF m_pageSize;
QSizeF m_documentSize;
};
#endif
......@@ -227,7 +227,8 @@ void KoPAView::setActivePage( KoPAPageBase* page )
m_verticalRuler->setActiveRange(layout.top, layout.height - layout.bottom);
QSizeF pageSize( layout.width, layout.height );
m_zoomController->setPageSize( pageSize );
m_zoomController->setPageSize( pageSize );
m_zoomController->setDocumentSize( pageSize );
m_canvas->update();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment