Generate an error dialog if there are unknown layouts.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_1_6@2251 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-07-16 14:51:33 +00:00
parent 43474a59b4
commit 56c61c66ea
2 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2001-07-16 Dekel Tsur <dekelts@tau.ac.il>
* src/buffer.C (parseSingleLyXformat2Token): Generate error insets
for unknown layouts.
2001-07-13 Dekel Tsur <dekelts@tau.ac.il>
* src/buffer.C (readLyXformat2): Generate an error dialog if there are
unknown layouts.
2001-07-06 Dekel Tsur <dekelts@tau.ac.il>
* lib/layouts/IEEEtran.layout: Add qed box at the end of proof.

View File

@ -238,6 +238,7 @@ void Buffer::setFileName(string const & newfile)
updateTitles();
}
int unknown_layouts;
// candidate for move to BufferView
// (at least some parts in the beginning of the func)
@ -249,6 +250,7 @@ void Buffer::setFileName(string const & newfile)
// Returns false if "\the_end" is not read for formats >= 2.13. (Asger)
bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
{
unknown_layouts = 0;
int pos = 0;
char depth = 0; // signed or unsigned?
#ifndef NEW_INSETS
@ -314,7 +316,18 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
return_par = par;
paragraph = return_par;
if (unknown_layouts > 0) {
string s = _("Couldn't set the layout for ");
if (unknown_layouts == 1) {
s += _("one paragraph");
} else {
s += tostr(unknown_layouts);
s += _(" paragraphs");
}
WriteAlert(_("Textclass Loading Error!"),s);
}
return the_end_read;
}
@ -365,6 +378,12 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
} else { // layout not found
// use default layout "Standard" (0)
par->layout = 0;
++unknown_layouts;
string const s = _("Layout had to be changed from\n")
+ layoutname + _(" to ")
+ textclasslist.NameOfLayout(params.textclass, par->layout);
InsetError * new_inset = new InsetError(s);
par->InsertInset(0, new_inset);
}
// Test whether the layout is obsolete.
LyXLayout const & layout =