From: Jürgen Vigna Date: Tue, 8 Jan 2002 16:07:07 +0000 (+0000) Subject: Fixed getMaxWidth() in insetminipage if the width is a percentage and fixed X-Git-Tag: 1.6.10~20067 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=dca91cf463150d8ace1f828dc73b7c4058636585;p=features.git Fixed getMaxWidth() in insetminipage if the width is a percentage and fixed insetButtonRelease in insettabular. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3319 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index db17dd44dd..7f0b03211f 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,5 +1,11 @@ 2002-01-08 Juergen Vigna + * 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. diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 069cd6958c..71487a4905 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -327,13 +327,29 @@ bool InsetMinipage::showInsetDialog(BufferView * bv) const int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const { + if (owner() && + (static_cast(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); diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 2b8125df35..d04a9423e0 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -796,7 +796,8 @@ bool InsetTabular::insetButtonRelease(BufferView * bv, { 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;