The Resorcerer template ('TMPL') used to open framework view layout ('FWvl') resources for localization relies on class tags stored within the resource data for information about how it should parse the resource into a series of editable fields. Support for class tags representing all standard ODF view types is included in the template; however, many developers will want to create their own custom view types derived from the standard types, and will use unique class tags to identify their types.
In order to edit view layouts containing custom views with Resorcerer, the 'FWvl' template must first be modified to accomodate the new types. To do this, open the 'TMPL' resource named "FWvl" in the "ODF Templates" file (or use the "Old ODF Templates" file if you're building your part with ODF 1.0). Near the top of the template definition is a series of CASE statements:
‘CASE’ View Layout=root
‘CASE’ FW_RView=view
‘CASE’ FW_RSuperView=suvw
.
.
.
‘CASE’ RCustomView=Cvie
‘CASE’ RCustomSuperView=Csuv
‘CASE’ RCustomControl=Ccon
‘CASE’ RCustomNativeControl=Cncn
‘CASE’ RCustomButton=Cbut
‘CASE’ RCustomPopUpMenu=Cpop
‘CASE’ RCustomScrollBar=Cscb
‘CASE’ RCustomGrowBox=Cgrb
‘CASE’ RCustomListBox=Clbo
‘CASE’ RCustomStaticText=Cstx
‘CASE’ RCustomGroupBox=Cgpb
‘CASE’ RCustomEditView=Cedv
‘CASE’ RCustomPictSView=Cpic
The last set of CASE statements (those with labels beginning “RCustom...”) are placeholders for your custom view types. If the custom view type doesn't add any new fields to the standard type from which it is derived, just double-click on the CASE label corresponding to the view type you're extending and replace the four-character class tag after the '=' with the class tag you used for your type. (For instance, if you extended FW_RButton and labeled your class 'MyBt', you could modify the template to work with your class by double-clicking on the CASE label for RCustomButton and changing "RCustomButton=Cbut" to "RCustomButton=MyBt".)
The situation becomes slightly more complicated if you derive multiple custom views from a single standard view class. If this is the case, you must first duplicate the CASE label for the placeholder custom resource type (the easiest way to do this is to Cut and then Paste twice, because Resorcerer automatically positions the insertion caret—the small black triangles on the sides of the window—after a Cut). Next, you can modify each of the class tags after the '=' signs in the CASE labels to one of your derived class tags. Finally, scroll down in the template to the actual definition of the data fields for the resource type you're using (it will be in the form of a KEYB/KEYE block labeled with the class tag of the placeholder custom type, beginning with a 'C'), and select and duplicate the entire definition, including the KEYB/KEYE fields. Note that Resorceror matches CASE labels with KEYB/KEYE blocks only by their ordering in the template, not by their labels, so it's important that you insert the additional CASE field and data definition blocks in corresponding locations. (There must be exactly one KEYB/KEYE block for each CASE statement.) You don't need to change the labels on the KEYB/KEYE statements after duplicating them, although it might be a good idea if it helps you keep track of which is which.
All of the above has assumed that the custom view type used hasn't added any additional data fields to the existing view types. If additional fields have been added, you'll have to add template fields corresponding to your additional data fields right before the appropriate KEYE tag in the template. Template tags for some the most common data types in ODF views are:
DWRD Decimal word
HWRD Hex word
DLNG Decimal long
HLNG Hex long
FIXD Fixed-point value
BFLG One-byte Boolean flag
CSTR Null-terminated C string
WSTR String preceded by a length word
SCPC Script code
LNGC Language code
Hxxx $xxx bytes of hex data (for instance, H00A for ten bytes of hex data)
In addition, you can represent a counted array with a series of fields as follows:
‘OCNT’ Number of array entries
‘LSTC’ •••••
(data in array elements)
‘LSTE’ •••••
The OCNT field is a two-byte, one-based count of the number of elements in the array; the LSTC and LSTE are just placeholders indicating the beginning and end of the counted list. As an example, this code from the ODFRC definition for a radio cluster: