mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Transfer metrics and screen related methods from Text to TextMetrics.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19995 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
502b048246
commit
cb796d31b0
13
src/Text.cpp
13
src/Text.cpp
@ -1160,19 +1160,6 @@ bool Text::dissolveInset(Cursor & cur) {
|
||||
}
|
||||
|
||||
|
||||
bool Text::isLastRow(pit_type pit, Row const & row) const
|
||||
{
|
||||
return row.endpos() >= pars_[pit].size()
|
||||
&& pit + 1 == pit_type(paragraphs().size());
|
||||
}
|
||||
|
||||
|
||||
bool Text::isFirstRow(pit_type pit, Row const & row) const
|
||||
{
|
||||
return row.pos() == 0 && pit == 0;
|
||||
}
|
||||
|
||||
|
||||
void Text::getWord(CursorSlice & from, CursorSlice & to,
|
||||
word_location const loc)
|
||||
{
|
||||
|
@ -256,13 +256,6 @@ public:
|
||||
/// return true if this is the main text
|
||||
bool isMainText(Buffer const &) const;
|
||||
|
||||
/// is this row the last in the text?
|
||||
/// FIXME: move to TextMetrics.
|
||||
bool isLastRow(pit_type pit, Row const & row) const;
|
||||
/// is this row the first in the text?
|
||||
/// FIXME: move to TextMetrics.
|
||||
bool isFirstRow(pit_type pit, Row const & row) const;
|
||||
|
||||
///
|
||||
double spacing(Buffer const & buffer, Paragraph const & par) const;
|
||||
/// make a suggestion for a label
|
||||
|
@ -1457,6 +1457,20 @@ void TextMetrics::deleteLineForward(Cursor & cur)
|
||||
}
|
||||
|
||||
|
||||
bool TextMetrics::isLastRow(pit_type pit, Row const & row) const
|
||||
{
|
||||
ParagraphList const & pars = text_->paragraphs();
|
||||
return row.endpos() >= pars[pit].size()
|
||||
&& pit + 1 == pit_type(pars.size());
|
||||
}
|
||||
|
||||
|
||||
bool TextMetrics::isFirstRow(pit_type pit, Row const & row) const
|
||||
{
|
||||
return row.pos() == 0 && pit == 0;
|
||||
}
|
||||
|
||||
|
||||
int TextMetrics::leftMargin(int max_width, pit_type pit) const
|
||||
{
|
||||
BOOST_ASSERT(pit >= 0);
|
||||
|
@ -181,6 +181,11 @@ public:
|
||||
///
|
||||
void deleteLineForward(Cursor & cur);
|
||||
|
||||
/// is this row the last in the text?
|
||||
bool isLastRow(pit_type pit, Row const & row) const;
|
||||
/// is this row the first in the text?
|
||||
bool isFirstRow(pit_type pit, Row const & row) const;
|
||||
|
||||
/// Returns an inset if inset was hit, or 0 if not.
|
||||
/// \warning This method is not recursive! It will return the
|
||||
/// outermost inset within this Text.
|
||||
|
@ -389,7 +389,7 @@ void RowPainter::paintChangeBar()
|
||||
if (start == end || !par_.isChanged(start, end))
|
||||
return;
|
||||
|
||||
int const height = text_.isLastRow(pit_, row_)
|
||||
int const height = text_metrics_.isLastRow(pit_, row_)
|
||||
? row_.ascent()
|
||||
: row_.height();
|
||||
|
||||
@ -421,7 +421,7 @@ void RowPainter::paintDepthBar()
|
||||
return;
|
||||
|
||||
depth_type prev_depth = 0;
|
||||
if (!text_.isFirstRow(pit_, row_)) {
|
||||
if (!text_metrics_.isFirstRow(pit_, row_)) {
|
||||
pit_type pit2 = pit_;
|
||||
if (row_.pos() == 0)
|
||||
--pit2;
|
||||
@ -429,7 +429,7 @@ void RowPainter::paintDepthBar()
|
||||
}
|
||||
|
||||
depth_type next_depth = 0;
|
||||
if (!text_.isLastRow(pit_, row_)) {
|
||||
if (!text_metrics_.isLastRow(pit_, row_)) {
|
||||
pit_type pit2 = pit_;
|
||||
if (row_.endpos() >= pars_[pit2].size())
|
||||
++pit2;
|
||||
|
Loading…
Reference in New Issue
Block a user