return -1;
int w = GetMaxWidthOfCell(pain, cell);
if (w > 0)
- // because the inset then subtracts it's top_x
- w += inset->x();
+ // because the inset then subtracts it's top_x and owner->x()
+ w += (inset->x() - top_x);
return w;
}
int InsetText::textWidth(Painter & pain) const
{
int w = getMaxWidth(pain, this);
- if (w < 0) {
- return w;
- }
- if (owner()) {
- w = w - top_x + owner()->x();
- return w;
- }
- w -= (2 * TEXT_TO_INSET_OFFSET);
- return w - top_x;
+ return w;
}
int InsetText::getMaxWidth(Painter & pain, UpdatableInset const * inset) const
{
int w = UpdatableInset::getMaxWidth(pain, inset);
- if (w < 0)
+ if (w < 0) {
+ return w;
+ }
+ if (owner()) {
+ w = w - top_x + owner()->x();
return w;
- return w - (2*TEXT_TO_INSET_OFFSET);
+ }
+ w -= (2 * TEXT_TO_INSET_OFFSET);
+ return w - top_x;
+// return w - (2*TEXT_TO_INSET_OFFSET);
}