TableTower/ui/lore_level_spread.gd
RobinFiredrake 317cac7a78 Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
  PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
  ([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
  My library; item sheets on Lore Entries; drag entries into lists,
  slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
  touch sizes, bottom panels; sheet CLI flags split out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00

48 lines
1.1 KiB
GDScript

class_name SpreadLoreLevel
extends LoreLevel
## "This spread": the open spread's Lore Entries (TowerBoard.book). Changes
## go through the spread's undo, and linked results follow (TowerBoard.sync_page).
func _init(p_main: Main) -> void:
super(p_main)
key = SPREAD
func pages() -> Array[BookPage]:
return m.data.book if m.data else ([] as Array[BookPage])
func get_page(id: String) -> BookPage:
return m.data.get_page(id) if m.data else null
func edit(change: Callable) -> void:
m.undo_redo._begin_edit()
change.call()
m.mark_dirty()
m.undo_redo._end_edit()
func changed(page: BookPage) -> void:
for table_id in m.data.sync_page(page.id):
m.inspector_edited(table_id)
m.mark_dirty()
func _add_raw(text: String, details: String) -> BookPage:
return m.data.add_page(text, details)
func remove_page(id: String) -> void:
edit(func() -> void: m.data.remove_page(id))
func revision() -> int:
return m.edit_rev
func uses_note(page: BookPage) -> String:
var n := m.data.page_uses(page.id)
return "Used by %d %s. Drag the Lore Entry from the list onto a result to use it there." % [n, "result" if n == 1 else "results"]