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
This commit is contained in:
Jürgen Vigna 2001-03-23 15:48:19 +00:00
parent ce07524d36
commit b8fd45fd39
6 changed files with 53 additions and 24 deletions

View 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

View 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);
}
}

View 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);

View 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);

View File

@ -290,5 +290,7 @@ private:
LyXParagraph * old_par;
/// The cache.
mutable Cache cache;
///
mutable int last_drawn_width;
};
#endif

View 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);