Macintosh Steps, Files


Creating A Macintosh Plug-In

In order to create a Macintosh plug-in you need a C++ complier (the following procedures assume that you are using Metrowerks' CodeWarrior), the application Stuffit Expander (which is automatically installed on your machine when you install Navigator), and a resource editor, such as ResEdit or Resourcer

  1. Download the Macintosh Sample Source Code. If you have Stuffit Expander installed, the folder New SDK is automatically created. The Sample Source Code file is decompressed and its contents are placed in the folder. Four folders, Documentation, Plugin Template, Examples, and Include, are automatically created in the folder New SDK. The Documentation folder includes additional information on creating plug-ins. Plugin Template contains the files you use to create a new plug-in. The Examples folder contains example files for creating a plug-in. Include is comprised of files required for compiling.
  2. Duplicate the Plugin Template folder and rename it myplug. The folder contains the shell files that provides a compilable framework for creating a plug-in. By working in these files you simply fill in the necessary code for basic plug-in functionality.
  3. Copy into this folder any auxiliary plug-in specific files you have created. For example, you may have written code to implement window handling functionality.
  4. In the folder myplug, rename the file PluginTemplate68K.u to Myplugin68K.u and delete the files PluginTemplate, PluginTemplate68K, PluginTemplate.xSYM, PluginTemplate68K.SYM. These files will be automatically recreated when you build your project.
  5. Using your resource editor, open the file PluginTemplate.rsrc.
  6. Edit the resource file to include the correct information. You must change the MIME type and file extension values by editing str #128. To do so, change string #1 to MIME type and string #2 to extension.
  7. Save the resource file. The resource file allows Netscape to query the plug-in without having to load it in memory.
  8. Open the file Myplugin68K.u. Using your compiler, open npshell.cpp. This is the compilable shell file.
  9. Using the Save As command, copy and rename npshell.cpp as myplugin.cpp in the folder myplug.
  10. In myplugin.cpp, write the code for the functions needed for your plug-in. The Plug-In Application Programming Interface provides a detailed description of each function. You may want to take a look at the files in the Examples and Plugins folders.
  11. Save the myplugin.cpp file.
  12. Change the Preferences associated with myplugin.cpp by choosing Preferences from the Edit menu. Select 68k Project Preferences. Make the following changes:
  13. Using your compiler, build the project. The file myplugin68K is created.
  14. If you want to create a fat PowerPC native application, open the file mypluginppc.u. Next use the Project menu to: Now recompile the project.
  15. Drag the file myplugin68K into the plugins folder of Navigator. If this folder doesn't exist, create it in the same location as netscape.exe. If the plug-in has associated files, create a separate folder and places the files there.
  16. Restart Navigator. When Netscape Navigator starts up, it checks for plug-in modules in the netscape\plugins directory.
  17. From the Help menu of Navigator, choose About Plug-ins. A list of all plug-ins in the directory is displayed. You should see your Mime type listed.
  18. Test your plug-in by creating an HTML document.

Macintosh Files

When you download the Macintosh sample source code, four folders are automatically created in the folder New SDK. The contents of each folder include:

Documentation Folder

Plugin Template Folder

Include Folder

Examples Folder