diff --git a/core_lib/src/interface/scribblearea.cpp b/core_lib/src/interface/scribblearea.cpp index 34fc0947e..10a97b558 100644 --- a/core_lib/src/interface/scribblearea.cpp +++ b/core_lib/src/interface/scribblearea.cpp @@ -88,7 +88,6 @@ bool ScribbleArea::init() mQuickSizing = mPrefs->isOn(SETTING::QUICK_SIZING); mMakeInvisible = false; - mIsSimplified = mPrefs->isOn(SETTING::OUTLINES); mMultiLayerOnionSkin = mPrefs->isOn(SETTING::MULTILAYER_ONION); mLayerVisibility = static_cast(mPrefs->getInt(SETTING::LAYER_VISIBILITY)); @@ -415,8 +414,6 @@ void ScribbleArea::keyPressEvent(QKeyEvent *event) // Don't handle this event on auto repeat if (event->isAutoRepeat()) { return; } - mKeyboardInUse = true; - if (isPointerInUse()) { return; } // prevents shortcuts calls while drawing if (currentTool()->keyPressEvent(event)) @@ -530,8 +527,6 @@ void ScribbleArea::keyReleaseEvent(QKeyEvent *event) return; } - mKeyboardInUse = false; - if (event->key() == 0) { editor()->tools()->tryClearTemporaryTool(Qt::Key_unknown); @@ -554,7 +549,7 @@ void ScribbleArea::keyReleaseEvent(QKeyEvent *event) // mouse and tablet event handlers void ScribbleArea::wheelEvent(QWheelEvent* event) { - // Don't change view if tool is in use + // Don't change view if the tool is in use if (isPointerInUse()) return; static const bool isX11 = QGuiApplication::platformName() == "xcb"; @@ -693,7 +688,6 @@ void ScribbleArea::pointerPressEvent(PointerEvent* event) const bool isPressed = event->buttons() & Qt::LeftButton; if (isPressed && mQuickSizing) { - //qDebug() << "Start Adjusting" << event->buttons(); if (currentTool()->startAdjusting(event->modifiers(), 1)) { return; @@ -733,13 +727,6 @@ void ScribbleArea::pointerReleaseEvent(PointerEvent* event) return; // [SHIFT]+drag OR [CTRL]+drag } - if (event->buttons() & (Qt::RightButton | Qt::MiddleButton)) - { - mMouseRightButtonInUse = false; - return; - } - - //qDebug() << "release event"; currentTool()->pointerReleaseEvent(event); editor()->tools()->tryClearTemporaryTool(event->button()); @@ -759,11 +746,11 @@ void ScribbleArea::handleDoubleClick() void ScribbleArea::tabletReleaseEventFired() { - // Under certain circumstances a mouse press event will fire after a tablet release event. - // This causes unexpected behaviours for some of the tools, eg. the bucket. - // The problem only seems to occur on windows and only when tapping. - // prior to this fix, the event queue would look like this: - // eg: TabletPress -> TabletRelease -> MousePress + // Under certain circumstances, a mouse press event will fire after a tablet release event. + // This causes unexpected behaviors for some tools, e.g., the bucket tool. + // The problem only seems to occur on Windows and only when tapping. + // Prior to this fix, the event queue would look like this: + // e.g.: TabletPress -> TabletRelease -> MousePress // The following will filter mouse events created after a tablet release event. mTabletReleaseMillisAgo += 50; @@ -1048,10 +1035,9 @@ void ScribbleArea::paintEvent(QPaintEvent* event) currentTool()->paint(painter); - Layer* layer = mEditor->layers()->currentLayer(); - if (!editor()->playback()->isPlaying()) // we don't need to display the following when the animation is playing { + Layer* layer = mEditor->layers()->currentLayer(); if (layer->type() == Layer::VECTOR) { VectorImage* vectorImage = currentVectorImage(layer); @@ -1128,7 +1114,6 @@ void ScribbleArea::paintEvent(QPaintEvent* event) mOverlayPainter.paint(painter); - // paints the selection outline if (mEditor->select()->somethingSelected()) { diff --git a/core_lib/src/interface/scribblearea.h b/core_lib/src/interface/scribblearea.h index 5312d998b..41c62ca6a 100644 --- a/core_lib/src/interface/scribblearea.h +++ b/core_lib/src/interface/scribblearea.h @@ -54,7 +54,6 @@ class ScribbleArea : public QWidget Q_OBJECT friend class MoveTool; - friend class EditTool; friend class SmudgeTool; friend class BucketTool; @@ -74,16 +73,12 @@ class ScribbleArea : public QWidget bool isLayerPaintable() const; - QVector calcSelectionCenterPoints(); - void setEffect(SETTING e, bool isOn); LayerVisibility getLayerVisibility() const { return mLayerVisibility; } qreal getCurveSmoothing() const { return mCurveSmoothingLevel; } - bool usePressure() const { return mUsePressure; } bool makeInvisible() const { return mMakeInvisible; } - QRect getCameraRect(); QPointF getCentralPoint(); /** Update frame. @@ -124,10 +119,6 @@ class ScribbleArea : public QWidget /** Tool changed, invalidate cache and frame if needed */ void onToolChanged(ToolType); - /** Set frame on layer to modified and invalidate current frame cache */ - void setModified(int layerNumber, int frameNumber); - void setModified(const Layer* layer, int frameNumber); - void endStroke(); void flipSelection(bool flipVertical); @@ -143,7 +134,6 @@ class ScribbleArea : public QWidget signals: void multiLayerOnionSkinChanged(bool); - void refreshPreview(); void selectionUpdated(); public slots: @@ -233,27 +223,17 @@ public slots: BitmapImage* currentBitmapImage(Layer* layer) const; VectorImage* currentVectorImage(Layer* layer) const; - MoveMode mMoveMode = MoveMode::NONE; - std::unique_ptr mStrokeManager; Editor* mEditor = nullptr; - - bool mIsSimplified = false; - bool mShowThinLines = false; bool mQuickSizing = true; LayerVisibility mLayerVisibility = LayerVisibility::ALL; - bool mUsePressure = true; bool mMakeInvisible = false; - bool mToolCursors = true; qreal mCurveSmoothingLevel = 0.0; - bool mMultiLayerOnionSkin = false; // future use. If required, just add a checkbox to updated it. - QColor mOnionColor; + bool mMultiLayerOnionSkin = false; // Future use. If required, just add a checkbox to update it. int mDeltaFactor = 1; -private: - /* Under certain circumstances a mouse press event will fire after a tablet release event. This causes unexpected behaviours for some of the tools, eg. the bucket. The problem only seems to occur on windows and only when tapping. @@ -262,9 +242,7 @@ public slots: The following will filter mouse events created after a tablet release event. */ void tabletReleaseEventFired(); - bool mKeyboardInUse = false; bool mMouseInUse = false; - bool mMouseRightButtonInUse = false; bool mTabletInUse = false; qreal mDevicePixelRatio = 1.; diff --git a/core_lib/src/managers/toolmanager.cpp b/core_lib/src/managers/toolmanager.cpp index eb9b0791d..f319c59de 100644 --- a/core_lib/src/managers/toolmanager.cpp +++ b/core_lib/src/managers/toolmanager.cpp @@ -347,7 +347,7 @@ void ToolManager::tabletSwitchToEraser() } void ToolManager::tabletRestorePrevTool() -{ +{ if (mTemporaryTool == nullptr && mTabletEraserTool != nullptr) { mTabletEraserTool = nullptr; diff --git a/core_lib/src/tool/stroketool.h b/core_lib/src/tool/stroketool.h index e4b5c7d92..7f97c793b 100644 --- a/core_lib/src/tool/stroketool.h +++ b/core_lib/src/tool/stroketool.h @@ -57,7 +57,7 @@ class StrokeTool : public BaseTool virtual bool emptyFrameActionEnabled(); private: - QPointF mLastPixel { 0, 0 }; + QPointF mLastPixel { 0, 0 }; }; #endif // STROKETOOL_H