summaryrefslogtreecommitdiff
authorleseb <leseb>2002-03-27 17:17:06 (UTC)
committer leseb <leseb>2002-03-27 17:17:06 (UTC)
commit7578abbb11ce2dbae3c54ab7051ad2b39d31360b (patch) (side-by-side diff)
treed87912e163039608f6c1c2dfcdab2f99010df118
parent4372bb8e59eb4b0d2fa5fba8f6525dc14873f239 (diff)
downloadopie-7578abbb11ce2dbae3c54ab7051ad2b39d31360b.zip
opie-7578abbb11ce2dbae3c54ab7051ad2b39d31360b.tar.gz
opie-7578abbb11ce2dbae3c54ab7051ad2b39d31360b.tar.bz2
Rename drawmode -> tool
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawmode.cpp28
-rw-r--r--noncore/graphics/drawpad/drawmode.h39
-rw-r--r--noncore/graphics/drawpad/ellipsedrawmode.cpp45
-rw-r--r--noncore/graphics/drawpad/ellipsedrawmode.h30
-rw-r--r--noncore/graphics/drawpad/erasedrawmode.cpp74
-rw-r--r--noncore/graphics/drawpad/erasedrawmode.h36
-rw-r--r--noncore/graphics/drawpad/filldrawmode.cpp88
-rw-r--r--noncore/graphics/drawpad/filldrawmode.h39
-rw-r--r--noncore/graphics/drawpad/linedrawmode.cpp39
-rw-r--r--noncore/graphics/drawpad/linedrawmode.h30
-rw-r--r--noncore/graphics/drawpad/pointdrawmode.cpp73
-rw-r--r--noncore/graphics/drawpad/pointdrawmode.h36
-rw-r--r--noncore/graphics/drawpad/rectangledrawmode.cpp39
-rw-r--r--noncore/graphics/drawpad/rectangledrawmode.h30
-rw-r--r--noncore/graphics/drawpad/shapedrawmode.cpp92
-rw-r--r--noncore/graphics/drawpad/shapedrawmode.h41
16 files changed, 0 insertions, 759 deletions
diff --git a/noncore/graphics/drawpad/drawmode.cpp b/noncore/graphics/drawpad/drawmode.cpp
deleted file mode 100644
index 57fd14b..0000000
--- a/noncore/graphics/drawpad/drawmode.cpp
+++ b/dev/null
@@ -1,28 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "drawmode.h"
-
-#include "drawpad.h"
-#include "drawpadcanvas.h"
-
-DrawMode::DrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
- : QObject()
-{
- m_pDrawPad = drawPad;
- m_pDrawPadCanvas = drawPadCanvas;
-}
-
-DrawMode::~DrawMode()
-{
-}
diff --git a/noncore/graphics/drawpad/drawmode.h b/noncore/graphics/drawpad/drawmode.h
deleted file mode 100644
index 01e42cc..0000000
--- a/noncore/graphics/drawpad/drawmode.h
+++ b/dev/null
@@ -1,39 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef DRAWMODE_H
-#define DRAWMODE_H
-
-#include <qobject.h>
-
-class DrawPad;
-class DrawPadCanvas;
-
-class DrawMode : public QObject
-{
-protected:
- DrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
-
-public:
- virtual ~DrawMode();
-
- virtual void mousePressEvent(QMouseEvent* e) = 0;
- virtual void mouseReleaseEvent(QMouseEvent* e) = 0;
- virtual void mouseMoveEvent(QMouseEvent* e) = 0;
-
-protected:
- DrawPad* m_pDrawPad;
- DrawPadCanvas* m_pDrawPadCanvas;
-};
-
-#endif // DRAWMODE_H
diff --git a/noncore/graphics/drawpad/ellipsedrawmode.cpp b/noncore/graphics/drawpad/ellipsedrawmode.cpp
deleted file mode 100644
index f9cfa73..0000000
--- a/noncore/graphics/drawpad/ellipsedrawmode.cpp
+++ b/dev/null
@@ -1,45 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "ellipsedrawmode.h"
-
-#include "drawpad.h"
-#include "drawpadcanvas.h"
-
-#include <qpainter.h>
-#include <qpixmap.h>
-
-EllipseDrawMode::EllipseDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
- : ShapeDrawMode(drawPad, drawPadCanvas)
-{
-}
-
-EllipseDrawMode::~EllipseDrawMode()
-{
-}
-
-void EllipseDrawMode::drawFinalShape(QPainter& p)
-{
- p.setRasterOp(Qt::NotROP);
- p.drawRect(QRect(m_polyline[2], m_polyline[0]));
- p.setPen(m_pDrawPad->pen());
- p.setRasterOp(Qt::CopyROP);
- p.drawEllipse(QRect(m_polyline[2], m_polyline[0]));
-}
-
-void EllipseDrawMode::drawTemporaryShape(QPainter& p)
-{
- p.setRasterOp(Qt::NotROP);
- p.drawRect(QRect(m_polyline[2], m_polyline[1]));
- p.drawRect(QRect(m_polyline[2], m_polyline[0]));
-}
diff --git a/noncore/graphics/drawpad/ellipsedrawmode.h b/noncore/graphics/drawpad/ellipsedrawmode.h
deleted file mode 100644
index 0246caa..0000000
--- a/noncore/graphics/drawpad/ellipsedrawmode.h
+++ b/dev/null
@@ -1,30 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef ELLIPSEDRAWMODE_H
-#define ELLIPSEDRAWMODE_H
-
-#include "shapedrawmode.h"
-
-class EllipseDrawMode : public ShapeDrawMode
-{
-public:
- EllipseDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
- ~EllipseDrawMode();
-
-protected:
- void drawFinalShape(QPainter& p);
- void drawTemporaryShape(QPainter& p);
-};
-
-#endif // ELLIPSEDRAWMODE_H
diff --git a/noncore/graphics/drawpad/erasedrawmode.cpp b/noncore/graphics/drawpad/erasedrawmode.cpp
deleted file mode 100644
index 0e585cc..0000000
--- a/noncore/graphics/drawpad/erasedrawmode.cpp
+++ b/dev/null
@@ -1,74 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "erasedrawmode.h"
-
-#include "drawpad.h"
-#include "drawpadcanvas.h"
-
-#include <qpainter.h>
-#include <qpixmap.h>
-
-EraseDrawMode::EraseDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
- : DrawMode(drawPad, drawPadCanvas)
-{
- m_mousePressed = false;
- m_polyline.resize(3);
-}
-
-EraseDrawMode::~EraseDrawMode()
-{
-}
-
-void EraseDrawMode::mousePressEvent(QMouseEvent* e)
-{
- m_mousePressed = true;
- m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos();
-}
-
-void EraseDrawMode::mouseReleaseEvent(QMouseEvent* e)
-{
- Q_UNUSED(e)
-
- m_mousePressed = false;
-}
-
-void EraseDrawMode::mouseMoveEvent(QMouseEvent* e)
-{
- if (m_mousePressed) {
- QPainter painter;
- QPen pen(Qt::white, m_pDrawPad->pen().width());
- painter.begin(m_pDrawPadCanvas->currentPage());
- painter.setPen(pen);
- m_polyline[2] = m_polyline[1];
- m_polyline[1] = m_polyline[0];
- m_polyline[0] = e->pos();
- painter.drawPolyline(m_polyline);
- painter.end();
-
- QRect r = m_polyline.boundingRect();
- r = r.normalize();
- r.setLeft(r.left() - m_pDrawPad->pen().width());
- r.setTop(r.top() - m_pDrawPad->pen().width());
- r.setRight(r.right() + m_pDrawPad->pen().width());
- r.setBottom(r.bottom() + m_pDrawPad->pen().width());
-
- QRect viewportRect(m_pDrawPadCanvas->contentsToViewport(r.topLeft()),
- m_pDrawPadCanvas->contentsToViewport(r.bottomRight()));
-
- bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(),
- m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height());
-
- m_pDrawPadCanvas->viewport()->update(viewportRect);
- }
-}
diff --git a/noncore/graphics/drawpad/erasedrawmode.h b/noncore/graphics/drawpad/erasedrawmode.h
deleted file mode 100644
index c64b010..0000000
--- a/noncore/graphics/drawpad/erasedrawmode.h
+++ b/dev/null
@@ -1,36 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef ERASEDRAWMODE_H
-#define ERASEPOINTDRAWMODE_H
-
-#include "drawmode.h"
-
-#include <qpointarray.h>
-
-class EraseDrawMode : public DrawMode
-{
-public:
- EraseDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
- ~EraseDrawMode();
-
- void mousePressEvent(QMouseEvent* e);
- void mouseReleaseEvent(QMouseEvent* e);
- void mouseMoveEvent(QMouseEvent* e);
-
-private:
- bool m_mousePressed;
- QPointArray m_polyline;
-};
-
-#endif // ERASEDRAWMODE_H
diff --git a/noncore/graphics/drawpad/filldrawmode.cpp b/noncore/graphics/drawpad/filldrawmode.cpp
deleted file mode 100644
index 6ae0e58..0000000
--- a/noncore/graphics/drawpad/filldrawmode.cpp
+++ b/dev/null
@@ -1,88 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "filldrawmode.h"
-
-#include "drawpad.h"
-#include "drawpadcanvas.h"
-
-#include <qimage.h>
-#include <qpixmap.h>
-
-FillDrawMode::FillDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
- : DrawMode(drawPad, drawPadCanvas)
-{
-}
-
-FillDrawMode::~FillDrawMode()
-{
-}
-
-void FillDrawMode::mousePressEvent(QMouseEvent* e)
-{
- int x = e->x();
- int y = e->y();
-
- m_image = m_pDrawPadCanvas->currentPage()->convertToImage();
- m_fillRgb = m_pDrawPad->brush().color().rgb();
- m_oldRgb = m_image.pixel(x, y);
-
- if (m_oldRgb != m_fillRgb) {
- fillLine(x, y);
-
- m_pDrawPadCanvas->currentPage()->convertFromImage(m_image);
- m_pDrawPadCanvas->viewport()->update();
- }
-}
-
-void FillDrawMode::mouseReleaseEvent(QMouseEvent* e)
-{
- Q_UNUSED(e)
-}
-
-void FillDrawMode::mouseMoveEvent(QMouseEvent* e)
-{
- Q_UNUSED(e)
-}
-
-void FillDrawMode::fillLine(int x, int y)
-{
- if ((x >= 0) && (x < m_image.width()) && (y >= 0) && (y < m_image.height())) {
- if (m_image.pixel(x, y) == m_oldRgb) {
- int x1, x2;
-
- x1 = x - 1;
- x2 = x + 1;
-
- while ((x1 >= 0) && (m_image.pixel(x1, y) == m_oldRgb)) {
- x1--;
- }
-
- while ((x2 < m_image.width()) && (m_image.pixel(x2, y) == m_oldRgb)) {
- x2++;
- }
-
- for (int i = x1 + 1; i < x2; i++) {
- m_image.setPixel(i, y, m_fillRgb);
- }
-
- for (int i = x1 + 1; i < x2; i++) {
- fillLine(i, y - 1);
- }
-
- for (int i = x1 + 1; i < x2; i++) {
- fillLine(i, y + 1);
- }
- }
- }
-}
diff --git a/noncore/graphics/drawpad/filldrawmode.h b/noncore/graphics/drawpad/filldrawmode.h
deleted file mode 100644
index 604f9c7..0000000
--- a/noncore/graphics/drawpad/filldrawmode.h
+++ b/dev/null
@@ -1,39 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef FILLDRAWMODE_H
-#define FILLDRAWMODE_H
-
-#include "drawmode.h"
-
-#include <qimage.h>
-
-class FillDrawMode : public DrawMode
-{
-public:
- FillDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
- ~FillDrawMode();
-
- void mousePressEvent(QMouseEvent* e);
- void mouseReleaseEvent(QMouseEvent* e);
- void mouseMoveEvent(QMouseEvent* e);
-
-private:
- void fillLine(int x, int y);
-
- QImage m_image;
- QRgb m_fillRgb;
- QRgb m_oldRgb;
-};
-
-#endif // FILLDRAWMODE_H
diff --git a/noncore/graphics/drawpad/linedrawmode.cpp b/noncore/graphics/drawpad/linedrawmode.cpp
deleted file mode 100644
index d432fad..0000000
--- a/noncore/graphics/drawpad/linedrawmode.cpp
+++ b/dev/null
@@ -1,39 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "linedrawmode.h"
-
-#include "drawpad.h"
-#include "drawpadcanvas.h"
-
-LineDrawMode::LineDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
- : ShapeDrawMode(drawPad, drawPadCanvas)
-{
-}
-
-LineDrawMode::~LineDrawMode()
-{
-}
-
-void LineDrawMode::drawFinalShape(QPainter& p)
-{
- p.setPen(m_pDrawPad->pen());
- p.drawLine(m_polyline[2], m_polyline[0]);
-}
-
-void LineDrawMode::drawTemporaryShape(QPainter& p)
-{
- p.setRasterOp(Qt::NotROP);
- p.drawLine(m_polyline[2], m_polyline[1]);
- p.drawLine(m_polyline[2], m_polyline[0]);
-}
diff --git a/noncore/graphics/drawpad/linedrawmode.h b/noncore/graphics/drawpad/linedrawmode.h
deleted file mode 100644
index 0ddd0ad..0000000
--- a/noncore/graphics/drawpad/linedrawmode.h
+++ b/dev/null
@@ -1,30 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef LINEDRAWMODE_H
-#define LINEDRAWMODE_H
-
-#include "shapedrawmode.h"
-
-class LineDrawMode : public ShapeDrawMode
-{
-public:
- LineDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
- ~LineDrawMode();
-
-protected:
- void drawFinalShape(QPainter& p);
- void drawTemporaryShape(QPainter& p);
-};
-
-#endif // LINEDRAWMODE_H
diff --git a/noncore/graphics/drawpad/pointdrawmode.cpp b/noncore/graphics/drawpad/pointdrawmode.cpp
deleted file mode 100644
index e251f1b..0000000
--- a/noncore/graphics/drawpad/pointdrawmode.cpp
+++ b/dev/null
@@ -1,73 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "pointdrawmode.h"
-
-#include "drawpad.h"
-#include "drawpadcanvas.h"
-
-#include <qpainter.h>
-#include <qpixmap.h>
-
-PointDrawMode::PointDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
- : DrawMode(drawPad, drawPadCanvas)
-{
- m_mousePressed = false;
- m_polyline.resize(3);
-}
-
-PointDrawMode::~PointDrawMode()
-{
-}
-
-void PointDrawMode::mousePressEvent(QMouseEvent* e)
-{
- m_mousePressed = true;
- m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos();
-}
-
-void PointDrawMode::mouseReleaseEvent(QMouseEvent* e)
-{
- Q_UNUSED(e)
-
- m_mousePressed = false;
-}
-
-void PointDrawMode::mouseMoveEvent(QMouseEvent* e)
-{
- if (m_mousePressed) {
- QPainter painter;
- painter.begin(m_pDrawPadCanvas->currentPage());
- painter.setPen(m_pDrawPad->pen());
- m_polyline[2] = m_polyline[1];
- m_polyline[1] = m_polyline[0];
- m_polyline[0] = e->pos();
- painter.drawPolyline(m_polyline);
- painter.end();
-
- QRect r = m_polyline.boundingRect();
- r = r.normalize();
- r.setLeft(r.left() - m_pDrawPad->pen().width());
- r.setTop(r.top() - m_pDrawPad->pen().width());
- r.setRight(r.right() + m_pDrawPad->pen().width());
- r.setBottom(r.bottom() + m_pDrawPad->pen().width());
-
- QRect viewportRect(m_pDrawPadCanvas->contentsToViewport(r.topLeft()),
- m_pDrawPadCanvas->contentsToViewport(r.bottomRight()));
-
- bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(),
- m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height());
-
- m_pDrawPadCanvas->viewport()->update(viewportRect);
- }
-}
diff --git a/noncore/graphics/drawpad/pointdrawmode.h b/noncore/graphics/drawpad/pointdrawmode.h
deleted file mode 100644
index 78da31f..0000000
--- a/noncore/graphics/drawpad/pointdrawmode.h
+++ b/dev/null
@@ -1,36 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef POINTDRAWMODE_H
-#define POINTDRAWMODE_H
-
-#include "drawmode.h"
-
-#include <qpointarray.h>
-
-class PointDrawMode : public DrawMode
-{
-public:
- PointDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
- ~PointDrawMode();
-
- void mousePressEvent(QMouseEvent* e);
- void mouseReleaseEvent(QMouseEvent* e);
- void mouseMoveEvent(QMouseEvent* e);
-
-private:
- bool m_mousePressed;
- QPointArray m_polyline;
-};
-
-#endif // POINTDRAWMODE_H
diff --git a/noncore/graphics/drawpad/rectangledrawmode.cpp b/noncore/graphics/drawpad/rectangledrawmode.cpp
deleted file mode 100644
index 0226544..0000000
--- a/noncore/graphics/drawpad/rectangledrawmode.cpp
+++ b/dev/null
@@ -1,39 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "rectangledrawmode.h"
-
-#include "drawpad.h"
-#include "drawpadcanvas.h"
-
-RectangleDrawMode::RectangleDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
- : ShapeDrawMode(drawPad, drawPadCanvas)
-{
-}
-
-RectangleDrawMode::~RectangleDrawMode()
-{
-}
-
-void RectangleDrawMode::drawFinalShape(QPainter& p)
-{
- p.setPen(m_pDrawPad->pen());
- p.drawRect(QRect(m_polyline[2], m_polyline[0]));
-}
-
-void RectangleDrawMode::drawTemporaryShape(QPainter& p)
-{
- p.setRasterOp(Qt::NotROP);
- p.drawRect(QRect(m_polyline[2], m_polyline[1]));
- p.drawRect(QRect(m_polyline[2], m_polyline[0]));
-}
diff --git a/noncore/graphics/drawpad/rectangledrawmode.h b/noncore/graphics/drawpad/rectangledrawmode.h
deleted file mode 100644
index 186533d..0000000
--- a/noncore/graphics/drawpad/rectangledrawmode.h
+++ b/dev/null
@@ -1,30 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef RECTANGLEDRAWMODE_H
-#define RECTANGLEDRAWMODE_H
-
-#include "shapedrawmode.h"
-
-class RectangleDrawMode : public ShapeDrawMode
-{
-public:
- RectangleDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
- ~RectangleDrawMode();
-
-protected:
- void drawFinalShape(QPainter& p);
- void drawTemporaryShape(QPainter& p);
-};
-
-#endif // RECTANGLEDRAWMODE_H
diff --git a/noncore/graphics/drawpad/shapedrawmode.cpp b/noncore/graphics/drawpad/shapedrawmode.cpp
deleted file mode 100644
index 8b9877d..0000000
--- a/noncore/graphics/drawpad/shapedrawmode.cpp
+++ b/dev/null
@@ -1,92 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "shapedrawmode.h"
-
-#include "drawpad.h"
-#include "drawpadcanvas.h"
-
-#include <qpainter.h>
-#include <qpixmap.h>
-
-ShapeDrawMode::ShapeDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
- : DrawMode(drawPad, drawPadCanvas)
-{
- m_mousePressed = false;
- m_polyline.resize(3);
-}
-
-ShapeDrawMode::~ShapeDrawMode()
-{
-}
-
-void ShapeDrawMode::mousePressEvent(QMouseEvent* e)
-{
- m_mousePressed = true;
- m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos();
-}
-
-void ShapeDrawMode::mouseReleaseEvent(QMouseEvent* e)
-{
- Q_UNUSED(e)
-
- QPainter painter;
- painter.begin(m_pDrawPadCanvas->currentPage());
- drawFinalShape(painter);
- painter.end();
-
- QRect r = m_polyline.boundingRect();
- r = r.normalize();
- r.setLeft(r.left() - m_pDrawPad->pen().width());
- r.setTop(r.top() - m_pDrawPad->pen().width());
- r.setRight(r.right() + m_pDrawPad->pen().width());
- r.setBottom(r.bottom() + m_pDrawPad->pen().width());
-
- QRect viewportRect(m_pDrawPadCanvas->contentsToViewport(r.topLeft()),
- m_pDrawPadCanvas->contentsToViewport(r.bottomRight()));
-
- bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(),
- m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height());
-
- m_pDrawPadCanvas->viewport()->update(viewportRect);
-
- m_mousePressed = false;
-}
-
-void ShapeDrawMode::mouseMoveEvent(QMouseEvent* e)
-{
- if (m_mousePressed) {
- m_polyline[0] = e->pos();
- QPainter painter;
- painter.begin(m_pDrawPadCanvas->currentPage());
- drawTemporaryShape(painter);
- painter.end();
-
- QRect r = m_polyline.boundingRect();
- r = r.normalize();
- r.setLeft(r.left() - m_pDrawPad->pen().width());
- r.setTop(r.top() - m_pDrawPad->pen().width());
- r.setRight(r.right() + m_pDrawPad->pen().width());
- r.setBottom(r.bottom() + m_pDrawPad->pen().width());
-
- QRect viewportRect(m_pDrawPadCanvas->contentsToViewport(r.topLeft()),
- m_pDrawPadCanvas->contentsToViewport(r.bottomRight()));
-
- bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(),
- m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height());
-
- m_pDrawPadCanvas->viewport()->update(viewportRect);
-
- m_polyline[1] = m_polyline[0];
- }
-}
diff --git a/noncore/graphics/drawpad/shapedrawmode.h b/noncore/graphics/drawpad/shapedrawmode.h
deleted file mode 100644
index 292478f..0000000
--- a/noncore/graphics/drawpad/shapedrawmode.h
+++ b/dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************
- * *
- * DrawPad - a drawing program for Opie Environment *
- * *
- * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef SHAPEDRAWMODE_H
-#define SHAPEDRAWMODE_H
-
-#include "drawmode.h"
-
-#include <qpointarray.h>
-
-class ShapeDrawMode : public DrawMode
-{
-public:
- ShapeDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas);
- ~ShapeDrawMode();
-
- void mousePressEvent(QMouseEvent* e);
- void mouseReleaseEvent(QMouseEvent* e);
- void mouseMoveEvent(QMouseEvent* e);
-
-protected:
- virtual void drawFinalShape(QPainter& p) = 0;
- virtual void drawTemporaryShape(QPainter& p) = 0;
-
- QPointArray m_polyline;
-
-private:
- bool m_mousePressed;
-};
-
-#endif // SHAPEDRAWMODE_H