change tracking:

* src/changes.h:
	* src/changes.C: remove constructor, destructor,
	copy constructor, reset(), and field empty_type_
	* src/paragraph_pimpl.C: comment out unwanted code


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15411 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2006-10-20 15:27:11 +00:00
parent 585e3a8730
commit de102c1cf3
3 changed files with 16 additions and 55 deletions

View File

@ -68,23 +68,6 @@ bool Changes::Range::intersects(Range const & r) const
} }
Changes::Changes(Change::Type const type)
: empty_type_(type)
{
}
Changes::~Changes()
{
}
Changes::Changes(Changes const & c)
{
table_ = c.table_;
}
void Changes::record(Change const & change, pos_type const pos) void Changes::record(Change const & change, pos_type const pos)
{ {
if (lyxerr.debugging(Debug::CHANGES)) { if (lyxerr.debugging(Debug::CHANGES)) {
@ -289,12 +272,6 @@ void Changes::add(Change const & change, ChangeTable::size_type const pos)
Change const Changes::lookup(pos_type const pos) const Change const Changes::lookup(pos_type const pos) const
{ {
if (!table_.size()) {
if (lyxerr.debugging(Debug::CHANGES))
lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl;
return Change(empty_type_);
}
ChangeTable::const_iterator it = table_.begin(); ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator const end = table_.end(); ChangeTable::const_iterator const end = table_.end();
@ -308,14 +285,8 @@ Change const Changes::lookup(pos_type const pos) const
} }
bool Changes::isChange(pos_type const start, pos_type const end) const bool Changes::isChanged(pos_type const start, pos_type const end) const
{ {
if (!table_.size()) {
if (lyxerr.debugging(Debug::CHANGES))
lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl;
return empty_type_ != Change::UNCHANGED;
}
ChangeTable::const_iterator it = table_.begin(); ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator const itend = table_.end(); ChangeTable::const_iterator const itend = table_.end();

View File

@ -45,21 +45,8 @@ bool operator!=(Change const & l, Change const & r);
class Changes { class Changes {
public: public:
Changes(Change::Type type);
~Changes();
Changes(Changes const &);
/// reset "default" change type (for empty pars)
void reset(Change::Type type) {
empty_type_ = type;
}
/// set the pos to the given change /// set the pos to the given change
void set(Change const & change, lyx::pos_type pos); void set(Change const & change, lyx::pos_type pos);
/// set the range to the given change /// set the range to the given change
void set(Change const & change, lyx::pos_type start, lyx::pos_type end); void set(Change const & change, lyx::pos_type start, lyx::pos_type end);
@ -70,7 +57,7 @@ public:
Change const lookup(lyx::pos_type pos) const; Change const lookup(lyx::pos_type pos) const;
/// return true if there is a change in the given range /// return true if there is a change in the given range
bool isChange(lyx::pos_type start, lyx::pos_type end) const; bool isChanged(lyx::pos_type start, lyx::pos_type end) const;
/// remove the given entry. This implies that a character was /// remove the given entry. This implies that a character was
/// deleted at pos, and will adjust all range bounds past it /// deleted at pos, and will adjust all range bounds past it
@ -120,9 +107,6 @@ private:
/// our table of changes, every row a range and change descriptor /// our table of changes, every row a range and change descriptor
ChangeTable table_; ChangeTable table_;
/// change type for an empty paragraph
Change::Type empty_type_;
/// handle a delete, either logical or physical (see erase) /// handle a delete, either logical or physical (see erase)
void del(Change const & change, ChangeTable::size_type pos); void del(Change const & change, ChangeTable::size_type pos);

View File

@ -77,8 +77,9 @@ Paragraph::Pimpl::Pimpl(Pimpl const & p, Paragraph * owner)
fontlist = p.fontlist; fontlist = p.fontlist;
id_ = paragraph_id++; id_ = paragraph_id++;
if (p.tracking()) // FIXME: change tracking (MG)
changes_.reset(new Changes(*p.changes_.get())); //if (p.tracking())
// changes_.reset(new Changes(*p.changes_.get()));
} }
@ -86,7 +87,8 @@ void Paragraph::Pimpl::setContentsFromPar(Paragraph const & par)
{ {
owner_->text_ = par.text_; owner_->text_ = par.text_;
if (par.pimpl_->tracking()) { if (par.pimpl_->tracking()) {
changes_.reset(new Changes(*(par.pimpl_->changes_.get()))); // FIXME: change tracking (MG)
// changes_.reset(new Changes(*(par.pimpl_->changes_.get())));
} }
} }
@ -97,7 +99,7 @@ bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const
if (!tracking()) if (!tracking())
return false; return false;
return changes_->isChange(start, end); return changes_->isChanged(start, end);
} }
@ -141,7 +143,8 @@ void Paragraph::Pimpl::acceptChange(pos_type start, pos_type end)
return; return;
if (!size()) { if (!size()) {
changes_.reset(new Changes(Change::UNCHANGED)); // FIXME: change tracking (MG)
// changes_.reset(new Changes(Change::UNCHANGED));
return; return;
} }
@ -171,7 +174,8 @@ void Paragraph::Pimpl::acceptChange(pos_type start, pos_type end)
} }
lyxerr[Debug::CHANGES] << "endacceptchange" << endl; lyxerr[Debug::CHANGES] << "endacceptchange" << endl;
changes_->reset(Change::UNCHANGED); // FIXME: change tracking (MG)
// changes_->reset(Change::UNCHANGED);
} }
@ -181,7 +185,8 @@ void Paragraph::Pimpl::rejectChange(pos_type start, pos_type end)
return; return;
if (!size()) { if (!size()) {
changes_.reset(new Changes(Change::UNCHANGED)); // FIXME: change tracking (MG)
// changes_.reset(new Changes(Change::UNCHANGED));
return; return;
} }
@ -210,7 +215,8 @@ void Paragraph::Pimpl::rejectChange(pos_type start, pos_type end)
break; break;
} }
} }
changes_->reset(Change::UNCHANGED); // FIXME: change tracking (MG)
// changes_->reset(Change::UNCHANGED);
} }