|
|
@ -503,6 +503,7 @@ void UBBoardController::stylusToolDoubleClicked(int tool) |
|
|
|
else if (tool == UBStylusTool::Hand) |
|
|
|
else if (tool == UBStylusTool::Hand) |
|
|
|
{ |
|
|
|
{ |
|
|
|
centerRestore(); |
|
|
|
centerRestore(); |
|
|
|
|
|
|
|
mActiveScene->setLastCenter(QPointF(0,0)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -511,6 +512,7 @@ void UBBoardController::stylusToolDoubleClicked(int tool) |
|
|
|
void UBBoardController::addScene() |
|
|
|
void UBBoardController::addScene() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
|
|
|
|
persistViewPositionOnCurrentScene(); |
|
|
|
persistCurrentScene(false,true); |
|
|
|
persistCurrentScene(false,true); |
|
|
|
|
|
|
|
|
|
|
|
UBDocumentContainer::addPage(mActiveSceneIndex + 1); |
|
|
|
UBDocumentContainer::addPage(mActiveSceneIndex + 1); |
|
|
@ -790,6 +792,8 @@ void UBBoardController::clearScene() |
|
|
|
{ |
|
|
|
{ |
|
|
|
freezeW3CWidgets(true); |
|
|
|
freezeW3CWidgets(true); |
|
|
|
mActiveScene->clearContent(UBGraphicsScene::clearItemsAndAnnotations); |
|
|
|
mActiveScene->clearContent(UBGraphicsScene::clearItemsAndAnnotations); |
|
|
|
|
|
|
|
mActiveScene->setLastCenter(QPointF(0,0)); |
|
|
|
|
|
|
|
mControlView->centerOn(mActiveScene->lastCenter()); |
|
|
|
updateActionStates(); |
|
|
|
updateActionStates(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -959,14 +963,23 @@ void UBBoardController::handScroll(qreal dx, qreal dy) |
|
|
|
emit controlViewportChanged(); |
|
|
|
emit controlViewportChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBBoardController::persistViewPositionOnCurrentScene() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QRect rect = mControlView->rect(); |
|
|
|
|
|
|
|
QPoint center(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); |
|
|
|
|
|
|
|
QPointF viewRelativeCenter = mControlView->mapToScene(center); |
|
|
|
|
|
|
|
mActiveScene->setLastCenter(viewRelativeCenter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBBoardController::previousScene() |
|
|
|
void UBBoardController::previousScene() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (mActiveSceneIndex > 0) |
|
|
|
if (mActiveSceneIndex > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
|
|
|
|
persistViewPositionOnCurrentScene(); |
|
|
|
persistCurrentScene(); |
|
|
|
persistCurrentScene(); |
|
|
|
setActiveDocumentScene(mActiveSceneIndex - 1); |
|
|
|
setActiveDocumentScene(mActiveSceneIndex - 1); |
|
|
|
|
|
|
|
mControlView->centerOn(mActiveScene->lastCenter()); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -979,8 +992,10 @@ void UBBoardController::nextScene() |
|
|
|
if (mActiveSceneIndex < selectedDocument()->pageCount() - 1) |
|
|
|
if (mActiveSceneIndex < selectedDocument()->pageCount() - 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
|
|
|
|
persistViewPositionOnCurrentScene(); |
|
|
|
persistCurrentScene(); |
|
|
|
persistCurrentScene(); |
|
|
|
setActiveDocumentScene(mActiveSceneIndex + 1); |
|
|
|
setActiveDocumentScene(mActiveSceneIndex + 1); |
|
|
|
|
|
|
|
mControlView->centerOn(mActiveScene->lastCenter()); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -993,8 +1008,10 @@ void UBBoardController::firstScene() |
|
|
|
if (mActiveSceneIndex > 0) |
|
|
|
if (mActiveSceneIndex > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
|
|
|
|
persistViewPositionOnCurrentScene(); |
|
|
|
persistCurrentScene(); |
|
|
|
persistCurrentScene(); |
|
|
|
setActiveDocumentScene(0); |
|
|
|
setActiveDocumentScene(0); |
|
|
|
|
|
|
|
mControlView->centerOn(mActiveScene->lastCenter()); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1007,8 +1024,10 @@ void UBBoardController::lastScene() |
|
|
|
if (mActiveSceneIndex < selectedDocument()->pageCount() - 1) |
|
|
|
if (mActiveSceneIndex < selectedDocument()->pageCount() - 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
|
|
|
|
|
|
|
persistViewPositionOnCurrentScene(); |
|
|
|
persistCurrentScene(); |
|
|
|
persistCurrentScene(); |
|
|
|
setActiveDocumentScene(selectedDocument()->pageCount() - 1); |
|
|
|
setActiveDocumentScene(selectedDocument()->pageCount() - 1); |
|
|
|
|
|
|
|
mControlView->centerOn(mActiveScene->lastCenter()); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2093,7 +2112,8 @@ void UBBoardController::saveViewState() |
|
|
|
{ |
|
|
|
{ |
|
|
|
mActiveScene->setViewState(UBGraphicsScene::SceneViewState(currentZoom(), |
|
|
|
mActiveScene->setViewState(UBGraphicsScene::SceneViewState(currentZoom(), |
|
|
|
mControlView->horizontalScrollBar()->value(), |
|
|
|
mControlView->horizontalScrollBar()->value(), |
|
|
|
mControlView->verticalScrollBar()->value())); |
|
|
|
mControlView->verticalScrollBar()->value(), |
|
|
|
|
|
|
|
mActiveScene->lastCenter())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|