-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 28 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 6 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 146 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.h | 6 | ||||
-rw-r--r-- | noncore/graphics/drawpad/erasetool.cpp | 8 | ||||
-rw-r--r-- | noncore/graphics/drawpad/filltool.cpp | 46 | ||||
-rw-r--r-- | noncore/graphics/drawpad/page.cpp | 60 | ||||
-rw-r--r-- | noncore/graphics/drawpad/page.h | 20 | ||||
-rw-r--r-- | noncore/graphics/drawpad/pageinformationdialog.cpp | 4 | ||||
-rw-r--r-- | noncore/graphics/drawpad/pointtool.cpp | 8 | ||||
-rw-r--r-- | noncore/graphics/drawpad/shapetool.cpp | 12 | ||||
-rw-r--r-- | noncore/graphics/drawpad/texttool.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.cpp | 6 |
13 files changed, 169 insertions, 187 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 4eb47a5..b0a414e 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -56,7 +56,5 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
56 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); | 56 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); |
57 | 57 | ||
58 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateNavigationToolButtons())); | 58 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); |
59 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateCaption())); | ||
60 | connect(m_pDrawPadCanvas, SIGNAL(pageBackupsChanged()), this, SLOT(updateUndoRedoToolButtons())); | ||
61 | 59 | ||
62 | setCentralWidget(m_pDrawPadCanvas); | 60 | setCentralWidget(m_pDrawPadCanvas); |
@@ -543,19 +541,5 @@ void DrawPad::changeBrushColor(const QColor& color) | |||
543 | } | 541 | } |
544 | 542 | ||
545 | void DrawPad::updateUndoRedoToolButtons() | 543 | void DrawPad::updateView() |
546 | { | ||
547 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->undoEnabled()); | ||
548 | m_pRedoAction->setEnabled(m_pDrawPadCanvas->redoEnabled()); | ||
549 | } | ||
550 | |||
551 | void DrawPad::updateNavigationToolButtons() | ||
552 | { | ||
553 | m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | ||
554 | m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | ||
555 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | ||
556 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | ||
557 | } | ||
558 | |||
559 | void DrawPad::updateCaption() | ||
560 | { | 544 | { |
561 | uint pagePosition = m_pDrawPadCanvas->pagePosition(); | 545 | uint pagePosition = m_pDrawPadCanvas->pagePosition(); |
@@ -564,4 +548,12 @@ void DrawPad::updateCaption() | |||
564 | setCaption(tr("DrawPad") + " - " + tr("Page") + " " | 548 | setCaption(tr("DrawPad") + " - " + tr("Page") + " " |
565 | + QString::number(pagePosition) + "/" + QString::number(pageCount)); | 549 | + QString::number(pagePosition) + "/" + QString::number(pageCount)); |
550 | |||
551 | m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); | ||
552 | m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled()); | ||
553 | |||
554 | m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | ||
555 | m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | ||
556 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | ||
557 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | ||
566 | } | 558 | } |
567 | 559 | ||
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index c57606c..7306228 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h | |||
@@ -60,8 +60,6 @@ private slots: | |||
60 | void changePenColor(const QColor& color); | 60 | void changePenColor(const QColor& color); |
61 | void changeBrushColor(const QColor& color); | 61 | void changeBrushColor(const QColor& color); |
62 | 62 | ||
63 | void updateUndoRedoToolButtons(); | 63 | void updateView(); |
64 | void updateNavigationToolButtons(); | ||
65 | void updateCaption(); | ||
66 | 64 | ||
67 | void deleteAll(); | 65 | void deleteAll(); |
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 05dd408..025bebb 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp | |||
@@ -29,6 +29,4 @@ | |||
29 | #include <qxml.h> | 29 | #include <qxml.h> |
30 | 30 | ||
31 | const int PAGE_BACKUPS = 99; | ||
32 | |||
33 | class DrawPadCanvasXmlHandler: public QXmlDefaultHandler | 31 | class DrawPadCanvasXmlHandler: public QXmlDefaultHandler |
34 | { | 32 | { |
@@ -150,5 +148,5 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch) | |||
150 | Page* page = new Page(m_title, image.width(), image.height()); | 148 | Page* page = new Page(m_title, image.width(), image.height()); |
151 | page->setLastModified(m_date); | 149 | page->setLastModified(m_date); |
152 | page->convertFromImage(image); | 150 | page->pixmap()->convertFromImage(image); |
153 | m_pages.append(page); | 151 | m_pages.append(page); |
154 | } | 152 | } |
@@ -162,5 +160,4 @@ DrawPadCanvas::DrawPadCanvas(DrawPad* drawPad, QWidget* parent, const char* name | |||
162 | m_pDrawPad = drawPad; | 160 | m_pDrawPad = drawPad; |
163 | m_pages.setAutoDelete(true); | 161 | m_pages.setAutoDelete(true); |
164 | m_pageBackups.setAutoDelete(true); | ||
165 | 162 | ||
166 | viewport()->setBackgroundMode(QWidget::NoBackground); | 163 | viewport()->setBackgroundMode(QWidget::NoBackground); |
@@ -187,15 +184,11 @@ void DrawPadCanvas::load(QIODevice* ioDevice) | |||
187 | if (m_pages.isEmpty()) { | 184 | if (m_pages.isEmpty()) { |
188 | m_pages.append(new Page("", contentsRect().size())); | 185 | m_pages.append(new Page("", contentsRect().size())); |
189 | m_pages.current()->fill(Qt::white); | 186 | m_pages.current()->pixmap()->fill(Qt::white); |
190 | } | 187 | } |
191 | 188 | ||
192 | m_pageBackups.clear(); | 189 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
193 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
194 | |||
195 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | ||
196 | viewport()->update(); | 190 | viewport()->update(); |
197 | 191 | ||
198 | emit pagesChanged(); | 192 | emit pagesChanged(); |
199 | emit pageBackupsChanged(); | ||
200 | } | 193 | } |
201 | 194 | ||
@@ -203,14 +196,10 @@ void DrawPadCanvas::initialPage() | |||
203 | { | 196 | { |
204 | m_pages.append(new Page("", 236, 232)); | 197 | m_pages.append(new Page("", 236, 232)); |
205 | m_pages.current()->fill(Qt::white); | 198 | m_pages.current()->pixmap()->fill(Qt::white); |
206 | |||
207 | m_pageBackups.clear(); | ||
208 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
209 | 199 | ||
210 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 200 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
211 | viewport()->update(); | 201 | viewport()->update(); |
212 | 202 | ||
213 | emit pagesChanged(); | 203 | emit pagesChanged(); |
214 | emit pageBackupsChanged(); | ||
215 | } | 204 | } |
216 | 205 | ||
@@ -228,9 +217,9 @@ void DrawPadCanvas::save(QIODevice* ioDevice) | |||
228 | textStream << " <image>" << endl; | 217 | textStream << " <image>" << endl; |
229 | textStream << " <title>" << bufferIterator.current()->title() << "</title>" << endl; | 218 | textStream << " <title>" << bufferIterator.current()->title() << "</title>" << endl; |
230 | 219 | ||
231 | int intDate = QDateTime(QDate(1970, 1, 1)).secsTo(bufferIterator.current()->lastModified()); | 220 | int intDate = QDateTime(QDate(1970, 1, 1)).secsTo(bufferIterator.current()->lastModified()); |
232 | textStream << " <date>" << intDate << "</date>" << endl; | 221 | textStream << " <date>" << intDate << "</date>" << endl; |
233 | 222 | ||
234 | QImage image = bufferIterator.current()->convertToImage(); | 223 | QImage image = bufferIterator.current()->pixmap()->convertToImage(); |
235 | QByteArray byteArray; | 224 | QByteArray byteArray; |
236 | QBuffer buffer(byteArray); | 225 | QBuffer buffer(byteArray); |
@@ -264,15 +253,11 @@ void DrawPadCanvas::importPage(const QString& fileName) | |||
264 | Page* importedPage = new Page(); | 253 | Page* importedPage = new Page(); |
265 | 254 | ||
266 | importedPage->load(fileName); | 255 | importedPage->pixmap()->load(fileName); |
267 | m_pages.insert(m_pages.at() + 1, importedPage); | 256 | m_pages.insert(m_pages.at() + 1, importedPage); |
268 | 257 | ||
269 | m_pageBackups.clear(); | 258 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
270 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
271 | |||
272 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | ||
273 | viewport()->update(); | 259 | viewport()->update(); |
274 | 260 | ||
275 | emit pagesChanged(); | 261 | emit pagesChanged(); |
276 | emit pageBackupsChanged(); | ||
277 | } | 262 | } |
278 | 263 | ||
@@ -290,5 +275,5 @@ void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,c | |||
290 | QImageIO imageIO(ioDevice, format); | 275 | QImageIO imageIO(ioDevice, format); |
291 | 276 | ||
292 | QImage image = m_pages.current()->convertToImage(); | 277 | QImage image = m_pages.current()->pixmap()->convertToImage(); |
293 | imageIO.setImage(image); | 278 | imageIO.setImage(image); |
294 | imageIO.write(); | 279 | imageIO.write(); |
@@ -306,5 +291,5 @@ void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,c | |||
306 | QImageIO imageIO(ioDevice, format); | 291 | QImageIO imageIO(ioDevice, format); |
307 | 292 | ||
308 | QImage image = m_pages.at(i - 1)->convertToImage(); | 293 | QImage image = m_pages.at(i - 1)->pixmap()->convertToImage(); |
309 | imageIO.setImage(image); | 294 | imageIO.setImage(image); |
310 | imageIO.write(); | 295 | imageIO.write(); |
@@ -337,43 +322,26 @@ void DrawPadCanvas::selectPage(Page* page) | |||
337 | { | 322 | { |
338 | m_pages.findRef(page); | 323 | m_pages.findRef(page); |
339 | m_pageBackups.clear(); | ||
340 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
341 | 324 | ||
342 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 325 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
343 | viewport()->update(); | 326 | viewport()->update(); |
344 | 327 | ||
345 | emit pagesChanged(); | 328 | emit pagesChanged(); |
346 | emit pageBackupsChanged(); | ||
347 | } | 329 | } |
348 | 330 | ||
349 | void DrawPadCanvas::selectPage(uint pagePosition) | 331 | void DrawPadCanvas::backupPage() |
350 | { | 332 | { |
351 | m_pages.at(pagePosition - 1); | 333 | m_pages.current()->backup(); |
352 | m_pageBackups.clear(); | ||
353 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
354 | |||
355 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | ||
356 | viewport()->update(); | ||
357 | 334 | ||
358 | emit pagesChanged(); | 335 | emit pagesChanged(); |
359 | emit pageBackupsChanged(); | ||
360 | } | 336 | } |
361 | 337 | ||
362 | void DrawPadCanvas::backupPage() | 338 | void DrawPadCanvas::selectPage(uint pagePosition) |
363 | { | 339 | { |
364 | m_pages.current()->setLastModified(QDateTime::currentDateTime()); | 340 | m_pages.at(pagePosition - 1); |
365 | |||
366 | Page* currentBackup = m_pageBackups.current(); | ||
367 | while (m_pageBackups.last() != currentBackup) { | ||
368 | m_pageBackups.removeLast(); | ||
369 | } | ||
370 | |||
371 | while (m_pageBackups.count() >= (PAGE_BACKUPS + 1)) { | ||
372 | m_pageBackups.removeFirst(); | ||
373 | } | ||
374 | 341 | ||
375 | m_pageBackups.append(new Page(*(m_pages.current()))); | 342 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
343 | viewport()->update(); | ||
376 | 344 | ||
377 | emit pageBackupsChanged(); | 345 | emit pagesChanged(); |
378 | } | 346 | } |
379 | 347 | ||
@@ -383,14 +351,10 @@ void DrawPadCanvas::deleteAll() | |||
383 | 351 | ||
384 | m_pages.append(new Page("", contentsRect().size())); | 352 | m_pages.append(new Page("", contentsRect().size())); |
385 | m_pages.current()->fill(Qt::white); | 353 | m_pages.current()->pixmap()->fill(Qt::white); |
386 | 354 | ||
387 | m_pageBackups.clear(); | 355 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
388 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
389 | |||
390 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | ||
391 | viewport()->update(); | 356 | viewport()->update(); |
392 | 357 | ||
393 | emit pagesChanged(); | 358 | emit pagesChanged(); |
394 | emit pageBackupsChanged(); | ||
395 | } | 359 | } |
396 | 360 | ||
@@ -398,27 +362,18 @@ void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor | |||
398 | { | 362 | { |
399 | m_pages.insert(m_pages.at() + 1, new Page(title, width, height)); | 363 | m_pages.insert(m_pages.at() + 1, new Page(title, width, height)); |
400 | m_pages.current()->fill(color); | 364 | m_pages.current()->pixmap()->fill(color); |
401 | |||
402 | m_pageBackups.clear(); | ||
403 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
404 | 365 | ||
405 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 366 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
406 | viewport()->update(); | 367 | viewport()->update(); |
407 | 368 | ||
408 | emit pagesChanged(); | 369 | emit pagesChanged(); |
409 | emit pageBackupsChanged(); | ||
410 | } | 370 | } |
411 | 371 | ||
412 | void DrawPadCanvas::clearPage() | 372 | void DrawPadCanvas::clearPage() |
413 | { | 373 | { |
414 | m_pages.current()->fill(Qt::white); | 374 | m_pages.current()->pixmap()->fill(Qt::white); |
415 | 375 | ||
416 | m_pageBackups.clear(); | 376 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
417 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
418 | |||
419 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | ||
420 | viewport()->update(); | 377 | viewport()->update(); |
421 | |||
422 | emit pageBackupsChanged(); | ||
423 | } | 378 | } |
424 | 379 | ||
@@ -429,15 +384,11 @@ void DrawPadCanvas::deletePage() | |||
429 | if (m_pages.isEmpty()) { | 384 | if (m_pages.isEmpty()) { |
430 | m_pages.append(new Page("", contentsRect().size())); | 385 | m_pages.append(new Page("", contentsRect().size())); |
431 | m_pages.current()->fill(Qt::white); | 386 | m_pages.current()->pixmap()->fill(Qt::white); |
432 | } | 387 | } |
433 | 388 | ||
434 | m_pageBackups.clear(); | 389 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
435 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
436 | |||
437 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | ||
438 | viewport()->update(); | 390 | viewport()->update(); |
439 | 391 | ||
440 | emit pagesChanged(); | 392 | emit pagesChanged(); |
441 | emit pageBackupsChanged(); | ||
442 | } | 393 | } |
443 | 394 | ||
@@ -460,14 +411,4 @@ void DrawPadCanvas::movePageDown() | |||
460 | } | 411 | } |
461 | 412 | ||
462 | bool DrawPadCanvas::undoEnabled() | ||
463 | { | ||
464 | return (m_pageBackups.current() != m_pageBackups.getFirst()); | ||
465 | } | ||
466 | |||
467 | bool DrawPadCanvas::redoEnabled() | ||
468 | { | ||
469 | return (m_pageBackups.current() != m_pageBackups.getLast()); | ||
470 | } | ||
471 | |||
472 | bool DrawPadCanvas::goPreviousPageEnabled() | 413 | bool DrawPadCanvas::goPreviousPageEnabled() |
473 | { | 414 | { |
@@ -482,18 +423,18 @@ bool DrawPadCanvas::goNextPageEnabled() | |||
482 | void DrawPadCanvas::undo() | 423 | void DrawPadCanvas::undo() |
483 | { | 424 | { |
484 | *(m_pages.current()) = *(m_pageBackups.prev()); | 425 | m_pages.current()->undo(); |
485 | 426 | ||
486 | viewport()->update(); | 427 | viewport()->update(); |
487 | 428 | ||
488 | emit pageBackupsChanged(); | 429 | emit pagesChanged(); |
489 | } | 430 | } |
490 | 431 | ||
491 | void DrawPadCanvas::redo() | 432 | void DrawPadCanvas::redo() |
492 | { | 433 | { |
493 | *(m_pages.current()) = *(m_pageBackups.next()); | 434 | m_pages.current()->redo(); |
494 | 435 | ||
495 | viewport()->update(); | 436 | viewport()->update(); |
496 | 437 | ||
497 | emit pageBackupsChanged(); | 438 | emit pagesChanged(); |
498 | } | 439 | } |
499 | 440 | ||
@@ -501,12 +442,9 @@ void DrawPadCanvas::goFirstPage() | |||
501 | { | 442 | { |
502 | m_pages.first(); | 443 | m_pages.first(); |
503 | m_pageBackups.clear(); | ||
504 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
505 | 444 | ||
506 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 445 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
507 | viewport()->update(); | 446 | viewport()->update(); |
508 | 447 | ||
509 | emit pagesChanged(); | 448 | emit pagesChanged(); |
510 | emit pageBackupsChanged(); | ||
511 | } | 449 | } |
512 | 450 | ||
@@ -514,12 +452,9 @@ void DrawPadCanvas::goPreviousPage() | |||
514 | { | 452 | { |
515 | m_pages.prev(); | 453 | m_pages.prev(); |
516 | m_pageBackups.clear(); | ||
517 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
518 | 454 | ||
519 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 455 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
520 | viewport()->update(); | 456 | viewport()->update(); |
521 | 457 | ||
522 | emit pagesChanged(); | 458 | emit pagesChanged(); |
523 | emit pageBackupsChanged(); | ||
524 | } | 459 | } |
525 | 460 | ||
@@ -527,12 +462,8 @@ void DrawPadCanvas::goNextPage() | |||
527 | { | 462 | { |
528 | m_pages.next(); | 463 | m_pages.next(); |
529 | m_pageBackups.clear(); | 464 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
530 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
531 | |||
532 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | ||
533 | viewport()->update(); | 465 | viewport()->update(); |
534 | 466 | ||
535 | emit pagesChanged(); | 467 | emit pagesChanged(); |
536 | emit pageBackupsChanged(); | ||
537 | } | 468 | } |
538 | 469 | ||
@@ -540,12 +471,9 @@ void DrawPadCanvas::goLastPage() | |||
540 | { | 471 | { |
541 | m_pages.last(); | 472 | m_pages.last(); |
542 | m_pageBackups.clear(); | ||
543 | m_pageBackups.append(new Page(*(m_pages.current()))); | ||
544 | 473 | ||
545 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 474 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
546 | viewport()->update(); | 475 | viewport()->update(); |
547 | 476 | ||
548 | emit pagesChanged(); | 477 | emit pagesChanged(); |
549 | emit pageBackupsChanged(); | ||
550 | } | 478 | } |
551 | 479 | ||
@@ -568,8 +496,8 @@ void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | |||
568 | { | 496 | { |
569 | QRect clipRect(cx, cy, cw, ch); | 497 | QRect clipRect(cx, cy, cw, ch); |
570 | QRect pixmapRect(0, 0, m_pages.current()->width(), m_pages.current()->height()); | 498 | QRect pixmapRect(0, 0, m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
571 | QRect drawRect = pixmapRect.intersect(clipRect); | 499 | QRect drawRect = pixmapRect.intersect(clipRect); |
572 | 500 | ||
573 | p->drawPixmap(drawRect.topLeft(), *(m_pages.current()), drawRect); | 501 | p->drawPixmap(drawRect.topLeft(), *(m_pages.current()->pixmap()), drawRect); |
574 | 502 | ||
575 | if (drawRect.right() < clipRect.right()) { | 503 | if (drawRect.right() < clipRect.right()) { |
diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h index 2283e5e..80a2a7e 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.h +++ b/noncore/graphics/drawpad/drawpadcanvas.h | |||
@@ -38,6 +38,4 @@ public: | |||
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(); | ||
41 | bool redoEnabled(); | ||
42 | bool goPreviousPageEnabled(); | 40 | bool goPreviousPageEnabled(); |
43 | bool goNextPageEnabled(); | 41 | bool goNextPageEnabled(); |
@@ -59,5 +57,5 @@ public slots: | |||
59 | void movePageUp(); | 57 | void movePageUp(); |
60 | void movePageDown(); | 58 | void movePageDown(); |
61 | 59 | ||
62 | void undo(); | 60 | void undo(); |
63 | void redo(); | 61 | void redo(); |
@@ -70,5 +68,4 @@ public slots: | |||
70 | signals: | 68 | signals: |
71 | void pagesChanged(); | 69 | void pagesChanged(); |
72 | void pageBackupsChanged(); | ||
73 | 70 | ||
74 | protected: | 71 | protected: |
@@ -81,5 +78,4 @@ private: | |||
81 | DrawPad* m_pDrawPad; | 78 | DrawPad* m_pDrawPad; |
82 | QList<Page> m_pages; | 79 | QList<Page> m_pages; |
83 | QList<Page> m_pageBackups; | ||
84 | }; | 80 | }; |
85 | 81 | ||
diff --git a/noncore/graphics/drawpad/erasetool.cpp b/noncore/graphics/drawpad/erasetool.cpp index f77e038..2326da5 100644 --- a/noncore/graphics/drawpad/erasetool.cpp +++ b/noncore/graphics/drawpad/erasetool.cpp | |||
@@ -33,4 +33,6 @@ EraseTool::~EraseTool() | |||
33 | void EraseTool::mousePressEvent(QMouseEvent* e) | 33 | void EraseTool::mousePressEvent(QMouseEvent* e) |
34 | { | 34 | { |
35 | m_pDrawPadCanvas->backupPage(); | ||
36 | |||
35 | m_mousePressed = true; | 37 | m_mousePressed = true; |
36 | m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); | 38 | m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); |
@@ -42,6 +44,4 @@ void EraseTool::mouseReleaseEvent(QMouseEvent* e) | |||
42 | 44 | ||
43 | m_mousePressed = false; | 45 | m_mousePressed = false; |
44 | |||
45 | m_pDrawPadCanvas->backupPage(); | ||
46 | } | 46 | } |
47 | 47 | ||
@@ -51,5 +51,5 @@ void EraseTool::mouseMoveEvent(QMouseEvent* e) | |||
51 | QPainter painter; | 51 | QPainter painter; |
52 | QPen pen(Qt::white, m_pDrawPad->pen().width()); | 52 | QPen pen(Qt::white, m_pDrawPad->pen().width()); |
53 | painter.begin(m_pDrawPadCanvas->currentPage()); | 53 | painter.begin(m_pDrawPadCanvas->currentPage()->pixmap()); |
54 | painter.setPen(pen); | 54 | painter.setPen(pen); |
55 | m_polyline[2] = m_polyline[1]; | 55 | m_polyline[2] = m_polyline[1]; |
@@ -70,5 +70,5 @@ void EraseTool::mouseMoveEvent(QMouseEvent* e) | |||
70 | 70 | ||
71 | bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), | 71 | bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), |
72 | m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); | 72 | m_pDrawPadCanvas->currentPage()->pixmap(), r.x(), r.y(), r.width(), r.height()); |
73 | 73 | ||
74 | m_pDrawPadCanvas->viewport()->update(viewportRect); | 74 | m_pDrawPadCanvas->viewport()->update(viewportRect); |
diff --git a/noncore/graphics/drawpad/filltool.cpp b/noncore/graphics/drawpad/filltool.cpp index 0177e1c..2a39d04 100644 --- a/noncore/graphics/drawpad/filltool.cpp +++ b/noncore/graphics/drawpad/filltool.cpp | |||
@@ -36,9 +36,11 @@ void FillTool::mousePressEvent(QMouseEvent* e) | |||
36 | int y = e->y(); | 36 | int y = e->y(); |
37 | 37 | ||
38 | m_image = m_pDrawPadCanvas->currentPage()->convertToImage(); | 38 | m_image = m_pDrawPadCanvas->currentPage()->pixmap()->convertToImage(); |
39 | m_fillRgb = m_pDrawPad->brush().color().rgb(); | 39 | m_fillRgb = m_pDrawPad->brush().color().rgb(); |
40 | m_oldRgb = m_image.pixel(x, y); | 40 | m_oldRgb = m_image.pixel(x, y); |
41 | 41 | ||
42 | if (m_oldRgb != m_fillRgb) { | 42 | if (m_oldRgb != m_fillRgb) { |
43 | m_pDrawPadCanvas->backupPage(); | ||
44 | |||
43 | if (m_pDrawPad->antiAliasing()) { | 45 | if (m_pDrawPad->antiAliasing()) { |
44 | m_mask.create(m_image.width(), m_image.height(), 8, 2); | 46 | m_mask.create(m_image.width(), m_image.height(), 8, 2); |
@@ -59,8 +61,6 @@ void FillTool::mousePressEvent(QMouseEvent* e) | |||
59 | } | 61 | } |
60 | 62 | ||
61 | m_pDrawPadCanvas->currentPage()->convertFromImage(m_image); | 63 | m_pDrawPadCanvas->currentPage()->pixmap()->convertFromImage(m_image); |
62 | m_pDrawPadCanvas->viewport()->update(); | 64 | m_pDrawPadCanvas->viewport()->update(); |
63 | |||
64 | m_pDrawPadCanvas->backupPage(); | ||
65 | } | 65 | } |
66 | } | 66 | } |
@@ -112,29 +112,29 @@ void FillTool::fillMaskLine(int x, int y) | |||
112 | if ((x >= 0) && (x < m_image.width()) && (y >= 0) && (y < m_image.height())) { | 112 | if ((x >= 0) && (x < m_image.width()) && (y >= 0) && (y < m_image.height())) { |
113 | if (m_mask.pixelIndex(x, y) == 0) { | 113 | if (m_mask.pixelIndex(x, y) == 0) { |
114 | if (rgbDistance(m_image.pixel(x, y), m_oldRgb) < FILL_THRESHOLD) { | 114 | if (rgbDistance(m_image.pixel(x, y), m_oldRgb) < FILL_THRESHOLD) { |
115 | int x1, x2; | 115 | int x1, x2; |
116 | 116 | ||
117 | x1 = x - 1; | 117 | x1 = x - 1; |
118 | x2 = x + 1; | 118 | x2 = x + 1; |
119 | 119 | ||
120 | while ((x1 >= 0) && (rgbDistance(m_image.pixel(x1, y), m_oldRgb) < FILL_THRESHOLD)) { | 120 | while ((x1 >= 0) && (rgbDistance(m_image.pixel(x1, y), m_oldRgb) < FILL_THRESHOLD)) { |
121 | x1--; | 121 | x1--; |
122 | } | 122 | } |
123 | 123 | ||
124 | while ((x2 < m_image.width()) && (rgbDistance(m_image.pixel(x2, y), m_oldRgb) < FILL_THRESHOLD)) { | 124 | while ((x2 < m_image.width()) && (rgbDistance(m_image.pixel(x2, y), m_oldRgb) < FILL_THRESHOLD)) { |
125 | x2++; | 125 | x2++; |
126 | } | 126 | } |
127 | 127 | ||
128 | for (int i = x1 + 1; i < x2; i++) { | 128 | for (int i = x1 + 1; i < x2; i++) { |
129 | m_mask.setPixel(i, y, 1); | 129 | m_mask.setPixel(i, y, 1); |
130 | } | 130 | } |
131 | 131 | ||
132 | for (int i = x1 + 1; i < x2; i++) { | 132 | for (int i = x1 + 1; i < x2; i++) { |
133 | fillMaskLine(i, y - 1); | 133 | fillMaskLine(i, y - 1); |
134 | } | 134 | } |
135 | 135 | ||
136 | for (int i = x1 + 1; i < x2; i++) { | 136 | for (int i = x1 + 1; i < x2; i++) { |
137 | fillMaskLine(i, y + 1); | 137 | fillMaskLine(i, y + 1); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | } | 140 | } |
diff --git a/noncore/graphics/drawpad/page.cpp b/noncore/graphics/drawpad/page.cpp index 601d1c3..fbf3d01 100644 --- a/noncore/graphics/drawpad/page.cpp +++ b/noncore/graphics/drawpad/page.cpp | |||
@@ -14,26 +14,39 @@ | |||
14 | #include "page.h" | 14 | #include "page.h" |
15 | 15 | ||
16 | const int PAGE_BACKUPS = 99; | ||
17 | |||
16 | Page::Page() | 18 | Page::Page() |
17 | : QPixmap() | ||
18 | { | 19 | { |
20 | m_title = ""; | ||
19 | m_lastModified = QDateTime::currentDateTime(); | 21 | m_lastModified = QDateTime::currentDateTime(); |
22 | m_pPixmap = new QPixmap(); | ||
23 | |||
24 | m_backHistory.setAutoDelete(true); | ||
25 | m_forwardHistory.setAutoDelete(true); | ||
20 | } | 26 | } |
21 | 27 | ||
22 | Page::Page(QString title, int w, int h) | 28 | Page::Page(QString title, int w, int h) |
23 | : QPixmap(w, h) | ||
24 | { | 29 | { |
25 | m_title = title; | 30 | m_title = title; |
26 | m_lastModified = QDateTime::currentDateTime(); | 31 | m_lastModified = QDateTime::currentDateTime(); |
32 | m_pPixmap = new QPixmap(w, h); | ||
33 | |||
34 | m_backHistory.setAutoDelete(true); | ||
35 | m_forwardHistory.setAutoDelete(true); | ||
27 | } | 36 | } |
28 | 37 | ||
29 | Page::Page(QString title, const QSize& size) | 38 | Page::Page(QString title, const QSize& size) |
30 | : QPixmap(size) | ||
31 | { | 39 | { |
32 | m_title = title; | 40 | m_title = title; |
33 | m_lastModified = QDateTime::currentDateTime(); | 41 | m_lastModified = QDateTime::currentDateTime(); |
42 | m_pPixmap = new QPixmap(size); | ||
43 | |||
44 | m_backHistory.setAutoDelete(true); | ||
45 | m_forwardHistory.setAutoDelete(true); | ||
34 | } | 46 | } |
35 | 47 | ||
36 | Page::~Page() | 48 | Page::~Page() |
37 | { | 49 | { |
50 | delete m_pPixmap; | ||
38 | } | 51 | } |
39 | 52 | ||
@@ -48,4 +61,10 @@ QDateTime Page::lastModified() const | |||
48 | } | 61 | } |
49 | 62 | ||
63 | QPixmap* Page::pixmap() const | ||
64 | |||
65 | { | ||
66 | return m_pPixmap; | ||
67 | } | ||
68 | |||
50 | void Page::setTitle(QString title) | 69 | void Page::setTitle(QString title) |
51 | { | 70 | { |
@@ -58,2 +77,37 @@ void Page::setLastModified(QDateTime lastModified) | |||
58 | } | 77 | } |
59 | 78 | ||
79 | bool Page::undoEnabled() | ||
80 | { | ||
81 | return (!m_backHistory.isEmpty()); | ||
82 | } | ||
83 | |||
84 | bool Page::redoEnabled() | ||
85 | { | ||
86 | return (!m_forwardHistory.isEmpty()); | ||
87 | } | ||
88 | |||
89 | void Page::backup() | ||
90 | { | ||
91 | setLastModified(QDateTime::currentDateTime()); | ||
92 | |||
93 | while (m_backHistory.count() >= (PAGE_BACKUPS + 1)) { | ||
94 | m_backHistory.removeFirst(); | ||
95 | } | ||
96 | |||
97 | m_backHistory.append(new QPixmap(*m_pPixmap)); | ||
98 | m_forwardHistory.clear(); | ||
99 | } | ||
100 | |||
101 | void Page::undo() | ||
102 | { | ||
103 | m_forwardHistory.append(new QPixmap(*m_pPixmap)); | ||
104 | m_pPixmap = new QPixmap(*(m_backHistory.last())); | ||
105 | m_backHistory.removeLast(); | ||
106 | } | ||
107 | |||
108 | void Page::redo() | ||
109 | { | ||
110 | m_backHistory.append(new QPixmap(*m_pPixmap)); | ||
111 | m_pPixmap = new QPixmap(*(m_forwardHistory.last())); | ||
112 | m_forwardHistory.removeLast(); | ||
113 | } | ||
diff --git a/noncore/graphics/drawpad/page.h b/noncore/graphics/drawpad/page.h index 20a37b5..8ce7bc9 100644 --- a/noncore/graphics/drawpad/page.h +++ b/noncore/graphics/drawpad/page.h | |||
@@ -15,9 +15,11 @@ | |||
15 | #define PAGE_H | 15 | #define PAGE_H |
16 | 16 | ||
17 | #include <qpixmap.h> | 17 | #include <qobject.h> |
18 | 18 | ||
19 | #include <qdatetime.h> | 19 | #include <qdatetime.h> |
20 | #include <qlist.h> | ||
21 | #include <qpixmap.h> | ||
20 | 22 | ||
21 | class Page : public QPixmap | 23 | class Page : public QObject |
22 | { | 24 | { |
23 | public: | 25 | public: |
@@ -27,14 +29,26 @@ public: | |||
27 | 29 | ||
28 | ~Page(); | 30 | ~Page(); |
29 | 31 | ||
30 | QString title() const; | 32 | QString title() const; |
31 | QDateTime lastModified() const; | 33 | QDateTime lastModified() const; |
34 | QPixmap* pixmap() const; | ||
32 | 35 | ||
33 | void setTitle(QString title); | 36 | void setTitle(QString title); |
34 | void setLastModified(QDateTime lastModified); | 37 | void setLastModified(QDateTime lastModified); |
35 | 38 | ||
39 | bool undoEnabled(); | ||
40 | bool redoEnabled(); | ||
41 | |||
42 | void backup(); | ||
43 | void undo(); | ||
44 | void redo(); | ||
45 | |||
36 | private: | 46 | private: |
37 | QString m_title; | 47 | QString m_title; |
38 | QDateTime m_lastModified; | 48 | QDateTime m_lastModified; |
49 | QPixmap* m_pPixmap; | ||
50 | |||
51 | QList<QPixmap> m_backHistory; | ||
52 | QList<QPixmap> m_forwardHistory; | ||
39 | }; | 53 | }; |
40 | 54 | ||
diff --git a/noncore/graphics/drawpad/pageinformationdialog.cpp b/noncore/graphics/drawpad/pageinformationdialog.cpp index c0d055e..cb14d73 100644 --- a/noncore/graphics/drawpad/pageinformationdialog.cpp +++ b/noncore/graphics/drawpad/pageinformationdialog.cpp | |||
@@ -44,8 +44,8 @@ PageInformationDialog::PageInformationDialog(Page* page, QWidget* parent, const | |||
44 | 44 | ||
45 | QLabel* widthLabel = new QLabel(tr("Width:"), sizeGroupBox); | 45 | QLabel* widthLabel = new QLabel(tr("Width:"), sizeGroupBox); |
46 | QLabel* widthValueLabel = new QLabel(QString::number(m_pPage->width()), sizeGroupBox); | 46 | QLabel* widthValueLabel = new QLabel(QString::number(m_pPage->pixmap()->width()), sizeGroupBox); |
47 | 47 | ||
48 | QLabel* heightLabel = new QLabel(tr("Height:"), sizeGroupBox); | 48 | QLabel* heightLabel = new QLabel(tr("Height:"), sizeGroupBox); |
49 | QLabel* heightValueLabel = new QLabel(QString::number(m_pPage->height()), sizeGroupBox); | 49 | QLabel* heightValueLabel = new QLabel(QString::number(m_pPage->pixmap()->height()), sizeGroupBox); |
50 | 50 | ||
51 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); | 51 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); |
diff --git a/noncore/graphics/drawpad/pointtool.cpp b/noncore/graphics/drawpad/pointtool.cpp index a4f846e..b9b52bc 100644 --- a/noncore/graphics/drawpad/pointtool.cpp +++ b/noncore/graphics/drawpad/pointtool.cpp | |||
@@ -34,4 +34,6 @@ PointTool::~PointTool() | |||
34 | void PointTool::mousePressEvent(QMouseEvent* e) | 34 | void PointTool::mousePressEvent(QMouseEvent* e) |
35 | { | 35 | { |
36 | m_pDrawPadCanvas->backupPage(); | ||
37 | |||
36 | m_mousePressed = true; | 38 | m_mousePressed = true; |
37 | m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); | 39 | m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); |
@@ -43,6 +45,4 @@ void PointTool::mouseReleaseEvent(QMouseEvent* e) | |||
43 | 45 | ||
44 | m_mousePressed = false; | 46 | m_mousePressed = false; |
45 | |||
46 | m_pDrawPadCanvas->backupPage(); | ||
47 | } | 47 | } |
48 | 48 | ||
@@ -62,5 +62,5 @@ void PointTool::mouseMoveEvent(QMouseEvent* e) | |||
62 | 62 | ||
63 | QPainter painter; | 63 | QPainter painter; |
64 | painter.begin(m_pDrawPadCanvas->currentPage()); | 64 | painter.begin(m_pDrawPadCanvas->currentPage()->pixmap()); |
65 | 65 | ||
66 | if (m_pDrawPad->antiAliasing()) { | 66 | if (m_pDrawPad->antiAliasing()) { |
@@ -105,5 +105,5 @@ void PointTool::mouseMoveEvent(QMouseEvent* e) | |||
105 | 105 | ||
106 | bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), | 106 | bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), |
107 | m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); | 107 | m_pDrawPadCanvas->currentPage()->pixmap(), r.x(), r.y(), r.width(), r.height()); |
108 | 108 | ||
109 | m_pDrawPadCanvas->viewport()->update(viewportRect); | 109 | m_pDrawPadCanvas->viewport()->update(viewportRect); |
diff --git a/noncore/graphics/drawpad/shapetool.cpp b/noncore/graphics/drawpad/shapetool.cpp index 8870a78..22e3dd6 100644 --- a/noncore/graphics/drawpad/shapetool.cpp +++ b/noncore/graphics/drawpad/shapetool.cpp | |||
@@ -33,4 +33,6 @@ ShapeTool::~ShapeTool() | |||
33 | void ShapeTool::mousePressEvent(QMouseEvent* e) | 33 | void ShapeTool::mousePressEvent(QMouseEvent* e) |
34 | { | 34 | { |
35 | m_pDrawPadCanvas->backupPage(); | ||
36 | |||
35 | m_mousePressed = true; | 37 | m_mousePressed = true; |
36 | m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); | 38 | m_polyline[2] = m_polyline[1] = m_polyline[0] = e->pos(); |
@@ -42,5 +44,5 @@ void ShapeTool::mouseReleaseEvent(QMouseEvent* e) | |||
42 | 44 | ||
43 | QPainter painter; | 45 | QPainter painter; |
44 | painter.begin(m_pDrawPadCanvas->currentPage()); | 46 | painter.begin(m_pDrawPadCanvas->currentPage()->pixmap()); |
45 | drawFinalShape(painter); | 47 | drawFinalShape(painter); |
46 | painter.end(); | 48 | painter.end(); |
@@ -57,11 +59,9 @@ void ShapeTool::mouseReleaseEvent(QMouseEvent* e) | |||
57 | 59 | ||
58 | bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), | 60 | bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), |
59 | m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); | 61 | m_pDrawPadCanvas->currentPage()->pixmap(), r.x(), r.y(), r.width(), r.height()); |
60 | 62 | ||
61 | m_pDrawPadCanvas->viewport()->update(viewportRect); | 63 | m_pDrawPadCanvas->viewport()->update(viewportRect); |
62 | 64 | ||
63 | m_mousePressed = false; | 65 | m_mousePressed = false; |
64 | |||
65 | m_pDrawPadCanvas->backupPage(); | ||
66 | } | 66 | } |
67 | 67 | ||
@@ -71,5 +71,5 @@ void ShapeTool::mouseMoveEvent(QMouseEvent* e) | |||
71 | m_polyline[0] = e->pos(); | 71 | m_polyline[0] = e->pos(); |
72 | QPainter painter; | 72 | QPainter painter; |
73 | painter.begin(m_pDrawPadCanvas->currentPage()); | 73 | painter.begin(m_pDrawPadCanvas->currentPage()->pixmap()); |
74 | drawTemporaryShape(painter); | 74 | drawTemporaryShape(painter); |
75 | painter.end(); | 75 | painter.end(); |
@@ -86,5 +86,5 @@ void ShapeTool::mouseMoveEvent(QMouseEvent* e) | |||
86 | 86 | ||
87 | bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), | 87 | bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), |
88 | m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); | 88 | m_pDrawPadCanvas->currentPage()->pixmap(), r.x(), r.y(), r.width(), r.height()); |
89 | 89 | ||
90 | m_pDrawPadCanvas->viewport()->update(viewportRect); | 90 | m_pDrawPadCanvas->viewport()->update(viewportRect); |
diff --git a/noncore/graphics/drawpad/texttool.cpp b/noncore/graphics/drawpad/texttool.cpp index 34c8a76..9037abd 100644 --- a/noncore/graphics/drawpad/texttool.cpp +++ b/noncore/graphics/drawpad/texttool.cpp | |||
@@ -57,6 +57,8 @@ void TextTool::mousePressEvent(QMouseEvent* e) | |||
57 | 57 | ||
58 | if (textToolDialog.exec() == QDialog::Accepted && !textToolDialog.text().isEmpty()) { | 58 | if (textToolDialog.exec() == QDialog::Accepted && !textToolDialog.text().isEmpty()) { |
59 | m_pDrawPadCanvas->backupPage(); | ||
60 | |||
59 | QPainter painter; | 61 | QPainter painter; |
60 | painter.begin(m_pDrawPadCanvas->currentPage()); | 62 | painter.begin(m_pDrawPadCanvas->currentPage()->pixmap()); |
61 | painter.setPen(m_pDrawPad->pen()); | 63 | painter.setPen(m_pDrawPad->pen()); |
62 | painter.drawText(e->x(), e->y(), textToolDialog.text()); | 64 | painter.drawText(e->x(), e->y(), textToolDialog.text()); |
@@ -64,6 +66,4 @@ void TextTool::mousePressEvent(QMouseEvent* e) | |||
64 | 66 | ||
65 | m_pDrawPadCanvas->viewport()->update(); | 67 | m_pDrawPadCanvas->viewport()->update(); |
66 | |||
67 | m_pDrawPadCanvas->backupPage(); | ||
68 | } | 68 | } |
69 | } | 69 | } |
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp index 14092bf..9b08ca2 100644 --- a/noncore/graphics/drawpad/thumbnailview.cpp +++ b/noncore/graphics/drawpad/thumbnailview.cpp | |||
@@ -36,5 +36,5 @@ PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) | |||
36 | m_pPage = page; | 36 | m_pPage = page; |
37 | 37 | ||
38 | QImage image = m_pPage->convertToImage(); | 38 | QImage image = m_pPage->pixmap()->convertToImage(); |
39 | 39 | ||
40 | int previewWidth = THUMBNAIL_SIZE; | 40 | int previewWidth = THUMBNAIL_SIZE; |
@@ -58,6 +58,6 @@ PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) | |||
58 | 58 | ||
59 | m_titleText = QObject::tr("Title:") + " " + m_pPage->title(); | 59 | m_titleText = QObject::tr("Title:") + " " + m_pPage->title(); |
60 | m_dimensionText = QObject::tr("Dimension:") + " " + QString::number(m_pPage->width()) | 60 | m_dimensionText = QObject::tr("Dimension:") + " " + QString::number(m_pPage->pixmap()->width()) |
61 | + "x" + QString::number(m_pPage->height()); | 61 | + "x" + QString::number(m_pPage->pixmap()->height()); |
62 | m_dateText = QObject::tr("Date:") + " " + dateTimeString(m_pPage->lastModified()); | 62 | m_dateText = QObject::tr("Date:") + " " + dateTimeString(m_pPage->lastModified()); |
63 | 63 | ||