Fix UI glitch in the prefs dialog (bug 7190).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37081 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2011-01-03 17:21:22 +00:00
parent 02fb4a784e
commit f7334ebfdb
2 changed files with 21 additions and 11 deletions

View File

@ -1196,28 +1196,34 @@ PrefDisplay::PrefDisplay(GuiPreferences * form)
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(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) void PrefDisplay::on_instantPreviewCO_currentIndexChanged(int index)
{ {
if (index == 0) previewSizeSB->setEnabled(index != 0);
previewSizeSB->setEnabled(false); }
else
previewSizeSB->setEnabled(true);
void PrefDisplay::on_displayGraphicsCB_toggled(bool on)
{
instantPreviewCO->setEnabled(on);
previewSizeSB->setEnabled(on && instantPreviewCO->currentIndex() > 0);
} }
void PrefDisplay::apply(LyXRC & rc) const void PrefDisplay::apply(LyXRC & rc) const
{ {
switch (instantPreviewCO->currentIndex()) { switch (instantPreviewCO->currentIndex()) {
case 0: rc.preview = LyXRC::PREVIEW_OFF; break; case 0:
case 1: rc.preview = LyXRC::PREVIEW_NO_MATH; break; rc.preview = LyXRC::PREVIEW_OFF;
case 2: rc.preview = LyXRC::PREVIEW_ON; break; break;
case 1:
rc.preview = LyXRC::PREVIEW_NO_MATH;
break;
case 2:
rc.preview = LyXRC::PREVIEW_ON;
break;
} }
rc.display_graphics = displayGraphicsCB->isChecked(); rc.display_graphics = displayGraphicsCB->isChecked();
@ -1252,6 +1258,9 @@ void PrefDisplay::update(LyXRC const & rc)
instantPreviewCO->setEnabled(rc.display_graphics); instantPreviewCO->setEnabled(rc.display_graphics);
previewSizeSB->setValue(rc.preview_scale_factor); previewSizeSB->setValue(rc.preview_scale_factor);
paragraphMarkerCB->setChecked(rc.paragraph_markers); paragraphMarkerCB->setChecked(rc.paragraph_markers);
previewSizeSB->setEnabled(
rc.display_graphics
&& rc.preview != LyXRC::PREVIEW_OFF);
} }

View File

@ -281,6 +281,7 @@ public:
private Q_SLOTS: private Q_SLOTS:
void on_instantPreviewCO_currentIndexChanged(int); void on_instantPreviewCO_currentIndexChanged(int);
void on_displayGraphicsCB_toggled(bool);
}; };