From: Vincent van Ravesteijn Date: Tue, 4 Aug 2009 23:01:06 +0000 (+0000) Subject: Some small code simplications. X-Git-Tag: 2.0.0~5842 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3114ce609cc04f0eb698c445446ba12e6efeafaf;p=lyx.git Some small code simplications. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30866 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 267e2ebfbe..6f1c408aba 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -759,7 +759,7 @@ void Paragraph::Private::latexInset( column = 0; } - if (owner_->lookupChange(i).deleted()) { + if (owner_->isDeleted(i)) { if( ++runparams.inDeletedInset == 1) runparams.changeOfDeletedInset = owner_->lookupChange(i); } @@ -848,7 +848,7 @@ void Paragraph::Private::latexInset( column += os.tellp() - len; } - if (owner_->lookupChange(i).deleted()) + if (owner_->isDeleted(i)) --runparams.inDeletedInset; } diff --git a/src/Text.cpp b/src/Text.cpp index e75e94c8d1..73c16f1d77 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -795,8 +795,8 @@ void Text::acceptOrRejectChanges(Cursor & cur, ChangeOp op) LASSERT(this == cur.text(), /**/); if (!cur.selection()) { - Change const & change = cur.paragraph().lookupChange(cur.pos()); - if (!(change.changed() && findNextChange(&cur.bv()))) + bool const changed = cur.paragraph().isChanged(cur.pos()); + if (!(changed && findNextChange(&cur.bv()))) return; } @@ -1356,7 +1356,7 @@ docstring Text::currentState(Cursor const & cur) const Change change = par.lookupChange(cur.pos()); - if (change.type != Change::UNCHANGED) { + if (change.changed()) { Author const & a = buf.params().authors().get(change.author); os << _("Change: ") << a.name(); if (!a.email().empty()) diff --git a/src/Text3.cpp b/src/Text3.cpp index 18ec4777ed..617a3ef6d7 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -2557,10 +2557,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, // However, without proper optimizations, this will inevitably // result in unacceptable performance - just imagine a user who // wants to select the complete content of a long document. - if (!cur.selection()) { - Change const & change = cur.paragraph().lookupChange(cur.pos()); - enable = change.changed(); - } else + if (!cur.selection()) + enable = cur.paragraph().isChanged(cur.pos()); + else // TODO: context-sensitive enabling of LFUN_CHANGE_ACCEPT/REJECT // for selections. enable = true; diff --git a/src/paragraph_funcs.cpp b/src/paragraph_funcs.cpp index f1f018ddbe..dfc895d1f1 100644 --- a/src/paragraph_funcs.cpp +++ b/src/paragraph_funcs.cpp @@ -191,7 +191,7 @@ void mergeParagraph(BufferParams const & bparams, // the imaginary end-of-paragraph character (at par.size()) has to be // marked as unmodified. Otherwise, its change is adopted by the first // character of the next paragraph. - if (par.lookupChange(par.size()).type != Change::UNCHANGED) { + if (par.isChanged(par.size())) { LYXERR(Debug::CHANGES, "merging par with inserted/deleted end-of-par character"); par.setChange(par.size(), Change(Change::UNCHANGED));