mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
new code for max depth; time to recompile your tree :)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3611 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3026a589b0
commit
cfffe11571
@ -1,5 +1,10 @@
|
||||
2002-02-28 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* paragraph.C (getMaxDepthAfter): new method. The maximal depth
|
||||
that the paragraph following this one can have.
|
||||
|
||||
* text2.C (incDepth): use Paragraph::getMaxDepthAfter
|
||||
|
||||
* vspace.C (asLatexCommand): fix bogus gcc warning
|
||||
|
||||
* Makefile.am (lyx_SOURCES): remove vms_defines.h
|
||||
|
@ -1054,6 +1054,18 @@ Paragraph::depth_type Paragraph::getDepth() const
|
||||
}
|
||||
|
||||
|
||||
Paragraph::depth_type Paragraph::getMaxDepthAfter(Buffer const * buffer) const
|
||||
{
|
||||
const bool isenv = textclasslist.Style(buffer->params.textclass,
|
||||
getLayout()).isEnvironment();
|
||||
|
||||
if (isenv)
|
||||
return params().depth() + 1;
|
||||
else
|
||||
return params().depth();
|
||||
|
||||
}
|
||||
|
||||
char Paragraph::getAlign() const
|
||||
{
|
||||
return params().align();
|
||||
|
@ -221,8 +221,10 @@ public:
|
||||
lyx::layout_type getLayout() const;
|
||||
///
|
||||
char getAlign() const;
|
||||
///
|
||||
/// The nesting depth of a paragraph
|
||||
depth_type getDepth() const;
|
||||
/// The maximal possible depth of a paragraph after this one
|
||||
depth_type getMaxDepthAfter(Buffer const *) const;
|
||||
///
|
||||
void setLayout(lyx::layout_type new_layout);
|
||||
///
|
||||
|
17
src/text2.C
17
src/text2.C
@ -641,19 +641,10 @@ void LyXText::incDepth(BufferView * bview)
|
||||
cursor.par()->getLayout()).labeltype != LABEL_BIBLIO) {
|
||||
Paragraph * prev = cursor.par()->previous();
|
||||
|
||||
if (prev) {
|
||||
const int depth_diff
|
||||
= prev->getDepth() - cursor.par()->getDepth();
|
||||
// go deeper only if
|
||||
// (1) the previous para is already
|
||||
// deeper (depth_diff > 0)
|
||||
// (2) the previous para is a
|
||||
// list-environment at the same
|
||||
// depth as this para.
|
||||
if (depth_diff > 0 || (depth_diff > -1
|
||||
&& textclasslist.Style(bview->buffer()->params.textclass,
|
||||
prev->getLayout()).isEnvironment())) {
|
||||
cursor.par()->params().depth(cursor.par()->params().depth() + 1);
|
||||
if (prev) {
|
||||
if (cursor.par()->getDepth()
|
||||
< prev->getMaxDepthAfter(bview->buffer())){
|
||||
cursor.par()->params().depth(cursor.par()->getDepth() + 1);
|
||||
anything_changed = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user