InsetText/Tabular fixes (buglist from SF.NET)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2085 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-06-01 15:10:26 +00:00
parent d963398763
commit e06bc73c22
7 changed files with 65 additions and 24 deletions

View File

@ -1835,7 +1835,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
if (!lt->selection.mark())
beforeChange(lt);
update(lt, BufferView::SELECT|BufferView::FITCUR);
LyXCursor const & cur = lt->cursor;
LyXCursor const cur = lt->cursor;
if (!is_rtl)
lt->CursorLeft(bv_, false);
if ((is_rtl || cur != lt->cursor) && // only if really moved!

View File

@ -1,3 +1,14 @@
2001-06-01 Juergen Vigna <jug@sad.it>
* lyxfunc.C (Dispatch): LFUN_PREFIX don't call the update if we're
inside a LockingInset (is the update needed at all?).
2001-05-31 Juergen Vigna <jug@sad.it>
* BufferView_pimpl.C (Dispatch): we need a new instanze of cursor
here not the old one otherwise how should we compare it afterwards
if it's the same!
2001-06-01 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lyxfont.C:

View File

@ -1,3 +1,16 @@
2001-06-01 Juergen Vigna <jug@sad.it>
* insettabular.C (resetPos): small hack so that scroll is not set to
0 when we are in the last column of a tabular. This is a problem we
have because of constats 20 offset on both directions, so this can
cause on the limit an endless loop.
* insettext.C (SetFont): forgot that we can have locking insets ;)
2001-05-31 Juergen Vigna <jug@sad.it>
* insettabular.C (LocalDispatch): small fix for LFUN_TAB.
2001-05-31 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* figinset.C: add using std:: directive for the C functions which

View File

@ -577,10 +577,12 @@ bool InsetTabular::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset,
if (the_locking_inset == inset) {
the_locking_inset->InsetUnlock(bv);
the_locking_inset = 0;
#warning fix scrolling when cellinset has requested a scroll (Jug)!!!
#if 0
if (scroll(false))
scroll(bv, 0.0F);
else
UpdateLocal(bv, CELL, false);
#endif
UpdateLocal(bv, CELL, false);
ShowInsetCursor(bv, false);
return true;
}
@ -782,7 +784,7 @@ InsetTabular::LocalDispatch(BufferView * bv,
case LFUN_SHIFT_TAB:
case LFUN_TAB:
{
if (GetFirstLockingInsetOfType(Inset::TABULAR_CODE))
if (GetFirstLockingInsetOfType(Inset::TABULAR_CODE) != this)
break;
HideInsetCursor(bv);
if (the_locking_inset) {
@ -1282,11 +1284,14 @@ void InsetTabular::resetPos(BufferView * bv) const
new_x += offset;
cursor.x(new_x);
// cursor.x(getCellXPos(actcell) + offset);
if (scroll(false) && (tabular->GetWidthOfTabular() < bv->workWidth()-20)) {
if ((actcol < tabular->columns()-1) && scroll(false) &&
(tabular->GetWidthOfTabular() < bv->workWidth()-20))
{
scroll(bv, 0.0F);
UpdateLocal(bv, FULL, false);
} else if (the_locking_inset &&
(tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20)) {
(tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20))
{
int xx = cursor.x() - offset + bv->text->GetRealCursorX(bv);
if (xx > (bv->workWidth()-20)) {
scroll(bv, -(xx - bv->workWidth() + 60));

View File

@ -284,21 +284,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
((need_update&(INIT|FULL)) || (top_baseline!=baseline) ||
(last_drawn_width!=insetWidth)))
{
int w = insetWidth;
int h = insetAscent + insetDescent;
int ty = baseline - insetAscent;
if (ty < 0) {
h += ty;
ty = 0;
}
if ((ty + h) > pain.paperHeight())
h = pain.paperHeight();
if ((top_x + drawTextXOffset + w) > pain.paperWidth())
w = pain.paperWidth();
pain.fillRectangle(top_x+drawTextXOffset, ty, w, h);
cleared = true;
need_update = FULL;
clearInset(pain, baseline, cleared);
}
if (cleared)
frame_is_visible = false;
@ -315,7 +301,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
}
top_x = int(x);
#if 1
cleared = true;
clearInset(pain, baseline, cleared);
#else
return;
#endif
@ -1394,6 +1380,10 @@ std::vector<string> const InsetText::getLabelList() const
void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall,
bool selectall)
{
if (the_locking_inset) {
the_locking_inset->SetFont(bv, font, toggleall, selectall);
return;
}
if (TEXT(bv)->selection.set()) {
bv->text->SetUndo(bv->buffer(), Undo::EDIT,
bv->text->cursor.par()->previous(),
@ -1761,6 +1751,24 @@ void InsetText::clearSelection(BufferView * bv)
TEXT(bv)->ClearSelection(bv);
}
void InsetText::clearInset(Painter & pain, int baseline, bool & cleared) const
{
int w = insetWidth;
int h = insetAscent + insetDescent;
int ty = baseline - insetAscent;
if (ty < 0) {
h += ty;
ty = 0;
}
if ((ty + h) > pain.paperHeight())
h = pain.paperHeight();
if ((top_x + drawTextXOffset + w) > pain.paperWidth())
w = pain.paperWidth();
pain.fillRectangle(top_x+drawTextXOffset, ty, w, h);
cleared = true;
need_update = FULL;
}
/* Emacs:
* Local variables:
* tab-width: 4

View File

@ -275,6 +275,7 @@ private:
void drawFrame(Painter &, bool cleared) const;
void clearFrame(Painter &, bool cleared) const;
///
void clearInset(Painter &, int baseline, bool & cleared) const;
/* Private structures and variables */
///

View File

@ -710,7 +710,10 @@ string const LyXFunc::Dispatch(int ac,
}
return string();
case LFUN_DOWN:
TEXT()->CursorDown(owner->view());
if (TEXT()->cursor.row()->next())
TEXT()->CursorDown(owner->view());
else
TEXT()->CursorRight(owner->view());
moveCursorUpdate(true, false);
owner->showState();
return string();
@ -794,7 +797,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_PREFIX:
{
if (owner->view()->available()) {
if (owner->view()->available() && !owner->view()->theLockingInset()) {
owner->view()->update(TEXT(),
BufferView::SELECT|BufferView::FITCUR);
}