* src/LyXRC.{cpp,h}:

- new RC_USE_PIXMAP_CACHE
* src/frontends/qt4/GuiPainter.{cpp,h}:
	- use rc.use_pixmap_cache
* src/frontends/qt4/GuiPrefs.cpp:
* src/frontends/qt4/ui/QPref.ui:
	- implement rc.use_pixmap_cache

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21372 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-11-02 14:43:09 +00:00
parent 16441a6914
commit 33bb075fd8
6 changed files with 285 additions and 164 deletions

View File

@ -165,6 +165,7 @@ keyword_item lyxrcTags[] = {
{ "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
{ "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
{ "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
{ "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
// compatibility with versions older than 1.4.0 only
{ "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
{ "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
@ -280,6 +281,7 @@ void LyXRC::setDefaults() {
preview_hashed_labels = false;
preview_scale_factor = "0.9";
use_converter_cache = true;
use_pixmap_cache = false;
converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
user_name = to_utf8(support::user_name());
@ -901,6 +903,11 @@ int LyXRC::read(Lexer & lexrc)
isp_use_pers_dict = lexrc.getBool();
}
break;
case RC_USE_PIXMAP_CACHE:
if (lexrc.next()) {
use_pixmap_cache = lexrc.getBool();
}
break;
case RC_USE_ESC_CHARS:
if (lexrc.next()) {
isp_use_esc_chars = lexrc.getBool();
@ -2064,6 +2071,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
}
if (tag != RC_LAST)
break;
case RC_USE_PIXMAP_CACHE:
if (ignore_system_lyxrc ||
use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
os << "\\use_pixmap_cache "
<< convert<string>(use_pixmap_cache)
<< '\n';
}
case RC_PERS_DICT:
if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
string const path = os::external_path(isp_pers_dict);
@ -2498,6 +2512,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
break;
case RC_USE_PIXMAP_CACHE:
str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
break;
case RC_PREVIEW:
str = _("Shows a typeset preview of things such as math");
break;

View File

@ -138,6 +138,7 @@ public:
RC_USE_ESC_CHARS,
RC_USE_INP_ENC,
RC_USE_PERS_DICT,
RC_USE_PIXMAP_CACHE,
RC_USE_SPELL_LIB,
RC_VIEWDVI_PAPEROPTION,
RC_VIEWER,
@ -291,6 +292,8 @@ public:
bool isp_use_alt_lang;
/// Use personal dictionary?
bool isp_use_pers_dict;
/// Use pixmap cache?
bool use_pixmap_cache;
/// Use escape chars?
bool isp_use_esc_chars;
/// Alternate language for ispell

View File

@ -22,6 +22,7 @@
#include "debug.h"
#include "Language.h"
#include "LyXRC.h"
#include "support/unicode.h"
@ -44,12 +45,12 @@ namespace frontend {
namespace {
bool const usePixmapCache = USE_PIXMAP_CACHE;
} // anon namespace
GuiPainter::GuiPainter(QPaintDevice * device)
: QPainter(device), Painter()
: QPainter(device), Painter(),
use_pixmap_cache_(lyxrc.use_pixmap_cache && USE_PIXMAP_CACHE)
{
// new QPainter has default QPen:
current_color_ = guiApp->colorCache().get(Color_black);
@ -359,7 +360,7 @@ int GuiPainter::text(int x, int y, docstring const & s,
return textwidth;
}
if (!usePixmapCache) {
if (!use_pixmap_cache_) {
// don't use the pixmap cache,
// draw directly onto the painting device
setQPainterPen(computeColor(f.realColor()));

View File

@ -117,6 +117,8 @@ private:
Painter::line_style current_ls_;
Painter::line_width current_lw_;
///
bool const use_pixmap_cache_;
///
std::stack<QColor> monochrome_min_;
///
std::stack<QColor> monochrome_max_;

View File

@ -1625,6 +1625,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent)
this, SIGNAL(changed()));
connect(lastfilesSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(pixmapCacheCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
lastfilesSB->setMaximum(maxlastfiles);
}
@ -1646,6 +1648,7 @@ void PrefUserInterface::apply(LyXRC & rc) const
rc.autosave = autoSaveSB->value() * 60;
rc.make_backup = autoSaveCB->isChecked();
rc.num_lastfiles = lastfilesSB->value();
rc.use_pixmap_cache = pixmapCacheCB->isChecked();
}
@ -1669,6 +1672,10 @@ void PrefUserInterface::update(LyXRC const & rc)
autoSaveSB->setValue(mins);
autoSaveCB->setChecked(rc.make_backup);
lastfilesSB->setValue(rc.num_lastfiles);
pixmapCacheCB->setChecked(rc.use_pixmap_cache);
#if (QT_VERSION < 0x040200) || defined(Q_WS_X11)
pixmapCacheGB->setEnabled(false);
#endif
}

View File

@ -6,13 +6,11 @@
<x>0</x>
<y>0</y>
<width>398</width>
<height>418</height>
<height>565</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -21,148 +19,6 @@
<string/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="5" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="3" >
<widget class="QGroupBox" name="scrollGB" >
<property name="title" >
<string>Scrolling</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="cursorFollowsCB" >
<property name="text" >
<string>Cursor follows &amp;scrollbar</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="3" >
<widget class="QGroupBox" name="documentsGB" >
<property name="title" >
<string>Documents</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QSpinBox" name="autoSaveSB" >
<property name="maximum" >
<number>300</number>
</property>
<property name="minimum" >
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QCheckBox" name="autoSaveCB" >
<property name="text" >
<string>B&amp;ackup documents, every</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="TextLabel1" >
<property name="text" >
<string>minutes</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="4" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lastfilesLA" >
<property name="text" >
<string>&amp;Maximum last files:</string>
</property>
<property name="buddy" >
<cstring>lastfilesSB</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="lastfilesSB" >
<property name="maximum" >
<number>9</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="uiFileLA" >
<property name="text" >
@ -183,12 +39,10 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="3" >
<item row="1" column="0" colspan="3" >
<widget class="QGroupBox" name="GeometryGB" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -200,10 +54,22 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" colspan="2" >
@ -258,12 +124,21 @@
</item>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
@ -295,12 +170,12 @@
<property name="enabled" >
<bool>false</bool>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="minimum" >
<number>200</number>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="singleStep" >
<number>10</number>
</property>
@ -321,12 +196,12 @@
<property name="enabled" >
<bool>false</bool>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="minimum" >
<number>200</number>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="singleStep" >
<number>10</number>
</property>
@ -353,6 +228,221 @@
</layout>
</widget>
</item>
<item row="2" column="0" colspan="3" >
<widget class="QGroupBox" name="documentsGB" >
<property name="title" >
<string>Documents</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QSpinBox" name="autoSaveSB" >
<property name="minimum" >
<number>1</number>
</property>
<property name="maximum" >
<number>300</number>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QCheckBox" name="autoSaveCB" >
<property name="text" >
<string>B&amp;ackup documents, every</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="TextLabel1" >
<property name="text" >
<string>minutes</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="4" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lastfilesLA" >
<property name="text" >
<string>&amp;Maximum last files:</string>
</property>
<property name="buddy" >
<cstring>lastfilesSB</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="lastfilesSB" >
<property name="maximum" >
<number>9</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="3" >
<widget class="QGroupBox" name="scrollGB" >
<property name="title" >
<string>Scrolling</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="cursorFollowsCB" >
<property name="text" >
<string>Cursor follows &amp;scrollbar</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="3" >
<widget class="QGroupBox" name="pixmapCacheGB" >
<property name="title" >
<string>Pixmap Cache</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="pixmapCacheCB" >
<property name="toolTip" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Checking this improves performance, but might decrease the on-screen quality of fonts.&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="text" >
<string>Enable Pi&amp;xmap Cache</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>