X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FChanges.cpp;h=d0356b8895ead3e34c9ba641f904004d0a73d87e;hb=7f17f13bfc2ad4e7cdd8ecfce23374e2b3d0c646;hp=6b5979b0bb00115ca351c6e18a7ff3fbdf08aaa7;hpb=8684c07664f00b743ea10b7e24fb3cf29641e366;p=lyx.git diff --git a/src/Changes.cpp b/src/Changes.cpp index 6b5979b0bb..d0356b8895 100644 --- a/src/Changes.cpp +++ b/src/Changes.cpp @@ -21,14 +21,13 @@ #include - -namespace lyx { - using std::abs; using std::endl; using std::string; using std::max; +namespace lyx { + /* * 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 @@ -37,7 +36,7 @@ using std::max; * When merging two adjacent changes, the changetime is not considered, * only the equality of the change type and author is checked (in method * isSimilarTo(...)). If two changes are in fact merged (in method merge()), - * the later change time is preserved. + * the later change time is preserved. */ bool Change::isSimilarTo(Change const & change) @@ -64,7 +63,7 @@ bool operator==(Change const & l, Change const & r) if (l.type == Change::UNCHANGED) { return true; } - + return l.author == r.author && l.changetime == r.changetime; } @@ -222,7 +221,7 @@ void Changes::insert(Change const & change, lyx::pos_type pos) Change const & Changes::lookup(pos_type const pos) const { static Change const noChange = Change(Change::UNCHANGED); - + ChangeTable::const_iterator it = table_.begin(); ChangeTable::const_iterator const end = table_.end(); @@ -282,7 +281,7 @@ void Changes::merge() (it + 1)->range.start = it->range.start; (it + 1)->change.changetime = max(it->change.changetime, - (it + 1)->change.changetime); + (it + 1)->change.changetime); table_.erase(it); // start again it = table_.begin(); @@ -314,7 +313,7 @@ int Changes::latexMarkChange(odocstream & os, BufferParams const & bparams, if (change.type == Change::DELETED) { docstring str = "\\lyxdeleted{" + bparams.authors().get(change.author).name() + "}{" + - chgTime + "}{"; + chgTime + "}{"; os << str; column += str.size(); } else if (change.type == Change::INSERTED) { @@ -357,4 +356,13 @@ void Changes::lyxMarkChange(std::ostream & os, int & column, } +void Changes::checkAuthors(AuthorList const & authorList) +{ + ChangeTable::const_iterator it = table_.begin(); + ChangeTable::const_iterator endit = table_.end(); + for ( ; it != endit ; ++it) + if (it->change.type != Change::UNCHANGED) + authorList.get(it->change.author).used(true); +} + } // namespace lyx