- 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>
61 lines
2.1 KiB
GDScript
61 lines
2.1 KiB
GDScript
class_name ViewMenu
|
|
extends MenuButton
|
|
## The top bar's "View ▾" menu: how rules read (plain words or rule text),
|
|
## collapsing or expanding every table, striped result rows and the minimap.
|
|
## These are view preferences, so they live in one menu instead of the bar.
|
|
|
|
const ID_PLAIN := 0
|
|
const ID_TEXT := 1
|
|
const ID_COLLAPSE := 2
|
|
const ID_STRIPES := 3
|
|
const ID_MINIMAP := 4
|
|
|
|
var m: Main
|
|
|
|
|
|
func setup(p_main: Main) -> void:
|
|
m = p_main
|
|
Style.menu_button("View ▾", false, self)
|
|
tooltip_text = "How rules read, collapsing tables, striped rows and the minimap"
|
|
var pm := get_popup()
|
|
ModalCard.style_popup(pm)
|
|
pm.add_separator("Rules")
|
|
pm.add_radio_check_item("Plain words", ID_PLAIN)
|
|
pm.set_item_tooltip(pm.get_item_index(ID_PLAIN), "Show rules in plain words: “Subtract 1 from Luck”")
|
|
pm.add_radio_check_item("Rule text", ID_TEXT)
|
|
pm.set_item_tooltip(pm.get_item_index(ID_TEXT), "Show rules as the text they're stored as: @luck -= 1")
|
|
pm.add_separator("Tables")
|
|
pm.add_item("Collapse all tables", ID_COLLAPSE)
|
|
pm.add_separator("Show")
|
|
pm.add_check_item("Striped rows", ID_STRIPES)
|
|
pm.add_check_item("Minimap (M)", ID_MINIMAP)
|
|
pm.about_to_popup.connect(sync)
|
|
pm.id_pressed.connect(activate)
|
|
|
|
|
|
## Brings the checks and the Collapse/Expand label up to date.
|
|
func sync() -> void:
|
|
var pm := get_popup()
|
|
pm.set_item_checked(pm.get_item_index(ID_PLAIN), m.rules_plain())
|
|
pm.set_item_checked(pm.get_item_index(ID_TEXT), not m.rules_plain())
|
|
pm.set_item_text(pm.get_item_index(ID_COLLAPSE), collapse_label())
|
|
pm.set_item_checked(pm.get_item_index(ID_STRIPES), m.local_state.striped_rows())
|
|
pm.set_item_checked(pm.get_item_index(ID_MINIMAP), m.board.minimap.visible)
|
|
|
|
|
|
func collapse_label() -> String:
|
|
return "Collapse all tables" if m._any_expanded() else "Expand all tables"
|
|
|
|
|
|
func activate(id: int) -> void:
|
|
match id:
|
|
ID_PLAIN:
|
|
m.set_rules_view("plain")
|
|
ID_TEXT:
|
|
m.set_rules_view("text")
|
|
ID_COLLAPSE:
|
|
m.set_all_collapsed(m._any_expanded())
|
|
ID_STRIPES:
|
|
m.local_state.set_striped_rows(not m.local_state.striped_rows())
|
|
ID_MINIMAP:
|
|
m.nav.set_minimap_visible(not m.board.minimap.visible, true)
|