From cb71b8a8de69187c06d5b7f87ecfb4dc8b8715d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 21 Sep 2009 00:44:43 +0000 Subject: [PATCH] GuiPrefs: - implement an UI to specify the size of InstantPreview images - change the default size to 1.0 because we've got many complaints that the former default size of 0.9 was too low Both changes fix #6176. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31425 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyXRC.cpp | 4 +- src/LyXRC.h | 2 +- src/frontends/qt4/GuiPrefs.cpp | 18 +++- src/frontends/qt4/GuiPrefs.h | 3 + src/frontends/qt4/ui/PrefDisplayUi.ui | 113 ++++++++++++++++---------- src/graphics/PreviewLoader.cpp | 2 +- 6 files changed, 93 insertions(+), 49 deletions(-) diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 1d9b11054b..b9dde4187b 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -243,7 +243,7 @@ void LyXRC::setDefaults() index_command = "makeindex -c -q"; nomencl_command = "makeindex -s nomencl.ist"; dpi = 75; - // Because a screen typically is wider than a piece of paper: + // Because a screen is typically wider than a piece of paper: zoom = 150; allow_geometry_session = true; // Default LaTeX font size: @@ -306,7 +306,7 @@ void LyXRC::setDefaults() label_init_length = 3; preview = PREVIEW_OFF; preview_hashed_labels = false; - preview_scale_factor = "0.9"; + preview_scale_factor = 1.0; use_converter_cache = true; use_tooltip = true; use_pixmap_cache = false; diff --git a/src/LyXRC.h b/src/LyXRC.h index 4468af9387..b80b08b778 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -423,7 +423,7 @@ public: /// bool preview_hashed_labels; /// - std::string preview_scale_factor; + double preview_scale_factor; /// user name std::string user_name; /// user email diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 241c70b20d..5b78e76874 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1071,7 +1071,21 @@ PrefDisplay::PrefDisplay(GuiPreferences * form) setupUi(this); connect(displayGraphicsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed())); - connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed())); + connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + if (instantPreviewCO->currentIndex() == 0) + previewSizeSB->setEnabled(false); + else + previewSizeSB->setEnabled(true); +} + + +void PrefDisplay::on_instantPreviewCO_currentIndexChanged(int index) +{ + if (index == 0) + previewSizeSB->setEnabled(false); + else + previewSizeSB->setEnabled(true); } @@ -1084,6 +1098,7 @@ void PrefDisplay::apply(LyXRC & rc) const } rc.display_graphics = displayGraphicsCB->isChecked(); + rc.preview_scale_factor = previewSizeSB->value(); rc.paragraph_markers = paragraphMarkerCB->isChecked(); // FIXME!! The graphics cache no longer has a changeDisplay method. @@ -1112,6 +1127,7 @@ void PrefDisplay::update(LyXRC const & rc) displayGraphicsCB->setChecked(rc.display_graphics); instantPreviewCO->setEnabled(rc.display_graphics); + previewSizeSB->setValue(rc.preview_scale_factor); paragraphMarkerCB->setChecked(rc.paragraph_markers); } diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 1c39119584..ecb2e06f97 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -281,6 +281,9 @@ public: void apply(LyXRC & rc) const; void update(LyXRC const & rc); + +private Q_SLOTS: + void on_instantPreviewCO_currentIndexChanged(int); }; diff --git a/src/frontends/qt4/ui/PrefDisplayUi.ui b/src/frontends/qt4/ui/PrefDisplayUi.ui index fce5417a41..9bc9caa62f 100644 --- a/src/frontends/qt4/ui/PrefDisplayUi.ui +++ b/src/frontends/qt4/ui/PrefDisplayUi.ui @@ -1,96 +1,121 @@ PrefDisplayUi - - + + 0 0 - 340 + 356 133 - + - - - - + + + + Display &Graphics - - - + + + Qt::Horizontal - + - 40 + 57 20 - - - + + + Instant &Preview: - + instantPreviewCO - - + + - + Off - + No math - + On - - - + + + + Preview Si&ze: + + + instantPreviewCO + + + + + + + + 0 + 0 + + + + factor for the preview size + + + 1 + + + 0.100000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + &Mark end of paragraphs - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - + + + Qt::Vertical - + QSizePolicy::Expanding - + 20 20 @@ -104,7 +129,7 @@ instantPreviewCO - qt_i18n.h + qt_i18n.h diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 91018f7d26..82893ed11c 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -390,7 +390,7 @@ PreviewLoader::Impl::Impl(PreviewLoader & p, Buffer const & b) : parent_(p), buffer_(b), font_scaling_factor_(0.0) { font_scaling_factor_ = 0.01 * lyxrc.dpi * lyxrc.zoom * - convert(lyxrc.preview_scale_factor); + lyxrc.preview_scale_factor; LYXERR(Debug::GRAPHICS, "The font scaling factor is " << font_scaling_factor_);