globals - Unidraw global constants, types, instances, and functions.
Contents
Constants
staticconstintCHARBUFSIZE
Size of standard character buffer.
staticconstintHANDLE_SIZE
Size of selection handles, in pixels.
staticconstcharMARK[]
String that delineates data boundaries in the ASCII representation that Catalog generates. Used
for error checking.
staticconstintPIN_RAD
The radius of a pin, used in its default graphical representation, in pixels.
staticconstintSLOP
Tolerance within which a hit on a graphical object will be detected, in pixels.
Description
Several constants and types are used throughout the Unidraw library. It also provides global access to
one-of-a-kind instances such as the unidraw object as well as shared graphics resources. Finally, there
are several global functions for common data manipulations. All of these are declared one file for
inclusion into other files where they are needed.
Functions
externvoidNormalRect(Coord&l,Coord&b,Coord&r,Coord&t)
Given two coordinate pairs (l, b) and (r, t), it checks whether l < r and b < t. If not, it swaps
the values in the offending inequalities. This function is useful for ensuring that a rectangle
is defined by its lower-left and upper-right vertices.
externvoidGetLine(constchar*buf,intlen,intbeg,int&end,int&size,int&nextBeg)
This function is convenient for extracting lines from a buffer with a minimum of additional math
operations. Given a buffer of characters buf of length len, search for the first newline character
(or the last character in the buffer) after the character at index beg; return the newline's
position in end, the size of the run of text terminated by a newline (end + 1 - beg), and the
index with which to begin a search for the next newline character (nextBeg).
externvoidGetAlignmentPoint(Graphic*,Alignment,float&,float&)
Return the point (in floating point canvas coordinates) on a graphic corresponding to the given
alignment. For example, to obtain the coordinates of the lower-left of a rectangle graphic,
specify the graphic and a BottomLeft alignment.
externvoidRef(Resource*)
Call the Reference operation on the given instance of a resource subclass if the pointer is non-
nil.
externchar*strnew(constchar*)
Duplicate the given null-terminated string, creating a buffer of the appropriate size and
returning the null-terminated result.
Instances
externUnidraw*unidrawexternCSolver*csolver
The global unidraw and csolver objects. These and all other global instances are initialized
automatically.
externPSColor*psblackexternPSColor*pswhiteexternPSPattern*pssolidexternPSPattern*psclearexternPSPattern*psnonepatexternPSBrush*pssingleexternPSBrush*psnonebrexternPSFont*psstdfont
Predefined graphics resource objects. The None operation on psnonepat and psnonebr returns true.
externGraphic*stdgraphic
A FullGraphic instance with its graphics state set to the global values listed above, excluding
psnonepat and psnonebr.
Name
globals - Unidraw global constants, types, instances, and functions.
See Also
CSolver(3U), Catalog(3U), Graphic(3U), GraphicView(3U), Pin(3U), Resource(3I), Unidraw(3U), InterViews(3I), pspaint(3U) Unidraw 30 July 1990 globals(3U)
Synopsis
#include<Unidraw/globals.h>
Types
enumDragConstraint
Enumerates orthogonal ways in which cursor movement may be constrained, usually during direct
manipulation. Possible values include None, XFixed, YFixed, XYEqual, HorizOrVert, or Gravity.
enumMobility
Enumerates the three possible component mobilities: Fixed, Floating, or Undef (undefined).
typedefunsignedOrientation
Specifies two kinds of orientation: Portrait or Vertical (synonymous), and Landscape or Horizontal
(synonymous).
enumTransMethod
Enumerates the three possible transmission methods for connectors: In, Out, or InOut.
typedefunsignedlongClassId
Type for representing unique class names for catalog-managed objects.
