The markDirty() and fitCursor() changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6537 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-03-19 14:45:22 +00:00
parent 19fb963cc8
commit 0623d1f074
40 changed files with 317 additions and 321 deletions

View File

@ -197,6 +197,12 @@ void BufferView::update(LyXText * text, UpdateCodes f)
} }
void BufferView::update(UpdateCodes f)
{
pimpl_->update(f);
}
void BufferView::switchKeyMap() void BufferView::switchKeyMap()
{ {
pimpl_->switchKeyMap(); pimpl_->switchKeyMap();
@ -554,7 +560,7 @@ bool BufferView::gotoLabel(string const & label)
beforeChange(text); beforeChange(text);
text->setCursor(it.getPar(), it.getPos()); text->setCursor(it.getPar(), it.getPos());
text->selection.cursor = text->cursor; text->selection.cursor = text->cursor;
update(text, BufferView::SELECT|BufferView::FITCUR); update(text, BufferView::SELECT);
return true; return true;
} }
} }
@ -570,11 +576,11 @@ void BufferView::undo()
owner()->message(_("Undo")); owner()->message(_("Undo"));
hideCursor(); hideCursor();
beforeChange(text); beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR); update(text, BufferView::SELECT);
if (!textUndo(this)) if (!textUndo(this))
owner()->message(_("No further undo information")); owner()->message(_("No further undo information"));
else else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(text, BufferView::SELECT);
switchKeyMap(); switchKeyMap();
} }
@ -587,11 +593,11 @@ void BufferView::redo()
owner()->message(_("Redo")); owner()->message(_("Redo"));
hideCursor(); hideCursor();
beforeChange(text); beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR); update(text, BufferView::SELECT);
if (!textRedo(this)) if (!textRedo(this))
owner()->message(_("No further redo information")); owner()->message(_("No further redo information"));
else else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(text, BufferView::SELECT);
switchKeyMap(); switchKeyMap();
} }
@ -610,7 +616,7 @@ void BufferView::pasteEnvironment()
if (available()) { if (available()) {
text->pasteEnvironmentType(); text->pasteEnvironmentType();
owner()->message(_("Paragraph environment type set")); owner()->message(_("Paragraph environment type set"));
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(text, BufferView::SELECT);
} }
} }
@ -638,7 +644,7 @@ void BufferView::selectLastWord()
text->selection.cursor = cur; text->selection.cursor = cur;
text->selectSelectedWord(); text->selectSelectedWord();
toggleSelection(false); toggleSelection(false);
update(text, BufferView::SELECT|BufferView::FITCUR); update(text, BufferView::SELECT);
} }
@ -650,7 +656,7 @@ void BufferView::endOfSpellCheck()
beforeChange(text); beforeChange(text);
text->selectSelectedWord(); text->selectSelectedWord();
text->clearSelection(); text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR); update(text, BufferView::SELECT);
} }
@ -661,11 +667,11 @@ void BufferView::replaceWord(string const & replacestring)
LyXText * tt = getLyXText(); LyXText * tt = getLyXText();
hideCursor(); hideCursor();
update(tt, BufferView::SELECT|BufferView::FITCUR); update(tt, BufferView::SELECT);
// clear the selection (if there is any) // clear the selection (if there is any)
toggleSelection(false); toggleSelection(false);
update(tt, BufferView::SELECT|BufferView::FITCUR); update(tt, BufferView::SELECT);
// clear the selection (if there is any) // clear the selection (if there is any)
toggleSelection(false); toggleSelection(false);
@ -677,7 +683,11 @@ void BufferView::replaceWord(string const & replacestring)
for (string::size_type i = 0; i < replacestring.length() + 1; ++i) { for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
tt->cursorLeft(this); tt->cursorLeft(this);
} }
update(tt, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(tt, BufferView::SELECT);
// FIXME: should be done through LFUN
buffer()->markDirty();
fitCursor();
} }
// End of spellchecker stuff // End of spellchecker stuff
@ -814,9 +824,9 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
} }
void BufferView::updateInset(Inset * inset, bool mark_dirty) void BufferView::updateInset(Inset * inset)
{ {
pimpl_->updateInset(inset, mark_dirty); pimpl_->updateInset(inset);
} }

View File

@ -44,10 +44,8 @@ public:
* of the document rendering. * of the document rendering.
*/ */
enum UpdateCodes { enum UpdateCodes {
UPDATE = 0, //< FIXME UPDATE = 0, //< repaint
SELECT = 1, //< selection change SELECT = 1 //< reset selection to current cursor pos
FITCUR = 2, //< the cursor needs fitting into the view
CHANGE = 4 //< document data has changed
}; };
/** /**
@ -88,8 +86,10 @@ public:
void update(); void update();
// update for a particular lyxtext // update for a particular lyxtext
void update(LyXText *, UpdateCodes uc); void update(LyXText *, UpdateCodes uc);
/// update for the top-level lyxtext
void update(UpdateCodes uc);
/// update for a particular inset /// update for a particular inset
void updateInset(Inset * inset, bool mark_dirty); void updateInset(Inset * inset);
/// reset the scrollbar to reflect current view position /// reset the scrollbar to reflect current view position
void updateScrollbar(); void updateScrollbar();
/// FIXME /// FIXME

View File

@ -530,43 +530,6 @@ void BufferView::Pimpl::update()
} }
} }
// Values used when calling update:
// -3 - update
// -2 - update, move sel_cursor if selection, fitcursor
// -1 - update, move sel_cursor if selection, fitcursor, mark dirty
// 0 - update, move sel_cursor if selection, fitcursor
// 1 - update, move sel_cursor if selection, fitcursor, mark dirty
// 3 - update, move sel_cursor if selection
//
// update -
// a simple redraw of the parts that need refresh
//
// move sel_cursor if selection -
// the text's sel_cursor is moved if there is selection is progress
//
// fitcursor -
// fitCursor() is called and the scrollbar updated
//
// mark dirty -
// the buffer is marked dirty.
//
// enum {
// UPDATE = 0,
// SELECT = 1,
// FITCUR = 2,
// CHANGE = 4
// };
//
// UPDATE_ONLY = UPDATE;
// UPDATE_SELECT = UPDATE | SELECT;
// UPDATE_SELECT_MOVE = UPDATE | SELECT | FITCUR;
// UPDATE_SELECT_MOVE_AFTER_CHANGE = UPDATE | SELECT | FITCUR | CHANGE;
//
// update(-3) -> update(0) -> update(0) -> update(UPDATE)
// update(-2) -> update(1 + 2) -> update(3) -> update(SELECT|FITCUR)
// update(-1) -> update(1 + 2 + 4) -> update(7) -> update(SELECT|FITCUR|CHANGE)
// update(1) -> update(1 + 2 + 4) -> update(7) -> update(SELECT|FITCUR|CHANGE)
// update(3) -> update(1) -> update(1) -> update(SELECT)
void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f) void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
{ {
@ -578,17 +541,28 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
if (text->inset_owner) { if (text->inset_owner) {
text->inset_owner->setUpdateStatus(bv_, InsetText::NONE); text->inset_owner->setUpdateStatus(bv_, InsetText::NONE);
updateInset(text->inset_owner, false); updateInset(text->inset_owner);
} else { } else {
update(); update();
} }
}
if ((f & FITCUR)) {
fitCursor(); void BufferView::Pimpl::update(BufferView::UpdateCodes f)
{
LyXText * text = bv_->text;
if (!text->selection.set() && (f & SELECT)) {
text->selection.cursor = text->cursor;
} }
if ((f & CHANGE)) { text->fullRebreak();
buffer_->markDirty();
if (text->inset_owner) {
text->inset_owner->setUpdateStatus(bv_, InsetText::NONE);
updateInset(text->inset_owner);
} else {
update();
} }
} }
@ -683,7 +657,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
bv_->text->setCursor(par, bv_->text->setCursor(par,
min(par->size(), saved_positions[i].par_pos)); min(par->size(), saved_positions[i].par_pos));
update(bv_->text, BufferView::SELECT | BufferView::FITCUR); update(BufferView::SELECT);
if (i > 0) { if (i > 0) {
ostringstream str; ostringstream str;
#if USE_BOOST_FORMAT #if USE_BOOST_FORMAT
@ -776,6 +750,8 @@ void BufferView::Pimpl::center()
new_y = t->cursor.y() - half_height; new_y = t->cursor.y() - half_height;
} }
// FIXME: look at this comment again ...
// FIXME: can we do this w/o calling screen directly ? // FIXME: can we do this w/o calling screen directly ?
// This updates top_y() but means the fitCursor() call // This updates top_y() but means the fitCursor() call
// from the update(FITCUR) doesn't realise that we might // from the update(FITCUR) doesn't realise that we might
@ -787,7 +763,7 @@ void BufferView::Pimpl::center()
// pretty obfuscated way of updating t->top_y() // pretty obfuscated way of updating t->top_y()
screen().draw(t, bv_, new_y); screen().draw(t, bv_, new_y);
update(t, BufferView::SELECT | BufferView::FITCUR); update(BufferView::SELECT);
} }
@ -939,7 +915,7 @@ void BufferView::Pimpl::trackChanges()
// we cannot allow undos beyond the freeze point // we cannot allow undos beyond the freeze point
buf->undostack.clear(); buf->undostack.clear();
} else { } else {
bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR); update(BufferView::SELECT);
bv_->text->setCursor(&(*buf->paragraphs.begin()), 0); bv_->text->setCursor(&(*buf->paragraphs.begin()), 0);
#warning changes FIXME #warning changes FIXME
//moveCursorUpdate(false); //moveCursorUpdate(false);
@ -1131,10 +1107,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
owner_->getLyXFunc().handleKeyFunc(ev.action); owner_->getLyXFunc().handleKeyFunc(ev.action);
owner_->getIntl().getTransManager() owner_->getIntl().getTransManager()
.TranslateAndInsert(ev.argument[0], bv_->getLyXText()); .TranslateAndInsert(ev.argument[0], bv_->getLyXText());
update(bv_->getLyXText(), update(bv_->getLyXText(), BufferView::SELECT);
BufferView::SELECT
| BufferView::FITCUR
| BufferView::CHANGE);
} }
break; break;
@ -1162,7 +1135,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
} else { } else {
Inset * inset = createInset(ev); Inset * inset = createInset(ev);
if (inset && insertInset(inset)) { if (inset && insertInset(inset)) {
updateInset(inset, true); updateInset(inset);
} else { } else {
delete inset; delete inset;
} }
@ -1255,7 +1228,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
break; break;
case LFUN_ACCEPT_ALL_CHANGES: { case LFUN_ACCEPT_ALL_CHANGES: {
bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR); update(BufferView::SELECT);
bv_->text->setCursor(&(*bv_->buffer()->paragraphs.begin()), 0); bv_->text->setCursor(&(*bv_->buffer()->paragraphs.begin()), 0);
#warning FIXME changes #warning FIXME changes
//moveCursorUpdate(false); //moveCursorUpdate(false);
@ -1263,13 +1236,12 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
while (lyxfind::findNextChange(bv_)) { while (lyxfind::findNextChange(bv_)) {
bv_->getLyXText()->acceptChange(); bv_->getLyXText()->acceptChange();
} }
update(bv_->text, update(BufferView::SELECT);
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
break; break;
} }
case LFUN_REJECT_ALL_CHANGES: { case LFUN_REJECT_ALL_CHANGES: {
bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR); update(BufferView::SELECT);
bv_->text->setCursor(&(*bv_->buffer()->paragraphs.begin()), 0); bv_->text->setCursor(&(*bv_->buffer()->paragraphs.begin()), 0);
#warning FIXME changes #warning FIXME changes
//moveCursorUpdate(false); //moveCursorUpdate(false);
@ -1277,22 +1249,19 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
while (lyxfind::findNextChange(bv_)) { while (lyxfind::findNextChange(bv_)) {
bv_->getLyXText()->rejectChange(); bv_->getLyXText()->rejectChange();
} }
update(bv_->text, update(BufferView::SELECT);
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
break; break;
} }
case LFUN_ACCEPT_CHANGE: { case LFUN_ACCEPT_CHANGE: {
bv_->getLyXText()->acceptChange(); bv_->getLyXText()->acceptChange();
update(bv_->text, update(BufferView::SELECT);
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
break; break;
} }
case LFUN_REJECT_CHANGE: { case LFUN_REJECT_CHANGE: {
bv_->getLyXText()->rejectChange(); bv_->getLyXText()->rejectChange();
update(bv_->text, update(BufferView::SELECT);
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
break; break;
} }
@ -1324,15 +1293,15 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
beforeChange(bv_->text); beforeChange(bv_->text);
if (!lout.empty()) { if (!lout.empty()) {
update(bv_->text, BufferView::SELECT|BufferView::FITCUR); update(BufferView::SELECT);
bv_->text->breakParagraph(bv_->buffer()->paragraphs); bv_->text->breakParagraph(bv_->buffer()->paragraphs);
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(BufferView::SELECT);
if (!bv_->text->cursor.par()->empty()) { if (!bv_->text->cursor.par()->empty()) {
bv_->text->cursorLeft(bv_); bv_->text->cursorLeft(bv_);
bv_->text->breakParagraph(bv_->buffer()->paragraphs); bv_->text->breakParagraph(bv_->buffer()->paragraphs);
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(BufferView::SELECT);
} }
string lres = lout; string lres = lout;
@ -1358,18 +1327,18 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
LYX_ALIGN_LAYOUT, LYX_ALIGN_LAYOUT,
string(), string(),
0); 0);
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(BufferView::SELECT);
} }
bv_->text->insertInset(inset); bv_->text->insertInset(inset);
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); update(BufferView::SELECT);
unFreezeUndo(); unFreezeUndo();
return true; return true;
} }
void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty) void BufferView::Pimpl::updateInset(Inset * inset)
{ {
if (!inset || !available()) if (!inset || !available())
return; return;
@ -1379,18 +1348,12 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
if (bv_->theLockingInset() == inset) { if (bv_->theLockingInset() == inset) {
if (bv_->text->updateInset(inset)) { if (bv_->text->updateInset(inset)) {
update(); update();
if (mark_dirty) {
buffer_->markDirty();
}
updateScrollbar(); updateScrollbar();
return; return;
} }
} else if (bv_->theLockingInset()->updateInsetInInset(bv_, inset)) { } else if (bv_->theLockingInset()->updateInsetInInset(bv_, inset)) {
if (bv_->text->updateInset(bv_->theLockingInset())) { if (bv_->text->updateInset(bv_->theLockingInset())) {
update(); update();
if (mark_dirty) {
buffer_->markDirty();
}
updateScrollbar(); updateScrollbar();
return; return;
} }
@ -1405,16 +1368,9 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
tl_inset = tl_inset->owner(); tl_inset = tl_inset->owner();
hideCursor(); hideCursor();
if (tl_inset == inset) { if (tl_inset == inset) {
update(bv_->text, BufferView::UPDATE); update(BufferView::UPDATE);
if (bv_->text->updateInset(inset)) { if (bv_->text->updateInset(inset)) {
if (mark_dirty) { update(BufferView::SELECT);
update(bv_->text,
BufferView::SELECT
| BufferView::FITCUR
| BufferView::CHANGE);
} else {
update(bv_->text, SELECT);
}
return; return;
} }
} else if (static_cast<UpdatableInset *>(tl_inset) } else if (static_cast<UpdatableInset *>(tl_inset)

View File

@ -47,6 +47,8 @@ struct BufferView::Pimpl : public boost::signals::trackable {
void update(); void update();
// //
void update(LyXText *, BufferView::UpdateCodes); void update(LyXText *, BufferView::UpdateCodes);
/// update the toplevel lyx text
void update(BufferView::UpdateCodes);
/** /**
* Repaint pixmap. Used for when we've made a visible * Repaint pixmap. Used for when we've made a visible
* change but don't need the full update() logic * change but don't need the full update() logic
@ -99,7 +101,7 @@ struct BufferView::Pimpl : public boost::signals::trackable {
/// ///
bool insertInset(Inset * inset, string const & lout = string()); bool insertInset(Inset * inset, string const & lout = string());
/// ///
void updateInset(Inset * inset, bool mark_dirty); void updateInset(Inset * inset);
/// ///
bool dispatch(FuncRequest const & ev); bool dispatch(FuncRequest const & ev);
private: private:

View File

@ -1,3 +1,26 @@
2003-03-19 John Levon <levon@movementarian.org>
* lyxfunc.C: mark buffer dirty if we executed a "dirtying" lfun.
fit the cursor after an lfun
* BufferView.h:
* BufferView.C:
* BufferView_pimpl.h:
* BufferView_pimpl.C: remove BufferView::FITCUR/CHANGE
* LyXAction.C: layout-character should have ReadOnly
* ParagraphParameters.C:
* buffer.C:
* bufferview_funcs.C:
* lyx_cb.C:
* lyxfind.C:
* lyxtext.h:
* text.C:
* text2.C:
* text3.C:
* undo_funcs.C: changes from above
2003-03-18 John Levon <levon@movementarian.org> 2003-03-18 John Levon <levon@movementarian.org>
* BufferView_pimpl.C (scrollDocView): add updateLayoutChoice(), * BufferView_pimpl.C (scrollDocView): add updateLayoutChoice(),

View File

@ -240,7 +240,7 @@ void LyXAction::init()
{ LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"), { LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
ReadOnly }, ReadOnly },
{ LFUN_LAYOUT, "layout", "", Noop }, { LFUN_LAYOUT, "layout", "", Noop },
{ LFUN_LAYOUT_CHARACTER, "layout-character", "", Noop }, { LFUN_LAYOUT_CHARACTER, "layout-character", "", ReadOnly },
{ LFUN_LAYOUT_COPY, "layout-copy", { LFUN_LAYOUT_COPY, "layout-copy",
N_("Copy paragraph environment type"), Noop }, N_("Copy paragraph environment type"), Noop },
{ LFUN_LAYOUT_DOCUMENT, "layout-document", "", ReadOnly }, { LFUN_LAYOUT_DOCUMENT, "layout-document", "", ReadOnly },

View File

@ -438,12 +438,7 @@ void setParagraphParams(BufferView & bv, string const & data)
params.noindent()); params.noindent());
// Actually apply these settings // Actually apply these settings
bv.update(text, bv.update(text, BufferView::SELECT);
BufferView::SELECT |
BufferView::FITCUR |
BufferView::CHANGE);
bv.buffer()->markDirty();
bv.owner()->message(_("Paragraph layout set")); bv.owner()->message(_("Paragraph layout set"));
} }

View File

@ -338,7 +338,6 @@ bool Buffer::readBody(LyXLex & lex, ParagraphList::iterator pit)
} else { } else {
// We are inserting into an existing document // We are inserting into an existing document
users->text->breakParagraph(paragraphs); users->text->breakParagraph(paragraphs);
markDirty();
// We don't want to adopt the parameters from the // We don't want to adopt the parameters from the
// document we insert, so read them into a temporary buffer // document we insert, so read them into a temporary buffer

View File

@ -177,7 +177,6 @@ void apply_freefont(BufferView * bv)
{ {
toggleAndShow(bv, freefont, toggleall); toggleAndShow(bv, freefont, toggleall);
bv->owner()->view_state_changed(); bv->owner()->view_state_changed();
bv->buffer()->markDirty();
bv->owner()->message(_("Character set")); bv->owner()->message(_("Character set"));
} }
@ -234,14 +233,14 @@ void changeDepth(BufferView * bv, LyXText * text, int decInc)
return; return;
bv->hideCursor(); bv->hideCursor();
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); bv->update(BufferView::SELECT);
if (decInc >= 0) if (decInc >= 0)
text->incDepth(); text->incDepth();
else else
text->decDepth(); text->decDepth();
if (text->inset_owner) if (text->inset_owner)
bv->updateInset((Inset *)text->inset_owner, true); bv->updateInset((Inset *)text->inset_owner);
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); bv->update(BufferView::SELECT);
} }
@ -397,9 +396,9 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
return; return;
bv->hideCursor(); bv->hideCursor();
bv->update(text, BufferView::SELECT | BufferView::FITCUR); bv->update(text, BufferView::SELECT);
text->toggleFree(font, toggleall); text->toggleFree(font, toggleall);
bv->update(text, BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); bv->update(text, BufferView::SELECT);
if (font.language() != ignore_language || if (font.language() != ignore_language ||
font.number() != LyXFont::IGNORE) { font.number() != LyXFont::IGNORE) {

View File

@ -122,7 +122,7 @@ void PreviewedInset::imageReady(grfx::PreviewImage const & pimage) const
pimage_ = &pimage; pimage_ = &pimage;
if (view()) if (view())
view()->updateInset(&inset_, false); view()->updateInset(&inset_);
} }
} // namespace grfx } // namespace grfx

View File

@ -1,3 +1,8 @@
2003-03-19 John Levon <levon@movementarian.org>
* several files: bv->updateInset() doesn't take
a bool mark_dirty any more
2003-03-17 Lars Gullik Bjønnes <larsbj@gullik.net> 2003-03-17 Lars Gullik Bjønnes <larsbj@gullik.net>
* adjust for BufferView* arg removal from lyxtext. * adjust for BufferView* arg removal from lyxtext.

View File

@ -66,7 +66,7 @@ dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
} }
setParams(p); setParams(p);
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;

View File

@ -63,7 +63,7 @@ dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
} }
setParams(p); setParams(p);
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;

View File

@ -24,6 +24,7 @@
#include "lyxtext.h" #include "lyxtext.h"
#include "WordLangTuple.h" #include "WordLangTuple.h"
#include "funcrequest.h" #include "funcrequest.h"
#include "buffer.h"
#include "frontends/font_metrics.h" #include "frontends/font_metrics.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"
@ -245,7 +246,8 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
first_after_edit = true; first_after_edit = true;
if (!bv->lockInset(this)) if (!bv->lockInset(this))
return; return;
bv->updateInset(this, false); bv->updateInset(this);
bv->buffer()->markDirty();
inset.edit(bv); inset.edit(bv);
} else { } else {
if (!bv->lockInset(this)) if (!bv->lockInset(this))
@ -273,7 +275,8 @@ void InsetCollapsable::edit(BufferView * bv, bool front)
if (!bv->lockInset(this)) if (!bv->lockInset(this))
return; return;
inset.setUpdateStatus(bv, InsetText::FULL); inset.setUpdateStatus(bv, InsetText::FULL);
bv->updateInset(this, false); bv->updateInset(this);
bv->buffer()->markDirty();
inset.edit(bv, front); inset.edit(bv, front);
first_after_edit = true; first_after_edit = true;
} else { } else {
@ -307,7 +310,7 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
inset.insetUnlock(bv); inset.insetUnlock(bv);
if (scroll()) if (scroll())
scroll(bv, 0.0F); scroll(bv, 0.0F);
bv->updateInset(this, false); bv->updateInset(this);
} }
@ -337,11 +340,13 @@ bool InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
// should not be called on inset open! // should not be called on inset open!
// inset.insetButtonRelease(bv, 0, 0, button); // inset.insetButtonRelease(bv, 0, 0, button);
inset.setUpdateStatus(bv, InsetText::FULL); inset.setUpdateStatus(bv, InsetText::FULL);
bv->updateInset(this, false); bv->updateInset(this);
bv->buffer()->markDirty();
} else { } else {
collapsed_ = true; collapsed_ = true;
bv->unlockInset(this); bv->unlockInset(this);
bv->updateInset(this, false); bv->updateInset(this);
bv->buffer()->markDirty();
} }
} else if (!collapsed_ && (cmd.y > button_bottom_y)) { } else if (!collapsed_ && (cmd.y > button_bottom_y)) {
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
@ -624,7 +629,7 @@ void InsetCollapsable::open(BufferView * bv)
if (!collapsed_) return; if (!collapsed_) return;
collapsed_ = false; collapsed_ = false;
bv->updateInset(this, false); bv->updateInset(this);
} }
@ -634,7 +639,7 @@ void InsetCollapsable::close(BufferView * bv) const
return; return;
collapsed_ = true; collapsed_ = true;
bv->updateInset(const_cast<InsetCollapsable *>(this), false); bv->updateInset(const_cast<InsetCollapsable *>(this));
} }

View File

@ -77,7 +77,7 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
break; break;
setParams(p); setParams(p);
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;

View File

@ -445,7 +445,7 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
InsetERTMailer::string2params(cmd.argument, status_); InsetERTMailer::string2params(cmd.argument, status_);
status(bv, status_); status(bv, status_);
bv->updateInset(this, true); bv->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;
@ -640,8 +640,10 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
bv->unlockInset(const_cast<InsetERT *>(this)); bv->unlockInset(const_cast<InsetERT *>(this));
break; break;
} }
if (bv) if (bv) {
bv->updateInset(const_cast<InsetERT *>(this), false); bv->updateInset(const_cast<InsetERT *>(this));
bv->buffer()->markDirty();
}
} }
} }

View File

@ -74,7 +74,7 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
break; break;
setFromParams(p); setFromParams(p);
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;

View File

@ -165,7 +165,7 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
params_.placement = params.placement; params_.placement = params.placement;
params_.wide = params.wide; params_.wide = params.wide;
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;

View File

@ -230,7 +230,7 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
string const filepath = cmd.view()->buffer()->filePath(); string const filepath = cmd.view()->buffer()->filePath();
setParams(p, filepath); setParams(p, filepath);
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;
@ -835,7 +835,7 @@ void InsetGraphics::validate(LaTeXFeatures & features) const
void InsetGraphics::statusChanged() void InsetGraphics::statusChanged()
{ {
if (!cache_->view.expired()) if (!cache_->view.expired())
cache_->view.lock()->updateInset(this, false); cache_->view.lock()->updateInset(this);
} }

View File

@ -127,7 +127,7 @@ dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
set(p); set(p);
params_.masterFilename_ = cmd.view()->buffer()->fileName(); params_.masterFilename_ = cmd.view()->buffer()->fileName();
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;
@ -624,7 +624,7 @@ void InsetInclude::PreviewImpl::restartLoading()
lyxerr << "restartLoading()" << std::endl; lyxerr << "restartLoading()" << std::endl;
removePreview(); removePreview();
if (view()) if (view())
view()->updateInset(&parent(), false); view()->updateInset(&parent());
generatePreview(); generatePreview();
} }

View File

@ -70,7 +70,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
} }
setParams(p); setParams(p);
cmd.view()->updateInset(this, !clean); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;

View File

@ -117,7 +117,7 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
params_.pos = params.pos; params_.pos = params.pos;
params_.width = params.width; params_.width = params.width;
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;

View File

@ -535,7 +535,7 @@ void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what,
need_update = what; need_update = what;
// Dirty Cast! (Lgb) // Dirty Cast! (Lgb)
if (need_update != NONE) { if (need_update != NONE) {
bv->updateInset(const_cast<InsetTabular *>(this), mark_dirty); bv->updateInset(const_cast<InsetTabular *>(this));
if (locked) if (locked)
resetPos(bv); resetPos(bv);
} }

View File

@ -586,7 +586,7 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty)
bv->fitCursor(); bv->fitCursor();
#endif #endif
if (flag) if (flag)
bv->updateInset(const_cast<InsetText *>(this), mark_dirty); bv->updateInset(const_cast<InsetText *>(this));
if (need_update == CURSOR) if (need_update == CURSOR)
need_update = NONE; need_update = NONE;

View File

@ -95,7 +95,7 @@ dispatch_result InsetWrap::localDispatch(FuncRequest const & cmd)
params_.placement = params.placement; params_.placement = params.placement;
params_.width = params.width; params_.width = params.width;
cmd.view()->updateInset(this, true); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
break; break;

View File

@ -110,8 +110,6 @@ void UpdatableInset::scroll(BufferView * bv, float s) const
if ((tmp_top_x + scx + width(bv, font)) < (workW / 2)) { if ((tmp_top_x + scx + width(bv, font)) < (workW / 2)) {
scx += (workW / 2) - (tmp_top_x + scx + width(bv, font)); scx += (workW / 2) - (tmp_top_x + scx + width(bv, font));
} }
// bv->updateInset(const_cast<UpdatableInset *>(this), false);
} }
void UpdatableInset::scroll(BufferView * bv, int offset) const void UpdatableInset::scroll(BufferView * bv, int offset) const
@ -134,7 +132,6 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
scx += offset; scx += offset;
} }
} }
// bv->updateInset(const_cast<UpdatableInset *>(this), false);
} }
@ -152,7 +149,7 @@ Inset::RESULT UpdatableInset::localDispatch(FuncRequest const & ev)
int const xx = strToInt(ev.argument); int const xx = strToInt(ev.argument);
scroll(ev.view(), xx); scroll(ev.view(), xx);
} }
ev.view()->updateInset(this, false); ev.view()->updateInset(this);
return DISPATCHED; return DISPATCHED;
} }

View File

@ -408,8 +408,7 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
else else
bv->getLyXText()->insertStringAsParagraphs(tmpstr); bv->getLyXText()->insertStringAsParagraphs(tmpstr);
if (flag) if (flag)
bv->update(bv->text, bv->update(BufferView::SELECT);
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
} }

View File

@ -92,17 +92,21 @@ int LyXReplace(BufferView * bv,
(text->inset_owner == text->inset_owner->getLockingInset()))) (text->inset_owner == text->inset_owner->getLockingInset())))
{ {
bv->hideCursor(); bv->hideCursor();
bv->update(text, BufferView::SELECT|BufferView::FITCUR); bv->update(text, BufferView::SELECT);
bv->toggleSelection(false); bv->toggleSelection(false);
text->replaceSelectionWithString(replacestr); text->replaceSelectionWithString(replacestr);
text->setSelectionRange(replacestr.length()); text->setSelectionRange(replacestr.length());
bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); bv->update(text, BufferView::SELECT);
++replace_count; ++replace_count;
} }
if (!once) if (!once)
found = LyXFind(bv, searchstr, fw, casesens, matchwrd); found = LyXFind(bv, searchstr, fw, casesens, matchwrd);
} while (!once && replaceall && found); } while (!once && replaceall && found);
// FIXME: should be called via an LFUN
bv->buffer()->markDirty();
bv->fitCursor();
return replace_count; return replace_count;
} }
@ -115,7 +119,7 @@ bool LyXFind(BufferView * bv,
return false; return false;
bv->hideCursor(); bv->hideCursor();
bv->update(bv->getLyXText(), BufferView::SELECT|BufferView::FITCUR); bv->update(bv->getLyXText(), BufferView::SELECT);
if (bv->theLockingInset()) { if (bv->theLockingInset()) {
bool found = forward ? bool found = forward ?
@ -153,16 +157,18 @@ bool LyXFind(BufferView * bv,
// inset did it already. // inset did it already.
if (result == SR_FOUND) { if (result == SR_FOUND) {
bv->unlockInset(bv->theLockingInset()); bv->unlockInset(bv->theLockingInset());
bv->update(text, BufferView::SELECT|BufferView::FITCUR); bv->update(text, BufferView::SELECT);
text->setSelectionRange(searchstr.length()); text->setSelectionRange(searchstr.length());
bv->toggleSelection(false); bv->toggleSelection(false);
bv->update(text, BufferView::SELECT|BufferView::FITCUR); bv->update(text, BufferView::SELECT);
} else if (result == SR_NOT_FOUND) { } else if (result == SR_NOT_FOUND) {
bv->unlockInset(bv->theLockingInset()); bv->unlockInset(bv->theLockingInset());
bv->update(text, BufferView::SELECT|BufferView::FITCUR); bv->update(text, BufferView::SELECT);
found = false; found = false;
} }
bv->fitCursor();
return found; return found;
} }
@ -383,7 +389,7 @@ bool findNextChange(BufferView * bv)
return false; return false;
bv->hideCursor(); bv->hideCursor();
bv->update(bv->getLyXText(), BufferView::SELECT | BufferView::FITCUR); bv->update(bv->getLyXText(), BufferView::SELECT);
pos_type length; pos_type length;
@ -421,16 +427,18 @@ bool findNextChange(BufferView * bv)
// inset did it already. // inset did it already.
if (result == SR_FOUND) { if (result == SR_FOUND) {
bv->unlockInset(bv->theLockingInset()); bv->unlockInset(bv->theLockingInset());
bv->update(text, BufferView::SELECT|BufferView::FITCUR); bv->update(text, BufferView::SELECT);
text->setSelectionRange(length); text->setSelectionRange(length);
bv->toggleSelection(false); bv->toggleSelection(false);
bv->update(text, BufferView::SELECT|BufferView::FITCUR); bv->update(text, BufferView::SELECT);
} else if (result == SR_NOT_FOUND) { } else if (result == SR_NOT_FOUND) {
bv->unlockInset(bv->theLockingInset()); bv->unlockInset(bv->theLockingInset());
bv->update(text, BufferView::SELECT|BufferView::FITCUR); bv->update(text, BufferView::SELECT);
found = false; found = false;
} }
bv->fitCursor();
return found; return found;
} }

View File

@ -125,7 +125,7 @@ void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
if (!TEXT(flag)->isInInset()) if (!TEXT(flag)->isInInset())
view()->toggleToggle(); view()->toggleToggle();
} }
view()->update(TEXT(flag), BufferView::SELECT|BufferView::FITCUR); view()->update(TEXT(flag), BufferView::SELECT);
view()->showCursor(); view()->showCursor();
view()->switchKeyMap(); view()->switchKeyMap();
@ -146,8 +146,7 @@ void LyXFunc::handleKeyFunc(kb_action action)
// actions // actions
keyseq.clear(); keyseq.clear();
// copied verbatim from do_accent_char // copied verbatim from do_accent_char
view()->update(TEXT(false), view()->update(TEXT(false), BufferView::SELECT);
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
TEXT(false)->selection.cursor = TEXT(false)->cursor; TEXT(false)->selection.cursor = TEXT(false)->cursor;
} }
@ -835,7 +834,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
moveCursorUpdate(true, false); moveCursorUpdate(true, false);
owner->view_state_changed(); owner->view_state_changed();
} else { } else {
view()->update(TEXT(), BufferView::SELECT|BufferView::FITCUR); view()->update(TEXT(), BufferView::SELECT);
} }
goto exit_with_message; goto exit_with_message;
} else if (result == FINISHED_DOWN) { } else if (result == FINISHED_DOWN) {
@ -948,8 +947,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
case LFUN_PREFIX: case LFUN_PREFIX:
{ {
if (view()->available() && !view()->theLockingInset()) { if (view()->available() && !view()->theLockingInset()) {
view()->update(TEXT(), view()->update(TEXT(), BufferView::SELECT);
BufferView::SELECT|BufferView::FITCUR);
} }
owner->message(keyseq.printOptions()); owner->message(keyseq.printOptions());
} }
@ -1580,6 +1578,12 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
} // end of switch } // end of switch
view()->owner()->updateLayoutChoice(); view()->owner()->updateLayoutChoice();
view()->fitCursor();
// If we executed a mutating lfun, mark the buffer as dirty
if (!lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)
&& !lyxaction.funcHasFlag(ev.action, LyXAction::ReadOnly))
view()->buffer()->markDirty();
exit_with_message: exit_with_message:
sendDispatchMessage(getMessage(), ev, verbose); sendDispatchMessage(getMessage(), ev, verbose);

View File

@ -581,7 +581,7 @@ public:
* with a dynamic left margin will be rebroken. */ * with a dynamic left margin will be rebroken. */
void updateCounters(); void updateCounters();
/// ///
void update(bool changed = true); void update();
/** /**
* Returns an inset if inset was hit, or 0 if not. * Returns an inset if inset was hit, or 0 if not.
* If hit, the coordinates are changed relative to the inset. * If hit, the coordinates are changed relative to the inset.

View File

@ -1,3 +1,12 @@
2003-03-19 John Levon <levon@movementarian.org>
* formulabase.h:
* formulabase.C:
* math_gridinset.C:
* math_hullinset.C:
* ref_inset.C: updateInset() doesn't take a bool
anymore
2003-03-17 John Levon <levon@movementarian.org> 2003-03-17 John Levon <levon@movementarian.org>
* formula.h: * formula.h:

View File

@ -127,15 +127,15 @@ void InsetFormulaBase::handleFont
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
if (mathcursor->par()->name() == font) { if (mathcursor->par()->name() == font) {
mathcursor->handleFont(font); mathcursor->handleFont(font);
updateLocal(bv, true); bv->updateInset(this);
} else { } else {
bool sel = mathcursor->selection(); bool sel = mathcursor->selection();
if (sel) if (sel)
updateLocal(bv, true); bv->updateInset(this);
mathcursor->handleNest(createMathInset(font)); mathcursor->handleNest(createMathInset(font));
mathcursor->insert(arg); mathcursor->insert(arg);
if (!sel) if (!sel)
updateLocal(bv, false); bv->updateInset(this);
} }
} }
@ -185,7 +185,7 @@ void InsetFormulaBase::edit(BufferView * bv, int x, int y, mouse_button::state)
mathcursor->setPos(x + xo_, y + yo_); mathcursor->setPos(x + xo_, y + yo_);
// if that is removed, we won't get the magenta box when entering an // if that is removed, we won't get the magenta box when entering an
// inset for the first time // inset for the first time
bv->updateInset(this, false); bv->updateInset(this);
} }
@ -196,7 +196,7 @@ void InsetFormulaBase::edit(BufferView * bv, bool front)
releaseMathCursor(bv); releaseMathCursor(bv);
mathcursor = new MathCursor(this, front); mathcursor = new MathCursor(this, front);
metrics(bv); metrics(bv);
bv->updateInset(this, false); bv->updateInset(this);
} }
@ -205,12 +205,12 @@ void InsetFormulaBase::insetUnlock(BufferView * bv)
if (mathcursor) { if (mathcursor) {
if (mathcursor->inMacroMode()) { if (mathcursor->inMacroMode()) {
mathcursor->macroModeClose(); mathcursor->macroModeClose();
updateLocal(bv, true); bv->updateInset(this);
} }
releaseMathCursor(bv); releaseMathCursor(bv);
} }
generatePreview(); generatePreview();
bv->updateInset(this, false); bv->updateInset(this);
} }
@ -291,7 +291,7 @@ void InsetFormulaBase::fitInsetCursor(BufferView * bv) const
void InsetFormulaBase::toggleInsetSelection(BufferView * bv) void InsetFormulaBase::toggleInsetSelection(BufferView * bv)
{ {
if (mathcursor) if (mathcursor)
bv->updateInset(this, false); bv->updateInset(this);
} }
@ -301,12 +301,6 @@ vector<string> const InsetFormulaBase::getLabelList() const
} }
void InsetFormulaBase::updateLocal(BufferView * bv, bool dirty)
{
bv->updateInset(this, dirty);
}
dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
{ {
if (!mathcursor) if (!mathcursor)
@ -315,7 +309,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
BufferView * bv = cmd.view(); BufferView * bv = cmd.view();
hideInsetCursor(bv); hideInsetCursor(bv);
showInsetCursor(bv); showInsetCursor(bv);
bv->updateInset(this, false); bv->updateInset(this);
//lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl; //lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button3) { if (cmd.button() == mouse_button::button3) {
@ -332,7 +326,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
mathcursor->selClear(); mathcursor->selClear();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_); mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->insert(asArray(bv->getClipboard())); mathcursor->insert(asArray(bv->getClipboard()));
bv->updateInset(this, true); bv->updateInset(this);
return DISPATCHED; return DISPATCHED;
} }
@ -379,7 +373,7 @@ dispatch_result InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
return DISPATCHED; return DISPATCHED;
} }
bv->updateInset(this, false); bv->updateInset(this);
return DISPATCHED; return DISPATCHED;
} }
@ -409,7 +403,7 @@ dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
hideInsetCursor(bv); hideInsetCursor(bv);
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_); mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
showInsetCursor(bv); showInsetCursor(bv);
bv->updateInset(this, false); bv->updateInset(this);
return DISPATCHED; return DISPATCHED;
} }
@ -472,7 +466,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_MATH_LIMITS: case LFUN_MATH_LIMITS:
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->dispatch(cmd); mathcursor->dispatch(cmd);
updateLocal(bv, true); bv->updateInset(this);
break; break;
case LFUN_RIGHTSEL: case LFUN_RIGHTSEL:
@ -481,7 +475,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
result = mathcursor->right(sel) ? DISPATCHED : FINISHED_RIGHT; result = mathcursor->right(sel) ? DISPATCHED : FINISHED_RIGHT;
//lyxerr << "calling scroll 20\n"; //lyxerr << "calling scroll 20\n";
//scroll(bv, 20); //scroll(bv, 20);
updateLocal(bv, false); bv->updateInset(this);
// write something to the minibuffer // write something to the minibuffer
//bv->owner()->message(mathcursor->info()); //bv->owner()->message(mathcursor->info());
break; break;
@ -490,27 +484,27 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
sel = true; // fall through sel = true; // fall through
case LFUN_LEFT: case LFUN_LEFT:
result = mathcursor->left(sel) ? DISPATCHED : FINISHED; result = mathcursor->left(sel) ? DISPATCHED : FINISHED;
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_UPSEL: case LFUN_UPSEL:
sel = true; // fall through sel = true; // fall through
case LFUN_UP: case LFUN_UP:
result = mathcursor->up(sel) ? DISPATCHED : FINISHED_UP; result = mathcursor->up(sel) ? DISPATCHED : FINISHED_UP;
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_DOWNSEL: case LFUN_DOWNSEL:
sel = true; // fall through sel = true; // fall through
case LFUN_DOWN: case LFUN_DOWN:
result = mathcursor->down(sel) ? DISPATCHED : FINISHED_DOWN; result = mathcursor->down(sel) ? DISPATCHED : FINISHED_DOWN;
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_WORDSEL: case LFUN_WORDSEL:
mathcursor->home(false); mathcursor->home(false);
mathcursor->end(true); mathcursor->end(true);
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_UP_PARAGRAPHSEL: case LFUN_UP_PARAGRAPHSEL:
@ -518,7 +512,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_DOWN_PARAGRAPHSEL: case LFUN_DOWN_PARAGRAPHSEL:
case LFUN_DOWN_PARAGRAPH: case LFUN_DOWN_PARAGRAPH:
result = FINISHED; result = FINISHED;
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_HOMESEL: case LFUN_HOMESEL:
@ -527,7 +521,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_HOME: case LFUN_HOME:
case LFUN_WORDLEFT: case LFUN_WORDLEFT:
result = mathcursor->home(sel) ? DISPATCHED : FINISHED; result = mathcursor->home(sel) ? DISPATCHED : FINISHED;
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_ENDSEL: case LFUN_ENDSEL:
@ -536,7 +530,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_END: case LFUN_END:
case LFUN_WORDRIGHT: case LFUN_WORDRIGHT:
result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT; result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT;
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_PRIORSEL: case LFUN_PRIORSEL:
@ -544,7 +538,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_BEGINNINGBUFSEL: case LFUN_BEGINNINGBUFSEL:
case LFUN_BEGINNINGBUF: case LFUN_BEGINNINGBUF:
result = FINISHED; result = FINISHED;
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_NEXTSEL: case LFUN_NEXTSEL:
@ -552,17 +546,17 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_ENDBUFSEL: case LFUN_ENDBUFSEL:
case LFUN_ENDBUF: case LFUN_ENDBUF:
result = FINISHED_RIGHT; result = FINISHED_RIGHT;
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_TAB: case LFUN_TAB:
mathcursor->idxNext(); mathcursor->idxNext();
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_SHIFT_TAB: case LFUN_SHIFT_TAB:
mathcursor->idxPrev(); mathcursor->idxPrev();
updateLocal(bv, false); bv->updateInset(this);
break; break;
case LFUN_DELETE_WORD_BACKWARD: case LFUN_DELETE_WORD_BACKWARD:
@ -574,7 +568,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
result = FINISHED; result = FINISHED;
remove_inset = true; remove_inset = true;
} }
updateLocal(bv, true); bv->updateInset(this);
break; break;
case LFUN_DELETE_WORD_FORWARD: case LFUN_DELETE_WORD_FORWARD:
@ -586,7 +580,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
result = FINISHED; result = FINISHED;
remove_inset = true; remove_inset = true;
} }
updateLocal(bv, true); bv->updateInset(this);
break; break;
// case LFUN_GETXY: // case LFUN_GETXY:
@ -600,7 +594,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
istringstream is(cmd.argument.c_str()); istringstream is(cmd.argument.c_str());
is >> x >> y; is >> x >> y;
mathcursor->setPos(x, y); mathcursor->setPos(x, y);
updateLocal(bv, false); bv->updateInset(this);
break; break;
} }
@ -609,13 +603,13 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
mathcursor->macroModeClose(); mathcursor->macroModeClose();
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->selPaste(); mathcursor->selPaste();
updateLocal(bv, true); bv->updateInset(this);
break; break;
case LFUN_CUT: case LFUN_CUT:
bv->lockedInsetStoreUndo(Undo::DELETE); bv->lockedInsetStoreUndo(Undo::DELETE);
mathcursor->selCut(); mathcursor->selCut();
updateLocal(bv, true); bv->updateInset(this);
break; break;
case LFUN_COPY: case LFUN_COPY:
@ -631,7 +625,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
// deadkeys // deadkeys
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->script(true); mathcursor->script(true);
updateLocal(bv, true); bv->updateInset(this);
} }
break; break;
@ -673,7 +667,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_MATH_MODE: case LFUN_MATH_MODE:
if (mathcursor->currentMode() == MathInset::TEXT_MODE) { if (mathcursor->currentMode() == MathInset::TEXT_MODE) {
mathcursor->niceInsert(MathAtom(new MathHullInset("simple"))); mathcursor->niceInsert(MathAtom(new MathHullInset("simple")));
updateLocal(bv, true); bv->updateInset(this);
} else { } else {
handleFont(bv, cmd.argument, "textrm"); handleFont(bv, cmd.argument, "textrm");
} }
@ -685,7 +679,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
if (!arg.empty()) { if (!arg.empty()) {
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->setSize(arg); mathcursor->setSize(arg);
updateLocal(bv, true); bv->updateInset(this);
} }
#endif #endif
break; break;
@ -703,7 +697,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
v_align += 'c'; v_align += 'c';
mathcursor->niceInsert( mathcursor->niceInsert(
MathAtom(new MathArrayInset("array", m, n, v_align[0], h_align))); MathAtom(new MathArrayInset("array", m, n, v_align[0], h_align)));
updateLocal(bv, true); bv->updateInset(this);
break; break;
} }
@ -712,7 +706,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
{ {
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->script(cmd.action == LFUN_SUPERSCRIPT); mathcursor->script(cmd.action == LFUN_SUPERSCRIPT);
updateLocal(bv, true); bv->updateInset(this);
break; break;
} }
@ -729,7 +723,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->handleNest(MathAtom(new MathDelimInset(ls, rs))); mathcursor->handleNest(MathAtom(new MathDelimInset(ls, rs)));
updateLocal(bv, true); bv->updateInset(this);
break; break;
} }
@ -737,7 +731,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_MATH_SPACE: case LFUN_MATH_SPACE:
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->insert(MathAtom(new MathSpaceInset(","))); mathcursor->insert(MathAtom(new MathSpaceInset(",")));
updateLocal(bv, true); bv->updateInset(this);
break; break;
case LFUN_UNDO: case LFUN_UNDO:
@ -753,7 +747,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
// interpret this as if a backslash was typed // interpret this as if a backslash was typed
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->interpret('\\'); mathcursor->interpret('\\');
updateLocal(bv, true); bv->updateInset(this);
break; break;
case LFUN_BREAKPARAGRAPH: case LFUN_BREAKPARAGRAPH:
@ -768,7 +762,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_INSERT_MATH: case LFUN_INSERT_MATH:
bv->lockedInsetStoreUndo(Undo::EDIT); bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->niceInsert(argument); mathcursor->niceInsert(argument);
updateLocal(bv, true); bv->updateInset(this);
break; break;
case -1: case -1:
@ -779,7 +773,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
result = mathcursor->interpret(argument[0]) ? DISPATCHED : FINISHED_RIGHT; result = mathcursor->interpret(argument[0]) ? DISPATCHED : FINISHED_RIGHT;
else else
mathcursor->insert(asArray(argument)); mathcursor->insert(asArray(argument));
updateLocal(bv, true); bv->updateInset(this);
} }
break; break;
@ -796,7 +790,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
case LFUN_INSET_TOGGLE: case LFUN_INSET_TOGGLE:
mathcursor->insetToggle(); mathcursor->insetToggle();
updateLocal(bv, true); bv->updateInset(this);
break; break;
case LFUN_DIALOG_SHOW_NEW_INSET: { case LFUN_DIALOG_SHOW_NEW_INSET: {
@ -833,7 +827,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
} }
} }
if (result == DISPATCHED) if (result == DISPATCHED)
updateLocal(bv, true); bv->updateInset(this);
} }
break; break;
@ -970,7 +964,7 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str,
mathcursor->setSelection(it, ar.size()); mathcursor->setSelection(it, ar.size());
current = it; current = it;
it.jump(ar.size()); it.jump(ar.size());
updateLocal(bv, false); bv->updateInset(this);
return true; return true;
} }
} }

View File

@ -89,8 +89,6 @@ public:
/// ///
virtual MathAtom & par() = 0; virtual MathAtom & par() = 0;
/// ///
virtual void updateLocal(BufferView * bv, bool mark_dirty);
///
// And shouldn't this really return a shared_ptr<BufferView> instead? // And shouldn't this really return a shared_ptr<BufferView> instead?
BufferView * view() const; BufferView * view() const;

View File

@ -1041,7 +1041,6 @@ dispatch_result MathGridInset::dispatch
case LFUN_TABINSERT: case LFUN_TABINSERT:
//bv->lockedInsetStoreUndo(Undo::EDIT); //bv->lockedInsetStoreUndo(Undo::EDIT);
splitCell(idx, pos); splitCell(idx, pos);
//updateLocal(bv, true);
return DISPATCHED_POP; return DISPATCHED_POP;
case LFUN_BREAKLINE: { case LFUN_BREAKLINE: {
@ -1061,7 +1060,6 @@ dispatch_result MathGridInset::dispatch
pos = cell(idx).size(); pos = cell(idx).size();
//mathcursor->normalize(); //mathcursor->normalize();
//updateLocal(bv, true);
return DISPATCHED_POP; return DISPATCHED_POP;
} }

View File

@ -768,7 +768,6 @@ dispatch_result MathHullInset::dispatch
for (row_type row = 0; row < nrows(); ++row) for (row_type row = 0; row < nrows(); ++row)
numbered(row, !old); numbered(row, !old);
//bv->owner()->message(old ? _("No number") : _("Number")); //bv->owner()->message(old ? _("No number") : _("Number"));
//updateLocal(bv, true);
} }
return DISPATCHED; return DISPATCHED;
@ -779,7 +778,6 @@ dispatch_result MathHullInset::dispatch
bool old = numbered(r); bool old = numbered(r);
//bv->owner()->message(old ? _("No number") : _("Number")); //bv->owner()->message(old ? _("No number") : _("Number"));
numbered(r, !old); numbered(r, !old);
//updateLocal(bv, true);
} }
return DISPATCHED; return DISPATCHED;

View File

@ -137,7 +137,7 @@ dispatch_result RefInset::localDispatch(FuncRequest const & cmd)
// if (cmd.view()) // if (cmd.view())
// // This does not compile because updateInset expects // // This does not compile because updateInset expects
// // an Inset* and 'this' isn't. // // an Inset* and 'this' isn't.
// cmd.view()->updateInset(this, true); // cmd.view()->updateInset(this);
return DISPATCHED; return DISPATCHED;
} }

View File

@ -82,6 +82,8 @@ int LyXText::top_y() const
row && row != anchor_row_; row = row->next()) { row && row != anchor_row_; row = row->next()) {
y += row->height(); y += row->height();
} }
lyxerr << "Returning y as " << y << endl;
lyxerr << "But row->y is " << anchor_row_->y() << endl;
return y + anchor_row_offset_; return y + anchor_row_offset_;
} }

View File

@ -1129,7 +1129,7 @@ void LyXText::setParagraph(bool line_top, bool line_bottom,
setSelection(); setSelection();
setCursor(tmpcursor.par(), tmpcursor.pos()); setCursor(tmpcursor.par(), tmpcursor.pos());
if (inset_owner) if (inset_owner)
bv()->updateInset(inset_owner, true); bv()->updateInset(inset_owner);
} }

View File

@ -60,19 +60,16 @@ namespace {
if (selecting || lt->selection.mark()) { if (selecting || lt->selection.mark()) {
lt->setSelection(); lt->setSelection();
if (lt->isInInset()) if (lt->isInInset())
bv->updateInset(lt->inset_owner, false); bv->updateInset(lt->inset_owner);
else else
bv->toggleToggle(); bv->toggleToggle();
} }
if (!lt->isInInset()) { if (!lt->isInInset()) {
//if (fitcur) bv->update(lt, BufferView::SELECT);
// bv->update(lt, BufferView::SELECT|BufferView::FITCUR);
//else
bv->update(lt, BufferView::SELECT|BufferView::FITCUR);
bv->showCursor(); bv->showCursor();
} else if (bv->text->status() != LyXText::UNCHANGED) { } else if (bv->text->status() != LyXText::UNCHANGED) {
bv->theLockingInset()->hideInsetCursor(bv); bv->theLockingInset()->hideInsetCursor(bv);
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); bv->update(BufferView::SELECT);
bv->showCursor(); bv->showCursor();
} }
@ -205,7 +202,7 @@ void LyXText::gotoInset(vector<Inset::Code> const & codes,
{ {
bv()->hideCursor(); bv()->hideCursor();
bv()->beforeChange(this); bv()->beforeChange(this);
update(false); update();
string contents; string contents;
if (same_content && cursor.par()->isInset(cursor.pos())) { if (same_content && cursor.par()->isInset(cursor.pos())) {
@ -228,7 +225,7 @@ void LyXText::gotoInset(vector<Inset::Code> const & codes,
bv()->owner()->message(_("No more insets")); bv()->owner()->message(_("No more insets"));
} }
} }
update(false); update();
selection.cursor = cursor; selection.cursor = cursor;
} }
@ -241,8 +238,10 @@ void LyXText::gotoInset(Inset::Code code, bool same_content)
void LyXText::cursorPrevious() void LyXText::cursorPrevious()
{ {
int y = top_y();
if (!cursor.row()->previous()) { if (!cursor.row()->previous()) {
if (top_y() > 0) { if (y > 0) {
int new_y = bv()->text->top_y() - bv()->workHeight(); int new_y = bv()->text->top_y() - bv()->workHeight();
bv()->screen().draw(bv()->text, bv(), new_y < 0 ? 0 : new_y); bv()->screen().draw(bv()->text, bv(), new_y < 0 ? 0 : new_y);
bv()->updateScrollbar(); bv()->updateScrollbar();
@ -250,7 +249,6 @@ void LyXText::cursorPrevious()
return; return;
} }
int y = top_y();
Row * cursorrow = cursor.row(); Row * cursorrow = cursor.row();
setCursorFromCoordinates(cursor.x_fix(), y); setCursorFromCoordinates(cursor.x_fix(), y);
@ -295,18 +293,20 @@ void LyXText::cursorPrevious()
void LyXText::cursorNext() void LyXText::cursorNext()
{ {
int top_y = top_y();
if (!cursor.row()->next()) { if (!cursor.row()->next()) {
int y = cursor.y() - cursor.row()->baseline() + int y = cursor.y() - cursor.row()->baseline() +
cursor.row()->height(); cursor.row()->height();
if (y > top_y() + bv()->workHeight()) { if (y > top_y + bv()->workHeight()) {
bv()->screen().draw(bv()->text, bv(), bv()->text->top_y() + bv()->workHeight()); bv()->screen().draw(bv()->text, bv(), bv()->text->top_y() + bv()->workHeight());
bv()->updateScrollbar(); bv()->updateScrollbar();
} }
return; return;
} }
int y = top_y() + bv()->workHeight(); int y = top_y + bv()->workHeight();
if (inset_owner && !top_y()) { if (inset_owner && !top_y) {
y -= (bv()->text->cursor.iy() y -= (bv()->text->cursor.iy()
- bv()->text->top_y() - bv()->text->top_y()
+ bv()->theLockingInset()->insetInInsetY()); + bv()->theLockingInset()->insetInInsetY());
@ -352,13 +352,9 @@ void LyXText::cursorNext()
} }
void LyXText::update(bool changed) void LyXText::update()
{ {
BufferView::UpdateCodes c = BufferView::SELECT | BufferView::FITCUR; bv()->update(this, BufferView::SELECT);
if (changed)
bv()->update(this, c | BufferView::CHANGE);
else
bv()->update(this, c);
} }
namespace { namespace {
@ -366,12 +362,12 @@ namespace {
void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind) void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
{ {
bv->hideCursor(); bv->hideCursor();
lt->update(bv); lt->update();
InsetSpecialChar * new_inset = new InsetSpecialChar(kind); InsetSpecialChar * new_inset = new InsetSpecialChar(kind);
if (!bv->insertInset(new_inset)) if (!bv->insertInset(new_inset))
delete new_inset; delete new_inset;
else else
bv->updateInset(new_inset, true); bv->updateInset(new_inset);
} }
@ -433,29 +429,29 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
redoHeightOfParagraph(); redoHeightOfParagraph();
postPaint(0); postPaint(0);
setCursor(cursor.par(), cursor.pos()); setCursor(cursor.par(), cursor.pos());
update(bv); update();
break; break;
} }
case LFUN_DELETE_WORD_FORWARD: case LFUN_DELETE_WORD_FORWARD:
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
deleteWordForward(); deleteWordForward();
update(bv); update();
finishChange(bv); finishChange(bv);
break; break;
case LFUN_DELETE_WORD_BACKWARD: case LFUN_DELETE_WORD_BACKWARD:
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
deleteWordBackward(); deleteWordBackward();
update(true); update();
finishChange(bv); finishChange(bv);
break; break;
case LFUN_DELETE_LINE_FORWARD: case LFUN_DELETE_LINE_FORWARD:
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
deleteLineForward(); deleteLineForward();
update(); update();
finishChange(bv); finishChange(bv);
@ -465,7 +461,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_TAB: case LFUN_TAB:
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
cursorTab(); cursorTab();
finishChange(bv); finishChange(bv);
break; break;
@ -473,7 +469,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_WORDRIGHT: case LFUN_WORDRIGHT:
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorLeftOneWord(); cursorLeftOneWord();
else else
@ -484,7 +480,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_WORDLEFT: case LFUN_WORDLEFT:
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorRightOneWord(); cursorRightOneWord();
else else
@ -495,7 +491,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_BEGINNINGBUF: case LFUN_BEGINNINGBUF:
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
cursorTop(); cursorTop();
finishChange(bv); finishChange(bv);
break; break;
@ -503,13 +499,13 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_ENDBUF: case LFUN_ENDBUF:
if (selection.mark()) if (selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
cursorBottom(); cursorBottom();
finishChange(bv); finishChange(bv);
break; break;
case LFUN_RIGHTSEL: case LFUN_RIGHTSEL:
update(false); update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorLeft(bv); cursorLeft(bv);
else else
@ -518,7 +514,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
break; break;
case LFUN_LEFTSEL: case LFUN_LEFTSEL:
update(false); update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorRight(bv); cursorRight(bv);
else else
@ -527,55 +523,55 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
break; break;
case LFUN_UPSEL: case LFUN_UPSEL:
update(false); update();
cursorUp(true); cursorUp(true);
finishChange(bv, true); finishChange(bv, true);
break; break;
case LFUN_DOWNSEL: case LFUN_DOWNSEL:
update(false); update();
cursorDown(true); cursorDown(true);
finishChange(bv, true); finishChange(bv, true);
break; break;
case LFUN_UP_PARAGRAPHSEL: case LFUN_UP_PARAGRAPHSEL:
update(false); update();
cursorUpParagraph(); cursorUpParagraph();
finishChange(bv, true); finishChange(bv, true);
break; break;
case LFUN_DOWN_PARAGRAPHSEL: case LFUN_DOWN_PARAGRAPHSEL:
update(false); update();
cursorDownParagraph(); cursorDownParagraph();
finishChange(bv, true); finishChange(bv, true);
break; break;
case LFUN_PRIORSEL: case LFUN_PRIORSEL:
update(false); update();
cursorPrevious(); cursorPrevious();
finishChange(bv, true); finishChange(bv, true);
break; break;
case LFUN_NEXTSEL: case LFUN_NEXTSEL:
update(false); update();
cursorNext(); cursorNext();
finishChange(bv, true); finishChange(bv, true);
break; break;
case LFUN_HOMESEL: case LFUN_HOMESEL:
update(false); update();
cursorHome(); cursorHome();
finishChange(bv, true); finishChange(bv, true);
break; break;
case LFUN_ENDSEL: case LFUN_ENDSEL:
update(false); update();
cursorEnd(); cursorEnd();
finishChange(bv, true); finishChange(bv, true);
break; break;
case LFUN_WORDRIGHTSEL: case LFUN_WORDRIGHTSEL:
update(false); update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorLeftOneWord(); cursorLeftOneWord();
else else
@ -584,7 +580,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
break; break;
case LFUN_WORDLEFTSEL: case LFUN_WORDLEFTSEL:
update(false); update();
if (cursor.par()->isRightToLeftPar(bv->buffer()->params)) if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
cursorRightOneWord(); cursorRightOneWord();
else else
@ -593,7 +589,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
break; break;
case LFUN_WORDSEL: { case LFUN_WORDSEL: {
update(false); update();
LyXCursor cur1; LyXCursor cur1;
LyXCursor cur2; LyXCursor cur2;
getWord(cur1, cur2, WHOLE_WORD); getWord(cur1, cur2, WHOLE_WORD);
@ -608,7 +604,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params); bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
if (is_rtl) if (is_rtl)
cursorLeft(false); cursorLeft(false);
if (cursor.pos() < cursor.par()->size() if (cursor.pos() < cursor.par()->size()
@ -631,7 +627,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
bool const is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params); bool const is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
LyXCursor const cur = cursor; LyXCursor const cur = cursor;
if (!is_rtl) if (!is_rtl)
cursorLeft(false); cursorLeft(false);
@ -705,7 +701,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_HOME: case LFUN_HOME:
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(bv); update();
cursorHome(); cursorHome();
finishChange(bv, false); finishChange(bv, false);
break; break;
@ -713,7 +709,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_END: case LFUN_END:
if (!selection.mark()) if (!selection.mark())
bv->beforeChange(this); bv->beforeChange(this);
update(bv); update();
cursorEnd(); cursorEnd();
finishChange(bv, false); finishChange(bv, false);
break; break;
@ -727,7 +723,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
bv->beforeChange(this); bv->beforeChange(this);
insertInset(new InsetNewline); insertInset(new InsetNewline);
update(true); update();
setCursor(cursor.par(), cursor.pos()); setCursor(cursor.par(), cursor.pos());
moveCursorUpdate(bv, false); moveCursorUpdate(bv, false);
break; break;
@ -737,14 +733,14 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (!selection.set()) { if (!selection.set()) {
Delete(); Delete();
selection.cursor = cursor; selection.cursor = cursor;
update(bv); update();
// It is possible to make it a lot faster still // It is possible to make it a lot faster still
// just comment out the line below... // just comment out the line below...
bv->showCursor(); bv->showCursor();
} else { } else {
update(false); update();
cutSelection(bv, true); cutSelection(bv, true);
update(bv); update();
} }
moveCursorUpdate(bv, false); moveCursorUpdate(bv, false);
bv->owner()->view_state_changed(); bv->owner()->view_state_changed();
@ -772,7 +768,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
cur.par()->params().align(), cur.par()->params().align(),
cur.par()->params().labelWidthString(), 0); cur.par()->params().labelWidthString(), 0);
cursorLeft(bv); cursorLeft(bv);
update(bv); update();
} else { } else {
cursorLeft(bv); cursorLeft(bv);
Delete(); Delete();
@ -783,10 +779,10 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
selection.cursor = cursor; selection.cursor = cursor;
} }
} else { } else {
update(false); update();
cutSelection(bv, true); cutSelection(bv, true);
} }
update(bv); update();
break; break;
@ -795,15 +791,15 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (bv->owner()->getIntl().getTransManager().backspace()) { if (bv->owner()->getIntl().getTransManager().backspace()) {
backspace(); backspace();
selection.cursor = cursor; selection.cursor = cursor;
update(bv); update();
// It is possible to make it a lot faster still // It is possible to make it a lot faster still
// just comment out the line below... // just comment out the line below...
bv->showCursor(); bv->showCursor();
} }
} else { } else {
update(false); update();
cutSelection(bv, true); cutSelection(bv, true);
update(bv); update();
} }
bv->owner()->view_state_changed(); bv->owner()->view_state_changed();
bv->switchKeyMap(); bv->switchKeyMap();
@ -830,16 +826,16 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
selection.cursor = cur; selection.cursor = cur;
} }
} else { } else {
update(false); update();
cutSelection(bv, true); cutSelection(bv, true);
} }
update(bv); update();
break; break;
case LFUN_BREAKPARAGRAPH: case LFUN_BREAKPARAGRAPH:
bv->beforeChange(this); bv->beforeChange(this);
breakParagraph(bv->buffer()->paragraphs, 0); breakParagraph(bv->buffer()->paragraphs, 0);
update(bv); update();
selection.cursor = cursor; selection.cursor = cursor;
bv->switchKeyMap(); bv->switchKeyMap();
bv->owner()->view_state_changed(); bv->owner()->view_state_changed();
@ -848,7 +844,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_BREAKPARAGRAPHKEEPLAYOUT: case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
bv->beforeChange(this); bv->beforeChange(this);
breakParagraph(bv->buffer()->paragraphs, 1); breakParagraph(bv->buffer()->paragraphs, 1);
update(bv); update();
selection.cursor = cursor; selection.cursor = cursor;
bv->switchKeyMap(); bv->switchKeyMap();
bv->owner()->view_state_changed(); bv->owner()->view_state_changed();
@ -871,14 +867,12 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
cur.par()->params().spacing(), cur.par()->params().spacing(),
cur.par()->params().align(), cur.par()->params().align(),
cur.par()->params().labelWidthString(), 1); cur.par()->params().labelWidthString(), 1);
//update(bv);
} }
} }
else { else {
breakParagraph(bv->buffer()->paragraphs, 0); breakParagraph(bv->buffer()->paragraphs, 0);
//update(bv);
} }
update(bv); update();
selection.cursor = cur; selection.cursor = cur;
bv->switchKeyMap(); bv->switchKeyMap();
bv->owner()->view_state_changed(); bv->owner()->view_state_changed();
@ -922,7 +916,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (cur_spacing != new_spacing || cur_value != new_value) { if (cur_spacing != new_spacing || cur_value != new_value) {
par->params().spacing(Spacing(new_spacing, new_value)); par->params().spacing(Spacing(new_spacing, new_value));
redoParagraph(); redoParagraph();
update(bv); update();
} }
break; break;
} }
@ -930,16 +924,16 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_INSET_TOGGLE: case LFUN_INSET_TOGGLE:
bv->hideCursor(); bv->hideCursor();
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
toggleInset(); toggleInset();
update(false); update();
bv->switchKeyMap(); bv->switchKeyMap();
break; break;
case LFUN_PROTECTEDSPACE: case LFUN_PROTECTEDSPACE:
if (cursor.par()->layout()->free_spacing) { if (cursor.par()->layout()->free_spacing) {
insertChar(' '); insertChar(' ');
update(bv); update();
} else { } else {
specialChar(this, bv, InsetSpecialChar::PROTECTED_SEPARATOR); specialChar(this, bv, InsetSpecialChar::PROTECTED_SEPARATOR);
} }
@ -968,7 +962,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_MARK_OFF: case LFUN_MARK_OFF:
bv->beforeChange(this); bv->beforeChange(this);
update(false); update();
selection.cursor = cursor; selection.cursor = cursor;
cmd.message(N_("Mark off")); cmd.message(N_("Mark off"));
break; break;
@ -976,7 +970,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_MARK_ON: case LFUN_MARK_ON:
bv->beforeChange(this); bv->beforeChange(this);
selection.mark(true); selection.mark(true);
update(false); update();
selection.cursor = cursor; selection.cursor = cursor;
cmd.message(N_("Mark on")); cmd.message(N_("Mark on"));
break; break;
@ -984,46 +978,46 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_SETMARK: case LFUN_SETMARK:
bv->beforeChange(this); bv->beforeChange(this);
if (selection.mark()) { if (selection.mark()) {
update(bv); update();
cmd.message(N_("Mark removed")); cmd.message(N_("Mark removed"));
} else { } else {
selection.mark(true); selection.mark(true);
update(bv); update();
cmd.message(N_("Mark set")); cmd.message(N_("Mark set"));
} }
selection.cursor = cursor; selection.cursor = cursor;
break; break;
case LFUN_UPCASE_WORD: case LFUN_UPCASE_WORD:
update(false); update();
changeCase(LyXText::text_uppercase); changeCase(LyXText::text_uppercase);
if (inset_owner) if (inset_owner)
bv->updateInset(inset_owner, true); bv->updateInset(inset_owner);
update(bv); update();
break; break;
case LFUN_LOWCASE_WORD: case LFUN_LOWCASE_WORD:
update(false); update();
changeCase(LyXText::text_lowercase); changeCase(LyXText::text_lowercase);
if (inset_owner) if (inset_owner)
bv->updateInset(inset_owner, true); bv->updateInset(inset_owner);
update(); update();
break; break;
case LFUN_CAPITALIZE_WORD: case LFUN_CAPITALIZE_WORD:
update(false); update();
changeCase(LyXText::text_capitalization); changeCase(LyXText::text_capitalization);
if (inset_owner) if (inset_owner)
bv->updateInset(inset_owner, true); bv->updateInset(inset_owner);
update(bv); update();
break; break;
case LFUN_TRANSPOSE_CHARS: case LFUN_TRANSPOSE_CHARS:
update(false); update();
transposeChars(); transposeChars();
if (inset_owner) if (inset_owner)
bv->updateInset(inset_owner, true); bv->updateInset(inset_owner);
update(bv); update();
break; break;
case LFUN_PASTE: case LFUN_PASTE:
@ -1032,19 +1026,18 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
// clear the selection // clear the selection
bv->toggleSelection(); bv->toggleSelection();
clearSelection(); clearSelection();
update(false); update();
pasteSelection(); pasteSelection();
clearSelection(); // bug 393 clearSelection(); // bug 393
update(false); update();
update(bv);
bv->switchKeyMap(); bv->switchKeyMap();
break; break;
case LFUN_CUT: case LFUN_CUT:
bv->hideCursor(); bv->hideCursor();
update(false); update();
cutSelection(bv, true); cutSelection(bv, true);
update(bv); update();
cmd.message(_("Cut")); cmd.message(_("Cut"));
break; break;
@ -1056,7 +1049,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_BEGINNINGBUFSEL: case LFUN_BEGINNINGBUFSEL:
if (inset_owner) if (inset_owner)
return UNDISPATCHED; return UNDISPATCHED;
update(false); update();
cursorTop(); cursorTop();
finishChange(bv, true); finishChange(bv, true);
break; break;
@ -1064,7 +1057,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_ENDBUFSEL: case LFUN_ENDBUFSEL:
if (inset_owner) if (inset_owner)
return UNDISPATCHED; return UNDISPATCHED;
update(false); update();
cursorBottom(); cursorBottom();
finishChange(bv, true); finishChange(bv, true);
break; break;
@ -1149,10 +1142,10 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (change_layout) { if (change_layout) {
bv->hideCursor(); bv->hideCursor();
current_layout = layout; current_layout = layout;
update(false); update();
setLayout(layout); setLayout(layout);
bv->owner()->setLayout(layout); bv->owner()->setLayout(layout);
update(bv); update();
bv->switchKeyMap(); bv->switchKeyMap();
} }
break; break;
@ -1172,7 +1165,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
else else
insertStringAsLines(clip); insertStringAsLines(clip);
clearSelection(); clearSelection();
update(bv); update();
} }
break; break;
} }
@ -1231,7 +1224,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
for (int i = 0; i < datetmp_len; i++) { for (int i = 0; i < datetmp_len; i++) {
insertChar(datetmp[i]); insertChar(datetmp[i]);
update(true); update();
} }
selection.cursor = cursor; selection.cursor = cursor;
moveCursorUpdate(bv, false); moveCursorUpdate(bv, false);
@ -1254,7 +1247,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
setSelection(); setSelection();
if (!isInInset()) if (!isInInset())
bv->screen().toggleSelection(this, bv, false); bv->screen().toggleSelection(this, bv, false);
update(false); update();
bv->haveSelection(selection.set()); bv->haveSelection(selection.set());
} }
break; break;
@ -1273,7 +1266,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
} else { } else {
selectWord(LyXText::WHOLE_WORD_STRICT); selectWord(LyXText::WHOLE_WORD_STRICT);
} }
update(false); update();
bv->haveSelection(selection.set()); bv->haveSelection(selection.set());
} }
break; break;
@ -1336,7 +1329,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
// Maybe an empty line was deleted // Maybe an empty line was deleted
if (!bv->text->selection.set()) if (!bv->text->selection.set())
bv->update(bv->text, BufferView::UPDATE); bv->update(BufferView::UPDATE);
bv->text->setSelection(); bv->text->setSelection();
bv->screen().toggleToggle(bv->text, bv); bv->screen().toggleToggle(bv->text, bv);
bv->fitCursor(); bv->fitCursor();
@ -1548,7 +1541,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (lyxrc.auto_region_delete) { if (lyxrc.auto_region_delete) {
if (selection.set()) { if (selection.set()) {
cutSelection(false, false); cutSelection(false, false);
update(bv); update();
} }
bv->haveSelection(false); bv->haveSelection(false);
} }
@ -1562,7 +1555,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
bv->owner()->getIntl().getTransManager(). bv->owner()->getIntl().getTransManager().
TranslateAndInsert(*cit, this); TranslateAndInsert(*cit, this);
update(bv); update();
selection.cursor = cursor; selection.cursor = cursor;
moveCursorUpdate(bv, false); moveCursorUpdate(bv, false);

View File

@ -232,7 +232,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
t->updateCounters(); t->updateCounters();
bv->fitCursor(); bv->fitCursor();
} }
bv->updateInset(it, false); bv->updateInset(it);
bv->text->setCursorIntern(bv->text->cursor.par(), bv->text->setCursorIntern(bv->text->cursor.par(),
bv->text->cursor.pos()); bv->text->cursor.pos());
} else { } else {