reversed jug-bug, will apply pieces later

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1958 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-04-26 17:47:40 +00:00
parent a2528eadcc
commit a464b9b97d
15 changed files with 159 additions and 380 deletions

View File

@ -184,12 +184,6 @@
* src/exporter.C (Export): Give an error message when path to file * src/exporter.C (Export): Give an error message when path to file
contains spaces. contains spaces.
2001-04-13 Juergen Vigna <jug@sad.it>
* tabular.C (GetAdditionalHeight): changed parameter from cell to row.
(LyXTabular): tried to minimize operator= operations (and realized
hopfully Lars wish).
2001-04-12 Dekel Tsur <dekelts@tau.ac.il> 2001-04-12 Dekel Tsur <dekelts@tau.ac.il>
* LaTeX.C (deplog): Always check that foundfile exists. * LaTeX.C (deplog): Always check that foundfile exists.

View File

@ -35,21 +35,6 @@
* figinset.C (runqueue): #warning triggers an error on Sun CC 6.0 as * figinset.C (runqueue): #warning triggers an error on Sun CC 6.0 as
an unrecognised preprocessor directive. So ensure they're wrapped. an unrecognised preprocessor directive. So ensure they're wrapped.
2001-04-13 Juergen Vigna <jug@sad.it>
* insettext.C: tried to avoid unneeded redraws.
(doClearArea): return true also if I need a FULL|INIT redraw.
* insettabular.C: tried to avoid unneeded redraws. Still one
problem with scrolling remains (resetPos).
(doClearArea): return true also if I need a FULL|INIT redraw.
* lyxinset.h: changed the scroll() function behaviour a bit.
Added nodraw() function so that I can block unneeded redraws.
Implemented the above 2 functions correctly in InsetText,
InsetTabular and InsetCollapsable. Now only the topmost Inset
owner is scrolled (as it should be) if a child inset requests this!
2001-04-06 John Levon <moz@compsoc.man.ac.uk> 2001-04-06 John Levon <moz@compsoc.man.ac.uk>
* insetexternal.h: * insetexternal.h:

View File

@ -152,6 +152,7 @@ void UpdatableInset::draw(BufferView *, LyXFont const &,
void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool ) void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool )
{} {}
void UpdatableInset::scroll(BufferView * bv, float s) const void UpdatableInset::scroll(BufferView * bv, float s) const
{ {
LyXFont font; LyXFont font;
@ -204,7 +205,7 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
scx += offset; scx += offset;
} }
} }
// bv->updateInset(const_cast<UpdatableInset *>(this), false); // bv->updateInset(const_cast<UpdatableInset *>(this), false);
} }

View File

@ -169,12 +169,9 @@ void InsetCollapsable::draw_collapsed(Painter & pain, LyXFont const &,
} }
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f, void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const int baseline, float & x, bool cleared) const
{ {
if (nodraw())
return;
Painter & pain = bv->painter(); Painter & pain = bv->painter();
button_length = widthCollapsed; button_length = widthCollapsed;
@ -188,27 +185,10 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
return; return;
} }
float old_x = x;
#if 0
UpdatableInset::draw(bv, f, baseline, x, cleared);
#else
if (!owner())
x += static_cast<float>(scroll());
#endif
if (!cleared && (inset.need_update == InsetText::FULL || if (!cleared && (inset.need_update == InsetText::FULL ||
inset.need_update == InsetText::INIT || inset.need_update == InsetText::INIT ||
top_x != int(x) || top_x != int(x) ||
top_baseline != baseline)) top_baseline != baseline)) {
{
#if 1
// we don't need anymore to clear here we just have to tell
// the underlying LyXText that it should do the RowClear!
inset.SetUpdateStatus(bv, InsetText::FULL);
bv->text->status = LyXText::CHANGED_IN_DRAW;
return;
#else
int w = owner() ? width(bv, f) : pain.paperWidth(); int w = owner() ? width(bv, f) : pain.paperWidth();
int h = ascent(bv, f) + descent(bv, f); int h = ascent(bv, f) + descent(bv, f);
int const tx = (needFullRow() && !owner()) ? 0 : int(x); int const tx = (needFullRow() && !owner()) ? 0 : int(x);
@ -222,15 +202,15 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
h += (baseline - ascent(bv, f)); h += (baseline - ascent(bv, f));
pain.fillRectangle(tx, ty - 1, w, h + 2); pain.fillRectangle(tx, ty - 1, w, h + 2);
cleared = true; cleared = true;
#endif
} }
top_x = int(x); top_x = int(x);
top_baseline = baseline; top_baseline = baseline;
float dummy = x;
int const bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f); int const bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f);
draw_collapsed(pain, f, bl, old_x); draw_collapsed(pain, f, bl, dummy);
inset.draw(bv, f, inset.draw(bv, f,
bl + descent_collapsed(pain, f) + inset.ascent(bv, f), bl + descent_collapsed(pain, f) + inset.ascent(bv, f),
x, cleared); x, cleared);
@ -271,8 +251,6 @@ void InsetCollapsable::InsetUnlock(BufferView * bv)
collapsed = true; collapsed = true;
} }
inset.InsetUnlock(bv); inset.InsetUnlock(bv);
if (scroll())
scroll(bv, 0.0F);
bv->updateInset(this, false); bv->updateInset(this, false);
} }
@ -403,8 +381,7 @@ bool InsetCollapsable::UnlockInsetInInset(BufferView * bv, UpdatableInset * in,
bv->unlockInset(this); bv->unlockInset(this);
return true; return true;
} }
bool const ret = inset.UnlockInsetInInset(bv, in, lr); return inset.UnlockInsetInInset(bv, in, lr);
return ret;
} }
@ -495,19 +472,3 @@ std::vector<string> const InsetCollapsable::getLabelList() const
{ {
return inset.getLabelList(); return inset.getLabelList();
} }
bool InsetCollapsable::nodraw() const
{
return inset.nodraw();
}
int InsetCollapsable::scroll(bool recursive) const
{
int sx = UpdatableInset::scroll(false);
if (recursive)
sx += inset.scroll(recursive);
return sx;
}

View File

@ -131,17 +131,6 @@ public:
void resizeLyXText(BufferView *) const; void resizeLyXText(BufferView *) const;
/// ///
std::vector<string> const getLabelList() const; std::vector<string> const getLabelList() const;
///
bool nodraw() const;
///
int scroll(bool recursive=true) const;
void scroll(BufferView *bv, float sx) const {
UpdatableInset::scroll(bv, sx);
}
void scroll(BufferView *bv, int offset) const {
UpdatableInset::scroll(bv, offset);
}
protected: protected:
/// ///
int ascent_collapsed(Painter &, LyXFont const &) const; int ascent_collapsed(Painter &, LyXFont const &) const;

View File

@ -133,6 +133,7 @@ InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
actrow = actcell = 0; actrow = actcell = 0;
clearSelection(); clearSelection();
need_update = INIT; need_update = INIT;
no_draw = false;
} }
@ -146,6 +147,7 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf)
actrow = actcell = 0; actrow = actcell = 0;
sel_cell_start = sel_cell_end = 0; sel_cell_start = sel_cell_end = 0;
need_update = INIT; need_update = INIT;
no_draw = false;
} }
@ -221,24 +223,15 @@ int InsetTabular::width(BufferView *, LyXFont const &) const
void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline, void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
float & x, bool cleared) const float & x, bool cleared) const
{ {
if (nodraw()) if (no_draw)
return; return;
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
return;
// lyxerr << "InsetTabular::draw(" << need_update << ")\n";
Painter & pain = bv->painter(); Painter & pain = bv->painter();
int i; int i;
int j; int j;
int nx; int nx;
#if 0
UpdatableInset::draw(bv, font, baseline, x, cleared); UpdatableInset::draw(bv, font, baseline, x, cleared);
#else
if (!owner())
x += static_cast<float>(scroll());
#endif
if (!cleared && ((need_update == INIT) || (need_update == FULL) || if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
(top_x != int(x)) || (top_baseline != baseline))) { (top_x != int(x)) || (top_baseline != baseline))) {
int h = ascent(bv, font) + descent(bv, font); int h = ascent(bv, font) + descent(bv, font);
@ -258,6 +251,9 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
} }
top_x = int(x); top_x = int(x);
top_baseline = baseline; top_baseline = baseline;
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
return;
bool dodraw;
x += ADD_TO_TABULAR_WIDTH; x += ADD_TO_TABULAR_WIDTH;
if (cleared) { if (cleared) {
int cell = 0; int cell = 0;
@ -265,41 +261,32 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
first_visible_cell = -1; first_visible_cell = -1;
for (i = 0; i < tabular->rows(); ++i) { for (i = 0; i < tabular->rows(); ++i) {
nx = int(x); nx = int(x);
cell = tabular->GetCellNumber(i, 0); dodraw = ((baseline + tabular->GetDescentOfRow(i)) > 0) &&
if (!((baseline + tabular->GetDescentOfRow(i)) > 0) && (baseline - tabular->GetAscentOfRow(i))<pain.paperHeight();
(baseline - tabular->GetAscentOfRow(i))<pain.paperHeight())
{
baseline += tabular->GetDescentOfRow(i) +
tabular->GetAscentOfRow(i + 1) +
tabular->GetAdditionalHeight(i + 1);
continue;
}
for (j = 0; j < tabular->columns(); ++j) { for (j = 0; j < tabular->columns(); ++j) {
if (nx > bv->workWidth())
break;
if (tabular->IsPartOfMultiColumn(i, j)) if (tabular->IsPartOfMultiColumn(i, j))
continue; continue;
cx = nx + tabular->GetBeginningOfTextInCell(cell); cx = nx + tabular->GetBeginningOfTextInCell(cell);
if (first_visible_cell < 0) if (dodraw) {
first_visible_cell = cell; if (first_visible_cell < 0)
if (hasSelection()) first_visible_cell = cell;
DrawCellSelection(pain, nx, baseline, i, j, cell); if (hasSelection())
tabular->GetCellInset(cell)->draw(bv, font, baseline, cx, DrawCellSelection(pain, nx, baseline, i, j, cell);
cleared); tabular->GetCellInset(cell)->draw(bv, font, baseline, cx,
DrawCellLines(pain, nx, baseline, i, cell); cleared);
DrawCellLines(pain, nx, baseline, i, cell);
}
nx += tabular->GetWidthOfColumn(cell); nx += tabular->GetWidthOfColumn(cell);
++cell; ++cell;
} }
baseline += tabular->GetDescentOfRow(i) + baseline += tabular->GetDescentOfRow(i) +
tabular->GetAscentOfRow(i + 1) + tabular->GetAscentOfRow(i + 1) +
tabular->GetAdditionalHeight(i + 1); tabular->GetAdditionalHeight(cell);
} }
} else if (need_update == CELL) { } else if (need_update == CELL) {
int cell = 0; int cell = 0;
nx = int(x); nx = int(x);
if (the_locking_inset && if (the_locking_inset) {
tabular->GetCellInset(actcell) != the_locking_inset)
{
Inset * inset = tabular->GetCellInset(cell); Inset * inset = tabular->GetCellInset(cell);
for (i = 0; for (i = 0;
inset != the_locking_inset && i < tabular->rows(); inset != the_locking_inset && i < tabular->rows();
@ -318,23 +305,24 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
nx = int(x); nx = int(x);
baseline += tabular->GetDescentOfRow(i) + baseline += tabular->GetDescentOfRow(i) +
tabular->GetAscentOfRow(i + 1) + tabular->GetAscentOfRow(i + 1) +
tabular->GetAdditionalHeight(i + 1); tabular->GetAdditionalHeight(cell);
} }
} }
} else { } else {
// copute baseline for actual row for (i = 0;
for (i = 0; i < actrow; ++i) { cell < actcell && i < tabular->rows(); ++i) {
baseline += tabular->GetDescentOfRow(i) + for (j = 0; (cell < actcell) && (j < tabular->columns()); ++j) {
tabular->GetAscentOfRow(i + 1) + if (tabular->IsPartOfMultiColumn(i, j))
tabular->GetAdditionalHeight(i + 1);
}
// now compute the right x position
cell = tabular->GetCellNumber(actrow, 0);
for (j = 0; (cell < actcell) && (j < tabular->columns()); ++j) {
if (tabular->IsPartOfMultiColumn(actrow, j))
continue; continue;
nx += tabular->GetWidthOfColumn(cell); nx += tabular->GetWidthOfColumn(cell);
++cell; ++cell;
}
if (tabular->row_of_cell(cell) > i) {
nx = int(x);
baseline += tabular->GetDescentOfRow(i) +
tabular->GetAscentOfRow(i + 1) +
tabular->GetAdditionalHeight(cell);
}
} }
} }
i = tabular->row_of_cell(cell); i = tabular->row_of_cell(cell);
@ -447,9 +435,12 @@ void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
owner()->update(bv, font, true); owner()->update(bv, font, true);
return; return;
} }
if (the_locking_inset) if (the_locking_inset) {
the_locking_inset->update(bv, font, reinit); the_locking_inset->update(bv, font, reinit);
// resetPos(bv);
// inset_x = cursor.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
// inset_y = cursor.y();
}
switch (need_update) { switch (need_update) {
case INIT: case INIT:
case FULL: case FULL:
@ -505,9 +496,9 @@ void InsetTabular::InsetUnlock(BufferView * bv)
no_selection = false; no_selection = false;
oldcell = -1; oldcell = -1;
locked = false; locked = false;
if (scroll(false) || hasSelection()) { if (scroll() || hasSelection()) {
sel_cell_start = sel_cell_end = 0; sel_cell_start = sel_cell_end = 0;
if (scroll(false)) { if (scroll()) {
scroll(bv, 0.0F); scroll(bv, 0.0F);
} }
UpdateLocal(bv, FULL, false); UpdateLocal(bv, FULL, false);
@ -567,10 +558,7 @@ bool InsetTabular::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset,
if (the_locking_inset == inset) { if (the_locking_inset == inset) {
the_locking_inset->InsetUnlock(bv); the_locking_inset->InsetUnlock(bv);
the_locking_inset = 0; the_locking_inset = 0;
if (scroll(false)) UpdateLocal(bv, CELL, false);
scroll(bv, 0.0F);
else
UpdateLocal(bv, CELL, false);
ShowInsetCursor(bv, false); ShowInsetCursor(bv, false);
return true; return true;
} }
@ -784,10 +772,7 @@ InsetTabular::LocalDispatch(BufferView * bv,
sel_cell_start = sel_cell_end = actcell; sel_cell_start = sel_cell_end = actcell;
if (hs) if (hs)
UpdateLocal(bv, SELECTION, false); UpdateLocal(bv, SELECTION, false);
if (!the_locking_inset) { ShowInsetCursor(bv);
ShowInsetCursor(bv);
return DISPATCHED_NOUPDATE;
}
return result; return result;
} }
// this to avoid compiler warnings. // this to avoid compiler warnings.
@ -1046,19 +1031,19 @@ InsetTabular::LocalDispatch(BufferView * bv,
result = UNDISPATCHED; result = UNDISPATCHED;
if (the_locking_inset) if (the_locking_inset)
break; break;
nodraw(true); no_draw = true;
if (ActivateCellInset(bv)) { if (ActivateCellInset(bv)) {
result = the_locking_inset->LocalDispatch(bv, action, arg); result = the_locking_inset->LocalDispatch(bv, action, arg);
if ((result == UNDISPATCHED) || (result == FINISHED)) { if ((result == UNDISPATCHED) || (result == FINISHED)) {
UnlockInsetInInset(bv, the_locking_inset); UnlockInsetInInset(bv, the_locking_inset);
nodraw(false); no_draw = false;
the_locking_inset = 0; the_locking_inset = 0;
return UNDISPATCHED; return UNDISPATCHED;
} }
nodraw(false); no_draw = false;
// the_locking_inset->ToggleInsetCursor(bv); the_locking_inset->ToggleInsetCursor(bv);
UpdateLocal(bv, CELL, false); UpdateLocal(bv, CELL, false);
// the_locking_inset->ToggleInsetCursor(bv); the_locking_inset->ToggleInsetCursor(bv);
return result; return result;
} }
break; break;
@ -1188,7 +1173,8 @@ void InsetTabular::ShowInsetCursor(BufferView * bv, bool show)
int const desc = lyxfont::maxDescent(font); int const desc = lyxfont::maxDescent(font);
bv->fitLockedInsetCursor(cursor.x(), cursor.y(), asc, desc); bv->fitLockedInsetCursor(cursor.x(), cursor.y(), asc, desc);
if (show) if (show)
bv->showLockedInsetCursor(cursor.x(), cursor.y(), asc, desc); bv->showLockedInsetCursor(cursor.x(), cursor.y(),
asc, desc);
setCursorVisible(true); setCursorVisible(true);
} }
} }
@ -1214,9 +1200,13 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
// first search the right row // first search the right row
while((ly < y) && (actrow < tabular->rows())) { while((ly < y) && (actrow < tabular->rows())) {
cursor.y(cursor.y() + tabular->GetDescentOfRow(actrow) + cursor.y(cursor.y()
tabular->GetAscentOfRow(actrow + 1) + + tabular->GetDescentOfRow(actrow)
tabular->GetAdditionalHeight(actrow + 1)); + tabular->GetAscentOfRow(actrow + 1)
+ tabular->
GetAdditionalHeight(tabular->
GetCellNumber(actrow + 1,
actcol)));
++actrow; ++actrow;
ly = cursor.y() + tabular->GetDescentOfRow(actrow); ly = cursor.y() + tabular->GetDescentOfRow(actrow);
} }
@ -1270,9 +1260,10 @@ void InsetTabular::resetPos(BufferView * bv) const
cursor.y(0); cursor.y(0);
for (; (cell < actcell) && !tabular->IsLastRow(cell); ++cell) { for (; (cell < actcell) && !tabular->IsLastRow(cell); ++cell) {
if (tabular->IsLastCellInRow(cell)) { if (tabular->IsLastCellInRow(cell)) {
cursor.y(cursor.y() + tabular->GetDescentOfRow(actrow) + cursor.y(cursor.y()
tabular->GetAscentOfRow(actrow + 1) + + tabular->GetDescentOfRow(actrow)
tabular->GetAdditionalHeight(actrow + 1)); + tabular->GetAscentOfRow(actrow + 1)
+ tabular->GetAdditionalHeight(cell + 1));
++actrow; ++actrow;
} }
} }
@ -1282,10 +1273,9 @@ void InsetTabular::resetPos(BufferView * bv) const
new_x += offset; new_x += offset;
cursor.x(new_x); cursor.x(new_x);
// cursor.x(getCellXPos(actcell) + offset); // cursor.x(getCellXPos(actcell) + offset);
if (scroll(false) && (tabular->GetWidthOfTabular() < bv->workWidth()-20)) { if (scroll() && (tabular->GetWidthOfTabular() < bv->workWidth()-20))
scroll(bv, 0.0F); scroll(bv, 0.0F);
UpdateLocal(bv, FULL, false); 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(bv); int xx = cursor.x() - offset + bv->text->GetRealCursorX(bv);
if (xx > (bv->workWidth()-20)) if (xx > (bv->workWidth()-20))
@ -1297,7 +1287,6 @@ void InsetTabular::resetPos(BufferView * bv) const
xx = 60; xx = 60;
scroll(bv, xx); scroll(bv, xx);
} }
UpdateLocal(bv, FULL, false);
} 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)) {
@ -1306,10 +1295,9 @@ void InsetTabular::resetPos(BufferView * bv) const
} 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, false);
} else if (scroll(false) && 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);
} }
if ((!the_locking_inset || if ((!the_locking_inset ||
!the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE)) && !the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE)) &&
@ -2305,33 +2293,3 @@ bool InsetTabular::isRightToLeft(BufferView *bv )
{ {
return bv->getParentLanguage(this)->RightToLeft(); return bv->getParentLanguage(this)->RightToLeft();
} }
bool InsetTabular::nodraw() const
{
if (the_locking_inset)
return the_locking_inset->nodraw();
return UpdatableInset::nodraw();
}
int InsetTabular::scroll(bool recursive) const
{
int sx = UpdatableInset::scroll(false);
if (recursive && the_locking_inset)
sx += the_locking_inset->scroll(recursive);
return sx;
}
bool InsetTabular::doClearArea() const
{
return !locked || (need_update & (FULL|INIT));
}
/* Emacs:
* Local variables:
* tab-width: 4
* End:
* vi:set tabstop=4:
*/

View File

@ -101,7 +101,7 @@ public:
/// ///
void Edit(BufferView *, int x, int y, unsigned int); void Edit(BufferView *, int x, int y, unsigned int);
/// ///
bool doClearArea() const; bool doClearArea() const { return !locked; };
/// ///
void InsetUnlock(BufferView *); void InsetUnlock(BufferView *);
/// ///
@ -178,20 +178,6 @@ public:
LyXFunc::func_status getStatus(string const & argument) const; LyXFunc::func_status getStatus(string const & argument) const;
/// ///
std::vector<string> const getLabelList() const; std::vector<string> const getLabelList() const;
///
void nodraw(bool b) {
UpdatableInset::nodraw(b);
}
bool nodraw() const;
///
int scroll(bool recursive=true) const;
void scroll(BufferView *bv, float sx) const {
UpdatableInset::scroll(bv, sx);
}
void scroll(BufferView *bv, int offset) const {
UpdatableInset::scroll(bv, offset);
}
// //
// Public structures and variables // Public structures and variables
/// ///
@ -297,6 +283,8 @@ private:
/// ///
bool no_selection; bool no_selection;
/// ///
bool no_draw;
///
mutable bool locked; mutable bool locked;
/// ///
mutable UpdateCodes need_update; mutable UpdateCodes need_update;

View File

@ -97,19 +97,18 @@ void InsetText::init(InsetText const * ins)
drawTextXOffset = 0; drawTextXOffset = 0;
drawTextYOffset = 0; drawTextYOffset = 0;
autoBreakRows = false; autoBreakRows = false;
drawFrame_ = NEVER; drawFrame = NEVER;
xpos = 0.0; xpos = 0.0;
if (ins) { if (ins) {
SetParagraphData(ins->par); SetParagraphData(ins->par);
autoBreakRows = ins->autoBreakRows; autoBreakRows = ins->autoBreakRows;
drawFrame_ = ins->drawFrame_; drawFrame = ins->drawFrame;
} }
par->SetInsetOwner(this); par->SetInsetOwner(this);
frame_color = LColor::insetframe; frame_color = LColor::insetframe;
locked = false; locked = false;
old_par = 0; old_par = 0;
last_drawn_width = -1; last_drawn_width = -1;
frame_is_visible = false;
} }
@ -298,29 +297,26 @@ int InsetText::textWidth(BufferView * bv) const
void InsetText::draw(BufferView * bv, LyXFont const & f, void InsetText::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const int baseline, float & x, bool cleared) const
{ {
if (nodraw())
return;
Painter & pain = bv->painter(); Painter & pain = bv->painter();
// no draw is necessary !!! // no draw is necessary !!!
if ((drawFrame_ == LOCKED) && !locked && !par->size()) { if ((drawFrame == LOCKED) && !locked && !par->size()) {
top_x = int(x); if (!cleared && (need_update & CLEAR_FRAME)) {
top_baseline = baseline; pain.rectangle(top_x + 1, baseline - insetAscent + 1,
x += width(bv, f); width(bv, f) - 1,
if (!cleared && (need_update & CLEAR_FRAME)) insetAscent + insetDescent - 1,
clearFrame(pain, cleared); LColor::background);
need_update = NONE; }
return; top_x = int(x);
top_baseline = baseline;
x += width(bv, f);
need_update = NONE;
return;
} }
xpos = x; xpos = x;
#if 0
UpdatableInset::draw(bv, f, baseline, x, cleared); UpdatableInset::draw(bv, f, baseline, x, cleared);
#else
if (!owner())
x += static_cast<float>(scroll());
#endif
// update insetWidth and insetHeight with dummy calls // update insetWidth and insetHeight with dummy calls
(void)ascent(bv, f); (void)ascent(bv, f);
(void)descent(bv, f); (void)descent(bv, f);
@ -328,9 +324,8 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
// if top_x differs we have a rule down and we don't have to clear anything // if top_x differs we have a rule down and we don't have to clear anything
if (!cleared && (top_x == int(x)) && if (!cleared && (top_x == int(x)) &&
((need_update&(INIT|FULL)) || (top_baseline!=baseline) || ((need_update == INIT) || (need_update == FULL) || (top_baseline != baseline) ||
(last_drawn_width!=insetWidth))) (last_drawn_width!=insetWidth))) {
{
int w = insetWidth; int w = insetWidth;
int h = insetAscent + insetDescent; int h = insetAscent + insetDescent;
int ty = baseline - insetAscent; int ty = baseline - insetAscent;
@ -351,14 +346,11 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
return; return;
if (top_x != int(x)) { if (top_x != int(x)) {
need_update |= INIT; need_update = INIT;
top_x = int(x); top_x = int(x);
bv->text->status = LyXText::CHANGED_IN_DRAW; bv->text->status = LyXText::CHANGED_IN_DRAW;
return; return;
} }
// lyxerr << "InsetText::draw[" << this << "](" << need_update << ":" << int(x) << ":" << top_x << ")\n";
if (cleared || (last_drawn_width != insetWidth)) { if (cleared || (last_drawn_width != insetWidth)) {
need_update |= FULL; need_update |= FULL;
last_drawn_width = insetWidth; last_drawn_width = insetWidth;
@ -374,7 +366,6 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
inset_y = cy(bv) + drawTextYOffset; inset_y = cy(bv) + drawTextYOffset;
} }
if (!cleared && (need_update == CURSOR) && !TEXT(bv)->selection) { if (!cleared && (need_update == CURSOR) && !TEXT(bv)->selection) {
drawFrame(pain, cleared);
x += width(bv, f); x += width(bv, f);
need_update = NONE; need_update = NONE;
return; return;
@ -401,7 +392,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
if (y_offset < 0) if (y_offset < 0)
y_offset = y; y_offset = y;
TEXT(bv)->first = first; TEXT(bv)->first = first;
if (cleared) { if (cleared) { // (need_update&FULL) || (need_update&INIT)
int yf = y_offset; int yf = y_offset;
y = 0; y = 0;
while ((row != 0) && (yf < ph)) { while ((row != 0) && (yf < ph)) {
@ -434,46 +425,30 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
TEXT(bv)->refresh_y = 0; TEXT(bv)->refresh_y = 0;
TEXT(bv)->status = LyXText::UNCHANGED; TEXT(bv)->status = LyXText::UNCHANGED;
if ((need_update != CURSOR_PAR) && if ((need_update != CURSOR_PAR) &&
((drawFrame_ == ALWAYS) || ((drawFrame_ == LOCKED) && locked))) ((drawFrame == ALWAYS) || ((drawFrame == LOCKED) && locked)))
drawFrame(pain, cleared); {
else if (need_update & CLEAR_FRAME) pain.rectangle(top_x + 1, baseline - insetAscent + 1,
clearFrame(pain, cleared); width(bv, f) - 1,
insetAscent + insetDescent - 1,
frame_color);
} else if (need_update & CLEAR_FRAME) {
pain.rectangle(top_x + 1, baseline - insetAscent + 1,
width(bv, f) - 1,
insetAscent + insetDescent - 1,
LColor::background);
}
x += width(bv, f) - TEXT_TO_INSET_OFFSET; x += width(bv, f) - TEXT_TO_INSET_OFFSET;
if (bv->text->status==LyXText::CHANGED_IN_DRAW) { if (bv->text->status==LyXText::CHANGED_IN_DRAW) {
need_update |= INIT; need_update = INIT;
} else if (need_update != INIT) } else if (need_update != INIT)
need_update = NONE; need_update = NONE;
} }
void InsetText::drawFrame(Painter & pain, bool cleared) const
{
if (!frame_is_visible || cleared) {
pain.rectangle(top_x + 1, top_baseline - insetAscent + 1,
insetWidth - 1, insetAscent + insetDescent - 1,
frame_color);
frame_is_visible = true;
}
}
void InsetText::clearFrame(Painter & pain, bool cleared) const
{
if (frame_is_visible) {
if (!cleared) {
pain.rectangle(top_x + 1, top_baseline - insetAscent + 1,
insetWidth - 1, insetAscent + insetDescent - 1,
LColor::background);
}
frame_is_visible = false;
}
}
void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit) void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
{ {
if (reinit) { if (reinit) { // && (need_update != CURSOR)) {
need_update |= INIT; need_update = INIT;
resizeLyXText(bv); resizeLyXText(bv);
if (owner()) if (owner())
owner()->update(bv, font, true); owner()->update(bv, font, true);
@ -484,39 +459,47 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
inset_y = cy(bv) + drawTextYOffset; inset_y = cy(bv) + drawTextYOffset;
the_locking_inset->update(bv, font, reinit); the_locking_inset->update(bv, font, reinit);
} }
#if 0
if (need_update == INIT) { if (need_update == INIT) {
resizeLyXText(bv); resizeLyXText(bv);
need_update |= FULL; need_update = FULL;
} }
#endif
int oldw = insetWidth; int oldw = insetWidth;
#if 1
insetWidth = TEXT(bv)->width + (2 * TEXT_TO_INSET_OFFSET); insetWidth = TEXT(bv)->width + (2 * TEXT_TO_INSET_OFFSET);
// max(textWidth(bv->painter()),
// static_cast<int>(TEXT(bv)->width) + drawTextXOffset) +
// (2 * TEXT_TO_INSET_OFFSET);
#else
insetWidth = textWidth(bv);
if (insetWidth < 0)
insetWidth = static_cast<int>(TEXT(bv)->width);
#endif
if (oldw != insetWidth) { if (oldw != insetWidth) {
// printf("TW(%p): %d-%d-%d-%d\n",this,insetWidth, oldw,
// textWidth(bv->painter()),static_cast<int>(TEXT(bv)->width));
resizeLyXText(bv); resizeLyXText(bv);
need_update |= FULL; need_update = FULL;
// update(bv, font, reinit); update(bv, font, reinit);
return; return;
} }
if ((need_update&CURSOR_PAR) && (TEXT(bv)->status==LyXText::UNCHANGED) && if ((need_update == CURSOR_PAR) && (TEXT(bv)->status == LyXText::UNCHANGED) &&
the_locking_inset) the_locking_inset)
{ {
TEXT(bv)->UpdateInset(bv, the_locking_inset); TEXT(bv)->UpdateInset(bv, the_locking_inset);
} }
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH) if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
need_update |= FULL; need_update = FULL;
#if 0
int y_temp = 0; int y_temp = 0;
Row * row = TEXT(bv)->GetRowNearY(y_temp); Row * row = TEXT(bv)->GetRowNearY(y_temp);
insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET; insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET;
insetDescent = TEXT(bv)->height - row->ascent_of_text() + insetDescent = TEXT(bv)->height - row->ascent_of_text() +
TEXT_TO_INSET_OFFSET; TEXT_TO_INSET_OFFSET;
#endif
} }
void InsetText::SetUpdateStatus(BufferView * bv, int what) const void InsetText::SetUpdateStatus(BufferView * bv, int what)
{ {
need_update |= what; need_update |= what;
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH) if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
@ -573,7 +556,7 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
TEXT(bv)->sel_cursor = TEXT(bv)->cursor; TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
bv->text->FinishUndo(); bv->text->FinishUndo();
ShowInsetCursor(bv); ShowInsetCursor(bv);
UpdateLocal(bv, CURSOR, false); UpdateLocal(bv, FULL, false);
// If the inset is empty set the language of the current font to the // If the inset is empty set the language of the current font to the
// language to the surronding text. // language to the surronding text.
@ -659,10 +642,7 @@ bool InsetText::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset,
if (lr) if (lr)
moveRight(bv, false); moveRight(bv, false);
old_par = 0; // force layout setting old_par = 0; // force layout setting
if (scroll()) UpdateLocal(bv, CURSOR_PAR, false);
scroll(bv, 0.0F);
else
UpdateLocal(bv, CURSOR, false);
return true; return true;
} }
return the_locking_inset->UnlockInsetInInset(bv, inset, lr); return the_locking_inset->UnlockInsetInInset(bv, inset, lr);
@ -1535,7 +1515,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool behind)
inset->Edit(bv, x, y, 0); inset->Edit(bv, x, y, 0);
if (!the_locking_inset) if (!the_locking_inset)
return false; return false;
UpdateLocal(bv, CURSOR, false); UpdateLocal(bv, CURSOR_PAR, false);
return true; return true;
} }
return false; return false;
@ -1559,7 +1539,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
inset->Edit(bv, x - inset_x, y - inset_y, button); inset->Edit(bv, x - inset_x, y - inset_y, button);
if (!the_locking_inset) if (!the_locking_inset)
return false; return false;
UpdateLocal(bv, CURSOR, false); UpdateLocal(bv, CURSOR_PAR, false);
return true; return true;
} }
return false; return false;
@ -1656,8 +1636,8 @@ void InsetText::SetAutoBreakRows(bool flag)
void InsetText::SetDrawFrame(BufferView * bv, DrawFrame how) void InsetText::SetDrawFrame(BufferView * bv, DrawFrame how)
{ {
if (how != drawFrame_) { if (how != drawFrame) {
drawFrame_ = how; drawFrame = how;
if (bv) if (bv)
UpdateLocal(bv, DRAW_FRAME, false); UpdateLocal(bv, DRAW_FRAME, false);
} }
@ -1860,34 +1840,3 @@ void InsetText::removeNewlines()
} }
} }
} }
bool InsetText::nodraw() const
{
if (the_locking_inset)
return the_locking_inset->nodraw();
return UpdatableInset::nodraw();
}
int InsetText::scroll(bool recursive) const
{
int sx = UpdatableInset::scroll(false);
if (recursive && the_locking_inset)
sx += the_locking_inset->scroll(recursive);
return sx;
}
bool InsetText::doClearArea() const
{
return !locked || (need_update & (FULL|INIT));
}
/* Emacs:
* Local variables:
* tab-width: 4
* End:
* vi:set tabstop=4:
*/

View File

@ -99,7 +99,7 @@ public:
/// ///
void update(BufferView *, LyXFont const &, bool =false); void update(BufferView *, LyXFont const &, bool =false);
/// ///
void SetUpdateStatus(BufferView *, int what) const; void SetUpdateStatus(BufferView *, int what);
/// ///
string const EditMessage() const; string const EditMessage() const;
/// ///
@ -107,7 +107,7 @@ public:
/// ///
bool IsTextInset() const { return true; } bool IsTextInset() const { return true; }
/// ///
bool doClearArea() const; bool doClearArea() const { return !locked; }
/// ///
void InsetUnlock(BufferView *); void InsetUnlock(BufferView *);
/// ///
@ -180,16 +180,6 @@ public:
/// ///
std::vector<string> const getLabelList() const; std::vector<string> const getLabelList() const;
/// ///
bool nodraw() const;
///
int scroll(bool recursive=true) const;
void scroll(BufferView *bv, float sx) const {
UpdatableInset::scroll(bv, sx);
}
void scroll(BufferView *bv, int offset) const {
UpdatableInset::scroll(bv, offset);
}
LyXParagraph * par; LyXParagraph * par;
/// ///
mutable int need_update; mutable int need_update;
@ -204,7 +194,7 @@ protected:
/// ///
bool autoBreakRows; bool autoBreakRows;
/// ///
DrawFrame drawFrame_; DrawFrame drawFrame;
/// ///
LColor::color frame_color; LColor::color frame_color;
@ -247,8 +237,8 @@ private:
/// ///
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0, bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0); int button = 0);
///
void removeNewlines(); void removeNewlines();
/// ///
int cx(BufferView *) const; int cx(BufferView *) const;
/// ///
@ -261,15 +251,11 @@ private:
bool cboundary(BufferView *) const; bool cboundary(BufferView *) const;
/// ///
Row * crow(BufferView *) const; Row * crow(BufferView *) const;
///
/// This instead of a macro /// This instead of a macro
LyXText * TEXT(BufferView * bv) const { LyXText * TEXT(BufferView * bv) const {
return getLyXText(bv); return getLyXText(bv);
} }
///
void drawFrame(Painter &, bool cleared) const;
void clearFrame(Painter &, bool cleared) const;
///
/* Private structures and variables */ /* Private structures and variables */
/// ///
@ -310,7 +296,5 @@ private:
mutable Cache cache; mutable Cache cache;
/// ///
mutable int last_drawn_width; mutable int last_drawn_width;
///
mutable bool frame_is_visible;
}; };
#endif #endif

View File

@ -234,11 +234,7 @@ public:
/// ///
virtual void resizeLyXText(BufferView *) const {} virtual void resizeLyXText(BufferView *) const {}
/// returns the actuall scroll-value /// returns the actuall scroll-value
virtual int scroll(bool recursive=true) const { int scroll() const { return scx; }
if (!recursive || !owner_)
return scx;
return 0;
}
protected: protected:
/// ///
mutable int top_x; mutable int top_x;
@ -308,7 +304,7 @@ public:
} }
/// ///
UpdatableInset() : cursor_visible_(false), block_drawing_(false) {} UpdatableInset() : cursor_visible_(false) {}
/// ///
virtual EDITABLE Editable() const; virtual EDITABLE Editable() const;
@ -367,20 +363,12 @@ public:
/// ///
virtual int getMaxWidth(BufferView * bv, UpdatableInset const *) const; virtual int getMaxWidth(BufferView * bv, UpdatableInset const *) const;
/// ///
int scroll(bool recursive=true) const { int scroll() const {
// We need this method to not clobber the real method in Inset // We need this method to not clobber the real method in Inset
return Inset::scroll(recursive); return Inset::scroll();
} }
/// ///
virtual bool ShowInsetDialog(BufferView *) const { return false; } virtual bool ShowInsetDialog(BufferView *) const { return false; }
///
virtual void nodraw(bool b) {
block_drawing_ = b;
}
///
virtual bool nodraw() const {
return block_drawing_;
}
protected: protected:
/// ///
void toggleCursorVisible() const { void toggleCursorVisible() const {
@ -394,11 +382,8 @@ protected:
void scroll(BufferView *, float sx) const; void scroll(BufferView *, float sx) const;
/// scrolls offset pixels /// scrolls offset pixels
void scroll(BufferView *, int offset) const; void scroll(BufferView *, int offset) const;
private: private:
/// ///
mutable bool cursor_visible_; mutable bool cursor_visible_;
///
bool block_drawing_;
}; };
#endif #endif

View File

@ -603,7 +603,7 @@ string const LyXFunc::Dispatch(int ac,
} }
selection_possible = false; selection_possible = false;
if (owner->view()->available()) if (owner->view()->available())
owner->view()->hideCursor(); owner->view()->hideCursor();

View File

@ -187,8 +187,8 @@ enum LyXRCTags {
string ps_command; string ps_command;
/// option for telling the dvi viewer about the paper size /// option for telling the dvi viewer about the paper size
string view_dvi_paper_option; string view_dvi_paper_option;
/// default paper size for local xdvi/dvips/ghostview/whatever /// default paper size for local xdvi/dvips/ghostview/whatever
BufferParams::PAPER_SIZE default_papersize; BufferParams::PAPER_SIZE default_papersize;
/// command to run chktex incl. options /// command to run chktex incl. options
string chktex_command; string chktex_command;
/// ///

View File

@ -96,13 +96,11 @@ LyXTabular::LyXTabular(InsetTabular * inset, int rows_arg, int columns_arg)
LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt) LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
{ {
owner_ = inset; owner_ = inset;
Init(lt.rows_, lt.columns_, &lt); Init(lt.rows_, lt.columns_);
#if 0
#ifdef WITH_WARNINGS #ifdef WITH_WARNINGS
#warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb) #warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb)
#endif #endif
operator=(lt); operator=(lt);
#endif
} }
@ -142,7 +140,6 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
LyXTabular * LyXTabular::Clone(InsetTabular * inset) LyXTabular * LyXTabular::Clone(InsetTabular * inset)
{ {
LyXTabular * result = new LyXTabular(inset, *this); LyXTabular * result = new LyXTabular(inset, *this);
#if 0
// don't know if this is good but I need to Clone also // don't know if this is good but I need to Clone also
// the text-insets here, this is for the Undo-facility! // the text-insets here, this is for the Undo-facility!
for (int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
@ -151,13 +148,12 @@ LyXTabular * LyXTabular::Clone(InsetTabular * inset)
result->cell_info[i][j].inset.setOwner(inset); result->cell_info[i][j].inset.setOwner(inset);
} }
} }
#endif
return result; return result;
} }
/* activates all lines and sets all widths to 0 */ /* activates all lines and sets all widths to 0 */
void LyXTabular::Init(int rows_arg, int columns_arg, LyXTabular const * lt) void LyXTabular::Init(int rows_arg, int columns_arg)
{ {
rows_ = rows_arg; rows_ = rows_arg;
columns_ = columns_arg; columns_ = columns_arg;
@ -165,11 +161,6 @@ void LyXTabular::Init(int rows_arg, int columns_arg, LyXTabular const * lt)
column_info = column_vector(columns_, columnstruct()); column_info = column_vector(columns_, columnstruct());
cell_info = cell_vvector(rows_, cell_vector(columns_, cellstruct())); cell_info = cell_vvector(rows_, cell_vector(columns_, cellstruct()));
if (lt) {
operator=(*lt);
return;
}
int cellno = 0; int cellno = 0;
for (int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
for (int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
@ -437,8 +428,10 @@ bool LyXTabular::RightLine(int cell, bool onlycolumn) const
bool LyXTabular::TopAlreadyDrawed(int cell) const bool LyXTabular::TopAlreadyDrawed(int cell) const
{ {
if (GetAdditionalHeight(cell))
return false;
int row = row_of_cell(cell); int row = row_of_cell(cell);
if ((row > 0) && !GetAdditionalHeight(row)) { if (row > 0) {
int column = column_of_cell(cell); int column = column_of_cell(cell);
--row; --row;
while (column while (column
@ -476,10 +469,10 @@ bool LyXTabular::IsLastRow(int cell) const
} }
int LyXTabular::GetAdditionalHeight(int row) const int LyXTabular::GetAdditionalHeight(int cell) const
{ {
if (!row || row >= rows_) int const row = row_of_cell(cell);
return 0; if (!row) return 0;
bool top = true; bool top = true;
bool bottom = true; bool bottom = true;
@ -675,7 +668,7 @@ bool LyXTabular::SetMColumnPWidth(int cell, string const & width)
bool LyXTabular::SetAlignSpecial(int cell, string const & special, bool LyXTabular::SetAlignSpecial(int cell, string const & special,
LyXTabular::Feature what) LyXTabular::Feature what)
{ {
if (what == SET_SPECIAL_MULTI) if (what == SET_SPECIAL_MULTI)
cellinfo_of_cell(cell)->align_special = special; cellinfo_of_cell(cell)->align_special = special;
@ -1888,7 +1881,7 @@ int LyXTabular::GetHeightOfTabular() const
for (int row = 0; row < rows_; ++row) for (int row = 0; row < rows_; ++row)
height += GetAscentOfRow(row) + GetDescentOfRow(row) + height += GetAscentOfRow(row) + GetDescentOfRow(row) +
GetAdditionalHeight(row); GetAdditionalHeight(GetCellNumber(row, 0));
return height; return height;
} }
@ -2592,9 +2585,3 @@ LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
return BOX_NONE; return BOX_NONE;
} }
#endif #endif
/* Emacs:
* Local variables:
* tab-width: 4
* End:
* vi:set tabstop=4:
*/

View File

@ -182,7 +182,7 @@ public:
bool IsLastRow(int cell) const; bool IsLastRow(int cell) const;
/// ///
int GetAdditionalHeight(int row) const; int GetAdditionalHeight(int cell) const;
/// ///
int GetAdditionalWidth(int cell) const; int GetAdditionalWidth(int cell) const;
@ -493,7 +493,7 @@ private:
InsetTabular * owner_; InsetTabular * owner_;
/// ///
void Init(int columns_arg, int rows_arg, LyXTabular const * lt = 0); void Init(int columns_arg, int rows_arg);
/// ///
void Reinit(); void Reinit();
/// ///

View File

@ -1157,7 +1157,7 @@ LyXText::NextBreakPoint(BufferView * bview, Row const * row, int width) const
int LyXText::Fill(BufferView * bview, Row * row, int paper_width) const int LyXText::Fill(BufferView * bview, Row * row, int paper_width) const
{ {
if (paper_width < 0) if (paper_width < 0)
return 20; return 0;
int w; int w;
// get the pure distance // get the pure distance
@ -1202,8 +1202,6 @@ int LyXText::Fill(BufferView * bview, Row * row, int paper_width) const
} }
int const fill = paper_width - w - RightMargin(bview->buffer(), row); int const fill = paper_width - w - RightMargin(bview->buffer(), row);
if (fill < 0)
return 0;
return fill; return fill;
} }
@ -1414,7 +1412,7 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
tmpfont = GetFont(bview->buffer(), row_ptr->par(), pos); tmpfont = GetFont(bview->buffer(), row_ptr->par(), pos);
tmpinset = row_ptr->par()->GetInset(pos); tmpinset = row_ptr->par()->GetInset(pos);
if (tmpinset) { if (tmpinset) {
// tmpinset->update(bview, tmpfont); tmpinset->update(bview, tmpfont);
asc = tmpinset->ascent(bview, tmpfont); asc = tmpinset->ascent(bview, tmpfont);
desc = tmpinset->descent(bview, tmpfont); desc = tmpinset->descent(bview, tmpfont);
maxwidth += tmpinset->width(bview, tmpfont); maxwidth += tmpinset->width(bview, tmpfont);