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);
text->breakParagraph(buffer()->paragraphs);
text->breakParagraph(buffer()->paragraphs());
bool res = buffer()->readFile(fname, text->cursor.par());
@ -295,7 +295,7 @@ void BufferView::setCursorFromRow(int row)
int tmpid = -1;
int tmppos = -1;
buffer()->texrow.getIdFromRow(row, tmpid, tmppos);
buffer()->texrow().getIdFromRow(row, tmpid, tmppos);
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
int const id = inset->id();
ParagraphList::iterator pit = buffer()->paragraphs.begin();
ParagraphList::iterator pend = buffer()->paragraphs.end();
ParagraphList::iterator pit = buffer()->paragraphs().begin();
ParagraphList::iterator pend = buffer()->paragraphs().end();
for (; pit != pend; ++pit) {
InsetList::iterator it = pit->insetlist.begin();
InsetList::iterator end = pit->insetlist.end();
@ -554,7 +554,7 @@ LyXText * BufferView::getLyXText() const
Language const * BufferView::getParentLanguage(InsetOld * inset) const
{
Paragraph const & par = ownerPar(*buffer(), inset);
return par.getFontSettings(buffer()->params,
return par.getFontSettings(buffer()->params(),
par.getPositionOfInset(inset)).language();
}
@ -566,7 +566,7 @@ Encoding const * BufferView::getEncoding() const
return 0;
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()));
return font.language()->encoding();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -79,15 +79,6 @@ public:
/// Load the autosaved file.
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
bool readFile(string const & filename);
@ -116,7 +107,6 @@ public:
/// do we have a paragraph with this id?
bool hasParWithID(int id) const;
public:
/// This signal is emitted when a parsing error shows up.
boost::signal1<void, ErrorItem> error;
/// This signal is emitted when some message shows up.
@ -273,40 +263,63 @@ public:
bool isMultiLingual();
/// 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?
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.
This is a linked list of paragraph, this list holds the
whole contents of the document.
*/
ParagraphList paragraphs;
ParagraphList & paragraphs();
ParagraphList const & paragraphs() const;
/// LyX version control object.
LyXVC lyxvc;
LyXVC & lyxvc();
LyXVC const & lyxvc() const;
/// Where to put temporary files.
string tmppath;
string const & temppath() const;
/** If we are writing a nice LaTeX file or not.
While writing as LaTeX, tells whether we are
doing a 'nice' LaTeX file */
bool niceFile;
bool & niceFile();
bool niceFile() const;
/// Used when typesetting to place errorboxes.
TexRow texrow;
TexRow & texrow();
TexRow const & texrow() const;
/// the author list for the document
AuthorList & authors();
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;
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;
/// need to regenerate .tex ?
@ -408,4 +421,5 @@ bool operator==(Buffer::inset_iterator const & iter1,
bool operator!=(Buffer::inset_iterator const & iter1,
Buffer::inset_iterator const & iter2);
#endif

View File

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

View File

@ -125,7 +125,7 @@ void BufferList::release(Buffer * buf)
Buffer * BufferList::newBuffer(string const & s, bool ronly)
{
Buffer * tmpbuf = new Buffer(s, ronly);
tmpbuf->params.useClassDefaults();
tmpbuf->params().useClassDefaults();
lyxerr[Debug::INFO] << "Assigning to buffer "
<< bstore.size() << endl;
bstore.push_back(tmpbuf);
@ -150,7 +150,7 @@ bool BufferList::close(Buffer * buf, bool ask)
Assert(buf);
// 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);
return true;
}

View File

@ -299,7 +299,7 @@ string const currentState(BufferView * bv)
Buffer * buffer = bv->buffer();
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.par()->lookupChange(c.pos()) != Change::UNCHANGED;
@ -319,11 +319,11 @@ string const currentState(BufferView * bv)
// font. (Asger)
LyXFont font = text->real_current_font;
LyXFont const & defaultfont =
buffer->params.getLyXTextClass().defaultfont();
buffer->params().getLyXTextClass().defaultfont();
font.reduce(defaultfont);
// 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"), font.stateText(&buffer->params));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,7 +69,7 @@ biblio::InfoMap const & ControlCitation::bibkeysInfo() 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 =
biblio::getCiteStyles(usingNatbib());
if (kernel().buffer().params.use_numerical_citations)
if (kernel().buffer().params().use_numerical_citations)
styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs);
else
styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs);

View File

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

View File

@ -33,7 +33,7 @@ void ControlPreamble::apply()
view().apply();
buffer()->params.preamble = params();
buffer()->params().preamble = params();
buffer()->markDirty();
lv_.message(_("LaTeX preamble set"));
}
@ -53,7 +53,7 @@ void ControlPreamble::params(string const & newparams)
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 += buffer()->params.dvips_options() + ' ';
command += buffer()->params().dvips_options() + ' ';
if (!Exporter::Export(buffer(), "dvi", true)) {
showPrintError(buffer()->fileName());
@ -163,7 +163,7 @@ void ControlPrint::apply()
// Push directory path.
string path = buffer()->filePath();
if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
path = buffer()->tmppath;
path = buffer()->temppath();
}
Path p(path);

View File

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

View File

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

View File

@ -36,7 +36,7 @@ string const ControlVCLog::getBufferFileName() 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());

View File

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

View File

@ -147,7 +147,7 @@ void LyXScreen::showCursor(BufferView & bv)
LyXText const & text = *bv.getLyXText();
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 isrtl = realfont.isVisibleRightToLeft();

View File

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

View File

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

View File

@ -133,8 +133,8 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const &)
int w = 0;
// 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)
ParagraphList::iterator it = bv->buffer()->paragraphs.begin();
ParagraphList::iterator end = bv->buffer()->paragraphs.end();
ParagraphList::iterator it = bv->buffer()->paragraphs().begin();
ParagraphList::iterator end = bv->buffer()->paragraphs().end();
for (; it != end; ++it) {
if (it->bibitem()) {
#warning metrics broken!
@ -156,8 +156,8 @@ string const bibitemWidest(Buffer const & buffer)
InsetBibitem const * bitem = 0;
LyXFont font;
ParagraphList::const_iterator it = buffer.paragraphs.begin();
ParagraphList::const_iterator end = buffer.paragraphs.end();
ParagraphList::const_iterator it = buffer.paragraphs().begin();
ParagraphList::const_iterator end = buffer.paragraphs().end();
for (; it != end; ++it) {
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.
// For the "official" lyx-layouts it's no problem to support
// all well
if (!contains(buffer.params.getLyXTextClass().name(),
if (!contains(buffer.params().getLyXTextClass().name(),
"art")) {
if (buffer.params.sides == LyXTextClass::OneSide) {
if (buffer.params().sides == LyXTextClass::OneSide) {
// oneside
os << "\\clearpage";
} else {

View File

@ -148,7 +148,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
int InsetBranch::latex(Buffer const & buf, ostream & os,
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)
return inset.latex(buf, os, runparams);
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
{
// 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)
return inset.docbook(buf, os, mixcont);
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
{
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) {
return inset.ascii(buf, os, ll);
}
@ -198,7 +198,7 @@ InsetBranchMailer::InsetBranchMailer(string const & name,
string const InsetBranchMailer::inset2string(Buffer const & buf) const
{
InsetBranchParams params = inset_.params();
params.branchlist = buf.params.branchlist;
params.branchlist = buf.params().branchlist;
inset_.setParams(params);
return params2string(name_, params);
}

View File

@ -95,7 +95,7 @@ void InsetCaption::draw(PainterInfo & pi, int x, int y) const
Assert(0);
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");
// Discover the number...

View File

@ -246,7 +246,7 @@ string const InsetCitation::generateLabel(Buffer const & buffer) const
string const after = getOptions();
string label;
if (buffer.params.use_natbib) {
if (buffer.params().use_natbib) {
string cmd = getCmdName();
if (cmd == "cite") {
// 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
// database, then getNatbibLabel will exit gracefully
// and we'll call getBasicLabel.
if (buffer.params.use_numerical_citations)
if (buffer.params().use_numerical_citations)
cmd = "citep";
else
cmd = "citet";
}
label = getNatbibLabel(buffer, cmd, getContents(),
before, after,
buffer.params.use_numerical_citations);
buffer.params().use_numerical_citations);
}
// Fallback to fail-safe
@ -277,8 +277,8 @@ InsetCitation::Cache::Style InsetCitation::getStyle(Buffer const & buffer) const
{
Cache::Style style = Cache::BASIC;
if (buffer.params.use_natbib) {
if (buffer.params.use_numerical_citations) {
if (buffer.params().use_natbib) {
if (buffer.params().use_numerical_citations) {
style = Cache::NATBIB_NUM;
} else {
style = Cache::NATBIB_AY;
@ -359,7 +359,7 @@ int InsetCitation::latex(Buffer const & buffer, ostream & os,
LatexRunParams const &) const
{
os << "\\";
if (buffer.params.use_natbib)
if (buffer.params().use_natbib)
os << getCmdName();
else
os << "cite";
@ -373,7 +373,7 @@ int InsetCitation::latex(Buffer const & buffer, ostream & os,
string const before = string();
string const after = getOptions();
if (!before.empty() && buffer.params.use_natbib)
if (!before.empty() && buffer.params().use_natbib)
os << '[' << before << "][" << after << ']';
else if (!after.empty())
os << '[' << after << ']';

View File

@ -197,7 +197,7 @@ void InsetERT::write(Buffer const & buf, ostream & os) const
<< "status "<< st << "\n";
//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 end = inset.paragraphs.end();
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
// generated files in the bufer's temporary directory.
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
// use that.
@ -518,7 +518,7 @@ void InsetExternal::updateExternal(string const & format,
// We are running stuff through LaTeX
string const temp_file =
support::MakeAbsPath(params_.filename.mangledFilename(),
buf.tmppath);
buf.temppath());
unsigned long const from_checksum = support::sum(from_file);
unsigned long const temp_checksum = support::sum(temp_file);
@ -573,7 +573,7 @@ string const doSubstitution(InsetExternal::Params const & params,
string contents;
string const filepath = support::IsFileReadable(file) ?
buffer.filePath() : buffer.tmppath;
buffer.filePath() : buffer.temppath();
support::Path p(filepath);
if (support::IsFileReadable(file))

View File

@ -167,7 +167,7 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
params_.placement = params.placement;
params_.wide = params.wide;
wide(params_.wide, cmd.view()->buffer()->params);
wide(params_.wide, cmd.view()->buffer()->params());
cmd.view()->updateInset(this);
return DISPATCHED;
}
@ -236,7 +236,7 @@ void InsetFloat::write(Buffer const & buf, ostream & os) const
void InsetFloat::read(Buffer const & buf, LyXLex & lex)
{
params_.read(lex);
wide(params_.wide, buf.params);
wide(params_.wide, buf.params());
InsetCollapsable::read(buf, lex);
}
@ -267,7 +267,7 @@ string const InsetFloat::editMessage() const
int InsetFloat::latex(Buffer const & buf, ostream & os,
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);
// Figure out the float placement to use.
// From lowest to highest:
@ -275,7 +275,7 @@ int InsetFloat::latex(Buffer const & buf, ostream & os,
// - document wide default placement
// - specific float 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);
if (!params_.placement.empty()
&& 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
{
FloatList const & floats = buf.params.getLyXTextClass().floats();
FloatList const & floats = buf.params().getLyXTextClass().floats();
string const tmptype = params_.type;
// Figure out the float placement to use.
// 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.
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);
if (!params_.placement.empty()
&& 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
for (; pit != end; ++pit) {
if (pit->layout()->name() == caplayout) {
string const name = floatname(params_.type, buf.params);
string const name = floatname(params_.type, buf.params());
string const str =
tostr(toclist[name].size() + 1)
+ ". " + pit->asString(buf, false);

View File

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

View File

@ -427,7 +427,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
if (zipped) {
CopyStatus status;
boost::tie(status, temp_file) =
copyToDirIfNeeded(orig_file, buf.tmppath);
copyToDirIfNeeded(orig_file, buf.temppath());
if (status == FAILURE)
return orig_file;
@ -459,7 +459,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
if (lyxrc.use_tempdir) {
CopyStatus status;
boost::tie(status, temp_file) =
copyToDirIfNeeded(orig_file, buf.tmppath);
copyToDirIfNeeded(orig_file, buf.temppath());
if (status == FAILURE)
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
{
string const file_name = buf.niceFile ?
string const file_name = buf.niceFile() ?
params().filename.relFilename(buf.filePath()):
params().filename.absFilename();

View File

@ -323,13 +323,13 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
Buffer * tmp = bufferlist.getBuffer(getFileName());
// 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 `"
<< MakeDisplayPath(getFileName())
<< "' has textclass `"
<< tmp->params.getLyXTextClass().name()
<< tmp->params().getLyXTextClass().name()
<< "' while parent file has textclass `"
<< buffer.params.getLyXTextClass().name()
<< buffer.params().getLyXTextClass().name()
<< "'." << endl;
//return 0;
}
@ -337,19 +337,19 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
// write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".tex");
if (!buffer.tmppath.empty() && !runparams.nice) {
if (!buffer.temppath().empty() && !runparams.nice) {
incfile = subst(incfile, '/','@');
#ifdef __EMX__
incfile = subst(incfile, ':', '$');
#endif
writefile = AddName(buffer.tmppath, incfile);
writefile = AddName(buffer.temppath(), incfile);
} else
writefile = getFileName();
writefile = ChangeExtension(writefile, ".tex");
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
tmp->markDepClean(buffer.tmppath);
tmp->markDepClean(buffer.temppath());
tmp->makeLaTeXFile(writefile, OnlyPath(getMasterFilename()),
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)
string writefile = ChangeExtension(getFileName(), ".sgml");
if (!buffer.tmppath.empty() && !buffer.niceFile) {
if (!buffer.temppath().empty() && !buffer.niceFile()) {
incfile = subst(incfile, '/','@');
writefile = AddName(buffer.tmppath, incfile);
writefile = AddName(buffer.temppath(), incfile);
} else
writefile = getFileName();
@ -411,7 +411,7 @@ int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os) const
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
tmp->makeLinuxDocFile(writefile, buffer.niceFile, true);
tmp->makeLinuxDocFile(writefile, buffer.niceFile(), true);
}
if (isVerbatim()) {
@ -439,9 +439,9 @@ int InsetInclude::docbook(Buffer const & buffer, ostream & os,
// write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".sgml");
if (!buffer.tmppath.empty() && !buffer.niceFile) {
if (!buffer.temppath().empty() && !buffer.niceFile()) {
incfile = subst(incfile, '/','@');
writefile = AddName(buffer.tmppath, incfile);
writefile = AddName(buffer.temppath(), incfile);
} else
writefile = 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] << "writefile:" << writefile << endl;
tmp->makeDocBookFile(writefile, buffer.niceFile, true);
tmp->makeDocBookFile(writefile, buffer.niceFile(), true);
}
if (isVerbatim()) {
@ -472,9 +472,9 @@ void InsetInclude::validate(LaTeXFeatures & features) const
Buffer const & b = *bufferlist.getBuffer(getMasterFilename());
if (!b.tmppath.empty() && !b.niceFile && !isVerbatim()) {
if (!b.temppath().empty() && !b.niceFile() && !isVerbatim()) {
incfile = subst(incfile, '/','@');
writefile = AddName(b.tmppath, incfile);
writefile = AddName(b.temppath(), incfile);
} else
writefile = getFileName();
@ -493,7 +493,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
// a file got loaded
Buffer * const tmp = bufferlist.getBuffer(getFileName());
if (tmp) {
tmp->niceFile = b.niceFile;
tmp->niceFile() = b.niceFile();
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();
#else
// And this is not the way... (Lgb)
string const curr_lang = buf.params.language->lang();
string const curr_lang = buf.params().language->lang();
#endif
const int quoteind = quote_index[side_][language_];
string qstr;

View File

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

View File

@ -154,7 +154,7 @@ void InsetText::writeParagraphData(Buffer const & buf, ostream & os) const
ParagraphList::const_iterator end = paragraphs.end();
Paragraph::depth_type dth = 0;
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);
if (buf.params.tracking_changes)
if (buf.params().tracking_changes)
paragraphs.begin()->trackChanges();
// delete the initial paragraph
@ -883,7 +883,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
// Derive layout number from given argument (string)
// and current buffer's textclass (number).
LyXTextClass const & tclass =
bv->buffer()->params.getLyXTextClass();
bv->buffer()->params().getLyXTextClass();
string layout = cmd.argument;
bool hasLayout = tclass.hasLayout(layout);
@ -1195,7 +1195,7 @@ void InsetText::fitInsetCursor(BufferView * bv) const
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);
else
return moveRightIntern(bv, true, true, false);
@ -1204,7 +1204,7 @@ InsetOld::RESULT InsetText::moveRight(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);
else
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 ins = paragraphs.insert(paragraphs.end(), *pit);
++pit;
mergeParagraph(buffer->params, paragraphs, boost::prior(ins));
mergeParagraph(buffer->params(), paragraphs, boost::prior(ins));
ParagraphList::iterator pend = plist.end();
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) {
if (tmp->layout()->name() == caplayout) {
string const name = floatname(params_.type, buf.params);
string const name = floatname(params_.type, buf.params());
string const str =
tostr(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false);

View File

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

View File

@ -1151,7 +1151,7 @@ string const Paragraph::asString(Buffer const & buffer,
os << params().labelString() << ' ';
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))
os << c;
else if (c == META_INSET)

View File

@ -350,7 +350,7 @@ TeXEnvironment(Buffer const & buf,
{
lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl;
BufferParams const & bparams = buf.params;
BufferParams const & bparams = buf.params();
LyXLayout_ptr const & style = pit->layout();
@ -476,7 +476,7 @@ TeXOnePar(Buffer const & buf,
{
lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '"
<< everypar << "'" << endl;
BufferParams const & bparams = buf.params;
BufferParams const & bparams = buf.params();
InsetOld const * in = pit->inInset();
bool further_blank_line = false;
@ -731,7 +731,7 @@ void latexParagraphs(Buffer const & buf,
{
bool was_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 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 Change change;
BufferParams const & bp = buf.params;
BufferParams const & bp = buf.params();
if (token[0] != '\\') {
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;
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;
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;
if (orig_font.language() == latex_language)
return;
if (orig_font.language() == bv_.buffer()->params.language)
if (orig_font.language() == bv_.buffer()->params().language)
return;
int const y = yo_ + row_->baseline() + 1;
@ -379,7 +379,7 @@ void RowPainter::paintBackground()
void RowPainter::paintSelection()
{
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params);
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
// the current selection
int const startx = text_.selection.start.x();
@ -692,18 +692,18 @@ void RowPainter::paintFirst()
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 (layout->latextype == LATEX_PARAGRAPH
&& !pit_->getDepth()) {
y_top += buffer.params.getDefSkip().inPixels(bv_);
y_top += buffer.params().getDefSkip().inPixels(bv_);
} else {
LyXLayout_ptr const & playout =
boost::prior(pit_)->layout();
if (playout->latextype == LATEX_PARAGRAPH
&& !boost::prior(pit_)->getDepth()) {
// 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;
}
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params);
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
// should we print a label?
if (layout->labeltype >= LABEL_STATIC
@ -743,12 +743,12 @@ void RowPainter::paintFirst()
// printed in an extra row and has a pagebreak at
// the top.
if (layout->labeltype == LABEL_COUNTER_CHAPTER) {
if (buffer.params.secnumdepth >= 0) {
if (buffer.params().secnumdepth >= 0) {
float spacing_val = 1.0;
if (!parparams.spacing().isDefault()) {
spacing_val = parparams.spacing().getValue();
} else {
spacing_val = buffer.params.spacing.getValue();
spacing_val = buffer.params().spacing.getValue();
}
int const maxdesc =
@ -791,7 +791,7 @@ void RowPainter::paintFirst()
if (!parparams.spacing().isDefault()) {
spacing_val = parparams.spacing().getValue();
} else {
spacing_val = buffer.params.spacing.getValue();
spacing_val = buffer.params().spacing.getValue();
}
int maxdesc =
@ -853,7 +853,7 @@ void RowPainter::paintLast()
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());
// draw an endlabel

View File

@ -1312,7 +1312,7 @@ void LyXTabular::read(Buffer const & buf, LyXLex & lex)
int columns_arg;
if (!getTokenValue(line, "columns", columns_arg))
return;
init(buf.params, rows_arg, columns_arg);
init(buf.params(), rows_arg, columns_arg);
l_getline(is, line);
if (!prefixIs(line, "<features")) {
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 cell = getCellNumber(i, 0);
BufferParams const & bufferparams = buf.params();
ret += TeXTopHLine(os, i);
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);
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();
if (rtl)

View File

@ -299,9 +299,10 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit,
vis2log_list[bidi_end + 1 - bidi_start] = -1;
log2vis_list[bidi_end + 1 - bidi_start] = -1;
BufferParams const & bufparams = buf.params();
pos_type stack[2];
bool const rtl_par =
pit->isRightToLeftPar(buf.params);
pit->isRightToLeftPar(bufparams);
int level = 0;
bool rtl = false;
bool rtl0 = false;
@ -314,12 +315,12 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit,
!pit->isLineSeparator(lpos + 1) &&
!pit->isNewline(lpos + 1))
? lpos + 1 : lpos;
LyXFont font = pit->getFontSettings(buf.params, pos);
LyXFont font = pit->getFontSettings(bufparams, pos);
if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() &&
font.number() == LyXFont::ON &&
pit->getFontSettings(buf.params, lpos - 1).number()
pit->getFontSettings(bufparams, lpos - 1).number()
== LyXFont::ON) {
font = pit->getFontSettings(buf.params, lpos);
font = pit->getFontSettings(bufparams, lpos);
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 rtl2 = bidi_InRange(pos)
? bidi_level(pos) % 2
: par.isRightToLeftPar(buf.params);
: par.isRightToLeftPar(buf.params());
return rtl != rtl2;
}
@ -419,7 +420,7 @@ bool LyXText::isBoundary(Buffer const & buf, Paragraph const & par,
bool const rtl = font.isVisibleRightToLeft();
bool const rtl2 = bidi_InRange(pos)
? bidi_level(pos) % 2
: par.isRightToLeftPar(buf.params);
: par.isRightToLeftPar(buf.params());
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
{
LyXTextClass const & tclass =
bv()->buffer()->params.getLyXTextClass();
bv()->buffer()->params().getLyXTextClass();
LyXLayout_ptr const & layout = pit->layout();
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::ERT_CODE))
&& (pit->layout() != tclass.defaultLayout() ||
bv()->buffer()->params.paragraph_separation ==
bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_INDENT)) {
x += font_metrics::signedWidth(parindent,
tclass.defaultfont());
@ -602,7 +603,7 @@ int LyXText::leftMargin(ParagraphList::iterator pit, Row const & row) const
int LyXText::rightMargin(ParagraphList::iterator pit,
Buffer const & buf, Row const &) const
{
LyXTextClass const & tclass = buf.params.getLyXTextClass();
LyXTextClass const & tclass = buf.params().getLyXTextClass();
LyXLayout_ptr const & layout = pit->layout();
return PAPER_MARGIN
@ -907,7 +908,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
if (!pit->params().spacing().isDefault())
spacing_val = pit->params().spacing().getValue();
else
spacing_val = bv()->buffer()->params.spacing.getValue();
spacing_val = bv()->buffer()->params().spacing.getValue();
//lyxerr << "spacing_val = " << spacing_val << endl;
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?
if (!rit->pos()) {
BufferParams const & bufparams = bv()->buffer()->params();
// some parksips VERY EASY IMPLEMENTATION
if (bv()->buffer()->params.paragraph_separation ==
if (bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_SKIP)
{
if (layout->isParagraph()
&& pit->getDepth() == 0
&& pit != ownerParagraphs().begin())
{
maxasc += bv()->buffer()->params.getDefSkip().inPixels(*bv());
maxasc += bufparams.getDefSkip().inPixels(*bv());
} else if (pit != ownerParagraphs().begin() &&
boost::prior(pit)->layout()->isParagraph() &&
boost::prior(pit)->getDepth() == 0)
{
// 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
// layout is printed in an extra row
if (layout->labeltype == LABEL_COUNTER_CHAPTER
&& bv()->buffer()->params.secnumdepth >= 0)
&& bufparams.secnumdepth >= 0)
{
float spacing_val = 1.0;
if (!pit->params().spacing().isDefault()) {
spacing_val = pit->params().spacing().getValue();
} else {
spacing_val = bv()->buffer()->params.spacing.getValue();
spacing_val = bufparams.spacing.getValue();
}
labeladdon = int(font_metrics::maxDescent(labelfont) *
@ -1054,7 +1055,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
if (!pit->params().spacing().isDefault()) {
spacing_val = pit->params().spacing().getValue();
} else {
spacing_val = bv()->buffer()->params.spacing.getValue();
spacing_val = bufparams.spacing.getValue();
}
labeladdon = int(
@ -1191,7 +1192,7 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
return;
LyXTextClass const & tclass =
bv()->buffer()->params.getLyXTextClass();
bv()->buffer()->params().getLyXTextClass();
LyXLayout_ptr const & layout = cursor.par()->layout();
// 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
// but we can fix this in 1.3.0 (Jug 20020509)
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);
#warning Trouble Point! (Lgb)
@ -1404,7 +1405,7 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit,
double x = 0;
bool const is_rtl =
pit->isRightToLeftPar(bv()->buffer()->params);
pit->isRightToLeftPar(bv()->buffer()->params());
if (is_rtl)
x = workWidth() > 0 ? rightMargin(pit, *bv()->buffer(), *rit) : 0;
else
@ -1929,15 +1930,16 @@ void LyXText::backspace()
// layout. I think it is a real bug of all other
// word processors to allow it. It confuses the user.
// Correction: Pasting is always allowed with standard-layout
LyXTextClass const & tclass =
bv()->buffer()->params.getLyXTextClass();
Buffer & buf = *bv()->buffer();
BufferParams const & bufparams = buf.params();
LyXTextClass const & tclass = bufparams.getLyXTextClass();
if (cursor.par() != tmppit
&& (cursor.par()->layout() == tmppit->layout()
|| tmppit->layout() == tclass.defaultLayout())
&& cursor.par()->getAlign() == tmppit->getAlign()) {
mergeParagraph(bv()->buffer()->params,
bv()->buffer()->paragraphs, cursor.par());
mergeParagraph(bufparams,
buf.paragraphs(), cursor.par());
if (cursor.pos() && cursor.par()->isSeparator(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();
#warning broken?
BufferParams const & params = bv()->buffer()->params;
BufferParams const & params = bv()->buffer()->params();
// We specialize the 95% common case:
if (!pit->getDepth()) {
@ -191,7 +191,7 @@ void LyXText::setCharFont(ParagraphList::iterator pit,
pos_type pos, LyXFont const & fnt,
bool toggleall)
{
BufferParams const & params = bv()->buffer()->params;
BufferParams const & params = bv()->buffer()->params();
LyXFont font = getFont(pit, pos);
font.update(fnt, params.language, toggleall);
// 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 epit = boost::next(send_cur.par());
BufferParams const & bufparams = bv()->buffer()->params();
LyXLayout_ptr const & lyxlayout =
bv()->buffer()->params.getLyXTextClass()[layout];
bufparams.getLyXTextClass()[layout];
do {
pit->applyLayout(lyxlayout);
makeFontEntriesLayoutSpecific(bv()->buffer()->params, *pit);
makeFontEntriesLayoutSpecific(bufparams, *pit);
pit->params().spaceTop(lyxlayout->fill_top ?
VSpace(VSpace::VFILL)
: VSpace(VSpace::NONE));
@ -368,7 +369,7 @@ void LyXText::setLayout(string const & layout)
}
// 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];
if (lyxlayout->is_environment) {
// move everything in a new environment inset
@ -493,7 +494,7 @@ void LyXText::setFont(LyXFont const & font, bool toggleall)
}
// Update current font
real_current_font.update(font,
bv()->buffer()->params.language,
bv()->buffer()->params().language,
toggleall);
// 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
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();
if (pit != ownerParagraphs().begin()) {
@ -893,7 +895,7 @@ void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit)
ostringstream s;
if (i >= 0 && i <= buf.params.secnumdepth) {
if (i >= 0 && i <= bufparams.secnumdepth) {
string numbertype;
string langtype;
@ -912,7 +914,7 @@ void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit)
numbertype = "sectioning";
} else {
numbertype = "appendix";
if (pit->isRightToLeftPar(buf.params))
if (pit->isRightToLeftPar(bufparams))
langtype = "hebrew";
else
langtype = "latin";
@ -1037,7 +1039,7 @@ void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit)
void LyXText::updateCounters()
{
// start over
bv()->buffer()->params.getLyXTextClass().counters().reset();
bv()->buffer()->params().getLyXTextClass().counters().reset();
ParagraphList::iterator beg = ownerParagraphs().begin();
ParagraphList::iterator end = ownerParagraphs().end();
@ -1122,14 +1124,15 @@ void LyXText::cutSelection(bool doclear, bool realcut)
endpit = selection.end.par();
int endpos = selection.end.pos();
BufferParams const & bufparams = bv()->buffer()->params();
boost::tie(endpit, endpos) = realcut ?
CutAndPaste::cutSelection(bv()->buffer()->params,
CutAndPaste::cutSelection(bufparams,
ownerParagraphs(),
selection.start.par(), endpit,
selection.start.pos(), endpos,
bv()->buffer()->params.textclass,
bufparams.textclass,
doclear)
: CutAndPaste::eraseSelection(bv()->buffer()->params,
: CutAndPaste::eraseSelection(bufparams,
ownerParagraphs(),
selection.start.par(), endpit,
selection.start.pos(), endpos,
@ -1176,7 +1179,7 @@ void LyXText::copySelection()
CutAndPaste::copySelection(selection.start.par(),
selection.end.par(),
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(),
ownerParagraphs(),
cursor.par(), cursor.pos(),
bv()->buffer()->params.textclass,
bv()->buffer()->params().textclass,
sel_index, el);
bufferErrors(*bv()->buffer(), el);
bv()->showErrorList(_("Paste"));
@ -1240,7 +1243,7 @@ void LyXText::replaceSelectionWithString(string const & str)
// Get font setting before we cut
pos_type pos = selection.end.pos();
LyXFont const font = selection.start.par()
->getFontSettings(bv()->buffer()->params,
->getFontSettings(bv()->buffer()->params(),
selection.start.pos());
// Insert the new string
@ -1384,7 +1387,7 @@ float LyXText::getCursorX(ParagraphList::iterator pit, RowList::iterator rit,
if (last < rit_pos)
cursor_vpos = rit_pos;
else if (pos > last && !boundary)
cursor_vpos = (pit->isRightToLeftPar(bv()->buffer()->params))
cursor_vpos = (pit->isRightToLeftPar(bv()->buffer()->params()))
? rit_pos : last + 1;
else if (pos > rit_pos && (pos > last || boundary))
// 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);
if (cursor.pos() == pit->size() &&
isBoundary(*bv()->buffer(), *pit, cursor.pos()) &&
!cursor.boundary()) {
Language const * lang =
pit->getParLanguage(bv()->buffer()->params);
pit->getParLanguage(bufparams);
current_font.setLanguage(lang);
current_font.setNumber(LyXFont::OFF);
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
// the value of rtl.
bool const rtl = (lastrow)
? pit->isRightToLeftPar(bv()->buffer()->params)
? pit->isRightToLeftPar(bv()->buffer()->params())
: false;
if (lastrow &&
((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:
if (!selection.mark())
bv->beforeChange(this);
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorLeftOneWord();
else
cursorRightOneWord();
@ -457,7 +457,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_WORDLEFT:
if (!selection.mark())
bv->beforeChange(this);
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorRightOneWord();
else
cursorLeftOneWord();
@ -481,7 +481,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_RIGHTSEL:
if (!selection.set())
selection.cursor = cursor;
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorLeft(bv);
else
cursorRight(bv);
@ -491,7 +491,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_LEFTSEL:
if (!selection.set())
selection.cursor = cursor;
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorRight(bv);
else
cursorLeft(bv);
@ -555,7 +555,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
break;
case LFUN_WORDRIGHTSEL:
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorLeftOneWord();
else
cursorRightOneWord();
@ -563,7 +563,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
break;
case LFUN_WORDLEFTSEL:
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorRightOneWord();
else
cursorLeftOneWord();
@ -582,7 +582,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
}
case LFUN_RIGHT: {
bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params());
if (!selection.mark())
bv->beforeChange(this);
if (is_rtl)
@ -605,7 +605,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_LEFT: {
// This is soooo ugly. Isn`t it possible to make
// 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())
bv->beforeChange(this);
LyXCursor const cur = cursor;
@ -791,7 +791,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_BREAKPARAGRAPH:
replaceSelection(bv->getLyXText());
breakParagraph(bv->buffer()->paragraphs, 0);
breakParagraph(bv->buffer()->paragraphs(), 0);
bv->update();
selection.cursor = cursor;
bv->switchKeyMap();
@ -800,7 +800,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
replaceSelection(bv->getLyXText());
breakParagraph(bv->buffer()->paragraphs, 1);
breakParagraph(bv->buffer()->paragraphs(), 1);
bv->update();
selection.cursor = cursor;
bv->switchKeyMap();
@ -827,7 +827,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
}
}
else {
breakParagraph(bv->buffer()->paragraphs, 0);
breakParagraph(bv->buffer()->paragraphs(), 0);
}
bv->update();
selection.cursor = cur;
@ -1054,7 +1054,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
// Derive layout number from given argument (string)
// 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);
string layout = cmd.argument;
@ -1144,10 +1144,10 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
LyXLayout_ptr const & style = pit->layout();
BufferParams const & bufparams = bv->buffer()->params();
if (style->pass_thru ||
pit->getFontSettings(bv->buffer()->params,
pos).language()->lang() == "hebrew" ||
(!bv->insertInset(new InsetQuotes(c, bv->buffer()->params))))
pit->getFontSettings(bufparams,pos).language()->lang() == "hebrew" ||
!bv->insertInset(new InsetQuotes(c, bufparams)))
bv->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
break;
}

View File

@ -67,7 +67,8 @@ TocList const getTocList(Buffer const & buf)
{
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 end = buf.par_iterator_end();
@ -78,7 +79,7 @@ TocList const getTocList(Buffer const & buf)
char const labeltype = pit->layout()->labeltype;
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
const int depth = max(0, labeltype - textclass.maxcounter());
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;
// We simply record the entire outer paragraphs
ParagraphList * plist = &buf->paragraphs;
ParagraphList & plist = buf->paragraphs();
ParIterator null = buf->par_iterator_end();
// First, identify the outer paragraphs
@ -59,8 +59,8 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
}
// And calculate a stable reference to them
int const first_offset = std::distance(plist->begin(), first);
int const last_offset = std::distance(last, plist->end());
int const first_offset = std::distance(plist.begin(), first);
int const last_offset = std::distance(last, plist.end());
// 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.
if (! undo_finished && kind != Undo::ATOMIC) {
// Check whether storing is needed.
if (! buf->undostack.empty()
&& buf->undostack.top().kind == kind
&& buf->undostack.top().first_par_offset == first_offset
&& buf->undostack.top().last_par_offset == last_offset) {
if (! buf->undostack().empty()
&& buf->undostack().top().kind == kind
&& buf->undostack().top().first_par_offset == first_offset
&& buf->undostack().top().last_par_offset == last_offset) {
// No additonal undo recording needed -
// effectively, we combine undo recordings to one.
return;
@ -107,25 +107,25 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
bool performUndoOrRedo(BufferView * bv, Undo & undo)
{
Buffer * buf = bv->buffer();
ParagraphList * plist = &buf->paragraphs;
ParagraphList & plist = buf->paragraphs();
// Remove new stuff between first and last
{
ParagraphList::iterator first = plist->begin();
ParagraphList::iterator first = plist.begin();
advance(first, undo.first_par_offset);
ParagraphList::iterator last = plist->begin();
advance(last, plist->size() - undo.last_par_offset);
plist->erase(first, ++last);
ParagraphList::iterator last = plist.begin();
advance(last, plist.size() - undo.last_par_offset);
plist.erase(first, ++last);
}
// Re-insert old stuff instead
{
if (plist->empty()) {
plist->assign(undo.pars.begin(), undo.pars.end());
if (plist.empty()) {
plist.assign(undo.pars.begin(), undo.pars.end());
} else {
ParagraphList::iterator first = plist->begin();
ParagraphList::iterator first = plist.begin();
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.top().pars.clear();
Buffer * buf = bv->buffer();
ParagraphList & plist = buf->paragraphs;
ParagraphList & plist = buf->paragraphs();
if (undo.first_par_offset + undo.last_par_offset <= int(plist.size())) {
ParagraphList::iterator first = plist.begin();
advance(first, undo.first_par_offset);
@ -237,15 +237,15 @@ void finishUndo()
bool textUndo(BufferView * bv)
{
return textUndoOrRedo(bv, bv->buffer()->undostack,
bv->buffer()->redostack);
return textUndoOrRedo(bv, bv->buffer()->undostack(),
bv->buffer()->redostack());
}
bool textRedo(BufferView * bv)
{
return textUndoOrRedo(bv, bv->buffer()->redostack,
bv->buffer()->undostack);
return textUndoOrRedo(bv, bv->buffer()->redostack(),
bv->buffer()->undostack());
}
@ -253,8 +253,8 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
ParagraphList::iterator first, ParagraphList::iterator last)
{
if (!undo_frozen) {
recordUndo(bv, kind, first, last, bv->buffer()->undostack);
bv->buffer()->redostack.clear();
recordUndo(bv, kind, first, last, bv->buffer()->undostack());
bv->buffer()->redostack().clear();
}
}

View File

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