SlotComp(3U)

πŸ’– SlotComp(3U) β€” the InterViews Reference Manual, bestie edition πŸ’–

okay so real quick, this whole page is from the InterViews Reference Manual, it's SlotComp(3U), and yes we're doing the full deep dive. grab a strawberry drink πŸ“, we're going in.


✨ NAME ✨

SlotComp, SlotView, HSlotComp, HSlotView, VSlotComp, VSlotView, SlotGraphic, PSSlot β€” the abstract base class and its subclasses for slot connector subject and view, plus the structured graphic and PostScript external representation classes for slots. that's a whole friend group, not just one class πŸ’…


🌸 SYNOPSIS 🌸

#include <Unidraw/Components/slot.h>

that's it. one include. iconic behaviour honestly.


πŸ¦‹ DESCRIPTION πŸ¦‹

SlotComp is a Connector subclass, and it's out here supporting connectivity with one degree of freedom. yes bestie, one. it's an abstract base class, meaning you don't instantiate it directly β€” you derive from it. and what do you derive? HSlotComp and VSlotComp, which handle horizontal and vertical orientations respectively. slay.

the slot component classes store their graphical attributes in SlotGraphics β€” that's the storage locker for the look πŸ‘‘

SlotView is an abstract subclass of ConnectorView, and its whole job is displaying slots. HSlotView and VSlotView are SlotViews that display slots with the corresponding orientations. and then β€” drumroll β€” PSSlot is a PostScriptView that externalizes the slot subject's info in PostScript form. the way that whole family tree just works 😭✨


πŸ‘‘ SLOTCOMP PUBLIC OPERATIONS πŸ‘‘

  • virtual void Interpret(Command*)
  • virtual void Uninterpret(Command*)

SlotComp (un)interprets a subset of the commands that connectors can generally interpret, namely MoveCmd, BrushCmd, AlignCmd, MobilityCmd, DeleteCmd, and CutCmd. not all of them, bestie β€” a subset. write that down πŸ“

  • virtual Mobility GetMobility()
  • virtual void SetMobility(Mobility)

SlotComp redefines these two so they return and assign its _mobility protected member. and important: slots have fixed mobility initially. that's the default, no cap.

  • Slot* GetSlot()

returns the Slot graphic that defines the line's attributes. and honestly? GetSlot is just a more specific form of the GetGraphic operation. same energy, narrower scope πŸŽ€


🧚 SLOTCOMP PROTECTED OPERATIONS 🧚

  • SlotComp(SlotGraphic* = nil)

the constructor takes an optional SlotGraphic that defines the slot's graphical attributes. it's protected to prevent instantiation, because SlotComp is an abstract class. no direct objects for you, sorry not sorry πŸ™ˆ

  • void SetOrientation(SlotGraphic*, Orientation)

defines the orientation of the SlotComp's SlotGraphic. and here's the tea: only SlotComp can specify this SlotGraphic attribute β€” the HSlotComp and VSlotComp subclasses just set it to reflect their respective orientations. gatekeeping, but make it architecture πŸ’…


🌈 SLOTVIEW PUBLIC OPERATIONS 🌈

  • virtual void Interpret(Command*)

SlotView interprets AlignToGridCmd to align its starting point to the grid. snapping into place, periodt ✨

  • virtual Manipulator* CreateManipulator( Viewer*, Event&, Transformer*, Tool* )
  • virtual void InterpretManipulator(Manipulator*)

okay so SlotViews respond only to manipulation by GraphicCompTools, MoveTools, and ConnectTools. that's the whole list. SlotView inherits its MoveTool response from ConnectorView.

GraphicCompTool will let the user sweep out a crosshaired rectangle that reflects the slot's size and orientation. creation will be influenced by gravity, if any β€” yes, gravity, it's giving physics class πŸͺ

SlotView creates a ConnectManip in response to the ConnectTool, and that manip will exhibit a gravational attraction to potential target connectors. SlotView will produce a ConnectCmd to connect the slot to its target. and a slot connected in this way will receive floating mobility. cute, it floats now 🎈

  • SlotComp* GetSlotComp()

return the subject. that's the whole thing. short king πŸ‘‘


πŸ’œ SLOTVIEW PROTECTED OPERATIONS πŸ’œ

  • SlotView(SlotComp* = nil)

create a SlotView, optionally supplying the subject. the constructor is protected to prevent instantiation β€” again, abstract, no shortcuts.

  • SlotGraphic* GetSlot()

return the SlotGraphic that defines the slot's attributes. GetSlot is simply a more specific form of the GetGraphic operation. yes it's the same description as the other GetSlot, they're twins, let them live πŸ’–

  • virtual SlotComp* NewSubject(SlotGraphic*)

a helper function that creates a SlotComp subject with the given slot graphic. this function produces the proper subject when the GraphicCompTool's manipulator is interpreted. HSlotView and VSlotView redefine this operation to return the corresponding SlotComp subclasses, which eliminates the need to reimplement InterpretManipulator. efficient queen behavior ✨

  • Manipulator* CreateGraphicCompManip( Viewer*, Event&, Transformer*, Tool* )
  • Manipulator* CreateConnectManip( Viewer*, Event&, Transformer*, Tool* )
  • Command* InterpretGraphicCompManip(Manipulator*)
  • Command* InterpretConnectManip(Manipulator*)

helper functions used by CreateManipulator and InterpretManipulator to create and interpret the manipulators associated with GraphicCompTool and ConnectTool. the backstage crew. we love them 🫢


⭐ SLOTGRAPHIC PUBLIC OPERATIONS ⭐

  • SlotGraphic(Coord, Coord, Coord, Graphic* = nil)

create a SlotGraphic, specifying the starting point, the length, and optionally a graphic from which to obtain its default graphics attributes. three Coords, bestie, in that order πŸ“

  • void GetOriginal(Coord&, Coord&, Coord&)

return the SlotGraphic's original geometry parameters, exactly as specified in the constructor. original flavour only, no remixes πŸ“


πŸŽ€ PSSLOT PUBLIC OPERATIONS πŸŽ€

  • PSSlot(SlotComp* = nil)

construct a PostScript external representation of the given subject, if any. if any. optional. flexible. we stan πŸ’…


πŸ’€ SEE ALSO πŸ’€

BrushCmd(3U), ConnectTool(3U), Connector(3U), ConnectorView3U), Event(3I), Graphic(3U), GraphicCompTool(3U), Grid(3U), MoveTool(3U), PatternCmd(3U), PostScriptView(3U), Transformer(3I), Viewer(3U), align(3U), edit(3U), globals(3U), manips(3U), transforms(3U)

psst β€” ConnectorView3U) really is written like that in the original, missing paren and all. not my typo, i'm just the messenger πŸ™ˆ

and that's the whole page, bestie! go forth and slay 🌟

this was Unidraw, dated 23 January 1991, and the page is SlotComp(3U). mwah, love u, read ur headers πŸ’–πŸ¦‹βœ¨