Create a new class with an appropriate name. Copy all the methods from RBox into the new class definition.
Modify the initialize method so that your primitive has the attributes you need.
Modify the display and displayScaledBy: methods to draw the required image.
Add a specification in the repSpecs directory. This should have the following form:
<name> =
type = representation
endSpecification
description
<some text describing the representation>
endDescription.
An example:
box =
type = representation
endSpecification
description
This is a basic box. The size can be changed.
endDescription.
The specification should be saved in a file with the same name as the representation.
Modify the REntity class method initializeOptions by adding a line like this:
RepresentationOptions
at: <representation name>
put: [<class name> new].
An example:
RepresentationOptions at: #box put: [RBox new].
The representation name should be the name of the file in the repSpecs directory which holds the representation specification.
Modify the RepSpec class method initializeRepTypes by adding a line like this:
BasicTypes at: <representation name> put: <class name>.
An example:
BasicTypes at: #box put: RBox.
Accept your change to the method.
Now re-initialize class RepSpec by executing: RepSpec initializeRepTypes
The RepSpec class includes a class variable, AttributeDictionary, which holds the basic attributes belonging to a primitive representation. An entry must be placed in AttributeDictionary for the attributes of the new representation. This is done by modifying class method initializeRepTypes.
An example:
AttributeDictionary at: #box put: Dictionary new.
(AttributeDictionary at: #box) at: #border put: #boolean.
(AttributeDictionary at: #box) at: #colour put: #colour.
(AttributeDictionary at: #box) at: #borderColour put: #colour.
Accept your change to the method.
Now re-initialize class RepSpec by executing: RepSpec initializeRepTypes.