Re: NSTextView pagination

2016-07-07 Thread Graham Cox

> On 8 Jul 2016, at 2:42 AM, Jonathan Mitchell  wrote:
> 
> could supply a new view that would correspond to the new page orientation (if 
> I could get an appropriate   notification) but NSPrintOperation’s -view 
> is readonly.


Do it this way. The textview can share the same NSTextStorage as the GUI view.

When you create the NSPrintOperation, you pass it the view to use, so you can 
create the new view then, set its text storage and away it goes. It’s usually 
much easier to set up a separate printing view than trying to make a single 
view adapt itself to deal with both situations.

—Graham



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

NSTextView pagination

2016-07-07 Thread Jonathan Mitchell
Is there a recommended way to change the content of an NSTextView subclass 
during an NSPrintOperation preview?
My subclass needs to adjust its content depending on the NSPrintInfo page 
orientation.
Drawing into the margin with NSView -drawPageBorderWithSize: is not an 
appropriate solution in this case.

I have tried manipulating the views attributed string content in
- (BOOL)knowsPageRange:(NSRangePointer)range
but this logs CG warnings and can behave unpredictably - presumably because the 
content is getting manipulated at an inappropriate point.
It also doesn’t produce the correct paginated output.

Any ideas?

I could supply a new view that would correspond to the new page orientation (if 
I could get an appropriate   notification) but NSPrintOperation’s -view is 
readonly.

Thanks

Jonathan



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com