Change tracking:

Remove methods
   * trackChanges(...)
   * untrackChanges(...)
   * cleanChanges(...)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15262 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2006-10-06 19:59:41 +00:00
parent eb11f2c542
commit 238b880c22
8 changed files with 15 additions and 89 deletions

View File

@ -82,7 +82,9 @@ class resetParagraph : public std::unary_function<Paragraph, Buffer const &> {
public:
resetParagraph(Buffer const & b) : buffer_(b) {}
void operator()(Paragraph & p) const {
p.cleanChanges();
// FIXME: change tracking (MG)
// set p's text to INSERTED in CT mode; clear CT info otherwise
// ERT paragraphs have the Language latex_language.
// This is invalid outside of ERT, so we need to change it
// to the buffer language.
@ -209,9 +211,8 @@ pasteSelectionHelper(LCursor & cur, ParagraphList const & parlist,
tmpbuf->erase(i--);
}
// reset change tracking status
// FIXME: Change tracking (MG)
// tmpbuf->cleanChanges(Paragraph::trackingOn/Off);
// set tmpbuf's text to INSERTED in CT mode; clear CT info otherwise
}
bool const empty = pars[pit].empty();

View File

@ -321,10 +321,11 @@ void InsetText::markNew(bool track_changes)
ParagraphList::iterator pit = paragraphs().begin();
ParagraphList::iterator end = paragraphs().end();
for (; pit != end; ++pit) {
if (track_changes)
pit->trackChanges();
else // no-op when not tracking
pit->cleanChanges();
// FIXME: change tracking (MG)
// if (track_changes)
// set pit's text to UNCHANGED
// else
// set pit's text to INSERTED in CT mode; reset CT info otherwise
}
}

View File

@ -1417,24 +1417,6 @@ void Paragraph::setContentsFromPar(Paragraph const & par)
}
void Paragraph::trackChanges(Change::Type type)
{
pimpl_->trackChanges(type);
}
void Paragraph::untrackChanges()
{
pimpl_->untrackChanges();
}
void Paragraph::cleanChanges(ChangeTracking ct)
{
pimpl_->cleanChanges(ct);
}
Change const Paragraph::lookupChange(lyx::pos_type pos) const
{
BOOST_ASSERT(pos <= size());

View File

@ -204,15 +204,6 @@ public:
///
InsetBibitem * bibitem() const; // ale970302
/// initialise tracking for this par
void trackChanges(Change::Type = Change::UNCHANGED);
/// stop tracking
void untrackChanges();
/// set entire paragraph to new text for change tracking
void cleanChanges(ChangeTracking ct = trackingUnknown);
/// look up change at given pos
Change const lookupChange(lyx::pos_type pos) const;

View File

@ -186,11 +186,10 @@ void breakParagraph(BufferParams const & bparams,
// subtle, but needed to get empty pars working right
if (bparams.trackChanges) {
// FIXME: Change tracking (MG)
if (!par.size()) {
par.cleanChanges();
} else if (!tmp->size()) {
tmp->cleanChanges();
}
// if (!par.size())
// set 'par' text to INSERTED in CT mode; clear CT info otherwise
// else if (!tmp->size())
// set 'tmp' text to INSERTED in CT mode; clear CT info otherwise
}
}

View File

@ -90,45 +90,6 @@ void Paragraph::Pimpl::setContentsFromPar(Paragraph const & par)
}
void Paragraph::Pimpl::trackChanges(Change::Type type)
{
if (tracking()) {
lyxerr[Debug::CHANGES] << "already tracking for par " << id_ << endl;
return;
}
lyxerr[Debug::CHANGES] << "track changes for par "
<< id_ << " type " << type << endl;
changes_.reset(new Changes(type));
changes_->set(type, 0, size() + 1);
}
void Paragraph::Pimpl::untrackChanges()
{
changes_.reset(0);
}
void Paragraph::Pimpl::cleanChanges(Paragraph::ChangeTracking ct)
{
// if the paragraph was not tracked and we don't know the buffer's
// change tracking state, we do nothing
if ((ct == Paragraph::trackingUnknown) && !tracking())
return;
// untrack everything if we are in a buffer where ct is disabled
else if (ct == Paragraph::trackingOff) {
untrackChanges();
return;
}
// in a buffer where ct is enabled, set everything to INSERTED
changes_.reset(new Changes(Change::INSERTED));
changes_->set(Change::INSERTED, 0, size() + 1);
}
bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const
{
if (!tracking())

View File

@ -38,12 +38,6 @@ public:
//
// Change tracking
//
/// set tracking mode
void trackChanges(Change::Type type = Change::UNCHANGED);
/// stop tracking
void untrackChanges();
/// set all text as new for change mode
void cleanChanges(Paragraph::ChangeTracking ct = Paragraph::trackingUnknown);
/// look up change at given pos
Change const lookupChange(lyx::pos_type pos) const;
/// is there a change within the given range ?

View File

@ -325,11 +325,8 @@ void readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex,
par.insertInset(par.size(), new InsetPagebreak, font, change);
} else if (token == "\\change_unchanged") {
// Hack ! Needed for empty paragraphs :/
// FIXME: is it still ??
/*
if (!par.size())
par.cleanChanges();
*/
// FIXME: change tracking (MG)
// set empty 'par' to INSERTED???
change = Change(Change::UNCHANGED);
} else if (token == "\\change_inserted") {
lex.eatLine();