change tracking:

* src/changes.h: pass Change and Range to ChangeRange constructor
	* src/changes.C: adjust


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15448 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2006-10-21 13:47:50 +00:00
parent f70d9515cb
commit 26b0abe7dc
2 changed files with 8 additions and 7 deletions

View File

@ -110,7 +110,7 @@ void Changes::set(Change const & change,
if (it == itend) { if (it == itend) {
lyxerr[Debug::CHANGES] << "Inserting change at end" << endl; lyxerr[Debug::CHANGES] << "Inserting change at end" << endl;
table_.push_back(ChangeRange(start, end, change)); table_.push_back(ChangeRange(change, Range(start, end)));
merge(); merge();
return; return;
} }
@ -130,7 +130,7 @@ void Changes::set(Change const & change,
// split head // split head
if (c.range.start < start) { if (c.range.start < start) {
it = table_.insert(it, ChangeRange(c.range.start, start, c.change)); it = table_.insert(it, ChangeRange(c.change, Range(c.range.start, start)));
if (lyxerr.debugging(Debug::CHANGES)) { if (lyxerr.debugging(Debug::CHANGES)) {
lyxerr[Debug::CHANGES] << "Splitting head of type " << c.change.type lyxerr[Debug::CHANGES] << "Splitting head of type " << c.change.type
<< " over " << c.range.start << "," << start << endl; << " over " << c.range.start << "," << start << endl;
@ -147,7 +147,7 @@ void Changes::set(Change const & change,
// split tail // split tail
if (c.range.end > end) { if (c.range.end > end) {
++it; ++it;
table_.insert(it, ChangeRange(end, c.range.end, c.change)); table_.insert(it, ChangeRange(c.change, Range(end, c.range.end)));
if (lyxerr.debugging(Debug::CHANGES)) { if (lyxerr.debugging(Debug::CHANGES)) {
lyxerr[Debug::CHANGES] << "Splitting tail of type " << c.change.type lyxerr[Debug::CHANGES] << "Splitting tail of type " << c.change.type
<< " over " << end << "," << c.range.end << endl; << " over " << end << "," << c.range.end << endl;

View File

@ -96,10 +96,11 @@ private:
class ChangeRange { class ChangeRange {
public: public:
ChangeRange(pos_type s, pos_type e, Change const & c) ChangeRange(Change const & c, Range const & r)
: range(Range(s, e)), change(c) {} : change(c), range(r) {}
Range range;
Change change; Change change;
Range range;
}; };
/// merge neighbouring ranges, assuming that they are abutting /// merge neighbouring ranges, assuming that they are abutting
@ -107,7 +108,7 @@ private:
typedef std::vector<ChangeRange> ChangeTable; typedef std::vector<ChangeRange> ChangeTable;
/// our table of changes, every row a range and change descriptor /// table of changes, every row a change and range descriptor
ChangeTable table_; ChangeTable table_;
}; };