Commit 284345b8 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

More removals

Removed the variables those had been moved the the helper class.
parent a0eea794
......@@ -101,6 +101,9 @@ private slots:
void slotSetFixedAngle(bool fixedAngle);
private:
// FIXME: investigate why this variable is needed
double m_dragDist;
QGridLayout* m_optionLayout;
// dyna gui
......
......@@ -71,7 +71,6 @@ KisToolFreehand::KisToolFreehand(KoCanvasBase * canvas, const QCursor & cursor,
{
m_explicitShowOutline = false;
m_painter = 0;
m_smooth = true;
m_assistant = false;
m_smoothness = 1.0;
......@@ -100,9 +99,6 @@ KisToolFreehand::KisToolFreehand(KoCanvasBase * canvas, const QCursor & cursor,
m_outlineTimer.setSingleShot(true);
connect(&m_outlineTimer, SIGNAL(timeout()), this, SLOT(hideOutline()));
m_strokeTimer.setSingleShot(true);
connect(&m_strokeTimer, SIGNAL(timeout()), this, SLOT(finishStroke()));
m_infoBuilder = new KisToolPaintingInformationBuilder(this);
m_helper = new KisToolFreehandHelper(m_infoBuilder);
......@@ -197,7 +193,7 @@ void KisToolFreehand::mousePressEvent(KoPointerEvent *e)
bool ignoreEvent = currentPaintOpPreset()->settings()->mousePressEvent(KisPaintInformation(convertToPixelCoord(e->point),
pressureToCurve(e->pressure()), e->xTilt(), e->yTilt(),
KisVector2D::Zero(),
e->rotation(), e->tangentialPressure(), perspective, m_strokeTimeMeasure.elapsed()),e->modifiers());
e->rotation(), e->tangentialPressure(), perspective, 0),e->modifiers());
if (!ignoreEvent){
e->accept();
return;
......@@ -454,9 +450,11 @@ QPainterPath KisToolFreehand::getOutlinePath(const QPointF &documentPos,
{
qreal scale = 1.0;
qreal rotation = 0;
if (m_painter && m_painter->paintOp()){
scale = m_painter->paintOp()->currentScale();
rotation = m_painter->paintOp()->currentRotation();
const KisPaintOp *paintOp = m_helper->currentPaintOp();
if (paintOp){
scale = paintOp->currentScale();
rotation = paintOp->currentRotation();
}
QPointF imagePos = currentImage()->documentToPixel(documentPos);
......
......@@ -84,32 +84,31 @@ private:
friend class KisToolPaintingInformationBuilder;
/**
* adjust a coordinates according to a KisPaintingAssitant, if available.
* Adjusts a coordinates according to a KisPaintingAssitant,
* if available.
*/
QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
/**
* Calculates a coefficient for KisPaintInformation
* according to perspective grid values
*/
qreal calculatePerspective(const QPointF &documentPoint);
void showOutlineTemporary();
void updateOutlineRect();
QPainterPath getOutlinePath(const QPointF &documentPos,
KisPaintOpSettings::OutlineMode outlineMode);
qreal calculatePerspective(const QPointF &documentPoint);
private slots:
void increaseBrushSize();
void decreaseBrushSize();
void hideOutline();
protected:
QTimer m_strokeTimer;
KisPaintInformation m_olderPaintInformation;
KisPaintInformation m_previousPaintInformation;
bool m_haveTangent;
QPointF m_previousTangent;
double m_dragDist;
QPointF m_strokeBegin;
KisPainter *m_painter;
protected:
bool m_smooth;
double m_smoothness;
bool m_assistant;
......@@ -134,17 +133,9 @@ private:
KisRecordedPathPaintAction* m_pathPaintAction;
QTime m_strokeTimeMeasure;
KAction* m_increaseBrushSize;
KAction* m_decreaseBrushSize;
bool m_hasPaintAtLeastOnce; ///< this indicates whether mouseReleaseEvent should call paintAt or not
KisStrokeId m_strokeId;
KisResourcesSnapshotSP m_resources;
KisDistanceInformation m_dragDistance;
KisPaintingInformationBuilder *m_infoBuilder;
KisToolFreehandHelper *m_helper;
};
......
......@@ -62,6 +62,7 @@ struct KisToolFreehandHelper::Private
KisToolFreehandHelper::KisToolFreehandHelper(KisPaintingInformationBuilder *infoBuilder)
: m_d(new Private)
{
m_d->painter = 0;
m_d->infoBuilder = infoBuilder;
m_d->smooth = true;
......@@ -180,7 +181,7 @@ void KisToolFreehandHelper::endPaint()
/**
* There might be some timer events still pending, so
* we should cancel them. Use this flag for the purpose.
* Please not that we are not in MT here, so no mutex
* Please note that we are not in MT here, so no mutex
* is needed
*/
m_d->painter = 0;
......@@ -188,6 +189,12 @@ void KisToolFreehandHelper::endPaint()
m_d->strokesFacade->endStroke(m_d->strokeId);
}
const KisPaintOp* KisToolFreehandHelper::currentPaintOp() const
{
return m_d->painter ? m_d->painter->paintOp() : 0;
}
void KisToolFreehandHelper::finishStroke()
{
if(m_d->haveTangent) {
......
......@@ -30,6 +30,8 @@ class KoResourceManager;
class KisPaintingInformationBuilder;
class KisStrokesFacade;
class KisPostExecutionUndoAdapter;
class KisPaintOp;
class KRITAUI_EXPORT KisToolFreehandHelper : public QObject
{
......@@ -50,7 +52,7 @@ public:
void paint(KoPointerEvent *event);
void endPaint();
void paintAtPreviousPos();
const KisPaintOp* currentPaintOp() const;
private:
void paintAt(const KisPaintInformation &pi);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment