In previous versions of MacApp, MacApp library resources were built as necessary by the MABuild tool. Several resource description files (.r) were automatically compiled into their respective object files (.rsrc). A project's .r file could then include specific resources from the built .rsrc files as they needed. For CodeWarrior (CW) builds, these files are now built by the Resources.prj project file.
Resources.prj builds these files into their respective .rsrc files, and also combines them all into one conglomerate file for easy inclusion in examples projects or your own project. There are four "flavors" of this file - PowerPC Debug, PowerPC Non Debug, 68K Debug, and 68K Non Debug. Files generally have the following suffixes to indicate their flavor: PPC_d, PPC_nd, 68K_d, 68K_nd. Specifically in this case:
MacApp ships with the .rsrc files already built. Unless you change one of the MacApp library .r files and need to rebuild your changes, or accidentally edit one of the MacApp library .rsrc files, you probably won't need to build Resources.prj.
The easiest way to set up your project's MacApp library resources is by using the MALib[flavor].rsrc files. You can use the conglomerate MALib[flavor].rsrc files directly in you projects. About half of the MacApp examples use the first approach, including Nothing.prj and GrayScaleGridView.prj and Template.prj. More experienced users or those who prefer resource description files can base their resources on .r files if they wish. If you prefer to use resource description files, you can include the individual MacApp library resources from a .r file. Examples of the latter approach include DemoDialogs.prj and SimpleThreads.prj.
If you prefer to use a .r file for your resources, there is one small catch. Instead of giving each individual MacApp library.rsrc file a flavor suffix, the files are instead placed into four folders within the Resources folder. These folders are named "PPC Non Debug", "PPC Debug", "68K Non Debug", and "68K Debug". This means, for instance, that the built 68k debug version of Memory.r has the same name as the non-debug version - they are both called "Memory.rsrc". But they reside in the "68K Debug" and "68K Non Debug" folders respectively. Because they have the same name, and you may be including resources from the built MacApp library .rsrc files in your .r file, you must be very careful that for each target flavor in your CW Project has the proper corresponding path for the resource flavor, and ONLY that path. i.e. A 68K debug target must include only the "68K Debug" resources folder in its access paths.
For instance, in the project DemoDialogs.prj, the file DemoDialogs.r includes the following line in order to get a default apple menu:
include "Defaults.rsrc" 'CMNU' (mApple); // Grab the default Apple menu
To include the proper flavor of this file, the PPC Debug target of DemoDialogs.prj contains the path "{Project}:::Resources:PPC Debug:", the 68K Debug target contains the path "{Project}:::Resources:68K Debug:" and similarly for the other flavors. Note that if they instead contained the recursive search path "{Project}:::Resources:" you would get the first flavor of Memory.rsrc that the CWPro project found since all four flavors have the same name. The examples projects and the Template.prj already contain the proper paths for their respective targets. If you use any of them for your starting project, you shouldn't need to worry about this.
Yes, this is definitely kludgey, but it arises as a means to replace the MABuild tool functionality. MABuild would create a separate folder for each build flavor and all the objects would be contained in that folder. Therefore the line above from DemoDialogs.r would automatically grab the proper flavor of the .rsrc file being included, since it there was only one flavor within that build folder. If we were to follow the convention of naming these .rsrc files with the "flavor suffixes", then for CW the alternative for the line above would be...
#if qPowerPC && qDebug include "DefaultsPPC_d.rsrc" 'CMNU' (mApple); // Grab the default Apple menu #elif q68K && qDebug include "Defaults68K_d.rsrc" 'CMNU' (mApple); // Grab the default Apple menu #elif //etc... for all flavors
...and there are a lot of these types of include lines! Ugh!
For now, just remember that if you are using a .r file to include pre-built MacApp resources and you don't start from Template.prj or an existing example, you need to add the specific path for the flavor of resources you want to include. The same holds if you add new targets to a project.
Unfortunately, the need to rebuild these resources with CW was addressed rather late in the R13 development process. MacApp library resources could benefit a great deal from a general re-visitation of their organization, content, and naming. The current solution represents a compromise - it works!
|
|
|
Debug.rsrc (68K Debug) |
Debugging views, menu, and strings. | |
ResourceLib.rsrc (68K Debug) |
"Grabber Hand" cursor. | |
Memory.rsrc (68K Debug) |
mem! and ppc! resources for adjusting memory usage. | |
Editions.rsrc (68K Debug) |
Publish and Subscribe support.* | |
MacApp.rsrc (68K Debug) |
Icons, aedt, more cursors, etc... | |
Defaults.rsrc (68K Debug) |
Default menus, views, help strings, icons, SIZE etc...* | |
Printing.rsrc (68K Debug) |
Print related dialogs, alerts, etc...* | |
CoreDefaults.rsrc (68K Debug) |
vers 2 Resources* | |
Dialog.rsrc (68K Debug) |
Generic dialogs, alerts, and views | |
N/A |
MALibPPC_nd.rsrc MALibPPC_d.rsrc MALib68K_nd.rsrc MALib68K_d.rsrc
|
Combination of all the above resource files. These files have the "flavor suffixes" because they are not referenced by any .r files. Include this file in your project if you prefer to use built resources instead of resource description files. |
|
|
For PPC-only apps that may run on 68K | |
Copy of the System 7.5 floating wdef for earlier systems. |