}
-void BufferView::fitCursor()
+bool BufferView::fitCursor()
{
- pimpl_->fitCursor();
+ return pimpl_->fitCursor();
}
///
void redraw();
///
- void fitCursor();
+ bool fitCursor();
///
void update();
//
///
void hideLockedInsetCursor();
///
- void fitLockedInsetCursor(int x, int y, int asc, int desc);
+ bool fitLockedInsetCursor(int x, int y, int asc, int desc);
///
int unlockInset(UpdatableInset * inset);
///
}
-void BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
+bool BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
{
if (theLockingInset() && available()) {
y += text->cursor.y() + theLockingInset()->insetInInsetY();
- if (pimpl_->screen_->fitManualCursor(text, this, x, y, asc, desc))
+ if (pimpl_->screen_->fitManualCursor(text, this, x, y, asc, desc)) {
updateScrollbar();
+ return true;
+ }
}
+ return false;
}
2002-03-29 Juergen Vigna <jug@sad.it>
+ * lyxfunc.C (dispatch): add a missing fitCursor call.
+
+ * BufferView2.C (fitLockedInsetCursor): the inset needs to know if
+ it was scrolled by a cursor move, so return the bool status.
+
+ * BufferView.C (fitCursor): return the bool flag also to the outside
+ world as this is needed.
+
+ * screen.C (toggleToggle): don't subtract the offset if it's positive.
+
* BufferView_pimpl.C (workAreaButtonPress): just lock the inset don't
call the edit() as it is not needed (and wrong) IMO.
(workAreaButtonPress): set the screen_first variable before evt.
2002-03-29 Juergen Vigna <jug@sad.it>
+ * insettext.C (updateLocal): fixes to fitCursor calls when locking/
+ unlocking inset.
+
+ * insettabular.C (edit): call fitCursor().
+
* insettext.C (insetButtonPress): change behaviour of no_selection
to the one in the BufferView selection_possible and fix the spurious
selection bug with it.
+ (localDispatch): revoke selection on BREAK... functions.
2002-03-28 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
return;
}
+ finishUndo();
locked = true;
the_locking_inset = 0;
inset_x = 0;
actcell = tabular->GetNumberOfCells() - 1;
clearSelection();
resetPos(bv);
- finishUndo();
+ bv->fitCursor();
}
}
if (result < FINISHED) {
if (!the_locking_inset) {
-// showInsetCursor(bv);
+ if (bv->fitCursor())
+ updateLocal(bv, FULL, false);
+ if (locked)
+ showInsetCursor(bv);
}
} else
bv->unlockInset(this);
void InsetTabular::fitInsetCursor(BufferView * bv) const
{
if (the_locking_inset) {
+ int old_first_y = bv->text->first_y;
the_locking_inset->fitInsetCursor(bv);
+ if (old_first_y != bv->text->first_y)
+ need_update = FULL;
return;
}
LyXFont font;
int const asc = lyxfont::maxAscent(font);
int const desc = lyxfont::maxDescent(font);
- bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
+ if (bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc))
+ need_update = FULL;
}
}
lt->fullRebreak(bv);
setUpdateStatus(bv, what);
- bool flag = (((need_update != CURSOR) && (need_update != NONE)) ||
- (lt->status() != LyXText::UNCHANGED) || lt->selection.set());
+ bool flag = mark_dirty ||
+ (((need_update != CURSOR) && (need_update != NONE)) ||
+ (lt->status() != LyXText::UNCHANGED) || lt->selection.set());
if (!lt->selection.set())
lt->selection.cursor = lt->cursor;
if (clear)
lt = 0;
+ if (locked && (need_update & CURSOR) && bv->fitCursor())
+ need_update |= FULL;
if (flag)
bv->updateInset(const_cast<InsetText *>(this), mark_dirty);
- else
- bv->fitCursor();
if (need_update == CURSOR)
need_update = NONE;
font.setLanguage(bv->getParentLanguage(this));
setFont(bv, font, false);
}
-// showInsetCursor(bv);
if (clear)
lt = 0;
if (drawFrame_ == LOCKED)
code = CURSOR|DRAW_FRAME;
updateLocal(bv, code, false);
+ showInsetCursor(bv);
// Tell the paragraph dialog that we've entered an insettext.
bv->owner()->getDialogs()->updateParagraph();
font.setLanguage(bv->getParentLanguage(this));
setFont(bv, font, false);
}
-// showInsetCursor(bv);
if (clear)
lt = 0;
int code = CURSOR;
if (drawFrame_ == LOCKED)
code = CURSOR|DRAW_FRAME;
updateLocal(bv, code, false);
+ showInsetCursor(bv);
}
void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
{
- no_selection = false;
+ no_selection = true;
// use this to check mouse motion for selection!
mouse_x = x;
the_locking_inset->insetUnlock(bv);
the_locking_inset = 0;
}
- if (inset)
- no_selection = true;
+ if (!inset)
+ no_selection = false;
if (bv->theLockingInset()) {
if (isHighlyEditableInset(inset)) {
void InsetText::insetMotionNotify(BufferView * bv, int x, int y, int state)
{
- if (no_selection || ((mouse_x == x) && (mouse_y == y)))
- return;
if (the_locking_inset) {
the_locking_inset->insetMotionNotify(bv, x - inset_x,
y - inset_y,state);
return;
}
+
+ if (no_selection || ((mouse_x == x) && (mouse_y == y)))
+ return;
+
bool clear = false;
if (!lt) {
lt = getLyXText(bv);
#ifdef WITH_WARNINGS
#warning I changed this to always return Dispatched maybe it is wrong (20011001 Jug)
#endif
+ updateLocal(bv, CURSOR, false);
return result;
}
}
break;
}
lt->breakParagraph(bv, 0);
- updwhat = FULL;
+ updwhat = CURSOR | FULL;
updflag = true;
break;
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
break;
}
lt->breakParagraph(bv, 1);
- updwhat = FULL;
+ updwhat = CURSOR | FULL;
updflag = true;
break;
setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next());
lt->insertChar(bv, Paragraph::META_NEWLINE);
- updwhat = CURSOR_PAR;
+ updwhat = CURSOR | CURSOR_PAR;
updflag = true;
}
break;
if (result >= FINISHED)
bv->unlockInset(this);
+
+ if (result == DISPATCHED_NOUPDATE && (need_update & FULL))
+ result = DISPATCHED;
return result;
}
int const asc = lyxfont::maxAscent(font);
int const desc = lyxfont::maxDescent(font);
- bv->fitLockedInsetCursor(cx(bv), cy(bv), asc, desc);
+ if (bv->fitLockedInsetCursor(cx(bv), cy(bv), asc, desc))
+ need_update |= FULL;
}
TEXT()->cursorUp(owner->view());
moveCursorUpdate(true, false);
owner->showState();
+ } else {
+ owner->view()->update(TEXT(), BufferView::SELECT|BufferView::FITCUR);
}
goto exit_with_message;
} else if (result == UpdatableInset::FINISHED_DOWN) {
- text->toggle_end_cursor.row()->baseline()
+ text->toggle_end_cursor.row()->height();
+ int const offset = y_offset < 0 ? y_offset : 0;
int const bottom = min(max(bottom_tmp, text->first_y),
- static_cast<int>(text->first_y + owner.height()))-y_offset;
+ static_cast<int>(text->first_y + owner.height()))-offset;
int const top = min(max(top_tmp, text->first_y),
- static_cast<int>(text->first_y + owner.height()))-y_offset;
+ static_cast<int>(text->first_y + owner.height()))-offset;
drawFromTo(text, bv, top - text->first_y,
bottom - text->first_y, y_offset,