It's the oldest. It includes projects for prehistoric CodeWarrior version (7.0 or 8.0) that can't be used with the most recent version of CodeWarrior (Pro x).
It's the most recent one. It includes projects that can be converted with recent versions of CodeWarrior Pro. Yet, this SDK contains some APIs that are only compatible with the fourth versions of the Browsers (Explorer 4.0 and Communicator 4.0) If you wish to make your plug-in work with older versions, you can still use that SDK, just don't call these new APIs (they are so really so great IMHO).
Download the 4.01a SDK.
Now, the documentation. Here again, we have two versions :
For my part, I prefer the PDF version that doesn't kill my eyes when I'm reading it.
To sum-up :
Download the PDF documentation.
If you already have downloaded the 4.01a SDK, just open the Macintosh Simple Project. Compile it and put an alias of the Plug-In in the Netscape Communicator Plug-In folder.
Do not try to put it in Internet Explorer Plug-In folder ! If you try to use that Plug-In in Internet Explorer, Internet Explorer will crash. You do not want that to happen, do you ?
After playing for a while with this Plug-In, it's high time for you to face the bad reality of life.
To develop a Plug-In, it's a good idea to start with the MacTemplate project sources ; for two good reasons :
Instead, put an alias of your Plug-In the the Browser Plug-In folder. This will allow you to have only one real Plug-In for every Browsers: good bye Version Management. Evenmore, this will allow you to compile a new version of the Plug-In and not have to put it every time at the good location.
When it comes to drawing, you can have a look at the code in the MacShell.cpp file. Indeed, when you're drawing, you must set your drawing context and later restore the former drawing context.
If you're like me, a curious guy or a first-class life sucker, you will wonder what is inside the NP_Port and NPWindow structure.
Some hours of debugging at candles light gave me some answers that you can't find in the documentation. They are not obvious to remember (while I'm writing these lines, I have to read the code to check).
First, all drawings are clipped. This is done with the clipRect parameter of the NPWindow structure and the portx and porty parameters of the NP_Port structure.
The portx and porty datas are also used to define the new QuickDraw origin for the Plug-In.
The width and height parameters of the NPWindow structure indicate the Plug-In dimension.
What is the exact puprose of the x and y coordinates of the NPWindow structure ? They are the actual corrdinates of the top-left corner of the Plug-In.
If you want to manage an OpenGL view inside a Plug-In, be aware that it's a nightmare the first time you code it.
Another important point concerns resizing and scrolling.
You get aware of a resizement with a new call to the NPP_SetWindow function.
For scrolling, you're never informed. You will just notice that the NPWindow and NP_Por values have changed when you receive an update Event. So beware.
In fact, if you read the documentation (it's quite hard to find this part of the documentation), you will learn the following things :
On Mac OS, Mouse, Keyboard, Update Events are managed with the NPP_HandleEvent function. This function supports the majority of traditional Mac OS Events and 3 more ones :
For the cursor, it's a bad idea to use the qd global. Use the gQDPtr that is obtained during the Plug-In initialization.
Once your code supports these 3 events, you will be able to manage Keyboard Events and Cursor Modification.
Just call UseResFile with this value and here you are.
With CodeWarrior, it's quite easy to debug a Plug-In (which is actually just a Shared Library). In the Project Preferences Panel, section Target, select the Runtime Settings option.
With the Choose... button, you can set-up the binary that will launch your Plug-In. So select Internet Explorer or Netscape Communicator.
What you have to do next, is to launch the debugger, and drag and drop the HTML page that calls your Plug-In in the Browser window.
Personal note : During my various attempts with iCab, I never succeeded in making this work.
Before comitting a Professional suicide, check that your plug-in works with Internet Explorer.
I'm sorry my lady, but we're living in a nasty world (I don't even speak of those satellites all around Earth disturbing the weather), Internet Explorer doesn't support all the functionalities of the SDK.
The various incompatibilites I have listed with Internet Explorer 4.5 and later :
Conclusion : If you want your Plug-In to work with Internet Explorer, forget about LiveConnect. On the NPP_GetJavaClass function, return NULL.
Within a Plug-In you can stream datas under 3 forms. One of which is to ask to be only warmed when the stream is finished and the local file is complete
This functionality doesn't work on Internet Explorer, which instead allows you to have a normal streaming. This means that when you ask the browser to download a file, every time a portion of this file has been downloaded, you will be warmed by a call to the NPP_Write function.
Once all the file has been downloaded, the NPP_StreamAsFile is called and Internet Explorer tells you the location of the local file (This file is not in the browser cache).
Conclusion : Avoid using StreamAsFileOnly if you can. Yet if you have to, be aware that on Internet Explorer, the file will be streamed as StreamAsFile.
Internet Explorer only sends you keyDown Events.
Conclusion : Design your Key management so that it only uses keyDown Events.
Internet Explorer 4.5 doesn't support NPP_GetURLNotify.
Internet Explorer 5.0 does.
Apparently, Internet Explorer 4.5 doesn't support simultaneous multiple streams. If you're calling several times NPN_GetURL (since IE 4.5 doesn't support NPN_GetURLNotify), all but one stream will be destroyed immediatly.
Conclusion : Do sequential streaming with IE 4.5.
Beware Internet Explorer and other Browsers. The fact that your plug-in is working with Netscape Communicator doesn't mean that it will work with other Borwsers.
It's a CodeWarrior Pro 5 Project.