-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 139c752..9f0e27f 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -1,166 +1,165 @@ | |||
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 "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> | ||
39 | #include <qpe/qpetoolbar.h> | 38 | #include <qpe/qpetoolbar.h> |
40 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
41 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
42 | 41 | ||
43 | #include <qmenubar.h> | 42 | #include <qmenubar.h> |
44 | #include <qaction.h> | 43 | #include <qaction.h> |
45 | #include <qfile.h> | 44 | #include <qfile.h> |
46 | #include <qmessagebox.h> | 45 | #include <qmessagebox.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 | ||
52 | DrawPad::DrawPad(QWidget* parent, const char* name, WFlags fl ) | 51 | DrawPad::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); |
79 | connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); | 78 | connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); |
80 | importPageAction->addTo(toolsPopupMenu); | 79 | importPageAction->addTo(toolsPopupMenu); |
81 | 80 | ||
82 | QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); | 81 | QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); |
83 | connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); | 82 | connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); |
84 | exportPageAction->addTo(toolsPopupMenu); | 83 | exportPageAction->addTo(toolsPopupMenu); |
85 | 84 | ||
86 | toolsPopupMenu->insertSeparator(); | 85 | toolsPopupMenu->insertSeparator(); |
87 | 86 | ||
88 | QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); | 87 | QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); |
89 | connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); | 88 | connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); |
90 | thumbnailViewAction->addTo(toolsPopupMenu); | 89 | thumbnailViewAction->addTo(toolsPopupMenu); |
91 | 90 | ||
92 | QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); | 91 | QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); |
93 | connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); | 92 | connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); |
94 | pageInformationAction->addTo(toolsPopupMenu); | 93 | pageInformationAction->addTo(toolsPopupMenu); |
95 | 94 | ||
96 | toolsPopupMenu->insertSeparator(); | 95 | toolsPopupMenu->insertSeparator(); |
97 | 96 | ||
98 | m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); | 97 | m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); |
99 | m_pAntiAliasingAction->setToggleAction(true); | 98 | m_pAntiAliasingAction->setToggleAction(true); |
100 | m_pAntiAliasingAction->addTo(toolsPopupMenu); | 99 | m_pAntiAliasingAction->addTo(toolsPopupMenu); |
101 | 100 | ||
102 | menuBar->insertItem(tr("Tools"), toolsPopupMenu); | 101 | menuBar->insertItem(tr("Tools"), toolsPopupMenu); |
103 | 102 | ||
104 | // init page toolbar | 103 | // init page toolbar |
105 | 104 | ||
106 | QToolBar* pageToolBar = new QToolBar(this); | 105 | QToolBar* pageToolBar = new QToolBar(this); |
107 | 106 | ||
108 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); | 107 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); |
109 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); | 108 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); |
110 | newPageAction->addTo(pageToolBar); | 109 | newPageAction->addTo(pageToolBar); |
111 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); | 110 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); |
112 | 111 | ||
113 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); | 112 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); |
114 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); | 113 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); |
115 | clearPageAction->addTo(pageToolBar); | 114 | clearPageAction->addTo(pageToolBar); |
116 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); | 115 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); |
117 | 116 | ||
118 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); | 117 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); |
119 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); | 118 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); |
120 | deletePageAction->addTo(pageToolBar); | 119 | deletePageAction->addTo(pageToolBar); |
121 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); | 120 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); |
122 | 121 | ||
123 | QToolBar* emptyToolBar = new QToolBar(this); | 122 | QToolBar* emptyToolBar = new QToolBar(this); |
124 | emptyToolBar->setHorizontalStretchable(true); | 123 | emptyToolBar->setHorizontalStretchable(true); |
125 | 124 | ||
126 | // init navigation toolbar | 125 | // init navigation toolbar |
127 | 126 | ||
128 | QToolBar* navigationToolBar = new QToolBar(this); | 127 | QToolBar* navigationToolBar = new QToolBar(this); |
129 | 128 | ||
130 | m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); | 129 | m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); |
131 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); | 130 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); |
132 | m_pUndoAction->addTo(navigationToolBar); | 131 | m_pUndoAction->addTo(navigationToolBar); |
133 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); | 132 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); |
134 | 133 | ||
135 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); | 134 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); |
136 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); | 135 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); |
137 | m_pRedoAction->addTo(navigationToolBar); | 136 | m_pRedoAction->addTo(navigationToolBar); |
138 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); | 137 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); |
139 | 138 | ||
140 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); | 139 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); |
141 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); | 140 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); |
142 | m_pFirstPageAction->addTo(navigationToolBar); | 141 | m_pFirstPageAction->addTo(navigationToolBar); |
143 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); | 142 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); |
144 | 143 | ||
145 | m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); | 144 | m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); |
146 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); | 145 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); |
147 | m_pPreviousPageAction->addTo(navigationToolBar); | 146 | m_pPreviousPageAction->addTo(navigationToolBar); |
148 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); | 147 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); |
149 | 148 | ||
150 | m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); | 149 | m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); |
151 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); | 150 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); |
152 | m_pNextPageAction->addTo(navigationToolBar); | 151 | m_pNextPageAction->addTo(navigationToolBar); |
153 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); | 152 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); |
154 | 153 | ||
155 | m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); | 154 | m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); |
156 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); | 155 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); |
157 | m_pLastPageAction->addTo(navigationToolBar); | 156 | m_pLastPageAction->addTo(navigationToolBar); |
158 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); | 157 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); |
159 | 158 | ||
160 | // init draw mode toolbar | 159 | // init draw mode toolbar |
161 | 160 | ||
162 | QToolBar* drawModeToolBar = new QToolBar(this); | 161 | QToolBar* drawModeToolBar = new QToolBar(this); |
163 | 162 | ||
164 | m_pLineToolButton = new QToolButton(drawModeToolBar); | 163 | m_pLineToolButton = new QToolButton(drawModeToolBar); |
165 | m_pLineToolButton->setToggleButton(true); | 164 | m_pLineToolButton->setToggleButton(true); |
166 | QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); | 165 | QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); |