Tool(3U)
π Tool(3U) π
okay bestie, welcome to the InterViews Reference Manual page for Tool(3U) β yes it's a manpage, yes it's from 1991, and yes it still ate. let's get into it π«Ά
β¨ NAME β¨
Tool β the base class for tool objects, periodt
πΈ SYNOPSIS πΈ
#include <Unidraw/Tools/tool.h>
π¦ DESCRIPTION π¦
okay so. Tool is an abstract base class for objects that support direct manipulation of components. and the way it does this?? tools use animation and other visual effects for immediate feedback, so the user genuinely feels like she's dealing with real objects. you grasp a tool, you wield it, you get the effect you wanted. main character energy fr π
now, that effect can be a few different things:
- it may involve a change to one or more components' internal state,
- or it may change the way components are viewed,
- or there may be no effect at all β like if the tool gets used in an inapropriate context. (and yes, that's the original spelling, we're keeping it, no cap.)
conceptually, tools do their work within viewers, where graphical component views get displayed and manipulated. so whenever a viewer receives an input event (mouse click, key press, whatever), it turns around and asks the current tool β which is defined by the enclosing editor object β to produce a manipulator object. iconic delegation honestly.
here's the whole pipeline, bestie:
- A tool implements its
CreateManipulatoroperation to create and initialize an appropriate manipulator, which encapsulates the tool's manipulation semantics by defining the three phases β grasp, wield, effect β of the manipulation. - Also, a tool can delegate manipulator creation to one or more of the
GraphicViewobjects in the viewer, to allow component-specific interaction. π - A tool's
InterpretManipulatoroperation accesses and analyzes information in the manipulator that characterizes the manipulation, and then creates a command that carries out the desired effect.
β οΈ important rule: if a tool delegated manipulator creation to a graphical view, then it must delegate its interpretation to that same view. matching sets only, bestie, don't mix and match π
π₯ PUBLIC OPERATIONS π₯
virtual Manipulator* CreateManipulator(
Viewer*, Event&, Transformer*
)
virtual void InterpretManipulator(Manipulator*)
- These are the operations that define how the tool reacts when it's used, and what its ultimate effect is. The tool can defer manipulator creation and interpretation to a
GraphicViewβ which is the whole reason the same tool can behave differently depending on the component it's manipulating. flexible queen β¨ CreateManipulatorcreates a manipulator that's appropriate for the tool. It receives:- the viewer in which the manipulation will take place,
- an event with which to initialize the manipulator if necessary,
- and the coordinate transformation that maps canvas coordinates into the subject's coordinate space.
InterpretManipulatoris called following manipulation and defines how to construct a command that carries out the manipulation's desired effect.
virtual void SetControlInfo(ControlInfo*)
virtual ControlInfo* GetControlInfo()
- Tools use a
ControlInfoobject to store information from which to build a user interface for engaging the tool. These two operations set and get thatControlInfoobject. π SetControlInfodoes not delete theControlInfobeing replaced. like, it just... leaves it there. so if you needed that, you have it. π
virtual Component* Copy()
- Returns a copy of the tool.
- Subclasses should redefine this operation to return an instance of their type. (yes that's "should" β we're not making up extra rules here.)
virtual void Read(istream&)
virtual void Write(ostream&)
- Read and write the tool's contents to a stream to support catalog operations.
ReadandWritetypically call first the corresponding operations defined by their parent class, and then they read or write their class-specific state.- > β οΈ note: you must ensure that the objects are read in the same order they are written. order matters, bestie, this is not a vibe-check situation, it's a correctness situation π
virtual ClassId GetClassId()
virtual boolean IsA(ClassId)
GetClassIdreturns the unique class identifier for theToolsubclass.IsAreturns whether the instance is of a class or subclass corresponding to the given identifier. It typically checks the given identifier against the instance's own (as defined by itsGetClassIdoperation) and, failing that, calls its parent classes'IsAoperation.- > π All subclasses must redefine
GetClassIdandIsAto ensure that their identifiers are unique and that instances are written and read properly. non-negotiable, fr fr.
π PROTECTED OPERATIONS π
Tool(ControlInfo* = nil)
- The constructor is protected to prevent instatiation of the abstract base class. (again, original spelling, we're keeping the whole thing, no edits π )
- The
ControlInfoobject is optional β but only tools that have no visible manifestion in the interface should omit it.
ControlInfo* CopyControlInfo()
CopyControlInfois a convenience function that subclasses may use in theirCopyoperation.- It returns a copy of the tool's
ControlInfoobject if it's non-nilβ simply checking for anilargument before calling the correspondingCopyon theControlInfoobject. so helpful, so thoughtful πΈ
π SEE ALSO π
Catalog(3U)Command(3U)ControlInfo(3U)Editor(3U)Event(3I)GraphicView(3U)Manipulator(3U)Transformer(3I)Viewer(3U)classes(3U)istream(3C++)ostream(3C++)
and that's the whole page, bestie!! this one's from Unidraw, dated 24 January 1991 β yes, before some of us were born, and yet it's still serving. stay iconic, keep your IsA unique, and read your streams in order πβ¨π¦
π¦ 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