Get rid of our custom anti-aliasing options and use the Document settings.

Also react correctly when they change, and a PS document is open.

svn path=/trunk/KDE/kdegraphics/okular/; revision=757659
This commit is contained in:
Pino Toscano 2008-01-05 16:14:43 +00:00
parent f238c3d95d
commit 056de06cf0
4 changed files with 26 additions and 32 deletions

View file

@ -5,14 +5,6 @@
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="okular-generator-ghostscriptrc"/>
<group name="General">
<entry name="GraphicsAntialiasing" type="Bool">
<label>Whether to use anti-aliasing for graphics.</label>
<whatsthis>Anti-aliasing makes the result look better, but it makes the display take longer</whatsthis>
</entry>
<entry name="TextAntialiasing" type="Bool">
<label>Whether to use anti-aliasing for graphics.</label>
<whatsthis>Anti-aliasing makes the result look better, but it makes the display take longer</whatsthis>
</entry>
<entry name="PlatformFonts" type="Bool">
<label>Use Platform Fonts</label>
<whatsthis>Determines whether Ghostscript should be allowed to use platform fonts, if false only usage of fonts embedded in the document will be allowed</whatsthis>

View file

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>328</width>
<height>131</height>
<height>73</height>
</rect>
</property>
<layout class="QVBoxLayout" >
@ -28,26 +28,6 @@
<string>General Settings</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="kcfg_TextAntialiasing" >
<property name="whatsThis" >
<string>Anti-aliasing makes the result look better, but it makes the display take longer</string>
</property>
<property name="text" >
<string>&amp;Enable anti-aliasing of fonts</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_GraphicsAntialiasing" >
<property name="whatsThis" >
<string>Anti-aliasing makes the result look better, but it makes the display take longer</string>
</property>
<property name="text" >
<string>&amp;Enable anti-aliasing of graphics</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_PlatformFonts" >
<property name="enabled" >

View file

@ -70,7 +70,23 @@ GSGenerator::~GSGenerator()
bool GSGenerator::reparseConfig()
{
return false;
bool changed = false;
if (m_internalDocument)
{
#define SET_HINT(hintname, hintdefvalue, hintvar) \
{ \
bool newhint = documentMetaData(hintname, hintdefvalue).toBool(); \
if (newhint != cache_##hintvar) \
{ \
cache_##hintvar = newhint; \
changed = true; \
} \
}
SET_HINT("GraphicsAntialias", true, AAgfx)
SET_HINT("TextAntialias", true, AAtext)
#undef SET_HINT
}
return changed;
}
void GSGenerator::addPages( KConfigDialog *dlg )
@ -135,6 +151,9 @@ bool GSGenerator::print( QPrinter& printer )
bool GSGenerator::loadDocument( const QString & fileName, QVector< Okular::Page * > & pagesVector )
{
cache_AAtext = documentMetaData("TextAntialias", true).toBool();
cache_AAgfx = documentMetaData("GraphicsAntialias", true).toBool();
m_internalDocument = spectre_document_new();
spectre_document_load(m_internalDocument, QFile::encodeName(fileName));
pagesVector.resize( spectre_document_get_n_pages(m_internalDocument) );
@ -197,8 +216,8 @@ void GSGenerator::generatePixmap( Okular::PixmapRequest * req )
renderer->setPlatformFonts(GSSettings::platformFonts());
int graphicsAA = 1;
int textAA = 1;
if (GSSettings::graphicsAntialiasing()) graphicsAA = 4;
if (GSSettings::textAntialiasing()) textAA = 2;
if (cache_AAgfx) graphicsAA = 4;
if (cache_AAtext) textAA = 2;
renderer->setAABits(graphicsAA, textAA);
renderer->setRotation( req->page()->orientation() * 90 );

View file

@ -62,6 +62,9 @@ class GSGenerator : public Okular::Generator, public Okular::ConfigInterface, pu
Okular::DocumentInfo *m_docInfo;
Okular::PixmapRequest *m_request;
bool cache_AAtext;
bool cache_AAgfx;
};
#endif