author | leseb <leseb> | 2002-03-21 17:33:38 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-03-21 17:33:38 (UTC) |
commit | 29baf8dcda3d05d91d340b739de0fdd9e37f5749 (patch) (unidiff) | |
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) (ignore 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 @@ | |||
20 | #include <qpixmap.h> | 20 | #include <qpixmap.h> |
21 | 21 | ||
22 | EllipseDrawMode::EllipseDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) | 22 | EllipseDrawMode::EllipseDrawMode(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) |
23 | : DrawMode(drawPad, drawPadCanvas) | 23 | : ShapeDrawMode(drawPad, drawPadCanvas) |
24 | { | 24 | { |
25 | m_mousePressed = false; | ||
26 | m_polyline.resize(3); | ||
27 | } | 25 | } |
28 | 26 | ||
29 | EllipseDrawMode::~EllipseDrawMode() | 27 | EllipseDrawMode::~EllipseDrawMode() |
30 | { | 28 | { |
31 | } | 29 | } |
32 | 30 | ||
33 | void EllipseDrawMode::mousePressEvent(QMouseEvent* e) | 31 | void EllipseDrawMode::drawFinalShape(QPainter& p) |
34 | { | 32 | { |
35 | m_mousePressed = true; | 33 | p.setRasterOp(Qt::NotROP); |
36 | m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); | 34 | p.drawRect(QRect(m_polyline[2], m_polyline[0])); |
35 | p.setPen(m_pDrawPad->pen()); | ||
36 | p.setRasterOp(Qt::CopyROP); | ||
37 | p.drawEllipse(QRect(m_polyline[2], m_polyline[0])); | ||
37 | } | 38 | } |
38 | 39 | ||
39 | void EllipseDrawMode::mouseReleaseEvent(QMouseEvent* e) | 40 | void EllipseDrawMode::drawTemporaryShape(QPainter& p) |
40 | { | 41 | { |
41 | Q_UNUSED(e) | 42 | p.setRasterOp(Qt::NotROP); |
42 | 43 | p.drawRect(QRect(m_polyline[2], m_polyline[1])); | |
43 | QPainter painter; | 44 | p.drawRect(QRect(m_polyline[2], m_polyline[0])); |
44 | painter.begin(m_pDrawPadCanvas->currentPage()); | ||
45 | painter.setRasterOp(Qt::NotROP); | ||
46 | painter.drawRect(QRect(m_polyline[2], m_polyline[0])); | ||
47 | painter.setPen(m_pDrawPad->pen()); | ||
48 | painter.setRasterOp(Qt::CopyROP); | ||
49 | painter.drawEllipse(QRect(m_polyline[2], m_polyline[0])); | ||
50 | painter.end(); | ||
51 | |||
52 | QRect r = m_polyline.boundingRect(); | ||
53 | r = r.normalize(); | ||
54 | r.setLeft(r.left() - m_pDrawPad->pen().width()); | ||
55 | r.setTop(r.top() - m_pDrawPad->pen().width()); | ||
56 | r.setRight(r.right() + m_pDrawPad->pen().width()); | ||
57 | r.setBottom(r.bottom() + m_pDrawPad->pen().width()); | ||
58 | |||
59 | bitBlt(m_pDrawPadCanvas, r.x(), r.y(), m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); | ||
60 | |||
61 | m_mousePressed = false; | ||
62 | } | ||
63 | |||
64 | void EllipseDrawMode::mouseMoveEvent(QMouseEvent* e) | ||
65 | { | ||
66 | if (m_mousePressed) { | ||
67 | QPainter painter; | ||
68 | painter.begin(m_pDrawPadCanvas->currentPage()); | ||
69 | painter.setRasterOp(Qt::NotROP); | ||
70 | m_polyline[0] = e->pos(); | ||
71 | painter.drawRect(QRect(m_polyline[2], m_polyline[1])); | ||
72 | painter.drawRect(QRect(m_polyline[2], m_polyline[0])); | ||
73 | painter.end(); | ||
74 | |||
75 | QRect r = m_polyline.boundingRect(); | ||
76 | r = r.normalize(); | ||
77 | r.setLeft(r.left() - m_pDrawPad->pen().width()); | ||
78 | r.setTop(r.top() - m_pDrawPad->pen().width()); | ||
79 | r.setRight(r.right() + m_pDrawPad->pen().width()); | ||
80 | r.setBottom(r.bottom() + m_pDrawPad->pen().width()); | ||
81 | |||
82 | bitBlt(m_pDrawPadCanvas, r.x(), r.y(), m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); | ||
83 | |||
84 | m_polyline[1] = m_polyline[0]; | ||
85 | } | ||
86 | } | 45 | } |