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.Chars
- Sprites.Media.Text.Tool.Palette
- Sprites.Media.Text.Tool.Selector
- Sprites.Media.Text.Tool.Window
- Sprites.Media.Text.Tool.Windows
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.
| Input | Type | Description |
|---|---|---|
visible | Value | The show flag, true while the char tool is selected. |
chars | Value | The glyph list, each a { pixels } the grid draws. |
selectedChar | Value | The two way selected glyph index, the char brush. |
charIndex | Value | The clamped selection, for the selected border. |
first | Number | The code point of the first glyph, for the hover titles. |
width | Number | The character cell width in pixels. |
height | Number | The character cell height in pixels. |
slots | Value | The two colours the glyphs draw with, paper then ink. |
aspect | Number | The 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.
| Input | Type | Description |
|---|---|---|
visible | Value | The show flag, true while the tool is selected. |
title | String | The window title, Ink or Paper. |
brush | Value | The two way colour index the swatch grid sets. |
colours | Array | The 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.
| Input | Type | Description |
|---|---|---|
selectedToolName | Value | The 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.
| Input | Type | Description |
|---|---|---|
selectedToolName | Value | The two way chosen canvas tool. |
fileVisible | Value | The File panel's show flag, set true by its Windows button. |
historyVisible | Value | The 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.
| Input | Type | Description |
|---|---|---|
fileVisible | Value | The File panel's show flag. |
historyVisible | Value | The History panel's show flag. |
Returns nothing.