Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
/* This file is part of the KDE project
* SPDX-FileCopyrightText: 2006 Thomas Zander <[email protected]>
* SPDX-FileCopyrightText: 2011 Jan Hambrecht <[email protected]>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "KoInteractionStrategy.h"
#include "KoInteractionStrategy_p.h"
#include "KoCanvasBase.h"
#include "KoShapeController.h"
#include "KoDocumentResourceManager.h"
#include "KoCanvasResourceProvider.h"
#include <kundo2command.h>
KoInteractionStrategy::KoInteractionStrategy(KoToolBase *parent)
: d_ptr(new KoInteractionStrategyPrivate(parent))
{
}
void KoInteractionStrategy::cancelInteraction()
{
KUndo2Command *cmd = createCommand();
if (cmd) {
cmd->redo(); //some applications rely an redo being called here
cmd->undo();
delete cmd;
}
}
KoInteractionStrategy::KoInteractionStrategy(KoInteractionStrategyPrivate &dd)
: d_ptr(&dd)
{
}
KoInteractionStrategy::~KoInteractionStrategy()
{
delete d_ptr;
}
void KoInteractionStrategy::paint(QPainter &, const KoViewConverter &, const KoColorDisplayRendererInterface *displayRendererInterface)
{
}
KoToolBase *KoInteractionStrategy::tool() const
{
Q_D(const KoInteractionStrategy);
return d->tool;
}
uint KoInteractionStrategy::handleRadius() const
{
return tool()->canvas()->resourceManager()->handleRadius();
}
uint KoInteractionStrategy::decorationThickness() const
{
return tool()->canvas()->resourceManager()->decorationThickness();
}
uint KoInteractionStrategy::grabSensitivity() const
{
return tool()->canvas()->shapeController()->resourceManager()->grabSensitivity();
}