prevent crash when inserting minipage in table cell,

small cosmetic stuff


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7454 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-30 15:41:39 +00:00
parent bee8db371f
commit eead5ba43d
6 changed files with 31 additions and 21 deletions

View File

@ -1,3 +1,9 @@
2003-07-30 André Pönitz <poenitz@gmx.net>
* tabular.C: don't use Assert too heavily. This crashes where it
shouldn't
2003-07-30 Alfredo Braunstein <abraunst@libero.it> 2003-07-30 Alfredo Braunstein <abraunst@libero.it>
* lyxfunc.C (dispatch): do not mark the buffer dirty if the action * lyxfunc.C (dispatch): do not mark the buffer dirty if the action

View File

@ -1,3 +1,10 @@
2003-07-30 André Pönitz <poenitz@gmx.net>
* insetcollapsable.C:
* insetfootlike.C:
* insettabular.C: parantheses, localize vars etc.
2003-07-29 Martin Vermeer <martin.vermeer@hut.fi> 2003-07-29 Martin Vermeer <martin.vermeer@hut.fi>
* insetnote.C: Implement a newenvironment in preamble for * insetnote.C: Implement a newenvironment in preamble for

View File

@ -113,7 +113,6 @@ void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
void InsetCollapsable::dimension_collapsed(Dimension & dim) const void InsetCollapsable::dimension_collapsed(Dimension & dim) const
{ {
font_metrics::buttonText(label, labelfont, dim.wid, dim.asc, dim.des); font_metrics::buttonText(label, labelfont, dim.wid, dim.asc, dim.des);
dim.wid += 2 * TEXT_TO_INSET_OFFSET;
} }
@ -141,7 +140,7 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetCollapsable::draw_collapsed(PainterInfo & pi, int x, int y) const void InsetCollapsable::draw_collapsed(PainterInfo & pi, int x, int y) const
{ {
pi.pain.buttonText(x + TEXT_TO_INSET_OFFSET, y, label, labelfont); pi.pain.buttonText(x, y, label, labelfont);
} }
@ -181,8 +180,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y, bool inlined) const
inset.draw(pi, x, y); inset.draw(pi, x, y);
} else { } else {
draw_collapsed(pi, old_x, bl); draw_collapsed(pi, old_x, bl);
int const yy = bl + dim_collapsed.descent() + inset.ascent(); inset.draw(pi, x, bl + dim_collapsed.descent() + inset.ascent());
inset.draw(pi, x, yy);
} }
} }

View File

@ -51,8 +51,8 @@ void InsetFootlike::write(Buffer const * buf, ostream & os) const
bool InsetFootlike::insetAllowed(InsetOld::Code code) const bool InsetFootlike::insetAllowed(InsetOld::Code code) const
{ {
if ((code == InsetOld::FOOT_CODE) || (code == InsetOld::MARGIN_CODE) if (code == InsetOld::FOOT_CODE || code == InsetOld::MARGIN_CODE
|| (code == InsetOld::FLOAT_CODE)) || code == InsetOld::FLOAT_CODE)
return false; return false;
return InsetCollapsable::insetAllowed(code); return InsetCollapsable::insetAllowed(code);
} }

View File

@ -275,14 +275,12 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
{ {
//lyxerr << "InsetTabular::draw: " << x << " " << y << "\n"; //lyxerr << "InsetTabular::draw: " << x << " " << y << "\n";
if (nodraw()) { if (nodraw()) {
lyxerr << "InsetTabular::nodraw: " << x << " " << y << "\n";
need_update = FULL; need_update = FULL;
return; return;
} }
BufferView * bv = pi.base.bv; BufferView * bv = pi.base.bv;
int i;
int j;
int nx;
#if 0 #if 0
UpdatableInset::draw(pi, x, y); UpdatableInset::draw(pi, x, y);
@ -296,25 +294,24 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
x += ADD_TO_TABULAR_WIDTH; x += ADD_TO_TABULAR_WIDTH;
int cell = 0; int cell = 0;
int cx;
first_visible_cell = -1; first_visible_cell = -1;
for (i = 0; i < tabular.rows(); ++i) { for (int i = 0; i < tabular.rows(); ++i) {
nx = x; int nx = x;
cell = tabular.getCellNumber(i, 0); cell = tabular.getCellNumber(i, 0);
if (!((y + tabular.getDescentOfRow(i)) > 0) && if (y + tabular.getDescentOfRow(i) <= 0 &&
(y - tabular.getAscentOfRow(i)) < pi.pain.paperHeight()) y - tabular.getAscentOfRow(i) < pi.pain.paperHeight())
{ {
y += tabular.getDescentOfRow(i) + y += tabular.getDescentOfRow(i) +
tabular.getAscentOfRow(i + 1) + tabular.getAscentOfRow(i + 1) +
tabular.getAdditionalHeight(i + 1); tabular.getAdditionalHeight(i + 1);
continue; continue;
} }
for (j = 0; j < tabular.columns(); ++j) { for (int j = 0; j < tabular.columns(); ++j) {
if (nx > bv->workWidth()) if (nx > bv->workWidth())
break; break;
if (tabular.isPartOfMultiColumn(i, j)) if (tabular.isPartOfMultiColumn(i, j))
continue; continue;
cx = nx + tabular.getBeginningOfTextInCell(cell); int cx = nx + tabular.getBeginningOfTextInCell(cell);
if (first_visible_cell < 0) if (first_visible_cell < 0)
first_visible_cell = cell; first_visible_cell = cell;
if (hasSelection()) { if (hasSelection()) {
@ -2619,7 +2616,9 @@ bool InsetTabular::forceDefaultParagraphs(InsetOld const * in) const
// well we didn't obviously find it so maybe our owner knows more // well we didn't obviously find it so maybe our owner knows more
if (owner()) if (owner())
return owner()->forceDefaultParagraphs(in); return owner()->forceDefaultParagraphs(in);
// if we're here there is really something strange going on!!! // if we're here there is really something strange going on!!!
lyxerr << "if we're here there is really something strange going on!\n";
return false; return false;
} }

View File

@ -2609,8 +2609,8 @@ int LyXTabular::getCellFromInset(InsetOld const * inset, int maybe_cell) const
{ {
// is this inset part of the tabular? // is this inset part of the tabular?
if (!inset || inset->owner() != owner_) { if (!inset || inset->owner() != owner_) {
lyxerr << "this is not a cell of the tabular!" << endl; //lyxerr << "Abort::this is not a cell of the tabular!" << endl;
Assert(0); return -1;
} }
const int save_cur_cell = cur_cell; const int save_cur_cell = cur_cell;