VisContent: 1.3 VisContent Instance Data: Fields That Affect the Document

Up: GEOS SDK TechDocs | Up | Prev: 1.2 Fields That Affect the View | Next: 1.4 Fields That Affect Input Events
VCNI_docOrigin, VCNI_scaleFactor, MSG_VIS_CONTENT_SET_DOC_BOUNDS, MSG_VIS_CONTENT_RECALC_SIZE_BASED_ON_VIEW

The GenView object maintains quite a bit of information about the document as managed by the content object. The content must also keep information about the document and how the view is displaying it. This information is stored in two fields, VCNI_docOrigin and VCNI_scaleFactor , both detailed below.

The document bounds of the content are typically equal to the bounds of the VisContent itself. The content's bounds are stored in the VI_bounds field inherited from VisClass . When a content is managing layers or large documents, however, its bounds are set to zero. It then manages its document bounds within the layer objects and the GenView. When the document bounds change, a MSG_VIS_CONTENT_SET_DOC_BOUNDS should be sent to the content to get it to notify all its layer children and the GenView of the new bounds. This message is shown at the end of this section.

If the content is not a large document and is set up to follow the GenView's geometry (it has either or both of VCNA_SAME_WIDTH_AS_VIEW or VCNA_SAME_HEIGHT_AS_VIEW set), it will be affected by changes in the view's geometry. During geometry updates, the view will send it a MSG_VIS_CONTENT_RECALC_SIZE_BASED_ON_VIEW . This message sets the content's width and/or height and therefore affects its VI_bounds field. This message is also shown at the end of this section.

VCNI_docOrigin
This field contains the current origin of the view window. The origin is the location of the view's upper left corner in the document (where the scrollers are). This field is of type PointDWord , which has the following structure:
typedef struct {
    sdword   PD_x;    /* x coordinate of origin */
    sdword   PD_y;    /* y coordinate of origin */
} PointDWord;
Normally, this field is set when the view is first opened or when the view is scrolled, scaled, or otherwise changed in document position. The view will send the message MSG_META_CONTENT_VIEW_ORIGIN_CHANGED to indicate the origin is different from its current setting.
VCNI_scaleFactor
This field contains the current scale factor the view is displaying. Scaling is implemented almost entirely in the GenView object; some content objects, however, will want to react in a special way when the scale factor is changed. The scale factor is stored in a PointWWFixed structure, as follows:
typedef struct {
    WWFixed    PF_x;   /* horizontal scale factor */
    WWFixed    PF_y;   /* vertical scale factor */
} PointWWFixed;
The WWFixed structures that determine the scale factor in each dimension consist of two elements. This structure is shown below:
typedef struct {
    word    WWF_frac;   /* fractional portion */
    word    WWF_int;    /* integral portion */
} WWFixed;
The VCNI_scaleFactor field in the content is never set directly by the application; instead, it is set with MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED whenever the view's scale factor changes.

Messages that set these fields are discussed in Messages Received from the View .

MSG_VIS_CONTENT_SET_DOC_BOUNDS

void	MSG_VIS_CONTENT_SET_DOC_BOUNDS(@stack
        sdword	bottom,
        sdword	right,
        sdword	top,
        sdword	left);

This message is used to set the document bounds of a content's large document. The content will send MSG_GEN_VIEW_SET_DOC_BOUNDS to its view and MSG_VIS_LAYER_SET_DOC_BOUNDS to each of its children with the new bounds. The recipient content must have the flag VCNA_LARGE_DOCUMENT_MODEL set in VCNI_attrs .

Source: Unrestricted.

Destination: Any large VisContent object--if the content is not using the large document model, an error will result.

Parameters: bottom, right, top, left
The new document bounds in 32-bit document coordinates.

Return: Nothing.

Interception: Unlikely.

Warnings: You may only send this message to a content that is using the large document model. All other contents will not handle this message but will result in a fatal error.

MSG_VIS_CONTENT_RECALC_SIZE_BASED_ON_VIEW

SizeAsDWord MSG_VIS_CONTENT_RECALC_SIZE_BASED_ON_VIEW();

This message causes the content to recalculate its size based on the view's geometry. It will try to set its width if it has VCNA_SAME_WIDTH_AS_VIEW set, and it will try to set its height if it has VCNA_SAME_HEIGHT_AS_VIEW set.

Source: Unrestricted--typically sent by the view or by the content to itself during geometry updates.

Destination: Any VisContent object.

Parameters: None.

Return: A SizeAsDWord value indicating the new size of the content. Use the macros DWORD_HEIGHT and DWORD_WIDTH to extract the appropriate values.

Interception: Unlikely .


Up: GEOS SDK TechDocs | Up | Prev: 1.2 Fields That Affect the View | Next: 1.4 Fields That Affect Input Events