beforeChange(text);
- text->breakParagraph(buffer()->paragraphs);
+ text->breakParagraph(buffer()->paragraphs());
bool res = buffer()->readFile(fname, text->cursor.par());
int tmpid = -1;
int tmppos = -1;
- buffer()->texrow.getIdFromRow(row, tmpid, tmppos);
+ buffer()->texrow().getIdFromRow(row, tmpid, tmppos);
ParagraphList::iterator texrowpar;
}
// 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();
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();
}
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();
}
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_);
}
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();
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);
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();
}
<< " button[" << ev.button() << ']'
<< endl;
- LyXTextClass const & tclass = buffer_->params.getLyXTextClass();
+ LyXTextClass const & tclass = buffer_->params().getLyXTextClass();
switch (ev.action) {
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);
}
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);
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();
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--);
// 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;
}
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;
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();
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) {
}
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) {
}
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) {
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();
} // 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
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");
string path = OnlyPath(filename);
if (lyxrc.use_tempdir || !IsDirWriteable(path))
- path = tmppath;
+ path = temppath();
string const fname = AddName(path,
OnlyFilename(ChangeExtension(filename,
AuthorList & Buffer::authors()
{
- return params.authorlist;
+ return params().authorlist;
}
<< token << '\'' << endl;
- string unknown = params.readToken(lex, token);
+ string unknown = params().readToken(lex, token);
if (!unknown.empty()) {
if (unknown[0] != '\\') {
unknownClass(unknown);
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
continue;
}
- readParagraph(lex, token, paragraphs, pit, depth);
+ readParagraph(lex, token, paragraphs(), pit, depth);
}
return the_end_read;
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
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;
// 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;
}
}
bool the_end = readBody(lex, pit);
- params.setPaperStuff();
+ params().setPaperStuff();
if (!the_end) {
Alert::error(_("Document format failure"),
bool retval;
- if (params.compressed) {
+ if (params().compressed) {
gz::ogzstream ofs(fname.c_str());
if (!ofs)
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
<< "\\lyxformat " << LYX_FORMAT << "\n";
// now write out the buffer paramters.
- params.writeFile(ofs);
+ params().writeFile(ofs);
ofs << "\\end_header\n";
// 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;
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:
{
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);
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:
// 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);
<< "\\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 {
}
// 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;
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);
}
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);
}
}
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
// How to check for successful close
// we want this to be true outside previews (for insetexternal)
- niceFile = true;
+ niceFile() = true;
}
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) {
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);
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);
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;
// How to check for successful close
// we want this to be true outside previews (for insetexternal)
- niceFile = true;
+ niceFile() = true;
}
// 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()) {
string const org_path = path;
if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
- path = tmppath;
+ path = temppath();
}
Path p(path); // path to LaTeX file
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
{
/// 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;
{
/// 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;
ParIterator end = par_iterator_end();
for (ParIterator it = par_iterator_begin(); it != end; ++it)
- it->changeLanguage(params, from, to);
+ it->changeLanguage(params(), from, to);
}
{
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;
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;
}
void Buffer::setParentName(string const & name)
{
- params.parentname = name;
+ params().parentname = name;
}
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());
}
/// 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);
/// 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.
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 ?
bool operator!=(Buffer::inset_iterator const & iter1,
Buffer::inset_iterator const & iter2);
+
#endif
// Fall through
case 1:
if (readFile(b, s)) {
- b->lyxvc.file_found_hook(s);
+ b->lyxvc().file_found_hook(s);
return true;
}
break;
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) {
}
b->setReadonly(false);
- b->updateDocLang(b->params.language);
+ b->updateDocLang(b->params().language);
return b;
}
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));
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);
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;
}
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;
// 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));
string real_outfile;
if (outfile == infile) {
real_outfile = infile;
- outfile = AddName(buffer->tmppath, "tmpfile.out");
+ outfile = AddName(buffer->temppath(), "tmpfile.out");
}
if (conv.latex) {
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);
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;
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));
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:
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;
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;
}
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';
}
}
// 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 =
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));
bool ControlCitation::usingNatbib() const
{
- return kernel().buffer().params.use_natbib;
+ return kernel().buffer().params().use_natbib;
}
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);
classApply();
- buffer()->params = *bp_;
+ buffer()->params() = *bp_;
lv_.view()->redoCurrentBuffer();
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) {
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;
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"));
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().apply();
- buffer()->params.preamble = params();
+ buffer()->params().preamble = params();
buffer()->markDirty();
lv_.message(_("LaTeX preamble set"));
}
void ControlPreamble::setParams()
{
- params_ = buffer()->params.preamble;
+ params_ = buffer()->params().preamble;
}
command += lyxrc.print_extra_options + ' ';
}
- command += buffer()->params.dvips_options() + ' ';
+ command += buffer()->params().dvips_options() + ' ';
if (!Exporter::Export(buffer(), "dvi", true)) {
showPrintError(buffer()->fileName());
// Push directory path.
string path = buffer()->filePath();
if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
- path = buffer()->tmppath;
+ path = buffer()->temppath();
}
Path p(path);
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);
return;
}
- speller_.reset(getSpeller(buffer()->params));
+ speller_.reset(getSpeller(buffer()->params()));
// reset values to initial
newval_ = 0.0;
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());
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();
return;
LyXTextClass const & tc =
- owner_->buffer()->params.getLyXTextClass();
+ owner_->buffer()->params().getLyXTextClass();
QString const & name = qt_(tc[layout]->name());
return;
LyXTextClass const & tc =
- owner_->buffer()->params.getLyXTextClass();
+ owner_->buffer()->params().getLyXTextClass();
combo_->setUpdatesEnabled(false);
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();
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();
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_);
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) {
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();
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!
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()) {
// 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 {
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;
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;
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);
}
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);
}
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...
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.
// 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
{
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;
LatexRunParams const &) const
{
os << "\\";
- if (buffer.params.use_natbib)
+ if (buffer.params().use_natbib)
os << getCmdName();
else
os << "cite";
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 << ']';
<< "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) {
// 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.
// 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);
string contents;
string const filepath = support::IsFileReadable(file) ?
- buffer.filePath() : buffer.tmppath;
+ buffer.filePath() : buffer.temppath();
support::Path p(filepath);
if (support::IsFileReadable(file))
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;
}
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);
}
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:
// - 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) {
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:
// 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) {
// 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);
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());
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()) {
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()) {
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;
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;
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();
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;
}
// 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);
// 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();
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()) {
// 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()))
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()) {
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();
// a file got loaded
Buffer * const tmp = bufferlist.getBuffer(getFileName());
if (tmp) {
- tmp->niceFile = b.niceFile;
+ tmp->niceFile() = b.niceFile();
tmp->validate(features);
}
}
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;
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
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;
// no break here!
case LFUN_DELETE:
recordUndo(bv, Undo::DELETE);
- cutSelection(bv->buffer()->params);
+ cutSelection(bv->buffer()->params());
updateLocal(bv);
break;
case LFUN_COPY:
}
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;
}
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);
}
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);
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;
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);
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;
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);
}
}
clear(false);
- if (buf.params.tracking_changes)
+ if (buf.params().tracking_changes)
paragraphs.begin()->trackChanges();
// delete the initial paragraph
// 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);
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);
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);
}
}
- mergeParagraph(bv->buffer()->params, paragraphs, first_par);
+ mergeParagraph(bv->buffer()->params(), paragraphs, first_par);
}
}
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)
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);
&& !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:
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();
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();
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);
}
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:
flag.setOnOff(true);
break;
case LFUN_TRACK_CHANGES:
- flag.setOnOff(buf->params.tracking_changes);
+ flag.setOnOff(buf->params().tracking_changes);
break;
default:
break;
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();
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());
{
if (!ensureBufferClean(view()))
break;
- if (!owner->buffer()->lyxvc.inUse()) {
- owner->buffer()->lyxvc.registrer();
+ if (!owner->buffer()->lyxvc().inUse()) {
+ owner->buffer()->lyxvc().registrer();
view()->reload();
}
}
{
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();
}
}
{
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();
}
}
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;
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)
{
lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl;
- BufferParams const & bparams = buf.params;
+ BufferParams const & bparams = buf.params();
LyXLayout_ptr const & style = pit->layout();
{
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;
{
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();
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();
}
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
}
}
lyxerr << "ownerPar: should not happen" << endl;
Assert(false);
- return buf.paragraphs.front(); // shut up compiler
+ return buf.paragraphs().front(); // shut up compiler
}
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;
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();
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_);
}
}
}
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
// 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 =
if (!parparams.spacing().isDefault()) {
spacing_val = parparams.spacing().getValue();
} else {
- spacing_val = buffer.params.spacing.getValue();
+ spacing_val = buffer.params().spacing.getValue();
}
int maxdesc =
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
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"
{
int ret = 0;
int cell = getCellNumber(i, 0);
+ BufferParams const & bufferparams = buf.params();
ret += TeXTopHLine(os, i);
for (int j = 0; j < columns_; ++j) {
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)
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;
!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;
}
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;
}
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;
}
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;
(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());
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
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) *
// 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());
}
}
// 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) *
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(
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
// 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)
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
// 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);
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()) {
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
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));
}
// 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
}
// Update current font
real_current_font.update(font,
- bv()->buffer()->params.language,
+ bv()->buffer()->params().language,
toggleall);
// Reduce to implicit settings
// 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()) {
ostringstream s;
- if (i >= 0 && i <= buf.params.secnumdepth) {
+ if (i >= 0 && i <= bufparams.secnumdepth) {
string numbertype;
string langtype;
numbertype = "sectioning";
} else {
numbertype = "appendix";
- if (pit->isRightToLeftPar(buf.params))
+ if (pit->isRightToLeftPar(bufparams))
langtype = "hebrew";
else
langtype = "latin";
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();
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,
CutAndPaste::copySelection(selection.start.par(),
selection.end.par(),
selection.start.pos(), selection.end.pos(),
- bv()->buffer()->params.textclass);
+ bv()->buffer()->params().textclass);
}
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"));
// 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
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
}
}
- 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);
// 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) ||
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();
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();
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);
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);
break;
case LFUN_WORDRIGHTSEL:
- if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
+ if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorLeftOneWord();
else
cursorRightOneWord();
break;
case LFUN_WORDLEFTSEL:
- if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
+ if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
cursorRightOneWord();
else
cursorLeftOneWord();
}
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)
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;
case LFUN_BREAKPARAGRAPH:
replaceSelection(bv->getLyXText());
- breakParagraph(bv->buffer()->paragraphs, 0);
+ breakParagraph(bv->buffer()->paragraphs(), 0);
bv->update();
selection.cursor = cursor;
bv->switchKeyMap();
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
replaceSelection(bv->getLyXText());
- breakParagraph(bv->buffer()->paragraphs, 1);
+ breakParagraph(bv->buffer()->paragraphs(), 1);
bv->update();
selection.cursor = cursor;
bv->switchKeyMap();
}
}
else {
- breakParagraph(bv->buffer()->paragraphs, 0);
+ breakParagraph(bv->buffer()->paragraphs(), 0);
}
bv->update();
selection.cursor = cur;
// 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;
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;
}
{
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();
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,
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
}
// 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).
// 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;
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());
}
}
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);
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());
}
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();
}
}
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.