]> git.lyx.org Git - lyx.git/blobdiff - src/Changes.cpp
Fixup tooltips
[lyx.git] / src / Changes.cpp
index f8f70e1da8e721b513c6fc1157f0899f0467ab16..a579144a7a1f875b8e6fb60bfb22043017d8d582 100644 (file)
@@ -19,6 +19,7 @@
 #include "BufferParams.h"
 #include "Encoding.h"
 #include "LaTeXFeatures.h"
+#include "LyXRC.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "Paragraph.h"
@@ -379,7 +380,7 @@ docstring getLaTeXMarkup(docstring const & macro, Author const & author,
                                          "Choose an appropriate document encoding (such as utf8)\n"
                                          "or change the author initials."),
                                        uncodable_initials, author_initials_latexed.second));
-                               warned_author_initials.insert(uncodable_author);
+                               warned_author_initials.insert(uncodable_initials);
                        }
                }
        }
@@ -428,16 +429,14 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
 
        int column = 0;
 
-       bool const dvipost = LaTeXFeatures::isAvailable("dvipost") &&
-                       (runparams.flavor == OutputParams::LATEX
-                        || runparams.flavor == OutputParams::DVILUATEX);
-
        if (oldChange.type != Change::UNCHANGED) {
-               // close \lyxadded or \lyxdeleted
-               os << '}';
-               column++;
+               if (oldChange.type != Change::DELETED || runparams.ctObject != OutputParams::CT_OMITOBJECT) {
+                       // close \lyxadded or \lyxdeleted
+                       os << '}';
+                       column++;
+               }
                if (oldChange.type == Change::DELETED
-                   && !runparams.wasDisplayMath && !dvipost)
+                   && !runparams.wasDisplayMath)
                        --runparams.inulemcmd;
        }
 
@@ -448,9 +447,19 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
 
        docstring macro_beg;
        if (change.type == Change::DELETED) {
-               macro_beg = from_ascii("\\lyxdeleted");
-               if (!runparams.inDisplayMath && !dvipost)
-                       ++runparams.inulemcmd;
+               if (runparams.ctObject == OutputParams::CT_OMITOBJECT)
+                       return 0;
+               else if (runparams.ctObject == OutputParams::CT_OBJECT)
+                       macro_beg = from_ascii("\\lyxobjdeleted");
+               else if (runparams.ctObject == OutputParams::CT_DISPLAYOBJECT)
+                       macro_beg = from_ascii("\\lyxdisplayobjdeleted");
+               else if (runparams.ctObject == OutputParams::CT_UDISPLAYOBJECT)
+                       macro_beg = from_ascii("\\lyxudisplayobjdeleted");
+               else {
+                       macro_beg = from_ascii("\\lyxdeleted");
+                       if (!runparams.inDisplayMath)
+                               ++runparams.inulemcmd;
+               }
        }
        else if (change.type == Change::INSERTED)
                macro_beg = from_ascii("\\lyxadded");
@@ -459,15 +468,6 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
                                       bparams.authors().get(change.author),
                                       chgTime, runparams);
 
-       // signature needed by \lyxsout to correctly strike out display math
-       if (change.type == Change::DELETED && runparams.inDisplayMath
-           && !dvipost) {
-               if (os.blankLine())
-                       str += from_ascii("\\\\\\noindent\n");
-               else
-                       str += from_ascii("\\\\\\\\\n");
-       }
-
        os << str;
        column += str.size();
 
@@ -557,18 +557,10 @@ void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer,
 }
 
 
-void Changes::updateBuffer(Buffer const & buf)
-{
-       bool const changed = isChanged();
-       buf.setChangesPresent(buf.areChangesPresent() || changed);
-       previously_changed_ = changed;
-}
-
-
 void Change::paintCue(PainterInfo & pi, double const x1, double const y,
                       double const x2, FontInfo const & font) const
 {
-       if (!changed())
+       if (!changed() || (!lyxrc.ct_additions_underlined && inserted()))
                return;
        // Calculate 1/3 height of font
        FontMetrics const & fm = theFontMetrics(font);
@@ -594,11 +586,14 @@ void Change::paintCue(PainterInfo & pi, double const x1, double const y1,
        switch(type) {
        case UNCHANGED:
                return;
-       case INSERTED:
+       case INSERTED: {
+               if (!lyxrc.ct_additions_underlined)
+                       break;
                pi.pain.line(int(x1), int(y2) + 1, int(x2), int(y2) + 1,
                             color(), Painter::line_solid,
                             pi.base.solidLineThickness());
                return;
+       }
        case DELETED:
                // FIXME: we cannot use antialias since we keep drawing on the same
                // background with the current painting mechanism.