author | kergoth <kergoth> | 2003-08-09 16:24:58 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 16:24:58 (UTC) |
commit | e16d333ec2e8509fc665921ca106c25325bae9e0 (patch) (unidiff) | |
tree | 9e9068190a15bc9b2a52ab33b40881128f732c0e /noncore/graphics/drawpad/drawpadcanvas.cpp | |
parent | 1c58d1407f9584fedcdae390a04e2b37e5853361 (diff) | |
download | opie-e16d333ec2e8509fc665921ca106c25325bae9e0.zip opie-e16d333ec2e8509fc665921ca106c25325bae9e0.tar.gz opie-e16d333ec2e8509fc665921ca106c25325bae9e0.tar.bz2 |
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 025bebb..dec498b 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp | |||
@@ -173,37 +173,43 @@ void DrawPadCanvas::load(QIODevice* ioDevice) | |||
173 | textStream.setCodec(QTextCodec::codecForName("UTF-8")); | 173 | textStream.setCodec(QTextCodec::codecForName("UTF-8")); |
174 | 174 | ||
175 | QXmlInputSource xmlInputSource(textStream); | 175 | QXmlInputSource xmlInputSource(textStream); |
176 | QXmlSimpleReader xmlSimpleReader; | 176 | QXmlSimpleReader xmlSimpleReader; |
177 | DrawPadCanvasXmlHandler drawPadCanvasXmlHandler; | 177 | DrawPadCanvasXmlHandler drawPadCanvasXmlHandler; |
178 | 178 | ||
179 | xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler); | 179 | xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler); |
180 | xmlSimpleReader.parse(xmlInputSource); | 180 | xmlSimpleReader.parse(xmlInputSource); |
181 | 181 | ||
182 | m_pages = drawPadCanvasXmlHandler.pages(); | 182 | m_pages = drawPadCanvasXmlHandler.pages(); |
183 | 183 | ||
184 | if (m_pages.isEmpty()) { | 184 | if (m_pages.isEmpty()) { |
185 | m_pages.append(new Page("", contentsRect().size())); | 185 | m_pages.append(new Page("", |
186 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), | ||
187 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); | ||
186 | m_pages.current()->pixmap()->fill(Qt::white); | 188 | m_pages.current()->pixmap()->fill(Qt::white); |
187 | } | 189 | } |
188 | 190 | ||
189 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); | 191 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
190 | viewport()->update(); | 192 | viewport()->update(); |
191 | 193 | ||
192 | emit pagesChanged(); | 194 | emit pagesChanged(); |
193 | } | 195 | } |
194 | 196 | ||
195 | void DrawPadCanvas::initialPage() | 197 | void DrawPadCanvas::initialPage() |
196 | { | 198 | { |
197 | m_pages.append(new Page("", 236, 232)); | 199 | m_pages.append(new Page("", |
200 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), | ||
201 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); | ||
202 | //236, 232)); no more fixed sizes | ||
203 | |||
198 | m_pages.current()->pixmap()->fill(Qt::white); | 204 | m_pages.current()->pixmap()->fill(Qt::white); |
199 | 205 | ||
200 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); | 206 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
201 | viewport()->update(); | 207 | viewport()->update(); |
202 | 208 | ||
203 | emit pagesChanged(); | 209 | emit pagesChanged(); |
204 | } | 210 | } |
205 | 211 | ||
206 | void DrawPadCanvas::save(QIODevice* ioDevice) | 212 | void DrawPadCanvas::save(QIODevice* ioDevice) |
207 | { | 213 | { |
208 | QTextStream textStream(ioDevice); | 214 | QTextStream textStream(ioDevice); |
209 | textStream.setCodec(QTextCodec::codecForName("UTF-8")); | 215 | textStream.setCodec(QTextCodec::codecForName("UTF-8")); |
@@ -340,25 +346,28 @@ void DrawPadCanvas::selectPage(uint pagePosition) | |||
340 | m_pages.at(pagePosition - 1); | 346 | m_pages.at(pagePosition - 1); |
341 | 347 | ||
342 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); | 348 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
343 | viewport()->update(); | 349 | viewport()->update(); |
344 | 350 | ||
345 | emit pagesChanged(); | 351 | emit pagesChanged(); |
346 | } | 352 | } |
347 | 353 | ||
348 | void DrawPadCanvas::deleteAll() | 354 | void DrawPadCanvas::deleteAll() |
349 | { | 355 | { |
350 | m_pages.clear(); | 356 | m_pages.clear(); |
351 | 357 | ||
352 | m_pages.append(new Page("", contentsRect().size())); | 358 | m_pages.append(new Page("", |
359 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), | ||
360 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); | ||
361 | |||
353 | m_pages.current()->pixmap()->fill(Qt::white); | 362 | m_pages.current()->pixmap()->fill(Qt::white); |
354 | 363 | ||
355 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); | 364 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
356 | viewport()->update(); | 365 | viewport()->update(); |
357 | 366 | ||
358 | emit pagesChanged(); | 367 | emit pagesChanged(); |
359 | } | 368 | } |
360 | 369 | ||
361 | void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color) | 370 | void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color) |
362 | { | 371 | { |
363 | m_pages.insert(m_pages.at() + 1, new Page(title, width, height)); | 372 | m_pages.insert(m_pages.at() + 1, new Page(title, width, height)); |
364 | m_pages.current()->pixmap()->fill(color); | 373 | m_pages.current()->pixmap()->fill(color); |
@@ -373,25 +382,28 @@ void DrawPadCanvas::clearPage() | |||
373 | { | 382 | { |
374 | m_pages.current()->pixmap()->fill(Qt::white); | 383 | m_pages.current()->pixmap()->fill(Qt::white); |
375 | 384 | ||
376 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); | 385 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
377 | viewport()->update(); | 386 | viewport()->update(); |
378 | } | 387 | } |
379 | 388 | ||
380 | void DrawPadCanvas::deletePage() | 389 | void DrawPadCanvas::deletePage() |
381 | { | 390 | { |
382 | m_pages.remove(m_pages.current()); | 391 | m_pages.remove(m_pages.current()); |
383 | 392 | ||
384 | if (m_pages.isEmpty()) { | 393 | if (m_pages.isEmpty()) { |
385 | m_pages.append(new Page("", contentsRect().size())); | 394 | m_pages.append(new Page("", |
395 | clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), | ||
396 | clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); | ||
397 | |||
386 | m_pages.current()->pixmap()->fill(Qt::white); | 398 | m_pages.current()->pixmap()->fill(Qt::white); |
387 | } | 399 | } |
388 | 400 | ||
389 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); | 401 | resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); |
390 | viewport()->update(); | 402 | viewport()->update(); |
391 | 403 | ||
392 | emit pagesChanged(); | 404 | emit pagesChanged(); |
393 | } | 405 | } |
394 | 406 | ||
395 | void DrawPadCanvas::movePageUp() | 407 | void DrawPadCanvas::movePageUp() |
396 | { | 408 | { |
397 | int index = m_pages.at(); | 409 | int index = m_pages.at(); |