Graphisoft®

API Development KitVersion: 18

Graphisoft Resource Compiler Example on Macintosh


In this example, we will create a native binary Macintosh resource for an Example dialog, which contains a picture, an icon, and two buttons:

Example Dialog ScreenShot

The corresponding GRC file for this dialog is: ExampleGRC.grc

The result will be a Macintosh resource (.rsrc) file, which contains the GDLG dialog resource.

Note, that the Resource Compiler can only handle only one input file (.grc) per one run.

Now let's compile the dialog:

./Utils/ResConv -q utf8 utf16 -i "./ExampleProject/ExampleGRC.grc" -o "./ExampleProject/ExampleGRC.grc.ro" -t m -p "./ExampleProject/" -d macintosh -d DEBUG_VERSION

In this step the native Macintosh .ro resource description file is constructed from the GRC file and image conversion takes place. From the information in the GRC file (eg. transparent color of icons or cursors, hotspot coordinates of cursors) and the .bmp sources, ResConv creates .tif (TIFF) files.

API version 18 Also, the 'STR#' resources are converted into platform-native .strings files. The individual .strings files have to be merged into one Localizable.strings file inside the resulting bundle's Resources/[lang].lproj folder.

We don't specify the operation mode of the ResConv, because -m r, the converter mode is the default mode. The first two parameters specify the input and the output files. The third option is also important. We instruct the compiler to convert to Macintosh platform, so it knows that it should generate native resources and native resource descriptor file as mentioned in the paragraph above. After that we add the binary input file and the resulting binary resource file's extension. We also set the destination path, and finally we add some define's. As a result of the defines, we can formulate conditional preprocessor expressions (#if defined ()) in the GRC source with these names too.

We are ready!