mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 11:52:25 +00:00
Fix bug 4594.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23376 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f2c06b5d9e
commit
ea2c38bbcc
@ -1242,7 +1242,20 @@ void GuiDocument::classChanged()
|
|||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
return;
|
return;
|
||||||
string const classname = classes_model_.getIDString(idx);
|
string const classname = classes_model_.getIDString(idx);
|
||||||
// FIXME There is a bug here: 4594
|
// check if this is a local layout file
|
||||||
|
if (prefixIs(classname, BaseClassList::localPrefix)) {
|
||||||
|
int const ret = Alert::prompt(_("Local layout file"),
|
||||||
|
_("The layout file you have selected is a local layout"
|
||||||
|
"file, not one in the system or user directory. Your"
|
||||||
|
"document may not work with this layout if you do not"
|
||||||
|
"keep the layout file in the same directory."),
|
||||||
|
1, 1, _("&Set Layout"), _("&Cancel"));
|
||||||
|
if (ret == 1) {
|
||||||
|
// try to reset the layout combo
|
||||||
|
setLayoutComboByIDString(bp_.baseClassID());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!bp_.setBaseClass(classname)) {
|
if (!bp_.setBaseClass(classname)) {
|
||||||
Alert::error(_("Error"), _("Unable to set document class."));
|
Alert::error(_("Error"), _("Unable to set document class."));
|
||||||
return;
|
return;
|
||||||
@ -1830,12 +1843,8 @@ void GuiDocument::updateParams(BufferParams const & params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// text layout
|
// text layout
|
||||||
string const & classname = params.baseClassID();
|
string const & layoutID = params.baseClassID();
|
||||||
int idx = classes_model_.findIDString(classname);
|
setLayoutComboByIDString(layoutID);
|
||||||
if (idx < 0)
|
|
||||||
lyxerr << "Unable to set layout for classname " << classname << std::endl;
|
|
||||||
else
|
|
||||||
latexModule->classCO->setCurrentIndex(idx);
|
|
||||||
|
|
||||||
updatePagestyle(documentClass().opt_pagestyle(),
|
updatePagestyle(documentClass().opt_pagestyle(),
|
||||||
params.pagestyle);
|
params.pagestyle);
|
||||||
@ -2094,6 +2103,17 @@ void GuiDocument::useClassDefaults()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiDocument::setLayoutComboByIDString(std::string const & idString)
|
||||||
|
{
|
||||||
|
int idx = classes_model_.findIDString(idString);
|
||||||
|
if (idx < 0)
|
||||||
|
Alert::warning(_("Can't set layout!"),
|
||||||
|
bformat(_("Unable to set layout for ID: %1$s"), from_utf8(idString)));
|
||||||
|
else
|
||||||
|
latexModule->classCO->setCurrentIndex(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GuiDocument::isValid()
|
bool GuiDocument::isValid()
|
||||||
{
|
{
|
||||||
return (validate_listings_params().empty() &&
|
return (validate_listings_params().empty() &&
|
||||||
|
@ -182,6 +182,8 @@ private:
|
|||||||
void saveDocDefault();
|
void saveDocDefault();
|
||||||
/// reset to default params
|
/// reset to default params
|
||||||
void useClassDefaults();
|
void useClassDefaults();
|
||||||
|
///
|
||||||
|
void setLayoutComboByIDString(std::string const & idString);
|
||||||
/// available classes
|
/// available classes
|
||||||
GuiIdListModel classes_model_;
|
GuiIdListModel classes_model_;
|
||||||
/// available modules
|
/// available modules
|
||||||
|
Loading…
Reference in New Issue
Block a user