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.selHandle(false);
|
||||
|
||||
d->text_metrics_[&buffer_.text()].editXY(cur, p.x, p.y,
|
||||
false, act == LFUN_SCREEN_UP);
|
||||
d->text_metrics_[&buffer_.text()].editXY(cur, p.x, p.y);
|
||||
//FIXME: what to do with cur.x_target()?
|
||||
bool update = in_texted && cur.bv().checkDepm(cur, old);
|
||||
cur.finishUndo();
|
||||
|
@ -1515,8 +1515,7 @@ pit_type TextMetrics::getPitNearY(int y)
|
||||
}
|
||||
|
||||
|
||||
Row const & TextMetrics::getPitAndRowNearY(int & y, pit_type & pit,
|
||||
bool assert_in_view, bool up)
|
||||
Row const & TextMetrics::getRowNearY(int & y, pit_type 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)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// x,y are absolute screen coordinates
|
||||
// sets cursor recursively descending into nested editable insets
|
||||
Inset * TextMetrics::editXY(Cursor & cur, int x, int y,
|
||||
bool assert_in_view, bool up)
|
||||
Inset * TextMetrics::editXY(Cursor & cur, int x, int y)
|
||||
{
|
||||
if (lyxerr.debugging(Debug::WORKAREA)) {
|
||||
LYXERR0("TextMetrics::editXY(cur, " << x << ", " << y << ")");
|
||||
cur.bv().coordCache().dump();
|
||||
}
|
||||
pit_type pit = getPitNearY(y);
|
||||
pit_type const pit = getPitNearY(y);
|
||||
LASSERT(pit != -1, return 0);
|
||||
Row const & row = getPitAndRowNearY(y, pit, assert_in_view, up);
|
||||
Row const & row = getRowNearY(y, pit);
|
||||
cur.pit() = pit;
|
||||
|
||||
// Do we cover an inset?
|
||||
|
@ -195,10 +195,8 @@ public:
|
||||
std::pair<pos_type, bool> getPosNearX(Row const & row, int & x) const;
|
||||
|
||||
/// 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
|
||||
/// that the row is on screen completely; this might change the given pit.
|
||||
Row const & getPitAndRowNearY(int & y, pit_type & pit,
|
||||
bool assert_in_view, bool up);
|
||||
/// (relative to the screen).
|
||||
Row const & getRowNearY(int & y, pit_type pit);
|
||||
|
||||
/// returns the paragraph number closest to screen y-coordinate.
|
||||
/// 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
|
||||
\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
|
||||
text in the current Text object. Otherwise it is the inset
|
||||
that the cursor points to, like for Inset::editXY.
|
||||
*/
|
||||
/// FIXME: cleanup to use BufferView::getCoveringInset() and
|
||||
/// setCursorFromCoordinates() instead of checkInsetHit().
|
||||
Inset * editXY(Cursor & cur, int x, int y,
|
||||
bool assert_in_view = false, bool up = true);
|
||||
Inset * editXY(Cursor & cur, int x, int y);
|
||||
|
||||
/// sets cursor only within this Text.
|
||||
/// x,y are screen coordinates
|
||||
|
Loading…
x
Reference in New Issue
Block a user