* insettext.[Ch] (updateLocal): remove 'what' argument by assuimng it

is 'FULL' all the time.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7496 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-08-04 15:14:11 +00:00
parent ecee0239e7
commit 7f87533060
3 changed files with 33 additions and 43 deletions

View File

@ -1,3 +1,9 @@
2003-08-04 André Pönitz <poenitz@gmx.net>
* insettext.[Ch] (updateLocal): remove 'what' argument by assuimng it
is 'FULL' all the time.
2003-08-03 Jean-Marc Lasgouttes <lasgouttes@lyx.org> 2003-08-03 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insetert.C (get_new_label): only add ... to the (closed) label * insetert.C (get_new_label): only add ... to the (closed) label

View File

@ -395,7 +395,7 @@ void InsetText::setUpdateStatus(int what) const
} }
void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty) void InsetText::updateLocal(BufferView * bv, bool mark_dirty)
{ {
if (!bv) if (!bv)
return; return;
@ -404,7 +404,7 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty)
collapseParagraphs(bv); collapseParagraphs(bv);
text_.partialRebreak(); text_.partialRebreak();
setUpdateStatus(what); setUpdateStatus(FULL);
bool flag = mark_dirty || bool flag = mark_dirty ||
(need_update != CURSOR && need_update != NONE) || (need_update != CURSOR && need_update != NONE) ||
text_.selection.set(); text_.selection.set();
@ -439,7 +439,7 @@ void InsetText::insetUnlock(BufferView * bv)
if (the_locking_inset) { if (the_locking_inset) {
the_locking_inset->insetUnlock(bv); the_locking_inset->insetUnlock(bv);
the_locking_inset = 0; the_locking_inset = 0;
updateLocal(bv, CURSOR_PAR, false); updateLocal(bv, false);
} }
no_selection = true; no_selection = true;
locked = false; locked = false;
@ -460,12 +460,8 @@ void InsetText::insetUnlock(BufferView * bv)
} else if (paragraphs.size() > 1) { } else if (paragraphs.size() > 1) {
text_.setCursor(boost::next(first_par), 0); text_.setCursor(boost::next(first_par), 0);
} }
#if 0
updateLocal(bv, code, false);
#else
if (code != NONE) if (code != NONE)
setUpdateStatus(code); setUpdateStatus(code);
#endif
} }
@ -503,7 +499,6 @@ void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset)
inset_pos = cpos(); inset_pos = cpos();
inset_par = cpar(); inset_par = cpar();
inset_boundary = cboundary(); inset_boundary = cboundary();
//updateLocal(bv, CURSOR, false);
} }
@ -580,7 +575,7 @@ bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
if (scroll()) if (scroll())
scroll(bv, 0.0F); scroll(bv, 0.0F);
else else
updateLocal(bv, CURSOR, false); updateLocal(bv, false);
return true; return true;
} }
return the_locking_inset->unlockInsetInInset(bv, inset, lr); return the_locking_inset->unlockInsetInInset(bv, inset, lr);
@ -670,7 +665,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
} }
inset->localDispatch(cmd1); inset->localDispatch(cmd1);
if (the_locking_inset) if (the_locking_inset)
updateLocal(bv, CURSOR, false); updateLocal(bv, false);
return; return;
} }
} }
@ -688,13 +683,8 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
text_.selection.cursor = text_.cursor; text_.selection.cursor = text_.cursor;
text_.cursor.x_fix(text_.cursor.x()); text_.cursor.x_fix(text_.cursor.x());
if (text_.selection.set()) {
text_.clearSelection(); text_.clearSelection();
updateLocal(bv, FULL, false); updateLocal(bv, false);
} else {
text_.clearSelection();
updateLocal(bv, CURSOR, false);
}
bv->owner()->setLayout(cpar()->layout()->name()); bv->owner()->setLayout(cpar()->layout()->name());
@ -751,7 +741,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
} }
#endif #endif
ret = inset->localDispatch(cmd1); ret = inset->localDispatch(cmd1);
updateLocal(bv, CURSOR_PAR, false); updateLocal(bv, false);
} }
return ret; return ret;
@ -780,7 +770,7 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
if (cur == text_.cursor) if (cur == text_.cursor)
return; return;
text_.setSelection(); text_.setSelection();
updateLocal(bv, SELECTION, false); updateLocal(bv, false);
} }
@ -846,7 +836,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
if (drawFrame_ == LOCKED) if (drawFrame_ == LOCKED)
code = CURSOR | DRAW_FRAME; code = CURSOR | DRAW_FRAME;
updateLocal(bv, code, false); updateLocal(bv, false);
// Tell the paragraph dialog that we've entered an insettext. // Tell the paragraph dialog that we've entered an insettext.
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE)); bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
return DISPATCHED; return DISPATCHED;
@ -884,7 +874,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
if (result == DISPATCHED_NOUPDATE) if (result == DISPATCHED_NOUPDATE)
return result; return result;
else if (result == DISPATCHED) { else if (result == DISPATCHED) {
updateLocal(bv, CURSOR_PAR, false); updateLocal(bv, false);
return result; return result;
} else if (result >= FINISHED) { } else if (result >= FINISHED) {
switch (result) { switch (result) {
@ -894,13 +884,13 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
break; break;
case FINISHED_UP: case FINISHED_UP:
if ((result = moveUp(bv)) >= FINISHED) { if ((result = moveUp(bv)) >= FINISHED) {
updateLocal(bv, CURSOR, false); updateLocal(bv, false);
bv->unlockInset(this); bv->unlockInset(this);
} }
break; break;
case FINISHED_DOWN: case FINISHED_DOWN:
if ((result = moveDown(bv)) >= FINISHED) { if ((result = moveDown(bv)) >= FINISHED) {
updateLocal(bv, CURSOR, false); updateLocal(bv, false);
bv->unlockInset(this); bv->unlockInset(this);
} }
break; break;
@ -909,7 +899,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
break; break;
} }
the_locking_inset = 0; the_locking_inset = 0;
updateLocal(bv, CURSOR, false); updateLocal(bv, false);
// make sure status gets reset immediately // make sure status gets reset immediately
bv->owner()->clearMessage(); bv->owner()->clearMessage();
return result; return result;
@ -1242,7 +1232,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
} }
if (updwhat > 0) if (updwhat > 0)
updateLocal(bv, updwhat, updflag); updateLocal(bv, updflag);
/// If the action has deleted all text in the inset, we need to change the /// If the action has deleted all text in the inset, we need to change the
// language to the language of the surronding text. // language to the language of the surronding text.
if (!was_empty && paragraphs.begin()->empty() && if (!was_empty && paragraphs.begin()->empty() &&
@ -1598,7 +1588,7 @@ bool InsetText::insertInset(BufferView * bv, InsetOld * inset)
inset->setOwner(this); inset->setOwner(this);
text_.insertInset(inset); text_.insertInset(inset);
bv->fitCursor(); bv->fitCursor();
updateLocal(bv, CURSOR_PAR|CURSOR, true); updateLocal(bv, true);
return true; return true;
} }
@ -1691,13 +1681,7 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
text_.clearSelection(); text_.clearSelection();
bv->fitCursor(); bv->fitCursor();
updateLocal(bv, true);
bool flag = (selectall || text_.selection.set());
if (flag)
updateLocal(bv, FULL, true);
else
updateLocal(bv, CURSOR_PAR, true);
} }
@ -1710,7 +1694,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool front)
inset->localDispatch(cmd); inset->localDispatch(cmd);
if (!the_locking_inset) if (!the_locking_inset)
return false; return false;
updateLocal(bv, CURSOR, false); updateLocal(bv, false);
return true; return true;
} }
@ -1742,7 +1726,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
inset->localDispatch(cmd); inset->localDispatch(cmd);
if (!the_locking_inset) if (!the_locking_inset)
return false; return false;
updateLocal(bv, CURSOR, false); updateLocal(bv, false);
return true; return true;
} }
@ -1809,7 +1793,7 @@ void InsetText::setDrawFrame(BufferView * bv, DrawFrame how)
if (how != drawFrame_) { if (how != drawFrame_) {
drawFrame_ = how; drawFrame_ = how;
if (bv) if (bv)
updateLocal(bv, DRAW_FRAME, false); updateLocal(bv, false);
} }
} }
@ -1819,7 +1803,7 @@ void InsetText::setFrameColor(BufferView * bv, LColor::color col)
if (frame_color != col) { if (frame_color != col) {
frame_color = col; frame_color = col;
if (bv) if (bv)
updateLocal(bv, DRAW_FRAME, false); updateLocal(bv, false);
} }
} }
@ -1940,7 +1924,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool /*force*/) const
text_.top_y(bv->screen().topCursorVisible(&text_)); text_.top_y(bv->screen().topCursorVisible(&text_));
if (!owner()) { if (!owner()) {
const_cast<InsetText*>(this)->updateLocal(bv, FULL, false); const_cast<InsetText*>(this)->updateLocal(bv, false);
// this will scroll the screen such that the cursor becomes visible // this will scroll the screen such that the cursor becomes visible
bv->updateScrollbar(); bv->updateScrollbar();
} else { } else {
@ -2100,7 +2084,7 @@ void InsetText::selectSelectedWord(BufferView * bv)
return; return;
} }
getLyXText(bv)->selectSelectedWord(); getLyXText(bv)->selectSelectedWord();
updateLocal(bv, SELECTION, false); updateLocal(bv, false);
} }
@ -2121,7 +2105,7 @@ bool InsetText::nextChange(BufferView * bv, lyx::pos_type & length)
locked = true; locked = true;
text_.cursor = cur; text_.cursor = cur;
text_.setSelectionRange(length); text_.setSelectionRange(length);
updateLocal(bv, SELECTION, false); updateLocal(bv, false);
} }
return result != lyx::find::SR_NOT_FOUND; return result != lyx::find::SR_NOT_FOUND;
} }
@ -2145,7 +2129,7 @@ bool InsetText::searchForward(BufferView * bv, string const & str,
locked = true; locked = true;
text_.cursor = cur; text_.cursor = cur;
text_.setSelectionRange(str.length()); text_.setSelectionRange(str.length());
updateLocal(bv, SELECTION, false); updateLocal(bv, false);
} }
return result != lyx::find::SR_NOT_FOUND; return result != lyx::find::SR_NOT_FOUND;
} }
@ -2177,7 +2161,7 @@ bool InsetText::searchBackward(BufferView * bv, string const & str,
locked = true; locked = true;
text_.cursor = cur; text_.cursor = cur;
text_.setSelectionRange(str.length()); text_.setSelectionRange(str.length());
updateLocal(bv, SELECTION, false); updateLocal(bv, false);
} }
return result != lyx::find::SR_NOT_FOUND; return result != lyx::find::SR_NOT_FOUND;
} }

View File

@ -237,7 +237,7 @@ public:
ParagraphList paragraphs; ParagraphList paragraphs;
protected: protected:
/// ///
void updateLocal(BufferView *, int what, bool mark_dirty); void updateLocal(BufferView *, bool mark_dirty);
/// set parameters for an initial lock of this inset /// set parameters for an initial lock of this inset
void lockInset(BufferView *); void lockInset(BufferView *);
/// lock an inset inside this one /// lock an inset inside this one