An Open Source Framework to extend Cocoa
MOKit Home Page
This release is mostly about MOViewController. There are a number of other interesting additions, though. Read on...
MOViewController: A new class and several useful subclasses have been added. MOViewController is a subclass of NSWindowController. Like an NSWindowController controls windows, an NSViewController controls views. It usually loads them from nib files. MOViewControllers form a hierarchy and the idea is that you can use them to build more extensive UIs without winding up with bloated NSWindowControllers. Each distinct part of the UI can have a dedicated controller. The subclasses that are provided with MOKit are mostly "container" view controllers. They include: MOTabViewController, MOSplitViewController, and MOViewListViewController. In all cases these container view controllers automatically manage the views of their subcontrollers. For example, a MOTabViewController creates a tab for each subcontroller and uses that subcontroller's view for the content view of the tab. See the class documentation for a lot more information.
MOTabView: A new subclass of NSTabView that allows for drag and drop of tabs. See the class documentation for a lot more information.
MOViewListView: Support has been added for drag & drop of the views in a view list view. MOViewListView also now uses subviews for its labels. This allows for the possibility of adding controls the the labels more easily. See the class documentation for a lot more information.
MOExtendedMenuItem & MOExtendedMenu: New subclasses of NSMenuItem & NSMenu that handle reverting menu items to default state (title, etc...) when there's no target for them. See the class documentation for a lot more information.
MODebug.h: This new header contains a few useful utilities for debugging. MOLog is like NSLog except it does not ever do system logging (always just logs to stdout) and it does not put a date stamp and process number prefix on every output. It can be useful for temporary debug messages. A -MO_shortDescription method is provided as a category on NSObject that returns the short-form NSObject-style description even for classes that have more verbose -description methods. A couple NSApplication category methods -MO_dumpResponderChain: and -MO_dumpKeyLoops: will log the responder chains or key loops of the key and main window. Finally, METHOD_TRACE_IN and METHOD_TRACE_OUT macros provide a relatively easy way to instrument code to trace calling patterns with indented call chain logging.
Notable Bug Fixes
This release marks the biggest changes to MOKit in quite a while. The release notes are split into a section for bigger new features, a section for minor enhancements, and one for bug fixes.
Complete HeaderDoc documentation: MOKit now uses HeaderDoc to document its public API. For more information on the new API or any of the previously existing API of the kit, refer to the documentation within the framework in the binary distribution.
If you build MOKit from source, note that the default Development build style does not generate HeaderDoc since it is somewhat time-consuming and not incremental (in other words, the complete documentation is regenerated on every build even if most or all of the headers did not change). The Deployment build style will generate HeaderDoc (as will the "Development with HeaderDoc" build style).
Automatic distribution packaging: MOKit now has a DistributionImages target. With this target active and the Deployment build style active, building will produce ready-to-release disk images for the binary and source distributions of MOKit into /tmp. The new target relies on a reusable script (imageFromFolder.sh). You can use the script in your own projects using the DistributionImages target and the Deployment build style from MOKit as examples of how to use it.
General NSView extensions for enforcing minimum and maximum sizes: MOKit adds a new category called MOSizing to NSView that includes methods for setting minimum and maximum sizes for any view as well as specific support for a view to gets its minimum size from its superview if that superview is an NSClipView. If none of the set methods are called for a particular NSView it will behave exactly like NSViews normally behave without MOKit, but if you use these methods to set special sizing behavior it will be enforced any time the frame size of the view is changed.
This feature makes use of the new support for replacing methods in MORuntimeUtilities (see below for more info).
MOViewListView: This NSView subclass implements a disclosable stack or list of subviews similar to those seen in the Jaguar Finder's Info dialog, Project Builder's target editor, and other apps such as Okita Composer. Basically, the view's "stack views" are automatically tiled into a vertical stack. Above each view is a label bar and the label bar has a disclosure control on it. The disclosure control can be used to "collapse" any one of the views so that all that shows is its label bar (and of course, the view can later be "expanded" back again). It is like a one-level outline for arbitrary subviews. The view has full configurability for its color scheme and has a convenience API for setting up color schemes to match the appearance of Finder's Get Info window and Project Builder's target editor as well as other presets.
MOExtendedTableView and MOExtendedOutlineView: These are subclasses of NSTableView and NSOutlineView respectively. They provide similar extensions in both subclasses including control over keyboard navigation when editing ends in a cell, unified datasource protocols for drag & drop, copy/paste and Services support, easy dataSource API for handling row addition and deletion, delegate API for intercepting and handling Return or Delete keystrokes, dataCell and delegate API for handling per-cell context menus, and other extensions that many clients of these classes often wind up implementing themselves.
Lots of additions to MORuntimeUtilities: In previous versions of MOKit the MORuntimeUtilities consisted of the single MOFullMethodName function. These utilities have been greatly expanded in this version. There's an NSObject category that has several factory methods that implement the following functionality:
There is an NSBundle category that implements a method to return an array of all the classes from a given bundle.
There is a Protocol category that implements a method to return an array of all the classes conforming to a given protocol.
Finally there are a variety of new functions that implement things like:
MOAssertions macros: MOKit now provides a replacement for the NSAssert* macros declared in NSException.h. There are several reasons for the replacement:
In addition to addressing these limitations of the NSAssert mechanism, MOAssertions includes additional macros that allow easier testing of common assertions like asserting that an object is of a particular class.
Project Builder File Template: A Project Builder File Template has been included that is suitable for use when adding new classes to MOKit itself. It comes pre-configured with the standard content used in MOKit source.
Additional test programs: Previous versions of MOKit had the RegexTest test tool for verifying correct behavior of MORegularExpression. This version of MOKit includes test tools for MOAssertions and MORuntimeUtilities functionality as well as a test application for the MOViewListView and a test application for MOExtendedTableView and MOExtendedOutlineView.
Notable Bug Fixes
The biggest change in this version is the new backing implementation for MORegularExpression. Henry Spencer, the author of the original regular expression code used by previous versions of MOKit has rewritten his package to support Unicode directly. He has also greatly expanded the supported syntax for regular expressions to support, among other things, most of the extensions from Perl5. I have upgraded MORegularExpression to use this new package (which I obtained from the tcl 8.3.2 distribution.) I believe all the syntax additions that had been added to the old implementation by Vivian Girel are now present in the new base-line implementation.
The only other significant change from 2.5 is that MOKit is now a (new) Project Builder project. Another minor change is that all MOKit source code is now stored in UTF-8 format. In this release, the only place that this is noticeable as being different from ASCII is in the file header comments where the copyright symbol is used. The project is set up such that all source files have UTF-8 set as their explicit file encodings, so handling should be completely automatic under Project Builder. Opening the source files in TextEdit or other editors may cause the copyright symbols to become corrupted if you do not explicitly open the files as UTF-8 encoding.
Sadly, this is the first version of MOKit that does not support Windows. MOKit 2.6 is for Mac OS X only.
As usual, the latest TextExtras (1.6) requires the latest MOKit (2.6).
The only changes in this version are a couple bug fixes and a big speed boost for standardizing line endings. TextExtras 1.5 requires this version of MOKit.
There are two main changes in 2.4.
MOKit 2.4 is built to run on Rhapsody/YellowBox For Windows Developer Release 2.
MOKit 2.3 is pretty similar to 2.2. However, starting with version 2.3, MOKit is a Rhapsody/YellowBox framework. This doesn't mean much in terms of changes, but it does alter the binary distributions.
MOKit 2.3 is built to run on Rhapsody/YellowBox For Windows Developer Release 1.
There have been a couple tweaks here and there, but nothing really new.
MOKit 2.2 has a few new classes, and removes one class.
I realized MOClassVariable is merely an NSDictionary with different API. Back in the old days of 3.x, having a MOClassVariable class made more sense since there was no NSDictionary and I never did like the old Hashtable APIs. I ported the class to OPENSTEP without really thinking. Well, I have thought about it now and the class is totally unnecessary. MOController now uses an NSDictionary directly. You should too, if you used to use MOClassVariable.
MOCompletionManager and MOCompletionStrategy provide a basic framework for implementing many different kinds of escape completion. These classes are useful for types of completion where there will be one or multiple possible completions and all the possible completions can be discovered quickly. The architecture kind of requires that all matches be discovered at once, so this is not really applicable where there might be multiple matches but it is either not possible or too expensive to figure them all out at once. One concrete strategy, MOFileCompletionStrategy, is provided which does regular file/path completion.
These classes are the result of some work I did on a Shell. I wanted to be able to have multiple types of completion that could all work at the same time. In addition to file completion, an advanced Shell usually wants to offer other types of completion such as wildcard completion, history completion, command completion, etc... Using this architecture it is possible to do this in a fairly clean way and to add new types of completion easily as they are implemented.
Finally, I have added some semi-useful category methods on various Foundation classes.
MOKit 2.1 addresses a couple minor problems with MOKit 2.0. PLEASE NOTE: This version of MOKit will only build on OPENSTEP for Mach or Windows version 4.1! The compiled versions may or may not work on 4.0.
There is a workaround in MOController for an OPENSTEP for Mach bug affecting the way MOController finds nib files. The workaround is not that great. Basically, if you have MOController nib files that won't load on Mach, you can write a special default for each such nib file to help MOController find it. See the code for details.
The MORegularExpression class has a couple new methods also, and there is an additional subproject which contains a test tool for MORegularExpression based on the test suite provided in the regex code on which MORegularExpression is based.
MOKit 2.0 is based on OPENSTEP. It will compile and run on both Windows and Mach. It does not include as many objects as 1.0, but they're better. They are also totally unsupported.
This version is packaged as a framework project. It builds into a shared library. There are few issues with this on Mach (see the ReadMe in the project).
Only a few classes are present. MOClassVariable implements a class variable that you can define once in a superclass, but which can take on different values for any subclasses. This class usually comes into its own when you are designing other reusable classes. Especially those that are meant to be subclassed. For instance, MOController uses this class internally.
MOController is a simple nib file controller object. It basically keeps track of loading a nib file and managing a window that comes out of it. It really must be subclassed to be useful, but it is good for either document situations or single instance situations. As simplistic as it is, I find this class one of the most useful. This functionality can be needed over and over again in different contexts even in a single application.
MORegularExpression encapsulates regular expression matching. The class is really a thin wrapper on top of Henry Spencer's implementation of the regex library routines. Instances represent immutable regular expressions that can be matched with strings and report on subexpression matches. This is a refinement from the MOKit 1.0 regular expression support. The expression itself is an object. Then the UI aspects are implemented separately in MORegexFormatter.
MORegexFormatter is an NSFormatter subclass which does validation and formatting based on regular expression matching. NSFormatters are cool. They can be used by any NSCell, or anybody else for that matter, to restrict and canonicalize text entry. This kind of formatter uses a set of regular expressions to validate input. The proposed value must match one of the expressions. There is a format string which can be used to reformat the value using the subexpression matches from the expression.
MOKit 2.0 also includes an InterfaceBuilder palette with a MORegexFormatter object on it. You can drop these onto NSTextFieldCells and NSFormCells in IB and a custom inspector lets you configure the regular expressions used for validating and the format string used for formatting.
MOKit 1.0 and earlier versions are based on the NEXTSTEP 3.x API. These versions have little in common with MOKit 2.0 and later.