]> git.lyx.org Git - features.git/commitdiff
Some small fixes and the mouse now works for minipages again.
authorJürgen Vigna <jug@sad.it>
Fri, 23 Mar 2001 15:48:19 +0000 (15:48 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 23 Mar 2001 15:48:19 +0000 (15:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1814 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetcollapsable.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettext.h
src/tabular.C

index cd96552f526f7f45b56d15ff7209bda8e162818c..4a01622a01e5caec5f0ac3ff59aea73e5e6bf749 100644 (file)
@@ -1,5 +1,9 @@
 2001-03-23  Juergen Vigna  <jug@sad.it>
 
+       * insetcollapsable.C (InsetMotionNotify):
+       (InsetButtonRelease): 
+       (InsetButtonPress): fixed y-offset (minipages).
+
        * insettext.C (draw): force a FULL update if cleared == true.
 
        * insetcollapsable.C (draw): Lars forgotten entry for changing this
index 2802e0507d64b53bb3ed1dbdeac1b054aa4fd37e..847e86642fa9b1d955a3d205d05062761945eaff 100644 (file)
@@ -251,7 +251,9 @@ void InsetCollapsable::InsetUnlock(BufferView * bv)
 void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button)
 {
     if (!collapsed && (x >= button_length)) {
-       inset->InsetButtonPress(bv, x - widthCollapsed, y, button);
+       inset->InsetButtonPress(bv, x - widthCollapsed,
+                               y + (top_baseline - inset->y()),
+                               button);
     }
 }
 
@@ -271,7 +273,9 @@ void InsetCollapsable::InsetButtonRelease(BufferView * bv,
            bv->updateInset(this, false);
        }
     } else if (!collapsed && (x >= button_length) && (y >= button_top_y)) {
-       inset->InsetButtonRelease(bv, x - widthCollapsed, y, button);
+       inset->InsetButtonRelease(bv, x - widthCollapsed,
+                                 y + (top_baseline - inset->y()),
+                                 button);
     }
 }
 
@@ -280,7 +284,9 @@ void InsetCollapsable::InsetMotionNotify(BufferView * bv,
                                         int x, int y, int state)
 {
     if (x >= button_length) {
-       inset->InsetMotionNotify(bv, x-widthCollapsed, y, state);
+       inset->InsetMotionNotify(bv, x-widthCollapsed,
+                                y + (top_baseline - inset->y()),
+                                state);
     }
 }
 
index a1a4d929b96ad4cef759e3ac4056897d106311a3..e8e33174ef1fbac17ced72810b5bb05eee889883 100644 (file)
@@ -740,6 +740,31 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv,
     if ((action < 0) && arg.empty())
         return FINISHED;
 
+    bool hs = hasSelection();
+
+    result=DISPATCHED;
+    // this one have priority over the locked InsetText!
+    switch (action) {
+    case LFUN_SHIFT_TAB:
+    case LFUN_TAB:
+    {
+       HideInsetCursor(bv);
+       if (the_locking_inset) {
+           UnlockInsetInInset(bv, the_locking_inset);
+           the_locking_inset = 0;
+       }
+       if (action == LFUN_TAB)
+           moveNextCell(bv, old_locking_inset != 0);
+       else
+           movePrevCell(bv, old_locking_inset != 0);
+       sel_cell_start = sel_cell_end = actcell;
+       if (hs)
+           UpdateLocal(bv, SELECTION, false);
+       ShowInsetCursor(bv);
+       return result;
+    }
+    }
+
     if (the_locking_inset) {
         result=the_locking_inset->LocalDispatch(bv, action, arg);
        if (result == DISPATCHED_NOUPDATE) {
@@ -760,7 +785,6 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv,
        }
     }
 
-    bool hs = hasSelection();
     HideInsetCursor(bv);
     result=DISPATCHED;
     switch (action) {
@@ -874,22 +898,6 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv,
        break;
     case LFUN_END:
        break;
-    case LFUN_SHIFT_TAB:
-    case LFUN_TAB:
-    {
-       if (the_locking_inset) {
-           UnlockInsetInInset(bv, the_locking_inset);
-           the_locking_inset = 0;
-       }
-       if (action == LFUN_TAB)
-           moveNextCell(bv, old_locking_inset != 0);
-       else
-           movePrevCell(bv, old_locking_inset != 0);
-       sel_cell_start = sel_cell_end = actcell;
-       if (hs)
-           UpdateLocal(bv, SELECTION, false);
-       break;
-    }
     case LFUN_LAYOUT_TABULAR:
     {
        bv->owner()->getDialogs()->showTabular(this);
index 6c2c89ec3f60f029cfe29f4460cfbaef7201e321..9fa4836a43a7ac0af09264597fb4024c3ecb1edf 100644 (file)
@@ -109,6 +109,7 @@ void InsetText::init(InsetText const * ins)
     frame_color = LColor::insetframe;
     locked = false;
     old_par = 0;
+    last_drawn_width = -1;
 }
 
 
@@ -323,9 +324,15 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
     xpos = x;
     UpdatableInset::draw(bv, f, baseline, x, cleared);
 
+    // update insetWidth and insetHeight with dummy calls
+    (void)ascent(bv, f);
+    (void)descent(bv, f);
+    (void)width(bv, f);
+
     // if top_x differs we have a rule down and we don't have to clear anything
     if (!cleared && (top_x == int(x)) &&
-       ((need_update==INIT)||(need_update==FULL)||(top_baseline!=baseline)))
+       ((need_update==INIT)||(need_update==FULL)||(top_baseline!=baseline)||
+        (last_drawn_width!=insetWidth)))
     {
        int w =  insetWidth;
        int h = insetAscent + insetDescent;
@@ -352,8 +359,10 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
        bv->text->status = LyXText::CHANGED_IN_DRAW;
        return;
     }
-    if (cleared)
-       need_update = FULL;
+    if (cleared || (last_drawn_width != insetWidth)) {
+       need_update |= FULL;
+       last_drawn_width = insetWidth;
+    }
 
     top_baseline = baseline;
     top_y = baseline - ascent(bv, f);
index e14b164512f986c46b8e1488b13b79060a3fadb1..cbc66e44ac3453aa319fdd2951d3e1a53cd8b1ec 100644 (file)
@@ -290,5 +290,7 @@ private:
     LyXParagraph * old_par;
     /// The cache.
     mutable Cache cache;
+    ///
+    mutable int last_drawn_width;
 };
 #endif
index 04ffe3e04089ea361175fcebff6b1b4d04d29397..5f149ce2660bc1ca72a7eee90ba8133aefd410f0 100644 (file)
@@ -2556,7 +2556,7 @@ void LyXTabular::Validate(LaTeXFeatures & features) const
         features.longtable = true;
     if (NeedRotating())
        features.rotating = true;
-    for (int cell = 0; cell < numberofcells; ++cell) {
+    for (int cell = 0; !features.array && (cell < numberofcells); ++cell) {
        if (GetVAlignment(cell) != LYX_VALIGN_TOP)
            features.array = true;
        GetCellInset(cell)->Validate(features);