Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
class_name MainTopBar
|
|
|
|
|
extends RefCounted
|
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
|
|
|
## Main's top bar (brand, Play/Build, collections, Build tools, search,
|
|
|
|
|
## View ▾, Help ▾ and the zoom control), the toast at the bottom and the
|
|
|
|
|
## endless-loop warning chip.
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
|
|
|
|
|
var m: Main
|
|
|
|
|
|
|
|
|
|
var _hint: Label
|
|
|
|
|
var _play_button: Button
|
|
|
|
|
var _build_button: Button
|
|
|
|
|
var _build_tools: Control
|
|
|
|
|
var _switcher: CollectionSwitcher
|
|
|
|
|
var _board_menu: IoMenu
|
2026-11-10 18:35:24 -06:00
|
|
|
## The bar's actions menu (Actions.background), like right-clicking the spread.
|
|
|
|
|
var actions_menu: MenuButton
|
2026-11-10 18:58:33 -06:00
|
|
|
## The name beside the logo (hidden on phones).
|
|
|
|
|
var brand_title: Label
|
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 view_menu: ViewMenu
|
|
|
|
|
var help_menu: HelpMenu
|
|
|
|
|
var zoom: ZoomControl
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
var _toast: PanelContainer
|
|
|
|
|
var _toast_label: Label
|
|
|
|
|
var _toast_undo: Button
|
2026-11-15 12:42:29 -06:00
|
|
|
## The toast button's own action (toast_action), or empty for Undo.
|
|
|
|
|
var _toast_do := Callable()
|
|
|
|
|
## Play mode's greyed "+ Card" (BuildModeHint).
|
|
|
|
|
var play_add_button: Button
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
var _toast_timer: Timer
|
|
|
|
|
## The undo step the toast's Undo button undoes (EditHistory serial), or -1.
|
|
|
|
|
var _toast_serial := -1
|
|
|
|
|
var _endless_chip: PanelContainer
|
|
|
|
|
var _endless_label: Label
|
|
|
|
|
var _endless_timer: Timer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _init(p_main: Main) -> void:
|
|
|
|
|
m = p_main
|
|
|
|
|
|
|
|
|
|
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
## The theme's logo (Style.LOGO): its mascot (Morgan Fortuna, the fortune
|
|
|
|
|
## teller, by default; recoloured by MascotArt), the old tower mark, or none.
|
2026-11-10 18:24:23 -06:00
|
|
|
func _logo() -> Control:
|
|
|
|
|
match Style.LOGO:
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
"fortune_teller", "mascot":
|
2026-11-10 18:24:23 -06:00
|
|
|
var tr := TextureRect.new()
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
tr.texture = MascotArt.texture(ThemeStore.current, 128)
|
2026-11-10 18:24:23 -06:00
|
|
|
tr.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
|
|
|
tr.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
|
|
|
|
tr.texture_filter = CanvasItem.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS
|
|
|
|
|
tr.custom_minimum_size = Vector2(46, 46)
|
|
|
|
|
tr.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
return tr
|
|
|
|
|
"tower":
|
|
|
|
|
var mark := Control.new()
|
|
|
|
|
mark.custom_minimum_size = Vector2(20, 24)
|
|
|
|
|
mark.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
mark.draw.connect(func() -> void: Icons.draw_tower(mark, Vector2(0, 0), 20.0 / 22.0, Style.ON_BG, Style.ACCENT))
|
|
|
|
|
return mark
|
|
|
|
|
return null
|
|
|
|
|
|
|
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func _build_top_bar() -> Control:
|
|
|
|
|
var bar := PanelContainer.new()
|
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
|
|
|
bar.add_theme_stylebox_override("panel", Style.panel_box([16, 10, 16, 10]))
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
var h := HBoxContainer.new()
|
|
|
|
|
h.add_theme_constant_override("separation", 10)
|
|
|
|
|
bar.add_child(h)
|
|
|
|
|
|
|
|
|
|
var brand := HBoxContainer.new()
|
|
|
|
|
brand.add_theme_constant_override("separation", 9)
|
2026-11-10 18:24:23 -06:00
|
|
|
var mark := _logo()
|
|
|
|
|
if mark:
|
|
|
|
|
brand.add_child(mark)
|
|
|
|
|
var title := Style.make_label("Table Tarot", Style.display(), 23, Style.ON_BG)
|
2026-11-10 18:58:33 -06:00
|
|
|
brand_title = title
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
title.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
brand.add_child(title)
|
|
|
|
|
h.add_child(brand)
|
|
|
|
|
|
|
|
|
|
var seg := PanelContainer.new()
|
|
|
|
|
seg.add_theme_stylebox_override("panel", Style.box(Color(0, 0, 0, 0.28), 9, [3, 3, 3, 3]))
|
|
|
|
|
seg.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
var seg_row := HBoxContainer.new()
|
|
|
|
|
seg_row.add_theme_constant_override("separation", 0)
|
|
|
|
|
seg.add_child(seg_row)
|
|
|
|
|
var group := ButtonGroup.new()
|
|
|
|
|
_play_button = _seg_button("Play", group)
|
|
|
|
|
_build_button = _seg_button("Build", group)
|
|
|
|
|
_play_button.button_pressed = true
|
|
|
|
|
_play_button.pressed.connect(func() -> void: m.set_mode(Main.Mode.PLAY))
|
|
|
|
|
_build_button.pressed.connect(func() -> void: m.set_mode(Main.Mode.BUILD))
|
|
|
|
|
seg_row.add_child(_play_button)
|
|
|
|
|
seg_row.add_child(_build_button)
|
|
|
|
|
h.add_child(seg)
|
|
|
|
|
|
2026-11-16 10:41:13 -06:00
|
|
|
# "SPREAD" over the switcher says what the name is and that it can change.
|
|
|
|
|
var spread_box := VBoxContainer.new()
|
|
|
|
|
spread_box.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
spread_box.add_theme_constant_override("separation", 0)
|
|
|
|
|
var caption := Style.make_label("SPREAD", Style.caps(), 10, Style.ON_BG_MUTED)
|
|
|
|
|
caption.tooltip_text = "A spread is a set of cards laid out together. Click its name to switch spreads or make a new one."
|
|
|
|
|
caption.mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
|
spread_box.add_child(caption)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
_switcher = CollectionSwitcher.new()
|
|
|
|
|
_switcher.setup(m)
|
2026-11-16 10:41:13 -06:00
|
|
|
spread_box.add_child(_switcher)
|
|
|
|
|
h.add_child(spread_box)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
|
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
|
|
|
_hint = Style.make_label(Main.HINTS[m.mode], Style.body(), 15, Style.ON_BG_MUTED)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
_hint.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
_hint.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
_hint.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
|
|
|
_hint.custom_minimum_size = Vector2(60, 0)
|
|
|
|
|
h.add_child(_hint)
|
|
|
|
|
|
|
|
|
|
var tools := HBoxContainer.new()
|
|
|
|
|
tools.add_theme_constant_override("separation", 6)
|
|
|
|
|
_build_tools = tools
|
|
|
|
|
m.undo_redo._make_history_buttons(tools)
|
|
|
|
|
m.editing._add_menu = m.editing._make_add_menu()
|
|
|
|
|
tools.add_child(m.editing._add_menu)
|
|
|
|
|
_board_menu = IoMenu.new()
|
|
|
|
|
_board_menu.setup(true, m.collections_enabled())
|
|
|
|
|
_board_menu.reset_requested.connect(m.editing.reset_sample)
|
|
|
|
|
_board_menu.import_requested.connect(m.collections.import_collection)
|
|
|
|
|
_board_menu.test_requested.connect(m.collections.open_test_board)
|
|
|
|
|
_board_menu.export_requested.connect(m.collections.export_collection)
|
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
|
|
|
_board_menu.pack_requested.connect(m.nav.pack_collapsed_groups)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
tools.add_child(_board_menu)
|
|
|
|
|
tools.visible = false
|
|
|
|
|
h.add_child(tools)
|
2026-11-15 12:42:29 -06:00
|
|
|
play_add_button = BuildModeHint.make_button(m)
|
|
|
|
|
h.add_child(play_add_button)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
|
|
|
|
|
_endless_chip = _make_endless_chip()
|
|
|
|
|
h.add_child(_endless_chip)
|
|
|
|
|
|
2026-11-10 18:35:24 -06:00
|
|
|
# The same actions as right-clicking the empty spread, for people who don't right-click.
|
|
|
|
|
actions_menu = Style.menu_button("☰")
|
|
|
|
|
actions_menu.tooltip_text = "Actions: new cards, search, shuffle all decks, theme…"
|
|
|
|
|
var apm := actions_menu.get_popup()
|
|
|
|
|
apm.about_to_popup.connect(func() -> void:
|
|
|
|
|
Actions.fill(apm, Actions.background(m, m.board.screen_to_world(m.board.size / 2.0) - Vector2(128, 120))))
|
|
|
|
|
h.add_child(actions_menu)
|
|
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
m.nav._search_button = _make_search_button()
|
|
|
|
|
h.add_child(m.nav._search_button)
|
|
|
|
|
|
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
|
|
|
view_menu = ViewMenu.new()
|
|
|
|
|
view_menu.setup(m)
|
|
|
|
|
h.add_child(view_menu)
|
|
|
|
|
help_menu = HelpMenu.new()
|
|
|
|
|
help_menu.setup(m)
|
|
|
|
|
h.add_child(help_menu)
|
|
|
|
|
zoom = ZoomControl.new()
|
|
|
|
|
zoom.setup(m)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
h.add_child(zoom)
|
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
|
|
|
# Show or hide the minimap as remembered for the starting mode.
|
|
|
|
|
m.nav._nav_mode_changed.call_deferred()
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return bar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _seg_button(text: String, group: ButtonGroup) -> Button:
|
|
|
|
|
var b := Button.new()
|
|
|
|
|
b.text = text
|
|
|
|
|
b.toggle_mode = true
|
|
|
|
|
b.button_group = group
|
|
|
|
|
b.add_theme_font_override("font", Style.body_bold())
|
|
|
|
|
b.add_theme_font_size_override("font_size", 16)
|
|
|
|
|
var normal := Style.box(Color(0, 0, 0, 0), 7, [16, 6, 16, 6])
|
|
|
|
|
var hover := Style.box(Color(1, 1, 1, 0.06), 7, [16, 6, 16, 6])
|
|
|
|
|
var pressed := Style.box(Style.CARD, 7, [16, 6, 16, 6])
|
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.skin_button(b, normal, hover, pressed, Style.ON_BG_MUTED, Style.ON_BG, Style.INK)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _make_search_button() -> Button:
|
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 b := Style.bar_button("")
|
|
|
|
|
b.custom_minimum_size = Vector2(38, 0)
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
b.tooltip_text = "Find a card by its name, results, prompt, variables or group (Ctrl+F)"
|
|
|
|
|
_bar_icon(b, func(c: Control) -> 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
|
|
|
c.draw_arc(Vector2(6.5, 6.5), 5.0, 0.0, TAU, 24, Style.ON_BG, 1.8, true)
|
|
|
|
|
c.draw_line(Vector2(10.3, 10.3), Vector2(14.5, 14.5), Style.ON_BG, 2.4, true))
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
b.pressed.connect(m.nav.toggle_search)
|
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
## Puts a 16 px drawn icon on a top-bar button: at the left of its text, or
|
|
|
|
|
## centred when the button has no text.
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func _bar_icon(b: Button, paint: Callable) -> void:
|
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 icon_only := b.text == ""
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
for n in ["normal", "hover", "pressed", "hover_pressed", "disabled"]:
|
|
|
|
|
var sb := b.get_theme_stylebox(n) as StyleBoxFlat
|
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 sb and not icon_only:
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
sb.content_margin_left = 32
|
|
|
|
|
var icon := Control.new()
|
|
|
|
|
icon.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
icon.size = Vector2(16, 16)
|
|
|
|
|
icon.draw.connect(paint.bind(icon))
|
|
|
|
|
b.add_child(icon)
|
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
|
|
|
b.resized.connect(func() -> void:
|
|
|
|
|
var x := roundf((b.size.x - 16.0) / 2.0) if icon_only else 11.0
|
|
|
|
|
icon.position = Vector2(x, roundf((b.size.y - 16.0) / 2.0)))
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# ----- Toast -----
|
|
|
|
|
|
|
|
|
|
func _build_toast() -> void:
|
|
|
|
|
_toast = PanelContainer.new()
|
|
|
|
|
var sb := Style.box(Style.CARD, 10, [16, 9, 10, 9])
|
|
|
|
|
sb.shadow_color = Color(0, 0, 0, 0.4)
|
|
|
|
|
sb.shadow_size = 18
|
|
|
|
|
sb.shadow_offset = Vector2(0, 8)
|
|
|
|
|
_toast.add_theme_stylebox_override("panel", sb)
|
|
|
|
|
var h := HBoxContainer.new()
|
|
|
|
|
h.add_theme_constant_override("separation", 12)
|
|
|
|
|
_toast.add_child(h)
|
|
|
|
|
_toast_label = Style.make_label("", Style.body(), 15, Style.INK)
|
|
|
|
|
_toast_label.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
h.add_child(_toast_label)
|
|
|
|
|
_toast_undo = Button.new()
|
|
|
|
|
_toast_undo.text = "Undo"
|
|
|
|
|
_toast_undo.add_theme_font_override("font", Style.body_bold())
|
|
|
|
|
_toast_undo.add_theme_font_size_override("font_size", 15)
|
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 un := Style.box(Style.BG, 7, [12, 5, 12, 5])
|
|
|
|
|
var uh := Style.box(Style.BG_HOVER, 7, [12, 5, 12, 5])
|
|
|
|
|
Style.skin_button(_toast_undo, un, uh, uh, Style.ACCENT)
|
2026-11-15 12:42:29 -06:00
|
|
|
_toast_undo.pressed.connect(func() -> void:
|
|
|
|
|
if _toast_do.is_valid():
|
|
|
|
|
_toast.hide()
|
|
|
|
|
_toast_do.call()
|
|
|
|
|
else:
|
|
|
|
|
_undo())
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
_toast_undo.focus_mode = Control.FOCUS_NONE
|
|
|
|
|
h.add_child(_toast_undo)
|
|
|
|
|
_toast.hide()
|
|
|
|
|
m.add_child(_toast)
|
|
|
|
|
_toast_timer = Timer.new()
|
|
|
|
|
_toast_timer.one_shot = true
|
|
|
|
|
_toast_timer.wait_time = 5.0
|
|
|
|
|
_toast_timer.timeout.connect(func() -> void:
|
|
|
|
|
_toast.hide()
|
|
|
|
|
_toast_serial = -1
|
|
|
|
|
)
|
|
|
|
|
m.add_child(_toast_timer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Shows a message at the bottom. With `undoable`, it has an Undo button for
|
|
|
|
|
## the edit just committed (it goes through the edit history, like Ctrl+Z).
|
|
|
|
|
func toast(message: String, undoable: bool = false) -> void:
|
|
|
|
|
_toast_serial = m.undo_redo.edits.top_serial() if undoable and m.undo_redo.edits else -1
|
2026-11-15 12:42:29 -06:00
|
|
|
_toast_do = Callable()
|
|
|
|
|
_toast_undo.text = "Undo"
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
_toast_label.text = message
|
|
|
|
|
_toast_undo.visible = _toast_serial >= 0
|
|
|
|
|
_toast.show()
|
|
|
|
|
_toast.reset_size()
|
|
|
|
|
_place_toast()
|
|
|
|
|
_toast_timer.start()
|
|
|
|
|
|
|
|
|
|
|
2026-11-15 12:42:29 -06:00
|
|
|
## A toast whose button runs `on_press` (labelled `label`) instead of Undo.
|
|
|
|
|
func toast_action(message: String, label: String, on_press: Callable) -> void:
|
|
|
|
|
toast(message)
|
|
|
|
|
_toast_do = on_press
|
|
|
|
|
_toast_undo.text = label
|
|
|
|
|
_toast_undo.show()
|
|
|
|
|
_toast.reset_size()
|
|
|
|
|
_place_toast()
|
|
|
|
|
|
|
|
|
|
|
Split ui/main.gd into area helpers (no behaviour change)
Main (3679 lines) becomes a shell: shared state, start-up, cards, input,
rules view and one-line delegators for the methods other files call. Each
area moves with its state into a RefCounted helper holding a back-reference
(m: Main):
main_cli.gd command-line and screenshot flags
main_top_bar.gd top bar, toast, endless-loop chip
main_editing.gd add/delete cards, results and pipes, selection bar
main_groups.gd groups and card drags
main_templates.gd templates
main_rolling.gd rolling, choice questions, playback, session seed, copy
main_collections.gd collections, import/export, table settings, test board
main_state.gd decks, variables, roll history (local state)
main_navigation.gd search, focus, minimap, arrange/pack
main_history.gd undo/redo and mark_dirty
main_inspector.gd inspector selection and refresh
Tests that reached moved private members now go through the helper
(main.undo_redo.edits, main.rolling.pending_choice(), ...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:14:19 -06:00
|
|
|
func _place_toast() -> void:
|
|
|
|
|
if _toast and _toast.visible:
|
|
|
|
|
_toast.reset_size()
|
|
|
|
|
_toast.position = Vector2((m.size.x - _toast.size.x) / 2.0, m.size.y - _toast.size.y - 20.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The toast's Undo button: undoes the step the toast was about, if it is
|
|
|
|
|
## still the newest one.
|
|
|
|
|
func _undo() -> void:
|
|
|
|
|
m.undo_redo._commit_edits()
|
|
|
|
|
if _toast_serial < 0 or m.undo_redo.edits == null or m.undo_redo.edits.top_serial() != _toast_serial:
|
|
|
|
|
_toast_undo.hide()
|
|
|
|
|
if m.undo_redo.edits and m.undo_redo.edits.can_undo():
|
|
|
|
|
toast("Newer edits came after that one. Undo (Ctrl+Z) steps back through them.")
|
|
|
|
|
return
|
|
|
|
|
m.undo_redo.undo()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ----- Endless-loop warning -----
|
|
|
|
|
|
|
|
|
|
func _make_endless_chip() -> PanelContainer:
|
|
|
|
|
var chip := PanelContainer.new()
|
|
|
|
|
chip.add_theme_stylebox_override("panel", Style.box(Style.WARN_BG, 8, [10, 4, 10, 4]))
|
|
|
|
|
chip.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
_endless_label = Style.make_label("", Style.body_bold(), 14, Style.WARN_INK)
|
|
|
|
|
_endless_label.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
|
|
|
chip.add_child(_endless_label)
|
|
|
|
|
chip.custom_minimum_size.x = 0
|
|
|
|
|
chip.hide()
|
|
|
|
|
return chip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _update_endless_chip() -> void:
|
|
|
|
|
if _endless_chip == null or m.data == null:
|
|
|
|
|
return
|
|
|
|
|
var ids := Roller.endless_cycles(m.data)
|
|
|
|
|
if m.mode != Main.Mode.BUILD or ids.is_empty():
|
|
|
|
|
_endless_chip.hide()
|
|
|
|
|
return
|
|
|
|
|
var names := PackedStringArray()
|
|
|
|
|
for id in ids:
|
|
|
|
|
var t := m.data.get_table(id)
|
|
|
|
|
names.append(t.name if t else id)
|
|
|
|
|
var list := ", ".join(names)
|
|
|
|
|
_endless_label.text = "⚠ Endless loop: " + list
|
|
|
|
|
var w := Style.body_bold().get_string_size(_endless_label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, 14).x
|
|
|
|
|
_endless_label.custom_minimum_size.x = clampf(w + 4.0, 120.0, 300.0)
|
|
|
|
|
_endless_chip.tooltip_text = "These tables can never finish rolling, because every result leads back into a loop:\n" + "\n".join(names)
|
|
|
|
|
_endless_chip.show()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The endless-loop check walks the whole board (about 30 ms on an 800-card
|
|
|
|
|
## board), so edits schedule it to run once typing pauses instead of on every
|
|
|
|
|
## keystroke.
|
|
|
|
|
func _schedule_endless_check() -> void:
|
|
|
|
|
if _endless_timer == null:
|
|
|
|
|
_endless_timer = Timer.new()
|
|
|
|
|
_endless_timer.one_shot = true
|
|
|
|
|
_endless_timer.wait_time = 0.4
|
|
|
|
|
_endless_timer.timeout.connect(_update_endless_chip)
|
|
|
|
|
m.add_child(_endless_timer)
|
|
|
|
|
_endless_timer.start()
|