Hello folks,

in the document-based application I'm writing, a document shows in its window some graphics resulting from some long-running computations. The user can then select a rectangular area of that graphical output and, by double-clicking on it, zoom in on it by creating a *new* document that re-computes the output only for the area in question, displaying it in the full-sized window of the new document.

Of course, the first time the application is launched (and whenever the user creates a new document by "normal" means), the zoom-in area is the full bounds rectangle of the document window's main view.

My problem is in figuring out how to pass the zoom-in area (when the user double-clicks on it) to the appropriate object in order to create a new document that does *not* use the full bounds rectangle of the document window's main view as its zoom-in area.

I've already managed to pass the zoom-in area in a clean way from the document window's main view to the document window's associated window controller and, from there, to the associated document.

The problem now is that if I issue a request for a new document, from the current document, there's no way that I can see to pass the zoom- in area to the document controller in a way that bypasses the default behavior.

It seems to me that I have no choice but to subclass NSDocumentController but, even then, where do I inject a custom zoom- in area?

The way I see it, I need to have a custom initializer for my documents and I need that custom initializer to be called from the document controller, with different arguments at different times (that is, with the default argument when the application starts and whenever the user creates a regular new document, but with a custom argument when the user double-clicks on a selected rectangle of the current document's main view).

Sure, I can override NSDocument's designated initializer (-init) in my NSDocument subclass, but *every* new document will *still* use the default zoom-in area.

Any help is appreciated.

Thanks in advance.
Wagner
_______________________________________________

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 arch...@mail-archive.com

Reply via email to