align(3U)

✨ align(3U) β€” InterViews Reference Manual ✨

okay bestie, buckle up, we're talking about align(3U) from the InterViews Reference Manual πŸ’– this one's all about the Unidraw command girls who make your interactors line up all cute and tidy. no cap.


🌸 NAME 🌸

AlignCmd, AlignToGridCmd β€” commands for aligning interactors to each other and to a grid. literally the matchmaker of layout, fr fr πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <Unidraw/Commands/align.h>

πŸ’œ DESCRIPTION πŸ’œ

so AlignCmd is a purely interpretive command for aligning selected components with respect to one another. like, it can align the left sides of selected components so that they coincide. iconic behavior honestly ✨

AlignToGridCmd is a whole different vibe β€” it gets interpreted by selected GraphicView objects so they align themselves to the grid (if any) associated with the viewer in which they appear. so each component gets to define what it means to align itself to the grid. main character energy, each one deciding for themselves 🫢


πŸ‘‘ ALIGNCMD PUBLIC OPERATIONS πŸ‘‘

AlignCmd(
    ControlInfo*,
    Alignment reference = Left, Alignment affected = Left
)
  • AlignCmd(Editor* = nil, Alignment = Left, Alignment = Left) β€” the constructor, and she takes optional arguments for specifying the alignment you want. the reference parameter specifies a point on a fixed reference component. the affected parameter specifies a point on components that will move to realize the alignment. and the defaults for these parameters? they specify that all affected components should align their left sides to reference's left side. left gang rise up πŸ’…
  • void GetAlignment(Alignment&, Alignment&) β€” returns the alignment parameters that were specified in the constructor. lowkey just handing your settings back to you, no notes.
  • GraphicComp* GetReference(GraphicComp* affected) β€” returns the reference component given a potentially affected component. here's the tea: if affected appears in the AlignCmd's clipboard, then GetReference returns the GraphicComp preceding it in the clipboard. but if affected is the first component in the clipboard, or if it's not on the clipboard at all, then GetReference returns the first component on the clipboard. first place stays winning πŸ‘‘

🌈 ALIGNTOGRIDCMD PUBLIC OPERATIONS 🌈

AlignToGridCmd(ControlInfo*)
AlignToGridCmd(Editor* = nil)
  • AlignToGridCmd(ControlInfo*) and AlignToGridCmd(Editor* = nil) β€” construct an AlignToGridCmd. that's it, that's the job, she's built πŸŽ€
  • virtual void Execute() and virtual void Unexecute() β€” AlignToGridCmd redefines Execute to let the selected GraphicView objects interpret the command the first time. this lets the components determine the proper grid with which to align themselves, plus the amount of movement required. Execute assumes that GraphicView objects will use the Align operation (described below) to compute the amount of movement, store it in a MoveData object, and finally issue a MoveCmd to the subject for interpretation. and Unexecute? she simply calls Unmove (also described below) to reverse the Align's effects. undoing the undoing, as one does πŸ’€
  • virtual void Align(GraphicView*, float, float) and virtual void Unalign(GraphicView*) β€” GraphicView objects interpreting the AlignToGridCmd should use the Align operation to specify a point to align to the grid that affects them. Align will effectively move the component so that the given point falls on the grid. it will also store the amount of movement in this by calling Store with a MoveData object. finally, Align calls Move (described below) to actually move the component that amount. Unalign provides a public interface to reversing the effects of Align by simply calling Unmove with its argument's subject. symmetry, bestie, we love to see it ✨

🧚 ALIGNTOGRIDCMD PROTECTED OPERATIONS 🧚

  • void Move(GraphicComp*) and void Unmove(GraphicComp*) β€” Move produces a MoveCmd based on the MoveData stored for the given GraphicComp and tells the GraphicComp to interpret the MoveCmd. conversely, Unmove produces a MoveCmd based on the the same information and tells the GraphicComp to uninterpret it. yes, "the the" β€” I'm keeping it, that's canon, don't @ me πŸ™ˆ

πŸ’– SEE ALSO πŸ’–

Command(3U), GraphicComp(3U), GraphicView(3U), Grid(3U), Viewer(3U), datas(3U), transforms(3U)

go read those too, iykyk 🌸


reminder bestie: this page is align(3U) from the InterViews Reference Manual, and it's brought to you by Unidraw, dated 23 January 1991 πŸŽ€ like, vintage but make it slay. mwah, that's the whole manual, periodt πŸ’…πŸ’œ