Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
class_name TableCardRows
|
|
|
|
|
|
extends RefCounted
|
|
|
|
|
|
## A TableCard's result rows: building them (plain, check outlet, sheet and the
|
|
|
|
|
|
## collapsed card's "more" row), their Play-mode text and rule chips, and their
|
|
|
|
|
|
## highlight state (normal, flickering during a roll, lit, with the copper bar
|
|
|
|
|
|
## of the inspector's selected result). Build-only controls come from
|
2026-11-14 13:29:57 -06:00
|
|
|
|
## TableCardEditing; the Play text comes from TableCardRowText and the chance
|
|
|
|
|
|
## labels from TableCardOdds.
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
|
|
|
|
|
|
enum RowState { NORMAL, FLICK, LIT }
|
|
|
|
|
|
|
|
|
|
|
|
const LOOP_ROWS := ["Each time", "Afterwards"]
|
|
|
|
|
|
## Longest effects summary shown on a chip.
|
|
|
|
|
|
const CHIP_CHARS := 30
|
|
|
|
|
|
const PLAIN_CHIP_CHARS := 38
|
|
|
|
|
|
|
|
|
|
|
|
var card: TableCard
|
|
|
|
|
|
## entry id -> {num, text, entry, index}, for the rows currently shown.
|
|
|
|
|
|
var parts: Dictionary = {}
|
|
|
|
|
|
var more_label: Label
|
|
|
|
|
|
var sheet_label: RichTextLabel
|
2026-11-10 19:56:07 -06:00
|
|
|
|
var kind_rows: TableCardKindRows
|
UI for cards with columns: header and cells, inspector Columns section, help
- TableCardColumns: the column-name header, each row's cells after its text
(Play: wrapping text; Build: a field per cell, edited inline), cards widen
per column, and in "each" mode the cell each column landed on is lit
(Main.lit_columns, from the rolled node's columns).
- InspectorColumns: Add columns, add/rename/move/remove (cells kept in step),
one roll vs each column, Save as (value picker) and Only if (condition
builder); the result inspector gets a field per extra column.
- Help: a Columns topic after Ranged tables and dice.
- tests/test_ui_columns.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:24:35 -06:00
|
|
|
|
var columns_ui: TableCardColumns
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
|
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
|
|
|
|
## Row styles by state, then +3 for the inspector's selected result, then +6
|
|
|
|
|
|
## for a striped (every second) row.
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
var _row_styles: Array[StyleBoxFlat] = []
|
|
|
|
|
|
var _flick_id := ""
|
2026-11-14 13:29:57 -06:00
|
|
|
|
## Chance labels of ranged rows in Play mode (TableCardOdds).
|
|
|
|
|
|
var odds: TableCardOdds
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _init(p_card: TableCard) -> void:
|
|
|
|
|
|
card = p_card
|
2026-11-10 19:56:07 -06:00
|
|
|
|
kind_rows = TableCardKindRows.new(self)
|
UI for cards with columns: header and cells, inspector Columns section, help
- TableCardColumns: the column-name header, each row's cells after its text
(Play: wrapping text; Build: a field per cell, edited inline), cards widen
per column, and in "each" mode the cell each column landed on is lit
(Main.lit_columns, from the rolled node's columns).
- InspectorColumns: Add columns, add/rename/move/remove (cells kept in step),
one roll vs each column, Save as (value picker) and Only if (condition
builder); the result inspector gets a field per extra column.
- Help: a Columns topic after Ranged tables and dice.
- tests/test_ui_columns.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:24:35 -06:00
|
|
|
|
columns_ui = TableCardColumns.new(p_card)
|
2026-11-14 13:29:57 -06:00
|
|
|
|
odds = TableCardOdds.new(p_card)
|
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
|
|
|
|
# Normal, flicker and lit; then the same with the copper bar of the
|
|
|
|
|
|
# inspector's selected result. Striped rows tint only the normal state, so
|
|
|
|
|
|
# the flicker and the lit result always read over the stripe.
|
|
|
|
|
|
for striped in [false, true]:
|
|
|
|
|
|
for selected in [false, true]:
|
|
|
|
|
|
for c in [Style.STRIPE if striped else Color(0, 0, 0, 0), Style.FLICK, Style.LIT]:
|
|
|
|
|
|
var sb := Style.box(c, 0, [12, 6, 22, 6])
|
|
|
|
|
|
if selected:
|
|
|
|
|
|
sb.border_width_left = 3
|
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
|
|
|
|
sb.border_color = Style.TRIM
|
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
|
|
|
|
sb.anti_aliasing = false
|
|
|
|
|
|
_row_styles.append(sb)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Forgets the previous build's rows.
|
|
|
|
|
|
func clear() -> void:
|
|
|
|
|
|
parts.clear()
|
UI for cards with columns: header and cells, inspector Columns section, help
- TableCardColumns: the column-name header, each row's cells after its text
(Play: wrapping text; Build: a field per cell, edited inline), cards widen
per column, and in "each" mode the cell each column landed on is lit
(Main.lit_columns, from the rolled node's columns).
- InspectorColumns: Add columns, add/rename/move/remove (cells kept in step),
one roll vs each column, Save as (value picker) and Only if (condition
builder); the result inspector gets a field per extra column.
- Help: a Columns topic after Ranged tables and dice.
- tests/test_ui_columns.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:24:35 -06:00
|
|
|
|
columns_ui.clear()
|
2026-11-14 13:29:57 -06:00
|
|
|
|
odds.clear()
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
more_label = null
|
|
|
|
|
|
_flick_id = ""
|
|
|
|
|
|
sheet_label = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func register(e: TableEntry, row: PanelContainer, num: Label, text: RichTextLabel, index: int) -> void:
|
|
|
|
|
|
card.rows[e.id] = row
|
|
|
|
|
|
parts[e.id] = {"num": num, "text": text, "entry": e, "index": index}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _is_pick() -> bool:
|
|
|
|
|
|
return card.table.kind == RollTable.KIND_CHOICE and card.table.choice == "pick"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## True for the Chosen row of a dynamic pick card.
|
|
|
|
|
|
func _is_chosen_row(index: int) -> bool:
|
|
|
|
|
|
return index == 0 and card.table.is_dynamic()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func make_row(e: TableEntry, index: int, build: bool, ranged: bool, numw: float) -> Control:
|
|
|
|
|
|
var table := card.table
|
|
|
|
|
|
var main := card.main
|
|
|
|
|
|
var edit := card.edit_ui
|
|
|
|
|
|
var row := PanelContainer.new()
|
|
|
|
|
|
row.mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
|
|
row.custom_minimum_size = Vector2(0, 36)
|
|
|
|
|
|
var h := TableCard.hbox(8)
|
|
|
|
|
|
row.add_child(h)
|
|
|
|
|
|
# Loop rows and the Answer row of number/text choices are fixed: no number,
|
|
|
|
|
|
# weight or delete.
|
|
|
|
|
|
var fixed := table.kind == RollTable.KIND_LOOP or (table.kind == RollTable.KIND_CHOICE and table.choice != "pick")
|
|
|
|
|
|
var chosen := _is_chosen_row(index)
|
|
|
|
|
|
|
2026-11-11 08:23:25 -06:00
|
|
|
|
if build and not fixed and not chosen and table.entries.size() > 1:
|
|
|
|
|
|
h.add_child(EntryHandle.new(card, e.id))
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
var num: Label = null
|
2026-11-15 12:29:52 -06:00
|
|
|
|
if build and RangeWeights.uses_weights(table):
|
|
|
|
|
|
# Weights: the box sets the share; the range it gives is shown beside it.
|
|
|
|
|
|
var r := TableCard.hbox(6)
|
|
|
|
|
|
r.custom_minimum_size = Vector2(numw, 0)
|
|
|
|
|
|
r.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
r.add_child(edit.weight_edit(e, true))
|
|
|
|
|
|
var span := Style.make_label(table.num_label(e, index) if e.has_range else "—", Style.display(true), 14, Style.MUTED)
|
|
|
|
|
|
span.custom_minimum_size = Vector2(52, 0)
|
|
|
|
|
|
span.mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
|
|
span.tooltip_text = "The range this weight gives, from the row order"
|
|
|
|
|
|
r.add_child(span)
|
|
|
|
|
|
h.add_child(r)
|
|
|
|
|
|
elif build and ranged:
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
var r := TableCard.hbox(2)
|
|
|
|
|
|
r.custom_minimum_size = Vector2(numw, 0)
|
|
|
|
|
|
r.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
r.add_child(edit.range_edit(e, true))
|
|
|
|
|
|
r.add_child(Style.make_label("–", Style.display(true), 15, Style.MUTED))
|
|
|
|
|
|
r.add_child(edit.range_edit(e, false))
|
|
|
|
|
|
h.add_child(r)
|
|
|
|
|
|
else:
|
|
|
|
|
|
var nl := "" if fixed else (str(index + 1) if table.kind == RollTable.KIND_ROUTER else table.num_label(e, index))
|
|
|
|
|
|
if table.is_dynamic() and not ranged:
|
|
|
|
|
|
nl = "★" if chosen else str(index)
|
|
|
|
|
|
num = Style.make_label(nl, Style.display(true), 16, Style.MUTED)
|
|
|
|
|
|
num.custom_minimum_size = Vector2(numw, 0)
|
|
|
|
|
|
num.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
|
|
|
|
|
num.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
if fixed:
|
|
|
|
|
|
num.text = "↻" if table.kind == RollTable.KIND_LOOP and index == 0 else "→"
|
|
|
|
|
|
num.add_theme_font_override("font", Style.body_bold(true))
|
|
|
|
|
|
num.add_theme_font_size_override("font_size", 14)
|
|
|
|
|
|
h.add_child(num)
|
|
|
|
|
|
|
|
|
|
|
|
var text: RichTextLabel = null
|
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 delete_button: Button = null
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
if build:
|
|
|
|
|
|
h.add_theme_constant_override("separation", 4)
|
|
|
|
|
|
var col := TableCard.vbox(2)
|
|
|
|
|
|
col.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
col.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
h.add_child(col)
|
|
|
|
|
|
if table.kind == RollTable.KIND_CHOICE and table.choice != "pick":
|
|
|
|
|
|
var al := Style.make_label("Answer", Style.body_italic(true), 15, Style.MUTED)
|
|
|
|
|
|
al.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
al.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
al.mouse_filter = Control.MOUSE_FILTER_PASS
|
2026-11-10 18:24:23 -06:00
|
|
|
|
al.tooltip_text = "Its effects and threads run after the player answers ({answer} holds the answer)"
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
col.add_child(al)
|
|
|
|
|
|
else:
|
|
|
|
|
|
if chosen:
|
|
|
|
|
|
# A caption over the text field, so the field keeps its width.
|
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 cl := Style.make_label("Chosen · runs for the picked option", Style.body_italic(true), 11, Style.TRIM_DARK)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
cl.mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
|
|
cl.tooltip_text = "Runs for whichever option from %s is picked: option, option_label and option_value hold it" % table.options_from.strip_edges()
|
|
|
|
|
|
col.add_child(cl)
|
|
|
|
|
|
col.add_child(edit.text_edit(e, index, chosen))
|
|
|
|
|
|
add_rule_chips(col, e)
|
UI for cards with columns: header and cells, inspector Columns section, help
- TableCardColumns: the column-name header, each row's cells after its text
(Play: wrapping text; Build: a field per cell, edited inline), cards widen
per column, and in "each" mode the cell each column landed on is lit
(Main.lit_columns, from the rolled node's columns).
- InspectorColumns: Add columns, add/rename/move/remove (cells kept in step),
one roll vs each column, Save as (value picker) and Only if (condition
builder); the result inspector gets a field per extra column.
- Help: a Columns topic after Ranged tables and dice.
- tests/test_ui_columns.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:24:35 -06:00
|
|
|
|
columns_ui.add_cells(h, e, index, true)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
if not ranged and not fixed:
|
|
|
|
|
|
h.add_child(edit.weight_edit(e))
|
|
|
|
|
|
if not fixed and not chosen:
|
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
|
|
|
|
delete_button = TableCardEditing.mini_button("×", "Delete this result", true, func() -> void: main.delete_entry(table.id, e.id))
|
|
|
|
|
|
h.add_child(delete_button)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
edit.hook_select(row, e.id)
|
|
|
|
|
|
else:
|
|
|
|
|
|
var col := TableCard.vbox(3)
|
|
|
|
|
|
col.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
col.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
text = RichText.label(row_text(e), 16, Style.INK, true)
|
|
|
|
|
|
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
RichText.hook_hover(text, main)
|
|
|
|
|
|
col.add_child(text)
|
|
|
|
|
|
add_rule_chips(col, e)
|
|
|
|
|
|
h.add_child(col)
|
UI for cards with columns: header and cells, inspector Columns section, help
- TableCardColumns: the column-name header, each row's cells after its text
(Play: wrapping text; Build: a field per cell, edited inline), cards widen
per column, and in "each" mode the cell each column landed on is lit
(Main.lit_columns, from the rolled node's columns).
- InspectorColumns: Add columns, add/rename/move/remove (cells kept in step),
one roll vs each column, Save as (value picker) and Only if (condition
builder); the result inspector gets a field per extra column.
- Help: a Columns topic after Ranged tables and dice.
- tests/test_ui_columns.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:24:35 -06:00
|
|
|
|
columns_ui.add_cells(h, e, index, false)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
row.mouse_entered.connect(func() -> void: main.details().show_entry(row, table.id, e.id))
|
|
|
|
|
|
if ranged and table.has_chances():
|
2026-11-09 10:01:10 -06:00
|
|
|
|
var pct := Style.make_label("", Style.body(true), 12, Style.MUTED)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
pct.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
2026-11-09 10:01:10 -06:00
|
|
|
|
pct.mouse_filter = Control.MOUSE_FILTER_PASS
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
h.add_child(pct)
|
2026-11-14 13:29:57 -06:00
|
|
|
|
odds.track(pct, e)
|
2026-11-09 10:01:10 -06:00
|
|
|
|
if ranged and table.has_mod() and num != null and not RollRange.natural_reach(table, e):
|
|
|
|
|
|
var nat := RollRange.natural(table)
|
|
|
|
|
|
num.tooltip_text = "Only a modifier reaches this: the dice alone roll %s–%s" % [table.fmt(nat.x), table.fmt(nat.y)]
|
|
|
|
|
|
num.mouse_filter = Control.MOUSE_FILTER_PASS
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
|
Pictures on results and Book pages; export/import keeps everything new
A result or page can have a picture (TableEntry.image, BookPage.image),
chosen from a file, shrunk to 512 px and kept in the spread file as WebP
under "images" (BoardImages; only used pictures are saved). It shows as
a thumbnail on the card row and in the details pop-up, and comes with a
page. Imported BBCode still can't point at files.
Fix: the Table Tarot JSON export and import (JsonIO.canonical) dropped
every key it didn't know, losing the Book, pictures, card colours and
sizes, limits, nesting, costs and thread options. They now pass through;
a round-trip test covers them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:21:05 -06:00
|
|
|
|
if e.image != "":
|
|
|
|
|
|
var pic := TextureRect.new()
|
|
|
|
|
|
pic.texture = main.data.picture(e.image)
|
|
|
|
|
|
pic.custom_minimum_size = Vector2(30, 30)
|
|
|
|
|
|
pic.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
|
|
|
|
pic.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
|
|
|
|
|
pic.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
pic.mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
|
|
h.add_child(pic)
|
2026-11-10 19:02:46 -06:00
|
|
|
|
if e.page != "":
|
|
|
|
|
|
# A small § says the result follows a Book page.
|
|
|
|
|
|
var pg := main.data.get_page(e.page)
|
|
|
|
|
|
var mark := Style.make_label("§", Style.body_bold(true), 13, Style.TRIM)
|
|
|
|
|
|
mark.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
mark.mouse_filter = Control.MOUSE_FILTER_PASS
|
2026-11-15 12:46:05 -06:00
|
|
|
|
mark.tooltip_text = "Lore Entry: %s" % (pg.label() if pg else "a deleted Lore Entry")
|
2026-11-10 19:02:46 -06:00
|
|
|
|
h.add_child(mark)
|
|
|
|
|
|
h.move_child(mark, mini(1, h.get_child_count() - 1))
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
register(e, row, num, text, index)
|
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
|
|
|
|
if delete_button:
|
|
|
|
|
|
edit.reveal_on_hover(e.id, row, delete_button)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
return row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The plain chips under a row's text: a pick option's "only if …" and the
|
|
|
|
|
|
## entry's effects ("Luck −1"). Used in Play and Build alike.
|
|
|
|
|
|
func add_rule_chips(col: VBoxContainer, e: TableEntry) -> void:
|
|
|
|
|
|
var plain := card.plain
|
2026-11-14 14:02:29 -06:00
|
|
|
|
if (_is_pick() or card.table.kind == RollTable.KIND_ROLL) and e.show_if.strip_edges() != "":
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
var bad := Expr.check(TemplateKit.probe(e.show_if.strip_edges())) != ""
|
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 si := Style.make_label(RulesView.show_if_line(e, card.main.data, plain), Style.body_bold(true), 12, Style.DANGER_INK if bad else Style.TRIM_DARK)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
si.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
si.mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
|
|
si.tooltip_text = ("only if " + e.show_if.strip_edges()) if plain else ""
|
|
|
|
|
|
si.set_meta("show_if_line", true)
|
|
|
|
|
|
col.add_child(si)
|
|
|
|
|
|
if e.effects.strip_edges() != "":
|
2026-11-10 19:56:07 -06:00
|
|
|
|
col.add_child(kind_rows.effects_chip(e))
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
2026-11-14 13:29:57 -06:00
|
|
|
|
## Play-mode text of a row (TableCardRowText): the rolled text when lit,
|
|
|
|
|
|
## otherwise the entry as written, with a lead-in for some card kinds.
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
func row_text(e: TableEntry) -> String:
|
2026-11-14 13:29:57 -06:00
|
|
|
|
return TableCardRowText.text_for(self, e)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
2026-11-09 10:01:10 -06:00
|
|
|
|
## The roll modifier's value now (RollRange.live_mod): {"known", "value"}.
|
|
|
|
|
|
func live_mod() -> Dictionary:
|
2026-11-14 13:29:57 -06:00
|
|
|
|
return odds.live_mod()
|
2026-11-09 10:01:10 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Updates the chance labels for the modifier's current value.
|
|
|
|
|
|
func refresh_odds() -> void:
|
2026-11-14 13:29:57 -06:00
|
|
|
|
odds.refresh()
|
2026-11-09 10:01:10 -06:00
|
|
|
|
|
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
## Re-renders a sheet card's template from the current variables.
|
|
|
|
|
|
func refresh_sheet() -> void:
|
|
|
|
|
|
if is_instance_valid(sheet_label):
|
|
|
|
|
|
var main := card.main
|
|
|
|
|
|
var s := RichText.decorate(Roller.render_sheet(main.data, main.persistent_vars, card.table))
|
|
|
|
|
|
if sheet_label.text != s:
|
|
|
|
|
|
sheet_label.text = s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func make_more_row(numw: float) -> PanelContainer:
|
|
|
|
|
|
var more_row := PanelContainer.new()
|
|
|
|
|
|
var normal := Style.box(Color(0, 0, 0, 0), 0, [12, 6, 22, 6])
|
|
|
|
|
|
var hover := Style.box(Style.HOVER_ROW, 0, [12, 6, 22, 6])
|
|
|
|
|
|
more_row.add_theme_stylebox_override("panel", normal)
|
|
|
|
|
|
more_row.custom_minimum_size = Vector2(0, 36)
|
|
|
|
|
|
more_row.mouse_filter = Control.MOUSE_FILTER_STOP
|
|
|
|
|
|
more_row.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
|
|
|
|
more_row.tooltip_text = "Show every result"
|
|
|
|
|
|
more_row.mouse_entered.connect(func() -> void: more_row.add_theme_stylebox_override("panel", hover))
|
|
|
|
|
|
more_row.mouse_exited.connect(func() -> void: more_row.add_theme_stylebox_override("panel", normal))
|
|
|
|
|
|
more_row.gui_input.connect(func(ev: InputEvent) -> void:
|
|
|
|
|
|
var mb := ev as InputEventMouseButton
|
|
|
|
|
|
if mb and mb.button_index == MOUSE_BUTTON_LEFT and not mb.pressed:
|
|
|
|
|
|
card.main.toggle_collapse.call_deferred(card.table.id)
|
|
|
|
|
|
)
|
|
|
|
|
|
var h := TableCard.hbox(8)
|
|
|
|
|
|
more_row.add_child(h)
|
|
|
|
|
|
var dots := Style.make_label("…", Style.display(true), 16, Style.MUTED)
|
|
|
|
|
|
dots.custom_minimum_size = Vector2(numw, 0)
|
|
|
|
|
|
dots.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
|
|
|
|
|
h.add_child(dots)
|
|
|
|
|
|
more_label = Style.make_label(more_text(), Style.body_italic(true), 14, Style.MUTED)
|
|
|
|
|
|
more_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
more_label.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
h.add_child(more_label)
|
|
|
|
|
|
return more_row
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-14 14:36:54 -06:00
|
|
|
|
## Under an opened long list: "▲ Show less", which collapses the card again.
|
|
|
|
|
|
func make_less_row() -> Button:
|
|
|
|
|
|
var less := TableCardEditing.footer_button("▲ Show less", Style.MUTED)
|
|
|
|
|
|
less.tooltip_text = "Collapse this card to its rolled result"
|
|
|
|
|
|
less.set_meta("show_less", true)
|
|
|
|
|
|
less.pressed.connect(func() -> void: card.main.toggle_collapse.call_deferred(card.table.id))
|
|
|
|
|
|
return less
|
|
|
|
|
|
|
|
|
|
|
|
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
func more_text() -> String:
|
|
|
|
|
|
var table := card.table
|
|
|
|
|
|
var hidden := table.entries.size() - card.rows.size()
|
|
|
|
|
|
if card.rows.size() > 0:
|
|
|
|
|
|
return "%d more · show all" % hidden
|
|
|
|
|
|
return "%d %s · show all" % [table.entries.size(), "ranges" if table.is_ranged() else "results"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- State ----------
|
|
|
|
|
|
|
|
|
|
|
|
func set_row_state(eid: String, state: RowState) -> void:
|
|
|
|
|
|
if not card.rows.has(eid):
|
|
|
|
|
|
return
|
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 p: Dictionary = parts[eid]
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
var k := int(state) + (3 if eid == card.selected_entry() else 0)
|
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
|
|
|
|
if int(p["index"]) % 2 == 1 and card.main.local_state.striped_rows():
|
|
|
|
|
|
k += 6
|
2026-11-14 13:47:03 -06:00
|
|
|
|
# Restyling a row makes its text be measured again, which is slow on big
|
|
|
|
|
|
# spreads, so a row that already looks this way is left alone.
|
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
|
|
|
|
card.edit_ui.sync_delete(eid)
|
2026-11-14 13:47:03 -06:00
|
|
|
|
if int(p.get("applied_style", -1)) == k:
|
|
|
|
|
|
return
|
|
|
|
|
|
p["applied_style"] = k
|
|
|
|
|
|
(card.rows[eid] as PanelContainer).add_theme_stylebox_override("panel", _row_styles[k])
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
var num: Label = p["num"]
|
|
|
|
|
|
if num:
|
|
|
|
|
|
num.add_theme_color_override("font_color", Style.INK if state == RowState.LIT else Style.MUTED)
|
|
|
|
|
|
var text: RichTextLabel = p["text"]
|
|
|
|
|
|
if text:
|
|
|
|
|
|
RichText.set_fonts(text, 16, true, state == RowState.LIT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Sets a row lit or normal, from whether its result is lit now.
|
|
|
|
|
|
func restate(eid: String) -> void:
|
|
|
|
|
|
set_row_state(eid, RowState.LIT if card.main.is_entry_lit(card.table.id, eid) else RowState.NORMAL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Re-renders a Play-mode row's text (it shows the rolled text while lit).
|
|
|
|
|
|
func update_row_text(eid: String) -> void:
|
|
|
|
|
|
var p: Dictionary = parts.get(eid, {})
|
|
|
|
|
|
var text: RichTextLabel = p.get("text")
|
|
|
|
|
|
if text:
|
|
|
|
|
|
var want := row_text(p["entry"])
|
|
|
|
|
|
if text.text != want:
|
|
|
|
|
|
text.text = want
|
UI for cards with columns: header and cells, inspector Columns section, help
- TableCardColumns: the column-name header, each row's cells after its text
(Play: wrapping text; Build: a field per cell, edited inline), cards widen
per column, and in "each" mode the cell each column landed on is lit
(Main.lit_columns, from the rolled node's columns).
- InspectorColumns: Add columns, add/rename/move/remove (cells kept in step),
one roll vs each column, Save as (value picker) and Only if (condition
builder); the result inspector gets a field per extra column.
- Help: a Columns topic after Ranged tables and dice.
- tests/test_ui_columns.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:24:35 -06:00
|
|
|
|
columns_ui.refresh(eid)
|
Split TableCard into header, rows, editing, value-body and text helpers
ui/table_card.gd keeps the card node (setup, rebuild, styling, selection,
highlights API, geometry, drag input) and delegates to RefCounted helpers
that own their own state: TableCardHeader, TableCardRows, TableCardEditing,
TableCardValue, plus static TableCardText. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:10:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func flick_random() -> void:
|
|
|
|
|
|
clear_flick()
|
|
|
|
|
|
if card.rows.is_empty():
|
|
|
|
|
|
return
|
|
|
|
|
|
var keys := card.rows.keys()
|
|
|
|
|
|
_flick_id = keys[card.main.rng.randi_range(0, keys.size() - 1)]
|
|
|
|
|
|
set_row_state(_flick_id, RowState.FLICK)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func clear_flick() -> void:
|
|
|
|
|
|
if _flick_id != "":
|
|
|
|
|
|
restate(_flick_id)
|
|
|
|
|
|
_flick_id = ""
|
2026-11-10 19:56:07 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Check outlets and sheet rows live in TableCardKindRows.
|
|
|
|
|
|
func make_check_row(e: TableEntry, index: int, build: bool, numw: float) -> Control:
|
|
|
|
|
|
return kind_rows.make_check_row(e, index, build, numw)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func make_sheet_row(e: TableEntry, build: bool) -> Control:
|
|
|
|
|
|
return kind_rows.make_sheet_row(e, build)
|