2002-01-08 Juergen Vigna <jug@sad.it>
+ * insettabular.C (insetButtonRelease): now this should work too
+ correctly.
+
+ * insetminipage.C (getMaxWidth): fixed for minipage inside insets and
+ if the width is a percentage.
+
* inset.h: added isChar() function and implemented this for
insetspecialchar insetquotes and insetlatexaccent.
added forceDefaultParagraphs() and implemented it for insettabular.
int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
const
{
+ if (owner() &&
+ (static_cast<UpdatableInset*>(owner())->getMaxWidth(bv, inset) < 0))
+ {
+ return -1;
+ }
if (!width_.empty()) {
- int ww1 = VSpace(width_).inPixels(bv);
- int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
- if (ww2 > 0 && ww2 < ww1) {
- return ww2;
+ LyXLength len(width_);
+ switch(len.unit()) {
+ case LyXLength::PW: // Always % of workarea
+ case LyXLength::PE:
+ case LyXLength::PP:
+ case LyXLength::PL:
+ return (InsetCollapsable::getMaxWidth(bv, inset) * (int)len.value()) / 100;
+ default:
+ {
+ int ww1 = VSpace(width_).inPixels(bv);
+ int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
+ if (ww2 > 0 && ww2 < ww1) {
+ return ww2;
+ }
+ return ww1;
+ }
}
- return ww1;
}
// this should not happen!
return InsetCollapsable::getMaxWidth(bv, inset);
{
bool ret = false;
if (the_locking_inset)
- ret = the_locking_inset->insetButtonRelease(bv, x, y, button);
+ ret = the_locking_inset->insetButtonRelease(bv, x - inset_x,
+ y - inset_y, button);
if (button == 3 && !ret) {
bv->owner()->getDialogs()->showTabular(this);
return true;