mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Fix (partially) font bug in compatability code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3345 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2c265ad5cc
commit
b44c7a6767
@ -1,3 +1,7 @@
|
||||
2002-01-12 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* buffer.C (insertErtContents): Fix (partially) the font bug.
|
||||
|
||||
2002-01-11 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* BufferView2.C (ChangeRefsIfUnique): use the HP version of std::count
|
||||
|
30
src/buffer.C
30
src/buffer.C
@ -287,6 +287,7 @@ struct ErtComp
|
||||
string contents;
|
||||
bool active;
|
||||
bool in_tabular;
|
||||
LyXFont font;
|
||||
};
|
||||
|
||||
std::stack<ErtComp> ert_stack;
|
||||
@ -395,16 +396,13 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
|
||||
|
||||
|
||||
#ifndef NO_COMPABILITY
|
||||
void Buffer::insertErtContents(Paragraph * par, int & pos,
|
||||
LyXFont const & f, bool set_inactive)
|
||||
void Buffer::insertErtContents(Paragraph * par, int & pos, bool set_inactive)
|
||||
{
|
||||
if (!ert_comp.contents.empty()) {
|
||||
lyxerr[Debug::INSETS] << "ERT contents:\n'"
|
||||
<< ert_comp.contents << "'" << endl;
|
||||
Inset * inset = new InsetERT(ert_comp.contents, true);
|
||||
LyXFont font;
|
||||
font.setLanguage(f.language());
|
||||
par->insertInset(pos++, inset, font);
|
||||
par->insertInset(pos++, inset, ert_comp.font);
|
||||
ert_comp.contents.erase();
|
||||
}
|
||||
if (set_inactive) {
|
||||
@ -457,7 +455,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
#ifndef NO_COMPABILITY
|
||||
ert_comp.in_tabular = false;
|
||||
// Do the insetert.
|
||||
insertErtContents(par, pos, font);
|
||||
insertErtContents(par, pos);
|
||||
#endif
|
||||
lex.eatLine();
|
||||
string const layoutname = lex.getString();
|
||||
@ -472,6 +470,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
#ifndef NO_COMPABILITY
|
||||
if (compare_no_case(layoutname, "latex") == 0) {
|
||||
ert_comp.active = true;
|
||||
ert_comp.font = font;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_CAPTION
|
||||
@ -575,8 +574,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
|
||||
#ifndef NO_COMPABILITY
|
||||
} else if (token == "\\begin_float") {
|
||||
insertErtContents(par, pos, font);
|
||||
//insertErtContents(par, pos, font, false);
|
||||
insertErtContents(par, pos);
|
||||
//insertErtContents(par, pos, false);
|
||||
//ert_stack.push(ert_comp);
|
||||
//ert_comp = ErtComp();
|
||||
|
||||
@ -666,7 +665,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
inset->read(this, nylex);
|
||||
par->insertInset(pos, inset, font);
|
||||
++pos;
|
||||
insertErtContents(par, pos, font);
|
||||
insertErtContents(par, pos);
|
||||
#endif
|
||||
} else if (token == "\\begin_deeper") {
|
||||
++depth;
|
||||
@ -977,12 +976,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
string const tok = lex.getString();
|
||||
if (tok == "no_latex") {
|
||||
// Do the insetert.
|
||||
insertErtContents(par, pos, font);
|
||||
insertErtContents(par, pos);
|
||||
} else if (tok == "latex") {
|
||||
ert_comp.active = true;
|
||||
ert_comp.font = font;
|
||||
} else if (tok == "default") {
|
||||
// Do the insetert.
|
||||
insertErtContents(par, pos, font);
|
||||
insertErtContents(par, pos);
|
||||
} else {
|
||||
lex.printError("Unknown LaTeX font flag "
|
||||
"`$$Token'");
|
||||
@ -1073,7 +1073,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
// the inset isn't it? Lgb.
|
||||
} else if (token == "\\begin_inset") {
|
||||
#ifndef NO_COMPABILITY
|
||||
insertErtContents(par, pos, font, false);
|
||||
insertErtContents(par, pos, false);
|
||||
ert_stack.push(ert_comp);
|
||||
ert_comp = ErtComp();
|
||||
#endif
|
||||
@ -1081,7 +1081,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
#ifndef NO_COMPABILITY
|
||||
ert_comp = ert_stack.top();
|
||||
ert_stack.pop();
|
||||
insertErtContents(par, pos, font);
|
||||
insertErtContents(par, pos);
|
||||
#endif
|
||||
} else if (token == "\\SpecialChar") {
|
||||
LyXLayout const & layout =
|
||||
@ -1119,7 +1119,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
// Since we cannot know it this is only a regular
|
||||
// newline or a tabular cell delimter we have to
|
||||
// handle the ERT here.
|
||||
insertErtContents(par, pos, font, false);
|
||||
insertErtContents(par, pos, false);
|
||||
|
||||
par->insertChar(pos, Paragraph::META_NEWLINE, font);
|
||||
++pos;
|
||||
@ -1175,7 +1175,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
#ifndef NO_COMPABILITY
|
||||
// If we still have some ert active here we have to insert
|
||||
// it so we don't loose it. (Lgb)
|
||||
insertErtContents(par, pos, font);
|
||||
insertErtContents(par, pos);
|
||||
#endif
|
||||
the_end_read = true;
|
||||
#ifndef NO_COMPABILITY
|
||||
|
@ -128,7 +128,6 @@ public:
|
||||
#ifndef NO_COMPABILITY
|
||||
///
|
||||
void insertErtContents(Paragraph * par, int & pos,
|
||||
LyXFont const & font,
|
||||
bool set_inactive = true);
|
||||
#endif
|
||||
///
|
||||
|
@ -262,7 +262,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
|
||||
continue;
|
||||
if (token == "\\end_inset") {
|
||||
#ifndef NO_COMPABILITY
|
||||
const_cast<Buffer*>(buf)->insertErtContents(par, pos, font, false);
|
||||
const_cast<Buffer*>(buf)->insertErtContents(par, pos, false);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -1440,7 +1440,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
#ifndef NO_COMPABILITY
|
||||
// Here we need to insert the inset_ert_contents into the last
|
||||
// cell of the tabular.
|
||||
owner_->bufferOwner()->insertErtContents(par, pos, font);
|
||||
owner_->bufferOwner()->insertErtContents(par, pos);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user