include ui support from Angus

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6812 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-04-15 02:28:53 +00:00
parent 84640bc0f2
commit 807682efd3
2 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2003-04-15 John Levon <levon@movementarian.org>
From Angus Leeming
* lyx_main.C: handle Include in .ui files
2003-04-15 John Levon <levon@movementarian.org>
* MenuBackend.C: make the doc files length shorter

View File

@ -673,14 +673,29 @@ void LyX::readUIFile(string const & name)
enum Uitags {
ui_menuset = 1,
ui_toolbar,
ui_include,
ui_last
};
struct keyword_item uitags[ui_last - 1] = {
{ "include", ui_include },
{ "menuset", ui_menuset },
{ "toolbar", ui_toolbar }
};
// Ensure that a file is read only once (prevents include loops)
static std::list<string> uifiles;
std::list<string>::const_iterator it = uifiles.begin();
std::list<string>::const_iterator end = uifiles.end();
it = std::find(it, end, name);
if (it != end) {
lyxerr[Debug::INIT] << "UI file '" << name
<< "' has been read already. "
<< "Is this an include loop?"
<< endl;
return;
}
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
string const ui_path = LibFileSearch("ui", name, "ui");
@ -690,6 +705,7 @@ void LyX::readUIFile(string const & name)
showFileError(name);
return;
}
uifiles.push_back(name);
lyxerr[Debug::INIT] << "Found " << name
<< " in " << ui_path << endl;
@ -705,6 +721,12 @@ void LyX::readUIFile(string const & name)
while (lex.isOK()) {
switch (lex.lex()) {
case ui_include: {
lex.next(true);
string const file = lex.getString();
readUIFile(file);
break;
}
case ui_menuset:
menubackend.read(lex);
break;