marbrowの構造
marbrowってどうなってるの?
PPBrowserをお手本として、独自の簡易フレームワークにモジラブラウザをエンベッディングしてみました。
主な特徴としては、
- 既存のフレームワークを使わず、素のMacintoshにインプリメント
- ブラウザ以外のコントロールは、モジラウィジェットでなく、Macintoshコントロールで実装
- 1ウインドウに2ブラウザの試み
- netlibによる、ファイルのダウンロードをテスト
- ブックマークの追加、移動をサポート (編集は未サポート)
などです。
◆ ビルド ◆
marbrowソースのダウンロード
上記でソースをダウンロードし、解凍するとmarbrowというフォルダが現れます。このフォルダを、
mozilla/embedding/browser/
以下にコピーしてください。PPBrowserのPowerPlantフォルダと同じ場所です。
下記のCodeWarriorプロジェクトにより、ビルドできます。
mozilla/embedding/browser/marbrow/marbrow.mcp
下記の場所にビルド結果の実行形式が出力されます。
mozilla/dist/viewer/marbrow
mozilla/dist/viewer_debug/marbrow Debug
【PPBrowserのスクリーンショット】

◆ ソース構造 ◆
■ Source/Application
main.cpp - メイン処理
glob.cpp - グローバル変数
init.cpp - 初期化/終了処理
evnt.cpp - イベント処理
docu.cpp - ドキュメント処理
err.cpp - エラー表示
wmng.cpp - ウィンドウ管理マネージャー
■ Source/Dialog
dlog.cpp - モーダルダイアログ表示
MMlDlog.cpp - モードレスダイアログクラス (MMlDlog)
MProgDlog.cpp - プログレスダイアログクラス (MProgDlog)
■ Source/Net
dnload.cpp - netlibダウンロード処理
■ Source/Utility
ustr.cpp - 文字列ユーティリティ
ufile.cpp - ファイルユーティリティ
uprcs.cpp - プロセスユーティリティ
uinetc.cpp - Internet Config ユーティリティ
udlg.cpp - ダイアログユーティリティ
UMacUnicode.cpp - Unicode変換用ユーティリティ
■ Source/View
MView.cpp - ビュー基本クラス (MView)
MWind.cpp - ウィンドウクラス (MWind)
MLoca.cpp - ロケーションバークラス (MLoca)
MStat.cpp - ステータスバークラス (MStat)
MButt.cpp - ボタンクラス (MButt)
MBrow.cpp - ブラウザシェルクラス (MBrow)
MChrome.cpp - クロームクラス (MChrome)
■ Resource
marbrow.rsrc - リソースファイル
cfmAlias.rsrc - Release Build用Aliasリソース
cfmAliasDebug.rsrc - Debug Build用Aliasリソース
■ Embed API
EmbedAPI.mcp - Embedding Library用プロジェクト
EmbedAPI.o - Release Build用Embedding Library
EmbedAPIDebug.o - Debug Build用Embedding Library
■ Mac Libraries - Macintosh用ライブラリ
InternetConfigLib - Internet Config 用スタッブライブラリ
■ Moz Libraries - モジラ用ライブラリ (Release/Debug共通)
NSAppStartup.o - モジラ用スタートアップ (mozilla/dist/mac/lib/)
InterfaceStubs - モジラ用InterfaceLibスタッブライブラリ (mozilla/dist/client_stubs/)
■ Moz Libraries/Release - モジラ用ライブラリ (Release用)
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/)
■ Moz Libraries/Release - モジラ用ライブラリ (Debug用)
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/)
◆ ビジュアル構造 ◆
marbrowでは、ビジュアル構造は、プログラム上で動的に構築します。
docu.cpp の、DoNew() でメインウィンドウを、DoNewPlain() でプレーンウィンドウを構築しています。
メインウィンドウのビジュアル構造は固定で、以下のようなものです。
|
メインウインドウ (MWind)
├ブラウザ1 (MBrow)
├ロケーションバー for ブラウザ1 (MLoca)
├ステータスバー for ブラウザ1 (MStat)
├Printボタン for ブラウザ1 (MButt)
├View Sourceボタン for ブラウザ1 (MButt)
├Homeボタン for ブラウザ1 (MButt)
├Exitボタン (MButt)
├ブラウザ2 (MBrow)
├ロケーションバー for ブラウザ2 (MLoca)
├ステータスバー for ブラウザ2 (MStat)
├Backボタン for ブラウザ2 (MButt)
├Forwardボタン for ブラウザ2 (MButt)
├Stopボタン for ブラウザ2 (MButt)
└Refreshボタン for ブラウザ2 (MButt)
|
プレーンウィンドウのビジュアル構造は以下のようなものですが、クロームフラグにより、表示されないパーツがあります。
|
プレーンウインドウ (MWind)
├ブラウザ (MBrow)
├ロケーションバー (MLoca)
├ステータスバー (MStat)
├Backボタン (MButt)
├Forwardボタン (MButt)
├Stopボタン (MButt)
└Refreshボタン (MButt)
|
◆ クラス構造 ◆
■ MView (MView.cpp、MView.h)
ビジュアルパーツの装備すべきメンバ変数とメソッドを定義した基底クラス (バーチャルなクラス) です。
■ MWind (MWind.cpp、MWind.h)
メインウィンドウのクラスです。
■ MLoca (MLoca.cpp、MLoca.h)
ロケーションバーのクラスです。
■ MStat (MStat.cpp、MStat.h)
ステータスバーのクラスです。
■ MButt (MButt.cpp、MButt.h)
ボタンのクラスです。
■ MBrow (MBrow.cpp、MBrow.h)
■ MChrome (MChrome.cpp、MChrome.h)
ブラウザクロームのクラスです。必要なインターフェースを装備しブラウザシェルと表裏一体となることで、ブラウザシェルクラスとモジラ側とのやりとりの中継基地的存在として動作します。
|