]> git.lyx.org Git - lyx.git/blobdiff - src/ParagraphMetrics.cpp
* LaTeXFeatures.cpp (useLanguage):
[lyx.git] / src / ParagraphMetrics.cpp
index 6b889083086f6414e4b80e1fdc9d805f4ed4248c..f8901ecfc77d7728a021ea0a7aea1edfb8b06c2d 100644 (file)
@@ -35,6 +35,7 @@
 #include "OutputParams.h"
 #include "paragraph_funcs.h"
 #include "sgml.h"
+#include "TextClass.h"
 #include "TexRow.h"
 #include "VSpace.h"
 
@@ -96,8 +97,8 @@ void ParagraphMetrics::reset(Paragraph const & par)
 }
 
 
-void ParagraphMetrics::computeRowSignature(Row & row,
-               BufferParams const & bparams)
+size_t ParagraphMetrics::computeRowSignature(Row const & row,
+               BufferParams const & bparams) const
 {
        boost::crc_32_type crc;
        for (pos_type i = row.pos(); i < row.endpos(); ++i) {
@@ -109,7 +110,12 @@ void ParagraphMetrics::computeRowSignature(Row & row,
                        crc.process_bytes(b, 1);
                }                       
        }
-       row.setCrc(crc.checksum());
+
+       Dimension const & d = row.dimension();
+       char_type const b[] = { row.sel_beg, row.sel_end, d.wid, d.asc, d.des};
+       crc.process_bytes(b, 5);
+
+       return crc.checksum();
 }
 
 
@@ -215,12 +221,12 @@ int ParagraphMetrics::rightMargin(Buffer const & buffer) const
 
 int ParagraphMetrics::singleWidth(pos_type pos, Font const & font) const
 {
-       char_type c = par_->getChar(pos);
-
        // The most special cases are handled first.
-       if (c == Paragraph::META_INSET)
+       if (par_->isInset(pos))
                return insetDimension(par_->getInset(pos)).wid;
 
+       char_type c = par_->getChar(pos);
+
        if (!isPrintable(c))
                return theFontMetrics(font).width(c);