-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 18 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.h | 2 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.cpp | 43 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.h | 11 |
4 files changed, 65 insertions, 9 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index c23ee34..bcb6877 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp | |||
@@ -390,64 +390,82 @@ void DrawPadCanvas::newPage(uint width, uint height, const QColor& color) | |||
390 | void DrawPadCanvas::clearPage() | 390 | void DrawPadCanvas::clearPage() |
391 | { | 391 | { |
392 | m_pages.current()->fill(Qt::white); | 392 | m_pages.current()->fill(Qt::white); |
393 | 393 | ||
394 | m_pageBackups.clear(); | 394 | m_pageBackups.clear(); |
395 | m_pageBackups.append(new Page(*(m_pages.current()))); | 395 | m_pageBackups.append(new Page(*(m_pages.current()))); |
396 | 396 | ||
397 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 397 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
398 | viewport()->update(); | 398 | viewport()->update(); |
399 | 399 | ||
400 | emit pageBackupsChanged(); | 400 | emit pageBackupsChanged(); |
401 | } | 401 | } |
402 | 402 | ||
403 | void DrawPadCanvas::deletePage() | 403 | void DrawPadCanvas::deletePage() |
404 | { | 404 | { |
405 | m_pages.remove(m_pages.current()); | 405 | m_pages.remove(m_pages.current()); |
406 | 406 | ||
407 | if (m_pages.isEmpty()) { | 407 | if (m_pages.isEmpty()) { |
408 | m_pages.append(new Page(contentsRect().size())); | 408 | m_pages.append(new Page(contentsRect().size())); |
409 | m_pages.current()->fill(Qt::white); | 409 | m_pages.current()->fill(Qt::white); |
410 | } | 410 | } |
411 | 411 | ||
412 | m_pageBackups.clear(); | 412 | m_pageBackups.clear(); |
413 | m_pageBackups.append(new Page(*(m_pages.current()))); | 413 | m_pageBackups.append(new Page(*(m_pages.current()))); |
414 | 414 | ||
415 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 415 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
416 | viewport()->update(); | 416 | viewport()->update(); |
417 | 417 | ||
418 | emit pagesChanged(); | 418 | emit pagesChanged(); |
419 | emit pageBackupsChanged(); | 419 | emit pageBackupsChanged(); |
420 | } | 420 | } |
421 | 421 | ||
422 | void DrawPadCanvas::movePageUp() | ||
423 | { | ||
424 | int index = m_pages.at(); | ||
425 | Page* page = m_pages.take(); | ||
426 | m_pages.insert(index - 1, page); | ||
427 | |||
428 | emit pagesChanged(); | ||
429 | } | ||
430 | |||
431 | void DrawPadCanvas::movePageDown() | ||
432 | { | ||
433 | int index = m_pages.at(); | ||
434 | Page* page = m_pages.take(); | ||
435 | m_pages.insert(index + 1, page); | ||
436 | |||
437 | emit pagesChanged(); | ||
438 | } | ||
439 | |||
422 | bool DrawPadCanvas::undoEnabled() | 440 | bool DrawPadCanvas::undoEnabled() |
423 | { | 441 | { |
424 | return (m_pageBackups.current() != m_pageBackups.getFirst()); | 442 | return (m_pageBackups.current() != m_pageBackups.getFirst()); |
425 | } | 443 | } |
426 | 444 | ||
427 | bool DrawPadCanvas::redoEnabled() | 445 | bool DrawPadCanvas::redoEnabled() |
428 | { | 446 | { |
429 | return (m_pageBackups.current() != m_pageBackups.getLast()); | 447 | return (m_pageBackups.current() != m_pageBackups.getLast()); |
430 | } | 448 | } |
431 | 449 | ||
432 | bool DrawPadCanvas::goPreviousPageEnabled() | 450 | bool DrawPadCanvas::goPreviousPageEnabled() |
433 | { | 451 | { |
434 | return (m_pages.current() != m_pages.getFirst()); | 452 | return (m_pages.current() != m_pages.getFirst()); |
435 | } | 453 | } |
436 | 454 | ||
437 | bool DrawPadCanvas::goNextPageEnabled() | 455 | bool DrawPadCanvas::goNextPageEnabled() |
438 | { | 456 | { |
439 | return (m_pages.current() != m_pages.getLast()); | 457 | return (m_pages.current() != m_pages.getLast()); |
440 | } | 458 | } |
441 | 459 | ||
442 | void DrawPadCanvas::undo() | 460 | void DrawPadCanvas::undo() |
443 | { | 461 | { |
444 | *(m_pages.current()) = *(m_pageBackups.prev()); | 462 | *(m_pages.current()) = *(m_pageBackups.prev()); |
445 | 463 | ||
446 | viewport()->update(); | 464 | viewport()->update(); |
447 | 465 | ||
448 | emit pageBackupsChanged(); | 466 | emit pageBackupsChanged(); |
449 | } | 467 | } |
450 | 468 | ||
451 | void DrawPadCanvas::redo() | 469 | void DrawPadCanvas::redo() |
452 | { | 470 | { |
453 | *(m_pages.current()) = *(m_pageBackups.next()); | 471 | *(m_pages.current()) = *(m_pageBackups.next()); |
diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h index d74d425..39cf752 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.h +++ b/noncore/graphics/drawpad/drawpadcanvas.h | |||
@@ -26,58 +26,60 @@ class DrawPadCanvas : public QScrollView | |||
26 | { | 26 | { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | 28 | ||
29 | public: | 29 | public: |
30 | DrawPadCanvas(DrawPad* drawPad, QWidget* parent = 0, const char* name = 0); | 30 | DrawPadCanvas(DrawPad* drawPad, QWidget* parent = 0, const char* name = 0); |
31 | ~DrawPadCanvas(); | 31 | ~DrawPadCanvas(); |
32 | 32 | ||
33 | void load(QIODevice* ioDevice); | 33 | void load(QIODevice* ioDevice); |
34 | void initialPage(); | 34 | void initialPage(); |
35 | void save(QIODevice* ioDevice); | 35 | void save(QIODevice* ioDevice); |
36 | 36 | ||
37 | void importPage(const QString& fileName); | 37 | void importPage(const QString& fileName); |
38 | void exportPage(uint fromPage, uint toPage, const QString& name, const QString& format); | 38 | void exportPage(uint fromPage, uint toPage, const QString& name, const QString& format); |
39 | 39 | ||
40 | bool undoEnabled(); | 40 | bool undoEnabled(); |
41 | bool redoEnabled(); | 41 | bool redoEnabled(); |
42 | bool goPreviousPageEnabled(); | 42 | bool goPreviousPageEnabled(); |
43 | bool goNextPageEnabled(); | 43 | bool goNextPageEnabled(); |
44 | 44 | ||
45 | Page* currentPage(); | 45 | Page* currentPage(); |
46 | QList<Page> pages(); | 46 | QList<Page> pages(); |
47 | uint pagePosition(); | 47 | uint pagePosition(); |
48 | uint pageCount(); | 48 | uint pageCount(); |
49 | 49 | ||
50 | void selectPage(Page* page); | 50 | void selectPage(Page* page); |
51 | void backupPage(); | 51 | void backupPage(); |
52 | 52 | ||
53 | public slots: | 53 | public slots: |
54 | void deleteAll(); | 54 | void deleteAll(); |
55 | void newPage(uint width, uint height, const QColor& color); | 55 | void newPage(uint width, uint height, const QColor& color); |
56 | void clearPage(); | 56 | void clearPage(); |
57 | void deletePage(); | 57 | void deletePage(); |
58 | void movePageUp(); | ||
59 | void movePageDown(); | ||
58 | 60 | ||
59 | void undo(); | 61 | void undo(); |
60 | void redo(); | 62 | void redo(); |
61 | 63 | ||
62 | void goFirstPage(); | 64 | void goFirstPage(); |
63 | void goPreviousPage(); | 65 | void goPreviousPage(); |
64 | void goNextPage(); | 66 | void goNextPage(); |
65 | void goLastPage(); | 67 | void goLastPage(); |
66 | 68 | ||
67 | signals: | 69 | signals: |
68 | void pagesChanged(); | 70 | void pagesChanged(); |
69 | void pageBackupsChanged(); | 71 | void pageBackupsChanged(); |
70 | 72 | ||
71 | protected: | 73 | protected: |
72 | void contentsMousePressEvent(QMouseEvent* e); | 74 | void contentsMousePressEvent(QMouseEvent* e); |
73 | void contentsMouseReleaseEvent(QMouseEvent* e); | 75 | void contentsMouseReleaseEvent(QMouseEvent* e); |
74 | void contentsMouseMoveEvent(QMouseEvent* e); | 76 | void contentsMouseMoveEvent(QMouseEvent* e); |
75 | void drawContents(QPainter* p, int cx, int cy, int cw, int ch); | 77 | void drawContents(QPainter* p, int cx, int cy, int cw, int ch); |
76 | 78 | ||
77 | private: | 79 | private: |
78 | DrawPad* m_pDrawPad; | 80 | DrawPad* m_pDrawPad; |
79 | QList<Page> m_pages; | 81 | QList<Page> m_pages; |
80 | QList<Page> m_pageBackups; | 82 | QList<Page> m_pageBackups; |
81 | }; | 83 | }; |
82 | 84 | ||
83 | #endif // DRAWPADCANVAS_H | 85 | #endif // DRAWPADCANVAS_H |
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp index 0c7934e..428e008 100644 --- a/noncore/graphics/drawpad/thumbnailview.cpp +++ b/noncore/graphics/drawpad/thumbnailview.cpp | |||
@@ -141,132 +141,159 @@ Page* PageListView::selected() const | |||
141 | } else { | 141 | } else { |
142 | page = NULL; | 142 | page = NULL; |
143 | } | 143 | } |
144 | 144 | ||
145 | return page; | 145 | return page; |
146 | } | 146 | } |
147 | 147 | ||
148 | ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) | 148 | ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) |
149 | : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel) | 149 | : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel) |
150 | { | 150 | { |
151 | inLoop = false; | 151 | inLoop = false; |
152 | 152 | ||
153 | m_pDrawPad = drawPad; | 153 | m_pDrawPad = drawPad; |
154 | m_pDrawPadCanvas = drawPadCanvas; | 154 | m_pDrawPadCanvas = drawPadCanvas; |
155 | 155 | ||
156 | setCaption(tr("DrawPad - Thumbnail View")); | 156 | setCaption(tr("DrawPad - Thumbnail View")); |
157 | 157 | ||
158 | QToolButton* newPageButton = new QToolButton(this); | 158 | QToolButton* newPageButton = new QToolButton(this); |
159 | newPageButton->setIconSet(Resource::loadIconSet("new")); | 159 | newPageButton->setIconSet(Resource::loadIconSet("new")); |
160 | newPageButton->setAutoRaise(true); | 160 | newPageButton->setAutoRaise(true); |
161 | connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage())); | 161 | connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage())); |
162 | 162 | ||
163 | QToolButton* clearPageButton = new QToolButton(this); | 163 | QToolButton* clearPageButton = new QToolButton(this); |
164 | clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear")); | 164 | clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear")); |
165 | clearPageButton->setAutoRaise(true); | 165 | clearPageButton->setAutoRaise(true); |
166 | connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage())); | 166 | connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage())); |
167 | 167 | ||
168 | QToolButton* deletePageButton = new QToolButton(this); | 168 | QToolButton* deletePageButton = new QToolButton(this); |
169 | deletePageButton->setIconSet(Resource::loadIconSet("trash")); | 169 | deletePageButton->setIconSet(Resource::loadIconSet("trash")); |
170 | deletePageButton->setAutoRaise(true); | 170 | deletePageButton->setAutoRaise(true); |
171 | connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); | 171 | connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); |
172 | 172 | ||
173 | QToolButton* movePageUpButton = new QToolButton(this); | 173 | m_pMovePageUpButton = new QToolButton(this); |
174 | movePageUpButton->setIconSet(Resource::loadIconSet("up")); | 174 | m_pMovePageUpButton->setIconSet(Resource::loadIconSet("up")); |
175 | movePageUpButton->setAutoRaise(true); | 175 | m_pMovePageUpButton->setAutoRaise(true); |
176 | connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp())); | ||
176 | 177 | ||
177 | QToolButton* movePageDownButton = new QToolButton(this); | 178 | m_pMovePageDownButton = new QToolButton(this); |
178 | movePageDownButton->setIconSet(Resource::loadIconSet("down")); | 179 | m_pMovePageDownButton->setIconSet(Resource::loadIconSet("down")); |
179 | movePageDownButton->setAutoRaise(true); | 180 | m_pMovePageDownButton->setAutoRaise(true); |
181 | connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown())); | ||
180 | 182 | ||
181 | m_pPageListView = new PageListView(m_pDrawPadCanvas, this); | 183 | m_pPageListView = new PageListView(m_pDrawPadCanvas, this); |
182 | connect(m_pPageListView, SIGNAL(selectionChanged()), this, SLOT(changePage())); | 184 | connect(m_pPageListView, SIGNAL(selectionChanged()), this, SLOT(changePage())); |
183 | 185 | ||
184 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); | 186 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); |
185 | QHBoxLayout* buttonLayout = new QHBoxLayout(0); | 187 | QHBoxLayout* buttonLayout = new QHBoxLayout(0); |
186 | 188 | ||
187 | buttonLayout->addWidget(newPageButton); | 189 | buttonLayout->addWidget(newPageButton); |
188 | buttonLayout->addWidget(clearPageButton); | 190 | buttonLayout->addWidget(clearPageButton); |
189 | buttonLayout->addWidget(deletePageButton); | 191 | buttonLayout->addWidget(deletePageButton); |
190 | buttonLayout->addStretch(); | 192 | buttonLayout->addStretch(); |
191 | buttonLayout->addWidget(movePageUpButton); | 193 | buttonLayout->addWidget(m_pMovePageUpButton); |
192 | buttonLayout->addWidget(movePageDownButton); | 194 | buttonLayout->addWidget(m_pMovePageDownButton); |
193 | 195 | ||
194 | mainLayout->addLayout(buttonLayout); | 196 | mainLayout->addLayout(buttonLayout); |
195 | mainLayout->addWidget(m_pPageListView); | 197 | mainLayout->addWidget(m_pPageListView); |
198 | |||
199 | updateView(); | ||
196 | } | 200 | } |
197 | 201 | ||
198 | ThumbnailView::~ThumbnailView() | 202 | ThumbnailView::~ThumbnailView() |
199 | { | 203 | { |
200 | hide(); | 204 | hide(); |
201 | } | 205 | } |
202 | 206 | ||
207 | void ThumbnailView::updateView() | ||
208 | { | ||
209 | m_pMovePageUpButton->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | ||
210 | m_pMovePageDownButton->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | ||
211 | } | ||
212 | |||
203 | void ThumbnailView::hide() | 213 | void ThumbnailView::hide() |
204 | { | 214 | { |
205 | QWidget::hide(); | 215 | QWidget::hide(); |
206 | 216 | ||
207 | if (inLoop) { | 217 | if (inLoop) { |
208 | inLoop = false; | 218 | inLoop = false; |
209 | qApp->exit_loop(); | 219 | qApp->exit_loop(); |
210 | } | 220 | } |
211 | } | 221 | } |
212 | 222 | ||
213 | void ThumbnailView::exec() | 223 | void ThumbnailView::exec() |
214 | { | 224 | { |
215 | show(); | 225 | show(); |
216 | 226 | ||
217 | if (!inLoop) { | 227 | if (!inLoop) { |
218 | inLoop = true; | 228 | inLoop = true; |
219 | qApp->enter_loop(); | 229 | qApp->enter_loop(); |
220 | } | 230 | } |
221 | } | 231 | } |
222 | 232 | ||
223 | void ThumbnailView::newPage() | 233 | void ThumbnailView::newPage() |
224 | { | 234 | { |
225 | QRect rect = m_pDrawPadCanvas->contentsRect(); | 235 | QRect rect = m_pDrawPadCanvas->contentsRect(); |
226 | 236 | ||
227 | NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(), | 237 | NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(), |
228 | m_pDrawPad->brush().color(), this); | 238 | m_pDrawPad->brush().color(), this); |
229 | 239 | ||
230 | if (newPageDialog.exec() == QDialog::Accepted) { | 240 | if (newPageDialog.exec() == QDialog::Accepted) { |
231 | m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), | 241 | m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), |
232 | newPageDialog.selectedColor()); | 242 | newPageDialog.selectedColor()); |
233 | m_pPageListView->updateView(); | 243 | m_pPageListView->updateView(); |
244 | updateView(); | ||
234 | } | 245 | } |
235 | } | 246 | } |
236 | 247 | ||
237 | void ThumbnailView::clearPage() | 248 | void ThumbnailView::clearPage() |
238 | { | 249 | { |
239 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe selected page?"), | 250 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe selected page?"), |
240 | QMessageBox::Information, QMessageBox::Yes, | 251 | QMessageBox::Information, QMessageBox::Yes, |
241 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 252 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
242 | QMessageBox::NoButton, this); | 253 | QMessageBox::NoButton, this); |
243 | 254 | ||
244 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 255 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
245 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 256 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
246 | 257 | ||
247 | if (messageBox.exec() == QMessageBox::Yes) { | 258 | if (messageBox.exec() == QMessageBox::Yes) { |
248 | m_pDrawPadCanvas->clearPage(); | 259 | m_pDrawPadCanvas->clearPage(); |
249 | m_pPageListView->updateView(); | 260 | m_pPageListView->updateView(); |
250 | } | 261 | } |
251 | } | 262 | } |
252 | 263 | ||
253 | void ThumbnailView::deletePage() | 264 | void ThumbnailView::deletePage() |
254 | { | 265 | { |
255 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe selected page?"), | 266 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe selected page?"), |
256 | QMessageBox::Information, QMessageBox::Yes, | 267 | QMessageBox::Information, QMessageBox::Yes, |
257 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 268 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
258 | QMessageBox::NoButton, this); | 269 | QMessageBox::NoButton, this); |
259 | 270 | ||
260 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 271 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
261 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 272 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
262 | 273 | ||
263 | if (messageBox.exec() == QMessageBox::Yes) { | 274 | if (messageBox.exec() == QMessageBox::Yes) { |
264 | m_pDrawPadCanvas->deletePage(); | 275 | m_pDrawPadCanvas->deletePage(); |
265 | m_pPageListView->updateView(); | 276 | m_pPageListView->updateView(); |
277 | updateView(); | ||
266 | } | 278 | } |
267 | } | 279 | } |
268 | 280 | ||
281 | void ThumbnailView::movePageUp() | ||
282 | { | ||
283 | m_pDrawPadCanvas->movePageUp(); | ||
284 | m_pPageListView->updateView(); | ||
285 | updateView(); | ||
286 | } | ||
287 | |||
288 | void ThumbnailView::movePageDown() | ||
289 | { | ||
290 | m_pDrawPadCanvas->movePageDown(); | ||
291 | m_pPageListView->updateView(); | ||
292 | updateView(); | ||
293 | } | ||
294 | |||
269 | void ThumbnailView::changePage() | 295 | void ThumbnailView::changePage() |
270 | { | 296 | { |
271 | m_pDrawPadCanvas->selectPage(m_pPageListView->selected()); | 297 | m_pDrawPadCanvas->selectPage(m_pPageListView->selected()); |
298 | updateView(); | ||
272 | } | 299 | } |
diff --git a/noncore/graphics/drawpad/thumbnailview.h b/noncore/graphics/drawpad/thumbnailview.h index 1fdb168..eb748fa 100644 --- a/noncore/graphics/drawpad/thumbnailview.h +++ b/noncore/graphics/drawpad/thumbnailview.h | |||
@@ -1,80 +1,89 @@ | |||
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 | #ifndef THUMBNAILVIEW_H | 14 | #ifndef THUMBNAILVIEW_H |
15 | #define THUMBNAILVIEW_H | 15 | #define THUMBNAILVIEW_H |
16 | 16 | ||
17 | #include <qwidget.h> | 17 | #include <qwidget.h> |
18 | #include <qlistview.h> | 18 | #include <qlistview.h> |
19 | 19 | ||
20 | class DrawPad; | 20 | class DrawPad; |
21 | class DrawPadCanvas; | 21 | class DrawPadCanvas; |
22 | class Page; | 22 | class Page; |
23 | 23 | ||
24 | class QToolButton; | ||
25 | |||
24 | class PageListViewItem : public QListViewItem | 26 | class PageListViewItem : public QListViewItem |
25 | { | 27 | { |
26 | public: | 28 | public: |
27 | PageListViewItem(Page* page, QListView* parent); | 29 | PageListViewItem(Page* page, QListView* parent); |
28 | ~PageListViewItem(); | 30 | ~PageListViewItem(); |
29 | 31 | ||
30 | Page* page() const; | 32 | Page* page() const; |
31 | 33 | ||
32 | private: | 34 | private: |
33 | Page* m_pPage; | 35 | Page* m_pPage; |
34 | }; | 36 | }; |
35 | 37 | ||
36 | class PageListView : public QListView | 38 | class PageListView : public QListView |
37 | { | 39 | { |
38 | public: | 40 | public: |
39 | PageListView(DrawPadCanvas* drawPadCanvas, QWidget* parent = 0, const char* name = 0); | 41 | PageListView(DrawPadCanvas* drawPadCanvas, QWidget* parent = 0, const char* name = 0); |
40 | ~PageListView(); | 42 | ~PageListView(); |
41 | 43 | ||
42 | void updateView(); | 44 | void updateView(); |
43 | 45 | ||
44 | void select(Page* page); | 46 | void select(Page* page); |
45 | Page* selected() const; | 47 | Page* selected() const; |
46 | 48 | ||
47 | protected: | 49 | protected: |
48 | void resizeEvent(QResizeEvent* e); | 50 | void resizeEvent(QResizeEvent* e); |
49 | 51 | ||
50 | private: | 52 | private: |
51 | DrawPadCanvas* m_pDrawPadCanvas; | 53 | DrawPadCanvas* m_pDrawPadCanvas; |
52 | }; | 54 | }; |
53 | 55 | ||
54 | class ThumbnailView : public QWidget | 56 | class ThumbnailView : public QWidget |
55 | { | 57 | { |
56 | Q_OBJECT | 58 | Q_OBJECT |
57 | 59 | ||
58 | public: | 60 | public: |
59 | ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent = 0, const char* name = 0); | 61 | ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent = 0, const char* name = 0); |
60 | ~ThumbnailView(); | 62 | ~ThumbnailView(); |
61 | 63 | ||
64 | void updateView(); | ||
65 | |||
62 | void hide(); | 66 | void hide(); |
63 | void exec(); | 67 | void exec(); |
64 | 68 | ||
65 | public slots: | 69 | public slots: |
66 | void newPage(); | 70 | void newPage(); |
67 | void clearPage(); | 71 | void clearPage(); |
68 | void deletePage(); | 72 | void deletePage(); |
73 | void movePageUp(); | ||
74 | void movePageDown(); | ||
69 | void changePage(); | 75 | void changePage(); |
70 | 76 | ||
71 | private: | 77 | private: |
72 | bool inLoop; | 78 | bool inLoop; |
73 | 79 | ||
74 | DrawPad* m_pDrawPad; | 80 | DrawPad* m_pDrawPad; |
75 | DrawPadCanvas* m_pDrawPadCanvas; | 81 | DrawPadCanvas* m_pDrawPadCanvas; |
76 | 82 | ||
83 | QToolButton* m_pMovePageUpButton; | ||
84 | QToolButton* m_pMovePageDownButton; | ||
85 | |||
77 | PageListView* m_pPageListView; | 86 | PageListView* m_pPageListView; |
78 | }; | 87 | }; |
79 | 88 | ||
80 | #endif // THUMBNAILVIEW_H | 89 | #endif // THUMBNAILVIEW_H |