From 33bb075fd8a5f8a6d1641416963d8d302abd597a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 2 Nov 2007 14:43:09 +0000 Subject: [PATCH] * 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 --- src/LyXRC.cpp | 18 ++ src/LyXRC.h | 3 + src/frontends/qt4/GuiPainter.cpp | 7 +- src/frontends/qt4/GuiPainter.h | 2 + src/frontends/qt4/GuiPrefs.cpp | 7 + src/frontends/qt4/ui/PrefUi.ui | 412 +++++++++++++++++++------------ 6 files changed, 285 insertions(+), 164 deletions(-) diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 79465326a0..c8cf673b3b 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -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(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; diff --git a/src/LyXRC.h b/src/LyXRC.h index 20eedd914d..e5c5958c1b 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -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 diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 16631003c0..57a5bd766e 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -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())); diff --git a/src/frontends/qt4/GuiPainter.h b/src/frontends/qt4/GuiPainter.h index aa4bfcacf9..06a8112898 100644 --- a/src/frontends/qt4/GuiPainter.h +++ b/src/frontends/qt4/GuiPainter.h @@ -117,6 +117,8 @@ private: Painter::line_style current_ls_; Painter::line_width current_lw_; /// + bool const use_pixmap_cache_; + /// std::stack monochrome_min_; /// std::stack monochrome_max_; diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 5074605bf7..7ebc2b381a 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -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 } diff --git a/src/frontends/qt4/ui/PrefUi.ui b/src/frontends/qt4/ui/PrefUi.ui index 4edfe17e82..a2522e0e01 100644 --- a/src/frontends/qt4/ui/PrefUi.ui +++ b/src/frontends/qt4/ui/PrefUi.ui @@ -6,13 +6,11 @@ 0 0 398 - 418 + 565 - - 1 - 1 + 0 0 @@ -21,148 +19,6 @@ - - 9 - - - 6 - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Scrolling - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - 9 - - - 6 - - - - - Cursor follows &scrollbar - - - - - - - - - - Documents - - - true - - - - 9 - - - 6 - - - - - 300 - - - 1 - - - - - - - B&ackup documents, every - - - - - - - minutes - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 0 - - - 6 - - - - - &Maximum last files: - - - lastfilesSB - - - - - - - 9 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - @@ -183,12 +39,10 @@ - + - - 5 - 5 + 0 0 @@ -200,10 +54,22 @@ true - + + 9 + + 9 - + + 9 + + + 9 + + + 6 + + 6 @@ -258,12 +124,21 @@ - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -295,12 +170,12 @@ false - - 9999 - 200 + + 9999 + 10 @@ -321,12 +196,12 @@ false - - 9999 - 200 + + 9999 + 10 @@ -353,6 +228,221 @@ + + + + Documents + + + true + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + 1 + + + 300 + + + + + + + B&ackup documents, every + + + + + + + minutes + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + &Maximum last files: + + + lastfilesSB + + + + + + + 9 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Scrolling + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + Cursor follows &scrollbar + + + + + + + + + + Pixmap Cache + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<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.</p></body></html> + + + Enable Pi&xmap Cache + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + -- 2.39.5