Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
class_name SheetFieldViews
|
|
|
|
|
|
extends RefCounted
|
|
|
|
|
|
## The inside of a sheet box, by kind (SheetKinds): what the player sees and
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
## changes in Play. This file has the basic kinds and shared helpers; the
|
|
|
|
|
|
## others live in SheetFieldsTrackers, SheetFieldsSmart, SheetFieldsList and
|
|
|
|
|
|
## SheetFieldsNiche. Changes go through SheetEditor.edit_value (typing) or
|
|
|
|
|
|
## set_value (clicks), so they can be undone.
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
|
## Touch targets at least this big (px) while `touch` is on.
|
|
|
|
|
|
const TOUCH := 44.0
|
|
|
|
|
|
|
|
|
|
|
|
## True while the stacked phone view (SheetStackView) builds a box: buttons
|
|
|
|
|
|
## and ticks get touch size (tap_size). Set and cleared around one build.
|
|
|
|
|
|
static var touch := false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## `normal` grown to touch size while `touch` is on.
|
|
|
|
|
|
static func tap_size(normal: Vector2) -> Vector2:
|
|
|
|
|
|
return normal.max(Vector2(TOUCH, TOUCH)) if touch else normal
|
|
|
|
|
|
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
static func make(ed: SheetEditor, box: SheetBox, look: Dictionary) -> Control:
|
|
|
|
|
|
var ink: Color = look["ink"]
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
match box.kind:
|
|
|
|
|
|
SheetKinds.HEADING:
|
|
|
|
|
|
return _heading(box, ink)
|
|
|
|
|
|
SheetKinds.NUMBER:
|
|
|
|
|
|
return _number(ed, box, ink)
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
SheetKinds.SHORT_TEXT:
|
|
|
|
|
|
return _short_text(ed, box, ink)
|
|
|
|
|
|
SheetKinds.CHECKBOX:
|
|
|
|
|
|
return _checkbox(ed, box, ink)
|
|
|
|
|
|
SheetKinds.DROPDOWN:
|
|
|
|
|
|
return _dropdown(ed, box, ink)
|
|
|
|
|
|
SheetKinds.DIVIDER:
|
|
|
|
|
|
return _divider(ink)
|
|
|
|
|
|
SheetKinds.PICTURE:
|
|
|
|
|
|
return _picture(ed, box, look)
|
|
|
|
|
|
SheetKinds.RESOURCE, SheetKinds.TICKS, SheetKinds.CLOCK, SheetKinds.DOTS, SheetKinds.STEP_DIE, SheetKinds.USAGE_DIE, SheetKinds.LADDER:
|
|
|
|
|
|
return SheetFieldsTrackers.make(ed, box, look)
|
|
|
|
|
|
SheetKinds.FORMULA, SheetKinds.DICE:
|
|
|
|
|
|
return SheetFieldsSmart.make(ed, box, look)
|
|
|
|
|
|
SheetKinds.LIST:
|
|
|
|
|
|
return SheetFieldsList.make(ed, box, look)
|
|
|
|
|
|
SheetKinds.SLOTS, SheetKinds.CONDITIONS, SheetKinds.SPELL_SLOTS, SheetKinds.XP, SheetKinds.CURRENCY:
|
|
|
|
|
|
return SheetFieldsNiche.make(ed, box, look)
|
|
|
|
|
|
return _text(ed, box, ink)
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _heading(box: SheetBox, ink: Color) -> Control:
|
|
|
|
|
|
var l := Style.make_label(box.title, Style.display(), 30, ink)
|
|
|
|
|
|
l.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
|
|
|
|
l.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
|
|
|
|
return l
|
|
|
|
|
|
|
|
|
|
|
|
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
static func _divider(ink: Color) -> Control:
|
|
|
|
|
|
var c := Control.new()
|
|
|
|
|
|
c.draw.connect(func() -> void: c.draw_line(Vector2(0, c.size.y / 2.0), Vector2(c.size.x, c.size.y / 2.0), Color(ink, 0.5), 2.0))
|
|
|
|
|
|
return c
|
|
|
|
|
|
|
|
|
|
|
|
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
## A number with − and + beside it; type to set it.
|
|
|
|
|
|
static func _number(ed: SheetEditor, box: SheetBox, ink: Color) -> Control:
|
|
|
|
|
|
var row := HBoxContainer.new()
|
|
|
|
|
|
row.alignment = BoxContainer.ALIGNMENT_CENTER
|
|
|
|
|
|
row.add_theme_constant_override("separation", 4)
|
|
|
|
|
|
var value := LineEdit.new()
|
|
|
|
|
|
value.name = "Value"
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
value.text = SheetValues.show(SheetValues.number(box.value))
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
value.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
value.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
value.custom_minimum_size.x = 24
|
|
|
|
|
|
value.add_theme_constant_override("minimum_character_width", 1)
|
|
|
|
|
|
value.flat = true
|
|
|
|
|
|
value.add_theme_font_override("font", Style.display())
|
|
|
|
|
|
value.add_theme_font_size_override("font_size", 26)
|
|
|
|
|
|
value.add_theme_color_override("font_color", ink)
|
|
|
|
|
|
var commit := func(text: String) -> void:
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
var n: Variant = clamp_number(box, SheetValues.number(parse_number(text, box.value)))
|
|
|
|
|
|
value.text = SheetValues.show(n)
|
|
|
|
|
|
if SheetValues.number(n) != SheetValues.number(box.value):
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
ed.edit_value(box, n)
|
|
|
|
|
|
value.text_submitted.connect(commit)
|
|
|
|
|
|
value.focus_exited.connect(func() -> void: commit.call(value.text))
|
|
|
|
|
|
for step: int in [-1, 1]:
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
var b := step_button("−" if step < 0 else "+", ink)
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
b.name = "Minus" if step < 0 else "Plus"
|
|
|
|
|
|
b.pressed.connect(func() -> void:
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
var n: Variant = clamp_number(box, SheetValues.number(box.value) + step)
|
|
|
|
|
|
value.text = SheetValues.show(n)
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
ed.edit_value(box, n))
|
|
|
|
|
|
row.add_child(b)
|
|
|
|
|
|
if step < 0:
|
|
|
|
|
|
row.add_child(value)
|
|
|
|
|
|
return row
|
|
|
|
|
|
|
|
|
|
|
|
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
## Keeps a number inside the box's min and max settings (when set).
|
|
|
|
|
|
static func clamp_number(box: SheetBox, n: float) -> Variant:
|
|
|
|
|
|
if str(box.config.get("min", "")) != "":
|
|
|
|
|
|
n = maxf(n, SheetValues.number(box.config["min"]))
|
|
|
|
|
|
if str(box.config.get("max", "")) != "":
|
|
|
|
|
|
n = minf(n, SheetValues.number(box.config["max"]))
|
|
|
|
|
|
return int(n) if n == floorf(n) else n
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _short_text(ed: SheetEditor, box: SheetBox, ink: Color) -> Control:
|
|
|
|
|
|
var e := LineEdit.new()
|
|
|
|
|
|
e.name = "Value"
|
|
|
|
|
|
e.text = str(box.value if box.value != null else "")
|
|
|
|
|
|
e.placeholder_text = "Type here"
|
|
|
|
|
|
e.flat = true
|
|
|
|
|
|
e.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
e.add_theme_font_size_override("font_size", 17)
|
|
|
|
|
|
e.add_theme_color_override("font_color", ink)
|
|
|
|
|
|
e.add_theme_color_override("font_placeholder_color", Color(ink, 0.4))
|
|
|
|
|
|
e.text_changed.connect(func(text: String) -> void: ed.edit_value(box, text))
|
|
|
|
|
|
return e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _checkbox(ed: SheetEditor, box: SheetBox, ink: Color) -> Control:
|
|
|
|
|
|
var c := CheckBox.new()
|
|
|
|
|
|
c.name = "Value"
|
|
|
|
|
|
c.text = "Yes" if bool(box.value) else "No"
|
|
|
|
|
|
c.button_pressed = bool(box.value)
|
|
|
|
|
|
for key in ["font_color", "font_hover_color", "font_pressed_color", "font_hover_pressed_color"]:
|
|
|
|
|
|
c.add_theme_color_override(key, ink)
|
|
|
|
|
|
c.toggled.connect(func(on: bool) -> void:
|
|
|
|
|
|
c.text = "Yes" if on else "No"
|
|
|
|
|
|
ed.edit_value(box, on))
|
|
|
|
|
|
return c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _dropdown(ed: SheetEditor, box: SheetBox, ink: Color) -> Control:
|
|
|
|
|
|
var o := OptionButton.new()
|
|
|
|
|
|
o.name = "Value"
|
|
|
|
|
|
var options: Array = box.config.get("options", [])
|
|
|
|
|
|
for i in options.size():
|
|
|
|
|
|
o.add_item(str(options[i]))
|
|
|
|
|
|
if str(options[i]) == str(box.value):
|
|
|
|
|
|
o.select(i)
|
|
|
|
|
|
o.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
o.add_theme_color_override("font_color", ink)
|
|
|
|
|
|
o.item_selected.connect(func(i: int) -> void: ed.edit_value(box, str(options[i])))
|
|
|
|
|
|
return o
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The picture from its file, or a button to pick one (Play).
|
|
|
|
|
|
static func _picture(ed: SheetEditor, box: SheetBox, look: Dictionary) -> Control:
|
|
|
|
|
|
var path := str(box.value if box.value != null else "")
|
|
|
|
|
|
var tex: Texture2D = null
|
|
|
|
|
|
if path != "" and FileAccess.file_exists(path):
|
|
|
|
|
|
var img := Image.load_from_file(path)
|
|
|
|
|
|
if img:
|
|
|
|
|
|
tex = ImageTexture.create_from_image(img)
|
|
|
|
|
|
if tex:
|
|
|
|
|
|
var tr := TextureRect.new()
|
|
|
|
|
|
tr.texture = tex
|
|
|
|
|
|
tr.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
|
|
|
|
tr.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
|
|
|
|
|
tr.tooltip_text = "Double-click to change the picture"
|
|
|
|
|
|
tr.gui_input.connect(func(ev: InputEvent) -> void:
|
|
|
|
|
|
var mb := ev as InputEventMouseButton
|
|
|
|
|
|
if mb and mb.double_click and not ed.building():
|
|
|
|
|
|
pick_picture(ed, box))
|
|
|
|
|
|
return tr
|
|
|
|
|
|
var b := step_button("Choose a picture…", look["ink"])
|
|
|
|
|
|
b.name = "Choose"
|
|
|
|
|
|
b.pressed.connect(pick_picture.bind(ed, box))
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
|
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
static func pick_picture(ed: SheetEditor, box: SheetBox) -> void:
|
|
|
|
|
|
ed.m.layout.file_dialog("Choose a picture", ["*.png, *.jpg, *.jpeg, *.webp ; Pictures"], FileDialog.FILE_MODE_OPEN_FILE, func(path: String) -> void:
|
|
|
|
|
|
var kept := ed.screen.store.keep_picture(path)
|
|
|
|
|
|
if kept == "":
|
|
|
|
|
|
ed.m.toast("Couldn't read that picture")
|
|
|
|
|
|
else:
|
|
|
|
|
|
ed.set_value(box, kept))
|
|
|
|
|
|
|
|
|
|
|
|
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
|
## Long notes: formatted text, edited with a toolbar (SheetTextBox).
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
static func _text(ed: SheetEditor, box: SheetBox, ink: Color) -> Control:
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
|
return SheetTextBox.make(ed, box, ink)
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Live values: {@name} shows the value of the box used in tables as @name.
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
static func expand(ed: SheetEditor, text: String) -> String:
|
2026-11-29 16:52:41 -06:00
|
|
|
|
return ed.m.sheet_links.expand(ed.doc, text)
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
|
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
static func parse_number(text: String, fallback: Variant) -> Variant:
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
var t := text.strip_edges()
|
|
|
|
|
|
if t.is_valid_int():
|
|
|
|
|
|
return t.to_int()
|
|
|
|
|
|
if t.is_valid_float():
|
|
|
|
|
|
return t.to_float()
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
return SheetValues.number(fallback)
|
|
|
|
|
|
|
|
|
|
|
|
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
|
## A small button drawn in the box's own ink colour. Pass `button` to skin another
|
|
|
|
|
|
## kind of button (a MenuButton).
|
|
|
|
|
|
static func step_button(text: String, ink: Color, button: Button = null) -> Button:
|
|
|
|
|
|
if button == null:
|
|
|
|
|
|
button = Button.new()
|
|
|
|
|
|
button.text = text
|
|
|
|
|
|
button.custom_minimum_size = tap_size(Vector2(26, 26))
|
|
|
|
|
|
button.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
button.focus_mode = Control.FOCUS_NONE
|
|
|
|
|
|
button.add_theme_font_override("font", Style.body_bold())
|
|
|
|
|
|
button.add_theme_font_size_override("font_size", 15)
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
var normal := Style.bordered(Style.box(Color(ink, 0.04), 6, [6, 0, 6, 0]), 1, Color(ink, 0.35))
|
|
|
|
|
|
var hover := Style.bordered(Style.box(Color(ink, 0.12), 6, [6, 0, 6, 0]), 1, Color(ink, 0.6))
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
|
Style.skin_button(button, normal, hover, hover, ink, ink, ink)
|
|
|
|
|
|
return button
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
|
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
|
## A muted label in the box's ink.
|
|
|
|
|
|
static func note(text: String, ink: Color, size: int = 13) -> Label:
|
|
|
|
|
|
var l := Style.make_label(text, Style.body(), size, Color(ink, 0.7))
|
|
|
|
|
|
l.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
return l
|