Structure of PPBrowser
How is PPBrowser!?
Mozilla has Mr. Conrad Carlen's PPBrowser as a model of embedding on Macintosh.
On this section, I analyze PPBrowser and probe structure of mozilla embedding.
Build 
Source code is contained in mozilla source itself and already checked out.
mozilla/embedding/browser/powerplant/
You can build it by the following CodeWarrior project.
mozilla/embedding/browser/powerplant/PPBrowser.mcp
The executables of building results are outputted in the following places.
mozilla/dist/viewer/PP Browser
mozilla/dist/viewer_debug/PP BrowserDebug
[Screen shot of PPBrowser]

Source tree structure 
Application
CBrowserApp.cp - Application class (CBrowserApp) CBrowserShell.cpp - BrowserShell class (CBrowserShell) CBrowserWindow.cp - Window class (CBrowserWindow) CFindComponent.cpp - Find Component class (CFindComponent) CThrobber.cpp - Throbber class (CThrobber) CUrlField.cp - Url Field class (CUrlField) CWebBrowserChrome.cpp - Browser chrome class (CWebBrowserChrome) UMacUnicode.cpp - Unicode conversion utility
Browser.ppob - PowerPlant Object resource
Browser.rsrc - Other resource
cfmAlias.rsrc - Alias resource for Release Building [#1]
cfmAliasDebug.rsrc - Alias resource for Debug Building [#1]
Embed API [#2]
EmbedAPI.mcp - Project for Embedding Library
EmbedAPI.o - Embedding Library for Release Building
EmbedAPIDebug.o - Embedding Library for Debug Building
PowerPlant
PowerPlant Resources
PowerPlant Appearance
Source & resource for PowerPlant classes which are used.
System Libraries
Stub libraries for Macintosh Shlbs which are used.
NS Libraries - Library for mozilla (Common to Release & Debug)
NSAppStartup.o - Startup code for mozilla (mozilla/dist/mac/lib/) [#3]
NS Libraries/Release - Library for mozilla (For Release) [#4]
appfilelocprovider.o - (mozilla/modules/appfilelocprovider/)
mpfilelocprovider.o - (mozilla/modules/mpfilelocprovider/)
gfx.shlb - (mozilla/dist/viewer/Essential Files/)
NSRuntime.shlb- (mozilla/dist/viewer/Essential Files/)
NSStdLib.shlb- (mozilla/dist/viewer/Essential Files/)
NSPR20.shlb- (mozilla/dist/viewer/Essential Files/)
RaptorShell.shlb- (mozilla/dist/viewer/Essential Files/)
widget.shlb- (mozilla/dist/viewer/Essential Files/)
xpcom.shlb- (mozilla/dist/viewer/Essential Files/)
NS Libraries/Release - Library for mozilla (For Debug) [#4]
appfilelocproviderDebug.o - (mozilla/modules/appfilelocprovider/)
mpfilelocproviderDebug.o - (mozilla/modules/mpfilelocprovider/)
gfxDebug.shlb - (mozilla/dist/viewer_debug/Essential Files/)
NSRuntimeDebug.shlb - (mozilla/dist/viewer_debug/Essential Files/)
NSStdLibDebug.shlb - (mozilla/dist/viewer_debug/Essential Files/)
NSPR20Debug.shlb - (mozilla/dist/viewer_debug/Essential Files/)
RaptorShellDebug.shlb - (mozilla/dist/viewer_debug/Essential Files/)
widgetDebug.shlb - (mozilla/dist/viewer_debug/Essential Files/)
xpcomDebug.shlb - (mozilla/dist/viewer_debug/Essential Files/)
[#1]
cfmAlias.rsrc or cfmAliasDebug.rsrc contains the alias resource which specifies the path of Shlbs that the mozilla executable uses.
- cfmAlias.rsrc - resType = 'alis'、resID = 129
- cfmAliasDebug.rsrc - resType = 'alis'、resID = 128
By specifing these alias resource ID's in Library Folder ID: of PPC PEF Setting, relative path of Shlb can be used.


[#2]
Embedding Libraries (EmbedAPI.o, EmbedAPIDebug.o) is not created when the build of mozilla itself. After the mozilla build, you can build them by mozilla/embedding/base/macbuild/EmbedAPI.mcp project. PPBrowser project includes this EmbedAPI.mcp as a subproject and can outputs Embedding Libraries. What you need actually are EmbedAPI.o, EmbedAPIDebug.o.
[#3]
Mozilla uses the original startup code.
In addition to normal startup function, Initialization/temination of GC (Garbege Collector) is added.
mozilla/lib/mac/NSStartup/NSStartup.mcp
Link this, and in PPC Linker Setting, set Initialization: to __NSInitialize, Termination: to __NSTerminate.

[#4]
Among of these things, Shlbs are not linked actually, but only used for checking the reference resolving. Shlbs used in mozilla exist in
- mozilla/dist/viewer/Essential Files/ - Essential Shlb for Release
- mozilla/dist/viewer/Components/ - Component Shlb for Release
- mozilla/dist/viewer_debug/Essential Files/ - Essential Shlb for Debug
- mozilla/dist/viewer_debug/Components/ - Component Shlb for Debug
But these are aliases and their entities exist under the directories of each module.
The directory mozilla/dist/viewer/ contains complete execution environment of mozilla, but it includes a lot of aliases such as Shlbs. Therefore, when you dare to make your program a product, you must resolve these aliases by entities.
Visual structure 
Because PPBrowser is PowerPlant application, visual structure of main window is defined statically in Layout resource (ID=129) of Browser.ppob
Layout of main window in Constructor is like this.


I show the important elements among these below.
LWindow
( class_ID='BroW', class=CBrowserWindow )
Main window.
CBrowserShell
( class_ID='BroS', pain_ID='WebS'、class=CBrowserShell )
Browser control (HTML part).
LEditText
( class_ID='UrlF', pain_ID='gUrl'、class=CUrlField )
URL control (LocationBar).
LStaticText
( class_ID='UrlF', pain_ID='Stat'、class=LStaticText )
Status control.
LBevelButton
( class_ID='bbut', pain_ID='Back'、class=LBevelButton )
LBevelButton
( class_ID='bbut', pain_ID='Forw'、class=LBevelButton )
LBevelButton
( class_ID='bbut', pain_ID='Stop'、class=LBevelButton )
Back, Forward, Stop button.
LProgressBar
( class_ID='pbar', pain_ID='Prog'、class=LProgressBar )
Progress bar control
CThrobber
( class_ID='Thrb', pain_ID='THRB'、class=CThrobber )
Throbber control (animated picture on net process)
Class structure 
CBrowserApp (CBrowserApp.cp、CBrowserApp.h)
Class of applications.
CBrowserWindow (CBrowserWindow.cp、CBrowserWindow.h)
Class of main window.
CBrowserShell (CBrowserShell.cp、CBrowserShell.h)
Class of browser control (HTML part).
CWebBrowserChrome (CWebBrowserChrome.cp、CWebBrowserChrome.h)
Class of browser chrome. By owning necessary interfaces and being in close cooperation with browser control, this works as relay station between browser control class and mozilla browser itself.
CUrlField (CUrlField.cp、CUrlField.h)
Class of URL control (LocationBar).
CThrobber (CThrobber.cp、CThrobber.h)
Class of throbber control (animated picture on net process).
CFindComponent (CFindComponent.cp、CFindComponent.h)
Class of Find Component.
Moreover, there are some classes that has been implemented as existing PowerPlant classes.
- Back, Forward, Stop button - LBevelButton
- Status bar - LStaticText
- Progress bar - LProgressBar
|