Gather ParagraphMetrics initialization in ParagraphMetrics::reset().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19833 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-08-27 14:04:46 +00:00
parent aa5c8a844f
commit b3b6f44755
3 changed files with 13 additions and 6 deletions

View File

@ -88,6 +88,14 @@ ParagraphMetrics & ParagraphMetrics::operator=(
}
void ParagraphMetrics::reset(Paragraph const & par)
{
par_ = ∥
dim_ = Dimension();
rows_.clear();
}
size_type ParagraphMetrics::calculateRowSignature(Row const & row)
{
boost::crc_32_type crc;

View File

@ -45,6 +45,8 @@ public:
/// \c updateRowChangeStatus() in TextMetrics::redoParagraph().
ParagraphMetrics & operator=(ParagraphMetrics const &);
void reset(Paragraph const & par);
///
Row & getRow(pos_type pos, bool boundary);
///

View File

@ -184,13 +184,13 @@ int TextMetrics::rightMargin(pit_type const pit) const
bool TextMetrics::redoParagraph(pit_type const pit)
{
Paragraph & par = text_->getPar(pit);
// IMPORTANT NOTE: We pass 'false' explicitely in order to not call
// redoParagraph() recursively inside parMetrics.
Dimension old_dim = parMetrics(pit, false).dim();
ParagraphMetrics & pm = par_metrics_[pit];
// reinitialize paragraph dimension.
pm.dim() = Dimension();
Paragraph & par = text_->getPar(pit);
pm.reset(par);
Buffer & buffer = bv_->buffer();
main_text_ = (text_ == &buffer.text());
bool changed = false;
@ -230,9 +230,6 @@ bool TextMetrics::redoParagraph(pit_type const pit)
changed |= ii->inset->metrics(mi, dim);
}
// rebreak the paragraph
pm.rows().clear();
par.setBeginOfBody();
pos_type z = 0;
// maximum pixel width of a row