From b8fd45fd39f73f94f9c4d0f75473df45d9dccdbe Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Fri, 23 Mar 2001 15:48:19 +0000 Subject: [PATCH] Some small fixes and the mouse now works for minipages again. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1814 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 4 ++++ src/insets/insetcollapsable.C | 12 +++++++--- src/insets/insettabular.C | 42 +++++++++++++++++++++-------------- src/insets/insettext.C | 15 ++++++++++--- src/insets/insettext.h | 2 ++ src/tabular.C | 2 +- 6 files changed, 53 insertions(+), 24 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index cd96552f52..4a01622a01 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,5 +1,9 @@ 2001-03-23 Juergen Vigna + * 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 diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 2802e0507d..847e86642f 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -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); } } diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index a1a4d929b9..e8e33174ef 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -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); diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 6c2c89ec3f..9fa4836a43 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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); diff --git a/src/insets/insettext.h b/src/insets/insettext.h index e14b164512..cbc66e44ac 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -290,5 +290,7 @@ private: LyXParagraph * old_par; /// The cache. mutable Cache cache; + /// + mutable int last_drawn_width; }; #endif diff --git a/src/tabular.C b/src/tabular.C index 04ffe3e040..5f149ce266 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -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); -- 2.39.5