InsetHFill drawing: some other tweaks. There's still a problem with cursor positionning and selection when the hfill is not expanded.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21985 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-05 23:10:11 +00:00
parent 9536a8a651
commit 920c3c3e36
2 changed files with 5 additions and 11 deletions

View File

@ -655,7 +655,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
if (pm.hfillExpansion(row, ii->pos)) 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 ? row.hfill : row.label_hfill);
else else
dim.wid = 0; dim.wid = 3;
// Cache the inset dimension. // Cache the inset dimension.
bv_->coordCache().insets().add(ii->inset, dim); bv_->coordCache().insets().add(ii->inset, dim);
pm.setInsetDimension(ii->inset, dim); pm.setInsetDimension(ii->inset, dim);

View File

@ -54,19 +54,13 @@ void InsetHFill::metrics(MetricsInfo &, Dimension & dim) const
void InsetHFill::draw(PainterInfo & pi, int x, int y) const void InsetHFill::draw(PainterInfo & pi, int x, int y) const
{ {
Dimension const dim = Inset::dimension(*pi.base.bv); Dimension const dim = Inset::dimension(*pi.base.bv);
x += 1; int const x0 = x + 1;
int const x1 = x + dim.wid - 2;
int const y0 = y + dim.des; int const y0 = y + dim.des;
int const y1 = y - dim.asc; int const y1 = y - dim.asc;
pi.pain.line(x, y1, x, y0, Color_added_space); pi.pain.line(x0, y1, x0, y0, Color_added_space);
if (dim.wid == 0) pi.pain.line(x0, y, x1, y, Color_added_space,
// The HFill is not expanded.
return;
int const x1 = x + dim.wid - 2;
pi.pain.line(x, y, x1, y, Color_added_space,
frontend::Painter::line_onoffdash); frontend::Painter::line_onoffdash);
pi.pain.line(x1, y1, x1, y0, Color_added_space); pi.pain.line(x1, y1, x1, y0, Color_added_space);
} }