]> git.lyx.org Git - features.git/commitdiff
prevent crash when inserting minipage in table cell,
authorAndré Pönitz <poenitz@gmx.net>
Wed, 30 Jul 2003 15:41:39 +0000 (15:41 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 30 Jul 2003 15:41:39 +0000 (15:41 +0000)
small cosmetic stuff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7454 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/insets/ChangeLog
src/insets/insetcollapsable.C
src/insets/insetfootlike.C
src/insets/insettabular.C
src/tabular.C

index 2b5a8344424f080104b36d76a9a735e43d38185c..ff1b01b7b4d948878318524a646988a05d83217d 100644 (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>
 
        * lyxfunc.C (dispatch): do not mark the buffer dirty if the action
index 072e271c876f033ec368e142f64de8d86149f6b2..8c31b752dc1ef060f9c4b57c3534a2130ccc190b 100644 (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>
 
        * insetnote.C: Implement a newenvironment in preamble for
index 2a328f3c463a95ce1bfd4b4c7ac77bc8287ea9e7..4a5002bf199fc9e1f96f1c568393b1ae618b161a 100644 (file)
@@ -113,7 +113,6 @@ void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
 void InsetCollapsable::dimension_collapsed(Dimension & dim) const
 {
        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
 {
-       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);
        } else {
                draw_collapsed(pi, old_x, bl);
-               int const yy = bl + dim_collapsed.descent() + inset.ascent();
-               inset.draw(pi, x, yy);
+               inset.draw(pi, x, bl + dim_collapsed.descent() + inset.ascent());
        }
 }
 
index 0605cfe34a18ba1999dc51be0167dfc109ba45fe..85e3366316e013a83615e673da86703952e82725 100644 (file)
@@ -51,8 +51,8 @@ void InsetFootlike::write(Buffer const * buf, ostream & os) const
 
 bool InsetFootlike::insetAllowed(InsetOld::Code code) const
 {
-       if ((code == InsetOld::FOOT_CODE) || (code == InsetOld::MARGIN_CODE)
-           || (code == InsetOld::FLOAT_CODE))
+       if (code == InsetOld::FOOT_CODE || code == InsetOld::MARGIN_CODE
+           || code == InsetOld::FLOAT_CODE)
                return false;
        return InsetCollapsable::insetAllowed(code);
 }
index c0019802996fc46eb5aca9a3397106ba922d917a..1cbf00c932aadbfb672030041d1e326b9f9b9ba0 100644 (file)
@@ -275,14 +275,12 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
 {
        //lyxerr << "InsetTabular::draw: " << x << " " << y << "\n";
        if (nodraw()) {
+               lyxerr << "InsetTabular::nodraw: " << x << " " << y << "\n";
                need_update = FULL;
                return;
        }
 
        BufferView * bv = pi.base.bv;
-       int i;
-       int j;
-       int nx;
 
 #if 0
        UpdatableInset::draw(pi, x, y);
@@ -296,25 +294,24 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
        x += ADD_TO_TABULAR_WIDTH;
 
        int cell = 0;
-       int cx;
        first_visible_cell = -1;
-       for (i = 0; i < tabular.rows(); ++i) {
-               nx = x;
+       for (int i = 0; i < tabular.rows(); ++i) {
+               int nx = x;
                cell = tabular.getCellNumber(i, 0);
-               if (!((y + tabular.getDescentOfRow(i)) > 0) &&
-                       (y - tabular.getAscentOfRow(i)) < pi.pain.paperHeight())
+               if (y + tabular.getDescentOfRow(i) <= 0 &&
+                         y - tabular.getAscentOfRow(i) < pi.pain.paperHeight())
                {
-               y += tabular.getDescentOfRow(i) +
-                               tabular.getAscentOfRow(i + 1) +
-                               tabular.getAdditionalHeight(i + 1);
+                       y += tabular.getDescentOfRow(i) +
+                                       tabular.getAscentOfRow(i + 1) +
+                                       tabular.getAdditionalHeight(i + 1);
                        continue;
                }
-               for (j = 0; j < tabular.columns(); ++j) {
+               for (int j = 0; j < tabular.columns(); ++j) {
                        if (nx > bv->workWidth())
                                break;
                        if (tabular.isPartOfMultiColumn(i, j))
                                continue;
-                       cx = nx + tabular.getBeginningOfTextInCell(cell);
+                       int cx = nx + tabular.getBeginningOfTextInCell(cell);
                        if (first_visible_cell < 0)
                                first_visible_cell = cell;
                        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
        if (owner())
                return owner()->forceDefaultParagraphs(in);
+
        // 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;
 }
 
index b5067a263c96e71cf03027c2669a6433e31b5dad..5ad06be2cc6a037302aaf97acb0bc08860b0ee36 100644 (file)
@@ -2609,8 +2609,8 @@ int LyXTabular::getCellFromInset(InsetOld const * inset, int maybe_cell) const
 {
        // is this inset part of the tabular?
        if (!inset || inset->owner() != owner_) {
-               lyxerr << "this is not a cell of the tabular!" << endl;
-               Assert(0);
+               //lyxerr << "Abort::this is not a cell of the tabular!" << endl;
+               return -1;
        }
 
        const int save_cur_cell = cur_cell;