# Macintosh Steps, Files

## Creating A Macintosh Plug-In

In order to create a Macintosh plug-in you need a C++ complier (these steps and the sample code all assume CodeWarrior 9), 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 Plug-in SDK. If you have Stuffit Expander installed, the folder PluginSDK is automatically created. The SDK contains the following sections:
   - Classes - contains moz_30.zip, the Navigator class file.
   - Common - Source code for utility classes used in multiple examples, and which you can reuse.
   - Examples - Example plugin projects, including MacTemplate, on which you can base your own projects.
   - Include - The header and stub files required for all Navigator plug-ins.
2. Duplicate the MacTemplate 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 MacTemplate68K.u to Myplugin68K.u and delete the files MacTemplatePPC, MacTemplate68K, MacTemplatePPC.xSYM, MacTemplate68k.SYM. These files will be automatically recreated when you build your project.
5. Using your resource editor, open the file MacTemplate.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 macshell.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:Source.
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:
    - Rename the file name to myplugin68K.
    - Rename they sym name to myplugin68K.sym
    - Save the settings
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:
    - Remove the file MacTemplate68K.
    - Add the file myplugin68K. This ensures that your plugin can run on both PowerPC and 68K code.
    - Delete npshell.cpp.
    - Add the file myplugin.cpp.
    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.