X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FChanges.cpp;h=97596b4b9268a90501b6617e22522dd3fdc6b4b1;hb=14fa2c71625c715ffcc42d13ee0151333079de2c;hp=877c3f104281fec2c8cee5b3f4b31b10e67be6a6;hpb=b917c4e40f9f5cd3d101444600eddafcca54d6e3;p=lyx.git diff --git a/src/Changes.cpp b/src/Changes.cpp index 877c3f1042..97596b4b92 100644 --- a/src/Changes.cpp +++ b/src/Changes.cpp @@ -19,6 +19,7 @@ #include "BufferParams.h" #include "Encoding.h" #include "LaTeXFeatures.h" +#include "MetricsInfo.h" #include "OutputParams.h" #include "Paragraph.h" #include "TocBackend.h" @@ -30,6 +31,8 @@ #include "support/mutex.h" #include "frontends/alert.h" +#include "frontends/FontMetrics.h" +#include "frontends/Painter.h" #include @@ -37,6 +40,9 @@ using namespace std; namespace lyx { +using frontend::Painter; +using frontend::FontMetrics; + /* * Class Change has a changetime field that specifies the exact time at which * a specific change was made. The change time is used as a guidance for the @@ -545,6 +551,46 @@ void Changes::updateBuffer(Buffer const & buf) } +void Change::paintCue(PainterInfo & pi, double const x1, double const y, + double const x2, FontInfo const & font) const +{ + if (!changed()) + return; + // Calculate 1/3 height of font + FontMetrics const & fm = theFontMetrics(font); + int const y_bar = deleted() ? y - fm.maxAscent() / 3 + : y + 2 * pi.base.solidLineOffset() + pi.base.solidLineThickness(); + pi.pain.line(int(x1), y_bar, int(x2), y_bar, color(), + Painter::line_solid, pi.base.solidLineThickness()); +} + + +void Change::paintCue(PainterInfo & pi, double const x1, double const y1, + double const x2, double const y2) const +{ + /* + * y1 / + * / + * / + * / + * / + * y2 /_____ + * x1 x2 + */ + double y = 0; + switch(type) { + case UNCHANGED: + return; + case INSERTED: + y = y2; + break; + case DELETED: + y = y1; + break; + } + pi.pain.line(x1, y2, x2, y, color(), Painter::line_solid, + pi.base.solidLineThickness()); +} } // namespace lyx