From 9dc74ccafa0b6bebf80281b4ef9708a201680766 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Mon, 13 Aug 2012 11:58:56 +0300 Subject: [PATCH 1/4] Fixed sync of magnifier tool on control and display screens. --- src/board/UBBoardController.cpp | 1 + src/domain/UBGraphicsScene.cpp | 17 ++++++++++++++--- src/domain/UBGraphicsScene.h | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 89cdfefd..b28ac7c8 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1486,6 +1486,7 @@ void UBBoardController::boardViewResized(QResizeEvent* event) mPaletteManager->containerResized(); + UBApplication::boardController->controlView()->scene()->moveMagnifier(); } diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 9ee4fb67..c90dc0a2 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1979,7 +1979,16 @@ void UBGraphicsScene::addMagnifier(UBMagnifierParams params) setModified(true); } -void UBGraphicsScene::moveMagnifier(QPoint newPos) +void UBGraphicsScene::moveMagnifier() +{ + if (magniferControlViewWidget) + { + QPoint magnifierPos = QPoint(magniferControlViewWidget->pos().x() + magniferControlViewWidget->size().width() / 2, magniferControlViewWidget->pos().y() + magniferControlViewWidget->size().height() / 2 ); + moveMagnifier(magnifierPos, true); + } +} + +void UBGraphicsScene::moveMagnifier(QPoint newPos, bool forceGrab) { QWidget *cContainer = (QWidget*)(UBApplication::boardController->controlContainer()); QGraphicsView *cView = (QGraphicsView*)UBApplication::boardController->controlView(); @@ -1987,6 +1996,8 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos) QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0)); + QRect qcr = cView->geometry(); + QRect qdr = dView->geometry(); int cvW = cView->width(); int dvW = dView->width(); qreal wCoeff = (qreal)dvW / (qreal)cvW; @@ -1999,8 +2010,8 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos) QPoint cvPoint = cView->mapFromGlobal(globalPoint); QPoint dvPoint( cvPoint.x() * wCoeff + dvZeroPoint.x(), cvPoint.y() * hCoeff + dvZeroPoint.y()); - magniferControlViewWidget->grabNMove(globalPoint, globalPoint, false, false); - magniferDisplayViewWidget->grabNMove(globalPoint, dvPoint, false, true); + magniferControlViewWidget->grabNMove(globalPoint, globalPoint, forceGrab, false); + magniferDisplayViewWidget->grabNMove(globalPoint, dvPoint, forceGrab, true); setModified(true); } diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index a9a82f11..027ef706 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -326,7 +326,8 @@ public slots: void selectionChangedProcessing(); void updateGroupButtonState(); - void moveMagnifier(QPoint newPos); + void moveMagnifier(); + void moveMagnifier(QPoint newPos, bool forceGrab = false); void closeMagnifier(); void zoomInMagnifier(); void zoomOutMagnifier(); From ced305eccc1facb9c0c855ab6001e297ad11f283 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Mon, 13 Aug 2012 12:06:31 +0300 Subject: [PATCH 2/4] Useless code was removed. --- src/adaptors/UBCFFSubsetAdaptor.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/adaptors/UBCFFSubsetAdaptor.cpp b/src/adaptors/UBCFFSubsetAdaptor.cpp index bc43b758..52308acd 100644 --- a/src/adaptors/UBCFFSubsetAdaptor.cpp +++ b/src/adaptors/UBCFFSubsetAdaptor.cpp @@ -1049,10 +1049,6 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite QTransform rTransform; QPointF newVector = rTransform.map(oldVector); - QRectF sr = mCurrentScene->sceneRect(); - QRectF sr1 = mCurrentSceneRect; - QRectF sr2 = mCurrentScene->normalizedSceneRect(); - QTransform tr = item->sceneTransform(); item->setTransform(rTransform.scale(fullScaleX, fullScaleY), true); tr = item->sceneTransform(); From 252dc9c42be083c9694d3a8f1f3ae0e82be119b7 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Mon, 13 Aug 2012 12:12:55 +0300 Subject: [PATCH 3/4] Display screen is centered now - fixed Sankore-811. --- src/board/UBBoardController.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index b28ac7c8..f56d7469 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1484,6 +1484,9 @@ void UBBoardController::boardViewResized(QResizeEvent* event) mControlView->centerOn(0,0); + if (mDisplayView) + mDisplayView->centerOn(0,0); + mPaletteManager->containerResized(); UBApplication::boardController->controlView()->scene()->moveMagnifier(); From 481e196a542684eb8fa7c51ac08e2b9163dffd4a Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Mon, 13 Aug 2012 12:55:20 +0300 Subject: [PATCH 4/4] Fixed moving items by play tool - Sankore-827,945. --- src/board/UBBoardView.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 8b87c8d9..fca5051d 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -1013,7 +1013,6 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) if (bReleaseIsNeed) { - qDebug() << "mre"; QGraphicsView::mouseReleaseEvent (event); } } @@ -1033,9 +1032,8 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) delete suspendedMousePressEvent; suspendedMousePressEvent = NULL; } - - QGraphicsView::mouseReleaseEvent (event); } + QGraphicsView::mouseReleaseEvent (event); } else if (currentTool == UBStylusTool::Text) {