Sprites.Media.Text.Tool

The text editor's tool infrastructure. The Tools window has two groups: a Tools group that selects the one canvas tool, move, char, ink or paper, and a Windows group whose buttons open the file, history and characters panels. The char tool draws a character chosen from the characters panel; the ink and paper tools each paint a colour chosen from a palette window shown while the tool is selected. The move, file and history windows are the shared Sprites.Media.Sprite parts; only the four tool selector, the Windows group and the colour palette live here.

Sprites.Media.Text.Tool

Sprites.Media.Text.Tool.Chars Void

Sprites.Media.Text.Tool.Chars(visible, chars, selectedChar, charIndex, first, width, height, slots, aspect)

The characters palette window: the char tool's own window, shown while the char tool is selected, with no close button, like the ink and paper palettes. It holds a scrolling grid of the font's glyphs; clicking a glyph sets it as the char brush. It reuses the font editor's character grid.

InputTypeDescription
visibleValueThe show flag, true while the char tool is selected.
charsValueThe glyph list, each a { pixels } the grid draws.
selectedCharValueThe two way selected glyph index, the char brush.
charIndexValueThe clamped selection, for the selected border.
firstNumberThe code point of the first glyph, for the hover titles.
widthNumberThe character cell width in pixels.
heightNumberThe character cell height in pixels.
slotsValueThe two colours the glyphs draw with, paper then ink.
aspectNumberThe pixel aspect the glyphs draw at.

Returns nothing.

Sprites.Media.Text.Tool.Palette Void

Sprites.Media.Text.Tool.Palette(visible, title, brush, colours)

A colour palette window: a floating window, shown while visible is true, holding a swatch grid of the machine's colours. Clicking a swatch sets brush to that colour's index, so the ink or paper tool paints it. The ink and paper tools each build one, shown while that tool is selected. It owns its live rect, so a window closed and reopened returns to where it was dragged.

InputTypeDescription
visibleValueThe show flag, true while the tool is selected.
titleStringThe window title, Ink or Paper.
brushValueThe two way colour index the swatch grid sets.
coloursArrayThe machine's colours as packed 0xRRGGBBAA integers.

Returns nothing.

Sprites.Media.Text.Tool.Selector Void

Sprites.Media.Text.Tool.Selector(selectedToolName)

The canvas tool selector: one button group, one option per canvas tool. Exactly one is selected at a time, and picking an option sets selectedToolName, which the editor reads to choose which tool acts on the canvas and which tool window shows. Move pans the view, char lays a character, and ink and paper paint the two attributes.

InputTypeDescription
selectedToolNameValueThe two way tool name, one of move, char, ink, paper.

Returns nothing.

Sprites.Media.Text.Tool.Window Void

Sprites.Media.Text.Tool.Window(selectedToolName, fileVisible, historyVisible)

The Tools window: a slim floating window docked to the stage's top left. It holds two labelled groups: Tools picks the one canvas tool, and Windows opens the panel windows, file and history. It shows no tool controls of its own; each painting tool has its own window, and each panel has its own window. The window has no close button and does not resize.

InputTypeDescription
selectedToolNameValueThe two way chosen canvas tool.
fileVisibleValueThe File panel's show flag, set true by its Windows button.
historyVisibleValueThe History panel's show flag.

Returns nothing.

Sprites.Media.Text.Tool.Windows Void

Sprites.Media.Text.Tool.Windows(fileVisible, historyVisible)

The Windows buttons: one secondary button per panel window, File and History, each opening its window on a click by setting its visible flag true. They turn nothing off: a panel window carries its own close button, and any number may be open at once. The characters palette is not here; it is the char tool's own window.

InputTypeDescription
fileVisibleValueThe File panel's show flag.
historyVisibleValueThe History panel's show flag.

Returns nothing.