+
+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
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)
}
-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_;
}
///
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);
///
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;
// 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
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);
#include "rowpainter.h"
#include "buffer.h"
+#include "debug.h"
#include "bufferparams.h"
#include "BufferView.h"
#include "encoding.h"
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();
}
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();
}
}
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()) {
// 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)) {
// changebar
paintChangeBar();
- if (row_->isParStart())
+ if (row_->pos() == 0)
paintFirst();
- if (isParEnd(*pit_, *row_))
+ if (row_->endpos() >= pit_->size())
paintLast();
// paint text
// 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
// 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
}
// 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())
{
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();
}
// 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;
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;
void LyXText::cursorEnd()
{
- setCursor(cursorPar(), cursorRow()->end() - 1);
+ setCursor(cursorPar(), cursorRow()->endpos() - 1);
}
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.
: 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);