Rename more instances of "cursor" to "caret"

Thanks to Pavel for the hint.
This commit is contained in:
Jean-Marc Lasgouttes 2017-08-24 17:37:56 +02:00
parent fb655725b7
commit b0737d2589
5 changed files with 23 additions and 22 deletions

View File

@ -2905,7 +2905,7 @@ bool BufferView::paragraphVisible(DocIterator const & dit) const
}
void BufferView::cursorPosAndHeight(Point & p, int & h) const
void BufferView::caretPosAndHeight(Point & p, int & h) const
{
Cursor const & cur = cursor();
Font const font = cur.real_current_font;

View File

@ -307,8 +307,8 @@ public:
bool paragraphVisible(DocIterator const & dit) const;
/// is the cursor currently visible in the view
bool cursorInView(Point const & p, int h) const;
/// get the position and height of the cursor
void cursorPosAndHeight(Point & p, int & h) const;
/// get the position and height of the caret
void caretPosAndHeight(Point & p, int & h) const;
///
void draw(frontend::Painter & pain, bool paint_caret);

View File

@ -198,6 +198,7 @@ public:
r = max(r, TabIndicatorWidth);
}
//FIXME: LyXRC::cursor_width should be caret_width
caret_width_ = lyxrc.cursor_width
? lyxrc.cursor_width
: 1 + int((lyxrc.currentZoom + 50) / 200.0);
@ -209,7 +210,7 @@ public:
QRect const & rect() { return rect_; }
private:
/// cursor is in RTL or LTR text
/// caret is in RTL or LTR text
bool rtl_;
/// indication for RTL or LTR
bool l_shape_;
@ -423,7 +424,7 @@ void GuiWorkArea::startBlinkingCaret()
Point p;
int h = 0;
d->buffer_view_->cursorPosAndHeight(p, h);
d->buffer_view_->caretPosAndHeight(p, h);
// Don't start blinking if the cursor isn't on screen.
if (!d->buffer_view_->cursorInView(p, h))
return;
@ -464,7 +465,7 @@ void GuiWorkArea::redraw(bool update_metrics)
d->buffer_view_->cursor().fixIfBroken();
}
// update cursor position, because otherwise it has to wait until
// update caret position, because otherwise it has to wait until
// the blinking interval is over
if (d->caret_visible_) {
d->hideCaret();
@ -507,7 +508,7 @@ void GuiWorkArea::processKeySym(KeySymbol const & key, KeyModifier mod)
// In order to avoid bad surprise in the middle of an operation,
// we better stop the blinking caret...
// the cursor gets restarted in GuiView::restartCaret()
// the caret gets restarted in GuiView::restartCaret()
stopBlinkingCaret();
guiApp->processKeySym(key, mod);
}
@ -526,7 +527,7 @@ void GuiWorkArea::Private::dispatch(FuncRequest const & cmd)
cmd.action() != LFUN_MOUSE_MOTION || cmd.button() != mouse_button::none;
// In order to avoid bad surprise in the middle of an operation, we better stop
// the blinking cursor.
// the blinking caret.
if (notJustMovingTheMouse)
p->stopBlinkingCaret();
@ -548,7 +549,7 @@ void GuiWorkArea::Private::dispatch(FuncRequest const & cmd)
// FIXME: let GuiView take care of those.
lyx_view_->clearMessage();
// Show the cursor immediately after any operation
// Show the caret immediately after any operation
p->startBlinkingCaret();
}
@ -566,7 +567,7 @@ void GuiWorkArea::Private::resizeBufferView()
Point point;
int h = 0;
buffer_view_->cursorPosAndHeight(point, h);
buffer_view_->caretPosAndHeight(point, h);
bool const caret_in_view = buffer_view_->cursorInView(point, h);
buffer_view_->resize(p->viewport()->width(), p->viewport()->height());
if (caret_in_view)
@ -581,9 +582,9 @@ void GuiWorkArea::Private::resizeBufferView()
need_resize_ = false;
p->busy(false);
// Eventually, restart the cursor after the resize event.
// Eventually, restart the caret after the resize event.
// We might be resizing even if the focus is on another widget so we only
// restart the cursor if we have the focus.
// restart the caret if we have the focus.
if (p->hasFocus())
QTimer::singleShot(50, p, SLOT(startBlinkingCaret()));
}
@ -596,7 +597,7 @@ void GuiWorkArea::Private::showCaret()
Point point;
int h = 0;
buffer_view_->cursorPosAndHeight(point, h);
buffer_view_->caretPosAndHeight(point, h);
if (!buffer_view_->cursorInView(point, h))
return;
@ -614,7 +615,7 @@ void GuiWorkArea::Private::showCaret()
if (realfont.language() == latex_language)
l_shape = false;
// show cursor on screen
// show caret on screen
Cursor & cur = buffer_view_->cursor();
bool completable = cur.inset().showCompletionCursor()
&& completer_->completionAvailable()
@ -623,7 +624,7 @@ void GuiWorkArea::Private::showCaret()
caret_visible_ = true;
//int cur_x = buffer_view_->getPos(cur).x_;
// We may have decided to slide the cursor row so that cursor
// We may have decided to slide the cursor row so that caret
// is visible.
point.x_ -= buffer_view_->horizScrollOffset();
@ -683,7 +684,7 @@ void GuiWorkArea::scrollTo(int value)
// FIXME: let GuiView take care of those.
d->lyx_view_->updateLayoutList();
}
// Show the cursor immediately after any operation.
// Show the caret immediately after any operation.
startBlinkingCaret();
// FIXME QT5
#ifdef Q_WS_X11
@ -1271,7 +1272,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
viewport()->update();
}
// Hide the cursor during the test transformation.
// Hide the caret during the test transformation.
if (e->preeditString().isEmpty())
startBlinkingCaret();
else
@ -1317,7 +1318,7 @@ QVariant GuiWorkArea::inputMethodQuery(Qt::InputMethodQuery query) const
cur_r.moveLeft(10);
cur_r.moveBottom(cur_r.bottom()
+ cur_r.height() * (d->preedit_lines_ - 1));
// return lower right of cursor in LyX.
// return lower right of caret in LyX.
return cur_r;
default:
return QWidget::inputMethodQuery(query);

View File

@ -109,7 +109,7 @@ private Q_SLOTS:
void scrollTo(int value);
/// timer to limit triple clicks
void doubleClickTimeout();
/// toggle the cursor's visibility
/// toggle the caret's visibility
void toggleCaret();
/// close this work area.
/// Slot for Buffer::closing signal.

View File

@ -85,9 +85,9 @@ struct GuiWorkArea::Private
///
void dispatch(FuncRequest const & cmd0);
/// hide the visible cursor, if it is visible
/// hide the visible caret, if it is visible
void hideCaret();
/// show the cursor if it is not visible
/// show the caret if it is not visible
void showCaret();
/// Set the range and value of the scrollbar and connect to its valueChanged
/// signal.
@ -110,7 +110,7 @@ struct GuiWorkArea::Private
///
CaretWidget * caret_;
/// is the cursor currently displayed
/// is the caret currently displayed
bool caret_visible_;
///
QTimer caret_timeout_;