bv_->the_locking_inset->
InsetMotionNotify(bv_,
x - cursor.x,
- y - cursor.y,
+ y - cursor.y + screen->first,
state);
return;
}
if (x > start_x && x < end_x
&& y_tmp > cursor.y - tmpinset->ascent(bv_->painter(), font)
&& y_tmp < cursor.y + tmpinset->descent(bv_->painter(), font)) {
+#if 0
if (move_cursor && (tmpinset != bv_->the_locking_inset))
+#endif
bv_->text->SetCursor(cursor.par,cursor.pos,true);
x = x - start_x;
// The origin of an inset is on the baseline
if (x > start_x && x < end_x
&& y_tmp > cursor.y - tmpinset->ascent(bv_->painter(), font)
&& y_tmp < cursor.y + tmpinset->descent(bv_->painter(), font)) {
+#if 0
if (move_cursor && (tmpinset != bv_->the_locking_inset))
- bv_->text->SetCursor(cursor.par,cursor.pos,true);
+#endif
+ bv_->text->SetCursor(cursor.par,cursor.pos-1,true);
x = x - start_x;
// The origin of an inset is on the baseline
y = y_tmp - (bv_->text->cursor.y);
xpos = x;
UpdatableInset::draw(pain, f, baseline, x);
- top_x = int(x);
- top_baseline = baseline;
- computeTextRows(pain, x);
- computeBaselines(baseline);
+ if (init_inset || (baseline != top_baseline) || (top_x != int(x))) {
+ top_baseline = baseline;
+ if (init_inset || (top_x != int(x))) {
+ top_x = int(x);
+ computeTextRows(pain, x);
+ init_inset = false;
+ }
+ computeBaselines(baseline);
+ }
if (the_locking_inset && (cursor.pos == inset_pos)) {
resetPos(pain);
inset_x = cursor.x - top_x + drawTextXOffset;
}
rows.back().asc = wordAscent;
rows.back().desc = wordDescent;
- row.pos = ++p; // +1;
+ row.pos = ++p;
rows.push_back(row);
SingleHeight(pain, par, p, oasc, odesc);
insetWidth = max(insetWidth, owidth);
nwp = p;
continue;
}
- Inset const * inset = 0;
+ Inset * inset = 0;
if (((p + 1) < par->Last()) &&
(par->GetChar(p + 1)==LyXParagraph::META_INSET))
inset = par->GetInset(p + 1);
- if (inset && inset->display()) {
- if (!is_first_word_in_row && (width >= maxWidth)) {
- // we have to split also the row above
+ if (inset) {
+ inset->setOwner(this);
+ if (inset->display()) {
+ if (!is_first_word_in_row && (width >= maxWidth)) {
+ // we have to split also the row above
+ rows.back().asc = oasc;
+ rows.back().desc = odesc;
+ row.pos = nwp;
+ rows.push_back(row);
+ oasc = wordAscent;
+ odesc = wordDescent;
+ insetWidth = max(insetWidth, owidth);
+ width = lastWordWidth;
+ lastWordWidth = 0;
+ } else {
+ oasc = max(oasc, wordAscent);
+ odesc = max(odesc, wordDescent);
+ }
rows.back().asc = oasc;
rows.back().desc = odesc;
- row.pos = nwp;
+ row.pos = ++p;
rows.push_back(row);
- oasc = wordAscent;
- odesc = wordDescent;
- insetWidth = max(insetWidth, owidth);
- width = lastWordWidth;
- lastWordWidth = 0;
- } else {
- oasc = max(oasc, wordAscent);
- odesc = max(odesc, wordDescent);
+ SingleHeight(pain, par, p, asc, desc);
+ rows.back().asc = asc;
+ rows.back().desc = desc;
+ row.pos = nwp = p + 1;
+ rows.push_back(row);
+ oasc = odesc = width = lastWordWidth = 0;
+ is_first_word_in_row = true;
+ wordAscent = wordDescent = 0;
+ continue;
}
- rows.back().asc = oasc;
- rows.back().desc = odesc;
- row.pos = ++p;
- rows.push_back(row);
- SingleHeight(pain, par, p, asc, desc);
- rows.back().asc = asc;
- rows.back().desc = desc;
- row.pos = nwp = p + 1;
- rows.push_back(row);
- oasc = odesc = width = lastWordWidth = 0;
- is_first_word_in_row = true;
- wordAscent = wordDescent = 0;
- continue;
} else if (par->IsSeparator(p)) {
if (width >= maxWidth) {
if (is_first_word_in_row) {
void InsetText::UpdateLocal(BufferView *bv, bool flag)
{
-#if 1
if (flag) {
computeTextRows(bv->painter(), xpos);
computeBaselines(top_baseline);
bv->updateInset(this, flag);
if (flag)
resetPos(bv->painter());
-#else
- init_inset = flag;
- bv->updateInset(this, flag);
-#endif
}
bool InsetText::cutSelection()
CutAndPaste cap;
LyXParagraph *endpar = par;
+ int start, end;
+ if (selection_start > selection_end) {
+ start = selection_end;
+ end = selection_start;
+ } else {
+ start = selection_start;
+ end = selection_end;
+ }
- return cap.cutSelection(par, &endpar, selection_start, selection_end,
- buffer->params.textclass);
+ return cap.cutSelection(par, &endpar, start, end,buffer->params.textclass);
}
bool InsetText::copySelection()
CutAndPaste cap;
- return cap.copySelection(par, par, selection_start, selection_end,
- buffer->params.textclass);
+ int start, end;
+ if (selection_start > selection_end) {
+ start = selection_end;
+ end = selection_start;
+ } else {
+ start = selection_start;
+ end = selection_end;
+ }
+ return cap.copySelection(par, par, start, end, buffer->params.textclass);
}
bool InsetText::pasteSelection()