* Licence details can be found in the file COPYING.
*
* \author Alfredo Braunstein
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
* \author John Levon
- * \author André Pönitz
- * \author Jürgen Vigna
+ * \author André Pönitz
+ * \author Jürgen Vigna
*
* Full author contact details are available in file CREDITS.
*/
void BufferView::scrollDocView(int value)
{
int const offset = value - d->scrollbarParameters_.position;
+
+ // No scrolling at all? No need to redraw anything
+ if (offset == 0)
+ return;
+
// If the offset is less than 2 screen height, prefer to scroll instead.
if (abs(offset) <= 2 * height_) {
- scroll(offset);
+ d->anchor_ypos_ -= offset;
updateMetrics();
buffer_.changed();
return;
Cursor cur(*this);
cur.reset(buffer_.inset());
tm.setCursorFromCoordinates(cur, 0, newy);
+
+ // update the bufferview cursor and notify insets
+ // FIXME: Care about the d->cursor_ flags to redraw if needed
+ Cursor old = d->cursor_;
mouseSetCursor(cur);
+ bool badcursor = notifyCursorLeavesOrEnters(old, d->cursor_);
+ if (badcursor)
+ d->cursor_.fixIfBroken();
}
case LFUN_NOTE_NEXT:
case LFUN_REFERENCE_NEXT:
case LFUN_WORD_FIND:
+ case LFUN_WORD_FINDADV:
case LFUN_WORD_REPLACE:
case LFUN_MARK_OFF:
case LFUN_MARK_ON:
case LFUN_SCREEN_RECENTER:
case LFUN_BIBTEX_DATABASE_ADD:
case LFUN_BIBTEX_DATABASE_DEL:
- case LFUN_GRAPHICS_GROUPS_UNIFY:
case LFUN_NOTES_MUTATE:
case LFUN_ALL_INSETS_TOGGLE:
case LFUN_STATISTICS:
flag.setEnabled(true);
break;
+ // @todo Test if current WorkArea is the search WorkArea
+ case LFUN_REGEXP_MODE:
+ flag.setEnabled(! this->cursor().inRegexped());
+ break;
+
case LFUN_NEXT_INSET_TOGGLE:
case LFUN_NEXT_INSET_MODIFY: {
// this is the real function we want to invoke
case LFUN_CHANGE_NEXT:
findNextChange(this);
+ // FIXME: Move this LFUN to Buffer so that we don't have to do this:
+ processUpdateFlags(Update::Force | Update::FitCursor);
break;
case LFUN_CHANGES_MERGE:
- if (findNextChange(this))
+ if (findNextChange(this)) {
+ processUpdateFlags(Update::Force | Update::FitCursor);
showDialog("changes");
+ }
break;
case LFUN_ALL_CHANGES_ACCEPT:
FuncRequest req = cmd;
if (cmd.argument().empty() && !d->search_request_cache_.argument().empty())
req = d->search_request_cache_;
+ if (req.argument().empty()) {
+ theLyXFunc().dispatch(FuncRequest(LFUN_DIALOG_SHOW, "findreplace"));
+ break;
+ }
if (find(this, req))
showCursor();
else
break;
}
+ case LFUN_WORD_FINDADV:
+ findAdv(this, cmd);
+ break;
+
case LFUN_MARK_OFF:
cur.clearSelection();
cur.resetAnchor();
processUpdateFlags(Update::Force);
break;
- // These two could be rewriten using some command like forall <insetname> <command>
+ // This could be rewriten using some command like forall <insetname> <command>
// once the insets refactoring is done.
- case LFUN_GRAPHICS_GROUPS_UNIFY: {
- if (cmd.argument().empty())
- break;
- graphics::unifyGraphicsGroups(cur.buffer(), to_utf8(cmd.argument()));
- processUpdateFlags(Update::Force | Update::FitCursor);
- break;
- }
-
case LFUN_NOTES_MUTATE: {
if (cmd.argument().empty())
break;
// Notify left insets
if (cur != old) {
old.fixIfBroken();
- bool badcursor = notifyCursorLeaves(old, cur);
+ bool badcursor = notifyCursorLeavesOrEnters(old, cur);
if (badcursor)
cursor().fixIfBroken();
}
// Inset is not at cursor position. Find it in the document.
Cursor cur(*this);
cur.reset(buffer().inset());
- do
+ while (cur && cur.nextInset() != inset)
cur.forwardInset();
- while (cur && cur.nextInset() != inset);
if (cur) {
setCursor(cur);
d->cursor_ = cur;
- updateLabels(buffer_);
+ buffer_.updateLabels();
updateMetrics();
buffer_.changed();
cap::saveSelection(cursor());
// Has the cursor just left the inset?
- bool badcursor = false;
bool leftinset = (&d->cursor_.inset() != &cur.inset());
- if (leftinset) {
+ if (leftinset)
d->cursor_.fixIfBroken();
- badcursor = notifyCursorLeaves(d->cursor_, cur);
- if (badcursor)
- cur.fixIfBroken();
- }
// FIXME: shift-mouse selection doesn't work well across insets.
bool do_selection = select && &d->cursor_.anchor().inset() == &cur.inset();
// FIXME: (2) if we had a working InsetText::notifyCursorLeaves,
// the leftinset bool would not be necessary (badcursor instead).
bool update = leftinset;
- if (!do_selection && !badcursor && d->cursor_.inTexted())
+ if (!do_selection && d->cursor_.inTexted())
update |= checkDepm(cur, d->cursor_);
d->cursor_.setCursor(cur);
if (height_ == 0 || width_ == 0)
return;
LYXERR(Debug::PAINTING, "\t\t*** START DRAWING ***");
+
Text & text = buffer_.text();
TextMetrics const & tm = d->text_metrics_[&text];
int const y = tm.first().second->position();
// Clear background.
pain.fillRectangle(0, 0, width_, height_,
- buffer_.inset().backgroundColor());
+ pi.backgroundColor(&buffer_.inset()));
// Draw everything.
tm.draw(pi, 0, y);