bugGNUstep - Bugs: bug #3346, NSDocument actions are not...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #3346: NSDocument actions are not reachable

Submitted by:  Stefan Urbanek <stefanu>
Submitted on:  Sun 27 Apr 2003 08:06:42 PM UTC  
 
Category: Gui/AppKitSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: Nicola Pero <nico>
Open/Closed: Closed

Thu 05 Oct 2006 05:37:13 PM UTC, comment #5:

Marking as fixed, since it's closed and obviously working. :)

Gregory John Casamento <gcasa>
Project Administrator
Mon 28 Apr 2003 12:21:32 PM UTC, comment #4:

NSApplication -targetForAction: was not checking if the
keyWindow's NSDocument responded to the action. Fixed on CVS.

Thanks for reporting the problem.

Nicola Pero <nico>
Project MemberIn charge of this item.
Mon 28 Apr 2003 10:15:20 AM UTC, comment #3:

No - the methods should be implemented only in NSDocument.
There is a precise reason for this - when you subclass
NSDocument, you might want to add new methods other than save/close. Those methods should be immediately available
to the main menu without the need of wrapping them manually
in NSWindowController/NSDocumentController.

It fits in the general philosophy that actions of the active
objects are activated and can be called directly from the menu. That makes simple to add new actions to objects which
can be active, and new menu items calling those actions without modifications of other parts of the software.

The problem you are having is definitely due to not setting
up correctly the various connections required in NSDocument-base applications. Those connections are
confusing to set up; Apple seems to have targeted too much flexibility at the expense of simplicity.

Without source code of what you have done, it's difficult
to guess what needs changing, so I'll point you to examples
instead:

I'm not sure if Ink (gui-only version) is right - it's a while I don't look at it; but the Renaissance version
of Ink (included in the Renaissance example applications)
is definitely right and it works (on both GNUstep and
Apple OS X).

Renaissance also uses both a customized NSDocument and NSWindowController in order to support loading nib files
from .gsmarkup rather than .gorm; you might take that as
an example of using both customized.

Else, if you still can't figure out how to set up the
connections properly, please submit the code you are using.

Nicola Pero <nico>
Project MemberIn charge of this item.
Mon 28 Apr 2003 07:12:04 AM UTC, comment #2:

Yes, this is what was done in Ink.app , but it is not the right way. It does not make sense to have NSWindowController if you have to make document a delegate of a window. According to apple docs in "Document based applications: Window controllers and nib files" delegate of window does not have to be used or it can be set to the window controller.

Actually, those save* and close: methods have to be implemented in NSDocumentController (not in nswindow controller, because it does not have to be a delegate of the window) and forwarded to current active document. Attached is a patch for NSDocumentController. Ignore previous patch.

Stefan Urbanek <stefanu>
Project Member
Sun 27 Apr 2003 08:41:38 PM UTC, comment #1:

The trick I found is that you have to set the NSDocument as the delegate of NSWindow. But It doesn't make sense if you have your own NSWindowController.
Anyway, just a comment.

-Deleted Account- <yjchen>
Sun 27 Apr 2003 08:06:42 PM UTC, original submission:

NSDocument actions saveDocument:, saveDocumentAs:, saveDocumentTo:, close: are not reachable from main menu. I have subclassed NSDocument and NSWindowController. I had to implement those methods in NSWindowController subclass and forward them to NSWindowController's document. I think those methods should be implemented directly in NSWindowController. Patch is attached (except close:).

Stefan Urbanek <stefanu>
Project Member

 

Attached Files
file #413:  NSDocumentController.m.patch added by stefanu (1KiB - application/octet-stream)
file #409:  NSWindowController.m.patch added by stefanu (700B - application/octet-stream - added save* methods to NSWindowController)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 4 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Thu 05 Oct 2006 05:37:13 PM UTCgcasaStatusNone=>Fixed
Mon 28 Apr 2003 12:21:32 PM UTCnicoOpen/ClosedAnalyzed=>(Error - Not Found)
Mon 28 Apr 2003 10:15:20 AM UTCnicoOpen/ClosedOpen=>(Error - Not Found)
Mon 28 Apr 2003 10:15:19 AM UTCnicoAssigned toNone=>NA

Back to the top


Powered by Savane 3.1-cleanup1