This library contains functions to load the resources of a GEM program (menu bars, dialog boxes, icons etc.) into memory and manipulate them there, as well as ascertaining the addresses of the relevant objects. The following routines are available for this purpose:
• rsrc_free | Releases memory occupied by an application's resource |
• rsrc_gaddr | Obtains address of an object in a resource data set |
• rsrc_load | Loads a resource file |
• rsrc_obfix | Converts character-based to pixel-based coordinates |
• rsrc_rcfix | Fixes up coordinates and pointers in memory |
• rsrc_saddr | Stores address of an object |
• sys_recalc_cicon_colours | Passes RGB-triplets in promille for icon conversion in 'direct colour' screen modes |
Note: Laying off such objects to a resource file has the invaluable advantage of permitting changes to the appearance (and particularly the language of any text) in a simple way without having to make any modifications to the program itself.
See also: About the AES Style guidelines
Name: | »Resource free« - Release memory occupied by a resource file.
|
Opcode: | 111
|
Syntax: | int16_t rsrc_free ( void );
|
Description: | The call rsrc_free frees the memory previously occupied by a
resource file (allocated by rsrc_load).
Note: It is imperative to call this function at the termination of a program! |
Return value: | An error has arisen only if the value 0 is returned.
|
Availability: | All AES versions.
|
Group: | Resource library
|
See also: | Binding rsrc_load
|
C: | int16_t rsrc_free ( void );
| |||||||||||||||||||||
Binding: |
int16_t rsrc_free (void) { return ( crys_if(111) ); } | |||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Resource get address« - Obtain address of an object in a
resource set.
| ||||||||||||||||||||||||||||||||||||||||||
Opcode: | 112
| ||||||||||||||||||||||||||||||||||||||||||
Syntax: | int16_t rsrc_gaddr ( int16_t re_gtype, int16_t re_gindex, void
*gaddr );
| ||||||||||||||||||||||||||||||||||||||||||
Description: | The call rsrc_gaddr obtains the start addresses of various
object structures of resource files loaded into memory with rsrc_load.
The following apply:
Note: If one wants to search for a text pointer within a TEDINFO structure, for instance, then one must not pass the index of the associated object, but the index of the TEDINFO structure. The same applies in essence to other codings. | ||||||||||||||||||||||||||||||||||||||||||
Return value: | An error has arisen only if the value 0 is returned (= object
does not exist).
| ||||||||||||||||||||||||||||||||||||||||||
Availability: | All AES versions.
| ||||||||||||||||||||||||||||||||||||||||||
Group: | Resource library
| ||||||||||||||||||||||||||||||||||||||||||
See also: | Binding rsrc_load
|
C: | int16_t rsrc_gaddr ( int16_t re_gtype, int16_t re_gindex, void
*gaddr );
| ||||||||||||||||||||||||||||||
Binding: |
int16_t rsrc_gaddr (int16_t re_gtype, int16_t re_gindex, void *gaddr) { int_in[0] = re_gtype; int_in[1] = re_gindex; control[4] = 1; crys_if (112); control[4] = 0; *gaddr = addr_out[0]; return ( int_out[0] ); } | ||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Resource load« - Loads a specified resource file into
memory.
|
Opcode: | 110
|
Syntax: | int16_t rsrc_load ( CONST int8_t *re_lpfname );
|
Description: | The call rsrc_load serves for loading a resource file and
initializing it (allocating memory); furthermore, all OBJECT
coordinates are converted from character-based coordinates to screen
coordinates. The parameter re_lpfname contains the
NULL-terminated filename of the resource file to load.
Note: The file will be looked for in all directories that the AES knows about. As of PC-GEM Version 2.0, incidentally, all object trees that have a box as a root (e.g. all dialog boxes) will have the SHADOWED flag set for it in ob_state. This means that all dialog boxes will be drawn with a shadow instead of an outline frame. The origin of this lies in the legal disputes between Apple and Digital Research. However, the SHADOWED bit can be reset (after rsrc_load) at run-rime and the normal OUTLINED bit set once more. Warning: Conversion of bit-images and icons from the standard format to the device-specific format does not occur at this stage. If required, this must be perfomed by the programmer himself. MagiC as of Version 3 and Geneva can load resources in the Interface format. With other AESs this possibility can be checked with appl_getinfo (opcode 2). |
Return value: | An error has arisen only if the value 0 is returned.
|
Availability: | All AES versions.
|
Group: | Resource library
|
See also: | Binding rsrc_free shel_find vr_trnfm
|
C: | int16_t rsrc_load ( CONST int8_t *re_lpfname );
| ||||||||||||||||||||||||
Binding: |
int16_t rsrc_load (CONST int8_t *re_lpfname) { addr_in[0] = re_lpfname; return ( crys_if(110) ); } | ||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Resource object fix« - Convert an object's coordinates from
character-based to pixel-based.
| ||||||
Opcode: | 114
| ||||||
Syntax: | int16_t rsrc_obfix ( OBJECT *re_otree, int16_t re_oobject );
| ||||||
Description: | The call rsrc_obfix converts the size and position of a
displayed object from character-based to pixel-based coordinates at
the current screen resolution. (This is required because all objects
in RSC files have their coordinates based on character positions
rather than screen coordinates to ensure correct display of trees and
objects at any screen resolution.) The following apply:
Note: A call of this function is always required if objects are created at run-time, or are not loaded with rsrc_load. The conversion is performed by multiplying the lower byte of the coordinate specification with the size of a character from the system font, and then adding the (signed) upper byte. Exception: For a width of exactly 80 characters, the width of the screen is substituted; this is used for the background object of the menu tree for instance. | ||||||
Return value: | This always has the value 1.
| ||||||
Availability: | All AES versions.
| ||||||
Group: | Resource library
| ||||||
See also: | Binding rsrc_load rsrc_rcfix
|
C: | int16_t rsrc_obfix ( OBJECT *re_otree, int16_t re_oobject );
| |||||||||||||||||||||||||||
Binding: |
int16_t rsrc_obfix (OBJECT *re_otree, int16_t re_oobject) { int_in[0] = re_oobject; addr_in[0] = re_otree; return ( crys_if(114) ); } | |||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Resource coordinate fix« - Fix up coordinates and pointers
in memory.
| ||
Opcode: | 115
| ||
Syntax: | int16_t rsrc_rcfix ( RSHDR *rc_header );
| ||
Description: | The function rsrc_rcfix, present in MagiC and MultiTOS, fixes
up resource data already loaded into memory by the application. During
this the coordinates are converted from character- to
pixel-coordinates.
If an application has already loaded an RSC file before the function is called, then it must be released with rsrc_free before the rsrc_rcfix call is made. The same applies at the termination of the application. The advantage of this function consists in the ability of incorporating the resource file of the program into the program code itself. It then suffices to just call rsrc_rcfix, and loading with rsrc_load can then be dispensed with. The following applies:
| ||
Return value: | This will be 0 if unsuccessful, else non-zero.
| ||
Availability: | Available only in MagiC and AES versions 4.0 and greater. The
presence of this call should also be checked for using appl_getinfo (Opcode
4).
| ||
Group: | Resource library
| ||
See also: | Binding rsrc_load rsrc_obfix
|
C: | int16_t rsrc_rcfix ( RSHDR *rc_header );
| ||||||||||||||||||||||||
Binding: |
int16_t rsrc_rcfix ( RSHDR *rc_header ) { addr_in[0] = rc_header; return ( crys_if(115) ); } | ||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | Resource store address« - Store address of an object.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Opcode: | 113
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Syntax: | int16_t rsrc_saddr ( int16_t re_stype, int16_t re_sindex, void
*saddr );
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description: | The call rsrc_saddr stores the start address of a data
structure in memory. The following apply:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Return value: | An error has arisen only if the value 0 is returned.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Availability: | All AES versions.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Group: | Resource library
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See also: | Binding rsrc_gaddr OBJECT
|
C: | int16_t rsrc_saddr ( int16_t re_stype, int16_t re_sindex, void
*saddr );
| ||||||||||||||||||||||||||||||
Binding: |
int16_t rsrc_saddr (int16_t re_stype, int16_t re_sindex, void *saddr) { int_in[0] = re_stype; int_in[1] = re_sindex; addr_in[0] = saddr; return ( crys_if(113) ); } | ||||||||||||||||||||||||||||||
GEM-Arrays: |
|