discuss-gnustep
[Top][All Lists]
Advanced

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

Editor and the responder chain


From: Stefan Urbanek
Subject: Editor and the responder chain
Date: Mon, 21 Mar 2005 09:36:59 +0100
User-agent: Internet Messaging Program (IMP) 3.2.2

Hi,

I would like to set up a small editor mechanism in my application. Problem is
like this:

I have a NSDocument document. The document is composed of card collections which
can be of different types. There is a document window (NSWindowController +
NSWindow) and in that window are two parts: one list for adding and removing
collections, and a view for editing the collection:

 +-------+-------------+
 |       |             |
 | list  |    view     |
 |       |             |
 |[+][-] |             |
 +-------+-------------+

When there was only one type of collection, there was no problem, as the view
was the collection view and the window controller served as editor (delegate),
which handled all action methods too.

Now I have more collection types and I would like to have different view for
each type. Say, that I have following types: ordered stack collection and
diagram. The view for ordered stack would be something similar to the view in a
presentation application (PowerPoint or OO.org) where one sees all slides and
can reorder them by D&D. The diagram view will look like, well, a diagram :o) -
objects with connections.

Now I would like to change the view, depending on the selected collection. And I
would like to have separate object to handle all editing actions - move editing
out of the window controller, as there should be many kinds of editors in the
future.

One solution is to have an Editor class which will provide a view. Then window
controller will reference: currentEditor, editorView. When one selects a
collection, the window controller will do:
- notify old editor that it will end editing
- remove old editor
- create new editor according to the collection
- assign selected collection to the new editor
- change old editor view to new editor view

Now, the problem is: how can I include the new editor object into the responder
chain?

Other solution would be to have one window per editor, however this is what I
wanted to avoid because of screen pollution. Moreover, user can have multiple
document windows open for the same document.

Or ... is there any other solution to the problem of multiple object types with
different editors?

Thank you,

Stefan Urbanek
--
http://stefan.agentfarms.net

First they ignore you, then they laugh at you, then they fight you, then
you win.
- Mahatma Gandhi




reply via email to

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