mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
Load local textclass in addTextClass(), reload local layout correctly in LFUN_TEXTCLASS_APPLY and LFUN_TEXTCLASS_LOAD
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@23199 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
bfa4f6b0f4
commit
94b2999e9e
@ -787,7 +787,7 @@ void showPrintError(string const & name)
|
||||
}
|
||||
|
||||
|
||||
void loadTextclass(string const & name)
|
||||
void loadTextclass(string const & name, string const & buf_path)
|
||||
{
|
||||
std::pair<bool, textclass_type> const tc_pair =
|
||||
textclasslist.numberOfClass(name);
|
||||
@ -801,7 +801,7 @@ void loadTextclass(string const & name)
|
||||
|
||||
textclass_type const tc = tc_pair.second;
|
||||
|
||||
if (!textclasslist[tc].load()) {
|
||||
if (!textclasslist[tc].load(buf_path)) {
|
||||
docstring s = bformat(_("The document could not be converted\n"
|
||||
"into the document class %1$s."),
|
||||
from_utf8(textclasslist[tc].name()));
|
||||
@ -1762,7 +1762,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
textclass_type const old_class =
|
||||
buffer->params().textclass;
|
||||
|
||||
loadTextclass(argument);
|
||||
loadTextclass(argument, buffer->filePath());
|
||||
|
||||
std::pair<bool, textclass_type> const tc_pair =
|
||||
textclasslist.numberOfClass(argument);
|
||||
@ -1793,7 +1793,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_TEXTCLASS_LOAD:
|
||||
loadTextclass(argument);
|
||||
loadTextclass(argument, lyx_view_->buffer()->filePath());
|
||||
break;
|
||||
|
||||
case LFUN_LYXRC_APPLY: {
|
||||
|
@ -990,6 +990,8 @@ string const & TextClass::name() const
|
||||
|
||||
string const & TextClass::latexname() const
|
||||
{
|
||||
// No buffer path information is needed here because on-demand layout files
|
||||
// have already been loaded, and no path is needed for system layouts.
|
||||
const_cast<TextClass*>(this)->load();
|
||||
return latexname_;
|
||||
}
|
||||
|
@ -155,6 +155,8 @@ bool TextClassList::read()
|
||||
// fname, clname, desc, and avail
|
||||
TextClass tmpl(fname, clname, desc, avail);
|
||||
if (lyxerr.debugging(Debug::TCLASS)) {
|
||||
// only system layout files are loaded here so no
|
||||
// buffer path is needed.
|
||||
tmpl.load();
|
||||
}
|
||||
classlist_.push_back(tmpl);
|
||||
@ -214,6 +216,10 @@ TextClassList::addTextClass(std::string const & textclass, std::string const & p
|
||||
if (pp.first && classlist_[pp.second].description() == tmpl.description())
|
||||
return pp;
|
||||
classlist_.push_back(tmpl);
|
||||
// This textclass is added on request so it will definitely be
|
||||
// used. Load it now because other load() calls may fail if they
|
||||
// are called in a context without buffer path information.
|
||||
classlist_.back().load(path);
|
||||
return make_pair(true, classlist_.size() - 1);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ What's new
|
||||
|
||||
* DOCUMENT INPUT/OUTPUT
|
||||
|
||||
- Stop warning messages when a local layout file is opened. Fix bugs caused by
|
||||
incorrect reloading of local layout files.
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user