On Wed, Mar 19, 2003 at 09:35:15PM +0000, John Levon wrote:
> This is fun. Insets like InsetMinipage and InsetERT can have e.g.
> INSET_MODIFY applied to them. This can actually alter its size. It
> actually needs to tell its contained InsetText to ->update(reinit ==
> true);
HA ! That's a bloody joke. This doesn't work. I have absolutely no idea
why, of course. This update stuff is entirely beyond understanding. Just
dealing with the bv->updateInset() vs. bv->update() vs. bv->update(blah)
vs. inset->update() vs. inset->updateInsetInInset() vs lyxtext->update()
vs. lyxtext->updateInset() [1] isn't too bad, but the semi-recursive
nature and delayed insettext state update thing makes it impossible.
I've spent 2 solid hours trying to work out the correct way of forcing
an update of a minipage, no go. Pretty pissed off ...
> Juergen, can you help ? What would you say if I suggest ripping the font
> paramter from inset->update ?
I've done this anyway, since it doesn't make things worse. I'm
committing the lot below tomorrow.
regards,
john
[1] I suspect casual readers may think I'm joking here. I'm not, these
all exist, and they all call each other.
Index: rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.8
diff -u -p -r1.8 rowpainter.C
--- rowpainter.C 17 Mar 2003 16:24:53 -0000 1.8
+++ rowpainter.C 20 Mar 2003 02:51:47 -0000
@@ -110,7 +110,9 @@ bool RowPainter::paintInset(pos_type con
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_);
// return true if something changed when we drew an inset
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.322
diff -u -p -r1.322 text.C
--- text.C 19 Mar 2003 15:01:29 -0000 1.322
+++ text.C 20 Mar 2003 02:51:50 -0000
@@ -283,10 +283,11 @@ int LyXText::singleWidth(Paragraph * par
return 3;
}
#if 1
+#warning inset->update FIXME
// this IS needed otherwise on initialitation we don't get the
fill
// of the row right (ONLY on initialization if we read a file!)
// should be changed! (Jug 20011204)
- tmpinset->update(bv(), font);
+ tmpinset->update(bv());
#endif
return tmpinset->width(bv(), font);
}
@@ -1019,7 +1020,8 @@ void LyXText::setHeightOfRow(Row * row)
tmpinset = row->par()->getInset(pos);
if (tmpinset) {
#if 1 // this is needed for deep update on initialitation
- tmpinset->update(bv(), tmpfont);
+#warning inset->update FIXME
+ tmpinset->update(bv());
#endif
asc = tmpinset->ascent(bv(), tmpfont);
desc = tmpinset->descent(bv(), tmpfont);
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.295
diff -u -p -r1.295 text2.C
--- text2.C 19 Mar 2003 14:45:15 -0000 1.295
+++ text2.C 20 Mar 2003 02:51:53 -0000
@@ -415,9 +415,8 @@ void LyXText::toggleInset()
} else {
inset->open(bv());
}
-#if 0
- inset->open(bv(), !inset->isOpen());
-#endif
+
+ bv()->updateInset(inset);
}
@@ -2482,14 +2481,8 @@ void LyXText::postPaint(int start_y)
// We are an inset's lyxtext. Tell the top-level lyxtext
// it needs to update the row we're in.
-
LyXText * t = bv()->text;
-
- // 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();
- }
+ t->postRowPaint(t->cursor.row(), t->cursor.y() - t->cursor.row()->baseline());
}
@@ -2499,6 +2492,7 @@ void LyXText::postRowPaint(Row * row, in
{
if (status_ != UNCHANGED && refresh_y < start_y) {
lyxerr << "Paint already pending from above" << endl;
+ status_ = NEED_MORE_REFRESH;
return;
} else {
refresh_y = start_y;
@@ -2515,15 +2509,8 @@ void LyXText::postRowPaint(Row * row, in
// We are an inset's lyxtext. Tell the top-level lyxtext
// it needs to update the row we're in.
-
LyXText * t = bv()->text;
-
- // 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();
- }
+ t->postRowPaint(t->cursor.row(), t->cursor.y() - t->cursor.row()->baseline());
}
Index: insets/inset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.h,v
retrieving revision 1.79
diff -u -p -r1.79 inset.h
--- insets/inset.h 17 Mar 2003 16:24:58 -0000 1.79
+++ insets/inset.h 20 Mar 2003 02:51:56 -0000
@@ -164,7 +164,7 @@ public:
///
virtual void draw(BufferView *, LyXFont const &, int baseline, float & x)
const = 0;
/// 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
virtual string const editMessage() const;
Index: insets/insetcollapsable.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v
retrieving revision 1.129
diff -u -p -r1.129 insetcollapsable.C
--- insets/insetcollapsable.C 19 Mar 2003 14:45:18 -0000 1.129
+++ insets/insetcollapsable.C 20 Mar 2003 02:51:56 -0000
@@ -46,7 +46,7 @@ class LyXText;
InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed)
: UpdatableInset(), collapsed_(collapsed), inset(bp),
button_length(0), button_top_y(0), button_bottom_y(0),
- need_update(NONE), label("Label"),
+ label("Label"),
#if 0
autocollapse(false),
#endif
@@ -64,7 +64,7 @@ InsetCollapsable::InsetCollapsable(Inset
: UpdatableInset(in, same_id), collapsed_(in.collapsed_),
framecolor(in.framecolor), labelfont(in.labelfont), inset(in.inset),
button_length(0), button_top_y(0), button_bottom_y(0),
- need_update(NONE), label(in.label),
+ label(in.label),
#if 0
autocollapse(in.autocollapse),
#endif
@@ -167,10 +167,10 @@ int InsetCollapsable::width(BufferView *
if (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) ?
- inset.width(bv, font) : widthCollapsed;
+ return max(collapsed_width, contents_width);
}
@@ -184,17 +184,11 @@ void InsetCollapsable::draw_collapsed(Pa
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
- int baseline, float & x) const
+ int baseline, float & x, bool inlined) const
{
lyx::Assert(bv);
cache(bv);
- if (need_update != NONE) {
- const_cast<InsetText *>(&inset)->update(bv, f, true);
- bv->text->postChangedInDraw();
- need_update = NONE;
- return;
- }
if (nodraw())
return;
@@ -213,7 +207,7 @@ void InsetCollapsable::draw(BufferView *
float old_x = x;
if (!owner())
- x += static_cast<float>(scroll());
+ x += scroll();
top_x = int(x);
topx_set = true;
@@ -221,10 +215,23 @@ void InsetCollapsable::draw(BufferView *
int const bl = baseline - ascent(bv, f) + ascent_collapsed();
- draw_collapsed(pain, bl, old_x);
- inset.draw(bv, f, bl + descent_collapsed() + inset.ascent(bv, f), x);
- if (x < (top_x + button_length + TEXT_TO_INSET_OFFSET))
- x = top_x + button_length + TEXT_TO_INSET_OFFSET;
+ 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);
+ // 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(Buffer
#endif
-void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
- bool reinit)
+void InsetCollapsable::update(BufferView * bv, bool reinit)
{
if (in_update) {
if (reinit && owner()) {
- owner()->update(bv, font, true);
+ owner()->update(bv, true);
}
return;
}
in_update = true;
- inset.update(bv, font, reinit);
+ inset.update(bv, reinit);
if (reinit && owner()) {
- owner()->update(bv, font, true);
+ owner()->update(bv, true);
}
in_update = false;
}
Index: insets/insetcollapsable.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.h,v
retrieving revision 1.94
diff -u -p -r1.94 insetcollapsable.h
--- insets/insetcollapsable.h 17 Mar 2003 01:34:34 -0000 1.94
+++ insets/insetcollapsable.h 20 Mar 2003 02:51:56 -0000
@@ -33,11 +33,6 @@ class LyXCursor;
class InsetCollapsable : public UpdatableInset {
public:
///
- enum UpdateCodes {
- NONE = 0,
- FULL
- };
- ///
static int const TEXT_TO_TOP_OFFSET = 2;
///
static int const TEXT_TO_BOTTOM_OFFSET = 2;
@@ -57,8 +52,11 @@ public:
int width(BufferView *, LyXFont const &) 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);
///
@@ -226,7 +224,6 @@ protected:
///
mutable int topx;
mutable int topbaseline;
- mutable UpdateCodes need_update;
private:
///
Index: insets/insetert.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v
retrieving revision 1.110
diff -u -p -r1.110 insetert.C
--- insets/insetert.C 19 Mar 2003 14:45:19 -0000 1.110
+++ insets/insetert.C 20 Mar 2003 02:51:57 -0000
@@ -445,6 +445,9 @@ Inset::RESULT InsetERT::localDispatch(Fu
InsetERTMailer::string2params(cmd.argument, status_);
status(bv, status_);
+ // re-init the text (width may have changed, going
+ // from inline to fullrow, etc.)
+ inset.update(bv, true);
bv->updateInset(this);
result = DISPATCHED;
}
@@ -569,39 +572,7 @@ int InsetERT::width(BufferView * bv, LyX
void InsetERT::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x) const
{
- lyx::Assert(bv);
- 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;
+ InsetCollapsable::draw(bv, f, baseline, x, inlined());
}
@@ -623,7 +594,6 @@ void InsetERT::status(BufferView * bv, E
{
if (st != status_) {
status_ = st;
- need_update = FULL;
switch (st) {
case Inlined:
if (bv)
@@ -706,15 +676,14 @@ int InsetERT::getMaxWidth(BufferView * b
}
-void InsetERT::update(BufferView * bv, LyXFont const & font,
- bool reinit)
+void InsetERT::update(BufferView * bv, bool reinit)
{
if (inset.need_update & InsetText::INIT ||
- inset.need_update & InsetText::FULL)
- {
+ inset.need_update & InsetText::FULL) {
setButtonLabel();
}
- InsetCollapsable::update(bv, font, reinit);
+
+ InsetCollapsable::update(bv, reinit);
}
Index: insets/insetert.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.h,v
retrieving revision 1.64
diff -u -p -r1.64 insetert.h
--- insets/insetert.h 17 Mar 2003 01:34:34 -0000 1.64
+++ insets/insetert.h 20 Mar 2003 02:51:57 -0000
@@ -123,7 +123,7 @@ public:
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
- void update(BufferView *, LyXFont const &, bool =false);
+ void update(BufferView *, bool =false);
private:
///
Index: insets/insetminipage.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetminipage.C,v
retrieving revision 1.59
diff -u -p -r1.59 insetminipage.C
--- insets/insetminipage.C 19 Mar 2003 18:25:36 -0000 1.59
+++ insets/insetminipage.C 20 Mar 2003 02:51:58 -0000
@@ -117,6 +117,8 @@ dispatch_result InsetMinipage::localDisp
params_.pos = params.pos;
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);
result = DISPATCHED;
}
Index: insets/insettabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
retrieving revision 1.250
diff -u -p -r1.250 insettabular.C
--- insets/insettabular.C 19 Mar 2003 17:15:31 -0000 1.250
+++ insets/insettabular.C 20 Mar 2003 02:52:00 -0000
@@ -327,7 +327,7 @@ void InsetTabular::draw(BufferView * bv,
int i = 0;
for(Inset * inset = owner(); inset; ++i)
inset = inset->owner();
- if (calculate_dimensions_of_cells(bv, font, false))
+ if (calculate_dimensions_of_cells(bv, false))
need_update = INIT;
} else {
need_update = NONE;
@@ -397,28 +397,28 @@ void InsetTabular::drawCellSelection(Pai
}
-void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
+void InsetTabular::update(BufferView * bv, bool reinit)
{
if (in_update) {
if (reinit) {
resetPos(bv);
if (owner())
- owner()->update(bv, font, true);
+ owner()->update(bv, true);
}
return;
}
in_update = true;
if (reinit) {
need_update = INIT;
- if (calculate_dimensions_of_cells(bv, font, true))
+ if (calculate_dimensions_of_cells(bv, true))
resetPos(bv);
if (owner())
- owner()->update(bv, font, true);
+ owner()->update(bv, true);
in_update = false;
return;
}
if (the_locking_inset)
- the_locking_inset->update(bv, font, reinit);
+ the_locking_inset->update(bv, reinit);
if (need_update < FULL &&
bv->text->status() == LyXText::NEED_MORE_REFRESH)
{
@@ -429,7 +429,7 @@ void InsetTabular::update(BufferView * b
case INIT:
case FULL:
case CELL:
- if (calculate_dimensions_of_cells(bv, font, false)) {
+ if (calculate_dimensions_of_cells(bv, false)) {
need_update = INIT;
resetPos(bv);
}
@@ -505,7 +505,7 @@ void InsetTabular::insetUnlock(BufferVie
{
if (the_locking_inset) {
the_locking_inset->insetUnlock(bv);
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
the_locking_inset = 0;
}
hideInsetCursor(bv);
@@ -517,17 +517,15 @@ void InsetTabular::insetUnlock(BufferVie
if (scroll(false)) {
scroll(bv, 0.0F);
}
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
}
}
-void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what,
- bool mark_dirty) const
+void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what) const
{
if (what == INIT) {
- LyXFont font;
- calculate_dimensions_of_cells(bv, font, true);
+ calculate_dimensions_of_cells(bv, true);
}
if (!locked && what == CELL)
what = FULL;
@@ -598,7 +596,7 @@ bool InsetTabular::unlockInsetInInset(Bu
if (scroll(false))
scroll(bv, 0.0F);
#endif
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
// this has to be here otherwise we don't redraw the cell!
the_locking_inset = 0;
// showInsetCursor(bv, false);
@@ -631,7 +629,7 @@ bool InsetTabular::updateInsetInInset(Bu
if (!static_cast<InsetText *>(tl_inset)->updateInsetInInset(bv, inset))
return false;
}
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
return true;
}
@@ -676,7 +674,7 @@ void InsetTabular::lfunMousePress(FuncRe
if (hasSelection()) {
clearSelection();
- updateLocal(cmd.view(), SELECTION, false);
+ updateLocal(cmd.view(), SELECTION);
}
int const ocell = actcell;
@@ -692,13 +690,13 @@ void InsetTabular::lfunMousePress(FuncRe
}
setPos(bv, cmd.x, cmd.y);
if (actrow != orow)
- updateLocal(bv, NONE, false);
+ updateLocal(bv, NONE);
clearSelection();
#if 0
if (cmd.button() == mouse_button::button3) {
if ((ocell != actcell) && the_locking_inset) {
the_locking_inset->insetUnlock(bv);
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
the_locking_inset = 0;
}
showInsetCursor(bv);
@@ -719,7 +717,7 @@ void InsetTabular::lfunMousePress(FuncRe
if (the_locking_inset) {
the_locking_inset->insetUnlock(bv);
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
the_locking_inset = 0;
}
@@ -780,10 +778,10 @@ void InsetTabular::lfunMouseMotion(FuncR
setPos(bv, cmd.x, cmd.y);
if (!hasSelection()) {
setSelection(actcell, actcell);
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
} else if (old_cell != actcell) {
setSelection(sel_cell_start, actcell);
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
}
showInsetCursor(bv);
}
@@ -833,7 +831,7 @@ Inset::RESULT InsetTabular::localDispatc
movePrevCell(bv, old_locking_inset != 0);
clearSelection();
if (hs)
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
if (!the_locking_inset) {
showInsetCursor(bv);
return DISPATCHED_NOUPDATE;
@@ -854,13 +852,13 @@ Inset::RESULT InsetTabular::localDispatc
resetPos(bv);
if (sc != scroll()) { // inset has been scrolled
the_locking_inset->toggleInsetCursor(bv);
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
the_locking_inset->toggleInsetCursor(bv);
}
return result;
} else if (result == DISPATCHED) {
the_locking_inset->toggleInsetCursor(bv);
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
the_locking_inset->toggleInsetCursor(bv);
return result;
} else if (result == FINISHED_UP) {
@@ -891,14 +889,14 @@ Inset::RESULT InsetTabular::localDispatc
end = actcell;
}
setSelection(start, end);
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
break;
}
case LFUN_RIGHT:
result = moveRight(bv);
clearSelection();
if (hs)
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
break;
case LFUN_LEFTSEL: {
int const start = hasSelection() ? sel_cell_start : actcell;
@@ -915,14 +913,14 @@ Inset::RESULT InsetTabular::localDispatc
end = actcell;
}
setSelection(start, end);
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
break;
}
case LFUN_LEFT:
result = moveLeft(bv);
clearSelection();
if (hs)
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
break;
case LFUN_DOWNSEL: {
int const start = hasSelection() ? sel_cell_start : actcell;
@@ -939,14 +937,14 @@ Inset::RESULT InsetTabular::localDispatc
} else {
setSelection(start, start);
}
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
}
break;
case LFUN_DOWN:
result = moveDown(bv, old_locking_inset != 0);
clearSelection();
if (hs) {
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
}
break;
case LFUN_UPSEL: {
@@ -964,14 +962,14 @@ Inset::RESULT InsetTabular::localDispatc
} else {
setSelection(start, start);
}
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
}
break;
case LFUN_UP:
result = moveUp(bv, old_locking_inset != 0);
clearSelection();
if (hs)
- updateLocal(bv, SELECTION, false);
+ updateLocal(bv, SELECTION);
break;
case LFUN_NEXT: {
UpdateCodes code = CURSOR;
@@ -991,7 +989,7 @@ Inset::RESULT InsetTabular::localDispatc
actcell = tabular->GetFirstCellInRow(tabular->rows() -
1) + column;
}
resetPos(bv);
- updateLocal(bv, code, false);
+ updateLocal(bv, code);
break;
}
case LFUN_PRIOR: {
@@ -1013,7 +1011,7 @@ Inset::RESULT InsetTabular::localDispatc
actcell = column;
}
resetPos(bv);
- updateLocal(bv, code, false);
+ updateLocal(bv, code);
break;
}
// none of these make sense for insettabular,
@@ -1062,7 +1060,7 @@ Inset::RESULT InsetTabular::localDispatc
if (tmpstr.empty())
break;
if (insertAsciiString(bv, tmpstr, false))
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
else
result = UNDISPATCHED;
break;
@@ -1077,7 +1075,7 @@ Inset::RESULT InsetTabular::localDispatc
bv->text->cursor.par(),
bv->text->cursor.par()->next());
cutSelection(bv->buffer()->params);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
case LFUN_COPY:
if (!hasSelection())
@@ -1162,7 +1160,7 @@ Inset::RESULT InsetTabular::localDispatc
bv->text->cursor.par(),
bv->text->cursor.par()->next());
pasteSelection(bv);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
}
// ATTENTION: the function above has to be PASTE and PASTESELECTION!!!
@@ -1202,7 +1200,7 @@ Inset::RESULT InsetTabular::localDispatc
unlockInsetInInset(bv, the_locking_inset);
nodraw(false);
// we need to update if this was requested before
- updateLocal(bv, NONE, false);
+ updateLocal(bv, NONE);
return UNDISPATCHED;
} else if (hs) {
clearSelection();
@@ -1211,7 +1209,7 @@ Inset::RESULT InsetTabular::localDispatc
need_update = SELECTION;
}
nodraw(false);
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
return result;
}
break;
@@ -1219,7 +1217,7 @@ Inset::RESULT InsetTabular::localDispatc
if (result < FINISHED) {
if (!the_locking_inset) {
if (bv->fitCursor())
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
if (locked)
showInsetCursor(bv);
}
@@ -1290,9 +1288,7 @@ void InsetTabular::validate(LaTeXFeature
}
-bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
- LyXFont const & font,
- bool reinit) const
+bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, bool reinit) const
{
int cell = -1;
int maxAsc = 0;
@@ -1300,6 +1296,10 @@ bool InsetTabular::calculate_dimensions_
InsetText * inset;
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
// change so I'll try this to have a boost, but who knows ;)
if ((need_update != INIT) &&
@@ -1324,7 +1324,7 @@ bool InsetTabular::calculate_dimensions_
++cell;
inset = tabular->GetCellInset(cell);
if (!reinit && !tabular->GetPWidth(cell).zero())
- inset->update(bv, font, false);
+ inset->update(bv, false);
maxAsc = max(maxAsc, inset->ascent(bv, font));
maxDesc = max(maxDesc, inset->descent(bv, font));
changed = tabular->SetWidthOfCell(cell, inset->width(bv,
font)) || changed;
@@ -1501,34 +1501,34 @@ void InsetTabular::resetPos(BufferView *
(tabular->GetWidthOfTabular() < bv->workWidth()-20))
{
scroll(bv, 0.0F);
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
} else if (the_locking_inset &&
(tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20))
{
int xx = cursor_.x() - offset + bv->text->getRealCursorX();
if (xx > (bv->workWidth()-20)) {
scroll(bv, -(xx - bv->workWidth() + 60));
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
} else if (xx < 20) {
if (xx < 0)
xx = -xx + 60;
else
xx = 60;
scroll(bv, xx);
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
}
} else if ((cursor_.x() - offset) > 20 &&
(cursor_.x() - offset + tabular->GetWidthOfColumn(actcell))
> (bv->workWidth() - 20)) {
scroll(bv, -tabular->GetWidthOfColumn(actcell) - 20);
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
} else if ((cursor_.x() - offset) < 20) {
scroll(bv, 20 - cursor_.x() + offset);
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
} else if (scroll() && top_x > 20 &&
(top_x + tabular->GetWidthOfTabular()) > (bv->workWidth() - 20)) {
scroll(bv, old_x - cursor_.x());
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
}
if (the_locking_inset) {
inset_x = cursor_.x() - top_x +
tabular->GetBeginningOfTextInCell(actcell);
@@ -1706,7 +1706,7 @@ void InsetTabular::setFont(BufferView *
unFreezeUndo();
if (selectall)
clearSelection();
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
}
if (the_locking_inset)
the_locking_inset->setFont(bv, font, tall);
@@ -1832,7 +1832,7 @@ void InsetTabular::tabularFeatures(Buffe
cell = tabular->GetCellNumber(i,column);
tabular->GetCellInset(cell)->resizeLyXText(bv);
}
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
}
if (vallen.zero()
@@ -1855,27 +1855,27 @@ void InsetTabular::tabularFeatures(Buffe
tabular->GetCellInset(tabular->GetCellNumber(i,
column))->
resizeLyXText(bv);
}
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
}
}
break;
case LyXTabular::SET_SPECIAL_COLUMN:
case LyXTabular::SET_SPECIAL_MULTI:
tabular->SetAlignSpecial(actcell,value,feature);
- updateLocal(bv, FULL, true);
+ updateLocal(bv, FULL);
break;
case LyXTabular::APPEND_ROW:
// append the row into the tabular
unlockInsetInInset(bv, the_locking_inset);
tabular->AppendRow(bv->buffer()->params, actcell);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
case LyXTabular::APPEND_COLUMN:
// append the column into the tabular
unlockInsetInInset(bv, the_locking_inset);
tabular->AppendColumn(bv->buffer()->params, actcell);
actcell = tabular->GetCellNumber(row, column);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
case LyXTabular::DELETE_ROW:
unlockInsetInInset(bv, the_locking_inset);
@@ -1886,7 +1886,7 @@ void InsetTabular::tabularFeatures(Buffe
--sel_row_start;
actcell = tabular->GetCellNumber(sel_row_start, column);
clearSelection();
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
case LyXTabular::DELETE_COLUMN:
unlockInsetInInset(bv, the_locking_inset);
@@ -1897,7 +1897,7 @@ void InsetTabular::tabularFeatures(Buffe
--sel_col_start;
actcell = tabular->GetCellNumber(row, sel_col_start);
clearSelection();
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
case LyXTabular::M_TOGGLE_LINE_TOP:
flag = false;
@@ -1909,7 +1909,7 @@ void InsetTabular::tabularFeatures(Buffe
tabular->SetTopLine(
tabular->GetCellNumber(i, j),
lineSet, flag);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
}
@@ -1924,7 +1924,7 @@ void InsetTabular::tabularFeatures(Buffe
tabular->GetCellNumber(i, j),
lineSet,
flag);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
}
@@ -1939,7 +1939,7 @@ void InsetTabular::tabularFeatures(Buffe
tabular->GetCellNumber(i,j),
lineSet,
flag);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
}
@@ -1954,7 +1954,7 @@ void InsetTabular::tabularFeatures(Buffe
tabular->GetCellNumber(i,j),
lineSet,
flag);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
}
@@ -1972,7 +1972,7 @@ void InsetTabular::tabularFeatures(Buffe
tabular->GetCellNumber(i, j),
setAlign,
flag);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
case LyXTabular::M_VALIGN_TOP:
case LyXTabular::M_VALIGN_BOTTOM:
@@ -1986,7 +1986,7 @@ void InsetTabular::tabularFeatures(Buffe
tabular->SetVAlignment(
tabular->GetCellNumber(i, j),
setVAlign, flag);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
case LyXTabular::MULTICOLUMN:
{
@@ -2001,10 +2001,10 @@ void InsetTabular::tabularFeatures(Buffe
// check wether we are completly in a multicol
if (tabular->IsMultiColumn(actcell)) {
tabular->UnsetMultiColumn(actcell);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
} else {
tabular->SetMultiColumn(bv->buffer(), actcell, 1);
- updateLocal(bv, CELL, true);
+ updateLocal(bv, CELL);
}
return;
}
@@ -2023,7 +2023,7 @@ void InsetTabular::tabularFeatures(Buffe
tabular->SetMultiColumn(bv->buffer(), s_start, s_end - s_start + 1);
actcell = s_start;
clearSelection();
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
}
case LyXTabular::SET_ALL_LINES:
@@ -2033,15 +2033,15 @@ void InsetTabular::tabularFeatures(Buffe
for (int j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetAllLines(
tabular->GetCellNumber(i,j), setLines);
- updateLocal(bv, INIT, true);
+ updateLocal(bv, INIT);
break;
case LyXTabular::SET_LONGTABULAR:
tabular->SetLongTabular(true);
- updateLocal(bv, INIT, true); // because this toggles displayed
+ updateLocal(bv, INIT); // because this toggles displayed
break;
case LyXTabular::UNSET_LONGTABULAR:
tabular->SetLongTabular(false);
- updateLocal(bv, INIT, true); // because this toggles displayed
+ updateLocal(bv, INIT); // because this toggles displayed
break;
case LyXTabular::SET_ROTATE_TABULAR:
tabular->SetRotateTabular(true);
@@ -2129,7 +2129,7 @@ bool InsetTabular::activateCellInset(Buf
inset->edit(bv, x, y, button);
if (!the_locking_inset)
return false;
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
return (the_locking_inset != 0);
}
@@ -2693,7 +2693,7 @@ bool InsetTabular::nextChange(BufferView
{
if (the_locking_inset) {
if (the_locking_inset->nextChange(bv, length)) {
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
return true;
}
if (tabular->IsLastCell(actcell))
@@ -2702,14 +2702,14 @@ bool InsetTabular::nextChange(BufferView
}
InsetText * inset = tabular->GetCellInset(actcell);
if (inset->nextChange(bv, length)) {
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
return true;
}
while (!tabular->IsLastCell(actcell)) {
++actcell;
inset = tabular->GetCellInset(actcell);
if (inset->nextChange(bv, length)) {
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
return true;
}
}
@@ -2722,7 +2722,7 @@ bool InsetTabular::searchForward(BufferV
{
if (the_locking_inset) {
if (the_locking_inset->searchForward(bv, str, cs, mw)) {
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
return true;
}
if (tabular->IsLastCell(actcell))
@@ -2731,14 +2731,14 @@ bool InsetTabular::searchForward(BufferV
}
InsetText * inset = tabular->GetCellInset(actcell);
if (inset->searchForward(bv, str, cs, mw)) {
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
return true;
}
while (!tabular->IsLastCell(actcell)) {
++actcell;
inset = tabular->GetCellInset(actcell);
if (inset->searchForward(bv, str, cs, mw)) {
- updateLocal(bv, FULL, false);
+ updateLocal(bv, FULL);
return true;
}
}
@@ -2751,7 +2751,7 @@ bool InsetTabular::searchBackward(Buffer
{
if (the_locking_inset) {
if (the_locking_inset->searchBackward(bv, str, cs, mw)) {
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
return true;
}
}
@@ -2762,7 +2762,7 @@ bool InsetTabular::searchBackward(Buffer
--actcell;
InsetText * inset = tabular->GetCellInset(actcell);
if (inset->searchBackward(bv, str, cs, mw)) {
- updateLocal(bv, CELL, false);
+ updateLocal(bv, CELL);
return true;
}
}
Index: insets/insettabular.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.h,v
retrieving revision 1.108
diff -u -p -r1.108 insettabular.h
--- insets/insettabular.h 17 Mar 2003 01:34:35 -0000 1.108
+++ insets/insettabular.h 20 Mar 2003 02:52:01 -0000
@@ -94,7 +94,7 @@ public:
///
void draw(BufferView *, const LyXFont &, int , float &) const;
///
- void update(BufferView *, LyXFont const &, bool = false);
+ void update(BufferView *, bool = false);
///
string const editMessage() const;
///
@@ -104,7 +104,7 @@ public:
//
void insetUnlock(BufferView *);
///
- void updateLocal(BufferView *, UpdateCodes, bool mark_dirty) const;
+ void updateLocal(BufferView *, UpdateCodes) const;
///
bool lockInsetInInset(BufferView *, UpdatableInset *);
///
@@ -251,8 +251,7 @@ private:
///
void lfunMouseMotion(FuncRequest const &);
///
- bool calculate_dimensions_of_cells(BufferView *, LyXFont const &,
- bool = false) const;
+ bool calculate_dimensions_of_cells(BufferView *, bool = false) const;
///
void drawCellLines(Painter &, int x, int baseline,
int row, int cell) const;
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.360
diff -u -p -r1.360 insettext.C
--- insets/insettext.C 19 Mar 2003 14:45:21 -0000 1.360
+++ insets/insettext.C 20 Mar 2003 02:52:04 -0000
@@ -485,12 +485,12 @@ void InsetText::drawFrame(Painter & pain
}
-void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
+void InsetText::update(BufferView * bv, bool reinit)
{
if (in_update) {
if (reinit && owner()) {
reinitLyXText();
- owner()->update(bv, font, true);
+ owner()->update(bv, true);
}
return;
}
@@ -500,7 +500,7 @@ void InsetText::update(BufferView * bv,
// we should put this call where we set need_update to INIT!
reinitLyXText();
if (owner())
- owner()->update(bv, font, true);
+ owner()->update(bv, true);
in_update = false;
return;
}
@@ -511,7 +511,7 @@ void InsetText::update(BufferView * bv,
if (the_locking_inset) {
inset_x = cix(bv) - top_x + drawTextXOffset;
inset_y = ciy(bv) + drawTextYOffset;
- the_locking_inset->update(bv, font, reinit);
+ the_locking_inset->update(bv, reinit);
}
bool clear = false;
@@ -538,7 +538,7 @@ void InsetText::setUpdateStatus(BufferVi
LyXText * llt = getLyXText(bv);
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 ((llt->status() == LyXText::NEED_MORE_REFRESH) ||
(!autoBreakRows &&
@@ -2270,7 +2270,6 @@ void InsetText::resizeLyXText(BufferView
return;
}
do_resize = 0;
-// lyxerr << "InsetText::resizeLyXText\n";
if (!paragraphs.begin()->next() && paragraphs.begin()->empty()) { // no data,
resize not neccessary!
// we have to do this as a fixed width may have changed!
LyXText * t = getLyXText(bv);
@@ -2323,7 +2322,6 @@ void InsetText::reinitLyXText() const
}
do_reinit = false;
do_resize = 0;
-// lyxerr << "InsetText::reinitLyXText\n";
for (Cache::iterator it = cache.begin(); it != cache.end(); ++it) {
lyx::Assert(it->second.text.get());
Index: insets/insettext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v
retrieving revision 1.145
diff -u -p -r1.145 insettext.h
--- insets/insettext.h 17 Mar 2003 16:24:59 -0000 1.145
+++ insets/insettext.h 20 Mar 2003 02:52:04 -0000
@@ -94,7 +94,7 @@ public:
///
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;
///