author | leseb <leseb> | 2002-03-21 17:33:38 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-03-21 17:33:38 (UTC) |
commit | 29baf8dcda3d05d91d340b739de0fdd9e37f5749 (patch) (side-by-side diff) | |
tree | 5f2958a16cc1f065cdef3e31c2c9500f8aac2e7b /noncore/graphics/drawpad/ellipsedrawmode.cpp | |
parent | 60c9126183ea72c08ad5cb77b8939812627aae17 (diff) | |
download | opie-29baf8dcda3d05d91d340b739de0fdd9e37f5749.zip opie-29baf8dcda3d05d91d340b739de0fdd9e37f5749.tar.gz opie-29baf8dcda3d05d91d340b739de0fdd9e37f5749.tar.bz2 |
Enable any size pages
Diffstat (limited to 'noncore/graphics/drawpad/ellipsedrawmode.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/ellipsedrawmode.cpp | 63 |
1 files changed, 11 insertions, 52 deletions
diff --git a/noncore/graphics/drawpad/ellipsedrawmode.cpp b/noncore/graphics/drawpad/ellipsedrawmode.cpp index 12a1113..f9cfa73 100644 --- a/noncore/graphics/drawpad/ellipsedrawmode.cpp +++ b/noncore/graphics/drawpad/ellipsedrawmode.cpp @@ -20,67 +20,26 @@ #include <qpixmap.h> EllipseDrawMode::EllipseDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) - : DrawMode(drawPad, drawPadCanvas) + : ShapeDrawMode(drawPad, drawPadCanvas) { - m_mousePressed = false; - m_polyline.resize(3); } EllipseDrawMode::~EllipseDrawMode() { } -void EllipseDrawMode::mousePressEvent(QMouseEvent* e) +void EllipseDrawMode::drawFinalShape(QPainter& p) { - m_mousePressed = true; - m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); + 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::mouseReleaseEvent(QMouseEvent* e) +void EllipseDrawMode::drawTemporaryShape(QPainter& p) { - Q_UNUSED(e) - - QPainter painter; - painter.begin(m_pDrawPadCanvas->currentPage()); - painter.setRasterOp(Qt::NotROP); - painter.drawRect(QRect(m_polyline[2], m_polyline[0])); - painter.setPen(m_pDrawPad->pen()); - painter.setRasterOp(Qt::CopyROP); - painter.drawEllipse(QRect(m_polyline[2], m_polyline[0])); - 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()); - - bitBlt(m_pDrawPadCanvas, r.x(), r.y(), m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); - - m_mousePressed = false; -} - -void EllipseDrawMode::mouseMoveEvent(QMouseEvent* e) -{ - if (m_mousePressed) { - QPainter painter; - painter.begin(m_pDrawPadCanvas->currentPage()); - painter.setRasterOp(Qt::NotROP); - m_polyline[0] = e->pos(); - painter.drawRect(QRect(m_polyline[2], m_polyline[1])); - painter.drawRect(QRect(m_polyline[2], m_polyline[0])); - 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()); - - bitBlt(m_pDrawPadCanvas, r.x(), r.y(), m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); - - m_polyline[1] = m_polyline[0]; - } + p.setRasterOp(Qt::NotROP); + p.drawRect(QRect(m_polyline[2], m_polyline[1])); + p.drawRect(QRect(m_polyline[2], m_polyline[0])); } |