Check for changes to modules before switching text classes. See the removed

FIXME for more.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26903 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-10-14 17:03:57 +00:00
parent c83ae83ebf
commit 9c95358b85

View File

@ -1354,12 +1354,22 @@ void GuiDocument::classChanged()
return; return;
} }
// FIXME We should really check here whether the modules have been // check whether the selected modules have changed.
// changed, I think, even if auto_reset_options is false. And, if so, bool modulesChanged = false;
// pop the same dialog. So we would need to compare what is in int const srows = selectedModel()->rowCount();
// modules_sel_model with what is in the OLD bp_.getModules() and if (srows != bp_.getModules().size())
// so do that before we reset things. modulesChanged = true;
if (lyxrc.auto_reset_options) { else {
list<string>::const_iterator mit = bp_.getModules().begin();
list<string>::const_iterator men = bp_.getModules().end();
for (int i = 0; i < srows && mit != men; ++i, ++mit)
if (selectedModel()->getIDString(i) != *mit) {
modulesChanged = true;
break;
}
}
if (modulesChanged || lyxrc.auto_reset_options) {
if (applyPB->isEnabled()) { if (applyPB->isEnabled()) {
int const ret = Alert::prompt(_("Unapplied changes"), int const ret = Alert::prompt(_("Unapplied changes"),
_("Some changes in the dialog were not yet applied.\n" _("Some changes in the dialog were not yet applied.\n"
@ -1368,6 +1378,7 @@ void GuiDocument::classChanged()
if (ret == 0) if (ret == 0)
applyView(); applyView();
} }
if (lyxrc.auto_reset_options)
bp_.useClassDefaults(); bp_.useClassDefaults();
} }
// With the introduction of modules came a distinction between the base // With the introduction of modules came a distinction between the base