if (selecting || lt->selection.mark()) {
lt->setSelection();
if (lt->isInInset())
- bv->updateInset(lt->inset_owner, false);
+ bv->updateInset(lt->inset_owner);
else
bv->toggleToggle();
}
if (!lt->isInInset()) {
- //if (fitcur)
- // bv->update(lt, BufferView::SELECT|BufferView::FITCUR);
- //else
- bv->update(lt, BufferView::SELECT|BufferView::FITCUR);
+ bv->update(lt, BufferView::SELECT);
bv->showCursor();
- } else if (bv->text->status() != LyXText::UNCHANGED) {
+ } else if (bv->text->refreshStatus() != LyXText::REFRESH_NONE) {
bv->theLockingInset()->hideInsetCursor(bv);
- bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
+ bv->update(BufferView::SELECT);
bv->showCursor();
}
{
bv()->hideCursor();
bv()->beforeChange(this);
- update(false);
+ update();
string contents;
if (same_content && cursor.par()->isInset(cursor.pos())) {
bv()->owner()->message(_("No more insets"));
}
}
- update(false);
+ update();
selection.cursor = cursor;
}
void LyXText::cursorPrevious()
{
+ int y = top_y();
+
if (!cursor.row()->previous()) {
- if (top_y() > 0) {
+ if (y > 0) {
int new_y = bv()->text->top_y() - bv()->workHeight();
bv()->screen().draw(bv()->text, bv(), new_y < 0 ? 0 : new_y);
bv()->updateScrollbar();
return;
}
- int y = top_y();
Row * cursorrow = cursor.row();
setCursorFromCoordinates(cursor.x_fix(), y);
void LyXText::cursorNext()
{
+ int topy = top_y();
+
if (!cursor.row()->next()) {
int y = cursor.y() - cursor.row()->baseline() +
cursor.row()->height();
- if (y > top_y() + bv()->workHeight()) {
+ if (y > topy + bv()->workHeight()) {
bv()->screen().draw(bv()->text, bv(), bv()->text->top_y() + bv()->workHeight());
bv()->updateScrollbar();
}
return;
}
- int y = top_y() + bv()->workHeight();
- if (inset_owner && !top_y()) {
+ int y = topy + bv()->workHeight();
+ if (inset_owner && !topy) {
y -= (bv()->text->cursor.iy()
- bv()->text->top_y()
+ bv()->theLockingInset()->insetInInsetY());
}
-void LyXText::update(bool changed)
+void LyXText::update()
{
- BufferView::UpdateCodes c = BufferView::SELECT | BufferView::FITCUR;
- if (changed)
- bv()->update(this, c | BufferView::CHANGE);
- else
- bv()->update(this, c);
+ bv()->update(this, BufferView::SELECT);
}
namespace {
void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
{
bv->hideCursor();
- lt->update(bv);
+ lt->update();
InsetSpecialChar * new_inset = new InsetSpecialChar(kind);
if (!bv->insertInset(new_inset))
delete new_inset;
else
- bv->updateInset(new_inset, true);
+ bv->updateInset(new_inset);
}
redoHeightOfParagraph();
postPaint(0);
setCursor(cursor.par(), cursor.pos());
- update(bv);
+ update();
break;
}
case LFUN_DELETE_WORD_FORWARD:
bv->beforeChange(this);
- update(false);
+ update();
deleteWordForward();
- update(bv);
+ update();
finishChange(bv);
break;
case LFUN_DELETE_WORD_BACKWARD:
bv->beforeChange(this);
- update(false);
+ update();
deleteWordBackward();
- update(true);
+ update();
finishChange(bv);
break;
case LFUN_DELETE_LINE_FORWARD:
bv->beforeChange(this);
- update(false);
+ update();
deleteLineForward();
update();
finishChange(bv);
case LFUN_TAB:
if (!selection.mark())
bv->beforeChange(this);
- update(false);
+ update();
cursorTab();
finishChange(bv);
break;
case LFUN_WORDRIGHT:
if (!selection.mark())
bv->beforeChange(this);
- update(false);
+ update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorLeftOneWord();
else
case LFUN_WORDLEFT:
if (!selection.mark())
bv->beforeChange(this);
- update(false);
+ update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorRightOneWord();
else
case LFUN_BEGINNINGBUF:
if (!selection.mark())
bv->beforeChange(this);
- update(false);
+ update();
cursorTop();
finishChange(bv);
break;
case LFUN_ENDBUF:
if (selection.mark())
bv->beforeChange(this);
- update(false);
+ update();
cursorBottom();
finishChange(bv);
break;
case LFUN_RIGHTSEL:
- update(false);
+ update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorLeft(bv);
else
break;
case LFUN_LEFTSEL:
- update(false);
+ update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorRight(bv);
else
break;
case LFUN_UPSEL:
- update(false);
+ update();
cursorUp(true);
finishChange(bv, true);
break;
case LFUN_DOWNSEL:
- update(false);
+ update();
cursorDown(true);
finishChange(bv, true);
break;
case LFUN_UP_PARAGRAPHSEL:
- update(false);
+ update();
cursorUpParagraph();
finishChange(bv, true);
break;
case LFUN_DOWN_PARAGRAPHSEL:
- update(false);
+ update();
cursorDownParagraph();
finishChange(bv, true);
break;
case LFUN_PRIORSEL:
- update(false);
+ update();
cursorPrevious();
finishChange(bv, true);
break;
case LFUN_NEXTSEL:
- update(false);
+ update();
cursorNext();
finishChange(bv, true);
break;
case LFUN_HOMESEL:
- update(false);
+ update();
cursorHome();
finishChange(bv, true);
break;
case LFUN_ENDSEL:
- update(false);
+ update();
cursorEnd();
finishChange(bv, true);
break;
case LFUN_WORDRIGHTSEL:
- update(false);
+ update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorLeftOneWord();
else
break;
case LFUN_WORDLEFTSEL:
- update(false);
+ update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorRightOneWord();
else
break;
case LFUN_WORDSEL: {
- update(false);
+ update();
LyXCursor cur1;
LyXCursor cur2;
getWord(cur1, cur2, WHOLE_WORD);
bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
if (!selection.mark())
bv->beforeChange(this);
- update(false);
+ update();
if (is_rtl)
cursorLeft(false);
if (cursor.pos() < cursor.par()->size()
bool const is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
if (!selection.mark())
bv->beforeChange(this);
- update(false);
+ update();
LyXCursor const cur = cursor;
if (!is_rtl)
cursorLeft(false);
case LFUN_HOME:
if (!selection.mark())
bv->beforeChange(this);
- update(bv);
+ update();
cursorHome();
finishChange(bv, false);
break;
case LFUN_END:
if (!selection.mark())
bv->beforeChange(this);
- update(bv);
+ update();
cursorEnd();
finishChange(bv, false);
break;
bv->beforeChange(this);
insertInset(new InsetNewline);
- update(true);
+ update();
setCursor(cursor.par(), cursor.pos());
moveCursorUpdate(bv, false);
break;
if (!selection.set()) {
Delete();
selection.cursor = cursor;
- update(bv);
+ update();
// It is possible to make it a lot faster still
// just comment out the line below...
bv->showCursor();
} else {
- update(false);
+ update();
cutSelection(bv, true);
- update(bv);
+ update();
}
moveCursorUpdate(bv, false);
bv->owner()->view_state_changed();
cur.par()->params().align(),
cur.par()->params().labelWidthString(), 0);
cursorLeft(bv);
- update(bv);
+ update();
} else {
cursorLeft(bv);
Delete();
selection.cursor = cursor;
}
} else {
- update(false);
+ update();
cutSelection(bv, true);
}
- update(bv);
+ update();
break;
if (bv->owner()->getIntl().getTransManager().backspace()) {
backspace();
selection.cursor = cursor;
- update(bv);
+ update();
// It is possible to make it a lot faster still
// just comment out the line below...
bv->showCursor();
}
} else {
- update(false);
+ update();
cutSelection(bv, true);
- update(bv);
+ update();
}
bv->owner()->view_state_changed();
bv->switchKeyMap();
selection.cursor = cur;
}
} else {
- update(false);
+ update();
cutSelection(bv, true);
}
- update(bv);
+ update();
break;
case LFUN_BREAKPARAGRAPH:
bv->beforeChange(this);
breakParagraph(bv->buffer()->paragraphs, 0);
- update(bv);
+ update();
selection.cursor = cursor;
bv->switchKeyMap();
bv->owner()->view_state_changed();
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
bv->beforeChange(this);
breakParagraph(bv->buffer()->paragraphs, 1);
- update(bv);
+ update();
selection.cursor = cursor;
bv->switchKeyMap();
bv->owner()->view_state_changed();
cur.par()->params().spacing(),
cur.par()->params().align(),
cur.par()->params().labelWidthString(), 1);
- //update(bv);
}
}
else {
breakParagraph(bv->buffer()->paragraphs, 0);
- //update(bv);
}
- update(bv);
+ update();
selection.cursor = cur;
bv->switchKeyMap();
bv->owner()->view_state_changed();
if (cur_spacing != new_spacing || cur_value != new_value) {
par->params().spacing(Spacing(new_spacing, new_value));
redoParagraph();
- update(bv);
+ update();
}
break;
}
case LFUN_INSET_TOGGLE:
bv->hideCursor();
bv->beforeChange(this);
- update(false);
+ update();
toggleInset();
- update(false);
+ update();
bv->switchKeyMap();
break;
case LFUN_PROTECTEDSPACE:
if (cursor.par()->layout()->free_spacing) {
insertChar(' ');
- update(bv);
+ update();
} else {
specialChar(this, bv, InsetSpecialChar::PROTECTED_SEPARATOR);
}
case LFUN_MARK_OFF:
bv->beforeChange(this);
- update(false);
+ update();
selection.cursor = cursor;
cmd.message(N_("Mark off"));
break;
case LFUN_MARK_ON:
bv->beforeChange(this);
selection.mark(true);
- update(false);
+ update();
selection.cursor = cursor;
cmd.message(N_("Mark on"));
break;
case LFUN_SETMARK:
bv->beforeChange(this);
if (selection.mark()) {
- update(bv);
+ update();
cmd.message(N_("Mark removed"));
} else {
selection.mark(true);
- update(bv);
+ update();
cmd.message(N_("Mark set"));
}
selection.cursor = cursor;
break;
case LFUN_UPCASE_WORD:
- update(false);
+ update();
changeCase(LyXText::text_uppercase);
if (inset_owner)
- bv->updateInset(inset_owner, true);
- update(bv);
+ bv->updateInset(inset_owner);
+ update();
break;
case LFUN_LOWCASE_WORD:
- update(false);
+ update();
changeCase(LyXText::text_lowercase);
if (inset_owner)
- bv->updateInset(inset_owner, true);
+ bv->updateInset(inset_owner);
update();
break;
case LFUN_CAPITALIZE_WORD:
- update(false);
+ update();
changeCase(LyXText::text_capitalization);
if (inset_owner)
- bv->updateInset(inset_owner, true);
- update(bv);
+ bv->updateInset(inset_owner);
+ update();
break;
case LFUN_TRANSPOSE_CHARS:
- update(false);
+ update();
transposeChars();
if (inset_owner)
- bv->updateInset(inset_owner, true);
- update(bv);
+ bv->updateInset(inset_owner);
+ update();
break;
case LFUN_PASTE:
// clear the selection
bv->toggleSelection();
clearSelection();
- update(false);
+ update();
pasteSelection();
clearSelection(); // bug 393
- update(false);
- update(bv);
+ update();
bv->switchKeyMap();
break;
case LFUN_CUT:
bv->hideCursor();
- update(false);
+ update();
cutSelection(bv, true);
- update(bv);
+ update();
cmd.message(_("Cut"));
break;
case LFUN_BEGINNINGBUFSEL:
if (inset_owner)
return UNDISPATCHED;
- update(false);
+ update();
cursorTop();
finishChange(bv, true);
break;
case LFUN_ENDBUFSEL:
if (inset_owner)
return UNDISPATCHED;
- update(false);
+ update();
cursorBottom();
finishChange(bv, true);
break;
if (change_layout) {
bv->hideCursor();
current_layout = layout;
- update(false);
+ update();
setLayout(layout);
bv->owner()->setLayout(layout);
- update(bv);
+ update();
bv->switchKeyMap();
}
break;
else
insertStringAsLines(clip);
clearSelection();
- update(bv);
+ update();
}
break;
}
for (int i = 0; i < datetmp_len; i++) {
insertChar(datetmp[i]);
- update(true);
+ update();
}
selection.cursor = cursor;
moveCursorUpdate(bv, false);
setSelection();
if (!isInInset())
bv->screen().toggleSelection(this, bv, false);
- update(false);
+ update();
bv->haveSelection(selection.set());
}
break;
} else {
selectWord(LyXText::WHOLE_WORD_STRICT);
}
- update(false);
+ update();
bv->haveSelection(selection.set());
}
break;
// Maybe an empty line was deleted
if (!bv->text->selection.set())
- bv->update(bv->text, BufferView::UPDATE);
+ bv->update(BufferView::UPDATE);
bv->text->setSelection();
bv->screen().toggleToggle(bv->text, bv);
bv->fitCursor();
// Highly editable inset, like math
UpdatableInset * inset = static_cast<UpdatableInset *>(inset_hit);
selection_possible = false;
- bv->owner()->updateLayoutChoice();
bv->owner()->message(inset->editMessage());
//inset->edit(bv, x, y, cmd.button());
// We just have to lock the inset before calling a PressEvent on it!
bv->text->selection.cursor = bv->text->cursor;
bv->text->cursor.x_fix(bv->text->cursor.x());
- bv->owner()->updateLayoutChoice();
if (bv->fitCursor())
selection_possible = false;
if (lyxrc.auto_region_delete) {
if (selection.set()) {
cutSelection(false, false);
- update(bv);
+ update();
}
bv->haveSelection(false);
}
bv->owner()->getIntl().getTransManager().
TranslateAndInsert(*cit, this);
- update(bv);
+ update();
selection.cursor = cursor;
moveCursorUpdate(bv, false);