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
This commit is contained in:
Uwe Stöhr 2009-09-21 00:44:43 +00:00
parent 2fb10659a8
commit cb71b8a8de
6 changed files with 93 additions and 49 deletions

View File

@ -243,7 +243,7 @@ void LyXRC::setDefaults()
index_command = "makeindex -c -q"; index_command = "makeindex -c -q";
nomencl_command = "makeindex -s nomencl.ist"; nomencl_command = "makeindex -s nomencl.ist";
dpi = 75; 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; zoom = 150;
allow_geometry_session = true; allow_geometry_session = true;
// Default LaTeX font size: // Default LaTeX font size:
@ -306,7 +306,7 @@ void LyXRC::setDefaults()
label_init_length = 3; label_init_length = 3;
preview = PREVIEW_OFF; preview = PREVIEW_OFF;
preview_hashed_labels = false; preview_hashed_labels = false;
preview_scale_factor = "0.9"; preview_scale_factor = 1.0;
use_converter_cache = true; use_converter_cache = true;
use_tooltip = true; use_tooltip = true;
use_pixmap_cache = false; use_pixmap_cache = false;

View File

@ -423,7 +423,7 @@ public:
/// ///
bool preview_hashed_labels; bool preview_hashed_labels;
/// ///
std::string preview_scale_factor; double preview_scale_factor;
/// user name /// user name
std::string user_name; std::string user_name;
/// user email /// user email

View File

@ -1071,7 +1071,21 @@ PrefDisplay::PrefDisplay(GuiPreferences * form)
setupUi(this); setupUi(this);
connect(displayGraphicsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); connect(displayGraphicsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed()));
connect(paragraphMarkerCB, SIGNAL(toggled(bool)), 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.display_graphics = displayGraphicsCB->isChecked();
rc.preview_scale_factor = previewSizeSB->value();
rc.paragraph_markers = paragraphMarkerCB->isChecked(); rc.paragraph_markers = paragraphMarkerCB->isChecked();
// FIXME!! The graphics cache no longer has a changeDisplay method. // 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); displayGraphicsCB->setChecked(rc.display_graphics);
instantPreviewCO->setEnabled(rc.display_graphics); instantPreviewCO->setEnabled(rc.display_graphics);
previewSizeSB->setValue(rc.preview_scale_factor);
paragraphMarkerCB->setChecked(rc.paragraph_markers); paragraphMarkerCB->setChecked(rc.paragraph_markers);
} }

View File

@ -281,6 +281,9 @@ public:
void apply(LyXRC & rc) const; void apply(LyXRC & rc) const;
void update(LyXRC const & rc); void update(LyXRC const & rc);
private Q_SLOTS:
void on_instantPreviewCO_currentIndexChanged(int);
}; };

View File

@ -5,7 +5,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>340</width> <width>356</width>
<height>133</height> <height>133</height>
</rect> </rect>
</property> </property>
@ -20,14 +20,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item rowspan="2" row="0" column="2" > <item row="0" column="4" rowspan="4">
<spacer> <spacer name="spacer_1">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>57</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -62,6 +62,44 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="2">
<widget class="QLabel" name="previewSizeLA">
<property name="text">
<string>Preview Si&amp;ze:</string>
</property>
<property name="buddy">
<cstring>instantPreviewCO</cstring>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="previewSizeSB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>factor for the preview size</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="paragraphMarkerCB"> <widget class="QCheckBox" name="paragraphMarkerCB">
<property name="text"> <property name="text">
@ -69,21 +107,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item rowspan="2" row="0" column="2" > <item row="3" column="0">
<spacer> <spacer name="spacer_2">
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2" >
<spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>

View File

@ -390,7 +390,7 @@ PreviewLoader::Impl::Impl(PreviewLoader & p, Buffer const & b)
: parent_(p), buffer_(b), font_scaling_factor_(0.0) : parent_(p), buffer_(b), font_scaling_factor_(0.0)
{ {
font_scaling_factor_ = 0.01 * lyxrc.dpi * lyxrc.zoom * font_scaling_factor_ = 0.01 * lyxrc.dpi * lyxrc.zoom *
convert<double>(lyxrc.preview_scale_factor); lyxrc.preview_scale_factor;
LYXERR(Debug::GRAPHICS, "The font scaling factor is " LYXERR(Debug::GRAPHICS, "The font scaling factor is "
<< font_scaling_factor_); << font_scaling_factor_);