GIFfun Source Code Overview
(c) 1998 Andrew C. Stone. All Rights Reserved.
Since I built the core of this application in an afternoon, I decided it would be a good testament to the ease of development in the Cocoa environment, as well as good PR, to give a way a cool tool. In order to keep it small, there is just one document window, although it could be modified to have multiple documents quite easily. There are many ways to code the same thing, so have mercy ye style and architecture buffs!
The applet's brains live in "GifController" - a subclass of NSResponder and the delegate of the Application (so it will receive the applicationWillFinishLaunching: notification).
Some functionality of GIFfun is modularized into subprojects:
WhirlGif.tproj: the tool which combines the GIFs (whirlgif.c)
Preferences.subproj: A module to display and modify user defaults
Info.subproj: Help and About... are here and loaded only if needed
TIFFtoGIF.subproj: Groovy code to convert images to GIF's (YB)
SDTask.subproj: A sweet wrapper on NSTask that logs stderr to a console
WINDOWS_HAQUE.subproj: A bug in RDR1 means
that you'll need this codes so the app doesn't crash!
It's activated by adding "-DRDR1" to "Compiler Flags"
in the Projects' "Build Inspector"
The interface files are customized for the various YELLOW BOX platforms:
GIFfun-macos.nib: for Mac OS X
GIFfun-macintosh.nib: for Mac OS X Server
GIFfun.nib: for MACH OpenStep
WINDOWS_GIFfun.nib: for YellowBox for Windows
You can download the source code in its entirety, or view it online now.Here's the connection between header files and interface builder files, for example, here are IB objects declared in GifController.h and a few of the actions (id is void * pointer, which like JAVA disguises object pointers as something less scary):
id colorIndexField;
id disposalMatrix;
id loopField;
id ouputDragWell;
id statusField;
id tableView;
id loopMatrix;
id window;
...
- (void)mergeGifs:(id)sender;
- (void)changeLoop:(id)sender;
- (void)loadHelp:(id)sender;
- (void)loadWhirlGifHelp:(id)sender;
|