mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
rename row.end into row.endpos
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7956 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
78d3fbdac3
commit
aec5a388c8
@ -1,3 +1,15 @@
|
||||
|
||||
2003-10-22 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* lyxtext.h:
|
||||
* text.C: use Row & instead of RowList::iterator
|
||||
|
||||
* lyxrow.h: rename end() to endpos()
|
||||
|
||||
* rowpainter.C:
|
||||
* text.C:
|
||||
* text2.C: adjust
|
||||
|
||||
2003-10-22 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* buffer.[Ch] (fully_loaded): new member function, returning true
|
||||
|
@ -365,7 +365,7 @@ string const currentState(BufferView * bv)
|
||||
state << _(", Paragraph: ") << text->cursorPar()->id();
|
||||
state << _(", Position: ") << text->cursor.pos();
|
||||
RowList::iterator rit = text->cursorRow();
|
||||
state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->end());
|
||||
state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->endpos());
|
||||
state << _(", Inset: ");
|
||||
InsetOld * inset = text->cursorPar()->inInset();
|
||||
if (inset)
|
||||
|
@ -48,13 +48,13 @@ pos_type Row::pos() const
|
||||
}
|
||||
|
||||
|
||||
void Row::end(pos_type p)
|
||||
void Row::endpos(pos_type p)
|
||||
{
|
||||
end_ = p;
|
||||
}
|
||||
|
||||
|
||||
pos_type Row::end() const
|
||||
pos_type Row::endpos() const
|
||||
{
|
||||
return end_;
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ public:
|
||||
///
|
||||
lyx::pos_type pos() const;
|
||||
///
|
||||
void end(lyx::pos_type p);
|
||||
void endpos(lyx::pos_type p);
|
||||
///
|
||||
lyx::pos_type end() const;
|
||||
lyx::pos_type endpos() const;
|
||||
///
|
||||
void fill(int f);
|
||||
///
|
||||
|
@ -24,17 +24,11 @@ using std::min;
|
||||
using std::endl;
|
||||
|
||||
|
||||
bool isParEnd(Paragraph const & par, Row const & row)
|
||||
{
|
||||
return row.end() == par.size();
|
||||
}
|
||||
|
||||
|
||||
pos_type lastPos(Paragraph const & par, Row const & row)
|
||||
{
|
||||
if (par.empty())
|
||||
return 0;
|
||||
pos_type pos = row.end() - 1;
|
||||
pos_type pos = row.endpos() - 1;
|
||||
if (pos == par.size())
|
||||
--pos;
|
||||
return pos;
|
||||
@ -113,14 +107,14 @@ bool hfillExpansion(Paragraph const & par, Row const & row, pos_type pos)
|
||||
|
||||
// at the end of a row it does not count
|
||||
// unless another hfill exists on the line
|
||||
if (pos >= lastPos(par, row)) {
|
||||
if (pos >= row.endpos()) {
|
||||
for (pos_type i = row.pos(); i < pos && !par.isHfill(i); ++i)
|
||||
return false;
|
||||
}
|
||||
|
||||
// at the beginning of a row it does not count, if it is not
|
||||
// the first row of a paragaph
|
||||
if (row.isParStart())
|
||||
if (row.pos() == 0)
|
||||
return true;
|
||||
|
||||
// in some labels it does not count
|
||||
|
@ -18,8 +18,6 @@
|
||||
class Paragraph;
|
||||
class Row;
|
||||
|
||||
bool isParEnd(Paragraph const & par, Row const & row);
|
||||
|
||||
lyx::pos_type lastPos(Paragraph const & par, Row const & row);
|
||||
|
||||
int numberOfSeparators(Paragraph const & par, Row const & row);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "rowpainter.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "debug.h"
|
||||
#include "bufferparams.h"
|
||||
#include "BufferView.h"
|
||||
#include "encoding.h"
|
||||
@ -527,7 +528,7 @@ void RowPainter::paintDepthBar()
|
||||
Paragraph::depth_type prev_depth = 0;
|
||||
if (row_ != text_.firstRow()) {
|
||||
ParagraphList::iterator pit2 = pit_;
|
||||
if (row_ == pit2->rows.begin())
|
||||
if (row_->pos() == 0)
|
||||
--pit2;
|
||||
prev_depth = pit2->getDepth();
|
||||
}
|
||||
@ -535,7 +536,7 @@ void RowPainter::paintDepthBar()
|
||||
Paragraph::depth_type next_depth = 0;
|
||||
if (row_ != text_.lastRow()) {
|
||||
ParagraphList::iterator pit2 = pit_;
|
||||
if (boost::next(row_) == pit2->rows.end())
|
||||
if (row_->endpos() >= pit2->size())
|
||||
++pit2;
|
||||
next_depth = pit2->getDepth();
|
||||
}
|
||||
@ -735,12 +736,14 @@ void RowPainter::paintFirst()
|
||||
}
|
||||
|
||||
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
|
||||
bool const is_seq = isFirstInSequence(pit_, text_.ownerParagraphs());
|
||||
//lyxerr << "paintFirst: " << pit_->id() << " is_seq: " << is_seq << std::endl;
|
||||
|
||||
// should we print a label?
|
||||
if (layout->labeltype >= LABEL_STATIC
|
||||
&& (layout->labeltype != LABEL_STATIC
|
||||
|| layout->latextype != LATEX_ENVIRONMENT
|
||||
|| isFirstInSequence(pit_, text_.ownerParagraphs()))) {
|
||||
|| layout->latextype != LATEX_ENVIRONMENT
|
||||
|| is_seq)) {
|
||||
|
||||
LyXFont font = getLabelFont();
|
||||
if (!pit_->getLabelstring().empty()) {
|
||||
@ -788,7 +791,7 @@ void RowPainter::paintFirst()
|
||||
|
||||
// the labels at the top of an environment.
|
||||
// More or less for bibliography
|
||||
} else if (isFirstInSequence(pit_, text_.ownerParagraphs()) &&
|
||||
} else if (is_seq &&
|
||||
(layout->labeltype == LABEL_TOP_ENVIRONMENT ||
|
||||
layout->labeltype == LABEL_BIBLIO ||
|
||||
layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
|
||||
@ -1036,10 +1039,10 @@ void RowPainter::paint()
|
||||
// changebar
|
||||
paintChangeBar();
|
||||
|
||||
if (row_->isParStart())
|
||||
if (row_->pos() == 0)
|
||||
paintFirst();
|
||||
|
||||
if (isParEnd(*pit_, *row_))
|
||||
if (row_->endpos() >= pit_->size())
|
||||
paintLast();
|
||||
|
||||
// paint text
|
||||
|
27
src/text.C
27
src/text.C
@ -769,8 +769,10 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
|
||||
// returns the minimum space a row needs on the screen in pixel
|
||||
int LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
|
||||
{
|
||||
if (paper_width < 0)
|
||||
if (paper_width < 0) {
|
||||
lyxerr << "paperwidth < 0: " << paper_width << " Why?" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w;
|
||||
// get the pure distance
|
||||
@ -781,7 +783,7 @@ int LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
|
||||
// special handling of the right address boxes
|
||||
if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
|
||||
int const tmpfill = row.fill();
|
||||
row.fill(0); // the minfill in MarginLeft()
|
||||
row.fill(0); // the minfill in leftMargin()
|
||||
w = leftMargin(pit, row);
|
||||
row.fill(tmpfill);
|
||||
} else
|
||||
@ -1106,7 +1108,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
|
||||
}
|
||||
|
||||
// is it a bottom line?
|
||||
if (row.end() == pit->size()) {
|
||||
if (row.endpos() >= pit->size()) {
|
||||
// the bottom margin
|
||||
ParagraphList::iterator nextpit = boost::next(pit);
|
||||
if (nextpit == ownerParagraphs().end() && !isInInset())
|
||||
@ -1468,8 +1470,8 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, Row & row) const
|
||||
{
|
||||
int const ns = numberOfSeparators(*pit, row);
|
||||
bool disp_inset = false;
|
||||
if (row.end() < pit->size()) {
|
||||
InsetOld * in = pit->getInset(row.end());
|
||||
if (row.endpos() < pit->size()) {
|
||||
InsetOld * in = pit->getInset(row.endpos());
|
||||
if (in)
|
||||
disp_inset = in->display();
|
||||
}
|
||||
@ -1477,8 +1479,8 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, Row & row) const
|
||||
// par, does not end in newline, and is not row above a
|
||||
// display inset... then stretch it
|
||||
if (ns
|
||||
&& row.end() < pit->size()
|
||||
&& !pit->isNewline(row.end())
|
||||
&& row.endpos() < pit->size()
|
||||
&& !pit->isNewline(row.endpos())
|
||||
&& !disp_inset
|
||||
) {
|
||||
fill_separator = w / ns;
|
||||
@ -2146,18 +2148,17 @@ int LyXText::redoParagraphInternal(ParagraphList::iterator pit)
|
||||
for (pos_type z = 0; z < pit->size() + 1; ) {
|
||||
Row row(z);
|
||||
z = rowBreakPoint(pit, row) + 1;
|
||||
row.end(z);
|
||||
row.endpos(z);
|
||||
int const f = fill(pit, row, ww);
|
||||
int const w = ww - f;
|
||||
par_width = std::max(par_width, w);
|
||||
row.fill(f);
|
||||
row.width(w);
|
||||
prepareToPrint(pit, row);
|
||||
setHeightOfRow(pit, row);
|
||||
row.y_offset(pit->height);
|
||||
pit->height += row.height();
|
||||
pit->rows.push_back(row);
|
||||
RowList::iterator rit = boost::prior(pit->rows.end());
|
||||
prepareToPrint(pit, *rit);
|
||||
setHeightOfRow(pit, *rit);
|
||||
rit->y_offset(pit->height);
|
||||
pit->height += rit->height();
|
||||
}
|
||||
height += pit->height;
|
||||
|
||||
|
@ -566,7 +566,7 @@ void LyXText::cursorHome()
|
||||
|
||||
void LyXText::cursorEnd()
|
||||
{
|
||||
setCursor(cursorPar(), cursorRow()->end() - 1);
|
||||
setCursor(cursorPar(), cursorRow()->endpos() - 1);
|
||||
}
|
||||
|
||||
|
||||
@ -1502,7 +1502,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
|
||||
boundary = false;
|
||||
// This (rtl_support test) is not needed, but gives
|
||||
// some speedup if rtl_support == false
|
||||
bool const lastrow = lyxrc.rtl_support && row.end() == pit->size();
|
||||
bool const lastrow = lyxrc.rtl_support && row.endpos() == pit->size();
|
||||
|
||||
// If lastrow is false, we don't need to compute
|
||||
// the value of rtl.
|
||||
@ -1511,7 +1511,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
|
||||
: false;
|
||||
if (lastrow &&
|
||||
((rtl && left_side && vc == row.pos() && x < tmpx - 5) ||
|
||||
(!rtl && !left_side && vc == last + 1 && x > tmpx + 5)))
|
||||
(!rtl && !left_side && vc == last + 1 && x > tmpx + 5)))
|
||||
c = last + 1;
|
||||
else if (vc == row.pos()) {
|
||||
c = vis2log(vc);
|
||||
|
Loading…
Reference in New Issue
Block a user