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";
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;

View File

@ -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

View File

@ -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(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);
}

View File

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

View File

@ -1,96 +1,121 @@
<ui version="4.0" >
<class>PrefDisplayUi</class>
<widget class="QWidget" name="PrefDisplayUi" >
<property name="geometry" >
<widget class="QWidget" name="PrefDisplayUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<width>356</width>
<height>133</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="displayGraphicsCB" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="displayGraphicsCB">
<property name="text">
<string>Display &amp;Graphics</string>
</property>
</widget>
</item>
<item rowspan="2" row="0" column="2" >
<spacer>
<property name="orientation" >
<item row="0" column="4" rowspan="4">
<spacer name="spacer_1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>57</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="instantPreviewLA" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="instantPreviewLA">
<property name="text">
<string>Instant &amp;Preview:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>instantPreviewCO</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="instantPreviewCO" >
<item row="1" column="1">
<widget class="QComboBox" name="instantPreviewCO">
<item>
<property name="text" >
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>No math</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="paragraphMarkerCB" >
<property name="text" >
<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">
<widget class="QCheckBox" name="paragraphMarkerCB">
<property name="text">
<string>&amp;Mark end of paragraphs</string>
</property>
</widget>
</item>
<item rowspan="2" row="0" column="2" >
<spacer>
<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" >
<item row="3" column="0">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
@ -104,7 +129,7 @@
<tabstop>instantPreviewCO</tabstop>
</tabstops>
<includes>
<include location="local" >qt_i18n.h</include>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections/>

View File

@ -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<double>(lyxrc.preview_scale_factor);
lyxrc.preview_scale_factor;
LYXERR(Debug::GRAPHICS, "The font scaling factor is "
<< font_scaling_factor_);