UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
class_name HelpDialog
|
|
|
|
|
extends ModalCard
|
|
|
|
|
## The Help window: topics down the left, the chosen topic on the right.
|
|
|
|
|
##
|
|
|
|
|
## The text lives in res://help/topics.txt, written in a small markup:
|
|
|
|
|
## # Title starts a topic
|
|
|
|
|
## ## Heading a heading inside a topic
|
|
|
|
|
## - item a bullet
|
|
|
|
|
## `code` rule text, shown as typed (brackets are safe inside)
|
|
|
|
|
## [topic]Title[/topic] a link to another topic
|
|
|
|
|
## Everything else is BBCode ([b], [i]) and blank lines split paragraphs.
|
|
|
|
|
|
Help: topics for every new feature, a cheat sheet, and Try a demo spreads
Twelve new Help topics (menus, selecting and resizing, nested groups,
themes, List view, the Book, rolling more than once, pausing, costs,
one table adjusting another, sheets and saving, pictures, phones), and a
Keyboard shortcuts topic split into keys, mouse and touch. Topics with
[demo]key[/demo] get a 'Try a demo spread' link: DemoSpreads builds a
small example, DemoMode shows it unsaved and unlisted with Keep a copy
and Back to my spread. --demo=KEY opens one from the command line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:24:57 -06:00
|
|
|
## A topic's "Try a demo spread" link was clicked (key for DemoSpreads).
|
|
|
|
|
signal demo_requested(key: String)
|
|
|
|
|
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
const PATH := "res://help/topics.txt"
|
|
|
|
|
const LINK_COLOR := "#4f2b12"
|
|
|
|
|
const CODE_COLOR := "#8a4a1c"
|
|
|
|
|
|
|
|
|
|
static var _cache: Array = []
|
|
|
|
|
|
|
|
|
|
var current := ""
|
|
|
|
|
var text: RichTextLabel
|
|
|
|
|
var _buttons: Dictionary = {} # title -> Button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _init(start: String = "") -> void:
|
|
|
|
|
super._init("Help", 920.0)
|
|
|
|
|
var row := HBoxContainer.new()
|
|
|
|
|
row.add_theme_constant_override("separation", 24)
|
|
|
|
|
body.add_child(row)
|
|
|
|
|
var list := VBoxContainer.new()
|
|
|
|
|
list.add_theme_constant_override("separation", 2)
|
|
|
|
|
list.custom_minimum_size.x = 220
|
|
|
|
|
row.add_child(list)
|
|
|
|
|
var group := ButtonGroup.new()
|
|
|
|
|
for t: Dictionary in topics():
|
|
|
|
|
var b := _topic_button(str(t["title"]), group)
|
|
|
|
|
list.add_child(b)
|
|
|
|
|
_buttons[t["title"]] = b
|
|
|
|
|
text = RichTextLabel.new()
|
Formatting: right-click Format menu in text fields, more toolbar buttons, sparkle/shimmer/flash
Every text field's right-click menu gains Format: Bold, Italic, Underline,
Strike-through, Colour, Size and Effect (Godot's wave, tornado, shake,
rainbow, pulse, fade plus the app's own sparkle, shimmer and flash, drawn
by RichTextEffects in ui/text_effects). The details toolbar adds U, S and
Effect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 14:32:46 -06:00
|
|
|
RichText.install_effects(text)
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
text.bbcode_enabled = true
|
|
|
|
|
text.fit_content = true
|
|
|
|
|
text.selection_enabled = true
|
|
|
|
|
text.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
text.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
text.add_theme_constant_override("line_separation", 3)
|
|
|
|
|
text.meta_clicked.connect(_on_meta)
|
|
|
|
|
row.add_child(text)
|
|
|
|
|
add_button("Close", "primary", close)
|
|
|
|
|
show_topic(start)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Every topic, in file order: [{title, body}] with the body already turned
|
|
|
|
|
## into BBCode. Read once and cached.
|
|
|
|
|
static func topics() -> Array:
|
|
|
|
|
if _cache.is_empty():
|
|
|
|
|
_cache = parse(FileAccess.get_file_as_string(PATH))
|
|
|
|
|
if _cache.is_empty():
|
|
|
|
|
_cache = [{"title": "Help", "body": "The help text is missing (%s)." % PATH}]
|
|
|
|
|
return _cache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func titles() -> Array[String]:
|
|
|
|
|
var out: Array[String] = []
|
|
|
|
|
for t: Dictionary in topics():
|
|
|
|
|
out.append(str(t["title"]))
|
|
|
|
|
return out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func parse(source: String) -> Array:
|
|
|
|
|
var out: Array = []
|
|
|
|
|
var cur: Dictionary = {}
|
|
|
|
|
for line in source.split("\n"):
|
|
|
|
|
if line.begins_with("# "):
|
|
|
|
|
cur = {"title": line.substr(2).strip_edges(), "body": ""}
|
|
|
|
|
out.append(cur)
|
|
|
|
|
elif not cur.is_empty():
|
|
|
|
|
cur["body"] += _line(line) + "\n"
|
|
|
|
|
for t: Dictionary in out:
|
|
|
|
|
t["body"] = str(t["body"]).strip_edges()
|
|
|
|
|
return out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _line(line: String) -> String:
|
|
|
|
|
if line.begins_with("## "):
|
|
|
|
|
return "[font_size=19][b]%s[/b][/font_size]" % _inline(line.substr(3).strip_edges())
|
|
|
|
|
if line.begins_with("- "):
|
|
|
|
|
return "[indent]• %s[/indent]" % _inline(line.substr(2))
|
|
|
|
|
return _inline(line)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## `code` spans (brackets escaped) and [topic] links.
|
|
|
|
|
static func _inline(s: String) -> String:
|
|
|
|
|
var out := ""
|
|
|
|
|
var parts := s.split("`")
|
|
|
|
|
for i in parts.size():
|
|
|
|
|
if i % 2 == 1:
|
|
|
|
|
var code := ""
|
|
|
|
|
for ch in parts[i]:
|
|
|
|
|
code += "[lb]" if ch == "[" else ("[rb]" if ch == "]" else ch)
|
|
|
|
|
out += "[color=%s][b]%s[/b][/color]" % [CODE_COLOR, code]
|
|
|
|
|
else:
|
|
|
|
|
out += parts[i]
|
Help: topics for every new feature, a cheat sheet, and Try a demo spreads
Twelve new Help topics (menus, selecting and resizing, nested groups,
themes, List view, the Book, rolling more than once, pausing, costs,
one table adjusting another, sheets and saving, pictures, phones), and a
Keyboard shortcuts topic split into keys, mouse and touch. Topics with
[demo]key[/demo] get a 'Try a demo spread' link: DemoSpreads builds a
small example, DemoMode shows it unsaved and unlisted with Keep a copy
and Back to my spread. --demo=KEY opens one from the command line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:24:57 -06:00
|
|
|
var dre := RegEx.create_from_string("\\[demo\\]([a-z_]+)\\[/demo\\]")
|
|
|
|
|
out = dre.sub(out, "[url=demo:$1][color=%s][b]▶ Try a demo spread[/b][/color][/url]" % LINK_COLOR, true)
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
var re := RegEx.create_from_string("\\[topic\\](.+?)\\[/topic\\]")
|
|
|
|
|
return re.sub(out, "[url=topic:$1][color=%s][u]$1[/u][/color][/url]" % LINK_COLOR, true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func show_topic(title: String) -> void:
|
|
|
|
|
var all := topics()
|
|
|
|
|
var found: Dictionary = all[0]
|
|
|
|
|
for t: Dictionary in all:
|
|
|
|
|
if str(t["title"]).to_lower() == title.to_lower():
|
|
|
|
|
found = t
|
|
|
|
|
current = str(found["title"])
|
|
|
|
|
title_label.text = current
|
|
|
|
|
text.text = str(found["body"])
|
|
|
|
|
if _buttons.has(current):
|
|
|
|
|
(_buttons[current] as Button).set_pressed_no_signal(true)
|
|
|
|
|
_scroll.scroll_vertical = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_meta(meta: Variant) -> void:
|
|
|
|
|
var s := str(meta)
|
|
|
|
|
if s.begins_with("topic:"):
|
|
|
|
|
show_topic(s.substr(6))
|
Help: topics for every new feature, a cheat sheet, and Try a demo spreads
Twelve new Help topics (menus, selecting and resizing, nested groups,
themes, List view, the Book, rolling more than once, pausing, costs,
one table adjusting another, sheets and saving, pictures, phones), and a
Keyboard shortcuts topic split into keys, mouse and touch. Topics with
[demo]key[/demo] get a 'Try a demo spread' link: DemoSpreads builds a
small example, DemoMode shows it unsaved and unlisted with Keep a copy
and Back to my spread. --demo=KEY opens one from the command line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:24:57 -06:00
|
|
|
elif s.begins_with("demo:"):
|
|
|
|
|
close()
|
|
|
|
|
demo_requested.emit(s.substr(5))
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## The window keeps one height while you move between topics.
|
|
|
|
|
func _fit() -> void:
|
|
|
|
|
card.custom_minimum_size.x = minf(_width, maxf(240.0, size.x - 32.0))
|
|
|
|
|
_scroll.custom_minimum_size.y = clampf(size.y - 200.0, 160.0, 640.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _topic_button(title: String, group: ButtonGroup) -> Button:
|
|
|
|
|
var b := Button.new()
|
|
|
|
|
b.text = title
|
|
|
|
|
b.toggle_mode = true
|
|
|
|
|
b.button_group = group
|
|
|
|
|
b.alignment = HORIZONTAL_ALIGNMENT_LEFT
|
|
|
|
|
b.add_theme_font_size_override("font_size", 15)
|
|
|
|
|
var m := [10, 5, 10, 5]
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
var on := Style.box(Color(Style.ACCENT, 0.3), 6, m)
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
Style.skin_button(b, Style.box(Color(0, 0, 0, 0), 6, m), Style.box(Style.HOVER_ROW, 6, m), on, Style.INK)
|
|
|
|
|
b.add_theme_stylebox_override("hover_pressed", on)
|
|
|
|
|
b.pressed.connect(func() -> void: show_topic(title))
|
|
|
|
|
return b
|