[calligra] krita/plugins/tools/tool_transform2: reset transform tool when the node chages
Boudewijn Rempt
boud at valdyas.org
Thu Mar 8 07:56:39 UTC 2012
On Wednesday 07 March 2012 Mar, Sven Langkamp wrote:
> Git commit 1cf3389a2867e6741feb9a501152fd23c79bfde7 by Sven Langkamp.
> Committed on 07/03/2012 at 19:31.
> Pushed by langkamp into branch 'master'.
>
> reset transform tool when the node chages
> BUG:295471
I think this fix should be backported to 2.4.
>
> M +11 -1 krita/plugins/tools/tool_transform2/kis_tool_transform.cc
> M +4 -0 krita/plugins/tools/tool_transform2/kis_tool_transform.h
>
> http://commits.kde.org/calligra/1cf3389a2867e6741feb9a501152fd23c79bfde7
>
> diff --git a/krita/plugins/tools/tool_transform2/kis_tool_transform.cc b/krita/plugins/tools/tool_transform2/kis_tool_transform.cc
> index 4d1ed58..45d4830 100644
> --- a/krita/plugins/tools/tool_transform2/kis_tool_transform.cc
> +++ b/krita/plugins/tools/tool_transform2/kis_tool_transform.cc
> @@ -79,7 +79,7 @@
>
> KisToolTransform::KisToolTransform(KoCanvasBase * canvas)
> : KisTool(canvas, KisCursor::rotateCursor())
> - , m_canvas(canvas)
> + , m_canvas(canvas), m_isActive(false)
> {
> setObjectName("tool_transform");
> useCursor(KisCursor::selectCursor());
> @@ -932,6 +932,14 @@ void KisToolTransform::keyReleaseEvent(QKeyEvent *event)
> KisTool::keyReleaseEvent(event);
> }
>
> +void KisToolTransform::resourceChanged(int key, const QVariant& res)
> +{
> + KisTool::resourceChanged(key, res);
> + if(m_isActive && key == KisCanvasResourceProvider::CurrentKritaNode) {
> + initTransform(m_currentArgs.mode());
> + }
> +}
> +
> /* A sort of gradient descent method is used to find the correct scale
> factors when scaling up/down the image from one of its corners,
> when there is a perspective projection.
> @@ -2092,6 +2100,7 @@ void KisToolTransform::activate(ToolActivation toolActivation, const QSet<KoShap
> else {
> updateOptionWidget();
> }
> + m_isActive = true;
> }
>
> void KisToolTransform::deactivate()
> @@ -2110,6 +2119,7 @@ void KisToolTransform::deactivate()
> }
>
> KisTool::deactivate();
> + m_isActive = false;
> }
>
> void KisToolTransform::transform()
> diff --git a/krita/plugins/tools/tool_transform2/kis_tool_transform.h b/krita/plugins/tools/tool_transform2/kis_tool_transform.h
> index c4c25e4..b92a7dd 100644
> --- a/krita/plugins/tools/tool_transform2/kis_tool_transform.h
> +++ b/krita/plugins/tools/tool_transform2/kis_tool_transform.h
> @@ -100,6 +100,8 @@ public:
> virtual void keyPressEvent(QKeyEvent *event);
> virtual void keyReleaseEvent(QKeyEvent *event);
>
> + virtual void resourceChanged(int key, const QVariant& res);
> +
> public:
> void paint(QPainter& gc, const KoViewConverter &converter);
>
> @@ -397,6 +399,8 @@ private:
> bool m_cursorOverPoint;
> int m_pointUnderCursor; // the id of the point in the vector
>
> + bool m_isActive;
> +
> private slots:
>
> void slotSetFilter(const KoID &);
>
>
--
Boudewijn Rempt
http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl
More information about the kimageshop
mailing list