Tool windows: - Every editor (scenario, scene builder, map, interactive objects, lighting, catalog export) is rebuilt on the interface ToolWindow chrome and the denser ToolTheme: header with title/close, status bar, Ctrl+S, dirty-state confirmation. - Shared building blocks in src/Common: ToolUi (rows, buttons, sections), CollapsibleSection, FilteredList, ModFileSelector, DragHandle and BackgroundCanvas (scene background with pan/zoom). - The map, interactive and light editors draw on canvases (MapEditorCanvas, InteractiveEditorCanvas, LightEditorCanvas) instead of one Control "handle" node per object; the *Handle classes are removed. - Scenario editor: tab data model (TabData), automatic graph layout (ScenarioGraphLayout), file tree/info/thumbnail panel updates. - Services: ModFileService (mod file listing and writing), SceneBackgroundService; MapFileService/ModResourceService follow. - Catalog export: per-language name/description editing. - Locale (en/ru) regrouped under tools/*; unused keys removed. Novel Editor: - collections/novel_editor.json: a "game" whose entry scene is an authoring workspace over the novel engine and the story content. - NovelEditorHub (scenes/novel_editor_hub.tscn) lists every installed tool through IToolProvider.AddMenuButton; ToolsInitializer registers it as the logical scene "novel_editor".
63 lines
2.4 KiB
C#
63 lines
2.4 KiB
C#
using Cthangover.Core.UI.Theming;
|
|
using Godot;
|
|
|
|
namespace Cthangover.Tools.Common
|
|
{
|
|
/// <summary>
|
|
/// Sidebar section with a clickable uppercase caption (style guide
|
|
/// <c>.ct-section-title</c> plus a ▸/▾ marker) that shows or hides its
|
|
/// <see cref="Body"/>. Editors expand the sections relevant to the selected
|
|
/// object and collapse the rest, so a long property panel stays readable
|
|
/// without losing access to rarely used fields.
|
|
/// </summary>
|
|
public partial class CollapsibleSection : VBoxContainer
|
|
{
|
|
private readonly Button _header;
|
|
private readonly string _title;
|
|
|
|
/// <summary>Container for the section's controls.</summary>
|
|
public VBoxContainer Body { get; }
|
|
|
|
/// <summary>Whether the body is shown.</summary>
|
|
public bool Expanded
|
|
{
|
|
get => Body.Visible;
|
|
set
|
|
{
|
|
Body.Visible = value;
|
|
_header.Text = (value ? "▾ " : "▸ ") + _title;
|
|
}
|
|
}
|
|
|
|
/// <summary>Creates a section titled by <paramref name="titleKey"/>.</summary>
|
|
public CollapsibleSection(string titleKey, bool expanded = true)
|
|
{
|
|
_title = ToolUi.Tr(titleKey).ToUpperInvariant();
|
|
AddThemeConstantOverride("separation", UiTokens.Space2);
|
|
|
|
_header = new Button
|
|
{
|
|
Flat = true,
|
|
Alignment = HorizontalAlignment.Left,
|
|
FocusMode = FocusModeEnum.None,
|
|
MouseDefaultCursorShape = CursorShape.PointingHand
|
|
};
|
|
_header.AddThemeFontSizeOverride("font_size", UiTokens.FontSmall);
|
|
_header.AddThemeColorOverride("font_color", UiTokens.Muted);
|
|
_header.AddThemeColorOverride("font_hover_color", UiTokens.AccentBright);
|
|
_header.AddThemeColorOverride("font_pressed_color", UiTokens.Muted);
|
|
_header.AddThemeStyleboxOverride("normal", new StyleBoxEmpty());
|
|
_header.AddThemeStyleboxOverride("hover", new StyleBoxEmpty());
|
|
_header.AddThemeStyleboxOverride("pressed", new StyleBoxEmpty());
|
|
_header.Pressed += () => Expanded = !Expanded;
|
|
AddChild(_header);
|
|
|
|
Body = new VBoxContainer();
|
|
Body.AddThemeConstantOverride("separation", UiTokens.Space2);
|
|
AddChild(Body);
|
|
|
|
Expanded = expanded;
|
|
}
|
|
}
|
|
}
|