LinkComp(3U)
π LinkComp(3U) β the InterViews Reference Manual glow-up π
okay bestie, gather round, because today we're talking about LinkComp, LinkView, and PSLink β the component subject, the view, and the PostScript external representation for lines with connectable endpoints. yes this is from the InterViews Reference Manual and yes it's lowkey iconic. β¨
β¨ NAME β¨
LinkComp, LinkView, PSLink β component subject, view, and PostScript external representation for lines with connectable endpoints. that's the whole squad, right there. π
πΈ SYNOPSIS πΈ
#include <Unidraw/Components/link.h>
that's it. that's the include. go forth. π¦
π DESCRIPTION π
so LinkComp is a GraphicComp that defines a line with two pins on each end. not one pin, bestie β two. and the line's endpoints will always coincide with the pins, even if the pins get moved, which is the whole point: it maintains a graphical link between the objects it's connected to. no cap, that's the vibe. π₯
LinkComp uses an Line graphic to define its initial geometry and graphical attributes. (yes, "an Line". we don't fix the original's grammar, we respect it. it's giving character.)
LinkView is a GraphicView for displaying the link.
PSLink is a PostScriptView that externalizes the subject's information in PostScript form. it's the one that speaks printer. π¨οΈβ¨
π LINKCOMP PUBLIC OPERATIONS π
LinkComp(Line* = nil)β the constructor, and it takes an optional line graphic to define its initial appearance. pass nothing, get the default vibe. pass aLine*, get your vibe. π«Άvirtual void Interpret(Command*)virtual void Uninterpret(Command*)β on top of whatever commandsGraphicComp(un)interprets,LinkCompalso (un)interpretsDeleteCmdandCutCmd, by passing these commands to its pins for (un)interpretation. the pins get a say. democracy, kinda. πvirtual void Update()β when theLinkComp's pins move to maintain connectivity,LinkCompwill reorient the line so that its endpoints and the pins coincide. it's literally doing yoga to keep everyone together. π§ββοΈvirtual void First(Iterator&)virtual void Last(Iterator&)virtual void Next(Iterator&)virtual void Prev(Iterator&)virtual boolean Done(Iterator)GraphicComp* GetComp(Iterator)void SetComp(GraphicComp*, Iterator&)βLinkCompredefinesGraphicComp's traversal operations to make its pins accessible to the Unidraw library. so Unidraw can figure out the connectors that belong to the component and call itsUpdateoperation only once, for efficiency. main character energy: one call, no drama. and important: the traversal does not include the line. πLine* GetLine()β returns theLinegraphic that defines the link's attributes.GetLineis simply a more specific form of theGetGraphicoperation. same energy, narrower scope. βvoid GetConnectors(Connector*&, Connector*&)β returns theLinkView's pins, which are stored in the_conn1and_conn2protected members. yes, those two. the duo. π―
π¦ LINKVIEW PUBLIC OPERATIONS π¦
LinkView(LinkComp* = nil)β creates aLinkView, optionally supplying the subject. ("Create an LinkView" β again, original grammar, we stan.) πvirtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer*, Tool*)virtual void InterpretManipulator(Manipulator*)βLinkViewredefines its response to manipulation with aGraphicCompTool. here's the choreography, bestie: the user clicks to specify the first endpoint of the link, and then drags to position the remaining endpoint. (Up)clicking on an existing connector will establish a connection between it and theLinkComp's first (second) pin. π
LinkView uses a ConnectManip to produce a gravitational attraction between existing connectors and the second pin as the user drags to position it. but β plot twist β the endpoints will not be constrained by gravity. gravity is just for the pins, bestie. π
LinkView will use ConnectCmds to connect the pin(s) to their target(s). pin(s) connected in this way will receive floating mobility; unconnected pin(s) will be fixed. choose your fighter. π₯
virtual void First(Iterator&)virtual void Last(Iterator&)virtual void Next(Iterator&)virtual void Prev(Iterator&)virtual boolean Done(Iterator)GraphicView* GetView(Iterator)void SetView(GraphicView*, Iterator&)βLinkViewredefinesGraphicView's traversal operations to make its pins accessible to the Unidraw library. that way Unidraw can determine the connectors that belong to the component β for example, to supportConnectManip's gravitational attraction effect. the pins need to be findable for the magnetism to work. iykyk. π§²virtual void GetEndpoints(Coord&, Coord&, Coord&, Coord&)β returns the link's endpoints, in canvas coordinates. fourCoord&s, four pieces of info, zero ambiguity. β¨LinkComp* GetLinkComp()β returns the subject. short king of a function. π
π LINKVIEW PROTECTED OPERATIONS π
virtual void CreateHandles()βLinkViewredefinesCreateHandlesto use aRubberHandlesobject with two handles, one at each endpoint of the link. two handles for two endpoints, symmetry, we love to see it. πLine* GetLine()β returns the line thatLinkViewdraws between its pins. not the subject's line β this one. subtle but important. πΈvirtual LinkComp* NewSubject(Line*)β a helper function that creates aLinkCompsubject with the given line graphic. this function produces the proper subject when theGraphicCompTool's manipulator is interpreted. subclasses can redefine this operation to return aLinkCompsubclass, thus eliminating the need to reimplementInterpretManipulator. big brain shortcut. π§ β¨Manipulator* CreateLinkCompManip(Viewer*, Event&, Transformer*, Tool*)Command* InterpretLinkCompManip(Manipulator*)β helper functions thatCreateManipulatorandInterpretManipulatoruse to create and interpret the manipulator forGraphicCompTool. they're the backstage crew. π«Ά
β PSLINK PUBLIC OPERATIONS β
PSLink(LinkComp* = nil)β constructs a PostScript external representation of the given subject, if any. printer time. π¨οΈπ
π SEE ALSO π
Event(3I), Graphic(3U), GraphicComp(3U), GraphicCompTool(3U), GraphicView(3U), Grid(3U), PinComp(3U), PostScriptView(3U), Transformer(3I), align(3U), edit(3U), manips(3U)
go read those too, bestie, that's the reading list. πβ¨
and that's the whole page!! Unidraw, 22 January 1991 β yeah, this one's vintage vintage, and it still ate. π π periodt. π
π¦ 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