Files
anm2ed/src/imgui/window/timeline/timeline.cpp
T
shweetandClaude Opus 5.5 d08f59d7ba Stage 8a: panels as plain functions; content selection on the uid Selection
- New panel kit (imgui/window/panel.*): list/card drawing with multi-select,
  rename, arrow keys, drag hooks and tooltips; a list panel helper for the
  context menu, shortcuts and footer; panels build their Actions inline.
- Layers, nulls, events, sounds, spritesheets, regions, shaders and
  animations are plain functions over a small persistent state struct.
- Content items are selected by uid in the shared Selection (one kind per
  content type, plus a focus per kind); regions are those of the focused
  spritesheet. Selection survives undo, paste and removal like the timeline's.
- Combo labels are computed when drawn (Document::choices_get).
- Deletes the Window callback framework, WINDOW_FLAGS, Storage and the
  per-window selection snapshot fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:47:21 -04:00

42 lines
1.4 KiB
C++

#include "context.hpp"
namespace anm2ed::imgui
{
Timeline::Timeline() = default;
Timeline::~Timeline() = default;
TimelineContext::TimelineContext(TimelineState&& state, Manager& manager, Settings& settings, Resources& resources,
Clipboard& clipboard)
: TimelineState(std::move(state)), manager(manager), settings(settings), resources(resources),
clipboard(clipboard), document(*manager.get()), model(document.model), playback(document.playback),
reference(document.reference_get())
{
}
void TimelineContext::update()
{
animation = model.animation_get(reference.animationIndex);
rowFrameChildHeight = ImGui::GetTextLineHeightWithSpacing() + ImGui::GetStyle().WindowPadding.y * 1.5f;
style = ImGui::GetStyle();
isLightTheme = settings.theme == theme::LIGHT;
isTextPushed = false;
if (isLightTheme)
{
ImGui::PushStyleColor(ImGuiCol_Text, TIMELINE_TEXT_COLOR_LIGHT);
isTextPushed = true;
}
frame_begin();
draw();
}
void Timeline::update(Manager& manager, Settings& settings, Resources& resources, Clipboard& clipboard)
{
if (!manager.get()) return;
auto state = context ? std::move(static_cast<TimelineState&>(*context)) : TimelineState{};
context = std::make_unique<TimelineContext>(std::move(state), manager, settings, resources, clipboard);
context->update();
}
}