extern int NEST_MARGIN;
extern int CHANGEBAR_MARGIN;
+
namespace {
/**
hfill_(row_.fill_hfill()),
label_hfill_(row_.fill_label_hfill())
{
+ //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo << " yo: " << yo
+ // << " pit->y: " << pit_->y
+ // << " row: " << (pit_->size() ? pit_->getChar(row_.pos()) : 'X') << endl;
x_ += xo_;
// background has already been cleared.
paintBackground();
// paint the selection background
- if (bv_.selection().set() && &text_ == bv_.fullCursor().innerText())
- paintSelection();
+#warning look here for selection
+ //if (bv_.cursor().selection() && &text_ == bv_.cursor().innerText())
+ // paintSelection();
// vertical lines for appendix
paintAppendix();
void RowPainter::paintInset(pos_type const pos)
{
- InsetOld * inset = const_cast<InsetOld*>(pit_->getInset(pos));
-
+ InsetBase const * inset = pit_->getInset(pos);
BOOST_ASSERT(inset);
-
PainterInfo pi(const_cast<BufferView *>(&bv_));
pi.base.font = getFont(pos);
+ inset->drawSelection(pi, int(x_), yo_ + row_.baseline());
inset->draw(pi, int(x_), yo_ + row_.baseline());
x_ += inset->width();
}
// first char
char c = pit_->getChar(pos);
c = pit_->transformChar(c, pos);
- str +=c;
+ str += c;
++vpos;
LyXFont const & font = getFont(pos);
bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
// the current selection
- int const startx = text_.cursorX(bv_.selStart());
- int const endx = text_.cursorX(bv_.selEnd());
- int const starty = text_.cursorY(bv_.selStart());
- int const endy = text_.cursorY(bv_.selEnd());
- ParagraphList::iterator startpit = text_.getPar(bv_.selStart());
- ParagraphList::iterator endpit = text_.getPar(bv_.selEnd());
- RowList::iterator startrow = startpit->getRow(bv_.selStart().pos());
- RowList::iterator endrow = endpit->getRow(bv_.selEnd().pos());
+ LCursor const & cur = bv_.cursor();
+ int const startx = text_.cursorX(cur.selBegin());
+ int const endx = text_.cursorX(cur.selEnd());
+ int const starty = text_.cursorY(cur.selBegin());
+ int const endy = text_.cursorY(cur.selEnd());
+ ParagraphList::iterator startpit = text_.getPar(cur.selBegin());
+ ParagraphList::iterator endpit = text_.getPar(cur.selEnd());
+ RowList::iterator startrow = startpit->getRow(cur.selBegin().pos());
+ RowList::iterator endrow = endpit->getRow(cur.selEnd().pos());
int const h = row_.height();
int const row_y = pit_->y + row_.y_offset();
int w;
if (sel_on_one_row) {
if (startx < endx) {
- x = int(xo_) + startx;
+ x = startx;
w = endx - startx;
} else {
- x = int(xo_) + endx;
+ x = endx;
w = startx - endx;
}
pain_.fillRectangle(x, yo_, w, h, LColor::selection);
} else if (sel_starts_here) {
- int const x = is_rtl ? int(xo_) : int(xo_ + startx);
+ int const x = is_rtl ? 0 : startx;
int const w = is_rtl ? startx : (width_ - startx);
pain_.fillRectangle(x, yo_, w, h, LColor::selection);
} else if (sel_ends_here) {
- int const x = is_rtl ? int(xo_ + endx) : int(xo_);
+ int const x = is_rtl ? endx : 0;
int const w = is_rtl ? (width_ - endx) : endx;
pain_.fillRectangle(x, yo_, w, h, LColor::selection);
} else if (row_y > starty && row_y < endy) {
}
if (((startpit != pit_ && startrow != rit_)
- || bv_.selStart().pos() <= pos) &&
+ || cur.selBegin().pos() <= pos) &&
((endpit != pit_ && endrow != rit_)
- || pos < bv_.selEnd().pos())) {
+ || pos < cur.selEnd().pos())) {
// Here we do not use x_ as xo_ was added to x_.
pain_.fillRectangle(int(old_tmpx), yo_,
int(tmpx - old_tmpx + 1), h, LColor::selection);
int paintText(BufferView const & bv)
{
ParagraphList::iterator pit;
- bv.text()->getRowNearY(bv.top_y(), pit);
+ bv.text()->updateParPositions();
+ bv.text()->getRowNearY(0, pit);
+ lyxerr << "top_y: " << bv.top_y() << " y: " << pit->y << endl;
return paintPars(bv, *bv.text(), pit, 0, 0, pit->y);
}