]> git.lyx.org Git - features.git/commitdiff
Fixed getMaxWidth() in insetminipage if the width is a percentage and fixed
authorJürgen Vigna <jug@sad.it>
Tue, 8 Jan 2002 16:07:07 +0000 (16:07 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 8 Jan 2002 16:07:07 +0000 (16:07 +0000)
insetButtonRelease in insettabular.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3319 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetminipage.C
src/insets/insettabular.C

index db17dd44dd89a2273124b58ce0eb3be792cd14e2..7f0b03211fa4078a82c86f4e726276cd831d273f 100644 (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.
index 069cd6958c2764afa2ee7794cd0582d6d9f2935a..71487a4905cf2d3a539a7bd95397d107d6afa4af 100644 (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);
index 2b8125df35b60efea724ddc4caf86afd05719c42..d04a9423e0e1d7f78c9df8c447fb1f17c593062b 100644 (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;