FROM : Johnny Deadman
DATE : Mon Apr 18 14:45:55 2005
They say if you are finding something difficult in Cocoa you are
doing it wrong so so... I probably am.
I have an autoformat routine for my screenplays which is complicated
and takes a while. When the user chooses 'autoformat', the format
manager creates a parser which parses the screenplay, which in turn
splits it into paragraphs, normalizes the text, performs context-free
and context-dependent analysis, builds a structure representing the
screenplay, and passes it back to the format manager, which replaces
the appropriate text and applies the appropriate formatting.
I want to put up a progress indicator BUT the process is split up
between many independent objects which don't know about each other
and don't know whether the job they're doing (eg formatting a
paragraph, analysing a scene) is a one-shot or part of a bigger picture.
Moreover, the whole process is handled by an object (the format
manager) which philosophically I do not feel should handle any
interaction. It might, for example, be called in the absence of a UI
and do its job perfectly well. (It's invoked in turn from an IBAction
in the main editor window's controller).
So what is the best way to handle a progress bar in this case?
It seems wrong to have to pass each object a reference to the
progress bar, the proportion of the task completed, and the
proportion of the task they are responsible for. It seems equally
wrong to insist that each object retain a reference to the top-level
object and notify it. I feel they should be agnostic about the
context from which they are invoked.
--
John Brownlow
Deep Fried Films, Inc
http://www.johnbrownlow.com
http://www.pinkheadedbug.com
DATE : Mon Apr 18 14:45:55 2005
They say if you are finding something difficult in Cocoa you are
doing it wrong so so... I probably am.
I have an autoformat routine for my screenplays which is complicated
and takes a while. When the user chooses 'autoformat', the format
manager creates a parser which parses the screenplay, which in turn
splits it into paragraphs, normalizes the text, performs context-free
and context-dependent analysis, builds a structure representing the
screenplay, and passes it back to the format manager, which replaces
the appropriate text and applies the appropriate formatting.
I want to put up a progress indicator BUT the process is split up
between many independent objects which don't know about each other
and don't know whether the job they're doing (eg formatting a
paragraph, analysing a scene) is a one-shot or part of a bigger picture.
Moreover, the whole process is handled by an object (the format
manager) which philosophically I do not feel should handle any
interaction. It might, for example, be called in the absence of a UI
and do its job perfectly well. (It's invoked in turn from an IBAction
in the main editor window's controller).
So what is the best way to handle a progress bar in this case?
It seems wrong to have to pass each object a reference to the
progress bar, the proportion of the task completed, and the
proportion of the task they are responsible for. It seems equally
wrong to insist that each object retain a reference to the top-level
object and notify it. I feel they should be agnostic about the
context from which they are invoked.
--
John Brownlow
Deep Fried Films, Inc
http://www.johnbrownlow.com
http://www.pinkheadedbug.com
| Related mails | Author | Date |
|---|---|---|
| Johnny Deadman | Apr 18, 14:45 | |
| j o a r | Apr 18, 15:15 | |
| John Brownlow | Apr 19, 22:35 | |
| Adam Swift | Apr 19, 22:47 |






Cocoa mail archive

