My patch from yesterday

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6548 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-03-20 14:13:49 +00:00
parent dbd45de02c
commit 26f1a5bfca
15 changed files with 168 additions and 184 deletions

View File

@ -1,3 +1,10 @@
2003-03-20 John Levon <levon@movementarian.org>
* rowpainter.C:
* text.C:
* text2.C: paint cleanups. Inset::update() dropped font
parameter
2003-03-19 John Levon <levon@movementarian.org> 2003-03-19 John Levon <levon@movementarian.org>
* lyxfunc.C: only fitcursor/markDirty if available() * lyxfunc.C: only fitcursor/markDirty if available()

View File

@ -1,3 +1,20 @@
2003-03-20 John Levon <levon@movementarian.org>
* inset.h:
* insetcollapsable.h:
* insetcollapsable.C:
* insetert.h:
* insetert.C:
* insetminipage.C:
* insetminipage.C:
* insettabular.h:
* insettabular.C:
* insettext.h:
* insettext.C: remove spurious font parameter
from update(). Fix drawing of ERT insets inside
insets (bug 966). Remove unused mark_dirty from
tabular's updateLocal()
2003-03-19 John Levon <levon@movementarian.org> 2003-03-19 John Levon <levon@movementarian.org>
* insetfloat.h: * insetfloat.h:

View File

@ -164,7 +164,7 @@ public:
/// ///
virtual void draw(BufferView *, LyXFont const &, int baseline, float & x) const = 0; virtual void draw(BufferView *, LyXFont const &, int baseline, float & x) const = 0;
/// update the inset representation /// update the inset representation
virtual void update(BufferView *, LyXFont const &, bool = false) virtual void update(BufferView *, bool = false)
{} {}
/// what appears in the minibuffer when opening /// what appears in the minibuffer when opening
virtual string const editMessage() const; virtual string const editMessage() const;

View File

@ -46,7 +46,7 @@ class LyXText;
InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed) InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed)
: UpdatableInset(), collapsed_(collapsed), inset(bp), : UpdatableInset(), collapsed_(collapsed), inset(bp),
button_length(0), button_top_y(0), button_bottom_y(0), button_length(0), button_top_y(0), button_bottom_y(0),
need_update(NONE), label("Label"), label("Label"),
#if 0 #if 0
autocollapse(false), autocollapse(false),
#endif #endif
@ -64,7 +64,7 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & in, bool same_id)
: UpdatableInset(in, same_id), collapsed_(in.collapsed_), : UpdatableInset(in, same_id), collapsed_(in.collapsed_),
framecolor(in.framecolor), labelfont(in.labelfont), inset(in.inset), framecolor(in.framecolor), labelfont(in.labelfont), inset(in.inset),
button_length(0), button_top_y(0), button_bottom_y(0), button_length(0), button_top_y(0), button_bottom_y(0),
need_update(NONE), label(in.label), label(in.label),
#if 0 #if 0
autocollapse(in.autocollapse), autocollapse(in.autocollapse),
#endif #endif
@ -167,10 +167,10 @@ int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
if (collapsed_) if (collapsed_)
return width_collapsed(); return width_collapsed();
int widthCollapsed = width_collapsed(); int const collapsed_width = width_collapsed();
int const contents_width = inset.width(bv, font);
return (inset.width(bv, font) > widthCollapsed) ? return max(collapsed_width, contents_width);
inset.width(bv, font) : widthCollapsed;
} }
@ -184,17 +184,11 @@ void InsetCollapsable::draw_collapsed(Painter & pain,
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f, void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x) const int baseline, float & x, bool inlined) const
{ {
lyx::Assert(bv); lyx::Assert(bv);
cache(bv); cache(bv);
if (need_update != NONE) {
const_cast<InsetText *>(&inset)->update(bv, f, true);
bv->text->postChangedInDraw();
need_update = NONE;
return;
}
if (nodraw()) if (nodraw())
return; return;
@ -213,7 +207,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
float old_x = x; float old_x = x;
if (!owner()) if (!owner())
x += static_cast<float>(scroll()); x += scroll();
top_x = int(x); top_x = int(x);
topx_set = true; topx_set = true;
@ -221,10 +215,23 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int const bl = baseline - ascent(bv, f) + ascent_collapsed(); int const bl = baseline - ascent(bv, f) + ascent_collapsed();
draw_collapsed(pain, bl, old_x); if (inlined) {
inset.draw(bv, f, bl + descent_collapsed() + inset.ascent(bv, f), x); inset.draw(bv, f, baseline, x);
if (x < (top_x + button_length + TEXT_TO_INSET_OFFSET)) } else {
x = top_x + button_length + TEXT_TO_INSET_OFFSET; draw_collapsed(pain, bl, old_x);
inset.draw(bv, f, bl + descent_collapsed() + inset.ascent(bv, f), x);
// contained inset may be shorter than the button
if (x < (top_x + button_length + TEXT_TO_INSET_OFFSET))
x = top_x + button_length + TEXT_TO_INSET_OFFSET;
}
}
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x) const
{
// by default, we are not inlined-drawing
draw(bv, f, baseline, x, false);
} }
@ -422,19 +429,18 @@ int InsetCollapsable::getMaxWidth(BufferView * bv,
#endif #endif
void InsetCollapsable::update(BufferView * bv, LyXFont const & font, void InsetCollapsable::update(BufferView * bv, bool reinit)
bool reinit)
{ {
if (in_update) { if (in_update) {
if (reinit && owner()) { if (reinit && owner()) {
owner()->update(bv, font, true); owner()->update(bv, true);
} }
return; return;
} }
in_update = true; in_update = true;
inset.update(bv, font, reinit); inset.update(bv, reinit);
if (reinit && owner()) { if (reinit && owner()) {
owner()->update(bv, font, true); owner()->update(bv, true);
} }
in_update = false; in_update = false;
} }

View File

@ -32,11 +32,6 @@ class LyXCursor;
*/ */
class InsetCollapsable : public UpdatableInset { class InsetCollapsable : public UpdatableInset {
public: public:
///
enum UpdateCodes {
NONE = 0,
FULL
};
/// ///
static int const TEXT_TO_TOP_OFFSET = 2; static int const TEXT_TO_TOP_OFFSET = 2;
/// ///
@ -57,8 +52,11 @@ public:
int width(BufferView *, LyXFont const &) const; int width(BufferView *, LyXFont const &) const;
/// ///
void draw(BufferView *, const LyXFont &, int , float &) const; void draw(BufferView *, const LyXFont &, int , float &) const;
/// draw, either inlined (no button) or collapsed/open
void draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool inlined) const;
/// ///
void update(BufferView *, LyXFont const &, bool =false); void update(BufferView *, bool =false);
/// ///
void edit(BufferView *, int, int, mouse_button::state); void edit(BufferView *, int, int, mouse_button::state);
/// ///
@ -226,7 +224,6 @@ protected:
/// ///
mutable int topx; mutable int topx;
mutable int topbaseline; mutable int topbaseline;
mutable UpdateCodes need_update;
private: private:
/// ///

View File

@ -445,6 +445,9 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
InsetERTMailer::string2params(cmd.argument, status_); InsetERTMailer::string2params(cmd.argument, status_);
status(bv, status_); status(bv, status_);
// FIXME: how on holy earth do you actually get
// this thing to reinit the bloody insettext
// and change the size of this inset !!?!
bv->updateInset(this); bv->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
@ -569,39 +572,7 @@ int InsetERT::width(BufferView * bv, LyXFont const & font) const
void InsetERT::draw(BufferView * bv, LyXFont const & f, void InsetERT::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x) const int baseline, float & x) const
{ {
lyx::Assert(bv); InsetCollapsable::draw(bv, f, baseline, x, inlined());
cache(bv);
Painter & pain = bv->painter();
button_length = width_collapsed();
button_top_y = -ascent(bv, f);
button_bottom_y = -ascent(bv, f) + ascent_collapsed() +
descent_collapsed();
if (!isOpen()) {
draw_collapsed(pain, baseline, x);
return;
}
float old_x = x;
if (!owner())
x += static_cast<float>(scroll());
top_x = int(x);
topx_set = true;
top_baseline = baseline;
int const bl = baseline - ascent(bv, f) + ascent_collapsed();
if (inlined()) {
inset.draw(bv, f, baseline, x);
} else {
draw_collapsed(pain, bl, old_x);
inset.draw(bv, f, bl + descent_collapsed() + inset.ascent(bv, f), x);
}
need_update = NONE;
} }
@ -623,7 +594,6 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
{ {
if (st != status_) { if (st != status_) {
status_ = st; status_ = st;
need_update = FULL;
switch (st) { switch (st) {
case Inlined: case Inlined:
if (bv) if (bv)
@ -706,15 +676,14 @@ int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const
} }
void InsetERT::update(BufferView * bv, LyXFont const & font, void InsetERT::update(BufferView * bv, bool reinit)
bool reinit)
{ {
if (inset.need_update & InsetText::INIT || if (inset.need_update & InsetText::INIT ||
inset.need_update & InsetText::FULL) inset.need_update & InsetText::FULL) {
{
setButtonLabel(); setButtonLabel();
} }
InsetCollapsable::update(bv, font, reinit);
InsetCollapsable::update(bv, reinit);
} }

View File

@ -123,7 +123,7 @@ public:
/// ///
int getMaxWidth(BufferView *, UpdatableInset const *) const; int getMaxWidth(BufferView *, UpdatableInset const *) const;
/// ///
void update(BufferView *, LyXFont const &, bool =false); void update(BufferView *, bool =false);
private: private:
/// ///

View File

@ -117,6 +117,8 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
params_.pos = params.pos; params_.pos = params.pos;
params_.width = params.width; params_.width = params.width;
// FIXME: what magical mysterious commands are actually
// needed here to update the bloody size of the inset !!!
cmd.view()->updateInset(this); cmd.view()->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }

View File

@ -327,7 +327,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
int i = 0; int i = 0;
for(Inset * inset = owner(); inset; ++i) for(Inset * inset = owner(); inset; ++i)
inset = inset->owner(); inset = inset->owner();
if (calculate_dimensions_of_cells(bv, font, false)) if (calculate_dimensions_of_cells(bv, false))
need_update = INIT; need_update = INIT;
} else { } else {
need_update = NONE; need_update = NONE;
@ -397,28 +397,28 @@ void InsetTabular::drawCellSelection(Painter & pain, int x, int baseline,
} }
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit) void InsetTabular::update(BufferView * bv, bool reinit)
{ {
if (in_update) { if (in_update) {
if (reinit) { if (reinit) {
resetPos(bv); resetPos(bv);
if (owner()) if (owner())
owner()->update(bv, font, true); owner()->update(bv, true);
} }
return; return;
} }
in_update = true; in_update = true;
if (reinit) { if (reinit) {
need_update = INIT; need_update = INIT;
if (calculate_dimensions_of_cells(bv, font, true)) if (calculate_dimensions_of_cells(bv, true))
resetPos(bv); resetPos(bv);
if (owner()) if (owner())
owner()->update(bv, font, true); owner()->update(bv, true);
in_update = false; in_update = false;
return; return;
} }
if (the_locking_inset) if (the_locking_inset)
the_locking_inset->update(bv, font, reinit); the_locking_inset->update(bv, reinit);
if (need_update < FULL && if (need_update < FULL &&
bv->text->status() == LyXText::NEED_MORE_REFRESH) bv->text->status() == LyXText::NEED_MORE_REFRESH)
{ {
@ -429,7 +429,7 @@ void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
case INIT: case INIT:
case FULL: case FULL:
case CELL: case CELL:
if (calculate_dimensions_of_cells(bv, font, false)) { if (calculate_dimensions_of_cells(bv, false)) {
need_update = INIT; need_update = INIT;
resetPos(bv); resetPos(bv);
} }
@ -505,7 +505,7 @@ void InsetTabular::insetUnlock(BufferView * bv)
{ {
if (the_locking_inset) { if (the_locking_inset) {
the_locking_inset->insetUnlock(bv); the_locking_inset->insetUnlock(bv);
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
the_locking_inset = 0; the_locking_inset = 0;
} }
hideInsetCursor(bv); hideInsetCursor(bv);
@ -517,17 +517,15 @@ void InsetTabular::insetUnlock(BufferView * bv)
if (scroll(false)) { if (scroll(false)) {
scroll(bv, 0.0F); scroll(bv, 0.0F);
} }
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
} }
} }
void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what, void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what) const
bool mark_dirty) const
{ {
if (what == INIT) { if (what == INIT) {
LyXFont font; calculate_dimensions_of_cells(bv, true);
calculate_dimensions_of_cells(bv, font, true);
} }
if (!locked && what == CELL) if (!locked && what == CELL)
what = FULL; what = FULL;
@ -598,7 +596,7 @@ bool InsetTabular::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
if (scroll(false)) if (scroll(false))
scroll(bv, 0.0F); scroll(bv, 0.0F);
#endif #endif
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
// this has to be here otherwise we don't redraw the cell! // this has to be here otherwise we don't redraw the cell!
the_locking_inset = 0; the_locking_inset = 0;
// showInsetCursor(bv, false); // showInsetCursor(bv, false);
@ -631,7 +629,7 @@ bool InsetTabular::updateInsetInInset(BufferView * bv, Inset * inset)
if (!static_cast<InsetText *>(tl_inset)->updateInsetInInset(bv, inset)) if (!static_cast<InsetText *>(tl_inset)->updateInsetInInset(bv, inset))
return false; return false;
} }
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
return true; return true;
} }
@ -676,7 +674,7 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
if (hasSelection()) { if (hasSelection()) {
clearSelection(); clearSelection();
updateLocal(cmd.view(), SELECTION, false); updateLocal(cmd.view(), SELECTION);
} }
int const ocell = actcell; int const ocell = actcell;
@ -692,13 +690,13 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
} }
setPos(bv, cmd.x, cmd.y); setPos(bv, cmd.x, cmd.y);
if (actrow != orow) if (actrow != orow)
updateLocal(bv, NONE, false); updateLocal(bv, NONE);
clearSelection(); clearSelection();
#if 0 #if 0
if (cmd.button() == mouse_button::button3) { if (cmd.button() == mouse_button::button3) {
if ((ocell != actcell) && the_locking_inset) { if ((ocell != actcell) && the_locking_inset) {
the_locking_inset->insetUnlock(bv); the_locking_inset->insetUnlock(bv);
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
the_locking_inset = 0; the_locking_inset = 0;
} }
showInsetCursor(bv); showInsetCursor(bv);
@ -719,7 +717,7 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
if (the_locking_inset) { if (the_locking_inset) {
the_locking_inset->insetUnlock(bv); the_locking_inset->insetUnlock(bv);
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
the_locking_inset = 0; the_locking_inset = 0;
} }
@ -780,10 +778,10 @@ void InsetTabular::lfunMouseMotion(FuncRequest const & cmd)
setPos(bv, cmd.x, cmd.y); setPos(bv, cmd.x, cmd.y);
if (!hasSelection()) { if (!hasSelection()) {
setSelection(actcell, actcell); setSelection(actcell, actcell);
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
} else if (old_cell != actcell) { } else if (old_cell != actcell) {
setSelection(sel_cell_start, actcell); setSelection(sel_cell_start, actcell);
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
} }
showInsetCursor(bv); showInsetCursor(bv);
} }
@ -833,7 +831,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
movePrevCell(bv, old_locking_inset != 0); movePrevCell(bv, old_locking_inset != 0);
clearSelection(); clearSelection();
if (hs) if (hs)
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
if (!the_locking_inset) { if (!the_locking_inset) {
showInsetCursor(bv); showInsetCursor(bv);
return DISPATCHED_NOUPDATE; return DISPATCHED_NOUPDATE;
@ -854,13 +852,13 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
resetPos(bv); resetPos(bv);
if (sc != scroll()) { // inset has been scrolled if (sc != scroll()) { // inset has been scrolled
the_locking_inset->toggleInsetCursor(bv); the_locking_inset->toggleInsetCursor(bv);
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
the_locking_inset->toggleInsetCursor(bv); the_locking_inset->toggleInsetCursor(bv);
} }
return result; return result;
} else if (result == DISPATCHED) { } else if (result == DISPATCHED) {
the_locking_inset->toggleInsetCursor(bv); the_locking_inset->toggleInsetCursor(bv);
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
the_locking_inset->toggleInsetCursor(bv); the_locking_inset->toggleInsetCursor(bv);
return result; return result;
} else if (result == FINISHED_UP) { } else if (result == FINISHED_UP) {
@ -891,14 +889,14 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
end = actcell; end = actcell;
} }
setSelection(start, end); setSelection(start, end);
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
break; break;
} }
case LFUN_RIGHT: case LFUN_RIGHT:
result = moveRight(bv); result = moveRight(bv);
clearSelection(); clearSelection();
if (hs) if (hs)
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
break; break;
case LFUN_LEFTSEL: { case LFUN_LEFTSEL: {
int const start = hasSelection() ? sel_cell_start : actcell; int const start = hasSelection() ? sel_cell_start : actcell;
@ -915,14 +913,14 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
end = actcell; end = actcell;
} }
setSelection(start, end); setSelection(start, end);
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
break; break;
} }
case LFUN_LEFT: case LFUN_LEFT:
result = moveLeft(bv); result = moveLeft(bv);
clearSelection(); clearSelection();
if (hs) if (hs)
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
break; break;
case LFUN_DOWNSEL: { case LFUN_DOWNSEL: {
int const start = hasSelection() ? sel_cell_start : actcell; int const start = hasSelection() ? sel_cell_start : actcell;
@ -939,14 +937,14 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
} else { } else {
setSelection(start, start); setSelection(start, start);
} }
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
} }
break; break;
case LFUN_DOWN: case LFUN_DOWN:
result = moveDown(bv, old_locking_inset != 0); result = moveDown(bv, old_locking_inset != 0);
clearSelection(); clearSelection();
if (hs) { if (hs) {
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
} }
break; break;
case LFUN_UPSEL: { case LFUN_UPSEL: {
@ -964,14 +962,14 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
} else { } else {
setSelection(start, start); setSelection(start, start);
} }
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
} }
break; break;
case LFUN_UP: case LFUN_UP:
result = moveUp(bv, old_locking_inset != 0); result = moveUp(bv, old_locking_inset != 0);
clearSelection(); clearSelection();
if (hs) if (hs)
updateLocal(bv, SELECTION, false); updateLocal(bv, SELECTION);
break; break;
case LFUN_NEXT: { case LFUN_NEXT: {
UpdateCodes code = CURSOR; UpdateCodes code = CURSOR;
@ -991,7 +989,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
actcell = tabular->GetFirstCellInRow(tabular->rows() - 1) + column; actcell = tabular->GetFirstCellInRow(tabular->rows() - 1) + column;
} }
resetPos(bv); resetPos(bv);
updateLocal(bv, code, false); updateLocal(bv, code);
break; break;
} }
case LFUN_PRIOR: { case LFUN_PRIOR: {
@ -1013,7 +1011,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
actcell = column; actcell = column;
} }
resetPos(bv); resetPos(bv);
updateLocal(bv, code, false); updateLocal(bv, code);
break; break;
} }
// none of these make sense for insettabular, // none of these make sense for insettabular,
@ -1062,7 +1060,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
if (tmpstr.empty()) if (tmpstr.empty())
break; break;
if (insertAsciiString(bv, tmpstr, false)) if (insertAsciiString(bv, tmpstr, false))
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
else else
result = UNDISPATCHED; result = UNDISPATCHED;
break; break;
@ -1077,7 +1075,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
bv->text->cursor.par(), bv->text->cursor.par(),
bv->text->cursor.par()->next()); bv->text->cursor.par()->next());
cutSelection(bv->buffer()->params); cutSelection(bv->buffer()->params);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
case LFUN_COPY: case LFUN_COPY:
if (!hasSelection()) if (!hasSelection())
@ -1162,7 +1160,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
bv->text->cursor.par(), bv->text->cursor.par(),
bv->text->cursor.par()->next()); bv->text->cursor.par()->next());
pasteSelection(bv); pasteSelection(bv);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
} }
// ATTENTION: the function above has to be PASTE and PASTESELECTION!!! // ATTENTION: the function above has to be PASTE and PASTESELECTION!!!
@ -1202,7 +1200,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
unlockInsetInInset(bv, the_locking_inset); unlockInsetInInset(bv, the_locking_inset);
nodraw(false); nodraw(false);
// we need to update if this was requested before // we need to update if this was requested before
updateLocal(bv, NONE, false); updateLocal(bv, NONE);
return UNDISPATCHED; return UNDISPATCHED;
} else if (hs) { } else if (hs) {
clearSelection(); clearSelection();
@ -1211,7 +1209,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
need_update = SELECTION; need_update = SELECTION;
} }
nodraw(false); nodraw(false);
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
return result; return result;
} }
break; break;
@ -1219,7 +1217,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
if (result < FINISHED) { if (result < FINISHED) {
if (!the_locking_inset) { if (!the_locking_inset) {
if (bv->fitCursor()) if (bv->fitCursor())
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
if (locked) if (locked)
showInsetCursor(bv); showInsetCursor(bv);
} }
@ -1290,9 +1288,7 @@ void InsetTabular::validate(LaTeXFeatures & features) const
} }
bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, bool reinit) const
LyXFont const & font,
bool reinit) const
{ {
int cell = -1; int cell = -1;
int maxAsc = 0; int maxAsc = 0;
@ -1300,6 +1296,10 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
InsetText * inset; InsetText * inset;
bool changed = false; bool changed = false;
// FIXME: since InsetText ignores this anyway, it doesn't
// matter what we pass it. Ugly
LyXFont font;
// if we have a locking_inset we should have to check only this cell for // if we have a locking_inset we should have to check only this cell for
// change so I'll try this to have a boost, but who knows ;) // change so I'll try this to have a boost, but who knows ;)
if ((need_update != INIT) && if ((need_update != INIT) &&
@ -1324,7 +1324,7 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
++cell; ++cell;
inset = tabular->GetCellInset(cell); inset = tabular->GetCellInset(cell);
if (!reinit && !tabular->GetPWidth(cell).zero()) if (!reinit && !tabular->GetPWidth(cell).zero())
inset->update(bv, font, false); inset->update(bv, false);
maxAsc = max(maxAsc, inset->ascent(bv, font)); maxAsc = max(maxAsc, inset->ascent(bv, font));
maxDesc = max(maxDesc, inset->descent(bv, font)); maxDesc = max(maxDesc, inset->descent(bv, font));
changed = tabular->SetWidthOfCell(cell, inset->width(bv, font)) || changed; changed = tabular->SetWidthOfCell(cell, inset->width(bv, font)) || changed;
@ -1501,34 +1501,34 @@ void InsetTabular::resetPos(BufferView * bv) const
(tabular->GetWidthOfTabular() < bv->workWidth()-20)) (tabular->GetWidthOfTabular() < bv->workWidth()-20))
{ {
scroll(bv, 0.0F); scroll(bv, 0.0F);
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
} else if (the_locking_inset && } 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(); int xx = cursor_.x() - offset + bv->text->getRealCursorX();
if (xx > (bv->workWidth()-20)) { if (xx > (bv->workWidth()-20)) {
scroll(bv, -(xx - bv->workWidth() + 60)); scroll(bv, -(xx - bv->workWidth() + 60));
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
} else if (xx < 20) { } else if (xx < 20) {
if (xx < 0) if (xx < 0)
xx = -xx + 60; xx = -xx + 60;
else else
xx = 60; xx = 60;
scroll(bv, xx); scroll(bv, xx);
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
} }
} else if ((cursor_.x() - offset) > 20 && } else if ((cursor_.x() - offset) > 20 &&
(cursor_.x() - offset + tabular->GetWidthOfColumn(actcell)) (cursor_.x() - offset + tabular->GetWidthOfColumn(actcell))
> (bv->workWidth() - 20)) { > (bv->workWidth() - 20)) {
scroll(bv, -tabular->GetWidthOfColumn(actcell) - 20); scroll(bv, -tabular->GetWidthOfColumn(actcell) - 20);
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
} else if ((cursor_.x() - offset) < 20) { } else if ((cursor_.x() - offset) < 20) {
scroll(bv, 20 - cursor_.x() + offset); scroll(bv, 20 - cursor_.x() + offset);
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
} else if (scroll() && top_x > 20 && } else if (scroll() && top_x > 20 &&
(top_x + tabular->GetWidthOfTabular()) > (bv->workWidth() - 20)) { (top_x + tabular->GetWidthOfTabular()) > (bv->workWidth() - 20)) {
scroll(bv, old_x - cursor_.x()); scroll(bv, old_x - cursor_.x());
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
} }
if (the_locking_inset) { if (the_locking_inset) {
inset_x = cursor_.x() - top_x + tabular->GetBeginningOfTextInCell(actcell); inset_x = cursor_.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
@ -1706,7 +1706,7 @@ void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall,
unFreezeUndo(); unFreezeUndo();
if (selectall) if (selectall)
clearSelection(); clearSelection();
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
} }
if (the_locking_inset) if (the_locking_inset)
the_locking_inset->setFont(bv, font, tall); the_locking_inset->setFont(bv, font, tall);
@ -1832,7 +1832,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
cell = tabular->GetCellNumber(i,column); cell = tabular->GetCellNumber(i,column);
tabular->GetCellInset(cell)->resizeLyXText(bv); tabular->GetCellInset(cell)->resizeLyXText(bv);
} }
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
} }
if (vallen.zero() if (vallen.zero()
@ -1855,27 +1855,27 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->GetCellInset(tabular->GetCellNumber(i, column))-> tabular->GetCellInset(tabular->GetCellNumber(i, column))->
resizeLyXText(bv); resizeLyXText(bv);
} }
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
} }
} }
break; break;
case LyXTabular::SET_SPECIAL_COLUMN: case LyXTabular::SET_SPECIAL_COLUMN:
case LyXTabular::SET_SPECIAL_MULTI: case LyXTabular::SET_SPECIAL_MULTI:
tabular->SetAlignSpecial(actcell,value,feature); tabular->SetAlignSpecial(actcell,value,feature);
updateLocal(bv, FULL, true); updateLocal(bv, FULL);
break; break;
case LyXTabular::APPEND_ROW: case LyXTabular::APPEND_ROW:
// append the row into the tabular // append the row into the tabular
unlockInsetInInset(bv, the_locking_inset); unlockInsetInInset(bv, the_locking_inset);
tabular->AppendRow(bv->buffer()->params, actcell); tabular->AppendRow(bv->buffer()->params, actcell);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
case LyXTabular::APPEND_COLUMN: case LyXTabular::APPEND_COLUMN:
// append the column into the tabular // append the column into the tabular
unlockInsetInInset(bv, the_locking_inset); unlockInsetInInset(bv, the_locking_inset);
tabular->AppendColumn(bv->buffer()->params, actcell); tabular->AppendColumn(bv->buffer()->params, actcell);
actcell = tabular->GetCellNumber(row, column); actcell = tabular->GetCellNumber(row, column);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
case LyXTabular::DELETE_ROW: case LyXTabular::DELETE_ROW:
unlockInsetInInset(bv, the_locking_inset); unlockInsetInInset(bv, the_locking_inset);
@ -1886,7 +1886,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
--sel_row_start; --sel_row_start;
actcell = tabular->GetCellNumber(sel_row_start, column); actcell = tabular->GetCellNumber(sel_row_start, column);
clearSelection(); clearSelection();
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
case LyXTabular::DELETE_COLUMN: case LyXTabular::DELETE_COLUMN:
unlockInsetInInset(bv, the_locking_inset); unlockInsetInInset(bv, the_locking_inset);
@ -1897,7 +1897,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
--sel_col_start; --sel_col_start;
actcell = tabular->GetCellNumber(row, sel_col_start); actcell = tabular->GetCellNumber(row, sel_col_start);
clearSelection(); clearSelection();
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
case LyXTabular::M_TOGGLE_LINE_TOP: case LyXTabular::M_TOGGLE_LINE_TOP:
flag = false; flag = false;
@ -1909,7 +1909,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->SetTopLine( tabular->SetTopLine(
tabular->GetCellNumber(i, j), tabular->GetCellNumber(i, j),
lineSet, flag); lineSet, flag);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
} }
@ -1924,7 +1924,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->GetCellNumber(i, j), tabular->GetCellNumber(i, j),
lineSet, lineSet,
flag); flag);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
} }
@ -1939,7 +1939,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->GetCellNumber(i,j), tabular->GetCellNumber(i,j),
lineSet, lineSet,
flag); flag);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
} }
@ -1954,7 +1954,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->GetCellNumber(i,j), tabular->GetCellNumber(i,j),
lineSet, lineSet,
flag); flag);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
} }
@ -1972,7 +1972,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->GetCellNumber(i, j), tabular->GetCellNumber(i, j),
setAlign, setAlign,
flag); flag);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
case LyXTabular::M_VALIGN_TOP: case LyXTabular::M_VALIGN_TOP:
case LyXTabular::M_VALIGN_BOTTOM: case LyXTabular::M_VALIGN_BOTTOM:
@ -1986,7 +1986,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->SetVAlignment( tabular->SetVAlignment(
tabular->GetCellNumber(i, j), tabular->GetCellNumber(i, j),
setVAlign, flag); setVAlign, flag);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
case LyXTabular::MULTICOLUMN: case LyXTabular::MULTICOLUMN:
{ {
@ -2001,10 +2001,10 @@ void InsetTabular::tabularFeatures(BufferView * bv,
// check wether we are completly in a multicol // check wether we are completly in a multicol
if (tabular->IsMultiColumn(actcell)) { if (tabular->IsMultiColumn(actcell)) {
tabular->UnsetMultiColumn(actcell); tabular->UnsetMultiColumn(actcell);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
} else { } else {
tabular->SetMultiColumn(bv->buffer(), actcell, 1); tabular->SetMultiColumn(bv->buffer(), actcell, 1);
updateLocal(bv, CELL, true); updateLocal(bv, CELL);
} }
return; return;
} }
@ -2023,7 +2023,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->SetMultiColumn(bv->buffer(), s_start, s_end - s_start + 1); tabular->SetMultiColumn(bv->buffer(), s_start, s_end - s_start + 1);
actcell = s_start; actcell = s_start;
clearSelection(); clearSelection();
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
} }
case LyXTabular::SET_ALL_LINES: case LyXTabular::SET_ALL_LINES:
@ -2033,15 +2033,15 @@ void InsetTabular::tabularFeatures(BufferView * bv,
for (int j = sel_col_start; j <= sel_col_end; ++j) for (int j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetAllLines( tabular->SetAllLines(
tabular->GetCellNumber(i,j), setLines); tabular->GetCellNumber(i,j), setLines);
updateLocal(bv, INIT, true); updateLocal(bv, INIT);
break; break;
case LyXTabular::SET_LONGTABULAR: case LyXTabular::SET_LONGTABULAR:
tabular->SetLongTabular(true); tabular->SetLongTabular(true);
updateLocal(bv, INIT, true); // because this toggles displayed updateLocal(bv, INIT); // because this toggles displayed
break; break;
case LyXTabular::UNSET_LONGTABULAR: case LyXTabular::UNSET_LONGTABULAR:
tabular->SetLongTabular(false); tabular->SetLongTabular(false);
updateLocal(bv, INIT, true); // because this toggles displayed updateLocal(bv, INIT); // because this toggles displayed
break; break;
case LyXTabular::SET_ROTATE_TABULAR: case LyXTabular::SET_ROTATE_TABULAR:
tabular->SetRotateTabular(true); tabular->SetRotateTabular(true);
@ -2129,7 +2129,7 @@ bool InsetTabular::activateCellInset(BufferView * bv, int x, int y, mouse_button
inset->edit(bv, x, y, button); inset->edit(bv, x, y, button);
if (!the_locking_inset) if (!the_locking_inset)
return false; return false;
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
return (the_locking_inset != 0); return (the_locking_inset != 0);
} }
@ -2693,7 +2693,7 @@ bool InsetTabular::nextChange(BufferView * bv, lyx::pos_type & length)
{ {
if (the_locking_inset) { if (the_locking_inset) {
if (the_locking_inset->nextChange(bv, length)) { if (the_locking_inset->nextChange(bv, length)) {
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
return true; return true;
} }
if (tabular->IsLastCell(actcell)) if (tabular->IsLastCell(actcell))
@ -2702,14 +2702,14 @@ bool InsetTabular::nextChange(BufferView * bv, lyx::pos_type & length)
} }
InsetText * inset = tabular->GetCellInset(actcell); InsetText * inset = tabular->GetCellInset(actcell);
if (inset->nextChange(bv, length)) { if (inset->nextChange(bv, length)) {
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
return true; return true;
} }
while (!tabular->IsLastCell(actcell)) { while (!tabular->IsLastCell(actcell)) {
++actcell; ++actcell;
inset = tabular->GetCellInset(actcell); inset = tabular->GetCellInset(actcell);
if (inset->nextChange(bv, length)) { if (inset->nextChange(bv, length)) {
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
return true; return true;
} }
} }
@ -2722,7 +2722,7 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
{ {
if (the_locking_inset) { if (the_locking_inset) {
if (the_locking_inset->searchForward(bv, str, cs, mw)) { if (the_locking_inset->searchForward(bv, str, cs, mw)) {
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
return true; return true;
} }
if (tabular->IsLastCell(actcell)) if (tabular->IsLastCell(actcell))
@ -2731,14 +2731,14 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
} }
InsetText * inset = tabular->GetCellInset(actcell); InsetText * inset = tabular->GetCellInset(actcell);
if (inset->searchForward(bv, str, cs, mw)) { if (inset->searchForward(bv, str, cs, mw)) {
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
return true; return true;
} }
while (!tabular->IsLastCell(actcell)) { while (!tabular->IsLastCell(actcell)) {
++actcell; ++actcell;
inset = tabular->GetCellInset(actcell); inset = tabular->GetCellInset(actcell);
if (inset->searchForward(bv, str, cs, mw)) { if (inset->searchForward(bv, str, cs, mw)) {
updateLocal(bv, FULL, false); updateLocal(bv, FULL);
return true; return true;
} }
} }
@ -2751,7 +2751,7 @@ bool InsetTabular::searchBackward(BufferView * bv, string const & str,
{ {
if (the_locking_inset) { if (the_locking_inset) {
if (the_locking_inset->searchBackward(bv, str, cs, mw)) { if (the_locking_inset->searchBackward(bv, str, cs, mw)) {
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
return true; return true;
} }
} }
@ -2762,7 +2762,7 @@ bool InsetTabular::searchBackward(BufferView * bv, string const & str,
--actcell; --actcell;
InsetText * inset = tabular->GetCellInset(actcell); InsetText * inset = tabular->GetCellInset(actcell);
if (inset->searchBackward(bv, str, cs, mw)) { if (inset->searchBackward(bv, str, cs, mw)) {
updateLocal(bv, CELL, false); updateLocal(bv, CELL);
return true; return true;
} }
} }

View File

@ -94,7 +94,7 @@ public:
/// ///
void draw(BufferView *, const LyXFont &, int , float &) const; void draw(BufferView *, const LyXFont &, int , float &) const;
/// ///
void update(BufferView *, LyXFont const &, bool = false); void update(BufferView *, bool = false);
/// ///
string const editMessage() const; string const editMessage() const;
/// ///
@ -104,7 +104,7 @@ public:
// //
void insetUnlock(BufferView *); void insetUnlock(BufferView *);
/// ///
void updateLocal(BufferView *, UpdateCodes, bool mark_dirty) const; void updateLocal(BufferView *, UpdateCodes) const;
/// ///
bool lockInsetInInset(BufferView *, UpdatableInset *); bool lockInsetInInset(BufferView *, UpdatableInset *);
/// ///
@ -251,8 +251,7 @@ private:
/// ///
void lfunMouseMotion(FuncRequest const &); void lfunMouseMotion(FuncRequest const &);
/// ///
bool calculate_dimensions_of_cells(BufferView *, LyXFont const &, bool calculate_dimensions_of_cells(BufferView *, bool = false) const;
bool = false) const;
/// ///
void drawCellLines(Painter &, int x, int baseline, void drawCellLines(Painter &, int x, int baseline,
int row, int cell) const; int row, int cell) const;

View File

@ -485,12 +485,12 @@ void InsetText::drawFrame(Painter & pain) const
} }
void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit) void InsetText::update(BufferView * bv, bool reinit)
{ {
if (in_update) { if (in_update) {
if (reinit && owner()) { if (reinit && owner()) {
reinitLyXText(); reinitLyXText();
owner()->update(bv, font, true); owner()->update(bv, true);
} }
return; return;
} }
@ -500,7 +500,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
// we should put this call where we set need_update to INIT! // we should put this call where we set need_update to INIT!
reinitLyXText(); reinitLyXText();
if (owner()) if (owner())
owner()->update(bv, font, true); owner()->update(bv, true);
in_update = false; in_update = false;
return; return;
} }
@ -511,7 +511,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
if (the_locking_inset) { if (the_locking_inset) {
inset_x = cix(bv) - top_x + drawTextXOffset; inset_x = cix(bv) - top_x + drawTextXOffset;
inset_y = ciy(bv) + drawTextYOffset; inset_y = ciy(bv) + drawTextYOffset;
the_locking_inset->update(bv, font, reinit); the_locking_inset->update(bv, reinit);
} }
bool clear = false; bool clear = false;
@ -538,7 +538,7 @@ void InsetText::setUpdateStatus(BufferView * bv, int what) const
LyXText * llt = getLyXText(bv); LyXText * llt = getLyXText(bv);
need_update |= what; need_update |= what;
// we have to redraw us full if our LyXText NEEDS_MORE_REFRES or // we have to redraw us full if our LyXText NEED_MORE_REFRESH or
// if we don't break row so that we only have one row to update! // if we don't break row so that we only have one row to update!
if ((llt->status() == LyXText::NEED_MORE_REFRESH) || if ((llt->status() == LyXText::NEED_MORE_REFRESH) ||
(!autoBreakRows && (!autoBreakRows &&
@ -2270,7 +2270,6 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
return; return;
} }
do_resize = 0; do_resize = 0;
// lyxerr << "InsetText::resizeLyXText\n";
if (!paragraphs.begin()->next() && paragraphs.begin()->empty()) { // no data, resize not neccessary! if (!paragraphs.begin()->next() && paragraphs.begin()->empty()) { // no data, resize not neccessary!
// we have to do this as a fixed width may have changed! // we have to do this as a fixed width may have changed!
LyXText * t = getLyXText(bv); LyXText * t = getLyXText(bv);
@ -2323,7 +2322,6 @@ void InsetText::reinitLyXText() const
} }
do_reinit = false; do_reinit = false;
do_resize = 0; do_resize = 0;
// lyxerr << "InsetText::reinitLyXText\n";
for (Cache::iterator it = cache.begin(); it != cache.end(); ++it) { for (Cache::iterator it = cache.begin(); it != cache.end(); ++it) {
lyx::Assert(it->second.text.get()); lyx::Assert(it->second.text.get());

View File

@ -94,7 +94,7 @@ public:
/// ///
void draw(BufferView *, LyXFont const &, int , float &) const; void draw(BufferView *, LyXFont const &, int , float &) const;
/// ///
void update(BufferView *, LyXFont const &, bool = false); void update(BufferView *, bool = false);
/// ///
void setUpdateStatus(BufferView *, int what) const; void setUpdateStatus(BufferView *, int what) const;
/// ///

View File

@ -110,7 +110,9 @@ bool RowPainter::paintInset(pos_type const pos)
LyXFont const & font = getFont(pos); LyXFont const & font = getFont(pos);
inset->update(perv(bv_), font, false); #warning inset->update FIXME
inset->update(perv(bv_), false);
inset->draw(perv(bv_), font, yo_ + row_.baseline(), x_); inset->draw(perv(bv_), font, yo_ + row_.baseline(), x_);
// return true if something changed when we drew an inset // return true if something changed when we drew an inset

View File

@ -283,10 +283,11 @@ int LyXText::singleWidth(Paragraph * par,
return 3; return 3;
} }
#if 1 #if 1
#warning inset->update FIXME
// this IS needed otherwise on initialitation we don't get the fill // this IS needed otherwise on initialitation we don't get the fill
// of the row right (ONLY on initialization if we read a file!) // of the row right (ONLY on initialization if we read a file!)
// should be changed! (Jug 20011204) // should be changed! (Jug 20011204)
tmpinset->update(bv(), font); tmpinset->update(bv());
#endif #endif
return tmpinset->width(bv(), font); return tmpinset->width(bv(), font);
} }
@ -1019,7 +1020,8 @@ void LyXText::setHeightOfRow(Row * row)
tmpinset = row->par()->getInset(pos); tmpinset = row->par()->getInset(pos);
if (tmpinset) { if (tmpinset) {
#if 1 // this is needed for deep update on initialitation #if 1 // this is needed for deep update on initialitation
tmpinset->update(bv(), tmpfont); #warning inset->update FIXME
tmpinset->update(bv());
#endif #endif
asc = tmpinset->ascent(bv(), tmpfont); asc = tmpinset->ascent(bv(), tmpfont);
desc = tmpinset->descent(bv(), tmpfont); desc = tmpinset->descent(bv(), tmpfont);

View File

@ -415,9 +415,8 @@ void LyXText::toggleInset()
} else { } else {
inset->open(bv()); inset->open(bv());
} }
#if 0
inset->open(bv(), !inset->isOpen()); bv()->updateInset(inset);
#endif
} }
@ -2471,7 +2470,6 @@ void LyXText::postPaint(int start_y)
refresh_row = 0; refresh_row = 0;
if (old != UNCHANGED && refresh_y < start_y) { if (old != UNCHANGED && refresh_y < start_y) {
lyxerr << "Paint already pending from above" << endl;
return; return;
} }
@ -2482,14 +2480,8 @@ void LyXText::postPaint(int start_y)
// We are an inset's lyxtext. Tell the top-level lyxtext // We are an inset's lyxtext. Tell the top-level lyxtext
// it needs to update the row we're in. // it needs to update the row we're in.
LyXText * t = bv()->text; LyXText * t = bv()->text;
t->postRowPaint(t->cursor.row(), t->cursor.y() - t->cursor.row()->baseline());
// FIXME: but what if this row is below ?
if (!t->refresh_row) {
t->refresh_row = t->cursor.row();
t->refresh_y = t->cursor.y() - t->cursor.row()->baseline();
}
} }
@ -2498,7 +2490,7 @@ void LyXText::postPaint(int start_y)
void LyXText::postRowPaint(Row * row, int start_y) void LyXText::postRowPaint(Row * row, int start_y)
{ {
if (status_ != UNCHANGED && refresh_y < start_y) { if (status_ != UNCHANGED && refresh_y < start_y) {
lyxerr << "Paint already pending from above" << endl; status_ = NEED_MORE_REFRESH;
return; return;
} else { } else {
refresh_y = start_y; refresh_y = start_y;
@ -2515,15 +2507,8 @@ void LyXText::postRowPaint(Row * row, int start_y)
// We are an inset's lyxtext. Tell the top-level lyxtext // We are an inset's lyxtext. Tell the top-level lyxtext
// it needs to update the row we're in. // it needs to update the row we're in.
LyXText * t = bv()->text; LyXText * t = bv()->text;
t->postRowPaint(t->cursor.row(), t->cursor.y() - t->cursor.row()->baseline());
// FIXME: but what if this new row is above ?
// Why the !t->refresh_row at all ?
if (!t->refresh_row) {
t->refresh_row = t->cursor.row();
t->refresh_y = t->cursor.y() - t->cursor.row()->baseline();
}
} }