mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-20 06:49:56 +00:00
Fix reloading of local layout file (bug #11120)
This commit is contained in:
parent
0964ffb266
commit
7822d11361
@ -2453,7 +2453,7 @@ void BufferParams::setDocumentClass(DocumentClassConstPtr tc)
|
||||
}
|
||||
|
||||
|
||||
bool BufferParams::setBaseClass(string const & classname)
|
||||
bool BufferParams::setBaseClass(string const & classname, string const & path)
|
||||
{
|
||||
LYXERR(Debug::TCLASS, "setBaseClass: " << classname);
|
||||
LayoutFileList & bcl = LayoutFileList::get();
|
||||
@ -2469,7 +2469,7 @@ bool BufferParams::setBaseClass(string const & classname)
|
||||
bcl.addEmptyClass(classname);
|
||||
}
|
||||
|
||||
bool const success = bcl[classname].load();
|
||||
bool const success = bcl[classname].load(path);
|
||||
if (!success) {
|
||||
docstring s =
|
||||
bformat(_("Due to some error in it, the layout file:\n"
|
||||
|
@ -136,7 +136,9 @@ public:
|
||||
/// NOTE: This does not call makeDocumentClass() to update the local
|
||||
/// DocumentClass. That needs to be done manually.
|
||||
/// \param classname: the name of the layout file
|
||||
bool setBaseClass(std::string const & classname);
|
||||
/// \param path: non-empty only for local layout files
|
||||
bool setBaseClass(std::string const & classname,
|
||||
std::string const & path = std::string());
|
||||
/// Adds the module information to the baseClass information to
|
||||
/// create our local DocumentClass.
|
||||
/// NOTE: This should NEVER be called externally unless one immediately goes
|
||||
|
@ -1366,7 +1366,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
// without calling recordUndo. Fix this before using
|
||||
// recordUndoBufferParams().
|
||||
cur.recordUndoFullBuffer();
|
||||
buffer_.params().setBaseClass(argument);
|
||||
buffer_.params().setBaseClass(argument, buffer_.layoutPos());
|
||||
makeDocumentClass();
|
||||
dr.screenUpdate(Update::Force);
|
||||
dr.forceBufferUpdate();
|
||||
@ -1390,7 +1390,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
case LFUN_LAYOUT_RELOAD: {
|
||||
LayoutFileIndex bc = buffer_.params().baseClassID();
|
||||
LayoutFileList::get().reset(bc);
|
||||
buffer_.params().setBaseClass(bc);
|
||||
buffer_.params().setBaseClass(bc, buffer_.layoutPos());
|
||||
makeDocumentClass();
|
||||
dr.screenUpdate(Update::Force);
|
||||
dr.forceBufferUpdate();
|
||||
|
@ -2555,7 +2555,7 @@ void GuiDocument::classChanged()
|
||||
// according to the new class. Note, however, that, if you use
|
||||
// the scroll wheel when sitting on the combo box, we'll load a
|
||||
// lot of TextClass objects very quickly....
|
||||
if (!bp_.setBaseClass(classname)) {
|
||||
if (!bp_.setBaseClass(classname, buffer().layoutPos())) {
|
||||
Alert::error(_("Error"), _("Unable to set document class."));
|
||||
return;
|
||||
}
|
||||
@ -2975,7 +2975,7 @@ void GuiDocument::updateDefaultFormat()
|
||||
int const idx = latexModule->classCO->currentIndex();
|
||||
if (idx >= 0) {
|
||||
string const classname = fromqstr(latexModule->classCO->getData(idx));
|
||||
param_copy.setBaseClass(classname);
|
||||
param_copy.setBaseClass(classname, buffer().layoutPos());
|
||||
param_copy.makeDocumentClass(true);
|
||||
}
|
||||
outputModule->defaultFormatCO->blockSignals(true);
|
||||
@ -3133,7 +3133,7 @@ void GuiDocument::applyView()
|
||||
int idx = latexModule->classCO->currentIndex();
|
||||
if (idx >= 0) {
|
||||
string const classname = fromqstr(latexModule->classCO->getData(idx));
|
||||
bp_.setBaseClass(classname);
|
||||
bp_.setBaseClass(classname, buffer().layoutPos());
|
||||
}
|
||||
|
||||
// Modules
|
||||
@ -4330,7 +4330,7 @@ void GuiDocument::useClassDefaults()
|
||||
|
||||
int idx = latexModule->classCO->currentIndex();
|
||||
string const classname = fromqstr(latexModule->classCO->getData(idx));
|
||||
if (!bp_.setBaseClass(classname)) {
|
||||
if (!bp_.setBaseClass(classname, buffer().layoutPos())) {
|
||||
Alert::error(_("Error"), _("Unable to set document class."));
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user