Make buffer's member variables private; use accessor functions.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7717 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-09-09 09:47:59 +00:00
parent 5020a84fc1
commit fd36f5ad76
53 changed files with 530 additions and 415 deletions

View File

@ -264,7 +264,7 @@ bool BufferView::insertLyXFile(string const & filen)
beforeChange(text); beforeChange(text);
text->breakParagraph(buffer()->paragraphs); text->breakParagraph(buffer()->paragraphs());
bool res = buffer()->readFile(fname, text->cursor.par()); bool res = buffer()->readFile(fname, text->cursor.par());
@ -295,7 +295,7 @@ void BufferView::setCursorFromRow(int row)
int tmpid = -1; int tmpid = -1;
int tmppos = -1; int tmppos = -1;
buffer()->texrow.getIdFromRow(row, tmpid, tmppos); buffer()->texrow().getIdFromRow(row, tmpid, tmppos);
ParagraphList::iterator texrowpar; ParagraphList::iterator texrowpar;
@ -437,8 +437,8 @@ bool BufferView::lockInset(UpdatableInset * inset)
} }
// Then do a deep look of the inset and lock the right one // Then do a deep look of the inset and lock the right one
int const id = inset->id(); int const id = inset->id();
ParagraphList::iterator pit = buffer()->paragraphs.begin(); ParagraphList::iterator pit = buffer()->paragraphs().begin();
ParagraphList::iterator pend = buffer()->paragraphs.end(); ParagraphList::iterator pend = buffer()->paragraphs().end();
for (; pit != pend; ++pit) { for (; pit != pend; ++pit) {
InsetList::iterator it = pit->insetlist.begin(); InsetList::iterator it = pit->insetlist.begin();
InsetList::iterator end = pit->insetlist.end(); InsetList::iterator end = pit->insetlist.end();
@ -554,7 +554,7 @@ LyXText * BufferView::getLyXText() const
Language const * BufferView::getParentLanguage(InsetOld * inset) const Language const * BufferView::getParentLanguage(InsetOld * inset) const
{ {
Paragraph const & par = ownerPar(*buffer(), inset); Paragraph const & par = ownerPar(*buffer(), inset);
return par.getFontSettings(buffer()->params, return par.getFontSettings(buffer()->params(),
par.getPositionOfInset(inset)).language(); par.getPositionOfInset(inset)).language();
} }
@ -566,7 +566,7 @@ Encoding const * BufferView::getEncoding() const
return 0; return 0;
LyXCursor const & c = t->cursor; LyXCursor const & c = t->cursor;
LyXFont const font = c.par()->getFont(buffer()->params, c.pos(), LyXFont const font = c.par()->getFont(buffer()->params(), c.pos(),
outerFont(c.par(), t->ownerParagraphs())); outerFont(c.par(), t->ownerParagraphs()));
return font.language()->encoding(); return font.language()->encoding();
} }

View File

@ -426,7 +426,7 @@ void BufferView::Pimpl::resizeCurrentBuffer()
textcache.show(lyxerr, "resizeCurrentBuffer"); textcache.show(lyxerr, "resizeCurrentBuffer");
} else { } else {
lyxerr << "no text in cache!" << endl; lyxerr << "no text in cache!" << endl;
bv_->text = new LyXText(bv_, 0, false, bv_->buffer()->paragraphs); bv_->text = new LyXText(bv_, 0, false, bv_->buffer()->paragraphs());
bv_->text->init(bv_); bv_->text->init(bv_);
} }
@ -669,7 +669,7 @@ bool BufferView::Pimpl::available() const
Change const BufferView::Pimpl::getCurrentChange() Change const BufferView::Pimpl::getCurrentChange()
{ {
if (!bv_->buffer()->params.tracking_changes) if (!bv_->buffer()->params().tracking_changes)
return Change(Change::UNCHANGED); return Change(Change::UNCHANGED);
LyXText * text = bv_->getLyXText(); LyXText * text = bv_->getLyXText();
@ -914,19 +914,19 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
void BufferView::Pimpl::trackChanges() void BufferView::Pimpl::trackChanges()
{ {
Buffer * buf(bv_->buffer()); Buffer * buf(bv_->buffer());
bool const tracking(buf->params.tracking_changes); bool const tracking(buf->params().tracking_changes);
if (!tracking) { if (!tracking) {
ParIterator const end = buf->par_iterator_end(); ParIterator const end = buf->par_iterator_end();
for (ParIterator it = buf->par_iterator_begin(); it != end; ++it) for (ParIterator it = buf->par_iterator_begin(); it != end; ++it)
it->trackChanges(); it->trackChanges();
buf->params.tracking_changes = true; buf->params().tracking_changes = true;
// we cannot allow undos beyond the freeze point // we cannot allow undos beyond the freeze point
buf->undostack.clear(); buf->undostack().clear();
} else { } else {
update(); update();
bv_->text->setCursor(buf->paragraphs.begin(), 0); bv_->text->setCursor(buf->paragraphs().begin(), 0);
#warning changes FIXME #warning changes FIXME
//moveCursorUpdate(false); //moveCursorUpdate(false);
@ -939,10 +939,10 @@ void BufferView::Pimpl::trackChanges()
ParIterator const end = buf->par_iterator_end(); ParIterator const end = buf->par_iterator_end();
for (ParIterator it = buf->par_iterator_begin(); it != end; ++it) for (ParIterator it = buf->par_iterator_begin(); it != end; ++it)
it->untrackChanges(); it->untrackChanges();
buf->params.tracking_changes = false; buf->params().tracking_changes = false;
} }
buf->redostack.clear(); buf->redostack().clear();
} }
@ -1006,7 +1006,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
<< " button[" << ev.button() << ']' << " button[" << ev.button() << ']'
<< endl; << endl;
LyXTextClass const & tclass = buffer_->params.getLyXTextClass(); LyXTextClass const & tclass = buffer_->params().getLyXTextClass();
switch (ev.action) { switch (ev.action) {
@ -1264,7 +1264,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
break; break;
case LFUN_ACCEPT_ALL_CHANGES: { case LFUN_ACCEPT_ALL_CHANGES: {
bv_->text->setCursor(bv_->buffer()->paragraphs.begin(), 0); bv_->text->setCursor(bv_->buffer()->paragraphs().begin(), 0);
#warning FIXME changes #warning FIXME changes
//moveCursorUpdate(false); //moveCursorUpdate(false);
@ -1276,7 +1276,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
} }
case LFUN_REJECT_ALL_CHANGES: { case LFUN_REJECT_ALL_CHANGES: {
bv_->text->setCursor(bv_->buffer()->paragraphs.begin(), 0); bv_->text->setCursor(bv_->buffer()->paragraphs().begin(), 0);
#warning FIXME changes #warning FIXME changes
//moveCursorUpdate(false); //moveCursorUpdate(false);
@ -1327,15 +1327,15 @@ bool BufferView::Pimpl::insertInset(InsetOld * inset, string const & lout)
beforeChange(bv_->text); beforeChange(bv_->text);
if (!lout.empty()) { if (!lout.empty()) {
bv_->text->breakParagraph(bv_->buffer()->paragraphs); bv_->text->breakParagraph(bv_->buffer()->paragraphs());
if (!bv_->text->cursor.par()->empty()) { if (!bv_->text->cursor.par()->empty()) {
bv_->text->cursorLeft(bv_); bv_->text->cursorLeft(bv_);
bv_->text->breakParagraph(bv_->buffer()->paragraphs); bv_->text->breakParagraph(bv_->buffer()->paragraphs());
} }
string lres = lout; string lres = lout;
LyXTextClass const & tclass = buffer_->params.getLyXTextClass(); LyXTextClass const & tclass = buffer_->params().getLyXTextClass();
bool hasLayout = tclass.hasLayout(lres); bool hasLayout = tclass.hasLayout(lres);
string lay = tclass.defaultLayoutName(); string lay = tclass.defaultLayoutName();

View File

@ -269,7 +269,7 @@ CutAndPaste::pasteSelection(Buffer const & buffer,
tmpbuf->erase(i--); tmpbuf->erase(i--);
} }
} else { } else {
LyXFont f1 = tmpbuf->getFont(buffer.params, i, outerFont(pit, pars)); LyXFont f1 = tmpbuf->getFont(buffer.params(), i, outerFont(pit, pars));
LyXFont f2 = f1; LyXFont f2 = f1;
if (!pit->checkInsertChar(f1)) { if (!pit->checkInsertChar(f1)) {
tmpbuf->erase(i--); tmpbuf->erase(i--);
@ -321,7 +321,7 @@ CutAndPaste::pasteSelection(Buffer const & buffer,
// Open the paragraph for inserting the buf // Open the paragraph for inserting the buf
// if necessary. // if necessary.
if (pit->size() > pos || boost::next(pit) == pars.end()) { if (pit->size() > pos || boost::next(pit) == pars.end()) {
breakParagraphConservative(buffer.params, breakParagraphConservative(buffer.params(),
pars, pit, pos); pars, pit, pos);
paste_the_end = true; paste_the_end = true;
} }
@ -339,7 +339,7 @@ CutAndPaste::pasteSelection(Buffer const & buffer,
if (boost::next(pit) == last_paste) if (boost::next(pit) == last_paste)
last_paste = pit; last_paste = pit;
mergeParagraph(buffer.params, pars, pit); mergeParagraph(buffer.params(), pars, pit);
// Store the new cursor position. // Store the new cursor position.
pit = last_paste; pit = last_paste;
@ -350,15 +350,15 @@ CutAndPaste::pasteSelection(Buffer const & buffer,
if (boost::next(last_paste) != pars.end() && if (boost::next(last_paste) != pars.end() &&
paste_the_end) { paste_the_end) {
if (boost::next(last_paste)->hasSameLayout(*last_paste)) { if (boost::next(last_paste)->hasSameLayout(*last_paste)) {
mergeParagraph(buffer.params, pars, mergeParagraph(buffer.params(), pars,
last_paste); last_paste);
} else if (boost::next(last_paste)->empty()) { } else if (boost::next(last_paste)->empty()) {
boost::next(last_paste)->makeSameLayout(*last_paste); boost::next(last_paste)->makeSameLayout(*last_paste);
mergeParagraph(buffer.params, pars, mergeParagraph(buffer.params(), pars,
last_paste); last_paste);
} else if (last_paste->empty()) { } else if (last_paste->empty()) {
last_paste->makeSameLayout(*boost::next(last_paste)); last_paste->makeSameLayout(*boost::next(last_paste));
mergeParagraph(buffer.params, pars, mergeParagraph(buffer.params(), pars,
last_paste); last_paste);
} else } else
boost::next(last_paste)->stripLeadingSpaces(); boost::next(last_paste)->stripLeadingSpaces();

View File

@ -192,7 +192,7 @@ void InsetList::deleteInsetsLyXText(BufferView * bv)
void InsetList::insetsOpenCloseBranch(BufferView * bv) void InsetList::insetsOpenCloseBranch(BufferView * bv)
{ {
BufferParams bp = bv->buffer()->params; BufferParams bp = bv->buffer()->params();
List::iterator it = list.begin(); List::iterator it = list.begin();
List::iterator end = list.end(); List::iterator end = list.end();
for (; it != end; ++it) { for (; it != end; ++it) {

View File

@ -493,7 +493,7 @@ void expandFloatListInsert(Menu & tomenu, LyXView const * view)
} }
FloatList const & floats = FloatList const & floats =
view->buffer()->params.getLyXTextClass().floats(); view->buffer()->params().getLyXTextClass().floats();
FloatList::const_iterator cit = floats.begin(); FloatList::const_iterator cit = floats.begin();
FloatList::const_iterator end = floats.end(); FloatList::const_iterator end = floats.end();
for (; cit != end; ++cit) { for (; cit != end; ++cit) {
@ -516,7 +516,7 @@ void expandFloatInsert(Menu & tomenu, LyXView const * view)
} }
FloatList const & floats = FloatList const & floats =
view->buffer()->params.getLyXTextClass().floats(); view->buffer()->params().getLyXTextClass().floats();
FloatList::const_iterator cit = floats.begin(); FloatList::const_iterator cit = floats.begin();
FloatList::const_iterator end = floats.end(); FloatList::const_iterator end = floats.end();
for (; cit != end; ++cit) { for (; cit != end; ++cit) {
@ -655,7 +655,7 @@ void expandBranches(Menu & tomenu, LyXView const * view)
if (!view || !view->buffer()) if (!view || !view->buffer())
return; return;
BufferParams const & params = view->buffer()->params; BufferParams const & params = view->buffer()->params();
std::list<Branch>::const_iterator cit = params.branchlist.begin(); std::list<Branch>::const_iterator cit = params.branchlist.begin();
std::list<Branch>::const_iterator end = params.branchlist.end(); std::list<Branch>::const_iterator end = params.branchlist.end();

View File

@ -109,17 +109,17 @@ bool openFileWrite(ofstream & ofs, string const & fname)
} // namespace anon } // namespace anon
Buffer::Buffer(string const & file, bool ronly) Buffer::Buffer(string const & file, bool ronly)
: niceFile(true), lyx_clean(true), bak_clean(true), : nicefile_(true), lyx_clean(true), bak_clean(true),
unnamed(false), read_only(ronly), unnamed(false), read_only(ronly),
filename_(file) filename_(file)
{ {
lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl; lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
filepath_ = OnlyPath(file); filepath_ = OnlyPath(file);
lyxvc.buffer(this); lyxvc().buffer(this);
if (read_only || lyxrc.use_tempdir) { if (read_only || lyxrc.use_tempdir) {
tmppath = CreateBufferTmpDir(); temppath_ = CreateBufferTmpDir();
} else { } else {
tmppath.erase(); temppath_.erase();
} }
// set initial author // set initial author
@ -135,18 +135,108 @@ Buffer::~Buffer()
closing(); closing();
if (!tmppath.empty() && destroyDir(tmppath) != 0) { if (!temppath().empty() && destroyDir(temppath()) != 0) {
Alert::warning(_("Could not remove temporary directory"), Alert::warning(_("Could not remove temporary directory"),
bformat(_("Could not remove the temporary directory %1$s"), tmppath)); bformat(_("Could not remove the temporary directory %1$s"), temppath()));
} }
paragraphs.clear(); paragraphs().clear();
// Remove any previewed LaTeX snippets associated with this buffer. // Remove any previewed LaTeX snippets associated with this buffer.
lyx::graphics::Previews::get().removeLoader(*this); lyx::graphics::Previews::get().removeLoader(*this);
} }
limited_stack<Undo> & Buffer::undostack()
{
return undostack_;
}
limited_stack<Undo> const & Buffer::undostack() const
{
return undostack_;
}
limited_stack<Undo> & Buffer::redostack()
{
return redostack_;
}
limited_stack<Undo> const & Buffer::redostack() const
{
return redostack_;
}
BufferParams & Buffer::params()
{
return params_;
}
BufferParams const & Buffer::params() const
{
return params_;
}
ParagraphList & Buffer::paragraphs()
{
return paragraphs_;
}
ParagraphList const & Buffer::paragraphs() const
{
return paragraphs_;
}
LyXVC & Buffer::lyxvc()
{
return lyxvc_;
}
LyXVC const & Buffer::lyxvc() const
{
return lyxvc_;
}
string const & Buffer::temppath() const
{
return temppath_;
}
bool & Buffer::niceFile()
{
return nicefile_;
}
bool Buffer::niceFile() const
{
return nicefile_;
}
TexRow & Buffer::texrow()
{
return texrow_;
}
TexRow const & Buffer::texrow() const
{
return texrow_;
}
string const Buffer::getLatexName(bool no_path) const string const Buffer::getLatexName(bool no_path) const
{ {
string const name = ChangeExtension(MakeLatexName(fileName()), ".tex"); string const name = ChangeExtension(MakeLatexName(fileName()), ".tex");
@ -164,7 +254,7 @@ pair<Buffer::LogType, string> const Buffer::getLogName() const
string path = OnlyPath(filename); string path = OnlyPath(filename);
if (lyxrc.use_tempdir || !IsDirWriteable(path)) if (lyxrc.use_tempdir || !IsDirWriteable(path))
path = tmppath; path = temppath();
string const fname = AddName(path, string const fname = AddName(path,
OnlyFilename(ChangeExtension(filename, OnlyFilename(ChangeExtension(filename,
@ -200,7 +290,7 @@ void Buffer::setReadonly(bool flag)
AuthorList & Buffer::authors() AuthorList & Buffer::authors()
{ {
return params.authorlist; return params().authorlist;
} }
@ -243,7 +333,7 @@ int Buffer::readHeader(LyXLex & lex)
<< token << '\'' << endl; << token << '\'' << endl;
string unknown = params.readToken(lex, token); string unknown = params().readToken(lex, token);
if (!unknown.empty()) { if (!unknown.empty()) {
if (unknown[0] != '\\') { if (unknown[0] != '\\') {
unknownClass(unknown); unknownClass(unknown);
@ -275,14 +365,14 @@ bool Buffer::readBody(LyXLex & lex, ParagraphList::iterator pit)
Paragraph::depth_type depth = 0; Paragraph::depth_type depth = 0;
bool the_end_read = false; bool the_end_read = false;
if (paragraphs.empty()) { if (paragraphs().empty()) {
readHeader(lex); readHeader(lex);
if (!params.getLyXTextClass().load()) { if (!params().getLyXTextClass().load()) {
string theclass = params.getLyXTextClass().name(); string theclass = params().getLyXTextClass().name();
Alert::error(_("Can't load document class"), bformat( Alert::error(_("Can't load document class"), bformat(
"Using the default document class, because the " "Using the default document class, because the "
" class %1$s could not be loaded.", theclass)); " class %1$s could not be loaded.", theclass));
params.textclass = 0; params().textclass = 0;
} }
} else { } else {
// We don't want to adopt the parameters from the // We don't want to adopt the parameters from the
@ -308,7 +398,7 @@ bool Buffer::readBody(LyXLex & lex, ParagraphList::iterator pit)
continue; continue;
} }
readParagraph(lex, token, paragraphs, pit, depth); readParagraph(lex, token, paragraphs(), pit, depth);
} }
return the_end_read; return the_end_read;
@ -327,9 +417,9 @@ int Buffer::readParagraph(LyXLex & lex, string const & token,
Paragraph par; Paragraph par;
par.params().depth(depth); par.params().depth(depth);
if (params.tracking_changes) if (params().tracking_changes)
par.trackChanges(); par.trackChanges();
LyXFont f(LyXFont::ALL_INHERIT, params.language); LyXFont f(LyXFont::ALL_INHERIT, params().language);
par.setFont(0, f); par.setFont(0, f);
// insert after // insert after
@ -374,7 +464,7 @@ void Buffer::insertStringAsLines(ParagraphList::iterator & par, pos_type & pos,
cit != str.end(); ++cit) { cit != str.end(); ++cit) {
if (*cit == '\n') { if (*cit == '\n') {
if (autobreakrows && (!par->empty() || par->allowEmpty())) { if (autobreakrows && (!par->empty() || par->allowEmpty())) {
breakParagraph(params, paragraphs, par, pos, breakParagraph(params(), paragraphs(), par, pos,
layout->isEnvironment()); layout->isEnvironment());
++par; ++par;
pos = 0; pos = 0;
@ -419,15 +509,15 @@ bool Buffer::readFile(string const & filename)
// Check if the file is compressed. // Check if the file is compressed.
string const format = getExtFromContents(filename); string const format = getExtFromContents(filename);
if (format == "gzip" || format == "zip" || format == "compress") { if (format == "gzip" || format == "zip" || format == "compress") {
params.compressed = true; params().compressed = true;
} }
bool ret = readFile(filename, paragraphs.begin()); bool ret = readFile(filename, paragraphs().begin());
// After we have read a file, we must ensure that the buffer // After we have read a file, we must ensure that the buffer
// language is set and used in the gui. // language is set and used in the gui.
// If you know of a better place to put this, please tell me. (Lgb) // If you know of a better place to put this, please tell me. (Lgb)
updateDocLang(params.language); updateDocLang(params().language);
return ret; return ret;
} }
@ -525,7 +615,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename,
} }
bool the_end = readBody(lex, pit); bool the_end = readBody(lex, pit);
params.setPaperStuff(); params().setPaperStuff();
if (!the_end) { if (!the_end) {
Alert::error(_("Document format failure"), Alert::error(_("Document format failure"),
@ -626,7 +716,7 @@ bool Buffer::writeFile(string const & fname) const
bool retval; bool retval;
if (params.compressed) { if (params().compressed) {
gz::ogzstream ofs(fname.c_str()); gz::ogzstream ofs(fname.c_str());
if (!ofs) if (!ofs)
@ -654,7 +744,7 @@ bool Buffer::do_writeFile(ostream & ofs) const
ofs.imbue(std::locale::classic()); ofs.imbue(std::locale::classic());
#endif #endif
// The top of the file should not be written by params. // The top of the file should not be written by params().
// write out a comment in the top of the file // write out a comment in the top of the file
ofs << "#LyX " << lyx_version ofs << "#LyX " << lyx_version
@ -662,7 +752,7 @@ bool Buffer::do_writeFile(ostream & ofs) const
<< "\\lyxformat " << LYX_FORMAT << "\n"; << "\\lyxformat " << LYX_FORMAT << "\n";
// now write out the buffer paramters. // now write out the buffer paramters.
params.writeFile(ofs); params().writeFile(ofs);
ofs << "\\end_header\n"; ofs << "\\end_header\n";
@ -670,10 +760,10 @@ bool Buffer::do_writeFile(ostream & ofs) const
// this will write out all the paragraphs // this will write out all the paragraphs
// using recursive descent. // using recursive descent.
ParagraphList::const_iterator pit = paragraphs.begin(); ParagraphList::const_iterator pit = paragraphs().begin();
ParagraphList::const_iterator pend = paragraphs.end(); ParagraphList::const_iterator pend = paragraphs().end();
for (; pit != pend; ++pit) for (; pit != pend; ++pit)
pit->write(*this, ofs, params, depth); pit->write(*this, ofs, params(), depth);
// Write marker that shows file is complete // Write marker that shows file is complete
ofs << "\n\\end_document" << endl; ofs << "\n\\end_document" << endl;
@ -838,7 +928,7 @@ string const Buffer::asciiParagraph(Paragraph const & par,
string word; string word;
for (pos_type i = 0; i < par.size(); ++i) { for (pos_type i = 0; i < par.size(); ++i) {
char c = par.getUChar(params, i); char c = par.getUChar(params(), i);
switch (c) { switch (c) {
case Paragraph::META_INSET: case Paragraph::META_INSET:
{ {
@ -908,8 +998,8 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
void Buffer::writeFileAscii(ostream & os, int linelen) void Buffer::writeFileAscii(ostream & os, int linelen)
{ {
ParagraphList::iterator beg = paragraphs.begin(); ParagraphList::iterator beg = paragraphs().begin();
ParagraphList::iterator end = paragraphs.end(); ParagraphList::iterator end = paragraphs().end();
ParagraphList::iterator it = beg; ParagraphList::iterator it = beg;
for (; it != end; ++it) { for (; it != end; ++it) {
os << asciiParagraph(*it, linelen, it == beg); os << asciiParagraph(*it, linelen, it == beg);
@ -945,26 +1035,26 @@ void Buffer::makeLaTeXFile(ostream & os,
bool output_preamble, bool output_body) bool output_preamble, bool output_body)
{ {
LatexRunParams runparams = runparams_in; LatexRunParams runparams = runparams_in;
niceFile = runparams.nice; // this will be used by Insetincludes. niceFile() = runparams.nice; // this will be used by Insetincludes.
// validate the buffer. // validate the buffer.
lyxerr[Debug::LATEX] << " Validating buffer..." << endl; lyxerr[Debug::LATEX] << " Validating buffer..." << endl;
LaTeXFeatures features(params); LaTeXFeatures features(params());
validate(features); validate(features);
lyxerr[Debug::LATEX] << " Buffer validation done." << endl; lyxerr[Debug::LATEX] << " Buffer validation done." << endl;
texrow.reset(); texrow().reset();
// The starting paragraph of the coming rows is the // The starting paragraph of the coming rows is the
// first paragraph of the document. (Asger) // first paragraph of the document. (Asger)
texrow.start(paragraphs.begin()->id(), 0); texrow().start(paragraphs().begin()->id(), 0);
if (output_preamble && runparams.nice) { if (output_preamble && runparams.nice) {
os << "%% LyX " << lyx_version << " created this file. " os << "%% LyX " << lyx_version << " created this file. "
"For more info, see http://www.lyx.org/.\n" "For more info, see http://www.lyx.org/.\n"
"%% Do not edit unless you really know what " "%% Do not edit unless you really know what "
"you are doing.\n"; "you are doing.\n";
texrow.newline(); texrow().newline();
texrow.newline(); texrow().newline();
} }
lyxerr[Debug::INFO] << "lyx header finished" << endl; lyxerr[Debug::INFO] << "lyx header finished" << endl;
// There are a few differences between nice LaTeX and usual files: // There are a few differences between nice LaTeX and usual files:
@ -979,7 +1069,7 @@ void Buffer::makeLaTeXFile(ostream & os,
// code for usual, NOT nice-latex-file // code for usual, NOT nice-latex-file
os << "\\batchmode\n"; // changed os << "\\batchmode\n"; // changed
// from \nonstopmode // from \nonstopmode
texrow.newline(); texrow().newline();
} }
if (!original_path.empty()) { if (!original_path.empty()) {
string inputpath = os::external_path(original_path); string inputpath = os::external_path(original_path);
@ -988,46 +1078,46 @@ void Buffer::makeLaTeXFile(ostream & os,
<< "\\def\\input@path{{" << "\\def\\input@path{{"
<< inputpath << "/}}\n" << inputpath << "/}}\n"
<< "\\makeatother\n"; << "\\makeatother\n";
texrow.newline(); texrow().newline();
texrow.newline(); texrow().newline();
texrow.newline(); texrow().newline();
} }
// Write the preamble // Write the preamble
runparams.use_babel = params.writeLaTeX(os, features, texrow); runparams.use_babel = params().writeLaTeX(os, features, texrow());
if (!output_body) if (!output_body)
return; return;
// make the body. // make the body.
os << "\\begin{document}\n"; os << "\\begin{document}\n";
texrow.newline(); texrow().newline();
} // output_preamble } // output_preamble
lyxerr[Debug::INFO] << "preamble finished, now the body." << endl; lyxerr[Debug::INFO] << "preamble finished, now the body." << endl;
if (!lyxrc.language_auto_begin) { if (!lyxrc.language_auto_begin) {
os << subst(lyxrc.language_command_begin, "$$lang", os << subst(lyxrc.language_command_begin, "$$lang",
params.language->babel()) params().language->babel())
<< endl; << endl;
texrow.newline(); texrow().newline();
} }
latexParagraphs(*this, paragraphs, os, texrow, runparams); latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
// add this just in case after all the paragraphs // add this just in case after all the paragraphs
os << endl; os << endl;
texrow.newline(); texrow().newline();
if (!lyxrc.language_auto_end) { if (!lyxrc.language_auto_end) {
os << subst(lyxrc.language_command_end, "$$lang", os << subst(lyxrc.language_command_end, "$$lang",
params.language->babel()) params().language->babel())
<< endl; << endl;
texrow.newline(); texrow().newline();
} }
if (output_preamble) { if (output_preamble) {
os << "\\end{document}\n"; os << "\\end{document}\n";
texrow.newline(); texrow().newline();
lyxerr[Debug::LATEX] << "makeLaTeXFile...done" << endl; lyxerr[Debug::LATEX] << "makeLaTeXFile...done" << endl;
} else { } else {
@ -1036,44 +1126,44 @@ void Buffer::makeLaTeXFile(ostream & os,
} }
// Just to be sure. (Asger) // Just to be sure. (Asger)
texrow.newline(); texrow().newline();
lyxerr[Debug::INFO] << "Finished making LaTeX file." << endl; lyxerr[Debug::INFO] << "Finished making LaTeX file." << endl;
lyxerr[Debug::INFO] << "Row count was " << texrow.rows() - 1 lyxerr[Debug::INFO] << "Row count was " << texrow().rows() - 1
<< '.' << endl; << '.' << endl;
// we want this to be true outside previews (for insetexternal) // we want this to be true outside previews (for insetexternal)
niceFile = true; niceFile() = true;
} }
bool Buffer::isLatex() const bool Buffer::isLatex() const
{ {
return params.getLyXTextClass().outputType() == LATEX; return params().getLyXTextClass().outputType() == LATEX;
} }
bool Buffer::isLinuxDoc() const bool Buffer::isLinuxDoc() const
{ {
return params.getLyXTextClass().outputType() == LINUXDOC; return params().getLyXTextClass().outputType() == LINUXDOC;
} }
bool Buffer::isLiterate() const bool Buffer::isLiterate() const
{ {
return params.getLyXTextClass().outputType() == LITERATE; return params().getLyXTextClass().outputType() == LITERATE;
} }
bool Buffer::isDocBook() const bool Buffer::isDocBook() const
{ {
return params.getLyXTextClass().outputType() == DOCBOOK; return params().getLyXTextClass().outputType() == DOCBOOK;
} }
bool Buffer::isSGML() const bool Buffer::isSGML() const
{ {
LyXTextClass const & tclass = params.getLyXTextClass(); LyXTextClass const & tclass = params().getLyXTextClass();
return tclass.outputType() == LINUXDOC || return tclass.outputType() == LINUXDOC ||
tclass.outputType() == DOCBOOK; tclass.outputType() == DOCBOOK;
@ -1086,22 +1176,22 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
if (!::openFileWrite(ofs, fname)) if (!::openFileWrite(ofs, fname))
return; return;
niceFile = nice; // this will be used by included files. niceFile() = nice; // this will be used by included files.
LaTeXFeatures features(params); LaTeXFeatures features(params());
validate(features); validate(features);
texrow.reset(); texrow().reset();
LyXTextClass const & tclass = params.getLyXTextClass(); LyXTextClass const & tclass = params().getLyXTextClass();
string top_element = tclass.latexname(); string top_element = tclass.latexname();
if (!body_only) { if (!body_only) {
ofs << "<!doctype linuxdoc system"; ofs << "<!doctype linuxdoc system";
string preamble = params.preamble; string preamble = params().preamble;
string const name = nice ? ChangeExtension(filename_, ".sgml") string const name = nice ? ChangeExtension(filename_, ".sgml")
: fname; : fname;
preamble += features.getIncludedFiles(name); preamble += features.getIncludedFiles(name);
@ -1112,12 +1202,12 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
} }
ofs << ">\n\n"; ofs << ">\n\n";
if (params.options.empty()) if (params().options.empty())
sgml::openTag(ofs, 0, false, top_element); sgml::openTag(ofs, 0, false, top_element);
else { else {
string top = top_element; string top = top_element;
top += ' '; top += ' ';
top += params.options; top += params().options;
sgml::openTag(ofs, 0, false, top); sgml::openTag(ofs, 0, false, top);
} }
} }
@ -1130,8 +1220,8 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
string item_name; string item_name;
vector<string> environment_stack(5); vector<string> environment_stack(5);
ParagraphList::iterator pit = paragraphs.begin(); ParagraphList::iterator pit = paragraphs().begin();
ParagraphList::iterator pend = paragraphs.end(); ParagraphList::iterator pend = paragraphs().end();
for (; pit != pend; ++pit) { for (; pit != pend; ++pit) {
LyXLayout_ptr const & style = pit->layout(); LyXLayout_ptr const & style = pit->layout();
// treat <toc> as a special case for compatibility with old code // treat <toc> as a special case for compatibility with old code
@ -1257,7 +1347,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
// How to check for successful close // How to check for successful close
// we want this to be true outside previews (for insetexternal) // we want this to be true outside previews (for insetexternal)
niceFile = true; niceFile() = true;
} }
@ -1348,7 +1438,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
PAR_TAG tag_close = NONE; PAR_TAG tag_close = NONE;
list < PAR_TAG > tag_open; list < PAR_TAG > tag_open;
LyXFont const font = par->getFont(params, i, outerFont(par, paragraphs)); LyXFont const font = par->getFont(params(), i, outerFont(par, paragraphs()));
if (font_old.family() != font.family()) { if (font_old.family() != font.family()) {
switch (family_type) { switch (family_type) {
@ -1516,21 +1606,21 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (!::openFileWrite(ofs, fname)) if (!::openFileWrite(ofs, fname))
return; return;
niceFile = nice; // this will be used by Insetincludes. niceFile() = nice; // this will be used by Insetincludes.
LaTeXFeatures features(params); LaTeXFeatures features(params());
validate(features); validate(features);
texrow.reset(); texrow().reset();
LyXTextClass const & tclass = params.getLyXTextClass(); LyXTextClass const & tclass = params().getLyXTextClass();
string top_element = tclass.latexname(); string top_element = tclass.latexname();
if (!only_body) { if (!only_body) {
ofs << "<!DOCTYPE " << top_element ofs << "<!DOCTYPE " << top_element
<< " PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\""; << " PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\"";
string preamble = params.preamble; string preamble = params().preamble;
string const name = nice ? ChangeExtension(filename_, ".sgml") string const name = nice ? ChangeExtension(filename_, ".sgml")
: fname; : fname;
preamble += features.getIncludedFiles(name); preamble += features.getIncludedFiles(name);
@ -1544,12 +1634,12 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
string top = top_element; string top = top_element;
top += " lang=\""; top += " lang=\"";
top += params.language->code(); top += params().language->code();
top += '"'; top += '"';
if (!params.options.empty()) { if (!params().options.empty()) {
top += ' '; top += ' ';
top += params.options; top += params().options;
} }
sgml::openTag(ofs, 0, false, top); sgml::openTag(ofs, 0, false, top);
@ -1569,8 +1659,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
string item_name; string item_name;
string command_name; string command_name;
ParagraphList::iterator par = paragraphs.begin(); ParagraphList::iterator par = paragraphs().begin();
ParagraphList::iterator pend = paragraphs.end(); ParagraphList::iterator pend = paragraphs().end();
for (; par != pend; ++par) { for (; par != pend; ++par) {
string sgmlparam; string sgmlparam;
@ -1783,7 +1873,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
// How to check for successful close // How to check for successful close
// we want this to be true outside previews (for insetexternal) // we want this to be true outside previews (for insetexternal)
niceFile = true; niceFile() = true;
} }
@ -1803,7 +1893,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
// parsing main loop // parsing main loop
for (pos_type i = 0; i < par->size(); ++i) { for (pos_type i = 0; i < par->size(); ++i) {
LyXFont font = par->getFont(params, i, outerFont(par, paragraphs)); LyXFont font = par->getFont(params(), i, outerFont(par, paragraphs()));
// handle <emphasis> tag // handle <emphasis> tag
if (font_old.emph() != font.emph()) { if (font_old.emph() != font.emph()) {
@ -1886,7 +1976,7 @@ int Buffer::runChktex()
string const org_path = path; string const org_path = path;
if (lyxrc.use_tempdir || !IsDirWriteable(path)) { if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
path = tmppath; path = temppath();
} }
Path p(path); // path to LaTeX file Path p(path); // path to LaTeX file
@ -1918,28 +2008,28 @@ int Buffer::runChktex()
void Buffer::validate(LaTeXFeatures & features) const void Buffer::validate(LaTeXFeatures & features) const
{ {
LyXTextClass const & tclass = params.getLyXTextClass(); LyXTextClass const & tclass = params().getLyXTextClass();
if (params.tracking_changes) { if (params().tracking_changes) {
features.require("dvipost"); features.require("dvipost");
features.require("color"); features.require("color");
} }
// AMS Style is at document level // AMS Style is at document level
if (params.use_amsmath == BufferParams::AMS_ON if (params().use_amsmath == BufferParams::AMS_ON
|| tclass.provides(LyXTextClass::amsmath)) || tclass.provides(LyXTextClass::amsmath))
features.require("amsmath"); features.require("amsmath");
for_each(paragraphs.begin(), paragraphs.end(), for_each(paragraphs().begin(), paragraphs().end(),
boost::bind(&Paragraph::validate, _1, boost::ref(features))); boost::bind(&Paragraph::validate, _1, boost::ref(features)));
// the bullet shapes are buffer level not paragraph level // the bullet shapes are buffer level not paragraph level
// so they are tested here // so they are tested here
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
if (params.user_defined_bullets[i] != ITEMIZE_DEFAULTS[i]) { if (params().user_defined_bullets[i] != ITEMIZE_DEFAULTS[i]) {
int const font = params.user_defined_bullets[i].getFont(); int const font = params().user_defined_bullets[i].getFont();
if (font == 0) { if (font == 0) {
int const c = params int const c = params()
.user_defined_bullets[i] .user_defined_bullets[i]
.getCharacter(); .getCharacter();
if (c == 16 if (c == 16
@ -1967,9 +2057,9 @@ void Buffer::getLabelList(std::vector<string> & list) const
{ {
/// if this is a child document and the parent is already loaded /// if this is a child document and the parent is already loaded
/// Use the parent's list instead [ale990407] /// Use the parent's list instead [ale990407]
if (!params.parentname.empty() if (!params().parentname.empty()
&& bufferlist.exists(params.parentname)) { && bufferlist.exists(params().parentname)) {
Buffer const * tmp = bufferlist.getBuffer(params.parentname); Buffer const * tmp = bufferlist.getBuffer(params().parentname);
if (tmp) { if (tmp) {
tmp->getLabelList(list); tmp->getLabelList(list);
return; return;
@ -1988,8 +2078,9 @@ void Buffer::fillWithBibKeys(std::vector<std::pair<string, string> > & keys) con
{ {
/// if this is a child document and the parent is already loaded /// if this is a child document and the parent is already loaded
/// use the parent's list instead [ale990412] /// use the parent's list instead [ale990412]
if (!params.parentname.empty() && bufferlist.exists(params.parentname)) { if (!params().parentname.empty() &&
Buffer const * tmp = bufferlist.getBuffer(params.parentname); bufferlist.exists(params().parentname)) {
Buffer const * tmp = bufferlist.getBuffer(params().parentname);
if (tmp) { if (tmp) {
tmp->fillWithBibKeys(keys); tmp->fillWithBibKeys(keys);
return; return;
@ -2068,7 +2159,7 @@ void Buffer::changeLanguage(Language const * from, Language const * to)
ParIterator end = par_iterator_end(); ParIterator end = par_iterator_end();
for (ParIterator it = par_iterator_begin(); it != end; ++it) for (ParIterator it = par_iterator_begin(); it != end; ++it)
it->changeLanguage(params, from, to); it->changeLanguage(params(), from, to);
} }
@ -2082,7 +2173,7 @@ bool Buffer::isMultiLingual()
{ {
ParIterator end = par_iterator_end(); ParIterator end = par_iterator_end();
for (ParIterator it = par_iterator_begin(); it != end; ++it) for (ParIterator it = par_iterator_begin(); it != end; ++it)
if (it->isMultiLingual(params)) if (it->isMultiLingual(params()))
return true; return true;
return false; return false;
@ -2157,31 +2248,33 @@ bool Buffer::hasParWithID(int id) const
ParIterator Buffer::par_iterator_begin() ParIterator Buffer::par_iterator_begin()
{ {
return ParIterator(paragraphs.begin(), paragraphs); return ParIterator(paragraphs().begin(), paragraphs());
} }
ParIterator Buffer::par_iterator_end() ParIterator Buffer::par_iterator_end()
{ {
return ParIterator(paragraphs.end(), paragraphs); return ParIterator(paragraphs().end(), paragraphs());
} }
ParConstIterator Buffer::par_iterator_begin() const ParConstIterator Buffer::par_iterator_begin() const
{ {
return ParConstIterator(const_cast<ParagraphList&>(paragraphs).begin(), paragraphs); ParagraphList const & pars = paragraphs();
return ParConstIterator(const_cast<ParagraphList&>(pars).begin(), pars);
} }
ParConstIterator Buffer::par_iterator_end() const ParConstIterator Buffer::par_iterator_end() const
{ {
return ParConstIterator(const_cast<ParagraphList&>(paragraphs).end(), paragraphs); ParagraphList const & pars = paragraphs();
return ParConstIterator(const_cast<ParagraphList&>(pars).end(), pars);
} }
Language const * Buffer::getLanguage() const Language const * Buffer::getLanguage() const
{ {
return params.language; return params().language;
} }
@ -2274,7 +2367,7 @@ bool Buffer::isReadonly() const
void Buffer::setParentName(string const & name) void Buffer::setParentName(string const & name)
{ {
params.parentname = name; params().parentname = name;
} }
@ -2292,27 +2385,27 @@ Buffer::inset_iterator::inset_iterator(base_type p, base_type e)
Buffer::inset_iterator Buffer::inset_iterator_begin() Buffer::inset_iterator Buffer::inset_iterator_begin()
{ {
return inset_iterator(paragraphs.begin(), paragraphs.end()); return inset_iterator(paragraphs().begin(), paragraphs().end());
} }
Buffer::inset_iterator Buffer::inset_iterator_end() Buffer::inset_iterator Buffer::inset_iterator_end()
{ {
return inset_iterator(paragraphs.end(), paragraphs.end()); return inset_iterator(paragraphs().end(), paragraphs().end());
} }
Buffer::inset_iterator Buffer::inset_const_iterator_begin() const Buffer::inset_iterator Buffer::inset_const_iterator_begin() const
{ {
return inset_iterator(const_cast<ParagraphList&>(paragraphs).begin(), ParagraphList & pars = const_cast<ParagraphList&>(paragraphs());
const_cast<ParagraphList&>(paragraphs).end()); return inset_iterator(pars.begin(), pars.end());
} }
Buffer::inset_iterator Buffer::inset_const_iterator_end() const Buffer::inset_iterator Buffer::inset_const_iterator_end() const
{ {
return inset_iterator(const_cast<ParagraphList&>(paragraphs).end(), ParagraphList & pars = const_cast<ParagraphList&>(paragraphs());
const_cast<ParagraphList&>(paragraphs).end()); return inset_iterator(pars.end(), pars.end());
} }

View File

@ -79,15 +79,6 @@ public:
/// Load the autosaved file. /// Load the autosaved file.
void loadAutoSaveFile(); void loadAutoSaveFile();
private:
/** Inserts a file into a document
\param par if != 0 insert the file.
\return \c false if method fails.
*/
bool readFile(LyXLex &, string const & filename,
ParagraphList::iterator pit);
public:
/// load a new file /// load a new file
bool readFile(string const & filename); bool readFile(string const & filename);
@ -116,7 +107,6 @@ public:
/// do we have a paragraph with this id? /// do we have a paragraph with this id?
bool hasParWithID(int id) const; bool hasParWithID(int id) const;
public:
/// This signal is emitted when a parsing error shows up. /// This signal is emitted when a parsing error shows up.
boost::signal1<void, ErrorItem> error; boost::signal1<void, ErrorItem> error;
/// This signal is emitted when some message shows up. /// This signal is emitted when some message shows up.
@ -273,40 +263,63 @@ public:
bool isMultiLingual(); bool isMultiLingual();
/// Does this mean that this is buffer local? /// Does this mean that this is buffer local?
limited_stack<Undo> undostack; limited_stack<Undo> & undostack();
limited_stack<Undo> const & undostack() const;
/// Does this mean that this is buffer local? /// Does this mean that this is buffer local?
limited_stack<Undo> redostack; limited_stack<Undo> & redostack();
limited_stack<Undo> const & redostack() const;
/// ///
BufferParams params; BufferParams & params();
BufferParams const & params() const;
/** The list of paragraphs. /** The list of paragraphs.
This is a linked list of paragraph, this list holds the This is a linked list of paragraph, this list holds the
whole contents of the document. whole contents of the document.
*/ */
ParagraphList paragraphs; ParagraphList & paragraphs();
ParagraphList const & paragraphs() const;
/// LyX version control object. /// LyX version control object.
LyXVC lyxvc; LyXVC & lyxvc();
LyXVC const & lyxvc() const;
/// Where to put temporary files. /// Where to put temporary files.
string tmppath; string const & temppath() const;
/** If we are writing a nice LaTeX file or not. /** If we are writing a nice LaTeX file or not.
While writing as LaTeX, tells whether we are While writing as LaTeX, tells whether we are
doing a 'nice' LaTeX file */ doing a 'nice' LaTeX file */
bool niceFile; bool & niceFile();
bool niceFile() const;
/// Used when typesetting to place errorboxes. /// Used when typesetting to place errorboxes.
TexRow texrow; TexRow & texrow();
TexRow const & texrow() const;
/// the author list for the document /// the author list for the document
AuthorList & authors(); AuthorList & authors();
private: private:
/** Inserts a file into a document
\param par if != 0 insert the file.
\return \c false if method fails.
*/
bool readFile(LyXLex &, string const & filename,
ParagraphList::iterator pit);
bool do_writeFile(std::ostream & ofs) const; bool do_writeFile(std::ostream & ofs) const;
limited_stack<Undo> undostack_;
limited_stack<Undo> redostack_;
BufferParams params_;
ParagraphList paragraphs_;
LyXVC lyxvc_;
string temppath_;
bool nicefile_;
TexRow texrow_;
typedef std::map<string, bool> DepClean; typedef std::map<string, bool> DepClean;
/// need to regenerate .tex ? /// need to regenerate .tex ?
@ -408,4 +421,5 @@ bool operator==(Buffer::inset_iterator const & iter1,
bool operator!=(Buffer::inset_iterator const & iter1, bool operator!=(Buffer::inset_iterator const & iter1,
Buffer::inset_iterator const & iter2); Buffer::inset_iterator const & iter2);
#endif #endif

View File

@ -120,7 +120,7 @@ bool loadLyXFile(Buffer * b, string const & s)
// Fall through // Fall through
case 1: case 1:
if (readFile(b, s)) { if (readFile(b, s)) {
b->lyxvc.file_found_hook(s); b->lyxvc().file_found_hook(s);
return true; return true;
} }
break; break;
@ -166,12 +166,12 @@ Buffer * newFile(string const & filename, string const & templatename,
string const text = bformat(_("The specified document template\n%1$s\ncould not be read."), file); string const text = bformat(_("The specified document template\n%1$s\ncould not be read."), file);
Alert::error(_("Could not read template"), text); Alert::error(_("Could not read template"), text);
// no template, start with empty buffer // no template, start with empty buffer
b->paragraphs.push_back(Paragraph()); b->paragraphs().push_back(Paragraph());
b->paragraphs.begin()->layout(b->params.getLyXTextClass().defaultLayout()); b->paragraphs().begin()->layout(b->params().getLyXTextClass().defaultLayout());
} }
} else { // start with empty buffer } else { // start with empty buffer
b->paragraphs.push_back(Paragraph()); b->paragraphs().push_back(Paragraph());
b->paragraphs.begin()->layout(b->params.getLyXTextClass().defaultLayout()); b->paragraphs().begin()->layout(b->params().getLyXTextClass().defaultLayout());
} }
if (!isNamed) { if (!isNamed) {
@ -180,7 +180,7 @@ Buffer * newFile(string const & filename, string const & templatename,
} }
b->setReadonly(false); b->setReadonly(false);
b->updateDocLang(b->params.language); b->updateDocLang(b->params().language);
return b; return b;
} }
@ -195,9 +195,9 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr)
int par_id = -1; int par_id = -1;
int posstart = -1; int posstart = -1;
int const errorrow = cit->error_in_line; int const errorrow = cit->error_in_line;
buf.texrow.getIdFromRow(errorrow, par_id, posstart); buf.texrow().getIdFromRow(errorrow, par_id, posstart);
int posend = -1; int posend = -1;
buf.texrow.getIdFromRow(errorrow + 1, par_id, posend); buf.texrow().getIdFromRow(errorrow + 1, par_id, posend);
buf.error(ErrorItem(cit->error_desc, buf.error(ErrorItem(cit->error_desc,
cit->error_text, cit->error_text,
par_id, posstart, posend)); par_id, posstart, posend));

View File

@ -125,7 +125,7 @@ void BufferList::release(Buffer * buf)
Buffer * BufferList::newBuffer(string const & s, bool ronly) Buffer * BufferList::newBuffer(string const & s, bool ronly)
{ {
Buffer * tmpbuf = new Buffer(s, ronly); Buffer * tmpbuf = new Buffer(s, ronly);
tmpbuf->params.useClassDefaults(); tmpbuf->params().useClassDefaults();
lyxerr[Debug::INFO] << "Assigning to buffer " lyxerr[Debug::INFO] << "Assigning to buffer "
<< bstore.size() << endl; << bstore.size() << endl;
bstore.push_back(tmpbuf); bstore.push_back(tmpbuf);
@ -150,7 +150,7 @@ bool BufferList::close(Buffer * buf, bool ask)
Assert(buf); Assert(buf);
// FIXME: is the quitting check still necessary ? // FIXME: is the quitting check still necessary ?
if (!ask || buf->isClean() || quitting || buf->paragraphs.empty()) { if (!ask || buf->isClean() || quitting || buf->paragraphs().empty()) {
release(buf); release(buf);
return true; return true;
} }

View File

@ -299,7 +299,7 @@ string const currentState(BufferView * bv)
Buffer * buffer = bv->buffer(); Buffer * buffer = bv->buffer();
LyXCursor const & c(text->cursor); LyXCursor const & c(text->cursor);
bool const show_change = buffer->params.tracking_changes bool const show_change = buffer->params().tracking_changes
&& c.pos() != c.par()->size() && c.pos() != c.par()->size()
&& c.par()->lookupChange(c.pos()) != Change::UNCHANGED; && c.par()->lookupChange(c.pos()) != Change::UNCHANGED;
@ -319,11 +319,11 @@ string const currentState(BufferView * bv)
// font. (Asger) // font. (Asger)
LyXFont font = text->real_current_font; LyXFont font = text->real_current_font;
LyXFont const & defaultfont = LyXFont const & defaultfont =
buffer->params.getLyXTextClass().defaultfont(); buffer->params().getLyXTextClass().defaultfont();
font.reduce(defaultfont); font.reduce(defaultfont);
// avoid _(...) re-entrance problem // avoid _(...) re-entrance problem
string const s = font.stateText(&buffer->params); string const s = font.stateText(&buffer->params());
state << bformat(_("Font: %1$s"), s); state << bformat(_("Font: %1$s"), s);
// state << bformat(_("Font: %1$s"), font.stateText(&buffer->params)); // state << bformat(_("Font: %1$s"), font.stateText(&buffer->params));

View File

@ -296,7 +296,7 @@ bool Converters::convert(Buffer const * buffer,
string real_outfile; string real_outfile;
if (outfile == infile) { if (outfile == infile) {
real_outfile = infile; real_outfile = infile;
outfile = AddName(buffer->tmppath, "tmpfile.out"); outfile = AddName(buffer->temppath(), "tmpfile.out");
} }
if (conv.latex) { if (conv.latex) {
@ -330,10 +330,10 @@ bool Converters::convert(Buffer const * buffer,
if (conv.from == "dvi" && conv.to == "ps") if (conv.from == "dvi" && conv.to == "ps")
command = add_options(command, command = add_options(command,
buffer->params.dvips_options()); buffer->params().dvips_options());
else if (conv.from == "dvi" && prefixIs(conv.to, "pdf")) else if (conv.from == "dvi" && prefixIs(conv.to, "pdf"))
command = add_options(command, command = add_options(command,
dvipdfm_options(buffer->params)); dvipdfm_options(buffer->params()));
lyxerr[Debug::FILES] << "Calling " << command << endl; lyxerr[Debug::FILES] << "Calling " << command << endl;
buffer->message(_("Executing command: ") + command); buffer->message(_("Executing command: ") + command);

View File

@ -42,7 +42,7 @@ namespace {
vector<string> const Backends(Buffer const & buffer) vector<string> const Backends(Buffer const & buffer)
{ {
vector<string> v; vector<string> v;
if (buffer.params.getLyXTextClass().isTeXClassAvailable()) if (buffer.params().getLyXTextClass().isTeXClassAvailable())
v.push_back(BufferFormat(buffer)); v.push_back(BufferFormat(buffer));
v.push_back("text"); v.push_back("text");
return v; return v;
@ -80,8 +80,8 @@ bool Exporter::Export(Buffer * buffer, string const & format,
backend_format = format; backend_format = format;
string filename = buffer->getLatexName(false); string filename = buffer->getLatexName(false);
if (!buffer->tmppath.empty()) if (!buffer->temppath().empty())
filename = AddName(buffer->tmppath, filename); filename = AddName(buffer->temppath(), filename);
filename = ChangeExtension(filename, filename = ChangeExtension(filename,
formats.extension(backend_format)); formats.extension(backend_format));

View File

@ -60,7 +60,7 @@ using std::endl;
InsetOld * createInset(FuncRequest const & cmd) InsetOld * createInset(FuncRequest const & cmd)
{ {
BufferView * bv = cmd.view(); BufferView * bv = cmd.view();
BufferParams const & params = bv->buffer()->params; BufferParams const & params = bv->buffer()->params();
switch (cmd.action) { switch (cmd.action) {
case LFUN_HFILL: case LFUN_HFILL:
@ -365,39 +365,39 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
inset = new InsetGraphics; inset = new InsetGraphics;
} else if (tmptok == "Note" || tmptok == "Comment" } else if (tmptok == "Note" || tmptok == "Comment"
|| tmptok == "Greyedout") { || tmptok == "Greyedout") {
inset = new InsetNote(buf.params, tmptok); inset = new InsetNote(buf.params(), tmptok);
} else if (tmptok == "Branch") { } else if (tmptok == "Branch") {
inset = new InsetBranch(buf.params, tmptok); inset = new InsetBranch(buf.params(), tmptok);
} else if (tmptok == "Include") { } else if (tmptok == "Include") {
InsetCommandParams p("Include"); InsetCommandParams p("Include");
inset = new InsetInclude(p, buf); inset = new InsetInclude(p, buf);
} else if (tmptok == "Environment") { } else if (tmptok == "Environment") {
lex.next(); lex.next();
inset = new InsetEnvironment(buf.params, lex.getString()); inset = new InsetEnvironment(buf.params(), lex.getString());
} else if (tmptok == "ERT") { } else if (tmptok == "ERT") {
inset = new InsetERT(buf.params); inset = new InsetERT(buf.params());
} else if (tmptok == "InsetSpace") { } else if (tmptok == "InsetSpace") {
inset = new InsetSpace; inset = new InsetSpace;
} else if (tmptok == "Tabular") { } else if (tmptok == "Tabular") {
inset = new InsetTabular(buf); inset = new InsetTabular(buf);
} else if (tmptok == "Text") { } else if (tmptok == "Text") {
inset = new InsetText(buf.params); inset = new InsetText(buf.params());
} else if (tmptok == "Foot") { } else if (tmptok == "Foot") {
inset = new InsetFoot(buf.params); inset = new InsetFoot(buf.params());
} else if (tmptok == "Marginal") { } else if (tmptok == "Marginal") {
inset = new InsetMarginal(buf.params); inset = new InsetMarginal(buf.params());
} else if (tmptok == "OptArg") { } else if (tmptok == "OptArg") {
inset = new InsetOptArg(buf.params); inset = new InsetOptArg(buf.params());
} else if (tmptok == "Minipage") { } else if (tmptok == "Minipage") {
inset = new InsetMinipage(buf.params); inset = new InsetMinipage(buf.params());
} else if (tmptok == "Float") { } else if (tmptok == "Float") {
lex.next(); lex.next();
string tmptok = lex.getString(); string tmptok = lex.getString();
inset = new InsetFloat(buf.params, tmptok); inset = new InsetFloat(buf.params(), tmptok);
} else if (tmptok == "Wrap") { } else if (tmptok == "Wrap") {
lex.next(); lex.next();
string tmptok = lex.getString(); string tmptok = lex.getString();
inset = new InsetWrap(buf.params, tmptok); inset = new InsetWrap(buf.params(), tmptok);
#if 0 #if 0
} else if (tmptok == "List") { } else if (tmptok == "List") {
inset = new InsetList; inset = new InsetList;
@ -405,7 +405,7 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
inset = new InsetList; inset = new InsetList;
#endif #endif
} else if (tmptok == "Caption") { } else if (tmptok == "Caption") {
inset = new InsetCaption(buf.params); inset = new InsetCaption(buf.params());
} else if (tmptok == "FloatList") { } else if (tmptok == "FloatList") {
inset = new InsetFloatList; inset = new InsetFloatList;
} }

View File

@ -171,11 +171,11 @@ bool Formats::view(Buffer const & buffer, string const & filename,
if (format_name == "dvi" && if (format_name == "dvi" &&
!lyxrc.view_dvi_paper_option.empty()) { !lyxrc.view_dvi_paper_option.empty()) {
command += ' ' + lyxrc.view_dvi_paper_option; command += ' ' + lyxrc.view_dvi_paper_option;
string paper_size = buffer.params.paperSizeName(); string paper_size = buffer.params().paperSizeName();
if (paper_size == "letter") if (paper_size == "letter")
paper_size = "us"; paper_size = "us";
command += ' ' + paper_size; command += ' ' + paper_size;
if (buffer.params.orientation == ORIENTATION_LANDSCAPE) if (buffer.params().orientation == ORIENTATION_LANDSCAPE)
command += 'r'; command += 'r';
} }

View File

@ -140,8 +140,8 @@ void LyXView::updateLayoutChoice()
} }
// update the layout display // update the layout display
if (toolbar_->updateLayoutList(buffer()->params.textclass)) { if (toolbar_->updateLayoutList(buffer()->params().textclass)) {
current_layout = buffer()->params.getLyXTextClass().defaultLayoutName(); current_layout = buffer()->params().getLyXTextClass().defaultLayoutName();
} }
string const & layout = string const & layout =

View File

@ -217,7 +217,7 @@ void ControlCharacter::setLanguage(string const & val)
font_->setLanguage(ignore_language); font_->setLanguage(ignore_language);
else if (val == "reset") else if (val == "reset")
font_->setLanguage(kernel().buffer().params.language); font_->setLanguage(kernel().buffer().params().language);
else else
font_->setLanguage(languages.getLanguage(val)); font_->setLanguage(languages.getLanguage(val));

View File

@ -69,7 +69,7 @@ biblio::InfoMap const & ControlCitation::bibkeysInfo() const
bool ControlCitation::usingNatbib() const bool ControlCitation::usingNatbib() const
{ {
return kernel().buffer().params.use_natbib; return kernel().buffer().params().use_natbib;
} }
@ -80,7 +80,7 @@ vector<string> const ControlCitation::getCiteStrings(string const & key) const
vector<biblio::CiteStyle> const cs = vector<biblio::CiteStyle> const cs =
biblio::getCiteStyles(usingNatbib()); biblio::getCiteStyles(usingNatbib());
if (kernel().buffer().params.use_numerical_citations) if (kernel().buffer().params().use_numerical_citations)
styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs); styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs);
else else
styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs); styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs);

View File

@ -69,7 +69,7 @@ void ControlDocument::apply()
classApply(); classApply();
buffer()->params = *bp_; buffer()->params() = *bp_;
lv_.view()->redoCurrentBuffer(); lv_.view()->redoCurrentBuffer();
@ -93,13 +93,13 @@ void ControlDocument::setParams()
bp_.reset(new BufferParams()); bp_.reset(new BufferParams());
/// Set the buffer parameters /// Set the buffer parameters
*bp_ = buffer()->params; *bp_ = buffer()->params();
} }
void ControlDocument::setLanguage() void ControlDocument::setLanguage()
{ {
Language const * oldL = buffer()->params.language; Language const * oldL = buffer()->params().language;
Language const * newL = bp_->language; Language const * newL = bp_->language;
if (oldL != newL) { if (oldL != newL) {
@ -115,7 +115,7 @@ void ControlDocument::setLanguage()
void ControlDocument::classApply() void ControlDocument::classApply()
{ {
BufferParams & params = buffer()->params; BufferParams & params = buffer()->params();
lyx::textclass_type const old_class = params.textclass; lyx::textclass_type const old_class = params.textclass;
lyx::textclass_type const new_class = bp_->textclass; lyx::textclass_type const new_class = bp_->textclass;
@ -124,13 +124,13 @@ void ControlDocument::classApply()
return; return;
// successfully loaded // successfully loaded
buffer()->params = *bp_; buffer()->params() = *bp_;
lv_.message(_("Converting document to new document class...")); lv_.message(_("Converting document to new document class..."));
ErrorList el; ErrorList el;
CutAndPaste::SwitchLayoutsBetweenClasses(old_class, new_class, CutAndPaste::SwitchLayoutsBetweenClasses(old_class, new_class,
lv_.buffer()->paragraphs, lv_.buffer()->paragraphs(),
el); el);
bufferErrors(*buffer(), el); bufferErrors(*buffer(), el);
bufferview()->showErrorList(_("Class switch")); bufferview()->showErrorList(_("Class switch"));
@ -162,17 +162,17 @@ void ControlDocument::saveAsDefault()
return; return;
#endif #endif
lv_.buffer()->params.preamble = bp_->preamble; lv_.buffer()->params().preamble = bp_->preamble;
string const fname = AddName(AddPath(user_lyxdir(), "templates/"), string const fname = AddName(AddPath(user_lyxdir(), "templates/"),
"defaults.lyx"); "defaults.lyx");
Buffer defaults(fname); Buffer defaults(fname);
defaults.params = params(); defaults.params() = params();
// add an empty paragraph. Is this enough? // add an empty paragraph. Is this enough?
Paragraph par; Paragraph par;
par.layout(params().getLyXTextClass().defaultLayout()); par.layout(params().getLyXTextClass().defaultLayout());
defaults.paragraphs.push_back(par); defaults.paragraphs().push_back(par);
defaults.writeFile(defaults.fileName()); defaults.writeFile(defaults.fileName());

View File

@ -33,7 +33,7 @@ void ControlPreamble::apply()
view().apply(); view().apply();
buffer()->params.preamble = params(); buffer()->params().preamble = params();
buffer()->markDirty(); buffer()->markDirty();
lv_.message(_("LaTeX preamble set")); lv_.message(_("LaTeX preamble set"));
} }
@ -53,7 +53,7 @@ void ControlPreamble::params(string const & newparams)
void ControlPreamble::setParams() void ControlPreamble::setParams()
{ {
params_ = buffer()->params.preamble; params_ = buffer()->params().preamble;
} }

View File

@ -153,7 +153,7 @@ void ControlPrint::apply()
command += lyxrc.print_extra_options + ' '; command += lyxrc.print_extra_options + ' ';
} }
command += buffer()->params.dvips_options() + ' '; command += buffer()->params().dvips_options() + ' ';
if (!Exporter::Export(buffer(), "dvi", true)) { if (!Exporter::Export(buffer(), "dvi", true)) {
showPrintError(buffer()->fileName()); showPrintError(buffer()->fileName());
@ -163,7 +163,7 @@ void ControlPrint::apply()
// Push directory path. // Push directory path.
string path = buffer()->filePath(); string path = buffer()->filePath();
if (lyxrc.use_tempdir || !IsDirWriteable(path)) { if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
path = buffer()->tmppath; path = buffer()->temppath();
} }
Path p(path); Path p(path);

View File

@ -120,8 +120,8 @@ void ControlSendto::apply()
if (format_->name() == "lyx") { if (format_->name() == "lyx") {
filename = ChangeExtension(buffer()->getLatexName(false), filename = ChangeExtension(buffer()->getLatexName(false),
format_->extension()); format_->extension());
if (!buffer()->tmppath.empty()) if (!buffer()->temppath().empty())
filename = AddName(buffer()->tmppath, filename); filename = AddName(buffer()->temppath(), filename);
buffer()->writeFile(filename); buffer()->writeFile(filename);

View File

@ -97,7 +97,7 @@ void ControlSpellchecker::startSession()
return; return;
} }
speller_.reset(getSpeller(buffer()->params)); speller_.reset(getSpeller(buffer()->params()));
// reset values to initial // reset values to initial
newval_ = 0.0; newval_ = 0.0;

View File

@ -36,7 +36,7 @@ string const ControlVCLog::getBufferFileName() const
void ControlVCLog::getVCLogFile(ostream & ss) const void ControlVCLog::getVCLogFile(ostream & ss) const
{ {
string const name = kernel().buffer().lyxvc.getLogFile(); string const name = kernel().buffer().lyxvc().getLogFile();
std::ifstream in(name.c_str()); std::ifstream in(name.c_str());

View File

@ -98,7 +98,7 @@ void QLToolbar::changed_layout(string const & sel)
owner_->centralWidget()->setFocus(); owner_->centralWidget()->setFocus();
LyXTextClass const & tc = LyXTextClass const & tc =
owner_->buffer()->params.getLyXTextClass(); owner_->buffer()->params().getLyXTextClass();
LyXTextClass::const_iterator end = tc.end(); LyXTextClass::const_iterator end = tc.end();
for (LyXTextClass::const_iterator cit = tc.begin(); for (LyXTextClass::const_iterator cit = tc.begin();
@ -120,7 +120,7 @@ void QLToolbar::setLayout(string const & layout)
return; return;
LyXTextClass const & tc = LyXTextClass const & tc =
owner_->buffer()->params.getLyXTextClass(); owner_->buffer()->params().getLyXTextClass();
QString const & name = qt_(tc[layout]->name()); QString const & name = qt_(tc[layout]->name());
@ -146,7 +146,7 @@ void QLToolbar::updateLayoutList()
return; return;
LyXTextClass const & tc = LyXTextClass const & tc =
owner_->buffer()->params.getLyXTextClass(); owner_->buffer()->params().getLyXTextClass();
combo_->setUpdatesEnabled(false); combo_->setUpdatesEnabled(false);

View File

@ -147,7 +147,7 @@ void LyXScreen::showCursor(BufferView & bv)
LyXText const & text = *bv.getLyXText(); LyXText const & text = *bv.getLyXText();
LyXFont const & realfont = text.real_current_font; LyXFont const & realfont = text.real_current_font;
BufferParams const & bp = bv.buffer()->params; BufferParams const & bp = bv.buffer()->params();
bool const samelang = realfont.language() == bp.language; bool const samelang = realfont.language() == bp.language;
bool const isrtl = realfont.isVisibleRightToLeft(); bool const isrtl = realfont.isVisibleRightToLeft();

View File

@ -168,7 +168,7 @@ void XFormsToolbar::layoutSelected()
string const & layoutguiname = getString(combox_); string const & layoutguiname = getString(combox_);
LyXTextClass const & tc = LyXTextClass const & tc =
owner_->buffer()->params.getLyXTextClass(); owner_->buffer()->params().getLyXTextClass();
LyXTextClass::const_iterator end = tc.end(); LyXTextClass::const_iterator end = tc.end();
for (LyXTextClass::const_iterator cit = tc.begin(); for (LyXTextClass::const_iterator cit = tc.begin();
@ -188,7 +188,7 @@ void XFormsToolbar::setLayout(string const & layout)
if (!combox_) if (!combox_)
return; return;
LyXTextClass const & tc = owner_->buffer()->params.getLyXTextClass(); LyXTextClass const & tc = owner_->buffer()->params().getLyXTextClass();
string const layoutname = _(tc[layout]->name()); string const layoutname = _(tc[layout]->name());
int const nnames = fl_get_combox_maxitems(combox_); int const nnames = fl_get_combox_maxitems(combox_);
@ -208,7 +208,7 @@ void XFormsToolbar::updateLayoutList()
return; return;
fl_clear_combox(combox_); fl_clear_combox(combox_);
LyXTextClass const & tc = owner_->buffer()->params.getLyXTextClass(); LyXTextClass const & tc = owner_->buffer()->params().getLyXTextClass();
LyXTextClass::const_iterator end = tc.end(); LyXTextClass::const_iterator end = tc.end();
for (LyXTextClass::const_iterator cit = tc.begin(); for (LyXTextClass::const_iterator cit = tc.begin();
cit != end; ++cit) { cit != end; ++cit) {

View File

@ -449,7 +449,7 @@ void PreviewLoader::Impl::startLoading()
lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()" << endl; lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()" << endl;
// As used by the LaTeX file and by the resulting image files // As used by the LaTeX file and by the resulting image files
string directory = buffer_.tmppath; string directory = buffer_.temppath();
if (directory.empty()) if (directory.empty())
directory = buffer_.filePath(); directory = buffer_.filePath();

View File

@ -133,8 +133,8 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const &)
int w = 0; int w = 0;
// Ha, now we are mainly at 1.2.0 and it is still here (Jug) // Ha, now we are mainly at 1.2.0 and it is still here (Jug)
// Does look like a hack? It is! (but will change at 0.13) // Does look like a hack? It is! (but will change at 0.13)
ParagraphList::iterator it = bv->buffer()->paragraphs.begin(); ParagraphList::iterator it = bv->buffer()->paragraphs().begin();
ParagraphList::iterator end = bv->buffer()->paragraphs.end(); ParagraphList::iterator end = bv->buffer()->paragraphs().end();
for (; it != end; ++it) { for (; it != end; ++it) {
if (it->bibitem()) { if (it->bibitem()) {
#warning metrics broken! #warning metrics broken!
@ -156,8 +156,8 @@ string const bibitemWidest(Buffer const & buffer)
InsetBibitem const * bitem = 0; InsetBibitem const * bitem = 0;
LyXFont font; LyXFont font;
ParagraphList::const_iterator it = buffer.paragraphs.begin(); ParagraphList::const_iterator it = buffer.paragraphs().begin();
ParagraphList::const_iterator end = buffer.paragraphs.end(); ParagraphList::const_iterator end = buffer.paragraphs().end();
for (; it != end; ++it) { for (; it != end; ++it) {
if (it->bibitem()) { if (it->bibitem()) {

View File

@ -140,9 +140,9 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
// part of its name, because it's than book. // part of its name, because it's than book.
// For the "official" lyx-layouts it's no problem to support // For the "official" lyx-layouts it's no problem to support
// all well // all well
if (!contains(buffer.params.getLyXTextClass().name(), if (!contains(buffer.params().getLyXTextClass().name(),
"art")) { "art")) {
if (buffer.params.sides == LyXTextClass::OneSide) { if (buffer.params().sides == LyXTextClass::OneSide) {
// oneside // oneside
os << "\\clearpage"; os << "\\clearpage";
} else { } else {

View File

@ -148,7 +148,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
int InsetBranch::latex(Buffer const & buf, ostream & os, int InsetBranch::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const LatexRunParams const & runparams) const
{ {
string const branch_sel = buf.params.branchlist.allSelected(); string const branch_sel = buf.params().branchlist.allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos) if (branch_sel.find(params_.branch, 0) != string::npos)
return inset.latex(buf, os, runparams); return inset.latex(buf, os, runparams);
return 0; return 0;
@ -164,7 +164,7 @@ int InsetBranch::linuxdoc(Buffer const &, std::ostream &) const
int InsetBranch::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const int InsetBranch::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
{ {
// untested - MV // untested - MV
string const branch_sel = buf.params.branchlist.allSelected(); string const branch_sel = buf.params().branchlist.allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos) if (branch_sel.find(params_.branch, 0) != string::npos)
return inset.docbook(buf, os, mixcont); return inset.docbook(buf, os, mixcont);
return 0; return 0;
@ -173,7 +173,7 @@ int InsetBranch::docbook(Buffer const & buf, std::ostream & os, bool mixcont) co
int InsetBranch::ascii(Buffer const & buf, std::ostream & os, int ll) const int InsetBranch::ascii(Buffer const & buf, std::ostream & os, int ll) const
{ {
string const branch_sel = buf.params.branchlist.allSelected(); string const branch_sel = buf.params().branchlist.allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos) { if (branch_sel.find(params_.branch, 0) != string::npos) {
return inset.ascii(buf, os, ll); return inset.ascii(buf, os, ll);
} }
@ -198,7 +198,7 @@ InsetBranchMailer::InsetBranchMailer(string const & name,
string const InsetBranchMailer::inset2string(Buffer const & buf) const string const InsetBranchMailer::inset2string(Buffer const & buf) const
{ {
InsetBranchParams params = inset_.params(); InsetBranchParams params = inset_.params();
params.branchlist = buf.params.branchlist; params.branchlist = buf.params().branchlist;
inset_.setParams(params); inset_.setParams(params);
return params2string(name_, params); return params2string(name_, params);
} }

View File

@ -95,7 +95,7 @@ void InsetCaption::draw(PainterInfo & pi, int x, int y) const
Assert(0); Assert(0);
FloatList const & floats = FloatList const & floats =
pi.base.bv->buffer()->params.getLyXTextClass().floats(); pi.base.bv->buffer()->params().getLyXTextClass().floats();
string const fl = i2 ? floats.getType(type).name() : N_("Float"); string const fl = i2 ? floats.getType(type).name() : N_("Float");
// Discover the number... // Discover the number...

View File

@ -246,7 +246,7 @@ string const InsetCitation::generateLabel(Buffer const & buffer) const
string const after = getOptions(); string const after = getOptions();
string label; string label;
if (buffer.params.use_natbib) { if (buffer.params().use_natbib) {
string cmd = getCmdName(); string cmd = getCmdName();
if (cmd == "cite") { if (cmd == "cite") {
// We may be "upgrading" from an older LyX version. // We may be "upgrading" from an older LyX version.
@ -254,14 +254,14 @@ string const InsetCitation::generateLabel(Buffer const & buffer) const
// author/year info is not present in the biblio // author/year info is not present in the biblio
// database, then getNatbibLabel will exit gracefully // database, then getNatbibLabel will exit gracefully
// and we'll call getBasicLabel. // and we'll call getBasicLabel.
if (buffer.params.use_numerical_citations) if (buffer.params().use_numerical_citations)
cmd = "citep"; cmd = "citep";
else else
cmd = "citet"; cmd = "citet";
} }
label = getNatbibLabel(buffer, cmd, getContents(), label = getNatbibLabel(buffer, cmd, getContents(),
before, after, before, after,
buffer.params.use_numerical_citations); buffer.params().use_numerical_citations);
} }
// Fallback to fail-safe // Fallback to fail-safe
@ -277,8 +277,8 @@ InsetCitation::Cache::Style InsetCitation::getStyle(Buffer const & buffer) const
{ {
Cache::Style style = Cache::BASIC; Cache::Style style = Cache::BASIC;
if (buffer.params.use_natbib) { if (buffer.params().use_natbib) {
if (buffer.params.use_numerical_citations) { if (buffer.params().use_numerical_citations) {
style = Cache::NATBIB_NUM; style = Cache::NATBIB_NUM;
} else { } else {
style = Cache::NATBIB_AY; style = Cache::NATBIB_AY;
@ -359,7 +359,7 @@ int InsetCitation::latex(Buffer const & buffer, ostream & os,
LatexRunParams const &) const LatexRunParams const &) const
{ {
os << "\\"; os << "\\";
if (buffer.params.use_natbib) if (buffer.params().use_natbib)
os << getCmdName(); os << getCmdName();
else else
os << "cite"; os << "cite";
@ -373,7 +373,7 @@ int InsetCitation::latex(Buffer const & buffer, ostream & os,
string const before = string(); string const before = string();
string const after = getOptions(); string const after = getOptions();
if (!before.empty() && buffer.params.use_natbib) if (!before.empty() && buffer.params().use_natbib)
os << '[' << before << "][" << after << ']'; os << '[' << before << "][" << after << ']';
else if (!after.empty()) else if (!after.empty())
os << '[' << after << ']'; os << '[' << after << ']';

View File

@ -197,7 +197,7 @@ void InsetERT::write(Buffer const & buf, ostream & os) const
<< "status "<< st << "\n"; << "status "<< st << "\n";
//inset.writeParagraphData(buf, os); //inset.writeParagraphData(buf, os);
string const layout(buf.params.getLyXTextClass().defaultLayoutName()); string const layout(buf.params().getLyXTextClass().defaultLayoutName());
ParagraphList::iterator par = inset.paragraphs.begin(); ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end(); ParagraphList::iterator end = inset.paragraphs.end();
for (; par != end; ++par) { for (; par != end; ++par) {

View File

@ -406,7 +406,7 @@ int InsetExternal::latex(Buffer const & buf, ostream & os,
// If we're running through the LaTeX compiler, we should write the // If we're running through the LaTeX compiler, we should write the
// generated files in the bufer's temporary directory. // generated files in the bufer's temporary directory.
bool const external_in_tmpdir = bool const external_in_tmpdir =
lyxrc.use_tempdir && !buf.tmppath.empty() && !runparams.nice; lyxrc.use_tempdir && !buf.temppath().empty() && !runparams.nice;
// If the template has specified a PDFLaTeX output, then we try and // If the template has specified a PDFLaTeX output, then we try and
// use that. // use that.
@ -518,7 +518,7 @@ void InsetExternal::updateExternal(string const & format,
// We are running stuff through LaTeX // We are running stuff through LaTeX
string const temp_file = string const temp_file =
support::MakeAbsPath(params_.filename.mangledFilename(), support::MakeAbsPath(params_.filename.mangledFilename(),
buf.tmppath); buf.temppath());
unsigned long const from_checksum = support::sum(from_file); unsigned long const from_checksum = support::sum(from_file);
unsigned long const temp_checksum = support::sum(temp_file); unsigned long const temp_checksum = support::sum(temp_file);
@ -573,7 +573,7 @@ string const doSubstitution(InsetExternal::Params const & params,
string contents; string contents;
string const filepath = support::IsFileReadable(file) ? string const filepath = support::IsFileReadable(file) ?
buffer.filePath() : buffer.tmppath; buffer.filePath() : buffer.temppath();
support::Path p(filepath); support::Path p(filepath);
if (support::IsFileReadable(file)) if (support::IsFileReadable(file))

View File

@ -167,7 +167,7 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
params_.placement = params.placement; params_.placement = params.placement;
params_.wide = params.wide; params_.wide = params.wide;
wide(params_.wide, cmd.view()->buffer()->params); wide(params_.wide, cmd.view()->buffer()->params());
cmd.view()->updateInset(this); cmd.view()->updateInset(this);
return DISPATCHED; return DISPATCHED;
} }
@ -236,7 +236,7 @@ void InsetFloat::write(Buffer const & buf, ostream & os) const
void InsetFloat::read(Buffer const & buf, LyXLex & lex) void InsetFloat::read(Buffer const & buf, LyXLex & lex)
{ {
params_.read(lex); params_.read(lex);
wide(params_.wide, buf.params); wide(params_.wide, buf.params());
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
} }
@ -267,7 +267,7 @@ string const InsetFloat::editMessage() const
int InsetFloat::latex(Buffer const & buf, ostream & os, int InsetFloat::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const LatexRunParams const & runparams) const
{ {
FloatList const & floats = buf.params.getLyXTextClass().floats(); FloatList const & floats = buf.params().getLyXTextClass().floats();
string const tmptype = (params_.wide ? params_.type + "*" : params_.type); string const tmptype = (params_.wide ? params_.type + "*" : params_.type);
// Figure out the float placement to use. // Figure out the float placement to use.
// From lowest to highest: // From lowest to highest:
@ -275,7 +275,7 @@ int InsetFloat::latex(Buffer const & buf, ostream & os,
// - document wide default placement // - document wide default placement
// - specific float placement // - specific float placement
string placement; string placement;
string const buf_placement = buf.params.float_placement; string const buf_placement = buf.params().float_placement;
string const def_placement = floats.defaultPlacement(params_.type); string const def_placement = floats.defaultPlacement(params_.type);
if (!params_.placement.empty() if (!params_.placement.empty()
&& params_.placement != def_placement) { && params_.placement != def_placement) {
@ -308,7 +308,7 @@ int InsetFloat::latex(Buffer const & buf, ostream & os,
int InsetFloat::linuxdoc(Buffer const & buf, ostream & os) const int InsetFloat::linuxdoc(Buffer const & buf, ostream & os) const
{ {
FloatList const & floats = buf.params.getLyXTextClass().floats(); FloatList const & floats = buf.params().getLyXTextClass().floats();
string const tmptype = params_.type; string const tmptype = params_.type;
// Figure out the float placement to use. // Figure out the float placement to use.
// From lowest to highest: // From lowest to highest:
@ -318,7 +318,7 @@ int InsetFloat::linuxdoc(Buffer const & buf, ostream & os) const
// This is the same as latex, as linuxdoc is modeled after latex. // This is the same as latex, as linuxdoc is modeled after latex.
string placement; string placement;
string const buf_placement = buf.params.float_placement; string const buf_placement = buf.params().float_placement;
string const def_placement = floats.defaultPlacement(params_.type); string const def_placement = floats.defaultPlacement(params_.type);
if (!params_.placement.empty() if (!params_.placement.empty()
&& params_.placement != def_placement) { && params_.placement != def_placement) {
@ -398,7 +398,7 @@ void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
// Find a caption layout in one of the (child inset's) pars // Find a caption layout in one of the (child inset's) pars
for (; pit != end; ++pit) { for (; pit != end; ++pit) {
if (pit->layout()->name() == caplayout) { if (pit->layout()->name() == caplayout) {
string const name = floatname(params_.type, buf.params); string const name = floatname(params_.type, buf.params());
string const str = string const str =
tostr(toclist[name].size() + 1) tostr(toclist[name].size() + 1)
+ ". " + pit->asString(buf, false); + ". " + pit->asString(buf, false);

View File

@ -52,7 +52,7 @@ InsetFloatList::~InsetFloatList()
string const InsetFloatList::getScreenLabel(Buffer const & buf) const string const InsetFloatList::getScreenLabel(Buffer const & buf) const
{ {
FloatList const & floats = buf.params.getLyXTextClass().floats(); FloatList const & floats = buf.params().getLyXTextClass().floats();
FloatList::const_iterator it = floats[getCmdName()]; FloatList::const_iterator it = floats[getCmdName()];
if (it != floats.end()) if (it != floats.end())
return _(it->second.listName()); return _(it->second.listName());
@ -75,7 +75,7 @@ void InsetFloatList::write(Buffer const &, ostream & os) const
void InsetFloatList::read(Buffer const & buf, LyXLex & lex) void InsetFloatList::read(Buffer const & buf, LyXLex & lex)
{ {
FloatList const & floats = buf.params.getLyXTextClass().floats(); FloatList const & floats = buf.params().getLyXTextClass().floats();
string token; string token;
if (lex.eatLine()) { if (lex.eatLine()) {
@ -137,7 +137,7 @@ dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
int InsetFloatList::latex(Buffer const & buf, ostream & os, int InsetFloatList::latex(Buffer const & buf, ostream & os,
LatexRunParams const &) const LatexRunParams const &) const
{ {
FloatList const & floats = buf.params.getLyXTextClass().floats(); FloatList const & floats = buf.params().getLyXTextClass().floats();
FloatList::const_iterator cit = floats[getCmdName()]; FloatList::const_iterator cit = floats[getCmdName()];
if (cit != floats.end()) { if (cit != floats.end()) {

View File

@ -427,7 +427,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
if (zipped) { if (zipped) {
CopyStatus status; CopyStatus status;
boost::tie(status, temp_file) = boost::tie(status, temp_file) =
copyToDirIfNeeded(orig_file, buf.tmppath); copyToDirIfNeeded(orig_file, buf.temppath());
if (status == FAILURE) if (status == FAILURE)
return orig_file; return orig_file;
@ -459,7 +459,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
if (lyxrc.use_tempdir) { if (lyxrc.use_tempdir) {
CopyStatus status; CopyStatus status;
boost::tie(status, temp_file) = boost::tie(status, temp_file) =
copyToDirIfNeeded(orig_file, buf.tmppath); copyToDirIfNeeded(orig_file, buf.temppath());
if (status == FAILURE) if (status == FAILURE)
return orig_file; return orig_file;
@ -608,7 +608,7 @@ int InsetGraphics::ascii(Buffer const &, ostream & os, int) const
int InsetGraphics::linuxdoc(Buffer const & buf, ostream & os) const int InsetGraphics::linuxdoc(Buffer const & buf, ostream & os) const
{ {
string const file_name = buf.niceFile ? string const file_name = buf.niceFile() ?
params().filename.relFilename(buf.filePath()): params().filename.relFilename(buf.filePath()):
params().filename.absFilename(); params().filename.absFilename();

View File

@ -323,13 +323,13 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
Buffer * tmp = bufferlist.getBuffer(getFileName()); Buffer * tmp = bufferlist.getBuffer(getFileName());
// FIXME: this should be a GUI warning // FIXME: this should be a GUI warning
if (tmp->params.textclass != buffer.params.textclass) { if (tmp->params().textclass != buffer.params().textclass) {
lyxerr << "WARNING: Included file `" lyxerr << "WARNING: Included file `"
<< MakeDisplayPath(getFileName()) << MakeDisplayPath(getFileName())
<< "' has textclass `" << "' has textclass `"
<< tmp->params.getLyXTextClass().name() << tmp->params().getLyXTextClass().name()
<< "' while parent file has textclass `" << "' while parent file has textclass `"
<< buffer.params.getLyXTextClass().name() << buffer.params().getLyXTextClass().name()
<< "'." << endl; << "'." << endl;
//return 0; //return 0;
} }
@ -337,19 +337,19 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
// write it to a file (so far the complete file) // write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".tex"); string writefile = ChangeExtension(getFileName(), ".tex");
if (!buffer.tmppath.empty() && !runparams.nice) { if (!buffer.temppath().empty() && !runparams.nice) {
incfile = subst(incfile, '/','@'); incfile = subst(incfile, '/','@');
#ifdef __EMX__ #ifdef __EMX__
incfile = subst(incfile, ':', '$'); incfile = subst(incfile, ':', '$');
#endif #endif
writefile = AddName(buffer.tmppath, incfile); writefile = AddName(buffer.temppath(), incfile);
} else } else
writefile = getFileName(); writefile = getFileName();
writefile = ChangeExtension(writefile, ".tex"); writefile = ChangeExtension(writefile, ".tex");
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl; lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl; lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
tmp->markDepClean(buffer.tmppath); tmp->markDepClean(buffer.temppath());
tmp->makeLaTeXFile(writefile, OnlyPath(getMasterFilename()), tmp->makeLaTeXFile(writefile, OnlyPath(getMasterFilename()),
runparams, false); runparams, false);
@ -399,9 +399,9 @@ int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os) const
// write it to a file (so far the complete file) // write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".sgml"); string writefile = ChangeExtension(getFileName(), ".sgml");
if (!buffer.tmppath.empty() && !buffer.niceFile) { if (!buffer.temppath().empty() && !buffer.niceFile()) {
incfile = subst(incfile, '/','@'); incfile = subst(incfile, '/','@');
writefile = AddName(buffer.tmppath, incfile); writefile = AddName(buffer.temppath(), incfile);
} else } else
writefile = getFileName(); writefile = getFileName();
@ -411,7 +411,7 @@ int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os) const
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl; lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl; lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
tmp->makeLinuxDocFile(writefile, buffer.niceFile, true); tmp->makeLinuxDocFile(writefile, buffer.niceFile(), true);
} }
if (isVerbatim()) { if (isVerbatim()) {
@ -439,9 +439,9 @@ int InsetInclude::docbook(Buffer const & buffer, ostream & os,
// write it to a file (so far the complete file) // write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".sgml"); string writefile = ChangeExtension(getFileName(), ".sgml");
if (!buffer.tmppath.empty() && !buffer.niceFile) { if (!buffer.temppath().empty() && !buffer.niceFile()) {
incfile = subst(incfile, '/','@'); incfile = subst(incfile, '/','@');
writefile = AddName(buffer.tmppath, incfile); writefile = AddName(buffer.temppath(), incfile);
} else } else
writefile = getFileName(); writefile = getFileName();
if (IsLyXFilename(getFileName())) if (IsLyXFilename(getFileName()))
@ -450,7 +450,7 @@ int InsetInclude::docbook(Buffer const & buffer, ostream & os,
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl; lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl; lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
tmp->makeDocBookFile(writefile, buffer.niceFile, true); tmp->makeDocBookFile(writefile, buffer.niceFile(), true);
} }
if (isVerbatim()) { if (isVerbatim()) {
@ -472,9 +472,9 @@ void InsetInclude::validate(LaTeXFeatures & features) const
Buffer const & b = *bufferlist.getBuffer(getMasterFilename()); Buffer const & b = *bufferlist.getBuffer(getMasterFilename());
if (!b.tmppath.empty() && !b.niceFile && !isVerbatim()) { if (!b.temppath().empty() && !b.niceFile() && !isVerbatim()) {
incfile = subst(incfile, '/','@'); incfile = subst(incfile, '/','@');
writefile = AddName(b.tmppath, incfile); writefile = AddName(b.temppath(), incfile);
} else } else
writefile = getFileName(); writefile = getFileName();
@ -493,7 +493,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
// a file got loaded // a file got loaded
Buffer * const tmp = bufferlist.getBuffer(getFileName()); Buffer * const tmp = bufferlist.getBuffer(getFileName());
if (tmp) { if (tmp) {
tmp->niceFile = b.niceFile; tmp->niceFile() = b.niceFile();
tmp->validate(features); tmp->validate(features);
} }
} }

View File

@ -265,7 +265,7 @@ int InsetQuotes::latex(Buffer const & buf, ostream & os,
parOwner()->getFont(buf->params, curr_pos).language()->babel(); parOwner()->getFont(buf->params, curr_pos).language()->babel();
#else #else
// And this is not the way... (Lgb) // And this is not the way... (Lgb)
string const curr_lang = buf.params.language->lang(); string const curr_lang = buf.params().language->lang();
#endif #endif
const int quoteind = quote_index[side_][language_]; const int quoteind = quote_index[side_][language_];
string qstr; string qstr;

View File

@ -144,7 +144,7 @@ bool InsetTabular::hasPasteBuffer() const
InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns) InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
: tabular(buf.params, this, max(rows, 1), max(columns, 1)), : tabular(buf.params(), this, max(rows, 1), max(columns, 1)),
buffer_(&buf), cursorx_(0), cursory_(0) buffer_(&buf), cursorx_(0), cursory_(0)
{ {
// for now make it always display as display() inset // for now make it always display as display() inset
@ -163,7 +163,7 @@ InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
InsetTabular::InsetTabular(InsetTabular const & tab) InsetTabular::InsetTabular(InsetTabular const & tab)
: UpdatableInset(tab), : UpdatableInset(tab),
tabular(tab.buffer_->params, this, tab.tabular), tabular(tab.buffer_->params(), this, tab.tabular),
buffer_(tab.buffer_), cursorx_(0), cursory_(0) buffer_(tab.buffer_), cursorx_(0), cursory_(0)
{ {
the_locking_inset = 0; the_locking_inset = 0;
@ -935,7 +935,7 @@ InsetOld::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
// no break here! // no break here!
case LFUN_DELETE: case LFUN_DELETE:
recordUndo(bv, Undo::DELETE); recordUndo(bv, Undo::DELETE);
cutSelection(bv->buffer()->params); cutSelection(bv->buffer()->params());
updateLocal(bv); updateLocal(bv);
break; break;
case LFUN_COPY: case LFUN_COPY:
@ -974,7 +974,7 @@ InsetOld::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
} }
maxCols = max(cols, maxCols); maxCols = max(cols, maxCols);
delete paste_tabular; delete paste_tabular;
paste_tabular = new LyXTabular(bv->buffer()->params, paste_tabular = new LyXTabular(bv->buffer()->params(),
this, rows, maxCols); this, rows, maxCols);
string::size_type op = 0; string::size_type op = 0;
int cell = 0; int cell = 0;
@ -1444,7 +1444,7 @@ bool InsetTabular::moveNextCell(BufferView * bv, bool lock)
} }
if (lock) { if (lock) {
bool rtl = tabular.getCellInset(actcell).paragraphs.begin()-> bool rtl = tabular.getCellInset(actcell).paragraphs.begin()->
isRightToLeftPar(bv->buffer()->params); isRightToLeftPar(bv->buffer()->params());
activateCellInset(bv, 0, 0, mouse_button::none, !rtl); activateCellInset(bv, 0, 0, mouse_button::none, !rtl);
} }
resetPos(bv); resetPos(bv);
@ -1473,7 +1473,7 @@ bool InsetTabular::movePrevCell(BufferView * bv, bool lock)
} }
if (lock) { if (lock) {
bool rtl = tabular.getCellInset(actcell).paragraphs.begin()-> bool rtl = tabular.getCellInset(actcell).paragraphs.begin()->
isRightToLeftPar(bv->buffer()->params); isRightToLeftPar(bv->buffer()->params());
activateCellInset(bv, 0, 0, mouse_button::none, !rtl); activateCellInset(bv, 0, 0, mouse_button::none, !rtl);
} }
resetPos(bv); resetPos(bv);
@ -1675,13 +1675,13 @@ void InsetTabular::tabularFeatures(BufferView * bv,
case LyXTabular::APPEND_ROW: case LyXTabular::APPEND_ROW:
// append the row into the tabular // append the row into the tabular
unlockInsetInInset(bv, the_locking_inset); unlockInsetInInset(bv, the_locking_inset);
tabular.appendRow(bv->buffer()->params, actcell); tabular.appendRow(bv->buffer()->params(), actcell);
updateLocal(bv); updateLocal(bv);
break; break;
case LyXTabular::APPEND_COLUMN: case LyXTabular::APPEND_COLUMN:
// append the column into the tabular // append the column into the tabular
unlockInsetInInset(bv, the_locking_inset); unlockInsetInInset(bv, the_locking_inset);
tabular.appendColumn(bv->buffer()->params, actcell); tabular.appendColumn(bv->buffer()->params(), actcell);
actcell = tabular.getCellNumber(row, column); actcell = tabular.getCellNumber(row, column);
updateLocal(bv); updateLocal(bv);
break; break;
@ -2209,7 +2209,7 @@ bool InsetTabular::copySelection(BufferView * bv)
swap(sel_row_start, sel_row_end); swap(sel_row_start, sel_row_end);
delete paste_tabular; delete paste_tabular;
paste_tabular = new LyXTabular(bv->buffer()->params, this, tabular); paste_tabular = new LyXTabular(bv->buffer()->params(), this, tabular);
for (int i = 0; i < sel_row_start; ++i) for (int i = 0; i < sel_row_start; ++i)
paste_tabular->deleteRow(0); paste_tabular->deleteRow(0);
@ -2575,7 +2575,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
int row = 0; int row = 0;
if (usePaste) { if (usePaste) {
delete paste_tabular; delete paste_tabular;
paste_tabular = new LyXTabular(bv->buffer()->params, paste_tabular = new LyXTabular(bv->buffer()->params(),
this, rows, maxCols); this, rows, maxCols);
loctab = paste_tabular; loctab = paste_tabular;
cols = 0; cols = 0;

View File

@ -154,7 +154,7 @@ void InsetText::writeParagraphData(Buffer const & buf, ostream & os) const
ParagraphList::const_iterator end = paragraphs.end(); ParagraphList::const_iterator end = paragraphs.end();
Paragraph::depth_type dth = 0; Paragraph::depth_type dth = 0;
for (; it != end; ++it) { for (; it != end; ++it) {
it->write(buf, os, buf.params, dth); it->write(buf, os, buf.params(), dth);
} }
} }
@ -166,7 +166,7 @@ void InsetText::read(Buffer const & buf, LyXLex & lex)
clear(false); clear(false);
if (buf.params.tracking_changes) if (buf.params().tracking_changes)
paragraphs.begin()->trackChanges(); paragraphs.begin()->trackChanges();
// delete the initial paragraph // delete the initial paragraph
@ -883,7 +883,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
// Derive layout number from given argument (string) // Derive layout number from given argument (string)
// and current buffer's textclass (number). // and current buffer's textclass (number).
LyXTextClass const & tclass = LyXTextClass const & tclass =
bv->buffer()->params.getLyXTextClass(); bv->buffer()->params().getLyXTextClass();
string layout = cmd.argument; string layout = cmd.argument;
bool hasLayout = tclass.hasLayout(layout); bool hasLayout = tclass.hasLayout(layout);
@ -1195,7 +1195,7 @@ void InsetText::fitInsetCursor(BufferView * bv) const
InsetOld::RESULT InsetText::moveRight(BufferView * bv) InsetOld::RESULT InsetText::moveRight(BufferView * bv)
{ {
if (text_.cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (text_.cursor.par()->isRightToLeftPar(bv->buffer()->params()))
return moveLeftIntern(bv, false, true, false); return moveLeftIntern(bv, false, true, false);
else else
return moveRightIntern(bv, true, true, false); return moveRightIntern(bv, true, true, false);
@ -1204,7 +1204,7 @@ InsetOld::RESULT InsetText::moveRight(BufferView * bv)
InsetOld::RESULT InsetText::moveLeft(BufferView * bv) InsetOld::RESULT InsetText::moveLeft(BufferView * bv)
{ {
if (text_.cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (text_.cursor.par()->isRightToLeftPar(bv->buffer()->params()))
return moveRightIntern(bv, true, true, false); return moveRightIntern(bv, true, true, false);
else else
return moveLeftIntern(bv, false, true, false); return moveLeftIntern(bv, false, true, false);
@ -1760,7 +1760,7 @@ void InsetText::collapseParagraphs(BufferView * bv)
} }
} }
mergeParagraph(bv->buffer()->params, paragraphs, first_par); mergeParagraph(bv->buffer()->params(), paragraphs, first_par);
} }
} }
@ -1781,7 +1781,7 @@ void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
ParagraphList::iterator pit = plist.begin(); ParagraphList::iterator pit = plist.begin();
ParagraphList::iterator ins = paragraphs.insert(paragraphs.end(), *pit); ParagraphList::iterator ins = paragraphs.insert(paragraphs.end(), *pit);
++pit; ++pit;
mergeParagraph(buffer->params, paragraphs, boost::prior(ins)); mergeParagraph(buffer->params(), paragraphs, boost::prior(ins));
ParagraphList::iterator pend = plist.end(); ParagraphList::iterator pend = plist.end();
for (; pit != pend; ++pit) for (; pit != pend; ++pit)

View File

@ -239,7 +239,7 @@ void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
for (; tmp != end; ++tmp) { for (; tmp != end; ++tmp) {
if (tmp->layout()->name() == caplayout) { if (tmp->layout()->name() == caplayout) {
string const name = floatname(params_.type, buf.params); string const name = floatname(params_.type, buf.params());
string const str = string const str =
tostr(toclist[name].size() + 1) tostr(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false); + ". " + tmp->asString(buf, false);

View File

@ -304,10 +304,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
&& !Exporter::IsExportable(*buf, ev.argument); && !Exporter::IsExportable(*buf, ev.argument);
break; break;
case LFUN_UNDO: case LFUN_UNDO:
disable = buf->undostack.empty(); disable = buf->undostack().empty();
break; break;
case LFUN_REDO: case LFUN_REDO:
disable = buf->redostack.empty(); disable = buf->redostack().empty();
break; break;
case LFUN_CUT: case LFUN_CUT:
case LFUN_COPY: case LFUN_COPY:
@ -426,17 +426,17 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
break; break;
case LFUN_VC_REGISTER: case LFUN_VC_REGISTER:
disable = buf->lyxvc.inUse(); disable = buf->lyxvc().inUse();
break; break;
case LFUN_VC_CHECKIN: case LFUN_VC_CHECKIN:
disable = !buf->lyxvc.inUse() || buf->isReadonly(); disable = !buf->lyxvc().inUse() || buf->isReadonly();
break; break;
case LFUN_VC_CHECKOUT: case LFUN_VC_CHECKOUT:
disable = !buf->lyxvc.inUse() || !buf->isReadonly(); disable = !buf->lyxvc().inUse() || !buf->isReadonly();
break; break;
case LFUN_VC_REVERT: case LFUN_VC_REVERT:
case LFUN_VC_UNDO: case LFUN_VC_UNDO:
disable = !buf->lyxvc.inUse(); disable = !buf->lyxvc().inUse();
break; break;
case LFUN_MENURELOAD: case LFUN_MENURELOAD:
disable = buf->isUnnamed() || buf->isClean(); disable = buf->isUnnamed() || buf->isClean();
@ -450,7 +450,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
case LFUN_REJECT_CHANGE: case LFUN_REJECT_CHANGE:
case LFUN_ACCEPT_ALL_CHANGES: case LFUN_ACCEPT_ALL_CHANGES:
case LFUN_REJECT_ALL_CHANGES: case LFUN_REJECT_ALL_CHANGES:
disable = !buf->params.tracking_changes; disable = !buf->params().tracking_changes;
break; break;
case LFUN_INSET_TOGGLE: { case LFUN_INSET_TOGGLE: {
LyXText * lt = view()->getLyXText(); LyXText * lt = view()->getLyXText();
@ -541,7 +541,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
UpdatableInset * tli = view()->theLockingInset(); UpdatableInset * tli = view()->theLockingInset();
disable = tli && tli->lyxCode() == InsetOld::ERT_CODE; disable = tli && tli->lyxCode() == InsetOld::ERT_CODE;
} else if (name == "vclog") { } else if (name == "vclog") {
disable = !buf->lyxvc.inUse(); disable = !buf->lyxvc().inUse();
} else if (name == "latexlog") { } else if (name == "latexlog") {
disable = !IsFileReadable(buf->getLogName().second); disable = !IsFileReadable(buf->getLogName().second);
} }
@ -629,7 +629,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
break; break;
case LFUN_INSERT_BRANCH: case LFUN_INSERT_BRANCH:
code = InsetOld::BRANCH_CODE; code = InsetOld::BRANCH_CODE;
if (buf->params.branchlist.empty()) if (buf->params().branchlist.empty())
disable = true; disable = true;
break; break;
case LFUN_INSERT_LABEL: case LFUN_INSERT_LABEL:
@ -713,7 +713,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
flag.setOnOff(true); flag.setOnOff(true);
break; break;
case LFUN_TRACK_CHANGES: case LFUN_TRACK_CHANGES:
flag.setOnOff(buf->params.tracking_changes); flag.setOnOff(buf->params().tracking_changes);
break; break;
default: default:
break; break;
@ -963,14 +963,14 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
owner->view_state_changed(); owner->view_state_changed();
break; break;
case LFUN_RIGHT: case LFUN_RIGHT:
if (!view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) { if (!view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params())) {
view()->text->cursorRight(view()); view()->text->cursorRight(view());
moveCursorUpdate(); moveCursorUpdate();
owner->view_state_changed(); owner->view_state_changed();
} }
goto exit_with_message; goto exit_with_message;
case LFUN_LEFT: case LFUN_LEFT:
if (view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) { if (view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params())) {
view()->text->cursorRight(view()); view()->text->cursorRight(view());
moveCursorUpdate(); moveCursorUpdate();
owner->view_state_changed(); owner->view_state_changed();
@ -1059,8 +1059,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
break; break;
case LFUN_READ_ONLY_TOGGLE: case LFUN_READ_ONLY_TOGGLE:
if (owner->buffer()->lyxvc.inUse()) if (owner->buffer()->lyxvc().inUse())
owner->buffer()->lyxvc.toggleReadOnly(); owner->buffer()->lyxvc().toggleReadOnly();
else else
owner->buffer()->setReadonly( owner->buffer()->setReadonly(
!owner->buffer()->isReadonly()); !owner->buffer()->isReadonly());
@ -1229,8 +1229,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
{ {
if (!ensureBufferClean(view())) if (!ensureBufferClean(view()))
break; break;
if (!owner->buffer()->lyxvc.inUse()) { if (!owner->buffer()->lyxvc().inUse()) {
owner->buffer()->lyxvc.registrer(); owner->buffer()->lyxvc().registrer();
view()->reload(); view()->reload();
} }
} }
@ -1240,9 +1240,9 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
{ {
if (!ensureBufferClean(view())) if (!ensureBufferClean(view()))
break; break;
if (owner->buffer()->lyxvc.inUse() if (owner->buffer()->lyxvc().inUse()
&& !owner->buffer()->isReadonly()) { && !owner->buffer()->isReadonly()) {
owner->buffer()->lyxvc.checkIn(); owner->buffer()->lyxvc().checkIn();
view()->reload(); view()->reload();
} }
} }
@ -1252,9 +1252,9 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
{ {
if (!ensureBufferClean(view())) if (!ensureBufferClean(view()))
break; break;
if (owner->buffer()->lyxvc.inUse() if (owner->buffer()->lyxvc().inUse()
&& owner->buffer()->isReadonly()) { && owner->buffer()->isReadonly()) {
owner->buffer()->lyxvc.checkOut(); owner->buffer()->lyxvc().checkOut();
view()->reload(); view()->reload();
} }
} }
@ -1262,14 +1262,14 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
case LFUN_VC_REVERT: case LFUN_VC_REVERT:
{ {
owner->buffer()->lyxvc.revert(); owner->buffer()->lyxvc().revert();
view()->reload(); view()->reload();
} }
break; break;
case LFUN_VC_UNDO: case LFUN_VC_UNDO:
{ {
owner->buffer()->lyxvc.undoLast(); owner->buffer()->lyxvc().undoLast();
view()->reload(); view()->reload();
} }
break; break;

View File

@ -1151,7 +1151,7 @@ string const Paragraph::asString(Buffer const & buffer,
os << params().labelString() << ' '; os << params().labelString() << ' ';
for (pos_type i = beg; i < end; ++i) { for (pos_type i = beg; i < end; ++i) {
value_type const c = getUChar(buffer.params, i); value_type const c = getUChar(buffer.params(), i);
if (IsPrintable(c)) if (IsPrintable(c))
os << c; os << c;
else if (c == META_INSET) else if (c == META_INSET)

View File

@ -350,7 +350,7 @@ TeXEnvironment(Buffer const & buf,
{ {
lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl; lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl;
BufferParams const & bparams = buf.params; BufferParams const & bparams = buf.params();
LyXLayout_ptr const & style = pit->layout(); LyXLayout_ptr const & style = pit->layout();
@ -476,7 +476,7 @@ TeXOnePar(Buffer const & buf,
{ {
lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '" lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '"
<< everypar << "'" << endl; << everypar << "'" << endl;
BufferParams const & bparams = buf.params; BufferParams const & bparams = buf.params();
InsetOld const * in = pit->inInset(); InsetOld const * in = pit->inInset();
bool further_blank_line = false; bool further_blank_line = false;
@ -731,7 +731,7 @@ void latexParagraphs(Buffer const & buf,
{ {
bool was_title = false; bool was_title = false;
bool already_title = false; bool already_title = false;
LyXTextClass const & tclass = buf.params.getLyXTextClass(); LyXTextClass const & tclass = buf.params().getLyXTextClass();
ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin(); ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
ParagraphList::iterator endpar = const_cast<ParagraphList&>(paragraphs).end(); ParagraphList::iterator endpar = const_cast<ParagraphList&>(paragraphs).end();
@ -812,7 +812,7 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
static LyXFont font; static LyXFont font;
static Change change; static Change change;
BufferParams const & bp = buf.params; BufferParams const & bp = buf.params();
if (token[0] != '\\') { if (token[0] != '\\') {
string::const_iterator cit = token.begin(); string::const_iterator cit = token.begin();
@ -1069,7 +1069,7 @@ ParagraphList::iterator outerPar(Buffer const & buf, InsetOld const * inset)
} }
lyxerr << "outerPar: should not happen" << endl; lyxerr << "outerPar: should not happen" << endl;
Assert(false); Assert(false);
return const_cast<Buffer &>(buf).paragraphs.end(); // shut up compiler return const_cast<Buffer &>(buf).paragraphs().end(); // shut up compiler
} }
@ -1092,5 +1092,5 @@ Paragraph const & ownerPar(Buffer const & buf, InsetOld const * inset)
} }
lyxerr << "ownerPar: should not happen" << endl; lyxerr << "ownerPar: should not happen" << endl;
Assert(false); Assert(false);
return buf.paragraphs.front(); // shut up compiler return buf.paragraphs().front(); // shut up compiler
} }

View File

@ -317,7 +317,7 @@ void RowPainter::paintForeignMark(double orig_x, LyXFont const & orig_font)
return; return;
if (orig_font.language() == latex_language) if (orig_font.language() == latex_language)
return; return;
if (orig_font.language() == bv_.buffer()->params.language) if (orig_font.language() == bv_.buffer()->params().language)
return; return;
int const y = yo_ + row_->baseline() + 1; int const y = yo_ + row_->baseline() + 1;
@ -379,7 +379,7 @@ void RowPainter::paintBackground()
void RowPainter::paintSelection() void RowPainter::paintSelection()
{ {
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params); bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
// the current selection // the current selection
int const startx = text_.selection.start.x(); int const startx = text_.selection.start.x();
@ -692,18 +692,18 @@ void RowPainter::paintFirst()
LyXLayout_ptr const & layout = pit_->layout(); LyXLayout_ptr const & layout = pit_->layout();
if (buffer.params.paragraph_separation == BufferParams::PARSEP_SKIP) { if (buffer.params().paragraph_separation == BufferParams::PARSEP_SKIP) {
if (pit_ != text_.ownerParagraphs().begin()) { if (pit_ != text_.ownerParagraphs().begin()) {
if (layout->latextype == LATEX_PARAGRAPH if (layout->latextype == LATEX_PARAGRAPH
&& !pit_->getDepth()) { && !pit_->getDepth()) {
y_top += buffer.params.getDefSkip().inPixels(bv_); y_top += buffer.params().getDefSkip().inPixels(bv_);
} else { } else {
LyXLayout_ptr const & playout = LyXLayout_ptr const & playout =
boost::prior(pit_)->layout(); boost::prior(pit_)->layout();
if (playout->latextype == LATEX_PARAGRAPH if (playout->latextype == LATEX_PARAGRAPH
&& !boost::prior(pit_)->getDepth()) { && !boost::prior(pit_)->getDepth()) {
// is it right to use defskip here, too? (AS) // is it right to use defskip here, too? (AS)
y_top += buffer.params.getDefSkip().inPixels(bv_); y_top += buffer.params().getDefSkip().inPixels(bv_);
} }
} }
} }
@ -726,7 +726,7 @@ void RowPainter::paintFirst()
y_top += asc; y_top += asc;
} }
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params); bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
// should we print a label? // should we print a label?
if (layout->labeltype >= LABEL_STATIC if (layout->labeltype >= LABEL_STATIC
@ -743,12 +743,12 @@ void RowPainter::paintFirst()
// printed in an extra row and has a pagebreak at // printed in an extra row and has a pagebreak at
// the top. // the top.
if (layout->labeltype == LABEL_COUNTER_CHAPTER) { if (layout->labeltype == LABEL_COUNTER_CHAPTER) {
if (buffer.params.secnumdepth >= 0) { if (buffer.params().secnumdepth >= 0) {
float spacing_val = 1.0; float spacing_val = 1.0;
if (!parparams.spacing().isDefault()) { if (!parparams.spacing().isDefault()) {
spacing_val = parparams.spacing().getValue(); spacing_val = parparams.spacing().getValue();
} else { } else {
spacing_val = buffer.params.spacing.getValue(); spacing_val = buffer.params().spacing.getValue();
} }
int const maxdesc = int const maxdesc =
@ -791,7 +791,7 @@ void RowPainter::paintFirst()
if (!parparams.spacing().isDefault()) { if (!parparams.spacing().isDefault()) {
spacing_val = parparams.spacing().getValue(); spacing_val = parparams.spacing().getValue();
} else { } else {
spacing_val = buffer.params.spacing.getValue(); spacing_val = buffer.params().spacing.getValue();
} }
int maxdesc = int maxdesc =
@ -853,7 +853,7 @@ void RowPainter::paintLast()
y_bottom -= asc; y_bottom -= asc;
} }
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params); bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
int const endlabel = getEndLabel(pit_, text_.ownerParagraphs()); int const endlabel = getEndLabel(pit_, text_.ownerParagraphs());
// draw an endlabel // draw an endlabel

View File

@ -1312,7 +1312,7 @@ void LyXTabular::read(Buffer const & buf, LyXLex & lex)
int columns_arg; int columns_arg;
if (!getTokenValue(line, "columns", columns_arg)) if (!getTokenValue(line, "columns", columns_arg))
return; return;
init(buf.params, rows_arg, columns_arg); init(buf.params(), rows_arg, columns_arg);
l_getline(is, line); l_getline(is, line);
if (!prefixIs(line, "<features")) { if (!prefixIs(line, "<features")) {
lyxerr << "Wrong tabular format (expected <features ...> got" lyxerr << "Wrong tabular format (expected <features ...> got"
@ -2060,6 +2060,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const & buf,
{ {
int ret = 0; int ret = 0;
int cell = getCellNumber(i, 0); int cell = getCellNumber(i, 0);
BufferParams const & bufferparams = buf.params();
ret += TeXTopHLine(os, i); ret += TeXTopHLine(os, i);
for (int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
@ -2068,7 +2069,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const & buf,
ret += TeXCellPreamble(os, cell); ret += TeXCellPreamble(os, cell);
InsetText & inset = getCellInset(cell); InsetText & inset = getCellInset(cell);
bool rtl = inset.paragraphs.begin()->isRightToLeftPar(buf.params) && bool rtl = inset.paragraphs.begin()->isRightToLeftPar(bufferparams) &&
!inset.paragraphs.begin()->empty() && getPWidth(cell).zero(); !inset.paragraphs.begin()->empty() && getPWidth(cell).zero();
if (rtl) if (rtl)

View File

@ -299,9 +299,10 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit,
vis2log_list[bidi_end + 1 - bidi_start] = -1; vis2log_list[bidi_end + 1 - bidi_start] = -1;
log2vis_list[bidi_end + 1 - bidi_start] = -1; log2vis_list[bidi_end + 1 - bidi_start] = -1;
BufferParams const & bufparams = buf.params();
pos_type stack[2]; pos_type stack[2];
bool const rtl_par = bool const rtl_par =
pit->isRightToLeftPar(buf.params); pit->isRightToLeftPar(bufparams);
int level = 0; int level = 0;
bool rtl = false; bool rtl = false;
bool rtl0 = false; bool rtl0 = false;
@ -314,12 +315,12 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit,
!pit->isLineSeparator(lpos + 1) && !pit->isLineSeparator(lpos + 1) &&
!pit->isNewline(lpos + 1)) !pit->isNewline(lpos + 1))
? lpos + 1 : lpos; ? lpos + 1 : lpos;
LyXFont font = pit->getFontSettings(buf.params, pos); LyXFont font = pit->getFontSettings(bufparams, pos);
if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() && if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() &&
font.number() == LyXFont::ON && font.number() == LyXFont::ON &&
pit->getFontSettings(buf.params, lpos - 1).number() pit->getFontSettings(bufparams, lpos - 1).number()
== LyXFont::ON) { == LyXFont::ON) {
font = pit->getFontSettings(buf.params, lpos); font = pit->getFontSettings(bufparams, lpos);
is_space = false; is_space = false;
} }
@ -405,7 +406,7 @@ bool LyXText::isBoundary(Buffer const & buf, Paragraph const & par,
bool const rtl = bidi_level(pos - 1) % 2; bool const rtl = bidi_level(pos - 1) % 2;
bool const rtl2 = bidi_InRange(pos) bool const rtl2 = bidi_InRange(pos)
? bidi_level(pos) % 2 ? bidi_level(pos) % 2
: par.isRightToLeftPar(buf.params); : par.isRightToLeftPar(buf.params());
return rtl != rtl2; return rtl != rtl2;
} }
@ -419,7 +420,7 @@ bool LyXText::isBoundary(Buffer const & buf, Paragraph const & par,
bool const rtl = font.isVisibleRightToLeft(); bool const rtl = font.isVisibleRightToLeft();
bool const rtl2 = bidi_InRange(pos) bool const rtl2 = bidi_InRange(pos)
? bidi_level(pos) % 2 ? bidi_level(pos) % 2
: par.isRightToLeftPar(buf.params); : par.isRightToLeftPar(buf.params());
return rtl != rtl2; return rtl != rtl2;
} }
@ -427,7 +428,7 @@ bool LyXText::isBoundary(Buffer const & buf, Paragraph const & par,
int LyXText::leftMargin(ParagraphList::iterator pit, Row const & row) const int LyXText::leftMargin(ParagraphList::iterator pit, Row const & row) const
{ {
LyXTextClass const & tclass = LyXTextClass const & tclass =
bv()->buffer()->params.getLyXTextClass(); bv()->buffer()->params().getLyXTextClass();
LyXLayout_ptr const & layout = pit->layout(); LyXLayout_ptr const & layout = pit->layout();
string parindent = layout->parindent; string parindent = layout->parindent;
@ -585,7 +586,7 @@ int LyXText::leftMargin(ParagraphList::iterator pit, Row const & row) const
(pit->inInset()->owner()->lyxCode() != InsetOld::TABULAR_CODE && (pit->inInset()->owner()->lyxCode() != InsetOld::TABULAR_CODE &&
pit->inInset()->owner()->lyxCode() != InsetOld::ERT_CODE)) pit->inInset()->owner()->lyxCode() != InsetOld::ERT_CODE))
&& (pit->layout() != tclass.defaultLayout() || && (pit->layout() != tclass.defaultLayout() ||
bv()->buffer()->params.paragraph_separation == bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_INDENT)) { BufferParams::PARSEP_INDENT)) {
x += font_metrics::signedWidth(parindent, x += font_metrics::signedWidth(parindent,
tclass.defaultfont()); tclass.defaultfont());
@ -602,7 +603,7 @@ int LyXText::leftMargin(ParagraphList::iterator pit, Row const & row) const
int LyXText::rightMargin(ParagraphList::iterator pit, int LyXText::rightMargin(ParagraphList::iterator pit,
Buffer const & buf, Row const &) const Buffer const & buf, Row const &) const
{ {
LyXTextClass const & tclass = buf.params.getLyXTextClass(); LyXTextClass const & tclass = buf.params().getLyXTextClass();
LyXLayout_ptr const & layout = pit->layout(); LyXLayout_ptr const & layout = pit->layout();
return PAPER_MARGIN return PAPER_MARGIN
@ -907,7 +908,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
if (!pit->params().spacing().isDefault()) if (!pit->params().spacing().isDefault())
spacing_val = pit->params().spacing().getValue(); spacing_val = pit->params().spacing().getValue();
else else
spacing_val = bv()->buffer()->params.spacing.getValue(); spacing_val = bv()->buffer()->params().spacing.getValue();
//lyxerr << "spacing_val = " << spacing_val << endl; //lyxerr << "spacing_val = " << spacing_val << endl;
int maxasc = int(font_metrics::maxAscent(font) * int maxasc = int(font_metrics::maxAscent(font) *
@ -985,22 +986,22 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
// is it a top line? // is it a top line?
if (!rit->pos()) { if (!rit->pos()) {
BufferParams const & bufparams = bv()->buffer()->params();
// some parksips VERY EASY IMPLEMENTATION // some parksips VERY EASY IMPLEMENTATION
if (bv()->buffer()->params.paragraph_separation == if (bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_SKIP) BufferParams::PARSEP_SKIP)
{ {
if (layout->isParagraph() if (layout->isParagraph()
&& pit->getDepth() == 0 && pit->getDepth() == 0
&& pit != ownerParagraphs().begin()) && pit != ownerParagraphs().begin())
{ {
maxasc += bv()->buffer()->params.getDefSkip().inPixels(*bv()); maxasc += bufparams.getDefSkip().inPixels(*bv());
} else if (pit != ownerParagraphs().begin() && } else if (pit != ownerParagraphs().begin() &&
boost::prior(pit)->layout()->isParagraph() && boost::prior(pit)->layout()->isParagraph() &&
boost::prior(pit)->getDepth() == 0) boost::prior(pit)->getDepth() == 0)
{ {
// is it right to use defskip here too? (AS) // is it right to use defskip here too? (AS)
maxasc += bv()->buffer()->params.getDefSkip().inPixels(*bv()); maxasc += bufparams.getDefSkip().inPixels(*bv());
} }
} }
@ -1026,13 +1027,13 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
// This is special code for the chapter, since the label of this // This is special code for the chapter, since the label of this
// layout is printed in an extra row // layout is printed in an extra row
if (layout->labeltype == LABEL_COUNTER_CHAPTER if (layout->labeltype == LABEL_COUNTER_CHAPTER
&& bv()->buffer()->params.secnumdepth >= 0) && bufparams.secnumdepth >= 0)
{ {
float spacing_val = 1.0; float spacing_val = 1.0;
if (!pit->params().spacing().isDefault()) { if (!pit->params().spacing().isDefault()) {
spacing_val = pit->params().spacing().getValue(); spacing_val = pit->params().spacing().getValue();
} else { } else {
spacing_val = bv()->buffer()->params.spacing.getValue(); spacing_val = bufparams.spacing.getValue();
} }
labeladdon = int(font_metrics::maxDescent(labelfont) * labeladdon = int(font_metrics::maxDescent(labelfont) *
@ -1054,7 +1055,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
if (!pit->params().spacing().isDefault()) { if (!pit->params().spacing().isDefault()) {
spacing_val = pit->params().spacing().getValue(); spacing_val = pit->params().spacing().getValue();
} else { } else {
spacing_val = bv()->buffer()->params.spacing.getValue(); spacing_val = bufparams.spacing.getValue();
} }
labeladdon = int( labeladdon = int(
@ -1191,7 +1192,7 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
return; return;
LyXTextClass const & tclass = LyXTextClass const & tclass =
bv()->buffer()->params.getLyXTextClass(); bv()->buffer()->params().getLyXTextClass();
LyXLayout_ptr const & layout = cursor.par()->layout(); LyXLayout_ptr const & layout = cursor.par()->layout();
// this is only allowed, if the current paragraph is not empty or caption // this is only allowed, if the current paragraph is not empty or caption
@ -1220,7 +1221,7 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
// paragraph before or behind and we should react on that one // paragraph before or behind and we should react on that one
// but we can fix this in 1.3.0 (Jug 20020509) // but we can fix this in 1.3.0 (Jug 20020509)
bool const isempty = (cursor.par()->allowEmpty() && cursor.par()->empty()); bool const isempty = (cursor.par()->allowEmpty() && cursor.par()->empty());
::breakParagraph(bv()->buffer()->params, paragraphs, cursor.par(), ::breakParagraph(bv()->buffer()->params(), paragraphs, cursor.par(),
cursor.pos(), keep_layout); cursor.pos(), keep_layout);
#warning Trouble Point! (Lgb) #warning Trouble Point! (Lgb)
@ -1404,7 +1405,7 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit,
double x = 0; double x = 0;
bool const is_rtl = bool const is_rtl =
pit->isRightToLeftPar(bv()->buffer()->params); pit->isRightToLeftPar(bv()->buffer()->params());
if (is_rtl) if (is_rtl)
x = workWidth() > 0 ? rightMargin(pit, *bv()->buffer(), *rit) : 0; x = workWidth() > 0 ? rightMargin(pit, *bv()->buffer(), *rit) : 0;
else else
@ -1929,15 +1930,16 @@ void LyXText::backspace()
// layout. I think it is a real bug of all other // layout. I think it is a real bug of all other
// word processors to allow it. It confuses the user. // word processors to allow it. It confuses the user.
// Correction: Pasting is always allowed with standard-layout // Correction: Pasting is always allowed with standard-layout
LyXTextClass const & tclass = Buffer & buf = *bv()->buffer();
bv()->buffer()->params.getLyXTextClass(); BufferParams const & bufparams = buf.params();
LyXTextClass const & tclass = bufparams.getLyXTextClass();
if (cursor.par() != tmppit if (cursor.par() != tmppit
&& (cursor.par()->layout() == tmppit->layout() && (cursor.par()->layout() == tmppit->layout()
|| tmppit->layout() == tclass.defaultLayout()) || tmppit->layout() == tclass.defaultLayout())
&& cursor.par()->getAlign() == tmppit->getAlign()) { && cursor.par()->getAlign() == tmppit->getAlign()) {
mergeParagraph(bv()->buffer()->params, mergeParagraph(bufparams,
bv()->buffer()->paragraphs, cursor.par()); buf.paragraphs(), cursor.par());
if (cursor.pos() && cursor.par()->isSeparator(cursor.pos() - 1)) if (cursor.pos() && cursor.par()->isSeparator(cursor.pos() - 1))
cursor.pos(cursor.pos() - 1); cursor.pos(cursor.pos() - 1);

View File

@ -110,7 +110,7 @@ LyXFont LyXText::getFont(ParagraphList::iterator pit, pos_type pos) const
LyXLayout_ptr const & layout = pit->layout(); LyXLayout_ptr const & layout = pit->layout();
#warning broken? #warning broken?
BufferParams const & params = bv()->buffer()->params; BufferParams const & params = bv()->buffer()->params();
// We specialize the 95% common case: // We specialize the 95% common case:
if (!pit->getDepth()) { if (!pit->getDepth()) {
@ -191,7 +191,7 @@ void LyXText::setCharFont(ParagraphList::iterator pit,
pos_type pos, LyXFont const & fnt, pos_type pos, LyXFont const & fnt,
bool toggleall) bool toggleall)
{ {
BufferParams const & params = bv()->buffer()->params; BufferParams const & params = bv()->buffer()->params();
LyXFont font = getFont(pit, pos); LyXFont font = getFont(pit, pos);
font.update(fnt, params.language, toggleall); font.update(fnt, params.language, toggleall);
// Let the insets convert their font // Let the insets convert their font
@ -333,12 +333,13 @@ LyXText::setLayout(LyXCursor & cur, LyXCursor & sstart_cur,
ParagraphList::iterator pit = sstart_cur.par(); ParagraphList::iterator pit = sstart_cur.par();
ParagraphList::iterator epit = boost::next(send_cur.par()); ParagraphList::iterator epit = boost::next(send_cur.par());
BufferParams const & bufparams = bv()->buffer()->params();
LyXLayout_ptr const & lyxlayout = LyXLayout_ptr const & lyxlayout =
bv()->buffer()->params.getLyXTextClass()[layout]; bufparams.getLyXTextClass()[layout];
do { do {
pit->applyLayout(lyxlayout); pit->applyLayout(lyxlayout);
makeFontEntriesLayoutSpecific(bv()->buffer()->params, *pit); makeFontEntriesLayoutSpecific(bufparams, *pit);
pit->params().spaceTop(lyxlayout->fill_top ? pit->params().spaceTop(lyxlayout->fill_top ?
VSpace(VSpace::VFILL) VSpace(VSpace::VFILL)
: VSpace(VSpace::NONE)); : VSpace(VSpace::NONE));
@ -368,7 +369,7 @@ void LyXText::setLayout(string const & layout)
} }
// special handling of new environment insets // special handling of new environment insets
BufferParams const & params = bv()->buffer()->params; BufferParams const & params = bv()->buffer()->params();
LyXLayout_ptr const & lyxlayout = params.getLyXTextClass()[layout]; LyXLayout_ptr const & lyxlayout = params.getLyXTextClass()[layout];
if (lyxlayout->is_environment) { if (lyxlayout->is_environment) {
// move everything in a new environment inset // move everything in a new environment inset
@ -493,7 +494,7 @@ void LyXText::setFont(LyXFont const & font, bool toggleall)
} }
// Update current font // Update current font
real_current_font.update(font, real_current_font.update(font,
bv()->buffer()->params.language, bv()->buffer()->params().language,
toggleall); toggleall);
// Reduce to implicit settings // Reduce to implicit settings
@ -835,7 +836,8 @@ void LyXText::setParagraph(bool line_top, bool line_bottom,
// set the counter of a paragraph. This includes the labels // set the counter of a paragraph. This includes the labels
void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit) void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit)
{ {
LyXTextClass const & textclass = buf.params.getLyXTextClass(); BufferParams const & bufparams = buf.params();
LyXTextClass const & textclass = bufparams.getLyXTextClass();
LyXLayout_ptr const & layout = pit->layout(); LyXLayout_ptr const & layout = pit->layout();
if (pit != ownerParagraphs().begin()) { if (pit != ownerParagraphs().begin()) {
@ -893,7 +895,7 @@ void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit)
ostringstream s; ostringstream s;
if (i >= 0 && i <= buf.params.secnumdepth) { if (i >= 0 && i <= bufparams.secnumdepth) {
string numbertype; string numbertype;
string langtype; string langtype;
@ -912,7 +914,7 @@ void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit)
numbertype = "sectioning"; numbertype = "sectioning";
} else { } else {
numbertype = "appendix"; numbertype = "appendix";
if (pit->isRightToLeftPar(buf.params)) if (pit->isRightToLeftPar(bufparams))
langtype = "hebrew"; langtype = "hebrew";
else else
langtype = "latin"; langtype = "latin";
@ -1037,7 +1039,7 @@ void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit)
void LyXText::updateCounters() void LyXText::updateCounters()
{ {
// start over // start over
bv()->buffer()->params.getLyXTextClass().counters().reset(); bv()->buffer()->params().getLyXTextClass().counters().reset();
ParagraphList::iterator beg = ownerParagraphs().begin(); ParagraphList::iterator beg = ownerParagraphs().begin();
ParagraphList::iterator end = ownerParagraphs().end(); ParagraphList::iterator end = ownerParagraphs().end();
@ -1122,14 +1124,15 @@ void LyXText::cutSelection(bool doclear, bool realcut)
endpit = selection.end.par(); endpit = selection.end.par();
int endpos = selection.end.pos(); int endpos = selection.end.pos();
BufferParams const & bufparams = bv()->buffer()->params();
boost::tie(endpit, endpos) = realcut ? boost::tie(endpit, endpos) = realcut ?
CutAndPaste::cutSelection(bv()->buffer()->params, CutAndPaste::cutSelection(bufparams,
ownerParagraphs(), ownerParagraphs(),
selection.start.par(), endpit, selection.start.par(), endpit,
selection.start.pos(), endpos, selection.start.pos(), endpos,
bv()->buffer()->params.textclass, bufparams.textclass,
doclear) doclear)
: CutAndPaste::eraseSelection(bv()->buffer()->params, : CutAndPaste::eraseSelection(bufparams,
ownerParagraphs(), ownerParagraphs(),
selection.start.par(), endpit, selection.start.par(), endpit,
selection.start.pos(), endpos, selection.start.pos(), endpos,
@ -1176,7 +1179,7 @@ void LyXText::copySelection()
CutAndPaste::copySelection(selection.start.par(), CutAndPaste::copySelection(selection.start.par(),
selection.end.par(), selection.end.par(),
selection.start.pos(), selection.end.pos(), selection.start.pos(), selection.end.pos(),
bv()->buffer()->params.textclass); bv()->buffer()->params().textclass);
} }
@ -1197,7 +1200,7 @@ void LyXText::pasteSelection(size_t sel_index)
CutAndPaste::pasteSelection(*bv()->buffer(), CutAndPaste::pasteSelection(*bv()->buffer(),
ownerParagraphs(), ownerParagraphs(),
cursor.par(), cursor.pos(), cursor.par(), cursor.pos(),
bv()->buffer()->params.textclass, bv()->buffer()->params().textclass,
sel_index, el); sel_index, el);
bufferErrors(*bv()->buffer(), el); bufferErrors(*bv()->buffer(), el);
bv()->showErrorList(_("Paste")); bv()->showErrorList(_("Paste"));
@ -1240,7 +1243,7 @@ void LyXText::replaceSelectionWithString(string const & str)
// Get font setting before we cut // Get font setting before we cut
pos_type pos = selection.end.pos(); pos_type pos = selection.end.pos();
LyXFont const font = selection.start.par() LyXFont const font = selection.start.par()
->getFontSettings(bv()->buffer()->params, ->getFontSettings(bv()->buffer()->params(),
selection.start.pos()); selection.start.pos());
// Insert the new string // Insert the new string
@ -1384,7 +1387,7 @@ float LyXText::getCursorX(ParagraphList::iterator pit, RowList::iterator rit,
if (last < rit_pos) if (last < rit_pos)
cursor_vpos = rit_pos; cursor_vpos = rit_pos;
else if (pos > last && !boundary) else if (pos > last && !boundary)
cursor_vpos = (pit->isRightToLeftPar(bv()->buffer()->params)) cursor_vpos = (pit->isRightToLeftPar(bv()->buffer()->params()))
? rit_pos : last + 1; ? rit_pos : last + 1;
else if (pos > rit_pos && (pos > last || boundary)) else if (pos > rit_pos && (pos > last || boundary))
// Place cursor after char at (logical) position pos - 1 // Place cursor after char at (logical) position pos - 1
@ -1458,14 +1461,15 @@ void LyXText::setCurrentFont()
} }
} }
current_font = pit->getFontSettings(bv()->buffer()->params, pos); BufferParams const & bufparams = bv()->buffer()->params();
current_font = pit->getFontSettings(bufparams, pos);
real_current_font = getFont(pit, pos); real_current_font = getFont(pit, pos);
if (cursor.pos() == pit->size() && if (cursor.pos() == pit->size() &&
isBoundary(*bv()->buffer(), *pit, cursor.pos()) && isBoundary(*bv()->buffer(), *pit, cursor.pos()) &&
!cursor.boundary()) { !cursor.boundary()) {
Language const * lang = Language const * lang =
pit->getParLanguage(bv()->buffer()->params); pit->getParLanguage(bufparams);
current_font.setLanguage(lang); current_font.setLanguage(lang);
current_font.setNumber(LyXFont::OFF); current_font.setNumber(LyXFont::OFF);
real_current_font.setLanguage(lang); real_current_font.setLanguage(lang);
@ -1548,7 +1552,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
// If lastrow is false, we don't need to compute // If lastrow is false, we don't need to compute
// the value of rtl. // the value of rtl.
bool const rtl = (lastrow) bool const rtl = (lastrow)
? pit->isRightToLeftPar(bv()->buffer()->params) ? pit->isRightToLeftPar(bv()->buffer()->params())
: false; : false;
if (lastrow && if (lastrow &&
((rtl && left_side && vc == rit->pos() && x < tmpx - 5) || ((rtl && left_side && vc == rit->pos() && x < tmpx - 5) ||

View File

@ -447,7 +447,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_WORDRIGHT: case LFUN_WORDRIGHT:
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorLeftOneWord(); cursorLeftOneWord();
else else
cursorRightOneWord(); cursorRightOneWord();
@ -457,7 +457,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_WORDLEFT: case LFUN_WORDLEFT:
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorRightOneWord(); cursorRightOneWord();
else else
cursorLeftOneWord(); cursorLeftOneWord();
@ -481,7 +481,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_RIGHTSEL: case LFUN_RIGHTSEL:
if (!selection.set()) if (!selection.set())
selection.cursor = cursor; selection.cursor = cursor;
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorLeft(bv); cursorLeft(bv);
else else
cursorRight(bv); cursorRight(bv);
@ -491,7 +491,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_LEFTSEL: case LFUN_LEFTSEL:
if (!selection.set()) if (!selection.set())
selection.cursor = cursor; selection.cursor = cursor;
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorRight(bv); cursorRight(bv);
else else
cursorLeft(bv); cursorLeft(bv);
@ -555,7 +555,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
break; break;
case LFUN_WORDRIGHTSEL: case LFUN_WORDRIGHTSEL:
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorLeftOneWord(); cursorLeftOneWord();
else else
cursorRightOneWord(); cursorRightOneWord();
@ -563,7 +563,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
break; break;
case LFUN_WORDLEFTSEL: case LFUN_WORDLEFTSEL:
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorRightOneWord(); cursorRightOneWord();
else else
cursorLeftOneWord(); cursorLeftOneWord();
@ -582,7 +582,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
} }
case LFUN_RIGHT: { case LFUN_RIGHT: {
bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params); bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params());
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
if (is_rtl) if (is_rtl)
@ -605,7 +605,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_LEFT: { case LFUN_LEFT: {
// This is soooo ugly. Isn`t it possible to make // This is soooo ugly. Isn`t it possible to make
// it simpler? (Lgb) // it simpler? (Lgb)
bool const is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params); bool const is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params());
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
LyXCursor const cur = cursor; LyXCursor const cur = cursor;
@ -791,7 +791,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_BREAKPARAGRAPH: case LFUN_BREAKPARAGRAPH:
replaceSelection(bv->getLyXText()); replaceSelection(bv->getLyXText());
breakParagraph(bv->buffer()->paragraphs, 0); breakParagraph(bv->buffer()->paragraphs(), 0);
bv->update(); bv->update();
selection.cursor = cursor; selection.cursor = cursor;
bv->switchKeyMap(); bv->switchKeyMap();
@ -800,7 +800,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_BREAKPARAGRAPHKEEPLAYOUT: case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
replaceSelection(bv->getLyXText()); replaceSelection(bv->getLyXText());
breakParagraph(bv->buffer()->paragraphs, 1); breakParagraph(bv->buffer()->paragraphs(), 1);
bv->update(); bv->update();
selection.cursor = cursor; selection.cursor = cursor;
bv->switchKeyMap(); bv->switchKeyMap();
@ -827,7 +827,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
} }
} }
else { else {
breakParagraph(bv->buffer()->paragraphs, 0); breakParagraph(bv->buffer()->paragraphs(), 0);
} }
bv->update(); bv->update();
selection.cursor = cur; selection.cursor = cur;
@ -1054,7 +1054,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
// Derive layout number from given argument (string) // Derive layout number from given argument (string)
// and current buffer's textclass (number) // and current buffer's textclass (number)
LyXTextClass const & tclass = bv->buffer()->params.getLyXTextClass(); LyXTextClass const & tclass = bv->buffer()->params().getLyXTextClass();
bool hasLayout = tclass.hasLayout(cmd.argument); bool hasLayout = tclass.hasLayout(cmd.argument);
string layout = cmd.argument; string layout = cmd.argument;
@ -1144,10 +1144,10 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
LyXLayout_ptr const & style = pit->layout(); LyXLayout_ptr const & style = pit->layout();
BufferParams const & bufparams = bv->buffer()->params();
if (style->pass_thru || if (style->pass_thru ||
pit->getFontSettings(bv->buffer()->params, pit->getFontSettings(bufparams,pos).language()->lang() == "hebrew" ||
pos).language()->lang() == "hebrew" || !bv->insertInset(new InsetQuotes(c, bufparams)))
(!bv->insertInset(new InsetQuotes(c, bv->buffer()->params))))
bv->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\"")); bv->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
break; break;
} }

View File

@ -67,7 +67,8 @@ TocList const getTocList(Buffer const & buf)
{ {
TocList toclist; TocList toclist;
LyXTextClass const & textclass = buf.params.getLyXTextClass(); BufferParams const & bufparams = buf.params();
LyXTextClass const & textclass = bufparams.getLyXTextClass();
ParConstIterator pit = buf.par_iterator_begin(); ParConstIterator pit = buf.par_iterator_begin();
ParConstIterator end = buf.par_iterator_end(); ParConstIterator end = buf.par_iterator_end();
@ -78,7 +79,7 @@ TocList const getTocList(Buffer const & buf)
char const labeltype = pit->layout()->labeltype; char const labeltype = pit->layout()->labeltype;
if (labeltype >= LABEL_COUNTER_CHAPTER if (labeltype >= LABEL_COUNTER_CHAPTER
&& labeltype <= LABEL_COUNTER_CHAPTER + buf.params.tocdepth) { && labeltype <= LABEL_COUNTER_CHAPTER + bufparams.tocdepth) {
// insert this into the table of contents // insert this into the table of contents
const int depth = max(0, labeltype - textclass.maxcounter()); const int depth = max(0, labeltype - textclass.maxcounter());
TocItem const item(pit->id(), depth, TocItem const item(pit->id(), depth,

View File

@ -47,7 +47,7 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
int const inset_id = inset ? inset->id() : -1; int const inset_id = inset ? inset->id() : -1;
// We simply record the entire outer paragraphs // We simply record the entire outer paragraphs
ParagraphList * plist = &buf->paragraphs; ParagraphList & plist = buf->paragraphs();
ParIterator null = buf->par_iterator_end(); ParIterator null = buf->par_iterator_end();
// First, identify the outer paragraphs // First, identify the outer paragraphs
@ -59,8 +59,8 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
} }
// And calculate a stable reference to them // And calculate a stable reference to them
int const first_offset = std::distance(plist->begin(), first); int const first_offset = std::distance(plist.begin(), first);
int const last_offset = std::distance(last, plist->end()); int const last_offset = std::distance(last, plist.end());
// Undo::ATOMIC are always recorded (no overlapping there). // Undo::ATOMIC are always recorded (no overlapping there).
@ -68,10 +68,10 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
// Nobody wants all removed character appear one by one when undoing. // Nobody wants all removed character appear one by one when undoing.
if (! undo_finished && kind != Undo::ATOMIC) { if (! undo_finished && kind != Undo::ATOMIC) {
// Check whether storing is needed. // Check whether storing is needed.
if (! buf->undostack.empty() if (! buf->undostack().empty()
&& buf->undostack.top().kind == kind && buf->undostack().top().kind == kind
&& buf->undostack.top().first_par_offset == first_offset && buf->undostack().top().first_par_offset == first_offset
&& buf->undostack.top().last_par_offset == last_offset) { && buf->undostack().top().last_par_offset == last_offset) {
// No additonal undo recording needed - // No additonal undo recording needed -
// effectively, we combine undo recordings to one. // effectively, we combine undo recordings to one.
return; return;
@ -107,25 +107,25 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
bool performUndoOrRedo(BufferView * bv, Undo & undo) bool performUndoOrRedo(BufferView * bv, Undo & undo)
{ {
Buffer * buf = bv->buffer(); Buffer * buf = bv->buffer();
ParagraphList * plist = &buf->paragraphs; ParagraphList & plist = buf->paragraphs();
// Remove new stuff between first and last // Remove new stuff between first and last
{ {
ParagraphList::iterator first = plist->begin(); ParagraphList::iterator first = plist.begin();
advance(first, undo.first_par_offset); advance(first, undo.first_par_offset);
ParagraphList::iterator last = plist->begin(); ParagraphList::iterator last = plist.begin();
advance(last, plist->size() - undo.last_par_offset); advance(last, plist.size() - undo.last_par_offset);
plist->erase(first, ++last); plist.erase(first, ++last);
} }
// Re-insert old stuff instead // Re-insert old stuff instead
{ {
if (plist->empty()) { if (plist.empty()) {
plist->assign(undo.pars.begin(), undo.pars.end()); plist.assign(undo.pars.begin(), undo.pars.end());
} else { } else {
ParagraphList::iterator first = plist->begin(); ParagraphList::iterator first = plist.begin();
advance(first, undo.first_par_offset); advance(first, undo.first_par_offset);
plist->insert(first, undo.pars.begin(), undo.pars.end()); plist.insert(first, undo.pars.begin(), undo.pars.end());
} }
} }
@ -190,7 +190,7 @@ bool textUndoOrRedo(BufferView * bv,
otherstack.push(undo); otherstack.push(undo);
otherstack.top().pars.clear(); otherstack.top().pars.clear();
Buffer * buf = bv->buffer(); Buffer * buf = bv->buffer();
ParagraphList & plist = buf->paragraphs; ParagraphList & plist = buf->paragraphs();
if (undo.first_par_offset + undo.last_par_offset <= int(plist.size())) { if (undo.first_par_offset + undo.last_par_offset <= int(plist.size())) {
ParagraphList::iterator first = plist.begin(); ParagraphList::iterator first = plist.begin();
advance(first, undo.first_par_offset); advance(first, undo.first_par_offset);
@ -237,15 +237,15 @@ void finishUndo()
bool textUndo(BufferView * bv) bool textUndo(BufferView * bv)
{ {
return textUndoOrRedo(bv, bv->buffer()->undostack, return textUndoOrRedo(bv, bv->buffer()->undostack(),
bv->buffer()->redostack); bv->buffer()->redostack());
} }
bool textRedo(BufferView * bv) bool textRedo(BufferView * bv)
{ {
return textUndoOrRedo(bv, bv->buffer()->redostack, return textUndoOrRedo(bv, bv->buffer()->redostack(),
bv->buffer()->undostack); bv->buffer()->undostack());
} }
@ -253,8 +253,8 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
ParagraphList::iterator first, ParagraphList::iterator last) ParagraphList::iterator first, ParagraphList::iterator last)
{ {
if (!undo_frozen) { if (!undo_frozen) {
recordUndo(bv, kind, first, last, bv->buffer()->undostack); recordUndo(bv, kind, first, last, bv->buffer()->undostack());
bv->buffer()->redostack.clear(); bv->buffer()->redostack().clear();
} }
} }

View File

@ -477,7 +477,7 @@ int VSpace::inPixels(BufferView const & bv) const
break; break;
case DEFSKIP: case DEFSKIP:
retval = bv.buffer()->params.getDefSkip().inPixels(bv); retval = bv.buffer()->params().getDefSkip().inPixels(bv);
break; break;
// This is how the skips are normally defined by LateX. // This is how the skips are normally defined by LateX.