From 56c61c66ea5d122ff1f0c2fdc985a49fe85ba262 Mon Sep 17 00:00:00 2001 From: Dekel Tsur Date: Mon, 16 Jul 2001 14:51:33 +0000 Subject: [PATCH] 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 --- ChangeLog | 10 ++++++++++ src/buffer.C | 21 ++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2ab2b6acd5..ab470b5e93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-07-16 Dekel Tsur + + * src/buffer.C (parseSingleLyXformat2Token): Generate error insets + for unknown layouts. + +2001-07-13 Dekel Tsur + + * src/buffer.C (readLyXformat2): Generate an error dialog if there are + unknown layouts. + 2001-07-06 Dekel Tsur * lib/layouts/IEEEtran.layout: Add qed box at the end of proof. diff --git a/src/buffer.C b/src/buffer.C index 2d03baf4e3..fd3457c277 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -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 =