author | harlekin <harlekin> | 2003-03-21 21:03:15 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-21 21:03:15 (UTC) |
commit | 3ed4386c2ee0e411fa3a8f9a81c3d6c86855d385 (patch) (unidiff) | |
tree | 7fb1e530231484d36ed35319701b122d8648e3a1 | |
parent | bf981853b49145690a28a3073aa2e11af329f089 (diff) | |
download | opie-3ed4386c2ee0e411fa3a8f9a81c3d6c86855d385.zip opie-3ed4386c2ee0e411fa3a8f9a81c3d6c86855d385.tar.gz opie-3ed4386c2ee0e411fa3a8f9a81c3d6c86855d385.tar.bz2 |
redo undo now in inline
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 53db993..459f1a8 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -27,173 +27,173 @@ | |||
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 <qpe/qpemenubar.h> | 39 | #include <qpe/qpemenubar.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> | 46 | #include <qpainter.h> |
47 | #include <qspinbox.h> | 47 | #include <qspinbox.h> |
48 | #include <qtoolbutton.h> | 48 | #include <qtoolbutton.h> |
49 | #include <qtooltip.h> | 49 | #include <qtooltip.h> |
50 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
51 | 51 | ||
52 | DrawPad::DrawPad(QWidget* parent, const char* name) | 52 | DrawPad::DrawPad(QWidget* parent, const char* name) |
53 | : QMainWindow(parent, name, WStyle_ContextHelp) | 53 | : QMainWindow(parent, name, WStyle_ContextHelp) |
54 | { | 54 | { |
55 | // init members | 55 | // init members |
56 | 56 | ||
57 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); | 57 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); |
58 | 58 | ||
59 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); | 59 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); |
60 | 60 | ||
61 | setCentralWidget(m_pDrawPadCanvas); | 61 | setCentralWidget(m_pDrawPadCanvas); |
62 | 62 | ||
63 | // init menu | 63 | // init menu |
64 | 64 | ||
65 | setToolBarsMovable(false); | 65 | setToolBarsMovable(false); |
66 | 66 | ||
67 | QPEToolBar* menuToolBar = new QPEToolBar(this); | 67 | QPEToolBar* menuToolBar = new QPEToolBar(this); |
68 | QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar); | 68 | QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar); |
69 | 69 | ||
70 | QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); | 70 | QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); |
71 | 71 | ||
72 | QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); | 72 | QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); |
73 | connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); | 73 | connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); |
74 | deleteAllAction->addTo(toolsPopupMenu); | 74 | deleteAllAction->addTo(toolsPopupMenu); |
75 | 75 | ||
76 | toolsPopupMenu->insertSeparator(); | 76 | toolsPopupMenu->insertSeparator(); |
77 | 77 | ||
78 | QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); | 78 | QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); |
79 | connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); | 79 | connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); |
80 | importPageAction->addTo(toolsPopupMenu); | 80 | importPageAction->addTo(toolsPopupMenu); |
81 | 81 | ||
82 | QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); | 82 | QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); |
83 | connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); | 83 | connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); |
84 | exportPageAction->addTo(toolsPopupMenu); | 84 | exportPageAction->addTo(toolsPopupMenu); |
85 | 85 | ||
86 | toolsPopupMenu->insertSeparator(); | 86 | toolsPopupMenu->insertSeparator(); |
87 | 87 | ||
88 | QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); | 88 | QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); |
89 | connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); | 89 | connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); |
90 | thumbnailViewAction->addTo(toolsPopupMenu); | 90 | thumbnailViewAction->addTo(toolsPopupMenu); |
91 | 91 | ||
92 | QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); | 92 | QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); |
93 | connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); | 93 | connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); |
94 | pageInformationAction->addTo(toolsPopupMenu); | 94 | pageInformationAction->addTo(toolsPopupMenu); |
95 | 95 | ||
96 | toolsPopupMenu->insertSeparator(); | 96 | toolsPopupMenu->insertSeparator(); |
97 | 97 | ||
98 | m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); | 98 | m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); |
99 | m_pAntiAliasingAction->setToggleAction(true); | 99 | m_pAntiAliasingAction->setToggleAction(true); |
100 | m_pAntiAliasingAction->addTo(toolsPopupMenu); | 100 | m_pAntiAliasingAction->addTo(toolsPopupMenu); |
101 | 101 | ||
102 | menuBar->insertItem(tr("Tools"), toolsPopupMenu); | 102 | menuBar->insertItem(tr("Tools"), toolsPopupMenu); |
103 | 103 | ||
104 | // init page toolbar | 104 | // init page toolbar |
105 | 105 | ||
106 | QPEToolBar* pageToolBar = new QPEToolBar(this); | 106 | QPEToolBar* pageToolBar = new QPEToolBar(this); |
107 | 107 | ||
108 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); | 108 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); |
109 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); | 109 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); |
110 | newPageAction->addTo(pageToolBar); | 110 | newPageAction->addTo(pageToolBar); |
111 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); | 111 | newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); |
112 | 112 | ||
113 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); | 113 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); |
114 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); | 114 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); |
115 | clearPageAction->addTo(pageToolBar); | 115 | clearPageAction->addTo(pageToolBar); |
116 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); | 116 | clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); |
117 | 117 | ||
118 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); | 118 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); |
119 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); | 119 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); |
120 | deletePageAction->addTo(pageToolBar); | 120 | deletePageAction->addTo(pageToolBar); |
121 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); | 121 | deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); |
122 | 122 | ||
123 | QPEToolBar* emptyToolBar = new QPEToolBar(this); | 123 | QPEToolBar* emptyToolBar = new QPEToolBar(this); |
124 | emptyToolBar->setHorizontalStretchable(true); | 124 | emptyToolBar->setHorizontalStretchable(true); |
125 | 125 | ||
126 | // init navigation toolbar | 126 | // init navigation toolbar |
127 | 127 | ||
128 | QPEToolBar* navigationToolBar = new QPEToolBar(this); | 128 | QPEToolBar* navigationToolBar = new QPEToolBar(this); |
129 | 129 | ||
130 | m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("drawpad/undo"), QString::null, 0, this); | 130 | m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); |
131 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); | 131 | connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); |
132 | m_pUndoAction->addTo(navigationToolBar); | 132 | m_pUndoAction->addTo(navigationToolBar); |
133 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); | 133 | m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); |
134 | 134 | ||
135 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("drawpad/redo"), QString::null, 0, this); | 135 | m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); |
136 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); | 136 | connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); |
137 | m_pRedoAction->addTo(navigationToolBar); | 137 | m_pRedoAction->addTo(navigationToolBar); |
138 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); | 138 | m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); |
139 | 139 | ||
140 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); | 140 | m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); |
141 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); | 141 | connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); |
142 | m_pFirstPageAction->addTo(navigationToolBar); | 142 | m_pFirstPageAction->addTo(navigationToolBar); |
143 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); | 143 | m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); |
144 | 144 | ||
145 | m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); | 145 | m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); |
146 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); | 146 | connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); |
147 | m_pPreviousPageAction->addTo(navigationToolBar); | 147 | m_pPreviousPageAction->addTo(navigationToolBar); |
148 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); | 148 | m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); |
149 | 149 | ||
150 | m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); | 150 | m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); |
151 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); | 151 | connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); |
152 | m_pNextPageAction->addTo(navigationToolBar); | 152 | m_pNextPageAction->addTo(navigationToolBar); |
153 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); | 153 | m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); |
154 | 154 | ||
155 | m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); | 155 | m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); |
156 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); | 156 | connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); |
157 | m_pLastPageAction->addTo(navigationToolBar); | 157 | m_pLastPageAction->addTo(navigationToolBar); |
158 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); | 158 | m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); |
159 | 159 | ||
160 | // init draw mode toolbar | 160 | // init draw mode toolbar |
161 | 161 | ||
162 | QPEToolBar* drawModeToolBar = new QPEToolBar(this); | 162 | QPEToolBar* drawModeToolBar = new QPEToolBar(this); |
163 | 163 | ||
164 | m_pLineToolButton = new QToolButton(drawModeToolBar); | 164 | m_pLineToolButton = new QToolButton(drawModeToolBar); |
165 | m_pLineToolButton->setToggleButton(true); | 165 | m_pLineToolButton->setToggleButton(true); |
166 | QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); | 166 | QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); |
167 | 167 | ||
168 | 168 | ||
169 | QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); | 169 | QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); |
170 | 170 | ||
171 | m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); | 171 | m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); |
172 | connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); | 172 | connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); |
173 | m_pPointToolAction->addTo(linePopupMenu); | 173 | m_pPointToolAction->addTo(linePopupMenu); |
174 | 174 | ||
175 | m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); | 175 | m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); |
176 | connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); | 176 | connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); |
177 | m_pLineToolAction->addTo(linePopupMenu); | 177 | m_pLineToolAction->addTo(linePopupMenu); |
178 | 178 | ||
179 | m_pLineToolButton->setPopup(linePopupMenu); | 179 | m_pLineToolButton->setPopup(linePopupMenu); |
180 | m_pLineToolButton->setPopupDelay(0); | 180 | m_pLineToolButton->setPopupDelay(0); |
181 | 181 | ||
182 | m_pRectangleToolButton = new QToolButton(drawModeToolBar); | 182 | m_pRectangleToolButton = new QToolButton(drawModeToolBar); |
183 | m_pRectangleToolButton->setToggleButton(true); | 183 | m_pRectangleToolButton->setToggleButton(true); |
184 | QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); | 184 | QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); |
185 | 185 | ||
186 | QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); | 186 | QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); |
187 | 187 | ||
188 | m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); | 188 | m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); |
189 | connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); | 189 | connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); |
190 | m_pRectangleToolAction->addTo(rectanglePopupMenu); | 190 | m_pRectangleToolAction->addTo(rectanglePopupMenu); |
191 | 191 | ||
192 | m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); | 192 | m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); |
193 | connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); | 193 | connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); |
194 | m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); | 194 | m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); |
195 | 195 | ||
196 | m_pRectangleToolButton->setPopup(rectanglePopupMenu); | 196 | m_pRectangleToolButton->setPopup(rectanglePopupMenu); |
197 | m_pRectangleToolButton->setPopupDelay(0); | 197 | m_pRectangleToolButton->setPopupDelay(0); |
198 | 198 | ||
199 | m_pEllipseToolButton = new QToolButton(drawModeToolBar); | 199 | m_pEllipseToolButton = new QToolButton(drawModeToolBar); |
@@ -495,129 +495,129 @@ void DrawPad::setTextTool() | |||
495 | m_pRectangleToolButton->setOn(false); | 495 | m_pRectangleToolButton->setOn(false); |
496 | m_pEllipseToolButton->setOn(false); | 496 | m_pEllipseToolButton->setOn(false); |
497 | m_pTextToolAction->setOn(true); | 497 | m_pTextToolAction->setOn(true); |
498 | m_pFillToolAction->setOn(false); | 498 | m_pFillToolAction->setOn(false); |
499 | m_pEraseToolAction->setOn(false); | 499 | m_pEraseToolAction->setOn(false); |
500 | } | 500 | } |
501 | 501 | ||
502 | void DrawPad::setFillTool() | 502 | void DrawPad::setFillTool() |
503 | { | 503 | { |
504 | if (m_pTool) { | 504 | if (m_pTool) { |
505 | delete m_pTool; | 505 | delete m_pTool; |
506 | } | 506 | } |
507 | 507 | ||
508 | m_pTool = new FillTool(this, m_pDrawPadCanvas); | 508 | m_pTool = new FillTool(this, m_pDrawPadCanvas); |
509 | 509 | ||
510 | m_pLineToolButton->setOn(false); | 510 | m_pLineToolButton->setOn(false); |
511 | m_pRectangleToolButton->setOn(false); | 511 | m_pRectangleToolButton->setOn(false); |
512 | m_pEllipseToolButton->setOn(false); | 512 | m_pEllipseToolButton->setOn(false); |
513 | m_pTextToolAction->setOn(false); | 513 | m_pTextToolAction->setOn(false); |
514 | m_pFillToolAction->setOn(true); | 514 | m_pFillToolAction->setOn(true); |
515 | m_pEraseToolAction->setOn(false); | 515 | m_pEraseToolAction->setOn(false); |
516 | } | 516 | } |
517 | 517 | ||
518 | void DrawPad::setEraseTool() | 518 | void DrawPad::setEraseTool() |
519 | { | 519 | { |
520 | if (m_pTool) { | 520 | if (m_pTool) { |
521 | delete m_pTool; | 521 | delete m_pTool; |
522 | } | 522 | } |
523 | 523 | ||
524 | m_pTool = new EraseTool(this, m_pDrawPadCanvas); | 524 | m_pTool = new EraseTool(this, m_pDrawPadCanvas); |
525 | 525 | ||
526 | m_pLineToolButton->setOn(false); | 526 | m_pLineToolButton->setOn(false); |
527 | m_pRectangleToolButton->setOn(false); | 527 | m_pRectangleToolButton->setOn(false); |
528 | m_pEllipseToolButton->setOn(false); | 528 | m_pEllipseToolButton->setOn(false); |
529 | m_pTextToolAction->setOn(false); | 529 | m_pTextToolAction->setOn(false); |
530 | m_pFillToolAction->setOn(false); | 530 | m_pFillToolAction->setOn(false); |
531 | m_pEraseToolAction->setOn(true); | 531 | m_pEraseToolAction->setOn(true); |
532 | } | 532 | } |
533 | 533 | ||
534 | void DrawPad::changePenWidth(int value) | 534 | void DrawPad::changePenWidth(int value) |
535 | { | 535 | { |
536 | m_pen.setWidth(value); | 536 | m_pen.setWidth(value); |
537 | } | 537 | } |
538 | 538 | ||
539 | void DrawPad::changePenColor(const QColor& color) | 539 | void DrawPad::changePenColor(const QColor& color) |
540 | { | 540 | { |
541 | m_pen.setColor(color); | 541 | m_pen.setColor(color); |
542 | 542 | ||
543 | QPainter painter; | 543 | QPainter painter; |
544 | painter.begin(m_pPenColorToolButton->pixmap()); | 544 | painter.begin(m_pPenColorToolButton->pixmap()); |
545 | painter.fillRect(QRect(0, 12, 14, 2), m_pen.color()); | 545 | painter.fillRect(QRect(0, 12, 14, 2), m_pen.color()); |
546 | painter.end(); | 546 | painter.end(); |
547 | 547 | ||
548 | m_pPenColorToolButton->popup()->hide(); | 548 | m_pPenColorToolButton->popup()->hide(); |
549 | } | 549 | } |
550 | 550 | ||
551 | void DrawPad::changeBrushColor(const QColor& color) | 551 | void DrawPad::changeBrushColor(const QColor& color) |
552 | { | 552 | { |
553 | m_brush = QBrush(color); | 553 | m_brush = QBrush(color); |
554 | 554 | ||
555 | QPainter painter; | 555 | QPainter painter; |
556 | painter.begin(m_pBrushColorToolButton->pixmap()); | 556 | painter.begin(m_pBrushColorToolButton->pixmap()); |
557 | painter.fillRect(QRect(0, 12, 14, 2), m_brush.color()); | 557 | painter.fillRect(QRect(0, 12, 14, 2), m_brush.color()); |
558 | painter.end(); | 558 | painter.end(); |
559 | 559 | ||
560 | m_pBrushColorToolButton->popup()->hide(); | 560 | m_pBrushColorToolButton->popup()->hide(); |
561 | } | 561 | } |
562 | 562 | ||
563 | void DrawPad::updateView() | 563 | void DrawPad::updateView() |
564 | { | 564 | { |
565 | uint pagePosition = m_pDrawPadCanvas->pagePosition(); | 565 | uint pagePosition = m_pDrawPadCanvas->pagePosition(); |
566 | uint pageCount = m_pDrawPadCanvas->pageCount(); | 566 | uint pageCount = m_pDrawPadCanvas->pageCount(); |
567 | 567 | ||
568 | setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) ); | 568 | setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) ); |
569 | 569 | ||
570 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); | 570 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); |
571 | m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled()); | 571 | m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled()); |
572 | 572 | ||
573 | m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | 573 | m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); |
574 | m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | 574 | m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); |
575 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | 575 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); |
576 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | 576 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); |
577 | } | 577 | } |
578 | 578 | ||
579 | void DrawPad::deleteAll() | 579 | void DrawPad::deleteAll() |
580 | { | 580 | { |
581 | QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), | 581 | QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), |
582 | QMessageBox::Information, QMessageBox::Yes, | 582 | QMessageBox::Information, QMessageBox::Yes, |
583 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 583 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
584 | QMessageBox::NoButton, this); | 584 | QMessageBox::NoButton, this); |
585 | 585 | ||
586 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 586 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
587 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 587 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
588 | 588 | ||
589 | if (messageBox.exec() == QMessageBox::Yes) { | 589 | if (messageBox.exec() == QMessageBox::Yes) { |
590 | m_pDrawPadCanvas->deleteAll(); | 590 | m_pDrawPadCanvas->deleteAll(); |
591 | } | 591 | } |
592 | } | 592 | } |
593 | 593 | ||
594 | void DrawPad::importPage() | 594 | void DrawPad::importPage() |
595 | { | 595 | { |
596 | ImportDialog importDialog(this); | 596 | ImportDialog importDialog(this); |
597 | 597 | ||
598 | importDialog.showMaximized(); | 598 | importDialog.showMaximized(); |
599 | 599 | ||
600 | if (importDialog.exec() == QDialog::Accepted) { | 600 | if (importDialog.exec() == QDialog::Accepted) { |
601 | const DocLnk* docLnk = importDialog.selected(); | 601 | const DocLnk* docLnk = importDialog.selected(); |
602 | 602 | ||
603 | if (docLnk) { | 603 | if (docLnk) { |
604 | m_pDrawPadCanvas->importPage(docLnk->file()); | 604 | m_pDrawPadCanvas->importPage(docLnk->file()); |
605 | delete docLnk; | 605 | delete docLnk; |
606 | } | 606 | } |
607 | } | 607 | } |
608 | } | 608 | } |
609 | 609 | ||
610 | void DrawPad::exportPage() | 610 | void DrawPad::exportPage() |
611 | { | 611 | { |
612 | ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this); | 612 | ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this); |
613 | 613 | ||
614 | exportDialog.showMaximized(); | 614 | exportDialog.showMaximized(); |
615 | 615 | ||
616 | if (exportDialog.exec() == QDialog::Accepted) { | 616 | if (exportDialog.exec() == QDialog::Accepted) { |
617 | m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(), | 617 | m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(), |
618 | exportDialog.selectedName(), exportDialog.selectedFormat()); | 618 | exportDialog.selectedName(), exportDialog.selectedFormat()); |
619 | } | 619 | } |
620 | } | 620 | } |
621 | 621 | ||
622 | void DrawPad::thumbnailView() | 622 | void DrawPad::thumbnailView() |
623 | { | 623 | { |