]> git.lyx.org Git - lyx.git/blobdiff - src/ParagraphMetrics.cpp
Move Dialog.{h,cpp} and ButtonPolicy.{h,cpp} to frontends/qt4/
[lyx.git] / src / ParagraphMetrics.cpp
index 02eb591ff7ff66e763ba65209d2a1899ce4bbeb6..8820a602294e286fd1c84c693ccf68d304c13b52 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,20 +97,27 @@ 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) {
                char_type const b[] = { par_->getChar(i) };
-               crc.process_bytes(b, 1);
+               crc.process_bytes(b, sizeof(char_type));
                if (bparams.trackChanges) {
                        Change change = par_->lookupChange(i);
                        char_type const b[] = { change.type };
+                       // 1 byte is enough to encode Change::Type
                        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};
+       // Each of the variable to process is 4 bytes: 4x5 = 20
+       crc.process_bytes(b, 20);
+
+       return crc.checksum();
 }
 
 
@@ -216,7 +224,7 @@ int ParagraphMetrics::rightMargin(Buffer const & buffer) const
 int ParagraphMetrics::singleWidth(pos_type pos, Font const & font) const
 {
        // The most special cases are handled first.
-       if (par_->isInset(pos);)
+       if (par_->isInset(pos))
                return insetDimension(par_->getInset(pos)).wid;
 
        char_type c = par_->getChar(pos);