}
-ParagraphMetrics const & TextMetrics::parMetrics(pit_type pit) const
-{
- return const_cast<TextMetrics *>(this)->parMetrics(pit, true);
-}
-
-
-
pair<pit_type, ParagraphMetrics const *> TextMetrics::first() const
{
ParMetricsCache::const_iterator it = par_metrics_.begin();
}
+bool TextMetrics::isLastRow(Row const & row) const
+{
+ ParagraphList const & pars = text_->paragraphs();
+ return row.endpos() >= pars[row.pit()].size()
+ && row.pit() + 1 == pit_type(pars.size());
+}
+
+
+bool TextMetrics::isFirstRow(Row const & row) const
+{
+ return row.pos() == 0 && row.pit() == 0;
+}
+
+
ParagraphMetrics & TextMetrics::parMetrics(pit_type pit, bool redo)
{
ParMetricsCache::iterator pmc_it = par_metrics_.find(pit);
}
+ParagraphMetrics const & TextMetrics::parMetrics(pit_type pit) const
+{
+ return const_cast<TextMetrics *>(this)->parMetrics(pit, true);
+}
+
+
+void TextMetrics::newParMetricsDown()
+{
+ pair<pit_type, ParagraphMetrics> const & last = *par_metrics_.rbegin();
+ pit_type const pit = last.first + 1;
+ if (pit == int(text_->paragraphs().size()))
+ return;
+
+ // do it and update its position.
+ redoParagraph(pit);
+ par_metrics_[pit].setPosition(last.second.position()
+ + last.second.descent() + par_metrics_[pit].ascent());
+ updatePosCache(pit);
+}
+
+
+void TextMetrics::newParMetricsUp()
+{
+ pair<pit_type, ParagraphMetrics> const & first = *par_metrics_.begin();
+ if (first.first == 0)
+ return;
+
+ pit_type const pit = first.first - 1;
+ // do it and update its position.
+ redoParagraph(pit);
+ par_metrics_[pit].setPosition(first.second.position()
+ - first.second.ascent() - par_metrics_[pit].descent());
+ updatePosCache(pit);
+}
+
+
bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width,
bool const expand_on_multipars)
{
}
-void TextMetrics::newParMetricsDown()
-{
- pair<pit_type, ParagraphMetrics> const & last = *par_metrics_.rbegin();
- pit_type const pit = last.first + 1;
- if (pit == int(text_->paragraphs().size()))
- return;
-
- // do it and update its position.
- redoParagraph(pit);
- par_metrics_[pit].setPosition(last.second.position()
- + last.second.descent() + par_metrics_[pit].ascent());
- updatePosCache(pit);
-}
-
-
-void TextMetrics::newParMetricsUp()
-{
- pair<pit_type, ParagraphMetrics> const & first = *par_metrics_.begin();
- if (first.first == 0)
- return;
-
- pit_type const pit = first.first - 1;
- // do it and update its position.
- redoParagraph(pit);
- par_metrics_[pit].setPosition(first.second.position()
- - first.second.ascent() - par_metrics_[pit].descent());
- updatePosCache(pit);
-}
-
// y is screen coordinate
pit_type TextMetrics::getPitNearY(int y)
{
}
-bool TextMetrics::isLastRow(Row const & row) const
-{
- ParagraphList const & pars = text_->paragraphs();
- return row.endpos() >= pars[row.pit()].size()
- && row.pit() + 1 == pit_type(pars.size());
-}
-
-
-bool TextMetrics::isFirstRow(Row const & row) const
-{
- return row.pos() == 0 && row.pit() == 0;
-}
-
-
int TextMetrics::leftMargin(pit_type pit) const
{
return leftMargin(pit, text_->paragraphs()[pit].size());
///
bool contains(pit_type pit) const;
///
- ParagraphMetrics const & parMetrics(pit_type) const;
- ///
std::pair<pit_type, ParagraphMetrics const *> first() const;
///
std::pair<pit_type, ParagraphMetrics const *> last() const;
+ /// is this row the last in the text?
+ bool isLastRow(Row const & row) const;
+ /// is this row the first in the text?
+ bool isFirstRow(Row const & row) const;
///
Dimension const & dim() const { return dim_; }
Point const & origin() const { return origin_; }
- /// compute text metrics.
- bool metrics(MetricsInfo & mi, Dimension & dim, int min_width = 0,
- bool const expand_on_multipars = true);
-
+ ///
+ ParagraphMetrics const & parMetrics(pit_type) const;
///
void newParMetricsDown();
///
void newParMetricsUp();
+ /// compute text metrics.
+ bool metrics(MetricsInfo & mi, Dimension & dim, int min_width = 0,
+ bool const expand_on_multipars = true);
+
/// The "nodraw" drawing stage for one single paragraph: set the
/// positions of the insets contained this paragraph in metrics
/// cache. Related to BufferView::updatePosCache.
///
void deleteLineForward(Cursor & cur);
- /// is this row the last in the text?
- bool isLastRow(Row const & row) const;
- /// is this row the first in the text?
- bool isFirstRow(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.