summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-10 21:45:06 (UTC)
committer harlekin <harlekin>2003-12-10 21:45:06 (UTC)
commit7c21195c1dde6cc91c41e5b15ef5acce568a2f54 (patch) (unidiff)
tree83914e1119fa662dc7a4d37e72624118c62aecaf
parentc80a4d0e0b0ed83757d8494e7f32c8b4b0b6e8d0 (diff)
downloadopie-7c21195c1dde6cc91c41e5b15ef5acce568a2f54.zip
opie-7c21195c1dde6cc91c41e5b15ef5acce568a2f54.tar.gz
opie-7c21195c1dde6cc91c41e5b15ef5acce568a2f54.tar.bz2
reduce includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp1
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp2
-rw-r--r--noncore/graphics/drawpad/ellipsetool.cpp1
-rw-r--r--noncore/graphics/drawpad/erasetool.cpp1
-rw-r--r--noncore/graphics/drawpad/exportdialog.cpp1
-rw-r--r--noncore/graphics/drawpad/filledellipsetool.cpp1
-rw-r--r--noncore/graphics/drawpad/filltool.cpp1
-rw-r--r--noncore/graphics/drawpad/importdialog.cpp1
-rw-r--r--noncore/graphics/drawpad/linetool.cpp1
-rw-r--r--noncore/graphics/drawpad/main.cpp1
-rw-r--r--noncore/graphics/drawpad/newpagedialog.cpp1
-rw-r--r--noncore/graphics/drawpad/pointtool.cpp1
-rw-r--r--noncore/graphics/drawpad/shapetool.cpp1
-rw-r--r--noncore/graphics/drawpad/texttool.cpp1
-rw-r--r--noncore/graphics/drawpad/thumbnailview.cpp1
-rw-r--r--noncore/graphics/drawpad/tool.cpp2
16 files changed, 0 insertions, 18 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index 86a10a5..71c9695 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -14,65 +14,64 @@
14#include "drawpad.h" 14#include "drawpad.h"
15 15
16#include "drawpadcanvas.h" 16#include "drawpadcanvas.h"
17#include "ellipsetool.h" 17#include "ellipsetool.h"
18#include "erasetool.h" 18#include "erasetool.h"
19#include "exportdialog.h" 19#include "exportdialog.h"
20#include "filledellipsetool.h" 20#include "filledellipsetool.h"
21#include "filledrectangletool.h" 21#include "filledrectangletool.h"
22#include "filltool.h" 22#include "filltool.h"
23#include "importdialog.h" 23#include "importdialog.h"
24#include "linetool.h" 24#include "linetool.h"
25#include "newpagedialog.h" 25#include "newpagedialog.h"
26#include "page.h" 26#include "page.h"
27#include "pageinformationdialog.h" 27#include "pageinformationdialog.h"
28#include "pointtool.h" 28#include "pointtool.h"
29#include "rectangletool.h" 29#include "rectangletool.h"
30#include "texttool.h" 30#include "texttool.h"
31#include "thumbnailview.h" 31#include "thumbnailview.h"
32 32
33#include <opie/colordialog.h> 33#include <opie/colordialog.h>
34#include <opie/colorpopupmenu.h> 34#include <opie/colorpopupmenu.h>
35 35
36#include <qpe/applnk.h> 36#include <qpe/applnk.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qmenubar.h> 39#include <qmenubar.h>
40#include <qpe/qpetoolbar.h> 40#include <qpe/qpetoolbar.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42 42
43#include <qaction.h> 43#include <qaction.h>
44#include <qfile.h> 44#include <qfile.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qpainter.h>
47#include <qspinbox.h> 46#include <qspinbox.h>
48#include <qtoolbutton.h> 47#include <qtoolbutton.h>
49#include <qtooltip.h> 48#include <qtooltip.h>
50#include <qwhatsthis.h> 49#include <qwhatsthis.h>
51 50
52DrawPad::DrawPad(QWidget* parent, const char* name, WFlags fl ) 51DrawPad::DrawPad(QWidget* parent, const char* name, WFlags fl )
53 : QMainWindow(parent, name, WStyle_ContextHelp) 52 : QMainWindow(parent, name, WStyle_ContextHelp)
54{ 53{
55 // init members 54 // init members
56 55
57 m_pDrawPadCanvas = new DrawPadCanvas(this, this); 56 m_pDrawPadCanvas = new DrawPadCanvas(this, this);
58 57
59 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); 58 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));
60 59
61 setCentralWidget(m_pDrawPadCanvas); 60 setCentralWidget(m_pDrawPadCanvas);
62 61
63 // init menu 62 // init menu
64 63
65 setToolBarsMovable(false); 64 setToolBarsMovable(false);
66 65
67 QToolBar* menuToolBar = new QToolBar(this); 66 QToolBar* menuToolBar = new QToolBar(this);
68 QMenuBar* menuBar = new QMenuBar(menuToolBar); 67 QMenuBar* menuBar = new QMenuBar(menuToolBar);
69 68
70 QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); 69 QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar);
71 70
72 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); 71 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
73 connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); 72 connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll()));
74 deleteAllAction->addTo(toolsPopupMenu); 73 deleteAllAction->addTo(toolsPopupMenu);
75 74
76 toolsPopupMenu->insertSeparator(); 75 toolsPopupMenu->insertSeparator();
77 76
78 QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); 77 QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this);
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index dec498b..446096c 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -1,60 +1,58 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "drawpadcanvas.h" 14#include "drawpadcanvas.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "page.h" 17#include "page.h"
18#include "tool.h" 18#include "tool.h"
19 19
20#include <qpe/applnk.h> 20#include <qpe/applnk.h>
21#include <qpe/filemanager.h> 21#include <qpe/filemanager.h>
22#include <qpe/mimetype.h> 22#include <qpe/mimetype.h>
23 23
24#include <qbuffer.h> 24#include <qbuffer.h>
25#include <qimage.h> 25#include <qimage.h>
26#include <qpainter.h>
27#include <qtextcodec.h> 26#include <qtextcodec.h>
28#include <qtextstream.h>
29#include <qxml.h> 27#include <qxml.h>
30 28
31class DrawPadCanvasXmlHandler: public QXmlDefaultHandler 29class DrawPadCanvasXmlHandler: public QXmlDefaultHandler
32{ 30{
33public: 31public:
34 DrawPadCanvasXmlHandler(); 32 DrawPadCanvasXmlHandler();
35 ~DrawPadCanvasXmlHandler(); 33 ~DrawPadCanvasXmlHandler();
36 34
37 QList<Page> pages(); 35 QList<Page> pages();
38 36
39 bool startElement(const QString& namespaceURI, const QString& localName, 37 bool startElement(const QString& namespaceURI, const QString& localName,
40 const QString& qName, const QXmlAttributes& atts); 38 const QString& qName, const QXmlAttributes& atts);
41 bool endElement(const QString& namespaceURI, const QString& localName, 39 bool endElement(const QString& namespaceURI, const QString& localName,
42 const QString& qName); 40 const QString& qName);
43 bool characters(const QString& ch); 41 bool characters(const QString& ch);
44 42
45private: 43private:
46 enum State { 44 enum State {
47 Unknown, 45 Unknown,
48 InTitle, 46 InTitle,
49 InDate, 47 InDate,
50 InData 48 InData
51 }; 49 };
52 50
53 State m_state; 51 State m_state;
54 QString m_title; 52 QString m_title;
55 QDateTime m_date; 53 QDateTime m_date;
56 ulong m_dataLenght; 54 ulong m_dataLenght;
57 QString m_dataFormat; 55 QString m_dataFormat;
58 QList<Page> m_pages; 56 QList<Page> m_pages;
59}; 57};
60 58
diff --git a/noncore/graphics/drawpad/ellipsetool.cpp b/noncore/graphics/drawpad/ellipsetool.cpp
index 0cdb731..2173c97 100644
--- a/noncore/graphics/drawpad/ellipsetool.cpp
+++ b/noncore/graphics/drawpad/ellipsetool.cpp
@@ -1,52 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "ellipsetool.h" 14#include "ellipsetool.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18 18
19#include <qimage.h> 19#include <qimage.h>
20#include <qpixmap.h>
21 20
22EllipseTool::EllipseTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 21EllipseTool::EllipseTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
23 : ShapeTool(drawPad, drawPadCanvas) 22 : ShapeTool(drawPad, drawPadCanvas)
24{ 23{
25} 24}
26 25
27EllipseTool::~EllipseTool() 26EllipseTool::~EllipseTool()
28{ 27{
29} 28}
30 29
31void EllipseTool::drawFinalShape(QPainter& p) 30void EllipseTool::drawFinalShape(QPainter& p)
32{ 31{
33 p.setRasterOp(Qt::NotROP); 32 p.setRasterOp(Qt::NotROP);
34 p.drawRect(QRect(m_polyline[2], m_polyline[0])); 33 p.drawRect(QRect(m_polyline[2], m_polyline[0]));
35 p.setRasterOp(Qt::CopyROP); 34 p.setRasterOp(Qt::CopyROP);
36 35
37 if (m_pDrawPad->antiAliasing()) { 36 if (m_pDrawPad->antiAliasing()) {
38 QRect r = m_polyline.boundingRect(); 37 QRect r = m_polyline.boundingRect();
39 r = r.normalize(); 38 r = r.normalize();
40 r.setLeft(r.left() - m_pDrawPad->pen().width()); 39 r.setLeft(r.left() - m_pDrawPad->pen().width());
41 r.setTop(r.top() - m_pDrawPad->pen().width()); 40 r.setTop(r.top() - m_pDrawPad->pen().width());
42 r.setRight(r.right() + m_pDrawPad->pen().width()); 41 r.setRight(r.right() + m_pDrawPad->pen().width());
43 r.setBottom(r.bottom() + m_pDrawPad->pen().width()); 42 r.setBottom(r.bottom() + m_pDrawPad->pen().width());
44 43
45 QPixmap areaPixmap(r.width(), r.height()); 44 QPixmap areaPixmap(r.width(), r.height());
46 bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); 45 bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r);
47 46
48 QImage areaImage = areaPixmap.convertToImage(); 47 QImage areaImage = areaPixmap.convertToImage();
49 QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); 48 QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3);
50 49
51 QPixmap bigAreaPixmap; 50 QPixmap bigAreaPixmap;
52 bigAreaPixmap.convertFromImage(bigAreaImage); 51 bigAreaPixmap.convertFromImage(bigAreaImage);
diff --git a/noncore/graphics/drawpad/erasetool.cpp b/noncore/graphics/drawpad/erasetool.cpp
index 2326da5..5d123c4 100644
--- a/noncore/graphics/drawpad/erasetool.cpp
+++ b/noncore/graphics/drawpad/erasetool.cpp
@@ -1,52 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "erasetool.h" 14#include "erasetool.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "page.h" 18#include "page.h"
19 19
20#include <qpainter.h>
21 20
22EraseTool::EraseTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 21EraseTool::EraseTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
23 : Tool(drawPad, drawPadCanvas) 22 : Tool(drawPad, drawPadCanvas)
24{ 23{
25 m_mousePressed = false; 24 m_mousePressed = false;
26 m_polyline.resize(3); 25 m_polyline.resize(3);
27} 26}
28 27
29EraseTool::~EraseTool() 28EraseTool::~EraseTool()
30{ 29{
31} 30}
32 31
33void EraseTool::mousePressEvent(QMouseEvent* e) 32void EraseTool::mousePressEvent(QMouseEvent* e)
34{ 33{
35 m_pDrawPadCanvas->backupPage(); 34 m_pDrawPadCanvas->backupPage();
36 35
37 m_mousePressed = true; 36 m_mousePressed = true;
38 m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); 37 m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos();
39} 38}
40 39
41void EraseTool::mouseReleaseEvent(QMouseEvent* e) 40void EraseTool::mouseReleaseEvent(QMouseEvent* e)
42{ 41{
43 Q_UNUSED(e) 42 Q_UNUSED(e)
44 43
45 m_mousePressed = false; 44 m_mousePressed = false;
46} 45}
47 46
48void EraseTool::mouseMoveEvent(QMouseEvent* e) 47void EraseTool::mouseMoveEvent(QMouseEvent* e)
49{ 48{
50 if (m_mousePressed) { 49 if (m_mousePressed) {
51 QPainter painter; 50 QPainter painter;
52 QPen pen(Qt::white, m_pDrawPad->pen().width()); 51 QPen pen(Qt::white, m_pDrawPad->pen().width());
diff --git a/noncore/graphics/drawpad/exportdialog.cpp b/noncore/graphics/drawpad/exportdialog.cpp
index adbd612..d63f428 100644
--- a/noncore/graphics/drawpad/exportdialog.cpp
+++ b/noncore/graphics/drawpad/exportdialog.cpp
@@ -1,52 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "exportdialog.h" 14#include "exportdialog.h"
15 15
16#include <opie/ofileselector.h> 16#include <opie/ofileselector.h>
17 17
18#include <qbuttongroup.h> 18#include <qbuttongroup.h>
19#include <qcombobox.h> 19#include <qcombobox.h>
20#include <qgroupbox.h>
21#include <qimage.h> 20#include <qimage.h>
22#include <qlabel.h> 21#include <qlabel.h>
23#include <qlayout.h> 22#include <qlayout.h>
24#include <qlineedit.h> 23#include <qlineedit.h>
25#include <qradiobutton.h> 24#include <qradiobutton.h>
26#include <qspinbox.h> 25#include <qspinbox.h>
27 26
28#include <stdlib.h> 27#include <stdlib.h>
29 28
30ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name) 29ExportDialog::ExportDialog(uint pageAt, uint pageCount, QWidget* parent, const char* name)
31 : QDialog(parent, name, true) 30 : QDialog(parent, name, true)
32{ 31{
33 setCaption(tr("DrawPad - Export")); 32 setCaption(tr("DrawPad - Export"));
34 33
35 m_pageAt = pageAt; 34 m_pageAt = pageAt;
36 m_pageCount = pageCount; 35 m_pageCount = pageCount;
37 36
38 QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this); 37 QButtonGroup* selectionButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Page Selection"), this);
39 connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int))); 38 connect(selectionButtonGroup, SIGNAL(pressed(int)), this, SLOT(selectionChanged(int)));
40 39
41 QRadioButton* selectAllRadioButton = new QRadioButton(tr("All"), selectionButtonGroup); 40 QRadioButton* selectAllRadioButton = new QRadioButton(tr("All"), selectionButtonGroup);
42 QRadioButton* selectCurrentRadioButton = new QRadioButton(tr("Current"), selectionButtonGroup); 41 QRadioButton* selectCurrentRadioButton = new QRadioButton(tr("Current"), selectionButtonGroup);
43 QRadioButton* selectRangeRadioButton = new QRadioButton(tr("Range"), selectionButtonGroup); 42 QRadioButton* selectRangeRadioButton = new QRadioButton(tr("Range"), selectionButtonGroup);
44 43
45 QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup); 44 QLabel* toLabel = new QLabel(tr("To:"), selectionButtonGroup);
46 45
47 m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); 46 m_pFromPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup);
48 connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int))); 47 connect(m_pFromPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fromPageChanged(int)));
49 48
50 m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup); 49 m_pToPageSpinBox = new QSpinBox(1, m_pageCount, 1, selectionButtonGroup);
51 connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int))); 50 connect(m_pToPageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toPageChanged(int)));
52 51
diff --git a/noncore/graphics/drawpad/filledellipsetool.cpp b/noncore/graphics/drawpad/filledellipsetool.cpp
index 6b5bbc6..41b8571 100644
--- a/noncore/graphics/drawpad/filledellipsetool.cpp
+++ b/noncore/graphics/drawpad/filledellipsetool.cpp
@@ -1,52 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "filledellipsetool.h" 14#include "filledellipsetool.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18 18
19#include <qimage.h> 19#include <qimage.h>
20#include <qpixmap.h>
21 20
22FilledEllipseTool::FilledEllipseTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 21FilledEllipseTool::FilledEllipseTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
23 : ShapeTool(drawPad, drawPadCanvas) 22 : ShapeTool(drawPad, drawPadCanvas)
24{ 23{
25} 24}
26 25
27FilledEllipseTool::~FilledEllipseTool() 26FilledEllipseTool::~FilledEllipseTool()
28{ 27{
29} 28}
30 29
31void FilledEllipseTool::drawFinalShape(QPainter& p) 30void FilledEllipseTool::drawFinalShape(QPainter& p)
32{ 31{
33 p.setRasterOp(Qt::NotROP); 32 p.setRasterOp(Qt::NotROP);
34 p.drawRect(QRect(m_polyline[2], m_polyline[0])); 33 p.drawRect(QRect(m_polyline[2], m_polyline[0]));
35 p.setRasterOp(Qt::CopyROP); 34 p.setRasterOp(Qt::CopyROP);
36 35
37 if (m_pDrawPad->antiAliasing()) { 36 if (m_pDrawPad->antiAliasing()) {
38 QRect r = m_polyline.boundingRect(); 37 QRect r = m_polyline.boundingRect();
39 r = r.normalize(); 38 r = r.normalize();
40 r.setLeft(r.left() - m_pDrawPad->pen().width()); 39 r.setLeft(r.left() - m_pDrawPad->pen().width());
41 r.setTop(r.top() - m_pDrawPad->pen().width()); 40 r.setTop(r.top() - m_pDrawPad->pen().width());
42 r.setRight(r.right() + m_pDrawPad->pen().width()); 41 r.setRight(r.right() + m_pDrawPad->pen().width());
43 r.setBottom(r.bottom() + m_pDrawPad->pen().width()); 42 r.setBottom(r.bottom() + m_pDrawPad->pen().width());
44 43
45 QPixmap areaPixmap(r.width(), r.height()); 44 QPixmap areaPixmap(r.width(), r.height());
46 bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); 45 bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r);
47 46
48 QImage areaImage = areaPixmap.convertToImage(); 47 QImage areaImage = areaPixmap.convertToImage();
49 QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); 48 QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3);
50 49
51 QPixmap bigAreaPixmap; 50 QPixmap bigAreaPixmap;
52 bigAreaPixmap.convertFromImage(bigAreaImage); 51 bigAreaPixmap.convertFromImage(bigAreaImage);
diff --git a/noncore/graphics/drawpad/filltool.cpp b/noncore/graphics/drawpad/filltool.cpp
index b47aa60..fedf3a5 100644
--- a/noncore/graphics/drawpad/filltool.cpp
+++ b/noncore/graphics/drawpad/filltool.cpp
@@ -1,52 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "filltool.h" 14#include "filltool.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "page.h" 18#include "page.h"
19 19
20#include <qimage.h>
21 20
22const int FILL_THRESHOLD = 65536; 21const int FILL_THRESHOLD = 65536;
23 22
24FillTool::FillTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 23FillTool::FillTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
25 : Tool(drawPad, drawPadCanvas) 24 : Tool(drawPad, drawPadCanvas)
26{ 25{
27} 26}
28 27
29FillTool::~FillTool() 28FillTool::~FillTool()
30{ 29{
31} 30}
32 31
33void FillTool::mousePressEvent(QMouseEvent* e) 32void FillTool::mousePressEvent(QMouseEvent* e)
34{ 33{
35 int x = e->x(); 34 int x = e->x();
36 int y = e->y(); 35 int y = e->y();
37 36
38 m_image = m_pDrawPadCanvas->currentPage()->pixmap()->convertToImage(); 37 m_image = m_pDrawPadCanvas->currentPage()->pixmap()->convertToImage();
39 38
40 if (m_image.depth() <= 8) { 39 if (m_image.depth() <= 8) {
41 m_image = m_image.convertDepth(32); 40 m_image = m_image.convertDepth(32);
42 } 41 }
43 42
44 m_fillRgb = m_pDrawPad->brush().color().rgb(); 43 m_fillRgb = m_pDrawPad->brush().color().rgb();
45 m_oldRgb = m_image.pixel(x, y); 44 m_oldRgb = m_image.pixel(x, y);
46 45
47 if (m_oldRgb != m_fillRgb) { 46 if (m_oldRgb != m_fillRgb) {
48 m_pDrawPadCanvas->backupPage(); 47 m_pDrawPadCanvas->backupPage();
49 48
50 if (m_pDrawPad->antiAliasing()) { 49 if (m_pDrawPad->antiAliasing()) {
51 m_mask.create(m_image.width(), m_image.height(), 8, 2); 50 m_mask.create(m_image.width(), m_image.height(), 8, 2);
52 m_mask.fill(0); 51 m_mask.fill(0);
diff --git a/noncore/graphics/drawpad/importdialog.cpp b/noncore/graphics/drawpad/importdialog.cpp
index 9a59a20..ce2e7ee 100644
--- a/noncore/graphics/drawpad/importdialog.cpp
+++ b/noncore/graphics/drawpad/importdialog.cpp
@@ -1,48 +1,47 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "importdialog.h" 14#include "importdialog.h"
15 15
16#include <qpe/applnk.h>
17#include <opie/ofileselector.h> 16#include <opie/ofileselector.h>
18 17
19#include <qcheckbox.h> 18#include <qcheckbox.h>
20#include <qimage.h> 19#include <qimage.h>
21#include <qlabel.h> 20#include <qlabel.h>
22#include <qlayout.h> 21#include <qlayout.h>
23#include <qpushbutton.h> 22#include <qpushbutton.h>
24 23
25ImportDialog::ImportDialog(QWidget* parent, const char* name) 24ImportDialog::ImportDialog(QWidget* parent, const char* name)
26 : QDialog(parent, name, true) 25 : QDialog(parent, name, true)
27{ 26{
28 setCaption(tr("DrawPad - Import")); 27 setCaption(tr("DrawPad - Import"));
29 28
30 MimeTypes types; types.insert( tr("All images"),"image/*" ); 29 MimeTypes types; types.insert( tr("All images"),"image/*" );
31 m_pFileSelector = new OFileSelector(this, 30 m_pFileSelector = new OFileSelector(this,
32 OFileSelector::FileSelector, 31 OFileSelector::FileSelector,
33 OFileSelector::Normal, 32 OFileSelector::Normal,
34 QString::null, 33 QString::null,
35 QString::null, types ); 34 QString::null, types );
36 m_pFileSelector->setNameVisible( false ); 35 m_pFileSelector->setNameVisible( false );
37 connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged())); 36 connect(m_pFileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(fileChanged()));
38 37
39 m_pPreviewLabel = new QLabel(this); 38 m_pPreviewLabel = new QLabel(this);
40 m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); 39 m_pPreviewLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
41 m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 40 m_pPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
42 m_pPreviewLabel->setFixedSize(114, 114); 41 m_pPreviewLabel->setFixedSize(114, 114);
43 m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid); 42 m_pPreviewLabel->setBackgroundMode(QWidget::PaletteMid);
44 43
45 m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this); 44 m_pAutomaticPreviewCheckBox = new QCheckBox(tr("Automatic preview"), this);
46 m_pAutomaticPreviewCheckBox->setChecked(true); 45 m_pAutomaticPreviewCheckBox->setChecked(true);
47 46
48 QPushButton* previewPushButton = new QPushButton(tr("Preview"), this); 47 QPushButton* previewPushButton = new QPushButton(tr("Preview"), this);
diff --git a/noncore/graphics/drawpad/linetool.cpp b/noncore/graphics/drawpad/linetool.cpp
index b6baa2a..5ea068c 100644
--- a/noncore/graphics/drawpad/linetool.cpp
+++ b/noncore/graphics/drawpad/linetool.cpp
@@ -1,52 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "linetool.h" 14#include "linetool.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18 18
19#include <qimage.h> 19#include <qimage.h>
20#include <qpixmap.h>
21 20
22LineTool::LineTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 21LineTool::LineTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
23 : ShapeTool(drawPad, drawPadCanvas) 22 : ShapeTool(drawPad, drawPadCanvas)
24{ 23{
25} 24}
26 25
27LineTool::~LineTool() 26LineTool::~LineTool()
28{ 27{
29} 28}
30 29
31void LineTool::drawFinalShape(QPainter& p) 30void LineTool::drawFinalShape(QPainter& p)
32{ 31{
33 p.setRasterOp(Qt::NotROP); 32 p.setRasterOp(Qt::NotROP);
34 p.drawLine(m_polyline[2], m_polyline[0]); 33 p.drawLine(m_polyline[2], m_polyline[0]);
35 p.setRasterOp(Qt::CopyROP); 34 p.setRasterOp(Qt::CopyROP);
36 35
37 if (m_pDrawPad->antiAliasing()) { 36 if (m_pDrawPad->antiAliasing()) {
38 QRect r = m_polyline.boundingRect(); 37 QRect r = m_polyline.boundingRect();
39 r = r.normalize(); 38 r = r.normalize();
40 r.setLeft(r.left() - m_pDrawPad->pen().width()); 39 r.setLeft(r.left() - m_pDrawPad->pen().width());
41 r.setTop(r.top() - m_pDrawPad->pen().width()); 40 r.setTop(r.top() - m_pDrawPad->pen().width());
42 r.setRight(r.right() + m_pDrawPad->pen().width()); 41 r.setRight(r.right() + m_pDrawPad->pen().width());
43 r.setBottom(r.bottom() + m_pDrawPad->pen().width()); 42 r.setBottom(r.bottom() + m_pDrawPad->pen().width());
44 43
45 QPixmap areaPixmap(r.width(), r.height()); 44 QPixmap areaPixmap(r.width(), r.height());
46 bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); 45 bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r);
47 46
48 QImage areaImage = areaPixmap.convertToImage(); 47 QImage areaImage = areaPixmap.convertToImage();
49 QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); 48 QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3);
50 49
51 QPixmap bigAreaPixmap; 50 QPixmap bigAreaPixmap;
52 bigAreaPixmap.convertFromImage(bigAreaImage); 51 bigAreaPixmap.convertFromImage(bigAreaImage);
diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp
index 87bc621..c87cc0f 100644
--- a/noncore/graphics/drawpad/main.cpp
+++ b/noncore/graphics/drawpad/main.cpp
@@ -1,19 +1,18 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "drawpad.h" 14#include "drawpad.h"
15 15
16#include <qpe/qpeapplication.h>
17#include <opie/oapplicationfactory.h> 16#include <opie/oapplicationfactory.h>
18 17
19OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) 18OPIE_EXPORT_APP( OApplicationFactory<DrawPad> )
diff --git a/noncore/graphics/drawpad/newpagedialog.cpp b/noncore/graphics/drawpad/newpagedialog.cpp
index e6e7fcb..dc8999a 100644
--- a/noncore/graphics/drawpad/newpagedialog.cpp
+++ b/noncore/graphics/drawpad/newpagedialog.cpp
@@ -1,49 +1,48 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "newpagedialog.h" 14#include "newpagedialog.h"
15 15
16#include <qbuttongroup.h> 16#include <qbuttongroup.h>
17#include <qgroupbox.h>
18#include <qlabel.h> 17#include <qlabel.h>
19#include <qlayout.h> 18#include <qlayout.h>
20#include <qlineedit.h> 19#include <qlineedit.h>
21#include <qradiobutton.h> 20#include <qradiobutton.h>
22#include <qspinbox.h> 21#include <qspinbox.h>
23 22
24NewPageDialog::NewPageDialog(uint width, uint height, const QColor& penColor, 23NewPageDialog::NewPageDialog(uint width, uint height, const QColor& penColor,
25 const QColor& brushColor, QWidget* parent, const char* name) 24 const QColor& brushColor, QWidget* parent, const char* name)
26 : QDialog(parent, name, true) 25 : QDialog(parent, name, true)
27{ 26{
28 setCaption(tr("New Page")); 27 setCaption(tr("New Page"));
29 28
30 m_penColor = penColor; 29 m_penColor = penColor;
31 m_brushColor = brushColor; 30 m_brushColor = brushColor;
32 31
33 QGroupBox* generalGroupBox = new QGroupBox(0, Qt::Vertical, tr("General"), this); 32 QGroupBox* generalGroupBox = new QGroupBox(0, Qt::Vertical, tr("General"), this);
34 33
35 QLabel* titleLabel = new QLabel(tr("Title:"), generalGroupBox); 34 QLabel* titleLabel = new QLabel(tr("Title:"), generalGroupBox);
36 m_pTitleLineEdit = new QLineEdit(generalGroupBox); 35 m_pTitleLineEdit = new QLineEdit(generalGroupBox);
37 36
38 QGroupBox* sizeGroupBox = new QGroupBox(0, Qt::Vertical, tr("Size"), this); 37 QGroupBox* sizeGroupBox = new QGroupBox(0, Qt::Vertical, tr("Size"), this);
39 38
40 QLabel* widthLabel = new QLabel(tr("Width:"), sizeGroupBox); 39 QLabel* widthLabel = new QLabel(tr("Width:"), sizeGroupBox);
41 QLabel* heightLabel = new QLabel(tr("Height:"), sizeGroupBox); 40 QLabel* heightLabel = new QLabel(tr("Height:"), sizeGroupBox);
42 41
43 m_pWidthSpinBox = new QSpinBox(1, 1024, 1, sizeGroupBox); 42 m_pWidthSpinBox = new QSpinBox(1, 1024, 1, sizeGroupBox);
44 m_pHeightSpinBox = new QSpinBox(1, 1024, 1, sizeGroupBox); 43 m_pHeightSpinBox = new QSpinBox(1, 1024, 1, sizeGroupBox);
45 44
46 m_pWidthSpinBox->setValue(width); 45 m_pWidthSpinBox->setValue(width);
47 m_pHeightSpinBox->setValue(height); 46 m_pHeightSpinBox->setValue(height);
48 47
49 m_pContentButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Background"), this); 48 m_pContentButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Background"), this);
diff --git a/noncore/graphics/drawpad/pointtool.cpp b/noncore/graphics/drawpad/pointtool.cpp
index b9b52bc..4fb7ad1 100644
--- a/noncore/graphics/drawpad/pointtool.cpp
+++ b/noncore/graphics/drawpad/pointtool.cpp
@@ -1,53 +1,52 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "pointtool.h" 14#include "pointtool.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "page.h" 18#include "page.h"
19 19
20#include <qimage.h> 20#include <qimage.h>
21#include <qpainter.h>
22 21
23PointTool::PointTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 22PointTool::PointTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
24 : Tool(drawPad, drawPadCanvas) 23 : Tool(drawPad, drawPadCanvas)
25{ 24{
26 m_mousePressed = false; 25 m_mousePressed = false;
27 m_polyline.resize(3); 26 m_polyline.resize(3);
28} 27}
29 28
30PointTool::~PointTool() 29PointTool::~PointTool()
31{ 30{
32} 31}
33 32
34void PointTool::mousePressEvent(QMouseEvent* e) 33void PointTool::mousePressEvent(QMouseEvent* e)
35{ 34{
36 m_pDrawPadCanvas->backupPage(); 35 m_pDrawPadCanvas->backupPage();
37 36
38 m_mousePressed = true; 37 m_mousePressed = true;
39 m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); 38 m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos();
40} 39}
41 40
42void PointTool::mouseReleaseEvent(QMouseEvent* e) 41void PointTool::mouseReleaseEvent(QMouseEvent* e)
43{ 42{
44 Q_UNUSED(e) 43 Q_UNUSED(e)
45 44
46 m_mousePressed = false; 45 m_mousePressed = false;
47} 46}
48 47
49void PointTool::mouseMoveEvent(QMouseEvent* e) 48void PointTool::mouseMoveEvent(QMouseEvent* e)
50{ 49{
51 if (m_mousePressed) { 50 if (m_mousePressed) {
52 m_polyline[2] = m_polyline[1]; 51 m_polyline[2] = m_polyline[1];
53 m_polyline[1] = m_polyline[0]; 52 m_polyline[1] = m_polyline[0];
diff --git a/noncore/graphics/drawpad/shapetool.cpp b/noncore/graphics/drawpad/shapetool.cpp
index 22e3dd6..6e4276d 100644
--- a/noncore/graphics/drawpad/shapetool.cpp
+++ b/noncore/graphics/drawpad/shapetool.cpp
@@ -1,52 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "shapetool.h" 14#include "shapetool.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "page.h" 18#include "page.h"
19 19
20#include <qpainter.h>
21 20
22ShapeTool::ShapeTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 21ShapeTool::ShapeTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
23 : Tool(drawPad, drawPadCanvas) 22 : Tool(drawPad, drawPadCanvas)
24{ 23{
25 m_mousePressed = false; 24 m_mousePressed = false;
26 m_polyline.resize(3); 25 m_polyline.resize(3);
27} 26}
28 27
29ShapeTool::~ShapeTool() 28ShapeTool::~ShapeTool()
30{ 29{
31} 30}
32 31
33void ShapeTool::mousePressEvent(QMouseEvent* e) 32void ShapeTool::mousePressEvent(QMouseEvent* e)
34{ 33{
35 m_pDrawPadCanvas->backupPage(); 34 m_pDrawPadCanvas->backupPage();
36 35
37 m_mousePressed = true; 36 m_mousePressed = true;
38 m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); 37 m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos();
39} 38}
40 39
41void ShapeTool::mouseReleaseEvent(QMouseEvent* e) 40void ShapeTool::mouseReleaseEvent(QMouseEvent* e)
42{ 41{
43 Q_UNUSED(e) 42 Q_UNUSED(e)
44 43
45 QPainter painter; 44 QPainter painter;
46 painter.begin(m_pDrawPadCanvas->currentPage()->pixmap()); 45 painter.begin(m_pDrawPadCanvas->currentPage()->pixmap());
47 drawFinalShape(painter); 46 drawFinalShape(painter);
48 painter.end(); 47 painter.end();
49 48
50 QRect r = m_polyline.boundingRect(); 49 QRect r = m_polyline.boundingRect();
51 r = r.normalize(); 50 r = r.normalize();
52 r.setLeft(r.left() - m_pDrawPad->pen().width()); 51 r.setLeft(r.left() - m_pDrawPad->pen().width());
diff --git a/noncore/graphics/drawpad/texttool.cpp b/noncore/graphics/drawpad/texttool.cpp
index 9037abd..3a89e80 100644
--- a/noncore/graphics/drawpad/texttool.cpp
+++ b/noncore/graphics/drawpad/texttool.cpp
@@ -1,54 +1,53 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "texttool.h" 14#include "texttool.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "page.h" 18#include "page.h"
19 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qlineedit.h> 21#include <qlineedit.h>
22#include <qpainter.h>
23 22
24TextToolDialog::TextToolDialog(QWidget* parent, const char* name) 23TextToolDialog::TextToolDialog(QWidget* parent, const char* name)
25 : QDialog(parent, name, true) 24 : QDialog(parent, name, true)
26{ 25{
27 setCaption(tr("Insert Text")); 26 setCaption(tr("Insert Text"));
28 27
29 m_pLineEdit = new QLineEdit(this); 28 m_pLineEdit = new QLineEdit(this);
30 29
31 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); 30 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
32 31
33 mainLayout->addWidget(m_pLineEdit); 32 mainLayout->addWidget(m_pLineEdit);
34} 33}
35 34
36TextToolDialog::~TextToolDialog() 35TextToolDialog::~TextToolDialog()
37{ 36{
38} 37}
39 38
40QString TextToolDialog::text() 39QString TextToolDialog::text()
41{ 40{
42 return m_pLineEdit->text(); 41 return m_pLineEdit->text();
43} 42}
44 43
45TextTool::TextTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 44TextTool::TextTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
46 : Tool(drawPad, drawPadCanvas) 45 : Tool(drawPad, drawPadCanvas)
47{ 46{
48} 47}
49 48
50TextTool::~TextTool() 49TextTool::~TextTool()
51{ 50{
52} 51}
53 52
54void TextTool::mousePressEvent(QMouseEvent* e) 53void TextTool::mousePressEvent(QMouseEvent* e)
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp
index 90ba39c..1ccf484 100644
--- a/noncore/graphics/drawpad/thumbnailview.cpp
+++ b/noncore/graphics/drawpad/thumbnailview.cpp
@@ -1,58 +1,57 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "thumbnailview.h" 14#include "thumbnailview.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "newpagedialog.h" 18#include "newpagedialog.h"
19#include "page.h" 19#include "page.h"
20 20
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/timestring.h> 23#include <qpe/timestring.h>
24 24
25#include <qapplication.h> 25#include <qapplication.h>
26#include <qimage.h>
27#include <qlayout.h> 26#include <qlayout.h>
28#include <qmessagebox.h> 27#include <qmessagebox.h>
29#include <qtoolbutton.h> 28#include <qtoolbutton.h>
30#include <qwhatsthis.h> 29#include <qwhatsthis.h>
31 30
32#define THUMBNAIL_SIZE 48 31#define THUMBNAIL_SIZE 48
33 32
34PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) 33PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent)
35 : QListBoxItem(parent) 34 : QListBoxItem(parent)
36{ 35{
37 m_pPage = page; 36 m_pPage = page;
38 37
39 QImage image = m_pPage->pixmap()->convertToImage(); 38 QImage image = m_pPage->pixmap()->convertToImage();
40 39
41 int previewWidth = THUMBNAIL_SIZE; 40 int previewWidth = THUMBNAIL_SIZE;
42 int previewHeight = THUMBNAIL_SIZE; 41 int previewHeight = THUMBNAIL_SIZE;
43 42
44 float widthScale = 1.0; 43 float widthScale = 1.0;
45 float heightScale = 1.0; 44 float heightScale = 1.0;
46 45
47 if (previewWidth < image.width()) { 46 if (previewWidth < image.width()) {
48 widthScale = (float)previewWidth / float(image.width()); 47 widthScale = (float)previewWidth / float(image.width());
49 } 48 }
50 49
51 if (previewHeight < image.height()) { 50 if (previewHeight < image.height()) {
52 heightScale = (float)previewHeight / float(image.height()); 51 heightScale = (float)previewHeight / float(image.height());
53 } 52 }
54 53
55 float scale = (widthScale < heightScale ? widthScale : heightScale); 54 float scale = (widthScale < heightScale ? widthScale : heightScale);
56 QImage thumbnailImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale)); 55 QImage thumbnailImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale));
57 56
58 m_thumbnail.convertFromImage(thumbnailImage); 57 m_thumbnail.convertFromImage(thumbnailImage);
diff --git a/noncore/graphics/drawpad/tool.cpp b/noncore/graphics/drawpad/tool.cpp
index 0d36912..656078e 100644
--- a/noncore/graphics/drawpad/tool.cpp
+++ b/noncore/graphics/drawpad/tool.cpp
@@ -1,28 +1,26 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "tool.h" 14#include "tool.h"
15 15
16#include "drawpad.h"
17#include "drawpadcanvas.h"
18 16
19Tool::Tool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) 17Tool::Tool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas)
20 : QObject() 18 : QObject()
21{ 19{
22 m_pDrawPad = drawPad; 20 m_pDrawPad = drawPad;
23 m_pDrawPadCanvas = drawPadCanvas; 21 m_pDrawPadCanvas = drawPadCanvas;
24} 22}
25 23
26Tool::~Tool() 24Tool::~Tool()
27{ 25{
28} 26}