* GuiLayoutBox: fix initial readonly disabled state and small cleanups.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22845 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-07 16:46:19 +00:00
parent b0349fd8ed
commit fadf8ba12e

View File

@ -307,7 +307,6 @@ void GuiLayoutBox::updateContents(bool reset)
return; return;
} }
setEnabled(true);
TextClass const * text_class = &buffer->params().getTextClass(); TextClass const * text_class = &buffer->params().getTextClass();
if (!reset && text_class_ == text_class) { if (!reset && text_class_ == text_class) {
set(owner_.view()->cursor().innerParagraph().layout()->name()); set(owner_.view()->cursor().innerParagraph().layout()->name());
@ -316,23 +315,20 @@ void GuiLayoutBox::updateContents(bool reset)
text_class_ = text_class; text_class_ = text_class;
setUpdatesEnabled(false);
clear(); clear();
TextClass::const_iterator it = text_class_->begin(); TextClass::const_iterator it = text_class_->begin();
TextClass::const_iterator const end = text_class_->end(); TextClass::const_iterator const end = text_class_->end();
for (; it != end; ++it) for (; it != end; ++it)
addItemSort(toqstr(translateIfPossible((*it)->name())), lyxrc.sort_layouts); addItemSort(toqstr(translateIfPossible((*it)->name())), lyxrc.sort_layouts);
setCurrentIndex(0); set(owner_.view()->cursor().innerParagraph().layout()->name());
// needed to recalculate size hint // needed to recalculate size hint
hide(); hide();
setMinimumWidth(sizeHint().width()); setMinimumWidth(sizeHint().width());
set(owner_.view()->cursor().innerParagraph().layout()->name());
show();
setUpdatesEnabled(true); setEnabled(!buffer->isReadonly());
show();
} }