summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp6
-rw-r--r--noncore/graphics/drawpad/drawpad.h3
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp6
-rw-r--r--noncore/graphics/drawpad/main.cpp1
5 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 7c26832..de27eb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,26 +1,27 @@
1 2004-??-??The Opie Team <opie@handhelds.org> 1 2004-??-??The Opie Team <opie@handhelds.org>
2 2
3 * Fixed Drawpad initialization (Bug #1314) (mickeyl)
3 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 4 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
4 * Added Conversion tool for pim-data (eilers) 5 * Added Conversion tool for pim-data (eilers)
5 * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers) 6 * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers)
6 7
7 2004-25-04The Opie Team <opie@handhelds.org> 8 2004-25-04The Opie Team <opie@handhelds.org>
8 9
9 * Released as Version 1.1.3 (devel) 10 * Released as Version 1.1.3 (devel)
10 * Introduced first implementation of SQL-Support using SQLite (eilers) 11 * Introduced first implementation of SQL-Support using SQLite (eilers)
11 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 12 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
12 * Added a real system graffiti character set (brad) 13 * Added a real system graffiti character set (brad)
13 * Added Generic Keyconfig Widget (zecke) 14 * Added Generic Keyconfig Widget (zecke)
14 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) 15 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke)
15 * Added new Bible reader app - opie-dagger (drw) 16 * Added new Bible reader app - opie-dagger (drw)
16 * Added a new Image Viewer. Work is ongoing (zecke,alwin) 17 * Added a new Image Viewer. Work is ongoing (zecke,alwin)
17 * Added namespace usage in libopie2 and everywhere (zecke,alwin) 18 * Added namespace usage in libopie2 and everywhere (zecke,alwin)
18 * Enabled the possibility to pass command line arguments to applications (mickeyl) 19 * Enabled the possibility to pass command line arguments to applications (mickeyl)
19 * Added an about applet showing some credits and information about Opie (mickeyl) 20 * Added an about applet showing some credits and information about Opie (mickeyl)
20 * Added benchmarking functionality to sysinfo (mickeyl) 21 * Added benchmarking functionality to sysinfo (mickeyl)
21 * Added applet and configuration application for switching hardware keyboard layouts (alwin) 22 * Added applet and configuration application for switching hardware keyboard layouts (alwin)
22 * Ported applications from libopie1 to libopie2* (drw,ar,alwin) 23 * Ported applications from libopie1 to libopie2* (drw,ar,alwin)
23 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) 24 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe)
24 * Clean-up of package information in control files (drw) 25 * Clean-up of package information in control files (drw)
25 * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 26 * Repaired mediummount which was broken since integrating the quicklauncher (alwin)
26 * Improved big-screen support (zecke,ar) 27 * Improved big-screen support (zecke,ar)
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index d9d0ce0..c0f42d9 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -28,49 +28,48 @@
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 <opie2/qcolordialog.h> 33#include <opie2/qcolordialog.h>
34#include <opie2/ocolorpopupmenu.h> 34#include <opie2/ocolorpopupmenu.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 <qtoolbar.h> 38#include <qtoolbar.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41 41
42#include <qmenubar.h> 42#include <qmenubar.h>
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 <qspinbox.h> 46#include <qspinbox.h>
47#include <qtoolbutton.h> 47#include <qtoolbutton.h>
48#include <qtooltip.h> 48#include <qtooltip.h>
49#include <qwhatsthis.h> 49#include <qwhatsthis.h>
50 50
51using namespace Opie::Ui; 51using namespace Opie::Ui;
52using namespace Opie::Ui;
53DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) 52DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ )
54 : QMainWindow(parent, name, WStyle_ContextHelp) 53 : QMainWindow(parent, name, WStyle_ContextHelp)
55{ 54{
56 // init members 55 // init members
57 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 56 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
58 this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) ); 57 this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) );
59 58
60 m_pDrawPadCanvas = new DrawPadCanvas(this, this); 59 m_pDrawPadCanvas = new DrawPadCanvas(this, this);
61 60
62 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); 61 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));
63 62
64 setCentralWidget(m_pDrawPadCanvas); 63 setCentralWidget(m_pDrawPadCanvas);
65 64
66 // init menu 65 // init menu
67 66
68 setToolBarsMovable(false); 67 setToolBarsMovable(false);
69 68
70 QToolBar* menuToolBar = new QToolBar(this); 69 QToolBar* menuToolBar = new QToolBar(this);
71 QMenuBar* menuBar = new QMenuBar(menuToolBar); 70 QMenuBar* menuBar = new QMenuBar(menuToolBar);
72 71
73 QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); 72 QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar);
74 73
75 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); 74 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
76 connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); 75 connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll()));
@@ -260,49 +259,52 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ )
260 QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); 259 QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) );
261 260
262 Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton); 261 Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton);
263 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); 262 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&)));
264 263
265 QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); 264 QToolTip::add(m_pPenColorToolButton, tr("Pen Color"));
266 m_pPenColorToolButton->setPopup(penColorPopupMenu); 265 m_pPenColorToolButton->setPopup(penColorPopupMenu);
267 m_pPenColorToolButton->setPopupDelay(0); 266 m_pPenColorToolButton->setPopupDelay(0);
268 267
269 changePenColor(Qt::black); 268 changePenColor(Qt::black);
270 269
271 m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); 270 m_pBrushColorToolButton = new QToolButton(drawParametersToolBar);
272 m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor")); 271 m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor"));
273 QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); 272 QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) );
274 273
275 Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton); 274 Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton);
276 connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); 275 connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&)));
277 276
278 QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); 277 QToolTip::add(m_pBrushColorToolButton, tr("Fill Color"));
279 m_pBrushColorToolButton->setPopup(brushColorPopupMenu); 278 m_pBrushColorToolButton->setPopup(brushColorPopupMenu);
280 m_pBrushColorToolButton->setPopupDelay(0); 279 m_pBrushColorToolButton->setPopupDelay(0);
281 280
282 changeBrushColor(Qt::white); 281 changeBrushColor(Qt::white);
283 282
284 finishStartup(); 283 // delay the rest of the initialization and do it from within the mainloop
284 // if we don't do this, the widget layout may not be constructed upon
285 // and we will end up with a wrong QScrollview page size (Mickeyl)
286 QTimer::singleShot( 100, this, SLOT( finishStartup() ) );
285} 287}
286 288
287 289
288void DrawPad::finishStartup() 290void DrawPad::finishStartup()
289{ 291{
290 // init pages 292 // init pages
291 293
292 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 294 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
293 295
294 if (file.open(IO_ReadOnly)) { 296 if (file.open(IO_ReadOnly)) {
295 m_pDrawPadCanvas->load(&file); 297 m_pDrawPadCanvas->load(&file);
296 file.close(); 298 file.close();
297 } else { 299 } else {
298 m_pDrawPadCanvas->initialPage(); 300 m_pDrawPadCanvas->initialPage();
299 } 301 }
300 302
301 loadConfig(); 303 loadConfig();
302 304
303} 305}
304 306
305DrawPad::~DrawPad() 307DrawPad::~DrawPad()
306{ 308{
307 saveConfig(); 309 saveConfig();
308 310
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h
index ba9e47d..63d3057 100644
--- a/noncore/graphics/drawpad/drawpad.h
+++ b/noncore/graphics/drawpad/drawpad.h
@@ -20,51 +20,52 @@
20class DrawPadCanvas; 20class DrawPadCanvas;
21class Tool; 21class Tool;
22 22
23class QAction; 23class QAction;
24class QColor; 24class QColor;
25class QSpinBox; 25class QSpinBox;
26class QToolButton; 26class QToolButton;
27class QWidgetStack; 27class QWidgetStack;
28 28
29class DrawPad : public QMainWindow 29class DrawPad : public QMainWindow
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32 32
33public: 33public:
34 DrawPad(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 34 DrawPad(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
35 ~DrawPad(); 35 ~DrawPad();
36 36
37 static QString appName() { return QString::fromLatin1("drawpad"); } 37 static QString appName() { return QString::fromLatin1("drawpad"); }
38 38
39 Tool* tool() { return m_pTool; } 39 Tool* tool() { return m_pTool; }
40 QPen pen() { return m_pen; } 40 QPen pen() { return m_pen; }
41 QBrush brush() { return m_brush; } 41 QBrush brush() { return m_brush; }
42 42
43 bool antiAliasing(); 43 bool antiAliasing();
44 void finishStartup();
45 44
46private slots: 45private slots:
46 void finishStartup();
47
47 void newPage(); 48 void newPage();
48 void clearPage(); 49 void clearPage();
49 void deletePage(); 50 void deletePage();
50 51
51 void slotAppMessage( const QCString&, const QByteArray& ); 52 void slotAppMessage( const QCString&, const QByteArray& );
52 53
53 void setPointTool(); 54 void setPointTool();
54 void setLineTool(); 55 void setLineTool();
55 void setRectangleTool(); 56 void setRectangleTool();
56 void setFilledRectangleTool(); 57 void setFilledRectangleTool();
57 void setEllipseTool(); 58 void setEllipseTool();
58 void setFilledEllipseTool(); 59 void setFilledEllipseTool();
59 void setTextTool(); 60 void setTextTool();
60 void setFillTool(); 61 void setFillTool();
61 void setEraseTool(); 62 void setEraseTool();
62 63
63 void changePenWidth(int value); 64 void changePenWidth(int value);
64 void changePenColor(const QColor& color); 65 void changePenColor(const QColor& color);
65 void changeBrushColor(const QColor& color); 66 void changeBrushColor(const QColor& color);
66 67
67 void updateView(); 68 void updateView();
68 69
69 void deleteAll(); 70 void deleteAll();
70 void importPage(); 71 void importPage();
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index 423ef26..5d0c6e4 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -495,38 +495,40 @@ void DrawPadCanvas::goLastPage()
495 495
496 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 496 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
497 viewport()->update(); 497 viewport()->update();
498 498
499 emit pagesChanged(); 499 emit pagesChanged();
500} 500}
501 501
502void DrawPadCanvas::contentsMousePressEvent(QMouseEvent* e) 502void DrawPadCanvas::contentsMousePressEvent(QMouseEvent* e)
503{ 503{
504 m_pDrawPad->tool()->mousePressEvent(e); 504 m_pDrawPad->tool()->mousePressEvent(e);
505} 505}
506 506
507void DrawPadCanvas::contentsMouseReleaseEvent(QMouseEvent* e) 507void DrawPadCanvas::contentsMouseReleaseEvent(QMouseEvent* e)
508{ 508{
509 m_pDrawPad->tool()->mouseReleaseEvent(e); 509 m_pDrawPad->tool()->mouseReleaseEvent(e);
510} 510}
511 511
512void DrawPadCanvas::contentsMouseMoveEvent(QMouseEvent* e) 512void DrawPadCanvas::contentsMouseMoveEvent(QMouseEvent* e)
513{ 513{
514 m_pDrawPad->tool()->mouseMoveEvent(e); 514 m_pDrawPad->tool()->mouseMoveEvent(e);
515} 515}
516 516
517void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 517void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
518{ 518{
519 Page* currentPage = m_pages.current();
520 if ( !currentPage ) return; // no page yet --> initialization not finished (Mickeyl)
519 QRect clipRect(cx, cy, cw, ch); 521 QRect clipRect(cx, cy, cw, ch);
520 QRect pixmapRect(0, 0, m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 522 QRect pixmapRect(0, 0, currentPage->pixmap()->width(), m_pages.current()->pixmap()->height());
521 QRect drawRect = pixmapRect.intersect(clipRect); 523 QRect drawRect = pixmapRect.intersect(clipRect);
522 524
523 p->drawPixmap(drawRect.topLeft(), *(m_pages.current()->pixmap()), drawRect); 525 p->drawPixmap(drawRect.topLeft(), *(currentPage->pixmap()), drawRect);
524 526
525 if (drawRect.right() < clipRect.right()) { 527 if (drawRect.right() < clipRect.right()) {
526 p->fillRect(drawRect.right() + 1, cy, cw - drawRect.width(), ch, colorGroup().dark()); 528 p->fillRect(drawRect.right() + 1, cy, cw - drawRect.width(), ch, colorGroup().dark());
527 } 529 }
528 530
529 if (drawRect.bottom() < clipRect.bottom()) { 531 if (drawRect.bottom() < clipRect.bottom()) {
530 p->fillRect(cx, drawRect.bottom() + 1, cw, ch - drawRect.height(), colorGroup().dark()); 532 p->fillRect(cx, drawRect.bottom() + 1, cw, ch - drawRect.height(), colorGroup().dark());
531 } 533 }
532} 534}
diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp
index e48bb2e..f468022 100644
--- a/noncore/graphics/drawpad/main.cpp
+++ b/noncore/graphics/drawpad/main.cpp
@@ -1,20 +1,19 @@
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 <opie2/oapplicationfactory.h> 16#include <opie2/oapplicationfactory.h>
17 17
18using namespace Opie::Core; 18using namespace Opie::Core;
19using namespace Opie::Core;
20OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) 19OPIE_EXPORT_APP( OApplicationFactory<DrawPad> )