mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
remove usage of Paragraph::next and Paragraph::previous
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6346 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ebc4d99eaa
commit
5c4091e019
@ -1,5 +1,9 @@
|
|||||||
2003-03-04 Lars Gullik Bjønnes <larsbj@gullik.net>
|
2003-03-04 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||||
|
|
||||||
|
* paragraph_funcs.C (TeXEnvironment): remove all usage of
|
||||||
|
Paragraph::next and Paragraph::previous
|
||||||
|
(TeXOnePar): ditto
|
||||||
|
|
||||||
* text.C (breakParagraph): adjust
|
* text.C (breakParagraph): adjust
|
||||||
|
|
||||||
* paragraph_funcs.C (breakParagraph): take a Buffer* instead of a
|
* paragraph_funcs.C (breakParagraph): take a Buffer* instead of a
|
||||||
|
@ -288,8 +288,10 @@ TeXEnvironment(Buffer const * buf,
|
|||||||
|
|
||||||
Language const * language = pit->getParLanguage(bparams);
|
Language const * language = pit->getParLanguage(bparams);
|
||||||
Language const * doc_language = bparams.language;
|
Language const * doc_language = bparams.language;
|
||||||
Language const * previous_language = pit->previous()
|
Language const * previous_language =
|
||||||
? pit->previous()->getParLanguage(bparams) : doc_language;
|
(pit != buf->paragraphs.begin())
|
||||||
|
? boost::prior(pit)->getParLanguage(bparams)
|
||||||
|
: doc_language;
|
||||||
if (language->babel() != previous_language->babel()) {
|
if (language->babel() != previous_language->babel()) {
|
||||||
|
|
||||||
if (!lyxrc.language_command_end.empty() &&
|
if (!lyxrc.language_command_end.empty() &&
|
||||||
@ -424,7 +426,7 @@ TeXOnePar(Buffer const * buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pit->params().spacing().isDefault()
|
if (!pit->params().spacing().isDefault()
|
||||||
&& (!pit->previous() || !pit->previous()->hasSameLayout(&*pit))) {
|
&& (pit == buf->paragraphs.begin() || !boost::prior(pit)->hasSameLayout(&*pit))) {
|
||||||
os << pit->params().spacing().writeEnvirBegin() << '\n';
|
os << pit->params().spacing().writeEnvirBegin() << '\n';
|
||||||
texrow.newline();
|
texrow.newline();
|
||||||
}
|
}
|
||||||
@ -459,16 +461,18 @@ TeXOnePar(Buffer const * buf,
|
|||||||
|
|
||||||
Language const * language = pit->getParLanguage(bparams);
|
Language const * language = pit->getParLanguage(bparams);
|
||||||
Language const * doc_language = bparams.language;
|
Language const * doc_language = bparams.language;
|
||||||
Language const * previous_language = pit->previous()
|
Language const * previous_language =
|
||||||
? pit->previous()->getParLanguage(bparams) : doc_language;
|
(pit != buf->paragraphs.begin())
|
||||||
|
? boost::prior(pit)->getParLanguage(bparams)
|
||||||
|
: doc_language;
|
||||||
|
|
||||||
if (language->babel() != previous_language->babel()
|
if (language->babel() != previous_language->babel()
|
||||||
// check if we already put language command in TeXEnvironment()
|
// check if we already put language command in TeXEnvironment()
|
||||||
&& !(style->isEnvironment()
|
&& !(style->isEnvironment()
|
||||||
&& (!pit->previous() ||
|
&& (pit == buf->paragraphs.begin() ||
|
||||||
(pit->previous()->layout() != pit->layout() &&
|
(boost::prior(pit)->layout() != pit->layout() &&
|
||||||
pit->previous()->getDepth() <= pit->getDepth())
|
boost::prior(pit)->getDepth() <= pit->getDepth())
|
||||||
|| pit->previous()->getDepth() < pit->getDepth())))
|
|| boost::prior(pit)->getDepth() < pit->getDepth())))
|
||||||
{
|
{
|
||||||
if (!lyxrc.language_command_end.empty() &&
|
if (!lyxrc.language_command_end.empty() &&
|
||||||
previous_language->babel() != doc_language->babel())
|
previous_language->babel() != doc_language->babel())
|
||||||
@ -538,7 +542,9 @@ TeXOnePar(Buffer const * buf,
|
|||||||
|
|
||||||
bool is_command = style->isCommand();
|
bool is_command = style->isCommand();
|
||||||
|
|
||||||
if (style->resfont.size() != font.size() && pit->next() && !is_command) {
|
if (style->resfont.size() != font.size()
|
||||||
|
&& boost::next(pit) != buf->paragraphs.end()
|
||||||
|
&& !is_command) {
|
||||||
if (!need_par)
|
if (!need_par)
|
||||||
os << '{';
|
os << '{';
|
||||||
os << "\\" << font.latexSize() << " \\par}";
|
os << "\\" << font.latexSize() << " \\par}";
|
||||||
@ -550,7 +556,8 @@ TeXOnePar(Buffer const * buf,
|
|||||||
switch (style->latextype) {
|
switch (style->latextype) {
|
||||||
case LATEX_ITEM_ENVIRONMENT:
|
case LATEX_ITEM_ENVIRONMENT:
|
||||||
case LATEX_LIST_ENVIRONMENT:
|
case LATEX_LIST_ENVIRONMENT:
|
||||||
if (pit->next() && (pit->params().depth() < pit->next()->params().depth())) {
|
if (boost::next(pit) != buf->paragraphs.end()
|
||||||
|
&& (pit->params().depth() < boost::next(pit)->params().depth())) {
|
||||||
os << '\n';
|
os << '\n';
|
||||||
texrow.newline();
|
texrow.newline();
|
||||||
}
|
}
|
||||||
@ -558,14 +565,14 @@ TeXOnePar(Buffer const * buf,
|
|||||||
case LATEX_ENVIRONMENT:
|
case LATEX_ENVIRONMENT:
|
||||||
// if its the last paragraph of the current environment
|
// if its the last paragraph of the current environment
|
||||||
// skip it otherwise fall through
|
// skip it otherwise fall through
|
||||||
if (pit->next()
|
if (boost::next(pit) != buf->paragraphs.end()
|
||||||
&& (pit->next()->layout() != pit->layout()
|
&& (boost::next(pit)->layout() != pit->layout()
|
||||||
|| pit->next()->params().depth() != pit->params().depth()))
|
|| boost::next(pit)->params().depth() != pit->params().depth()))
|
||||||
break;
|
break;
|
||||||
// fall through possible
|
// fall through possible
|
||||||
default:
|
default:
|
||||||
// we don't need it for the last paragraph!!!
|
// we don't need it for the last paragraph!!!
|
||||||
if (pit->next()) {
|
if (boost::next(pit) != buf->paragraphs.end()) {
|
||||||
os << '\n';
|
os << '\n';
|
||||||
texrow.newline();
|
texrow.newline();
|
||||||
}
|
}
|
||||||
@ -594,14 +601,14 @@ TeXOnePar(Buffer const * buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pit->params().spacing().isDefault()
|
if (!pit->params().spacing().isDefault()
|
||||||
&& (!pit->next() || !pit->next()->hasSameLayout(&*pit))) {
|
&& (boost::next(pit) == buf->paragraphs.end()|| !boost::next(pit)->hasSameLayout(&*pit))) {
|
||||||
os << pit->params().spacing().writeEnvirEnd() << '\n';
|
os << pit->params().spacing().writeEnvirEnd() << '\n';
|
||||||
texrow.newline();
|
texrow.newline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't need it for the last paragraph!!!
|
// we don't need it for the last paragraph!!!
|
||||||
if (pit->next()) {
|
if (boost::next(pit) != buf->paragraphs.end()) {
|
||||||
os << '\n';
|
os << '\n';
|
||||||
texrow.newline();
|
texrow.newline();
|
||||||
} else {
|
} else {
|
||||||
@ -624,6 +631,6 @@ TeXOnePar(Buffer const * buf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << "TeXOnePar...done " << pit->next() << endl;
|
lyxerr[Debug::LATEX] << "TeXOnePar...done " << &*boost::next(pit) << endl;
|
||||||
return ++pit;
|
return ++pit;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user