Commit 75aacbd1 authored by Halla Rempt's avatar Halla Rempt
Browse files

Remove the update() method from the tools and add a canvas getter

to the resource provider class.

svn path=/trunk/koffice/; revision=600535
parent 6b768de7
......@@ -76,11 +76,6 @@ void KisToolBrush::timeoutPaint()
}
void KisToolBrush::update(KisCanvasSubject *subject)
{
super::update(subject);
}
void KisToolBrush::initPaint(KoPointerEvent *e)
{
super::initPaint(e);
......
......@@ -36,7 +36,6 @@ class KisToolBrush : public KisToolFreehand {
public:
KisToolBrush();
virtual ~KisToolBrush();
virtual void update(KisCanvasSubject *subject);
virtual void setup(KActionCollection *collection);
virtual enumToolType toolType() { return TOOL_SHAPE; }
virtual quint32 priority() { return 0; }
......
......@@ -69,12 +69,6 @@ KisToolColorPicker::~KisToolColorPicker()
{
}
void KisToolColorPicker::update(KisCanvasSubject *subject)
{
m_subject = subject;
super::update(m_subject);
}
void KisToolColorPicker::buttonPress(KoPointerEvent *e)
{
if (m_subject) {
......
......@@ -47,7 +47,6 @@ public:
virtual ~KisToolColorPicker();
public:
virtual void update(KisCanvasSubject *subject);
virtual void setup(KActionCollection *collection);
virtual void buttonPress(KoPointerEvent *e);
virtual QWidget* createOptionWidget(QWidget* parent);
......
......@@ -60,7 +60,7 @@ protected:
// Tool starting duplicate
KoPoint m_offset; // This member give the offset from the click position to the point where we take the duplication
bool m_isOffsetNotUptodate; // Tells if the offset is update
bool m_isOffsetNotUptodate; // Tells if the offset is updated
KoPoint m_position; // Give the position of the last alt-click
KoPoint m_positionStartPainting;
QCheckBox* m_healing;
......
......@@ -54,13 +54,6 @@ KisToolEllipse::~KisToolEllipse()
{
}
void KisToolEllipse::update (KisCanvasSubject *subject)
{
super::update (subject);
if (m_subject)
m_currentImage = m_subject->currentImg ();
}
void KisToolEllipse::buttonPress(KoPointerEvent *event)
{
if (m_currentImage && event->button() == Qt::LeftButton) {
......
......@@ -38,16 +38,6 @@ public:
KisToolEllipse();
virtual ~KisToolEllipse();
//
// KisCanvasObserver interface
//
virtual void update (KisCanvasSubject *subject);
//
// KisToolPaint interface
//
virtual void setup(KActionCollection *collection);
virtual quint32 priority() { return 3; }
virtual enumToolType toolType() { return TOOL_SHAPE; }
......
......@@ -64,14 +64,6 @@ KisToolFill::KisToolFill()
setCursor(KisCursor::load("tool_fill_cursor.png", 6, 6));
}
void KisToolFill::update(KisCanvasSubject *subject)
{
m_subject = subject;
m_currentImage = subject->currentImg();
super::update(m_subject);
}
KisToolFill::~KisToolFill()
{
}
......
......@@ -48,8 +48,6 @@ public:
virtual void setup(KActionCollection *collection);
virtual enumToolType toolType() { return TOOL_FILL; }
virtual void update(KisCanvasSubject *subject);
virtual void buttonPress(KoPointerEvent*);
virtual void buttonRelease(KoPointerEvent*);
......
......@@ -68,12 +68,6 @@ KisToolGradient::~KisToolGradient()
{
}
void KisToolGradient::update(KisCanvasSubject *subject)
{
m_subject = subject;
super::update(m_subject);
}
void KisToolGradient::paint(QPainter& gc)
{
if (m_dragging)
......
......@@ -54,8 +54,6 @@ public:
virtual void setup(KActionCollection *collection);
virtual enumToolType toolType() { return TOOL_FILL; }
virtual void update(KisCanvasSubject *subject);
virtual void buttonPress(KoPointerEvent *event);
virtual void move(KoPointerEvent *event);
virtual void buttonRelease(KoPointerEvent *event);
......
......@@ -61,15 +61,6 @@ KisToolLine::~KisToolLine()
{
}
void KisToolLine::update(KisCanvasSubject *subject)
{
m_subject = subject;
m_currentImage = subject->currentImg();
super::update(m_subject);
}
void KisToolLine::paint(QPainter& gc)
{
if (m_dragging)
......@@ -122,17 +113,17 @@ void KisToolLine::buttonRelease(KoPointerEvent *e)
if(m_subject) {
KisCanvasController *controller = m_subject->canvasController();
KisImageSP img = m_subject->currentImg();
if (m_startPos == m_endPos) {
controller->updateCanvas();
m_dragging = false;
return;
}
if ((e->modifiers() & Qt::ShiftModifier) == Qt::ShiftModifier) {
m_endPos = straightLine(e->pos());
} else m_endPos = e->pos();
KisPaintDeviceSP device;
if (m_currentImage &&
(device = m_currentImage->activeDevice()) &&
......@@ -140,9 +131,9 @@ void KisToolLine::buttonRelease(KoPointerEvent *e)
delete m_painter;
m_painter = new KisPainter( device );
Q_CHECK_PTR(m_painter);
if (m_currentImage->undo()) m_painter->beginTransaction(i18n("Line"));
m_painter->setPaintColor(m_subject->fgColor());
m_painter->setBrush(m_subject->currentBrush());
m_painter->setOpacity(m_opacity);
......@@ -152,12 +143,12 @@ void KisToolLine::buttonRelease(KoPointerEvent *e)
m_painter->paintLine(m_startPos, PRESSURE_DEFAULT, 0, 0, m_endPos, PRESSURE_DEFAULT, 0, 0);
device->setDirty( m_painter->dirtyRect() );
notifyModified();
/* remove remains of the line drawn while moving */
if (controller->kiscanvas()) {
controller->kiscanvas()->update();
}
if (m_currentImage->undo() && m_painter) {
m_currentImage->undoAdapter()->addCommand(m_painter->endTransaction());
}
......
......@@ -48,7 +48,6 @@ class KisToolLine : public KisToolPaint {
virtual void setup(KActionCollection *collection);
virtual enumToolType toolType() { return TOOL_SHAPE; }
virtual quint32 priority() { return 1; }
virtual void update(KisCanvasSubject *subject);
virtual void buttonPress(KoPointerEvent *event);
virtual void move(KoPointerEvent *event);
......
......@@ -53,13 +53,6 @@ KisToolMove::~KisToolMove()
{
}
void KisToolMove::update(KisCanvasSubject *subject)
{
m_subject = subject;
m_strategy.reset(subject);
super::update(subject);
}
void KisToolMove::buttonPress(KoPointerEvent *e)
{
if (m_subject && e->button() == Qt::LeftButton) {
......
......@@ -35,8 +35,6 @@ public:
KisToolMove();
virtual ~KisToolMove();
public:
virtual void update(KisCanvasSubject *subject);
public:
virtual void setup(KActionCollection *collection);
......
......@@ -43,12 +43,6 @@ KisToolPan::~KisToolPan()
{
}
void KisToolPan::update(KisCanvasSubject *subject)
{
m_subject = subject;
super::update(m_subject);
}
void KisToolPan::buttonPress(KoPointerEvent *e)
{
if (m_subject && !m_dragging && e->button() == Qt::LeftButton) {
......
......@@ -37,10 +37,8 @@ public:
KisToolPan();
virtual ~KisToolPan();
virtual void update(KisCanvasSubject *subject);
virtual void setup(KActionCollection *collection);
virtual enumToolType toolType() { return TOOL_VIEW; }
virtual enumToolType toolType() { return TOOL_VIEW; }
virtual void buttonPress(KoPointerEvent *e);
virtual void move(KoPointerEvent *e);
......
......@@ -55,13 +55,6 @@ KisToolRectangle::~KisToolRectangle()
{
}
void KisToolRectangle::update (KisCanvasSubject *subject)
{
super::update (subject);
if (m_subject)
m_currentImage = m_subject->currentImg ();
}
void KisToolRectangle::buttonPress(KoPointerEvent *event)
{
if (m_currentImage && event->button() == Qt::LeftButton) {
......
......@@ -43,15 +43,6 @@ public:
KisToolRectangle();
virtual ~KisToolRectangle();
//
// KisCanvasObserver interface
//
virtual void update (KisCanvasSubject *subject);
//
// KisToolPaint interface
//
virtual void setup(KActionCollection *collection);
virtual enumToolType toolType() { return TOOL_SHAPE; }
......
......@@ -63,12 +63,6 @@ KisToolText::~KisToolText()
{
}
void KisToolText::update(KisCanvasSubject *subject)
{
m_subject = subject;
super::update(subject);
}
void KisToolText::buttonRelease(KoPointerEvent *e)
{
if (m_subject && e->button() == Qt::LeftButton) {
......
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