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
This commit is contained in:
Jürgen Vigna 2002-01-08 16:07:07 +00:00
parent dde058d322
commit dca91cf463
3 changed files with 29 additions and 6 deletions

View File

@ -1,5 +1,11 @@
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.

View File

@ -327,13 +327,29 @@ bool InsetMinipage::showInsetDialog(BufferView * bv) const
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);

View File

@ -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;