Universal Overlay v1.2
----------------------

Armin Diedering
Last changed: 29.1.2000
Tab width: 3


1. What is UniLay ?
===================

UniLay is an overlay for ResourceMaster from Version 3.0 onwards. With 
overlays it is possible to display user-defined objects already in the 
editor. 
UniLay uses ResourceMaster's own userdef-objects for this, which the 
ResourceMaster uses when no MagiC special types are available. This has 
the advantage that the overlay with its 2-3 kbyte is kept very small. 
The disadvantage is that the objects are displayed in the editor not  
quite the same as they will later look in the program. Nevertheless a  
rough impression is possible.


2. Installation
===============

RSM 3.0:
--------
Simply copy the files "unilay.ovl" and "unilay.cnf" into the RSM 
"modules" folder and rename them to "rsm.ovl" and "rsm.cnf".

RSM 3.2:
--------
Simply copy the files "unilay.ovl" and "unilay.cnf" into the RSM "modules"
folder. As RSM 3.2 supports multiple overlays, the files may be renamed 
and UniLay copied several times into the "modules" folder. The filename 
for the "*.ovl" and the "*.cnf" have to be identical (e.g. "flydials.ovl" 
and "flydials.cnf").
From RSM 3.2 onwards an overlay can offer its own Toolboxes. UniLay looks 
in the "modules" folder for a  Tools-resource ("Overlay-Name.rsc"). This  
Resource must be constructed in exactly the same way as an RSM Tool-
resource -> rsm.hyp.


3. Which objects are supported?
===============================

UniLay or the ResourceMaster currently supports 7 special objects:

- RSM_MOVEBUTTON		The well-known dog-ear to make dialogs fly.
- RSM_BUTTON			A button with an underscored character.
- RSM_CHECKBUTTON		A check-button with/without underscored character.
- RSM_RADIOBUTTON		A radio-button  with/without underscored character.
- RSM_UNDERLINED		An underscored string.
- RSM_GROUPBOX			A group frame.
- RSM_NICELINE			A niceline for menus.

Apart from RSM_MOVEBUTTON, the special objects only take effect when 
dealing with G_STRING, G_BUTTON or G_TITLE objects. 

For RSM_BUTTON, RSM_CHECKBUTTON and RSM_RADIOBUTTON the underscored 
character will be marked with an opening square bracket in the button 
text. Alternatively you can do it like MagiC by setting Whitebak; in that 
case the position is determined by bits 8-11 of ob_states using a binary 
format starting from none set for the first character, bit 8 (=1) set for 
the second, bit 9 (=2) for the third, bit 8+9 (=3) for the fourth etc.
The MagiC method takes priority.


4. How do I configure UniLay?
=============================

UniLay loads in initialization the file "unilay.cnf". In this CNF-file 
you can specify for which objects the overlay should be active.

The file has to commence with the following line!

------------Snip-----------
#[xxxx]
------------Snap-----------

This sets the ID of the overlay ("xxxx" represents any 4 characters). If 
you want to (or must) use several CNF-files, then you should assign an ID 
for each CNF. As the ID of the overlay is also saved in the *.rsm-file, 
RSM will only activate the overlay if the IDs match.
To avoid conflicts with public overlays, private IDs should start with a 
'_' such as "#[_AO1]" (Armins Overlay No.1).

Then follow the object lines.
Each valid object line is built up as follows:

------------Snip-----------
#00 0000 0000 0000 0000 0000 0000	Comment
------------Snap-----------

So the line always starts with a hash (double-cross). The hash is 
followed by 7 hexadecimal-coded numbers, separated by a space. The 
first always has 2 places and the rest four places. An optional comment 
must be separated by spaces or tabs from the last number.

The first number determines the special object number. The following 
apply:
	0 -> DRAW_NOTHING
	2 -> RSM_MOVEBUTTON
	3 -> RSM_BUTTON
	4 -> RSM_CHECKBUTTON
	5 -> RSM_RADIOBUTTON
	6 -> RSM_UNDERLINED
	7 -> RSM_GROUPBOX
	8 -> RSM_NICELINE

The folllowing 6 numbers are split into 3 pairs. Each number-pair 
contains a mask and a comparison value. These number-pairs apply in each 
case for the OBJECT-component type, Flags and States.

Example: 
---------
1. The overlay should take over the display of an RSM_CHECKBUTTON when:
	- The extended type = 22 (hex 16)
	- The object type = G_STRING (28 or hex 1c)

	#03 ffff 161c 0000 0000 0000 0000
   --- ---- ---- -------------------
    |   |     |           |
    |   |     |          Flags and States are irrelevant
    |   |    Ext.type=22 and Type=G_STRING?
    |  Use all bits of ob_type
   RSM_CHECKBUTTON 

2. As a checkbutton should only be draw when the EXIT-flag is not set, 
   we need a second line:
   
   #00 ffff 161c 0004 0004 0000 0000
   ---           ---- ----
    |             |     |
    |             |    Is EXIT set?
    |            Only evaluate the EXIT-flag
   DRAW_NOTHING
   
   This line must be placed before the RSM_CHECKBUTTON-line.

3. An RSM_RADIOBUTTON should be drawn for the same conditions as above  
	when the RADIO-flag is set:
	
   #04 ffff 161c 0010 0010 0000 0000
   ---           ---- ----
    |             |     |
    |             |    Is RADIO set?
    |            Only evaluate the RADIO-flag
   RSM_RADIOBUTTON
   
   This line too must be placed before the RSM_CHECKBUTTON-line but 
   after the DRAW_NOTHING line.
	
4. To summarize: 
	- The extended type = 22 (hex 16)
	- The object type = G_STRING (28 or hex 1c)
	- If EXIT-flag, then nothing should be drawn
	- If RADIO-flag then RSM_RADIOBUTTON else RSM_CHECKBUTTON
	
	------------Snip-----------
   #00 ffff 161c 0004 0004 0000 0000	If Exit draw nothing
   #04 ffff 161c 0010 0010 0000 0000	If RADIO -> RSM_RADIOBUTTON
	#03 ffff 161c 0000 0000 0000 0000	If no EXIT and also no RADIO 
													then RSM_CHECKBUTTON
	------------Snap-----------
