Index: krita/krita.action =================================================================== --- krita/krita.action +++ krita/krita.action @@ -355,6 +355,17 @@ true + + + Use Pen Pressure + + Use Pen Pressure + Use Pen Pressure + 10000 + + true + + symmetry-horizontal Horizontal Mirror Tool Index: libs/ui/kis_canvas_resource_provider.h =================================================================== --- libs/ui/kis_canvas_resource_provider.h +++ libs/ui/kis_canvas_resource_provider.h @@ -75,6 +75,7 @@ Size, HdrGamma, GlobalAlphaLock, + DisablePressure, PreviousPaintOpPreset, EffectiveZoom, ///<-Used only by painting tools for non-displaying purposes PresetAllowsLod, @@ -165,6 +166,8 @@ void setGlobalAlphaLock(bool lock); bool globalAlphaLock() const; + void setDisablePressure(bool value); + bool disablePressure() const; ///Notify that the workspace is saved and settings should be saved to it void notifySavingWorkspace(KisWorkspaceResource* workspace); Index: libs/ui/kis_canvas_resource_provider.cpp =================================================================== --- libs/ui/kis_canvas_resource_provider.cpp +++ libs/ui/kis_canvas_resource_provider.cpp @@ -532,6 +532,16 @@ return m_resourceManager->resource(GlobalAlphaLock).toBool(); } +void KisCanvasResourceProvider::setDisablePressure(bool value) +{ + m_resourceManager->setResource(DisablePressure, value); +} + +bool KisCanvasResourceProvider::disablePressure() const +{ + return m_resourceManager->resource(DisablePressure).toBool(); +} + void KisCanvasResourceProvider::notifyLoadingWorkspace(KisWorkspaceResource* workspace) { emit sigLoadingWorkspace(workspace); Index: libs/ui/kis_paintop_box.h =================================================================== --- libs/ui/kis_paintop_box.h +++ libs/ui/kis_paintop_box.h @@ -25,7 +25,8 @@ #include #include #include - +#include +#include #include #include @@ -153,6 +154,7 @@ void slotSwitchToPreviousPreset(); void slotUnsetEraseMode(); void slotToggleAlphaLockMode(bool); + void slotDisablePressureMode(bool); void slotReloadPreset(); void slotGuiChangedCurrentPreset(); @@ -182,6 +184,8 @@ KisCompositeOpComboBox* m_cmbCompositeOp; QToolButton* m_eraseModeButton; QToolButton* m_alphaLockButton; + QCheckBox* m_disablePressureButton; + QLabel* m_pressureLabel; QToolButton* m_hMirrorButton; QToolButton* m_vMirrorButton; KisToolOptionsPopup* m_toolOptionsPopup; @@ -195,6 +199,7 @@ QToolButton* m_reloadButton; KisAction* m_eraseAction; KisAction* m_reloadAction; + KisAction* m_disablePressureAction; QString m_currCompositeOpID; KisNodeWSP m_previousNode; Index: libs/ui/kis_paintop_box.cc =================================================================== --- libs/ui/kis_paintop_box.cc +++ libs/ui/kis_paintop_box.cc @@ -156,6 +156,13 @@ m_alphaLockButton->setDefaultAction(alphaLockAction); + // pen pressure + m_disablePressureButton = new QCheckBox(this); + m_disablePressureButton->setCheckable(true); + m_disablePressureButton->setChecked(true); + + m_disablePressureAction = m_viewManager->actionManager()->createAction("disable_pressure"); + m_disablePressureButton->addAction(m_disablePressureAction); // horizontal and vertical mirror toolbar buttons @@ -178,8 +185,6 @@ moveToCenterActionX->setText(i18n("Move to Canvas Center")); toolbarMenuXMirror->addAction(moveToCenterActionX); - - // mirror tool options for the Y Mirror QMenu *toolbarMenuYMirror = new QMenu(); @@ -334,6 +339,22 @@ action->setText(i18n("Brush composite")); action->setDefaultWidget(compositeActions); + m_pressureLabel = new QLabel(this); + m_pressureLabel->setText("Use Pen Pressure"); + + QWidget* compositePressure = new QWidget(this); + QHBoxLayout* pressureLayout = new QHBoxLayout(compositePressure); + pressureLayout->addWidget(m_disablePressureButton); + pressureLayout->addWidget(m_pressureLabel); + + pressureLayout->setSpacing(4); + pressureLayout->setContentsMargins(0, 0, 0, 0); + + action = new QWidgetAction(this); + view->actionCollection()->addAction("pressure_action", action); + action->setText(i18n("Pressure usage")); + action->setDefaultWidget(compositePressure); + action = new QWidgetAction(this); KisActionRegistry::instance()->propertizeAction("brushslider1", action); view->actionCollection()->addAction("brushslider1", action); @@ -443,9 +464,9 @@ connect(m_presetsChooserPopup, SIGNAL(resourceSelected(KoResource*)) , SLOT(resourceSelected(KoResource*))); connect(m_resourceProvider , SIGNAL(sigNodeChanged(const KisNodeSP)) , SLOT(slotNodeChanged(const KisNodeSP))); connect(m_cmbCompositeOp , SIGNAL(currentIndexChanged(int)) , SLOT(slotSetCompositeMode(int))); - connect(m_eraseAction , SIGNAL(toggled(bool)) , SLOT(slotToggleEraseMode(bool))); - connect(alphaLockAction , SIGNAL(toggled(bool)) , SLOT(slotToggleAlphaLockMode(bool))); - + connect(m_eraseAction , SIGNAL(toggled(bool)) , SLOT(slotToggleEraseMode(bool))); + connect(alphaLockAction , SIGNAL(toggled(bool)) , SLOT(slotToggleAlphaLockMode(bool))); + connect(m_disablePressureAction , SIGNAL(toggled(bool)) , SLOT(slotDisablePressureMode(bool))); connect(m_hMirrorAction , SIGNAL(toggled(bool)) , SLOT(slotHorizontalMirrorChanged(bool))); connect(m_vMirrorAction , SIGNAL(toggled(bool)) , SLOT(slotVerticalMirrorChanged(bool))); @@ -782,6 +803,10 @@ m_eraseAction->setChecked(value.toBool()); } + if (key == KisCanvasResourceProvider::DisablePressure) { + m_disablePressureAction->setChecked(value.toBool()); + } + sender()->blockSignals(false); } } @@ -1076,6 +1101,13 @@ m_resourceProvider->setGlobalAlphaLock(checked); } +void KisPaintopBox::slotDisablePressureMode(bool checked) +{ + m_resourceProvider->setDisablePressure(checked); + + ENTER_FUNCTION() << ppVar(m_resourceProvider->disablePressure()); +} + void KisPaintopBox::slotReloadPreset() { KisSignalsBlocker blocker(m_optionWidget); Index: libs/ui/tool/kis_painting_information_builder.h =================================================================== --- libs/ui/tool/kis_painting_information_builder.h +++ libs/ui/tool/kis_painting_information_builder.h @@ -30,6 +30,7 @@ class KisToolFreehand; class KisCoordinatesConverter; class KisSpeedSmoother; +class KoCanvasResourceManager; class KRITAUI_EXPORT KisPaintingInformationBuilder : public QObject { @@ -39,7 +40,7 @@ KisPaintingInformationBuilder(); ~KisPaintingInformationBuilder(); - KisPaintInformation startStroke(KoPointerEvent *event, int timeElapsed); + KisPaintInformation startStroke(KoPointerEvent *event, int timeElapsed, const KoCanvasResourceManager *manager = 0); KisPaintInformation continueStroke(KoPointerEvent *event, int timeElapsed); @@ -72,6 +73,7 @@ QVector m_pressureSamples; QPointF m_startPoint; QScopedPointer m_speedSmoother; + bool m_pressureDisabled; }; class KRITAUI_EXPORT KisConverterPaintingInformationBuilder : public KisPaintingInformationBuilder Index: libs/ui/tool/kis_painting_information_builder.cpp =================================================================== --- libs/ui/tool/kis_painting_information_builder.cpp +++ libs/ui/tool/kis_painting_information_builder.cpp @@ -26,6 +26,8 @@ #include "kis_cubic_curve.h" #include "kis_speed_smoother.h" +#include +#include "kis_canvas_resource_provider.h" /***********************************************************************/ /* KisPaintingInformationBuilder */ @@ -36,7 +38,8 @@ KisPaintingInformationBuilder::KisPaintingInformationBuilder() - : m_speedSmoother(new KisSpeedSmoother()) + : m_speedSmoother(new KisSpeedSmoother()), + m_pressureDisabled(true) { connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(updateSettings())); @@ -58,8 +61,11 @@ } KisPaintInformation KisPaintingInformationBuilder::startStroke(KoPointerEvent *event, - int timeElapsed) + int timeElapsed, + const KoCanvasResourceManager *manager) { + m_pressureDisabled = manager->resource(KisCanvasResourceProvider::DisablePressure).toBool(); + m_startPoint = event->point; return createPaintingInformation(event, timeElapsed); @@ -103,7 +109,7 @@ qreal speed = m_speedSmoother->getNextSpeed(imageToView(imagePoint)); return KisPaintInformation(imagePoint, - pressureToCurve(event->pressure()), + !m_pressureDisabled ? 1.0 : pressureToCurve(event->pressure()), event->xTilt(), event->yTilt(), event->rotation(), event->tangentialPressure(), Index: libs/ui/tool/kis_tool_freehand_helper.cpp =================================================================== --- libs/ui/tool/kis_tool_freehand_helper.cpp +++ libs/ui/tool/kis_tool_freehand_helper.cpp @@ -194,7 +194,7 @@ KisDefaultBoundsBaseSP bounds) { KisPaintInformation pi = - m_d->infoBuilder->startStroke(event, elapsedStrokeTime()); + m_d->infoBuilder->startStroke(event, elapsedStrokeTime(), resourceManager); initPaintImpl(pi, resourceManager, Index: plugins/tools/tool_transform2/kis_liquify_paint_helper.h =================================================================== --- plugins/tools/tool_transform2/kis_liquify_paint_helper.h +++ plugins/tools/tool_transform2/kis_liquify_paint_helper.h @@ -27,7 +27,6 @@ class KisLiquifyProperties; class QPainterPath; - class KisLiquifyPaintHelper { public: