• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Need advice on creating a new document from within another document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need advice on creating a new document from within another document


  • Subject: Need advice on creating a new document from within another document
  • From: WT <email@hidden>
  • Date: Mon, 22 Dec 2008 05:17:51 +0100

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 (email@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Number Formatter Problems in IB
  • Next by Date: Managed Object won't dealloc even after Hit with Kitchen Sink
  • Previous by thread: Number Formatter Problems in IB
  • Next by thread: Managed Object won't dealloc even after Hit with Kitchen Sink
  • Index(es):
    • Date
    • Thread