Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
class_name GroupCard
|
|
|
|
|
extends MarginContainer
|
|
|
|
|
## A group on the board (see TableGroup). Expanded, it's a frame a little
|
|
|
|
|
## darker than the felt, drawn behind its member cards, with a title bar
|
|
|
|
|
## (chevron, name, member count, details pop-up; in Build a ⋯ menu). Dragging
|
|
|
|
|
## the title bar moves the group and its members.
|
|
|
|
|
##
|
|
|
|
|
## Collapsed, the members are hidden and the group shows as one compact card
|
|
|
|
|
## (drawn as a little stack) with its name, "N cards" and the last rolled
|
|
|
|
|
## results of any lit members. Pipes into members then attach to its inlet, and
|
|
|
|
|
## pipes out of members leave from its right edge (PipeLayer asks anchor_for).
|
|
|
|
|
##
|
|
|
|
|
## Main keeps expanded groups in BoardView.groups (behind the pipes) and
|
|
|
|
|
## collapsed ones in BoardView.cards, with the table cards.
|
|
|
|
|
|
|
|
|
|
const INLET_Y := 30.0
|
|
|
|
|
## Most lit results a collapsed group lists.
|
|
|
|
|
const MAX_LIT := 6
|
|
|
|
|
const MENU_DETAILS := 0
|
|
|
|
|
const MENU_TEMPLATE := 1
|
|
|
|
|
const MENU_UNGROUP := 2
|
|
|
|
|
const MENU_DELETE := 3
|
|
|
|
|
const MENU_TOGGLE := 4
|
|
|
|
|
|
|
|
|
|
var main: Main
|
|
|
|
|
var group: TableGroup
|
|
|
|
|
## "tid:eid" -> row, for the lit results a collapsed group lists.
|
|
|
|
|
var lit_rows: Dictionary = {}
|
2026-11-08 17:08:22 -06:00
|
|
|
## The Build-mode ⋯ menu, or null.
|
|
|
|
|
var menu_button: MenuButton
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
|
|
|
|
|
var _card: PanelContainer
|
|
|
|
|
var _header: Control
|
|
|
|
|
var _lit_keys: Array = []
|
|
|
|
|
var _rolling := false
|
|
|
|
|
var _drop := false
|
|
|
|
|
var _dragging := false
|
|
|
|
|
var _drag_last := Vector2.ZERO
|
|
|
|
|
var _frame_box: StyleBoxFlat
|
|
|
|
|
var _frame_drop: StyleBoxFlat
|
|
|
|
|
var _band_box: StyleBoxFlat
|
|
|
|
|
var _stack_box: StyleBoxFlat
|
|
|
|
|
var _card_box: StyleBoxFlat
|
|
|
|
|
var _card_rolling: StyleBoxFlat
|
2026-11-10 18:30:13 -06:00
|
|
|
var _card_selected: StyleBoxFlat
|
|
|
|
|
## In the Build selection (MainSelection).
|
|
|
|
|
var _selected := false
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func setup(p_main: Main, p_group: TableGroup) -> void:
|
|
|
|
|
main = p_main
|
|
|
|
|
group = p_group
|
|
|
|
|
mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
theme = Style.card_theme()
|
|
|
|
|
_frame_box = Style.box(Color(0, 0, 0, 0.16), 16)
|
|
|
|
|
Style.bordered(_frame_box, 1, Color(1, 1, 1, 0.08))
|
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
|
|
|
_frame_drop = Style.box(Color(Style.ACCENT, 0.08), 16)
|
|
|
|
|
Style.bordered(_frame_drop, 2, Style.ACCENT)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_band_box = Style.box(Color(0, 0, 0, 0.16), 0)
|
|
|
|
|
_band_box.corner_radius_top_left = 16
|
|
|
|
|
_band_box.corner_radius_top_right = 16
|
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
|
|
|
_stack_box = Style.bordered(Style.box(Style.CARD_SHADE, 10), 1, Color(0, 0, 0, 0.12))
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_card_box = Style.box(Style.CARD, 10)
|
|
|
|
|
_card_box.shadow_color = Color(0, 0, 0, 0.32)
|
|
|
|
|
_card_box.shadow_size = 16
|
|
|
|
|
_card_box.shadow_offset = Vector2(0, 8)
|
|
|
|
|
_card_rolling = _card_box.duplicate() as StyleBoxFlat
|
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
|
|
|
Style.bordered(_card_rolling, 3, Style.ACCENT)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_card_rolling.set_expand_margin_all(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
|
|
|
_card_rolling.shadow_color = Color(Style.ACCENT, 0.45)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_card_rolling.shadow_size = 26
|
|
|
|
|
_card_rolling.shadow_offset = Vector2.ZERO
|
2026-11-10 18:30:13 -06:00
|
|
|
_card_selected = _card_box.duplicate() as StyleBoxFlat
|
|
|
|
|
Style.bordered(_card_selected, 3, Style.TRIM)
|
|
|
|
|
_card_selected.set_expand_margin_all(4)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
minimum_size_changed.connect(func() -> void: _shrink.call_deferred())
|
|
|
|
|
rebuild()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func rebuild() -> void:
|
|
|
|
|
for c in get_children():
|
|
|
|
|
remove_child(c)
|
|
|
|
|
c.queue_free()
|
|
|
|
|
lit_rows.clear()
|
2026-11-08 17:08:22 -06:00
|
|
|
menu_button = null
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_card = null
|
|
|
|
|
_header = null
|
|
|
|
|
position = group.position
|
|
|
|
|
if group.collapsed:
|
|
|
|
|
_lit_keys = main.lit_keys_for_group(group)
|
|
|
|
|
_build_compact()
|
|
|
|
|
else:
|
|
|
|
|
_lit_keys = []
|
|
|
|
|
_build_frame()
|
|
|
|
|
queue_redraw()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Follows the model's rect after the board refits the frame.
|
|
|
|
|
func sync_rect() -> void:
|
|
|
|
|
position = group.position
|
|
|
|
|
if not group.collapsed:
|
|
|
|
|
custom_minimum_size = group.size
|
|
|
|
|
size = group.size
|
|
|
|
|
queue_redraw()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _shrink() -> void:
|
|
|
|
|
if group == null:
|
|
|
|
|
return
|
|
|
|
|
if group.collapsed:
|
|
|
|
|
size = Vector2(card_width(), 0)
|
|
|
|
|
else:
|
|
|
|
|
size = group.size
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func card_width() -> float:
|
|
|
|
|
return TableCard.BUILD_WIDTH if main.mode == Main.Mode.BUILD else TableCard.WIDTH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _draw() -> void:
|
|
|
|
|
if group == null:
|
|
|
|
|
return
|
|
|
|
|
if group.collapsed:
|
|
|
|
|
# Two card edges peeking out behind: a stack of cards.
|
|
|
|
|
for k in [2, 1]:
|
|
|
|
|
var off := Vector2(5.0 * k, 5.0 * k)
|
|
|
|
|
draw_style_box(_stack_box, Rect2(off, size))
|
|
|
|
|
return
|
|
|
|
|
var r := Rect2(Vector2.ZERO, size)
|
2026-11-10 18:30:13 -06:00
|
|
|
draw_style_box(_frame_drop if _drop or _selected else _frame_box, r)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
draw_style_box(_band_box, Rect2(0, 0, size.x, TableGroup.TITLE_H))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Expanded frame ----------
|
|
|
|
|
|
|
|
|
|
func _build_frame() -> void:
|
|
|
|
|
custom_minimum_size = group.size
|
|
|
|
|
size = group.size
|
|
|
|
|
var col := VBoxContainer.new()
|
|
|
|
|
col.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
col.add_theme_constant_override("separation", 0)
|
|
|
|
|
add_child(col)
|
|
|
|
|
var bar := PanelContainer.new()
|
|
|
|
|
bar.add_theme_stylebox_override("panel", Style.box(Color(0, 0, 0, 0), 0, [10, 0, 10, 0]))
|
|
|
|
|
bar.custom_minimum_size = Vector2(0, TableGroup.TITLE_H)
|
|
|
|
|
bar.mouse_filter = MOUSE_FILTER_STOP
|
|
|
|
|
bar.mouse_default_cursor_shape = CURSOR_MOVE
|
|
|
|
|
bar.gui_input.connect(_on_title_input.bind(bar))
|
|
|
|
|
bar.mouse_entered.connect(_show_details.bind(bar))
|
|
|
|
|
col.add_child(bar)
|
|
|
|
|
_header = bar
|
2026-11-09 08:21:26 -06:00
|
|
|
var h := TableCard.hbox(8)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
h.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
bar.add_child(h)
|
|
|
|
|
var chevron := ChevronButton.new()
|
|
|
|
|
chevron.use_felt_colors()
|
|
|
|
|
chevron.open = true
|
|
|
|
|
chevron.tooltip_text = "Collapse %s into one card" % Formatter.strip_tags(group.name)
|
|
|
|
|
chevron.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
chevron.pressed.connect(func() -> void: main.toggle_group(group.id))
|
|
|
|
|
h.add_child(chevron)
|
|
|
|
|
var build := main.mode == Main.Mode.BUILD
|
|
|
|
|
if build:
|
|
|
|
|
h.add_child(_name_edit(true))
|
|
|
|
|
else:
|
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 title := Style.make_label(Formatter.strip_tags(group.name), Style.display(true), 20, Style.ON_BG)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
title.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
title.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
title.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
|
|
|
title.custom_minimum_size = Vector2(30, 0)
|
|
|
|
|
title.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
h.add_child(title)
|
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 count := Style.make_label(count_text(), Style.body(true), 13, Style.ON_BG_MUTED)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
count.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
count.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
if group.details.strip_edges() != "":
|
|
|
|
|
count.text += " " + RichText.INFO_MARK
|
|
|
|
|
h.add_child(count)
|
|
|
|
|
if build:
|
|
|
|
|
h.add_child(_menu_button(true))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func count_text() -> String:
|
|
|
|
|
var n := group.members.size()
|
|
|
|
|
return "%d %s" % [n, "card" if n == 1 else "cards"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func set_drop_target(on: bool) -> void:
|
|
|
|
|
if _drop != on:
|
|
|
|
|
_drop = on
|
|
|
|
|
queue_redraw()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Collapsed card ----------
|
|
|
|
|
|
|
|
|
|
func _build_compact() -> void:
|
|
|
|
|
custom_minimum_size = Vector2(card_width(), 0)
|
|
|
|
|
_shrink.call_deferred()
|
|
|
|
|
_card = PanelContainer.new()
|
|
|
|
|
_card.mouse_filter = MOUSE_FILTER_STOP
|
2026-11-10 18:30:13 -06:00
|
|
|
_card.add_theme_stylebox_override("panel", _card_style())
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_card.gui_input.connect(func(ev: InputEvent) -> void:
|
|
|
|
|
# Clicks on the card body shouldn't pan the board.
|
|
|
|
|
var mb := ev as InputEventMouseButton
|
|
|
|
|
if mb and mb.button_index == MOUSE_BUTTON_LEFT:
|
|
|
|
|
_card.accept_event()
|
|
|
|
|
)
|
|
|
|
|
add_child(_card)
|
2026-11-09 08:21:26 -06:00
|
|
|
var col := TableCard.vbox(0)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_card.add_child(col)
|
|
|
|
|
|
|
|
|
|
var header := PanelContainer.new()
|
|
|
|
|
var hs := Style.box(Color(0, 0, 0, 0), 0, [12, 10, 10, 9])
|
|
|
|
|
hs.border_width_bottom = 1
|
|
|
|
|
hs.border_color = Style.RULE
|
|
|
|
|
header.add_theme_stylebox_override("panel", hs)
|
|
|
|
|
header.mouse_filter = MOUSE_FILTER_STOP
|
|
|
|
|
header.mouse_default_cursor_shape = CURSOR_MOVE
|
|
|
|
|
header.gui_input.connect(_on_title_input.bind(header))
|
|
|
|
|
header.mouse_entered.connect(_show_details.bind(header))
|
|
|
|
|
col.add_child(header)
|
|
|
|
|
_header = header
|
2026-11-09 08:21:26 -06:00
|
|
|
var row := TableCard.hbox(8)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
header.add_child(row)
|
|
|
|
|
var chevron := ChevronButton.new()
|
|
|
|
|
chevron.open = false
|
|
|
|
|
chevron.tooltip_text = "Expand %s" % Formatter.strip_tags(group.name)
|
|
|
|
|
chevron.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
chevron.pressed.connect(func() -> void: main.toggle_group(group.id))
|
|
|
|
|
row.add_child(chevron)
|
|
|
|
|
var build := main.mode == Main.Mode.BUILD
|
|
|
|
|
if build:
|
|
|
|
|
row.add_child(_name_edit(false))
|
|
|
|
|
else:
|
2026-11-09 08:21:26 -06:00
|
|
|
var titles := TableCard.vbox(3)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
titles.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
titles.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
var title := Style.make_label(Formatter.strip_tags(group.name), Style.display(true), 20, Style.INK)
|
|
|
|
|
title.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
title.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
titles.add_child(title)
|
|
|
|
|
var sub := Style.make_label("Group · " + count_text(), Style.body(true), 12, Style.MUTED)
|
|
|
|
|
if group.details.strip_edges() != "":
|
|
|
|
|
sub.text += " " + RichText.INFO_MARK
|
|
|
|
|
sub.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
titles.add_child(sub)
|
|
|
|
|
row.add_child(titles)
|
|
|
|
|
var badge := _stack_badge()
|
|
|
|
|
row.add_child(badge)
|
|
|
|
|
if build:
|
|
|
|
|
row.add_child(_menu_button(false))
|
|
|
|
|
|
|
|
|
|
var pad := MarginContainer.new()
|
|
|
|
|
pad.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
pad.add_theme_constant_override("margin_top", 6)
|
|
|
|
|
pad.add_theme_constant_override("margin_bottom", 8)
|
|
|
|
|
col.add_child(pad)
|
2026-11-09 08:21:26 -06:00
|
|
|
var list := TableCard.vbox(2)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
pad.add_child(list)
|
|
|
|
|
var shown := _lit_keys.slice(maxi(0, _lit_keys.size() - MAX_LIT))
|
|
|
|
|
if _lit_keys.size() > shown.size():
|
|
|
|
|
var more := Style.make_label("+%d earlier results" % (_lit_keys.size() - shown.size()), Style.body_italic(true), 13, Style.MUTED)
|
|
|
|
|
more.add_theme_constant_override("line_spacing", 0)
|
|
|
|
|
var mm := MarginContainer.new()
|
|
|
|
|
mm.add_theme_constant_override("margin_left", 14)
|
|
|
|
|
mm.add_child(more)
|
|
|
|
|
list.add_child(mm)
|
|
|
|
|
for key: String in shown:
|
|
|
|
|
list.add_child(_lit_row(key))
|
|
|
|
|
if shown.is_empty():
|
|
|
|
|
var names := PackedStringArray()
|
|
|
|
|
for tid in group.members.slice(0, 3):
|
|
|
|
|
var t := main.data.get_table(tid)
|
|
|
|
|
if t:
|
|
|
|
|
names.append(Formatter.strip_tags(t.name))
|
|
|
|
|
var txt := ", ".join(names)
|
|
|
|
|
if group.members.size() > 3:
|
|
|
|
|
txt += " and %d more" % (group.members.size() - 3)
|
|
|
|
|
var note := Style.make_label(txt if txt != "" else "No cards yet", Style.body_italic(true), 14, Style.MUTED)
|
|
|
|
|
note.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
var nm := MarginContainer.new()
|
|
|
|
|
nm.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
nm.add_theme_constant_override("margin_left", 14)
|
|
|
|
|
nm.add_theme_constant_override("margin_right", 14)
|
|
|
|
|
nm.add_theme_constant_override("margin_top", 2)
|
|
|
|
|
nm.add_theme_constant_override("margin_bottom", 2)
|
|
|
|
|
nm.add_child(note)
|
|
|
|
|
list.add_child(nm)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## A small pile-of-cards mark with the member count, at the header's right.
|
|
|
|
|
func _stack_badge() -> Control:
|
|
|
|
|
var c := Control.new()
|
|
|
|
|
c.custom_minimum_size = Vector2(30, 28)
|
|
|
|
|
c.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
c.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
c.tooltip_text = count_text()
|
|
|
|
|
c.draw.connect(func() -> void:
|
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 back := Style.bordered(Style.box(Style.CARD_SHADE, 3), 1, Style.TRIM_DARK)
|
|
|
|
|
var front := Style.bordered(Style.box(Style.BG, 3), 1, Style.BG_DEEP)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
c.draw_style_box(back, Rect2(8, 2, 18, 22))
|
|
|
|
|
c.draw_style_box(front, Rect2(3, 6, 18, 22))
|
|
|
|
|
var s := str(group.members.size())
|
|
|
|
|
var f := Style.display(true)
|
|
|
|
|
var w := f.get_string_size(s, HORIZONTAL_ALIGNMENT_LEFT, -1, 14).x
|
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
|
|
|
c.draw_string(f, Vector2(12.0 - w / 2.0, 22), s, HORIZONTAL_ALIGNMENT_LEFT, -1, 14, Style.ACCENT)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
)
|
|
|
|
|
return c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _lit_row(key: String) -> Control:
|
|
|
|
|
var i := key.rfind(":")
|
|
|
|
|
var tid := key.substr(0, i)
|
|
|
|
|
var eid := key.substr(i + 1)
|
|
|
|
|
var t := main.data.get_table(tid)
|
|
|
|
|
var row := PanelContainer.new()
|
|
|
|
|
row.mouse_filter = MOUSE_FILTER_PASS
|
|
|
|
|
row.add_theme_stylebox_override("panel", Style.box(Style.LIT, 0, [14, 5, 22, 6]))
|
2026-11-09 08:21:26 -06:00
|
|
|
var v := TableCard.vbox(1)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
row.add_child(v)
|
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 cap := Style.make_label(Formatter.strip_tags(t.name if t else tid).to_upper(), Style.caps(), 10, Style.TRIM_DARK)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
cap.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
|
|
|
cap.custom_minimum_size = Vector2(20, 0)
|
|
|
|
|
cap.mouse_filter = MOUSE_FILTER_IGNORE
|
|
|
|
|
v.add_child(cap)
|
|
|
|
|
var text := RichText.label(RichText.decorate(main.lit_text(tid, eid)), 15, Style.INK, true)
|
|
|
|
|
text.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
RichText.hook_hover(text, main)
|
|
|
|
|
v.add_child(text)
|
|
|
|
|
row.mouse_entered.connect(func() -> void: main.details().show_entry(row, tid, eid))
|
|
|
|
|
lit_rows[key] = row
|
|
|
|
|
return row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Re-renders a collapsed group when the lit results of its members changed.
|
|
|
|
|
func refresh_lit(keys: Array) -> void:
|
|
|
|
|
if group.collapsed and keys != _lit_keys:
|
|
|
|
|
rebuild()
|
|
|
|
|
|
|
|
|
|
|
2026-11-10 18:30:13 -06:00
|
|
|
func _card_style() -> StyleBox:
|
|
|
|
|
return _card_rolling if _rolling else (_card_selected if _selected else _card_box)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func set_selected(on: bool) -> void:
|
|
|
|
|
_selected = on
|
|
|
|
|
if is_instance_valid(_card):
|
|
|
|
|
_card.add_theme_stylebox_override("panel", _card_style())
|
|
|
|
|
queue_redraw()
|
|
|
|
|
|
|
|
|
|
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
func set_rolling(on: bool) -> void:
|
|
|
|
|
_rolling = on
|
|
|
|
|
if is_instance_valid(_card):
|
2026-11-10 18:30:13 -06:00
|
|
|
_card.add_theme_stylebox_override("panel", _card_style())
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Shared parts ----------
|
|
|
|
|
|
|
|
|
|
func _name_edit(on_felt: bool) -> LineEdit:
|
|
|
|
|
var le := LineEdit.new()
|
|
|
|
|
le.text = group.name
|
|
|
|
|
le.placeholder_text = "Group name"
|
|
|
|
|
le.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
le.size_flags_vertical = SIZE_SHRINK_CENTER
|
|
|
|
|
le.custom_minimum_size = Vector2(40, 0)
|
|
|
|
|
le.add_theme_font_override("font", Style.display(true))
|
|
|
|
|
le.add_theme_font_size_override("font_size", 18)
|
|
|
|
|
if on_felt:
|
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
|
|
|
le.add_theme_color_override("font_color", Style.ON_BG)
|
|
|
|
|
le.add_theme_color_override("caret_color", Style.ON_BG)
|
|
|
|
|
le.add_theme_color_override("font_placeholder_color", Style.ON_BG_MUTED)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
le.add_theme_stylebox_override("normal", Style.bordered(Style.box(Color(0, 0, 0, 0.12), 6, [7, 3, 7, 3]), 1, Color(1, 1, 1, 0.14)))
|
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
|
|
|
le.add_theme_stylebox_override("focus", Style.bordered(Style.box(Color(0, 0, 0, 0.25), 6, [7, 3, 7, 3]), 1, Style.ACCENT))
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
else:
|
|
|
|
|
le.add_theme_stylebox_override("normal", Style.bordered(Style.box(Color.WHITE, 6, [7, 3, 7, 3]), 1, Style.RULE))
|
|
|
|
|
le.tooltip_text = "Rename this group"
|
|
|
|
|
le.text_changed.connect(func(s: String) -> void:
|
|
|
|
|
group.name = s
|
|
|
|
|
main.mark_dirty()
|
|
|
|
|
)
|
|
|
|
|
return le
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _menu_button(on_felt: bool) -> MenuButton:
|
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 mb := Style.overflow_button("Group options", on_felt)
|
2026-11-08 17:08:22 -06:00
|
|
|
menu_button = mb
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
var pm := mb.get_popup()
|
|
|
|
|
pm.add_item("Expand" if group.collapsed else "Collapse", MENU_TOGGLE)
|
|
|
|
|
pm.add_item("Details…", MENU_DETAILS)
|
|
|
|
|
pm.add_item("Save as template…", MENU_TEMPLATE)
|
|
|
|
|
pm.add_separator()
|
|
|
|
|
pm.add_item("Ungroup (keep the cards)", MENU_UNGROUP)
|
|
|
|
|
pm.add_item("Delete group and its cards…", MENU_DELETE)
|
|
|
|
|
pm.id_pressed.connect(func(id: int) -> void:
|
|
|
|
|
match id:
|
|
|
|
|
MENU_TOGGLE:
|
|
|
|
|
main.toggle_group(group.id)
|
|
|
|
|
MENU_DETAILS:
|
|
|
|
|
main.edit_group_details(group.id)
|
|
|
|
|
MENU_TEMPLATE:
|
|
|
|
|
main.save_template_from([], "group", [group.id])
|
|
|
|
|
MENU_UNGROUP:
|
|
|
|
|
main.ungroup(group.id)
|
|
|
|
|
MENU_DELETE:
|
|
|
|
|
main.confirm_delete_group(group.id)
|
|
|
|
|
)
|
|
|
|
|
return mb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _show_details(owner: Control) -> void:
|
|
|
|
|
if _dragging or group.details.strip_edges() == "":
|
|
|
|
|
return
|
|
|
|
|
main.details().show_for(owner, Formatter.strip_tags(group.name), group.details,
|
|
|
|
|
"Group · %s%s" % [count_text(), " · collapsed" if group.collapsed else ""])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Geometry (world coordinates) ----------
|
|
|
|
|
|
|
|
|
|
func inlet_point() -> Vector2:
|
|
|
|
|
return Vector2(position.x, position.y + INLET_Y)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Where a pipe from a hidden member's entry leaves the collapsed card: that
|
|
|
|
|
## result's row when it's listed, otherwise the right edge by the title.
|
|
|
|
|
func anchor_for(tid: String, eid: String) -> Vector2:
|
|
|
|
|
var row: Control = lit_rows.get(Roller.entry_key(tid, eid))
|
|
|
|
|
if row != null and row.is_inside_tree():
|
|
|
|
|
var to_world := main.board.world.get_global_transform().affine_inverse()
|
|
|
|
|
var r := row.get_global_rect()
|
|
|
|
|
return Vector2(position.x + size.x, (to_world * (r.position + Vector2(0, r.size.y / 2.0))).y)
|
|
|
|
|
return Vector2(position.x + size.x, position.y + INLET_Y)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Input ----------
|
|
|
|
|
|
|
|
|
|
func _on_title_input(ev: InputEvent, owner: Control) -> void:
|
|
|
|
|
var mb := ev as InputEventMouseButton
|
|
|
|
|
if mb and mb.button_index == MOUSE_BUTTON_LEFT:
|
|
|
|
|
if mb.pressed:
|
|
|
|
|
main.details().hide_for()
|
2026-11-10 18:30:13 -06:00
|
|
|
if main.mode == Main.Mode.BUILD and (mb.ctrl_pressed or mb.meta_pressed):
|
|
|
|
|
main.selecting.toggle_group(group.id)
|
|
|
|
|
owner.accept_event()
|
|
|
|
|
return
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_dragging = true
|
|
|
|
|
_drag_last = main.board.world_mouse()
|
|
|
|
|
if group.collapsed:
|
|
|
|
|
get_parent().move_child(self, -1)
|
|
|
|
|
elif _dragging:
|
|
|
|
|
_dragging = false
|
|
|
|
|
main.mark_dirty()
|
|
|
|
|
owner.accept_event()
|
|
|
|
|
return
|
|
|
|
|
var mm := ev as InputEventMouseMotion
|
|
|
|
|
if mm and _dragging:
|
|
|
|
|
var delta := (main.board.world_mouse() - _drag_last).round()
|
|
|
|
|
if delta != Vector2.ZERO:
|
2026-11-10 18:30:13 -06:00
|
|
|
main.selecting.drag_group(group.id, delta)
|
Group cards and templates
Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:01:34 -06:00
|
|
|
_drag_last += delta
|
|
|
|
|
owner.accept_event()
|