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>
* 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>
* insetfloat.h:

View File

@ -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;

View File

@ -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(InsetCollapsable const & in, bool same_id)
: 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 * bv, LyXFont const & font) const
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(Painter & pain,
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 * bv, LyXFont const & f,
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 * bv, LyXFont const & f,
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(BufferView * bv,
#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;
}

View File

@ -32,11 +32,6 @@ class LyXCursor;
*/
class InsetCollapsable : public UpdatableInset {
public:
///
enum UpdateCodes {
NONE = 0,
FULL
};
///
static int const TEXT_TO_TOP_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:
///

View File

@ -445,6 +445,9 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
InsetERTMailer::string2params(cmd.argument, 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);
result = DISPATCHED;
}
@ -569,39 +572,7 @@ int InsetERT::width(BufferView * bv, LyXFont const & font) const
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, ERTStatus const st) const
{
if (st != status_) {
status_ = st;
need_update = FULL;
switch (st) {
case Inlined:
if (bv)
@ -706,15 +676,14 @@ int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const
}
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);
}

View File

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

View File

@ -117,6 +117,8 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
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;
}

View File

@ -327,7 +327,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
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(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 (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 * bv, LyXFont const & font, bool reinit)
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(BufferView * bv)
{
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(BufferView * bv)
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(BufferView * bv, UpdatableInset * inset,
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(BufferView * bv, Inset * inset)
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(FuncRequest const & cmd)
if (hasSelection()) {
clearSelection();
updateLocal(cmd.view(), SELECTION, false);
updateLocal(cmd.view(), SELECTION);
}
int const ocell = actcell;
@ -692,13 +690,13 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
}
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(FuncRequest const & cmd)
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(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
} 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::localDispatch(FuncRequest const & cmd)
} 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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
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::localDispatch(FuncRequest const & cmd)
need_update = SELECTION;
}
nodraw(false);
updateLocal(bv, CELL, false);
updateLocal(bv, CELL);
return result;
}
break;
@ -1219,7 +1217,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
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(LaTeXFeatures & features) const
}
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_of_cells(BufferView * bv,
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_of_cells(BufferView * bv,
++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 * bv) const
(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 * bv, LyXFont const & font, bool tall,
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(BufferView * bv,
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(BufferView * bv,
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(BufferView * bv,
--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(BufferView * bv,
--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(BufferView * bv,
tabular->SetTopLine(
tabular->GetCellNumber(i, j),
lineSet, flag);
updateLocal(bv, INIT, true);
updateLocal(bv, INIT);
break;
}
@ -1924,7 +1924,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->GetCellNumber(i, j),
lineSet,
flag);
updateLocal(bv, INIT, true);
updateLocal(bv, INIT);
break;
}
@ -1939,7 +1939,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->GetCellNumber(i,j),
lineSet,
flag);
updateLocal(bv, INIT, true);
updateLocal(bv, INIT);
break;
}
@ -1954,7 +1954,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
tabular->GetCellNumber(i,j),
lineSet,
flag);
updateLocal(bv, INIT, true);
updateLocal(bv, INIT);
break;
}
@ -1972,7 +1972,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
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(BufferView * bv,
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(BufferView * bv,
// 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(BufferView * bv,
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(BufferView * bv,
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(BufferView * bv, int x, int y, mouse_button
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 * bv, lyx::pos_type & length)
{
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 * bv, lyx::pos_type & length)
}
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(BufferView * bv, string const & str,
{
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(BufferView * bv, string const & str,
}
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(BufferView * bv, string const & str,
{
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(BufferView * bv, string const & str,
--actcell;
InsetText * inset = tabular->GetCellInset(actcell);
if (inset->searchBackward(bv, str, cs, mw)) {
updateLocal(bv, CELL, false);
updateLocal(bv, CELL);
return true;
}
}

View File

@ -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;

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 (reinit && owner()) {
reinitLyXText();
owner()->update(bv, font, true);
owner()->update(bv, true);
}
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!
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, LyXFont const & font, bool reinit)
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(BufferView * bv, int what) const
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 * bv, bool force) const
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());

View File

@ -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;
///

View File

@ -110,7 +110,9 @@ bool RowPainter::paintInset(pos_type const 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_);
// return true if something changed when we drew an inset

View File

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

View File

@ -415,9 +415,8 @@ void LyXText::toggleInset()
} else {
inset->open(bv());
}
#if 0
inset->open(bv(), !inset->isOpen());
#endif
bv()->updateInset(inset);
}
@ -2471,7 +2470,6 @@ void LyXText::postPaint(int start_y)
refresh_row = 0;
if (old != UNCHANGED && refresh_y < start_y) {
lyxerr << "Paint already pending from above" << endl;
return;
}
@ -2482,14 +2480,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());
}
@ -2498,7 +2490,7 @@ void LyXText::postPaint(int start_y)
void LyXText::postRowPaint(Row * row, int start_y)
{
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 +2507,8 @@ void LyXText::postRowPaint(Row * row, 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 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());
}