+2005-07-17 Juergen Vigna <jug@lyx.org>
+
+ * text2.C (cursorHome):
+ * text.C (drawSelection, cursorX):
+ * dociterator.C (textRow): add boundary to getRow() call
+
+ * paragraph.C (getRow): implementation of below
+
+ * paragraph.h: add parameter boundary for getRow() function
+
2005-07-18 José Matos <jamatos@fc.up.pt>
* buffer.C:
* tex-strings.[Ch]: new file format, remove support for a4.sty,
a4wide.sty and a4widemargins.
-2005-07-17 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+2005-07-17 Juergen Vigna <jug@lyx.org>
* text2.C (cursorLeft): fix one of error
Row & DocIterator::textRow()
{
BOOST_ASSERT(!paragraph().rows().empty());
- return paragraph().getRow(pos());
+ return paragraph().getRow(pos(), boundary_);
}
Row const & DocIterator::textRow() const
{
BOOST_ASSERT(!paragraph().rows().empty());
- return paragraph().getRow(pos());
+ return paragraph().getRow(pos(), boundary_);
}
}
-Row & Paragraph::getRow(pos_type pos)
+Row & Paragraph::getRow(pos_type pos, bool boundary)
{
BOOST_ASSERT(!rows().empty());
+ // If boundary is set we should return the row on which
+ // the character before is inside.
+ if (pos > 0 && boundary)
+ --pos;
+
RowList::iterator rit = rows_.end();
RowList::iterator const begin = rows_.begin();
}
-Row const & Paragraph::getRow(pos_type pos) const
+Row const & Paragraph::getRow(pos_type pos, bool boundary) const
{
BOOST_ASSERT(!rows().empty());
+ // If boundary is set we should return the row on which
+ // the character before is inside.
+ if (pos > 0 && boundary)
+ --pos;
+
RowList::const_iterator rit = rows_.end();
RowList::const_iterator const begin = rows_.begin();
ParagraphParameters const & params() const;
///
- Row & getRow(lyx::pos_type pos);
+ Row & getRow(lyx::pos_type pos, bool boundary);
///
- Row const & getRow(lyx::pos_type pos) const;
+ Row const & getRow(lyx::pos_type pos, bool boundary) const;
///
size_t pos2row(lyx::pos_type pos) const;
}
-/*
+#if 0
// only used for inset right now. should also be used for main text
void LyXText::drawSelection(PainterInfo & pi, int x , int) const
{
Paragraph const & par1 = pars_[beg.pit()];
Paragraph const & par2 = pars_[end.pit()];
- Row const & row1 = par1.getRow(beg.pos());
- Row const & row2 = par2.getRow(end.pos());
+ Row const & row1 = par1.getRow(beg.pos(), beg.boundary());
+ Row const & row2 = par2.getRow(end.pos(), end.boundary());
int y1,x1,x2;
if (bv_funcs::status(pi.base.bv, beg) == bv_funcs::CUR_ABOVE) {
pi.pain.fillRectangle(x + X1, y2 - row2.height(),
X2 - X1, row2.height(), LColor::background);
}
-*/
+#else
void LyXText::drawSelection(PainterInfo & pi, int x, int) const
{
x1 = 0;
x2 = dim_.wid;
} else {
- Row const & row1 = par1.getRow(beg.pos());
+ Row const & row1 = par1.getRow(beg.pos(), beg.boundary());
y1 = bv_funcs::getPos(beg, beg.boundary()).y_ - row1.ascent();
y2 = y1 + row1.height();
int const startx = cursorX(beg.top(), false);
X1 = 0;
X2 = dim_.wid;
} else {
- Row const & row2 = par2.getRow(end.pos());
+ Row const & row2 = par2.getRow(end.pos(), end.boundary());
Y1 = bv_funcs::getPos(end, end.boundary()).y_ - row2.ascent();
Y2 = Y1 + row2.height();
int const endx = cursorX(end.top(), false);
X2 = !isRTL(par2) ? endx : 0 + dim_.wid;
}
- if (!above && !below && &par1.getRow(beg.pos())
- == &par2.getRow(end.pos()))
+ if (!above && !below && &par1.getRow(beg.pos(), end.boundary())
+ == &par2.getRow(end.pos(), end.boundary()))
{
// paint only one rectangle
pi.pain.fillRectangle(x + x1, y1, X2 - x1, y2 - y1,
pi.pain.fillRectangle(x, y2, dim_.wid,
Y1 - y2, LColor::selection);
}
-
+#endif
bool LyXText::isLastRow(pit_type pit, Row const & row) const
{
if (boundary_correction)
--ppos;
- Row const & row = par.getRow(ppos);
+ Row const & row = par.getRow(sl.pos(), boundary);
pos_type cursor_vpos = 0;
void LyXText::cursorHome(LCursor & cur)
{
BOOST_ASSERT(this == cur.text());
- Paragraph const & par = cur.paragraph();
- if (cur.boundary() && cur.pos())
- setCursor(cur, cur.pit(), par.getRow(cur.pos()-1).pos());
- else
- setCursor(cur, cur.pit(), cur.textRow().pos());
+ Row const & row = cur.paragraph().getRow(cur.pos(),cur.boundary());
+
+ setCursor(cur, cur.pit(), row.pos());
}