Re: PDFDocument subclass with an undo manager

2008-07-01 Thread Kevin Ross
That did the trick, thank you for the insight.  It seems so obvious  
after the fact!

Thank  you again very much!

- Kevin



On Jun 30, 2008, at 6:23 PM, Graham Cox wrote:

It won't redo because when it performs the undo, it is calling - 
initWithData: directly, and I take it from this snippet that  
initWithData: isn't recording the undo.


You need to create a wrapper method for initWithData that contains  
the undo recording step, then make that method the target of the  
undo, something like:


- (void)myInitWithData:(NSData*) newData
{
	[[undoManager prepareWithInvocationTarget:self] myInitWithData: 
[self oldData]];

[self initWithData:newData];
}


hth,

cheers, Graham




On 1 Jul 2008, at 9:02 am, Kevin Ross wrote:

Hi everyone, I have a question that might seems a little silly.  I  
have a PDFDocument subclass which can perform page impositions.  I  
would also like to be able to undo the impositions.  In the methods  
I have this when I make the change to the PDF:


[[undoManager prepareWithInvocationTarget:self] initWithData:[self  
dataRepresentation]];

[self initWithData:(NSData *)newPDFData];


When I call -undo: later, it works, but I can't get it to -redo:

Is what I'm trying to do even possible this way ?  Is there a  
better way?


Thanks for any pointers and/or suggestions!!

Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: PDFDocument subclass with an undo manager

2008-06-30 Thread Graham Cox
It won't redo because when it performs the undo, it is calling - 
initWithData: directly, and I take it from this snippet that  
initWithData: isn't recording the undo.


You need to create a wrapper method for initWithData that contains the  
undo recording step, then make that method the target of the undo,  
something like:


- (void)myInitWithData:(NSData*) newData
{
	[[undoManager prepareWithInvocationTarget:self] myInitWithData:[self  
oldData]];

[self initWithData:newData];
}


hth,

cheers, Graham




On 1 Jul 2008, at 9:02 am, Kevin Ross wrote:

Hi everyone, I have a question that might seems a little silly.  I  
have a PDFDocument subclass which can perform page impositions.  I  
would also like to be able to undo the impositions.  In the methods  
I have this when I make the change to the PDF:


[[undoManager prepareWithInvocationTarget:self] initWithData:[self  
dataRepresentation]];

[self initWithData:(NSData *)newPDFData];


When I call -undo: later, it works, but I can't get it to -redo:

Is what I'm trying to do even possible this way ?  Is there a better  
way?


Thanks for any pointers and/or suggestions!!

Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


PDFDocument subclass with an undo manager

2008-06-30 Thread Kevin Ross
Hi everyone, I have a question that might seems a little silly.  I  
have a PDFDocument subclass which can perform page impositions.  I  
would also like to be able to undo the impositions.  In the methods I  
have this when I make the change to the PDF:


[[undoManager prepareWithInvocationTarget:self] initWithData:[self  
dataRepresentation]];

[self initWithData:(NSData *)newPDFData];


When I call -undo: later, it works, but I can't get it to -redo:

Is what I'm trying to do even possible this way ?  Is there a better  
way?


Thanks for any pointers and/or suggestions!!

Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]