|
|
@ -362,6 +362,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta |
|
|
|
// Just for debug. Do not delete please
|
|
|
|
// Just for debug. Do not delete please
|
|
|
|
// connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing()));
|
|
|
|
// connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing()));
|
|
|
|
connect(UBApplication::undoStack.data(), SIGNAL(indexChanged(int)), this, SLOT(updateSelectionFrameWrapper(int))); |
|
|
|
connect(UBApplication::undoStack.data(), SIGNAL(indexChanged(int)), this, SLOT(updateSelectionFrameWrapper(int))); |
|
|
|
|
|
|
|
connect(UBDrawingController::drawingController(), SIGNAL(stylusToolChanged(int,int)), this, SLOT(stylusToolChanged(int,int))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsScene::~UBGraphicsScene() |
|
|
|
UBGraphicsScene::~UBGraphicsScene() |
|
|
@ -615,6 +616,8 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres |
|
|
|
mTempPolygon = NULL; |
|
|
|
mTempPolygon = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!mCurrentStroke->points().empty()) |
|
|
|
|
|
|
|
{ |
|
|
|
QPointF lastDrawnPoint = mCurrentStroke->points().last().first; |
|
|
|
QPointF lastDrawnPoint = mCurrentStroke->points().last().first; |
|
|
|
|
|
|
|
|
|
|
|
mTempPolygon = lineToPolygonItem(QLineF(lastDrawnPoint, scenePos), mPreviousWidth, width); |
|
|
|
mTempPolygon = lineToPolygonItem(QLineF(lastDrawnPoint, scenePos), mPreviousWidth, width); |
|
|
@ -622,6 +625,7 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else if (currentTool == UBStylusTool::Eraser) |
|
|
|
else if (currentTool == UBStylusTool::Eraser) |
|
|
|
{ |
|
|
|
{ |
|
|
|
qreal eraserWidth = UBSettings::settings()->currentEraserWidth(); |
|
|
|
qreal eraserWidth = UBSettings::settings()->currentEraserWidth(); |
|
|
@ -641,7 +645,7 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres |
|
|
|
return accepted; |
|
|
|
return accepted; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool UBGraphicsScene::inputDeviceRelease() |
|
|
|
bool UBGraphicsScene::inputDeviceRelease(int tool) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool accepted = false; |
|
|
|
bool accepted = false; |
|
|
|
|
|
|
|
|
|
|
@ -651,10 +655,15 @@ bool UBGraphicsScene::inputDeviceRelease() |
|
|
|
accepted = true; |
|
|
|
accepted = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool(); |
|
|
|
if (tool < 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tool = UBDrawingController::drawingController()->stylusTool(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)tool; |
|
|
|
|
|
|
|
|
|
|
|
if (currentTool == UBStylusTool::Eraser) |
|
|
|
if (currentTool == UBStylusTool::Eraser) |
|
|
|
redrawEraser(false); |
|
|
|
hideEraser(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBDrawingController *dc = UBDrawingController::drawingController(); |
|
|
|
UBDrawingController *dc = UBDrawingController::drawingController(); |
|
|
@ -2355,6 +2364,17 @@ void UBGraphicsScene::resizedMagnifier(qreal newPercent) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsScene::stylusToolChanged(int tool, int previousTool) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (mInputDeviceIsPressed && tool != previousTool) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// tool was changed while input device is pressed
|
|
|
|
|
|
|
|
// simulate release and press to terminate pervious strokes
|
|
|
|
|
|
|
|
inputDeviceRelease(previousTool); |
|
|
|
|
|
|
|
inputDevicePress(mPreviousPoint); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsScene::addCompass(QPointF center) |
|
|
|
void UBGraphicsScene::addCompass(QPointF center) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBGraphicsCompass* compass = new UBGraphicsCompass(); // mem : owned and destroyed by the scene
|
|
|
|
UBGraphicsCompass* compass = new UBGraphicsCompass(); // mem : owned and destroyed by the scene
|
|
|
|