mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Get rid of BufferView::scrollUp/Down
LFUN_SCROLL was the last user, change it to use only scroll(). Take this opportunity to improve a bit this dispatch code. Also improve somewhat the methods documentation.
This commit is contained in:
parent
f52842d289
commit
439b7bb9c9
@ -2168,18 +2168,24 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
scroll_step = d->scrollbarParameters_.single_step;
|
scroll_step = d->scrollbarParameters_.single_step;
|
||||||
else if (scroll_type == "page")
|
else if (scroll_type == "page")
|
||||||
scroll_step = d->scrollbarParameters_.page_step;
|
scroll_step = d->scrollbarParameters_.page_step;
|
||||||
else
|
|
||||||
return;
|
|
||||||
string const scroll_quantity = cmd.getArg(1);
|
|
||||||
if (scroll_quantity == "up")
|
|
||||||
scrollUp(scroll_step);
|
|
||||||
else if (scroll_quantity == "down")
|
|
||||||
scrollDown(scroll_step);
|
|
||||||
else {
|
else {
|
||||||
int const scroll_value = convert<int>(scroll_quantity);
|
dispatched = false;
|
||||||
if (scroll_value)
|
return;
|
||||||
scroll(scroll_step * scroll_value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string const scroll_quantity = cmd.getArg(1);
|
||||||
|
|
||||||
|
if (scroll_quantity == "up")
|
||||||
|
scroll(-scroll_step);
|
||||||
|
else if (scroll_quantity == "down")
|
||||||
|
scroll(scroll_step);
|
||||||
|
else if (isStrInt(scroll_quantity))
|
||||||
|
scroll(scroll_step * convert<int>(scroll_quantity));
|
||||||
|
else {
|
||||||
|
dispatched = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dr.screenUpdate(Update::ForceDraw);
|
dr.screenUpdate(Update::ForceDraw);
|
||||||
dr.forceBufferUpdate();
|
dr.forceBufferUpdate();
|
||||||
break;
|
break;
|
||||||
@ -2859,20 +2865,6 @@ int BufferView::scroll(int pixels)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BufferView::scrollDown(int pixels)
|
|
||||||
{
|
|
||||||
d->anchor_ypos_ -= pixels;
|
|
||||||
return -pixels;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int BufferView::scrollUp(int pixels)
|
|
||||||
{
|
|
||||||
d->anchor_ypos_ += pixels;
|
|
||||||
return pixels;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool BufferView::setCursorFromRow(int row)
|
bool BufferView::setCursorFromRow(int row)
|
||||||
{
|
{
|
||||||
TexRow::TextEntry start, end;
|
TexRow::TextEntry start, end;
|
||||||
|
@ -218,17 +218,17 @@ public:
|
|||||||
/// Ensure the passed cursor \p dit is visible.
|
/// Ensure the passed cursor \p dit is visible.
|
||||||
/// This method will automatically scroll and update the BufferView
|
/// This method will automatically scroll and update the BufferView
|
||||||
/// (metrics+drawing) if needed.
|
/// (metrics+drawing) if needed.
|
||||||
/// \param how Use this scroll strategy
|
/// \param how: where the cursor should appear (visible/top/center)
|
||||||
void showCursor(DocIterator const & dit, ScrollType how);
|
void showCursor(DocIterator const & dit, ScrollType how);
|
||||||
/// Scroll to the cursor.
|
/// Scroll to the cursor.
|
||||||
/// \param how Use this scroll strategy
|
/// This only updates the anchor vertical position, but does not
|
||||||
|
/// recompute metrics nor trigger a screen refresh.
|
||||||
|
/// \param how: where the cursor should appear (visible/top/center)
|
||||||
/// \return true if screen was scrolled
|
/// \return true if screen was scrolled
|
||||||
bool scrollToCursor(DocIterator const & dit, ScrollType how);
|
bool scrollToCursor(DocIterator const & dit, ScrollType how);
|
||||||
/// scroll down document by the given number of pixels.
|
/// scroll the view by the given number of pixels. This only
|
||||||
int scrollDown(int pixels);
|
/// updates the anchor vertical position, but does not recompute
|
||||||
/// scroll up document by the given number of pixels.
|
/// metrics nor trigger a screen refresh.
|
||||||
int scrollUp(int pixels);
|
|
||||||
/// scroll document by the given number of pixels.
|
|
||||||
int scroll(int pixels);
|
int scroll(int pixels);
|
||||||
/// Scroll the view by a number of pixels.
|
/// Scroll the view by a number of pixels.
|
||||||
void scrollDocView(int pixels);
|
void scrollDocView(int pixels);
|
||||||
|
Loading…
Reference in New Issue
Block a user