diff --git a/src/ChangeLog b/src/ChangeLog index abbac56c08..621f676c27 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2006-04-13 Jürgen Spitzmüller + + * 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. + 2006-04-11 Jean-Marc Lasgouttes * version.C.in: update date for 1.4.1. diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 373ee6c01b..3f13d8b10a 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -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(); diff --git a/src/paragraph.C b/src/paragraph.C index 6cf2afa1c4..5904e014cd 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1620,9 +1620,9 @@ void Paragraph::untrackChanges() } -void Paragraph::cleanChanges() +void Paragraph::cleanChanges(ChangeTracking ct) { - pimpl_->cleanChanges(); + pimpl_->cleanChanges(ct); } diff --git a/src/paragraph.h b/src/paragraph.h index 27038e0ff1..3602c0fc08 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -71,6 +71,15 @@ public: /// all these places. META_INSET = 1 }; + 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 char value_type; /// @@ -208,7 +217,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; diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 4ffd914f3e..90c923880b 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -14,6 +14,7 @@ #include #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); } diff --git a/src/paragraph_pimpl.h b/src/paragraph_pimpl.h index 488e7e4ded..1c1d43b92f 100644 --- a/src/paragraph_pimpl.h +++ b/src/paragraph_pimpl.h @@ -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 diff --git a/status.14x b/status.14x index 1a5ac299c3..5a8e79f2ac 100644 --- a/status.14x +++ b/status.14x @@ -43,6 +43,9 @@ What's new - When pasting contents to a tabular with the middle mouse, the language has sometimes be changed. This is fixed now. +- Set change tracking marks properly when copying between documents with different change + tracking status (bug 2207). + * Configuration/Installation: - Make LyX/Win work under windows 98.