]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_textinset.C
more IU
[lyx.git] / src / mathed / math_textinset.C
index bc7c9a74f5e5794cad315f163ba85507bcb0d211..39931d8f42bb6492f9b7c98511d1edd97a130008 100644 (file)
@@ -1,17 +1,32 @@
+/**
+ * \file math_textinset.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
 
 #include "math_textinset.h"
+#include "math_data.h"
 #include "metricsinfo.h"
 #include "debug.h"
 
+using std::auto_ptr;
+using std::endl;
+
 
 MathTextInset::MathTextInset()
        : MathNestInset(1)
 {}
 
 
-MathInset * MathTextInset::clone() const
+auto_ptr<InsetBase> MathTextInset::clone() const
 {
-       return new MathTextInset(*this);
+       return auto_ptr<InsetBase>(new MathTextInset(*this));
 }
 
 
@@ -20,7 +35,7 @@ MathInset::idx_type MathTextInset::pos2row(pos_type pos) const
        for (pos_type r = 0, n = cache_.nargs(); r < n; ++r)
                if (pos >= cache_.cellinfo_[r].begin_ && pos <= cache_.cellinfo_[r].end_)
                        return r;
-       lyxerr << "illegal row for pos " << pos << "\n";
+       lyxerr << "illegal row for pos " << pos << endl;
        return 0;
 }
 
@@ -88,7 +103,7 @@ void MathTextInset::metrics(MetricsInfo & mi, Dimension & dim) const
                // Special handling of spaces. We reached a safe position for breaking.
                char const c = cell(0)[i]->getChar();
                if (c == ' ') {
-                       //lyxerr << "reached safe pos\n";
+                       //lyxerr << "reached safe pos" << endl;
                        // we don't count the space into the safe pos
                        safe += curr;
                        // we reset to this safepos if the next chunk does not fit
@@ -103,12 +118,12 @@ void MathTextInset::metrics(MetricsInfo & mi, Dimension & dim) const
                        // This is a regular char. Go on if we either don't care for
                        // the width limit or have not reached that limit.
                        curr += cell(0)[i].width_;
-                       if (!mi.base.restrictwidth || curr + safe <= mi.base.textwidth)
+                       if (curr + safe <= mi.base.textwidth)
                                continue;
                }
 
                // We passed the limit. Create a row entry.
-               //lyxerr << "passed limit\n";
+               //lyxerr << "passed limit" << endl;
                cache_.appendRow();
                MathArray & ar = cache_.cell(cache_.nargs() - 1);
                MathGridInset::CellInfo & row = cache_.cellinfo_.back();
@@ -121,7 +136,7 @@ void MathTextInset::metrics(MetricsInfo & mi, Dimension & dim) const
                } else if (spaces) {
                        // but we had a space break before this position.
                        // so retreat to this position
-                       //lyxerr << "... but had safe pos.\n";
+                       //lyxerr << "... but had safe pos." << endl;
                        row.begin_ = begin;
                        row.end_   = safepos;  // this is position of the safe space
                        i          = safepos;  // i gets incremented at end of loop
@@ -130,13 +145,13 @@ void MathTextInset::metrics(MetricsInfo & mi, Dimension & dim) const
                } else {
                        // This item is too large and it is the only one.
                        // We have no choice but to produce an overfull box.
-                       lyxerr << "... without safe pos\n";
+                       lyxerr << "... without safe pos" << endl;
                        row.begin_ = begin;
                        row.end_   = i + 1;
                        begin      = i + 1;
                }
                ar = MathArray(cell(0).begin() + row.begin_, cell(0).begin() + row.end_);
-               //lyxerr << "line: " << ar << "\n";
+               //lyxerr << "line: " << ar << endl;
                // in any case, start the new row with empty boxes
                curr = 0;
                safe = 0;
@@ -148,7 +163,7 @@ void MathTextInset::metrics(MetricsInfo & mi, Dimension & dim) const
        row.begin_ = begin;
        row.end_   = cell(0).size();
        ar = MathArray(cell(0).begin() + row.begin_, cell(0).begin() + row.end_);
-       //lyxerr << "last line: " << ar.data() << "\n";
+       //lyxerr << "last line: " << ar.data() << endl;
 
        // what to report?
        cache_.metrics(mi, dim_);