mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* src/paragraph.h (public): new enum ChangeTracking,
indicating if ct is used in the current buffer. (cleanChanges): pass enum ChangeTracking. * src/paragraph_pimpl.C (cleanChanges): delete ct marks from paste content if ct is of in the buffer. Set content INSERTED if ct is on (bug 2207). * src/CutAndPaste.C (pasteSelectionHelper): pass information about the current change tracking state to cleanChanges. * src/paragraph_pimpl.h (cleanChanges): pass enum ChangeTracking. * src/paragraph.C (cleanChanges): pass enum ChangeTracking. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13666 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6fb5b5cd4e
commit
d27e1b9dd7
@ -172,6 +172,12 @@ pasteSelectionHelper(Buffer const & buffer,
|
||||
!pars[pit].insetAllowed(tmpbuf->getInset(i)->lyxCode()))
|
||||
tmpbuf->erase(i--);
|
||||
}
|
||||
|
||||
// reset change tracking status
|
||||
if (buffer.params().tracking_changes)
|
||||
tmpbuf->cleanChanges(Paragraph::trackingOn);
|
||||
else
|
||||
tmpbuf->cleanChanges(Paragraph::trackingOff);
|
||||
}
|
||||
|
||||
bool const empty = pars[pit].empty();
|
||||
|
@ -1620,9 +1620,9 @@ void Paragraph::untrackChanges()
|
||||
}
|
||||
|
||||
|
||||
void Paragraph::cleanChanges()
|
||||
void Paragraph::cleanChanges(ChangeTracking ct)
|
||||
{
|
||||
pimpl_->cleanChanges();
|
||||
pimpl_->cleanChanges(ct);
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,6 +72,15 @@ public:
|
||||
META_INSET = 1
|
||||
//META_INSET = 0x200001 // above 0x10ffff, for ucs-4
|
||||
};
|
||||
enum ChangeTracking
|
||||
{
|
||||
/// Change tracking is "on" in this buffer
|
||||
trackingOn,
|
||||
/// Change tracking is "off" in this buffer
|
||||
trackingOff,
|
||||
/// Change tracking is "unknown" in this buffer
|
||||
trackingUnknown
|
||||
};
|
||||
///
|
||||
typedef lyx::char_type value_type;
|
||||
///
|
||||
@ -209,7 +218,7 @@ public:
|
||||
void untrackChanges();
|
||||
|
||||
/// set entire paragraph to new text for change tracking
|
||||
void cleanChanges();
|
||||
void cleanChanges(ChangeTracking ct = trackingUnknown);
|
||||
|
||||
/// look up change type at given pos
|
||||
Change::Type lookupChange(lyx::pos_type pos) const;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "paragraph_pimpl.h"
|
||||
#include "paragraph.h"
|
||||
|
||||
#include "bufferparams.h"
|
||||
#include "debug.h"
|
||||
@ -109,12 +110,20 @@ void Paragraph::Pimpl::untrackChanges()
|
||||
}
|
||||
|
||||
|
||||
void Paragraph::Pimpl::cleanChanges()
|
||||
void Paragraph::Pimpl::cleanChanges(Paragraph::ChangeTracking ct)
|
||||
{
|
||||
// if we're not tracking, we don't want to reset...
|
||||
if (!tracking())
|
||||
// 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);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
/// stop tracking
|
||||
void untrackChanges();
|
||||
/// set all text as new for change mode
|
||||
void cleanChanges();
|
||||
void cleanChanges(Paragraph::ChangeTracking ct = Paragraph::trackingUnknown);
|
||||
/// look up change type at given pos
|
||||
Change::Type lookupChange(lyx::pos_type pos) const;
|
||||
/// look up change at given pos
|
||||
|
Loading…
Reference in New Issue
Block a user