Change tracking:

src/paragraph.h: remove obsolete isChangeEdited(...);
        remove obsolete isInsertedText(...); turn 
        isDeletedText(...) into Paragraph::isDeleted(...)

        src/paragraph_pimpl.h: remove obsolete isChangeEdited(...)

        src/changes.h: remove obsolete isChangeEdited(...)

        src/insets/insetert.C:
        src/paragraph_pimpl.C:
        src/frontends/controllers/ControlSpellchecker.C:
        src/rowpainter.C:
        src/changes.C:
        src/paragraph.C:
        src/buffer_funcs.C: adjust properly


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15371 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2006-10-19 12:49:11 +00:00
parent ee89a6e45e
commit b55f70432c
10 changed files with 12 additions and 64 deletions

View File

@ -260,7 +260,7 @@ int countWords(DocIterator const & from, DocIterator const & to)
if (dit.inTexted()
&& dit.pos() != dit.lastpos()
&& dit.paragraph().isLetter(dit.pos())
&& !isDeletedText(dit.paragraph(), dit.pos())) {
&& !dit.paragraph().isDeleted(dit.pos())) {
if (!inword) {
++count;
inword = true;

View File

@ -368,28 +368,6 @@ bool Changes::isChange(pos_type const start, pos_type const end) const
}
bool Changes::isChangeEdited(lyx::pos_type const start,
lyx::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::INSERTED;
}
ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator const itend = table_.end();
for (; it != itend; ++it) {
if (it->range.intersects(Range(start, end ? end - 1 : 0))
&& it->change.type != Change::INSERTED) {
return true;
}
}
return false;
}
void Changes::merge()
{
if (lyxerr.debugging(Debug::CHANGES))

View File

@ -78,9 +78,6 @@ public:
/// return true if there is a change in the given range
bool isChange(lyx::pos_type start, lyx::pos_type end) const;
/// return true if there is a deleted or unchanged range contained
bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const;
/// remove the given entry. This implies that a character was
/// deleted at pos, and will adjust all range bounds past it
void erase(lyx::pos_type pos);

View File

@ -139,7 +139,7 @@ bool isLetter(DocIterator const & dit)
// We want to pass the ' and escape chars to ispell
|| contains(lyx::from_utf8(lyxrc.isp_esc_chars + '\''),
dit.paragraph().getChar(dit.pos())))
&& !isDeletedText(dit.paragraph(), dit.pos());
&& !dit.paragraph().isDeleted(dit.pos());
}

View File

@ -154,7 +154,7 @@ int InsetERT::latex(Buffer const &, ostream & os,
pos_type siz = par->size();
for (pos_type i = 0; i < siz; ++i) {
// ignore all struck out text
if (isDeletedText(*par, i))
if (par->isDeleted(i))
continue;
os << par->getChar(i);

View File

@ -1434,12 +1434,6 @@ bool Paragraph::isChanged(pos_type start, pos_type end) const
}
bool Paragraph::isChangeEdited(pos_type start, pos_type end) const
{
return pimpl_->isChangeEdited(start, end);
}
void Paragraph::setChange(Change const & change)
{
pimpl_->setChange(change);

View File

@ -200,9 +200,10 @@ public:
/// is there a change within the given range ?
bool isChanged(lyx::pos_type start, lyx::pos_type end) const;
/// is there a non-addition in this range ?
bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const;
/// is there a deletion at the given pos ?
bool isDeleted(lyx::pos_type pos) const {
return lookupChange(pos).type == Change::DELETED;
}
/// set change type at given pos
void setChangeType(lyx::pos_type pos, Change::Type type);
@ -415,16 +416,4 @@ private:
Pimpl * pimpl_;
};
inline bool isInsertedText(Paragraph const & par, lyx::pos_type pos)
{
return par.lookupChange(pos).type == Change::INSERTED;
}
inline bool isDeletedText(Paragraph const & par, lyx::pos_type pos)
{
return par.lookupChange(pos).type == Change::DELETED;
}
#endif // PARAGRAPH_H

View File

@ -92,6 +92,7 @@ void Paragraph::Pimpl::setContentsFromPar(Paragraph const & par)
bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const
{
// FIXME: change tracking (MG)
if (!tracking())
return false;
@ -99,15 +100,6 @@ bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const
}
bool Paragraph::Pimpl::isChangeEdited(pos_type start, pos_type end) const
{
if (!tracking())
return false;
return changes_->isChangeEdited(start, end);
}
void Paragraph::Pimpl::setChange(Change const & change)
{
// FIXME: change tracking (MG)

View File

@ -42,8 +42,6 @@ public:
Change const lookupChange(lyx::pos_type pos) const;
/// is there a change within the given range ?
bool isChanged(lyx::pos_type start, lyx::pos_type end) const;
/// is there a non-addition in this range ?
bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const;
/// set change for the entire par
void setChange(Change const & change);
/// set change type at given pos

View File

@ -173,7 +173,7 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
bv_.buffer()->params().getFont() :
font;
pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
pi.erased_ = erased_ || isDeletedText(par_, pos);
pi.erased_ = erased_ || par_.isDeleted(pos);
bv_.coordCache().insets().add(inset, int(x_), yo_);
InsetText const * const in = inset->asTextInset();
// non-wide insets are painted completely. Recursive
@ -688,7 +688,7 @@ void RowPainter::paintText()
continue;
}
is_struckout = isDeletedText(par_, pos);
is_struckout = par_.isDeleted(pos);
if (is_struckout && !running_strikeout) {
running_strikeout = true;