X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FChanges.cpp;h=97596b4b9268a90501b6617e22522dd3fdc6b4b1;hb=14fa2c71625c715ffcc42d13ee0151333079de2c;hp=616daf029f50aa615d4bba3a5a919d6cbf8fc798;hpb=6d4e6aad24edb7bcfbc49f03d2432fc9fa06954d;p=lyx.git diff --git a/src/Changes.cpp b/src/Changes.cpp index 616daf029f..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 @@ -138,6 +144,8 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en << ", author: " << change.author << ", time: " << long(change.changetime) << ") in range (" << start << ", " << end << ")"); + if (!isChanged()) + is_update_required_ = true; } Range const newRange(start, end); @@ -543,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