(setHeightOfRow): reformat

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2394 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-07-31 10:10:17 +00:00
parent a622bb6efa
commit f97e06c961
2 changed files with 295 additions and 287 deletions

View File

@ -1,6 +1,7 @@
2001-07-31 Juergen Vigna <jug@sad.it>
* text.C (getVisibleRow): minor clear row changes (still not perfect).
(setHeightOfRow): reformat
2001-07-30 Lars Gullik Bjønnes <larsbj@birdstep.com>

View File

@ -1252,8 +1252,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
// This is not completely correct, but we can live with the small,
// cosmetic error for now.
LyXFont::FONT_SIZE const maxsize =
row_ptr->par()->highestFontInRange(row_ptr->pos(),
pos_end);
row_ptr->par()->highestFontInRange(row_ptr->pos(), pos_end);
if (maxsize > font.size()) {
font.setSize(maxsize);
@ -1276,18 +1275,23 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
// some parksips VERY EASY IMPLEMENTATION
if (bview->buffer()->params.paragraph_separation ==
BufferParams::PARSEP_SKIP) {
BufferParams::PARSEP_SKIP)
{
if (layout.isParagraph()
&& firstpar->getDepth() == 0
&& firstpar->previous())
{
maxasc += bview->buffer()->params.getDefSkip().inPixels(bview);
else if (firstpar->previous()
&& textclasslist.Style(bview->buffer()->params.textclass,
firstpar->previous()->getLayout()).isParagraph()
&& firstpar->previous()->getDepth() == 0)
} else if (firstpar->previous() &&
textclasslist.Style(bview->buffer()->params.textclass,
firstpar->previous()->
getLayout()).isParagraph() &&
firstpar->previous()->getDepth() == 0)
{
// is it right to use defskip here too? (AS)
maxasc += bview->buffer()->params.getDefSkip().inPixels(bview);
}
}
// the paper margins
if (!row_ptr->par()->previous() && bv_owner)
@ -1310,7 +1314,8 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
// 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
&& bview->buffer()->params.secnumdepth >= 0) {
&& bview->buffer()->params.secnumdepth >= 0)
{
float spacing_val = 1.0;
if (!row_ptr->par()->params().spacing().isDefault()) {
spacing_val = row_ptr->par()->params().spacing().getValue();
@ -1331,7 +1336,8 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
|| layout.labeltype == LABEL_BIBLIO
|| layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
&& row_ptr->par()->isFirstInSequence()
&& !row_ptr->par()->getLabelstring().empty()) {
&& !row_ptr->par()->getLabelstring().empty())
{
float spacing_val = 1.0;
if (!row_ptr->par()->params().spacing().isDefault()) {
spacing_val = row_ptr->par()->params().spacing().getValue();
@ -1357,13 +1363,12 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
Paragraph * prev = row_ptr->par()->previous();
if (prev)
prev = row_ptr->par()->depthHook(row_ptr->par()->getDepth());
if (prev && prev->getLayout() == firstpar->getLayout()
&& prev->getDepth() == firstpar->getDepth()
&& prev->getLabelWidthString() == firstpar->getLabelWidthString())
if (prev && prev->getLayout() == firstpar->getLayout() &&
prev->getDepth() == firstpar->getDepth() &&
prev->getLabelWidthString() == firstpar->getLabelWidthString())
{
layoutasc = (layout.itemsep * defaultHeight());
}
else if (row_ptr->previous()) {
} else if (row_ptr->previous()) {
tmptop = layout.topsep;
if (row_ptr->previous()->par()->getDepth() >= row_ptr->par()->getDepth())
@ -1373,8 +1378,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
if (tmptop > 0)
layoutasc = (tmptop * defaultHeight());
}
else if (row_ptr->par()->params().lineTop()) {
} else if (row_ptr->par()->params().lineTop()) {
tmptop = layout.topsep;
if (tmptop > 0)
@ -1385,14 +1389,14 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
if (prev) {
maxasc += int(textclasslist.Style(bview->buffer()->params.textclass,
prev->getLayout()).parsep * defaultHeight());
}
else {
if (firstpar->previous()
&& firstpar->previous()->getDepth() == 0
&& firstpar->previous()->getLayout() != firstpar->getLayout()) {
} else {
if (firstpar->previous() &&
firstpar->previous()->getDepth() == 0 &&
firstpar->previous()->getLayout() !=
firstpar->getLayout())
{
// avoid parsep
}
else if (firstpar->previous()){
} else if (firstpar->previous()) {
maxasc += int(layout.parsep * defaultHeight());
}
}
@ -1401,8 +1405,8 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
// is it a bottom line?
if (row_ptr->par() == par
&& (!row_ptr->next() || row_ptr->next()->par() != row_ptr->par())) {
&& (!row_ptr->next() || row_ptr->next()->par() != row_ptr->par()))
{
// the paper margins
if (!par->next() && bv_owner)
maxdesc += LYX_PAPER_MARGIN;
@ -1432,24 +1436,27 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
float unusual = 0;
if (comparepar->getDepth() > nextpar->getDepth()) {
usual = (textclasslist.Style(bview->buffer()->params.textclass, comparepar->getLayout()).bottomsep * defaultHeight());
usual = (textclasslist.Style(bview->buffer()->params.textclass,
comparepar->getLayout()).bottomsep * defaultHeight());
comparepar = comparepar->depthHook(nextpar->getDepth());
if (comparepar->getLayout()!= nextpar->getLayout()
|| nextpar->getLabelWidthString() !=
comparepar->getLabelWidthString())
unusual = (textclasslist.Style(bview->buffer()->params.textclass, comparepar->getLayout()).bottomsep * defaultHeight());
{
unusual = (textclasslist.Style(bview->buffer()->params.textclass,
comparepar->getLayout()).bottomsep * defaultHeight());
}
if (unusual > usual)
layoutdesc = unusual;
else
layoutdesc = usual;
}
else if (comparepar->getDepth() == nextpar->getDepth()) {
} else if (comparepar->getDepth() == nextpar->getDepth()) {
if (comparepar->getLayout()!= nextpar->getLayout()
|| nextpar->getLabelWidthString() !=
comparepar->getLabelWidthString())
layoutdesc = int(textclasslist.Style(bview->buffer()->params.textclass, comparepar->getLayout()).bottomsep * defaultHeight());
layoutdesc = int(textclasslist.Style(bview->buffer()->params.textclass,
comparepar->getLayout()).bottomsep * defaultHeight());
}
}
}