TableTower/ui/sheet_lore_dock.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

40 lines
1.5 KiB
GDScript

class_name SheetLoreDock
extends PanelContainer
## The Lore Index inside the sheet editor (Play and Build): the shared
## LoreList, with the "Inspector | Lore Index" tabs on top in Build (as on the
## spread). Drag a Lore Entry onto a box: SheetLoreDrop adds it there.
## Shown with SheetEditor.set_lore_shown (top bar "Lore Index", the tab).
const WIDTH := 340.0
var ed: SheetEditor
var lore: LoreList
var _tabs: HBoxContainer
func setup(p_editor: SheetEditor) -> void:
ed = p_editor
custom_minimum_size.x = WIDTH
add_theme_stylebox_override("panel", Style.panel_box([10, 10, 10, 10]))
var col := VBoxContainer.new()
col.add_theme_constant_override("separation", 8)
add_child(col)
_tabs = SideTabs.tab_row([[SheetInspector.INSPECTOR, "Inspector"], [SheetInspector.LORE, "Lore Index"]], SheetInspector.LORE,
func(which: String) -> void: ed.set_lore_shown(which == SheetInspector.LORE))
col.add_child(_tabs)
lore = LoreList.new()
lore.name = "LoreList"
lore.size_flags_vertical = SIZE_EXPAND_FILL
lore.setup(ed.m, func() -> void: ed.set_lore_shown(false))
lore.dropped.connect(func(page: BookPage, level: LoreLevel, at: Vector2) -> void:
SheetLoreDrop.drop(ed, page, level, at, Input.is_key_pressed(KEY_SHIFT)))
lore.open_sheet = func(id: String) -> void: ed.nav.open(id)
col.add_child(lore)
visible = false
## Build shows the tabs in place of the title, as on the spread.
func sync() -> void:
_tabs.visible = ed.building()
SideTabs.press(_tabs, SheetInspector.LORE)
lore.title.visible = not ed.building()