Code simplification. We don't need to memorize the current Row hfill anymore.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21987 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-06 08:39:42 +00:00
parent 770c4d41fd
commit eb96d94ce7
3 changed files with 8 additions and 12 deletions

View File

@ -24,13 +24,13 @@ namespace lyx {
Row::Row()
: separator(0), hfill(0), label_hfill(0), x(0),
: separator(0), label_hfill(0), x(0),
sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(0), end_(0)
{}
Row::Row(pos_type pos)
: separator(0), hfill(0), label_hfill(0), x(0),
: separator(0), label_hfill(0), x(0),
sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(pos), end_(0)
{}

View File

@ -68,8 +68,6 @@ public:
/// width of a separator (i.e. space)
double separator;
/// width of hfills in the body
double hfill;
/// width of hfills in the label
double label_hfill;
/// the x position of the row

View File

@ -513,7 +513,6 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
Row & row, int width) const
{
row.label_hfill = 0;
row.hfill = 0;
row.separator = 0;
Buffer & buffer = bv_->buffer();
@ -553,12 +552,11 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
row.label_hfill = labelFill(pit, row) / double(nlh);
}
double hfill = 0;
if (w > 0) {
// are there any hfills in the row?
int const nh = numberOfHfills(par, row);
if (nh) {
if (w > 0)
row.hfill = w / nh;
if (int nh = numberOfHfills(par, row))
hfill = w / double(nh);
// we don't have to look at the alignment if it is ALIGN_LEFT and
// if the row is already larger then the permitted width as then
// we force the LEFT_ALIGN'edness!
@ -653,7 +651,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
continue;
Dimension dim = row.dimension();
if (pm.hfillExpansion(row, ii->pos))
dim.wid = int(ii->pos >= body_pos ? row.hfill : row.label_hfill);
dim.wid = int(ii->pos >= body_pos ? hfill : row.label_hfill);
else
dim.wid = 3;
// Cache the inset dimension.