[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kviewshell-0.7/kviewshell
From: Wilfried Huss <Wilfried.Huss () gmx ! at>
Date: 2006-06-22 20:26:09
Message-ID: 1151007969.849592.10682.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 553998 by whuss:
I should remember to always also test DVI-files that contain no
papersize-special.
This is only a temporary fix, because the code that handles paper sizes
needs a rewrite anyway.
M +6 -0 plugins/dvi/dviRenderer.cpp
M +5 -1 plugins/dvi/kdvi_multipage.cpp
M +2 -0 plugins/dvi/renderedDviPagePixmap.h
M +6 -1 shell/dataModel.cpp
M +19 -0 shell/dataModel.h
M +8 -13 shell/documentPageCache.cpp
M +0 -3 shell/documentPageCache.h
--- branches/work/kviewshell-0.7/kviewshell/plugins/dvi/dviRenderer.cpp #553997:553998
@@ -154,6 +154,12 @@
globalColor = Qt::black;
SimplePageSize ps = sizeOfPage(page->getPageNumber());
+ if (!ps.isValid())
+ {
+ RenderedDviPagePixmap* DVIpage = static_cast<RenderedDviPagePixmap*>(page);
+ ps = DVIpage->customPageSize;
+ }
+
int pageHeight = ps.sizeInPixel(resolution).height();
int pageWidth = ps.sizeInPixel(resolution).width();
page->resize(pageWidth, pageHeight);
--- branches/work/kviewshell-0.7/kviewshell/plugins/dvi/kdvi_multipage.cpp #553997:553998
@@ -404,8 +404,12 @@
RenderedDocumentPagePixmap* KDVIMultiPage::createDocumentPagePixmap(JobId id) const
{
- RenderedDocumentPagePixmap* page = new RenderedDviPagePixmap(id);
+ RenderedDviPagePixmap* page = new RenderedDviPagePixmap(id);
page->setupObservers(dataModel);
+
+ // Needed for DVI files without a papersize-special
+ page->customPageSize = dataModel->userPreferredPageSize();
+
return page;
}
--- branches/work/kviewshell-0.7/kviewshell/plugins/dvi/renderedDviPagePixmap.h #553997:553998
@@ -44,6 +44,8 @@
generated when the current page is drawn.
*/
QValueVector<Hyperlink> sourceHyperLinkList;
+
+ SimplePageSize customPageSize;
};
#endif
--- branches/work/kviewshell-0.7/kviewshell/shell/dataModel.cpp #553997:553998
@@ -30,8 +30,13 @@
DataModel::DataModel(QObject* parent)
: QObject(parent),
- _numberOfPages(0)
+ _numberOfPages(0),
+ _useCustomPageSize(false)
{
+ Length w,h;
+ w.setLength_in_mm(200);
+ h.setLength_in_mm(300);
+ _userPreferredPageSize.setPageSize(w,h);
}
--- branches/work/kviewshell-0.7/kviewshell/shell/dataModel.h #553997:553998
@@ -29,6 +29,7 @@
#include "history.h"
#include "kvsprefs.h"
#include "selection.h"
+#include "simplePageSize.h"
#include <klocale.h>
@@ -146,6 +147,17 @@
/** Copy the selected text into the clipboard. */
void copyText() const { selection.copyText(); }
+ /** @returns true if a user selected paper size is used instead of the size
+ that is specified in the document. */
+ bool useCustomPageSize() const { return _useCustomPageSize; }
+
+ void setUseCustomPageSize(bool customPageSize) { _useCustomPageSize = customPageSize; }
+
+ /** @returns the paper size that is used when useCustomPageSize() is true. */
+ SimplePageSize userPreferredPageSize() const { return _userPreferredPageSize; }
+
+ void setUserPreferredPageSize(SimplePageSize s) { _userPreferredPageSize = s; }
+
signals:
void currentPageNumberChanged();
void gotoCurrentPage();
@@ -199,6 +211,13 @@
// This holds the currently selected text.
TextSelection selection;
+ // True if a user selected paper size is used instead of the
+ // size that is specified in the document.
+ bool _useCustomPageSize;
+
+ // The paper size that is used when _useCustomPageSize is true.
+ SimplePageSize _userPreferredPageSize;
+
KVSPrefs prefs;
};
--- branches/work/kviewshell-0.7/kviewshell/shell/documentPageCache.cpp #553997:553998
@@ -36,11 +36,6 @@
renderThread = new RenderThread(renderQueue);
resolutionInDPI = 0.0;
- Length w,h;
- w.setLength_in_mm(200);
- h.setLength_in_mm(300);
- userPreferredSize.setPageSize(w,h);
- useDocumentSpecifiedSize = true;
renderThread->start();
}
@@ -90,8 +85,8 @@
}
SimplePageSize s = renderer->sizeOfPage(page);
- if (!useDocumentSpecifiedSize)
- s = userPreferredSize;
+ if (dataModel->useCustomPageSize())
+ s = dataModel->userPreferredPageSize();
if (!s.isValid())
{
@@ -99,7 +94,7 @@
// as an estimate.
s = renderer->sizeOfPage(1);
if (!s.isValid())
- s = userPreferredSize;
+ s = dataModel->userPreferredPageSize();
}
return s;
@@ -125,7 +120,7 @@
SimplePageSize ps = sizeOfPage(pg);
if (ps.isValid())
return ps.sizeInPixel(resolutionInDPI);
- return userPreferredSize.sizeInPixel(resolutionInDPI);
+ return dataModel->userPreferredPageSize().sizeInPixel(resolutionInDPI);
}
@@ -348,8 +343,8 @@
void DocumentPageCache::setUserPreferredSize(const SimplePageSize& s)
{
- bool sizeChanged = !userPreferredSize.isNearlyEqual(s);
- userPreferredSize = s;
+ bool sizeChanged = !dataModel->userPreferredPageSize().isNearlyEqual(s);
+ dataModel->setUserPreferredPageSize(s);
if (sizeChanged)
emit(paperSizeChanged());
@@ -358,9 +353,9 @@
void DocumentPageCache::setUseDocumentSpecifiedSize(bool b)
{
- bool valChanged = (useDocumentSpecifiedSize == b);
+ bool valChanged = (dataModel->useCustomPageSize() != b);
- useDocumentSpecifiedSize = b;
+ dataModel->setUseCustomPageSize(!b);
if (valChanged)
emit(paperSizeChanged());
}
--- branches/work/kviewshell-0.7/kviewshell/shell/documentPageCache.h #553997:553998
@@ -138,9 +138,6 @@
resolution to give a reasonable default value. */
double resolutionInDPI;
- SimplePageSize userPreferredSize;
- bool useDocumentSpecifiedSize;
-
/** This list holds the cache. */
QCache<RenderedDocumentPagePixmap> LRUCache;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic