This source code is helpful in building plug-ins for the MacOS 8 Contextual Menu Manager. It is too small to really be considered a "framework" if you ask me, but what else can it be succinctly named? There is a base class, PluginBase, which does a lot of the dirty work for you of parsing AE descriptor data, command item building, file grunge work, temporary files, etc. You need to create a subclass, Plugin, that does your specific work by overriding a key method or two to provide your hard work, and may override another method or two to control the basic behavior. Your Plugin object is instantiated by the PluginSOM object that is directly grappled by the SOM code that lurks in the system.
There are two sample plugins provided, and a "template" plugin that you might find useful for cloning when you want to start building a new plugin of your own. Look at the samples to see how easy it is. Also look at the detailed comments in PluginBase.h and PluginBase.cp to see the gory details on how things work. It's not tricky, so dive right in!
Look who else is using this framework to write cool plug-ins.
Version 1.1 fixes one very annoying problem and a couple of bugs.
Prior versions had a problem with the "timeLimit" value supplied by the Contextual Menu Manager in the method PluginBase::ExamineContext. The method would search the context for each data type, and after each part of the search, it would call TickCount to find out whether the time limit had expired. If it had expired, the method would bail out of the search and return, with the menu commands likely not having been added to the menu. After some experimentation and feedback from framework users I have decided to ignore the time limit. It seems to have no ill effects whatsoever, and of course works much better than when the commands don't show up.
PluginHierarchicalCommand::AddSubHierarchicalCommand was building the AEDescList incorrectly, making sub-sub-hierarichical commands not work. Thank you Hideki Itoh!
PluginBase::IsSpecificCreatorType had a typo that caused the type/creator comparison to be incorrect sometimes. It was comparing the file type to the desired creator. Thank you Chris Grigg!
The supplied projects were created in CodeWarrior Pro 3.
You need to have Apple's Contextual Menu Manager SDK (header files and libraries). The projects supplied here have their include paths set to assume that the CMM headers and libraries are located in a folder called "CMM SDK" next to the other folders supplied here. You can change this, of course. The files assumed to be in the SDK folder are:
The CMM SDK is part of the Appearance Manager SDK, which is available on Apple's SDK server. Here's version 1.0.2, of course this link will probably not be permanent....
<ftp://dev.apple.com/devworld/Development_Kits/Appearance_&_CMM_SDK_1.0.2.sit.hqx>
Your plugins will run only on PowerPC machines. The Contextual Menu Manager currently does not support 68K plugins. In fact, the SDK does not give you a way to build 68K plugins. I don't know of any technical reason for this limitation, only "human resource" limitations, such as "who are we going to pull off another project to build and test this instead?"
Copyright ©1997-1998 by Trygve Isaacson. All Rights Reserved.
Use this source code! Create plug-ins galore! Here are the restrictions:
Permission granted to:
Permission NOT granted to:
You must grant me one single-user license to your plugins based on this source code, and send email to trygve@bombaydigital.com describing where to get it.
In plain English, this means that you can use this code for free, hack it to your heart's delight, and release any plug-ins you build with it, commercial or not. Just don't redistribute this source code package as if you wrote it. And, since you are using my work for free, the least you can do is let me be a registered owner of one copy of your plugin.
Have fun!