bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug #3346] NSDocument actions are not reachable


From: nobody
Subject: [Bug #3346] NSDocument actions are not reachable
Date: Mon, 28 Apr 2003 06:15:21 -0400

=================== BUG #3346: LATEST MODIFICATIONS ==================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=3346&group_id=99

Changes by: Nicola Pero <n.pero@mi.flashnet.it>
Date: Mon 04/28/2003 at 10:15 (GMT)

            What     | Removed                   | Added
---------------------------------------------------------------------------
         Assigned to | None                      | nico
              Status | Open                      | Analyzed


------------------ Additional Follow-up Comments ----------------------------
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.



=================== BUG #3346: FULL BUG SNAPSHOT ===================


Submitted by: stefanu                 Project: GNUstep                      
Submitted on: Sun 04/27/2003 at 20:06
Category:  Gui/AppKit                 Severity:  5 - Major                  
Bug Group:  Bug                       Resolution:  None                     
Assigned to:  nico                    Status:  Analyzed                     

Summary:  NSDocument actions are not reachable

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:).

Follow-up Comments
*******************

-------------------------------------------------------
Date: Mon 04/28/2003 at 10:15       By: nico
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.

-------------------------------------------------------
Date: Mon 04/28/2003 at 07:12       By: stefanu
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.


-------------------------------------------------------
Date: Sun 04/27/2003 at 20:41       By: yjchen
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.


CC list is empty


File Attachments
****************

-------------------------------------------------------
Date: Mon 04/28/2003 at 07:12  Name: NSDocumentController.m.patch  Size: 1KB   
By: stefanu

http://savannah.gnu.org/bugs/download.php?group_id=99&amp;bug_id=3346&amp;bug_file_id=416

-------------------------------------------------------
Date: Sun 04/27/2003 at 20:06  Name: NSWindowController.m.patch  Size: 0KB   
By: stefanu
added save* methods to NSWindowController
http://savannah.gnu.org/bugs/download.php?group_id=99&amp;bug_id=3346&amp;bug_file_id=412


For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=3346&group_id=99




reply via email to

[Prev in Thread] Current Thread [Next in Thread]