If the Mozilla application you are working on is more autonomous than a package that sits up on a Mozilla installation, you may want to add extra customization. Here are two common features: the program icon and the splash screen. Some features require that you build the source code yourself, even just a particular module instead of the whole tree. Refer to Appendix A for more details on obtaining and building the source code.
Program icons are important for several reasons. Primarily, however, they are a visual representation of your application on the system that it runs on, whether it runs in a file explorer, a taskbar, or an application selector. This section tells you where to locate the current icons in the Mozilla application and what files or resources need to be changed to make your icon the default for Mozilla.
In Windows, create your own icon and then follow these steps:
Go to the mozilla/xpfe/bootstrap folder in the source tree.
Open the splash.rc resource file. This can be done in the text editor of your choice or in any program with special handling for Windows resource files.
Change the icon resource to the file of your choice.
// Program icon. IDI_APPLICATION ICON "mozdev.ico"
Recompile the bootstrap module. This recompilation regenerates the mozilla.exe executable file.
C:\mozilla\src>cd mozilla\xpfe\bootstrap C:\mozilla\src\mozilla\xpfe\bootstrap>nmake -f makefile.win
An alternative to Steps 2 and 3 is to give your icon the same name as the Mozilla icon (mozilla.ico) and just drop it into the tree, replacing the existing one shown in Figure 6-6.
X Windows uses the common X Pixmap (XPM) format for icons. XPM files are C source code files, with each pixmap defined as a static character array. The window manager expects to find two XPM files for each icon specified in the configuration files as ICON. Mozilla has two files for icons located in mozilla/src/gtk: mozicon16.xpm and mozicon50.xpm. Many utilities, such as the GIMP, PaintShopPro, and Xview, can transform images from other common formats.
The Macintosh BNDL resource (OS icons for files and applications) and related resource types (4bit, 8bit, large, small icons, masks, and FREF) are contained in nsMacBundle.rsrc, located at mozilla/xpfe/bootstrap. It also contains a MOZZ resource that references the Mozilla software license. All Macintosh software have this set of resources.
If you want to change icons on a window-by-window basis, do it only in Mozilla on the Windows platform. In the chrome root, there exists a directory \icons\default\. Within this directory, you can place any number of icons for windows in your application. The filename has to be the same as the XUL window ID: <window_id>.ico. One example of an icon being used in this way is the DOM Inspector window in Mozilla. In the \icons\default\ directory you will find the file winInspectorMain.ico on Windows. This option is good for package authors who add windows to the Mozilla application and do not want to hijack this resource completely. Icons can be installed as part of an XPI. |
Are splash screens a necessary startup feature for a program or a shameless plug? The answer is probably somewhere in between, leaning toward the necessary in the case of Mozilla (Figure 6-7 shows Mozilla's splash screen).
Because Mozilla is a large application and needs to process so much (including profiles, initialization code, and theme/locale selection from the chrome registry) before you actually see the first window appear, users need a visual clue that something is happening when Mozilla starts up.
If your application also requires a lot of processing at startup or if you would like to customize your application, then creating and using your own unique splash screen is essential.
The splash screen file is a bitmap image that also lives in the same splash.rc file that houses the icon file, perhaps more appropriately named in this case.
// Splash screen bitmap. IDB_SPLASH BITMAP "splash.bmp"
Again, you have the option of changing the resource file or calling the image file the same name as the Mozilla splash (splash.bmp) and dropping it into the tree. Both of options require recompilation of the bootstrap module.
The splash screen uses the same XPM format as is used for the icons. The file is called splash.xpm and is located in mozilla/xpfe/bootstrap. Note that the splash display is turned off by default on this platform and can be displayed by using the -splash switch in a command shell.
/mozilla -splash
The file Splash.rsrc (located in the source tree at mozilla/xpfe/bootstrap) contains Macintosh resources to display the splash screen (native DLOG, DITL, PICT) during startup while the shared libraries are loaded and before the profile manager is shown.