On Tue, Feb 19, 2002 at 12:39:00AM +0100, Lars Gullik Bjønnes wrote:
 
> John Levon <[EMAIL PROTECTED]> writes:
> 
> | On Mon, Feb 18, 2002 at 11:38:42PM +0200, Martin Vermeer wrote:
> >
> >> Remedy: Make cut & paste keep track of the layouts by name rather than
> >> by number, or convert the numbers. (Easier said than done!)
> >
> | indeed but I guess it needs doing.
> 
> I am looking into this now.
> 
> | It's also possible to get the same behaviour
> | with a combination of undo, redo, and changing document class. It's been
> | discussed vbefore, but given that we know two crasher testcases (at least) I
> | guess its time has come ...
> 
> on it...
> 
> -- 
>       Lgb

I suppose the way to proceed is the following: Where is defined, in 
lyxtextclasslist.[Ch], the global varialble textclasslist, we should
also define a global variable selectiontextclass.

Then, in CutAndPaste, there is the convenient routine
SwitchLayoutsBetweenClasses, which does precisely what we want.

When cutting into the selection buffer, assign the source doc's 
textclass to selectiontextclass. Then, on paste, if the target doc's
textclass is a different one, traverse all paragraphs and convert them,
first from number to name using the old list, then back to number again
using the new list (this is where SwitchLayoutsBetweenClasses comes in). 

Failure leads to the Standard=0 class, and an error box.

When I look at CutAndPaste, this seems to be already done... using the
variable "textclass" (line 57) which receives the source textclass (lines
91 and 164) upon cut and copy, and is used on line 295. 

Why doesn't this work already? Is "textclass" a global variable?

Ahhh... a new paragraph is created at line 229. Inside that operation
another creation takes place, of a Paragraph::Pimpl, and then I lose
track... but somewhere it there, getLayout gets called, *still with the 
old layout value*. This should not happen I suppose.

Martin

Attachment: msg33177/pgp00000.pgp
Description: PGP signature

Reply via email to