From d8db0e8515b0d1698264a11811e36ae78c94d353 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Thu, 15 Apr 2010 17:49:15 +0000 Subject: [PATCH] Rename anchor() to normalAnchor() as the anchor() function was already returning a normalized anchor in stead of the real one. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34145 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 2 +- src/Cursor.cpp | 20 ++++++++++---------- src/Cursor.h | 2 +- src/TextMetrics.cpp | 2 +- src/lyxfind.cpp | 2 +- src/rowpainter.cpp | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 4afcda8158..9a922f997f 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2258,7 +2258,7 @@ bool BufferView::mouseSetCursor(Cursor & cur, bool select) d->cursor_.fixIfBroken(); // FIXME: shift-mouse selection doesn't work well across insets. - bool do_selection = select && &d->cursor_.anchor().inset() == &cur.inset(); + bool do_selection = select && &d->cursor_.normalAnchor().inset() == &cur.inset(); // do the dEPM magic if needed // FIXME: (1) move this to InsetText::notifyCursorLeaves? diff --git a/src/Cursor.cpp b/src/Cursor.cpp index a28eded33b..185d866950 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -980,7 +980,7 @@ void Cursor::posVisToRowExtremity(bool left) } -CursorSlice Cursor::anchor() const +CursorSlice Cursor::normalAnchor() const { if (!selection()) return top(); @@ -998,7 +998,7 @@ CursorSlice Cursor::selBegin() const { if (!selection()) return top(); - return anchor() < top() ? anchor() : top(); + return normalAnchor() < top() ? normalAnchor() : top(); } @@ -1006,7 +1006,7 @@ CursorSlice Cursor::selEnd() const { if (!selection()) return top(); - return anchor() > top() ? anchor() : top(); + return normalAnchor() > top() ? normalAnchor() : top(); } @@ -1018,10 +1018,10 @@ DocIterator Cursor::selectionBegin() const DocIterator di; // FIXME: This is a work-around for the problem that // CursorSlice doesn't keep track of the boundary. - if (anchor() == top()) + if (normalAnchor() == top()) di = anchor_.boundary() > boundary() ? anchor_ : *this; else - di = anchor() < top() ? anchor_ : *this; + di = normalAnchor() < top() ? anchor_ : *this; di.resize(depth()); return di; } @@ -1035,10 +1035,10 @@ DocIterator Cursor::selectionEnd() const DocIterator di; // FIXME: This is a work-around for the problem that // CursorSlice doesn't keep track of the boundary. - if (anchor() == top()) + if (normalAnchor() == top()) di = anchor_.boundary() < boundary() ? anchor_ : *this; else - di = anchor() > top() ? anchor_ : *this; + di = normalAnchor() > top() ? anchor_ : *this; if (di.depth() > depth()) { di.resize(depth()); @@ -1053,9 +1053,9 @@ void Cursor::setSelection() setSelection(true); // A selection with no contents is not a selection // FIXME: doesnt look ok - if (idx() == anchor().idx() && - pit() == anchor().pit() && - pos() == anchor().pos()) + if (idx() == normalAnchor().idx() && + pit() == normalAnchor().pit() && + pos() == normalAnchor().pos()) setSelection(false); } diff --git a/src/Cursor.h b/src/Cursor.h index 134c95cd91..5747d31ce4 100644 --- a/src/Cursor.h +++ b/src/Cursor.h @@ -201,7 +201,7 @@ public: int textTargetOffset() const; /// access to normalized selection anchor - CursorSlice anchor() const; + CursorSlice normalAnchor() const; /// sets anchor to cursor position void resetAnchor(); /// access to owning BufferView diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 1aef414b7c..482b2a13bf 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -2078,7 +2078,7 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co // This is our text. && cur.text() == text_ // if the anchor is outside, this is not our selection - && cur.anchor().text() == text_ + && cur.normalAnchor().text() == text_ && pit >= sel_beg.pit() && pit <= sel_end.pit(); // We store the begin and end pos of the selection relative to this par diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 5e44691ad5..fd44187104 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -371,7 +371,7 @@ bool findChange(BufferView * bv, bool next) if (bv->cursor().selection()) { // set the cursor at the beginning or at the end of the selection // before searching. Otherwise, the current change will be found. - if (next != (bv->cursor().top() > bv->cursor().anchor())) + if (next != (bv->cursor().top() > bv->cursor().normalAnchor())) bv->cursor().setCursorToAnchor(); } diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index ef81e683ae..bfc3ea9c83 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -716,7 +716,7 @@ void RowPainter::paintOnlyInsets() bool const pi_selected = pi_.selected; Cursor const & cur = pi_.base.bv->cursor(); if (cur.selection() && cur.text() == &text_ - && cur.anchor().text() == &text_) + && cur.normalAnchor().text() == &text_) pi_.selected = row_.sel_beg <= pos && row_.sel_end > pos; paintInset(inset, pos); pi_.selected = pi_selected; @@ -858,7 +858,7 @@ void RowPainter::paintText() bool const pi_selected = pi_.selected; Cursor const & cur = pi_.base.bv->cursor(); if (cur.selection() && cur.text() == &text_ - && cur.anchor().text() == &text_) + && cur.normalAnchor().text() == &text_) pi_.selected = row_.sel_beg <= pos && row_.sel_end > pos; paintInset(inset, pos); pi_.selected = pi_selected; -- 2.39.2