Buffer::Buffer(string const & file, bool ronly)
+ : paragraph(0), lyx_clean(true), bak_clean(true),
+ unnamed(false), dep_clean(0), read_only(ronly),
+ filename(file), users(0)
{
lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
- filename = file;
+// filename = file;
filepath = OnlyPath(file);
- paragraph = 0;
- lyx_clean = true;
- bak_clean = true;
- dep_clean = 0;
- read_only = ronly;
- unnamed = false;
- users = 0;
+// paragraph = 0;
+// lyx_clean = true;
+// bak_clean = true;
+// dep_clean = 0;
+// read_only = ronly;
+// unnamed = false;
+// users = 0;
lyxvc.buffer(this);
- if (read_only || (lyxrc.use_tempdir)) {
+ if (read_only || lyxrc.use_tempdir) {
tmppath = CreateBufferTmpDir();
- } else tmppath.erase();
+ } else {
+ tmppath.erase();
+ }
}
string contents;
bool active;
bool in_tabular;
+ LyXFont font;
};
std::stack<ErtComp> ert_stack;
} else {
// We are inserting into an existing document
users->text->breakParagraph(users);
- first_par = users->text->firstParagraph();
+ first_par = users->text->ownerParagraph();
pos = 0;
markDirty();
// We don't want to adopt the parameters from the
#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) {
#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();
#ifndef NO_COMPABILITY
if (compare_no_case(layoutname, "latex") == 0) {
ert_comp.active = true;
+ ert_comp.font = font;
}
#endif
#ifdef USE_CAPTION
#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();
inset->read(this, nylex);
par->insertInset(pos, inset, font);
++pos;
- insertErtContents(par, pos, font);
+ insertErtContents(par, pos);
#endif
} else if (token == "\\begin_deeper") {
++depth;
//how can I put it back?
}
} else if (token == "\\bulletLaTeX") {
+ // The bullet class should be able to read this.
lex.nextToken();
int const index = lex.getInteger();
lex.next();
lex.next();
temp_str = lex.getString();
}
+
params.user_defined_bullets[index].setText(sum_str);
params.temp_bullets[index].setText(sum_str);
} else if (token == "\\secnumdepth") {
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'");
// 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
#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 =
// 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;
#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
{
Inset const * inset = par->getInset(i);
if (inset) {
- if (linelen > 0)
+ if (linelen > 0) {
buffer << word.str();
+ word.str("");
+ }
if (inset->ascii(this, buffer, linelen)) {
// to be sure it breaks paragraph
currlinelen += linelen;