mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 05:37:11 +00:00
Remove assert_in_view parameter to TextMetrics::editXY
This parameter was not used anymore since commit 9c443d96. The description of that commit said "Use assert_in_view = false when calling TextMetrics::editXY() because this parameter does not work as advertised: if an inset not totally visible, the code will not try to go inside it to look for a smaller row that is totally visible." Rename accordingly getPitAndRowNearY to getRowNearY.
This commit is contained in:
parent
b4b27b4800
commit
24fcef9185
@ -2161,8 +2161,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
cur.setCursor(doc_iterator_begin(cur.buffer()));
|
cur.setCursor(doc_iterator_begin(cur.buffer()));
|
||||||
cur.selHandle(false);
|
cur.selHandle(false);
|
||||||
|
|
||||||
d->text_metrics_[&buffer_.text()].editXY(cur, p.x, p.y,
|
d->text_metrics_[&buffer_.text()].editXY(cur, p.x, p.y);
|
||||||
false, act == LFUN_SCREEN_UP);
|
|
||||||
//FIXME: what to do with cur.x_target()?
|
//FIXME: what to do with cur.x_target()?
|
||||||
bool update = in_texted && cur.bv().checkDepm(cur, old);
|
bool update = in_texted && cur.bv().checkDepm(cur, old);
|
||||||
cur.finishUndo();
|
cur.finishUndo();
|
||||||
|
@ -1515,8 +1515,7 @@ pit_type TextMetrics::getPitNearY(int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Row const & TextMetrics::getPitAndRowNearY(int & y, pit_type & pit,
|
Row const & TextMetrics::getRowNearY(int & y, pit_type pit)
|
||||||
bool assert_in_view, bool up)
|
|
||||||
{
|
{
|
||||||
ParagraphMetrics const & pm = par_metrics_[pit];
|
ParagraphMetrics const & pm = par_metrics_[pit];
|
||||||
|
|
||||||
@ -1529,48 +1528,21 @@ Row const & TextMetrics::getPitAndRowNearY(int & y, pit_type & pit,
|
|||||||
if (yy + rit->height() > y)
|
if (yy + rit->height() > y)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (assert_in_view) {
|
|
||||||
if (!up && yy + rit->height() > y) {
|
|
||||||
if (rit != pm.rows().begin()) {
|
|
||||||
y = yy;
|
|
||||||
--rit;
|
|
||||||
} else if (pit != 0) {
|
|
||||||
--pit;
|
|
||||||
newParMetricsUp();
|
|
||||||
ParagraphMetrics const & pm2 = par_metrics_[pit];
|
|
||||||
rit = pm2.rows().end();
|
|
||||||
--rit;
|
|
||||||
y = yy;
|
|
||||||
}
|
|
||||||
} else if (up && yy != y) {
|
|
||||||
if (rit != rlast) {
|
|
||||||
y = yy + rit->height();
|
|
||||||
++rit;
|
|
||||||
} else if (pit < int(text_->paragraphs().size()) - 1) {
|
|
||||||
++pit;
|
|
||||||
newParMetricsDown();
|
|
||||||
ParagraphMetrics const & pm2 = par_metrics_[pit];
|
|
||||||
rit = pm2.rows().begin();
|
|
||||||
y = pm2.position();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return *rit;
|
return *rit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// x,y are absolute screen coordinates
|
// x,y are absolute screen coordinates
|
||||||
// sets cursor recursively descending into nested editable insets
|
// sets cursor recursively descending into nested editable insets
|
||||||
Inset * TextMetrics::editXY(Cursor & cur, int x, int y,
|
Inset * TextMetrics::editXY(Cursor & cur, int x, int y)
|
||||||
bool assert_in_view, bool up)
|
|
||||||
{
|
{
|
||||||
if (lyxerr.debugging(Debug::WORKAREA)) {
|
if (lyxerr.debugging(Debug::WORKAREA)) {
|
||||||
LYXERR0("TextMetrics::editXY(cur, " << x << ", " << y << ")");
|
LYXERR0("TextMetrics::editXY(cur, " << x << ", " << y << ")");
|
||||||
cur.bv().coordCache().dump();
|
cur.bv().coordCache().dump();
|
||||||
}
|
}
|
||||||
pit_type pit = getPitNearY(y);
|
pit_type const pit = getPitNearY(y);
|
||||||
LASSERT(pit != -1, return 0);
|
LASSERT(pit != -1, return 0);
|
||||||
Row const & row = getPitAndRowNearY(y, pit, assert_in_view, up);
|
Row const & row = getRowNearY(y, pit);
|
||||||
cur.pit() = pit;
|
cur.pit() = pit;
|
||||||
|
|
||||||
// Do we cover an inset?
|
// Do we cover an inset?
|
||||||
|
@ -195,10 +195,8 @@ public:
|
|||||||
std::pair<pos_type, bool> getPosNearX(Row const & row, int & x) const;
|
std::pair<pos_type, bool> getPosNearX(Row const & row, int & x) const;
|
||||||
|
|
||||||
/// returns the row near the specified y-coordinate in a given paragraph
|
/// returns the row near the specified y-coordinate in a given paragraph
|
||||||
/// (relative to the screen). If assert_in_view is true, it is made sure
|
/// (relative to the screen).
|
||||||
/// that the row is on screen completely; this might change the given pit.
|
Row const & getRowNearY(int & y, pit_type pit);
|
||||||
Row const & getPitAndRowNearY(int & y, pit_type & pit,
|
|
||||||
bool assert_in_view, bool up);
|
|
||||||
|
|
||||||
/// returns the paragraph number closest to screen y-coordinate.
|
/// returns the paragraph number closest to screen y-coordinate.
|
||||||
/// This method uses the BufferView CoordCache to locate the
|
/// This method uses the BufferView CoordCache to locate the
|
||||||
@ -211,18 +209,13 @@ public:
|
|||||||
/**
|
/**
|
||||||
\return the inset pointer if x,y is covering that inset
|
\return the inset pointer if x,y is covering that inset
|
||||||
\param x,y are absolute screen coordinates.
|
\param x,y are absolute screen coordinates.
|
||||||
\param assert_in_view if true the cursor will be set on a row
|
|
||||||
that is completely visible
|
|
||||||
\param up whether we are going up or down (only used when
|
|
||||||
assert_in_view is true
|
|
||||||
\retval inset is null if the cursor is positioned over normal
|
\retval inset is null if the cursor is positioned over normal
|
||||||
text in the current Text object. Otherwise it is the inset
|
text in the current Text object. Otherwise it is the inset
|
||||||
that the cursor points to, like for Inset::editXY.
|
that the cursor points to, like for Inset::editXY.
|
||||||
*/
|
*/
|
||||||
/// FIXME: cleanup to use BufferView::getCoveringInset() and
|
/// FIXME: cleanup to use BufferView::getCoveringInset() and
|
||||||
/// setCursorFromCoordinates() instead of checkInsetHit().
|
/// setCursorFromCoordinates() instead of checkInsetHit().
|
||||||
Inset * editXY(Cursor & cur, int x, int y,
|
Inset * editXY(Cursor & cur, int x, int y);
|
||||||
bool assert_in_view = false, bool up = true);
|
|
||||||
|
|
||||||
/// sets cursor only within this Text.
|
/// sets cursor only within this Text.
|
||||||
/// x,y are screen coordinates
|
/// x,y are screen coordinates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user