globals(3U)
๐ globals(3U) โ the Unidraw girlies' shared stuff ๐
okay so bestie, welcome to globals, part of the InterViews Reference Manual โจ this is the Unidraw page that's literally the group chat of the whole library โ all the constants, types, one-of-a-kind instances, and lil helper functions that everybody keeps referencing. ๐ซถ
โจ SYNOPSIS โจ
#include <Unidraw/globals.h>
๐ธ DESCRIPTION ๐ธ
So there are several constants and types that get used all over the place throughout the Unidraw library โ like, everywhere, no cap. This page also hands you global access to the one-of-a-kind instances (hi, the unidraw object ๐) plus the shared graphics resources. And finally there's a lil collection of global functions for common data manipulations. ๐
The way that all of these are declared in one file so you can just include it wherever you need them? Iconic. Efficient. Periodt.
๐ CONSTANTS ๐
static const int CHARBUFSIZEโ the size of the standard character buffer. ๐static const int HANDLE_SIZEโ the size of selection handles, in pixels. Those lil grabby bits, yk?static const char MARK[]โ a string that delineates data boundaries in the ASCII representation thatCataloggenerates. It's used for error checking, so it's giving hall monitor energy but make it helpful. ๐จstatic const int PIN_RADโ the radius of a pin, used in its default graphical representation, in pixels. ๐static const int SLOPโ the tolerance within which a hit on a graphical object will be detected, in pixels. Basically the "close enough bestie" radius. ๐ฏ
๐ฆ TYPES ๐ฆ
enum DragConstraintโ enumerates the orthogonal ways cursor movement may be constrained, usually during direct manipulation. Possible values includeNone,XFixed,YFixed,XYEqual,HorizOrVert, orGravity. Pick your fighter. ๐ฅenum Mobilityโ enumerates the three possible component mobilities:Fixed,Floating, orUndef(undefined).typedef unsigned Orientationโ specifies two kinds of orientation:PortraitorVertical(synonymous ๐), andLandscapeorHorizontal(also synonymous ๐).enum TransMethodโ enumerates the three possible transmission methods for connectors:In,Out, orInOut.typedef unsigned long ClassIdโ the type for representing unique class names for catalog-managed objects. ๐ท๏ธ
๐ INSTANCES ๐
extern Unidraw* unidraw
extern CSolver* csolver
The global unidraw and csolver objects. And here's the best part โ these and all other global instances are initialized automatically. โจ no manual setup, we love a low-maintenance king.
extern PSColor* psblack
extern PSColor* pswhite
extern PSPattern* pssolid
extern PSPattern* psclear
extern PSPattern* psnonepat
extern PSBrush* pssingle
extern PSBrush* psnonebr
extern PSFont* psstdfont
Predefined graphics resource objects. ๐จ fyi the None operation on psnonepat and psnonebr returns true.
extern Graphic* stdgraphic
A FullGraphic instance with its graphics state set to the global values listed above โ excluding psnonepat and psnonebr. ๐ not them.
๐ FUNCTIONS ๐
extern void NormalRect(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. Basically it fixes your rectangle's whole vibe so it's actually right-side up.
extern void GetLine(
const char* buf, int len, int beg, int& end,
int& size, int& nextBeg
)
This function is convenient for extracting lines from a buffer with a minimum of additional math operations โ say less, we hate extra math. ๐งฎ
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. Then it returns:
- the newline's position in
end - the size of the run of text terminated by a newline, which is
end + 1 - beg, insize - the index with which to begin a search for the next newline character, in
nextBeg
extern void GetAlignmentPoint(
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. ๐ obsessed.
extern void Ref(Resource*)
Call the Reference operation on the given instance of a resource subclass โ if the pointer is non-nil. (so if it's nil, nothing happens, it's giving "seen at 11:47 pm" ๐)
extern char* strnew(const char*)
Duplicate the given null-terminated string, creating a buffer of the appropriate size and returning the null-terminated result. ๐ a lil dupe, but make it legal.
๐ SEE ALSO ๐
CSolver(3U), Catalog(3U), Graphic(3U), GraphicView(3U), Pin(3U), Resource(3I), Unidraw(3U), InterViews(3I), pspaint(3U)
and that's the whole page bestie, go forth and globals responsibly ๐ซถ
Unidraw ยท 30 July 1990 โ yeah she's vintage, she's a classic, she's got main character energy from nineteen ninety and she still slays. ๐โญ
๐ฆ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms