author | leseb <leseb> | 2002-03-27 17:17:06 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-03-27 17:17:06 (UTC) |
commit | 7578abbb11ce2dbae3c54ab7051ad2b39d31360b (patch) (side-by-side diff) | |
tree | d87912e163039608f6c1c2dfcdab2f99010df118 /noncore/graphics/drawpad/shapedrawmode.cpp | |
parent | 4372bb8e59eb4b0d2fa5fba8f6525dc14873f239 (diff) | |
download | opie-7578abbb11ce2dbae3c54ab7051ad2b39d31360b.zip opie-7578abbb11ce2dbae3c54ab7051ad2b39d31360b.tar.gz opie-7578abbb11ce2dbae3c54ab7051ad2b39d31360b.tar.bz2 |
Rename drawmode -> tool
Diffstat (limited to 'noncore/graphics/drawpad/shapedrawmode.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/shapedrawmode.cpp | 92 |
1 files changed, 0 insertions, 92 deletions
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]; - } -} |