yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
content_registry.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_REGISTRY_CONTENT_REGISTRY_H_
2#define YAZE_APP_EDITOR_REGISTRY_CONTENT_REGISTRY_H_
3
4#include <functional>
5#include <memory>
6#include <string>
7#include <vector>
8
10
11namespace yaze {
12class Rom;
13class EventBus;
14
15namespace project {
16struct YazeProject;
17} // namespace project
18
19namespace zelda3 {
20class GameData;
21} // namespace zelda3
22
23namespace editor {
24class WindowContent;
25class Editor;
26class GlobalEditorContext;
27struct EditorDependencies;
28
29namespace workflow {
30class HackWorkflowBackend;
31class ValidationCapability;
32class ProgressionCapability;
33class PlanningCapability;
34} // namespace workflow
35
54namespace ContentRegistry {
55
62namespace Context {
63
72
77Rom* rom();
78
83void SetRom(Rom* rom);
84
90
96
102
109void SetCurrentEditor(Editor* editor);
110
111Editor* editor_window_context(const std::string& category);
112void SetEditorWindowContext(const std::string& category, Editor* editor);
113
119
127
133
141
147
152std::string build_workflow_log();
153void SetBuildWorkflowLog(const std::string& output);
154std::vector<ProjectWorkflowHistoryEntry> workflow_history();
157std::function<void()> start_build_workflow_callback();
158void SetStartBuildWorkflowCallback(std::function<void()> callback);
159std::function<void()> run_project_workflow_callback();
160void SetRunProjectWorkflowCallback(std::function<void()> callback);
161std::function<void()> show_workflow_output_callback();
162void SetShowWorkflowOutputCallback(std::function<void()> callback);
163std::function<void()> cancel_build_workflow_callback();
164void SetCancelBuildWorkflowCallback(std::function<void()> callback);
165
171void Clear();
172} // namespace Context
173
183namespace Panels {
184using PanelFactory = std::function<std::unique_ptr<WindowContent>()>;
185
190void RegisterFactory(PanelFactory factory);
191
196template <typename T>
197void add() {
198 RegisterFactory([]() { return std::make_unique<T>(); });
199}
200
205std::vector<std::unique_ptr<WindowContent>> CreateAll();
206
211void Register(std::unique_ptr<WindowContent> panel);
212
217std::vector<WindowContent*> GetAll();
218
224WindowContent* Get(const std::string& id);
225
231void Clear();
232} // namespace Panels
233
235namespace WindowContents = Panels;
236
240namespace Editors {
242 std::function<std::unique_ptr<Editor>(const EditorDependencies&)>;
243
244void RegisterFactory(EditorFactory factory);
245
246template <typename T>
247void add() {
248 RegisterFactory([](const EditorDependencies& deps) {
249 auto editor = std::make_unique<T>();
250 editor->SetDependencies(deps);
251 return editor;
252 });
253}
254
255std::vector<std::unique_ptr<Editor>> CreateAll(const EditorDependencies& deps);
256} // namespace Editors
257
262namespace Shortcuts {
264 std::string id;
265 std::string default_key;
266 std::string description;
267};
268
269void Register(const ShortcutDef& shortcut);
270void add(const std::string& id, const std::string& key,
271 const std::string& desc);
272std::vector<ShortcutDef> GetAll();
273} // namespace Shortcuts
274
278namespace WorkflowActions {
279struct ActionDef {
280 std::string id;
281 std::string group;
282 std::string label;
283 std::string description;
284 std::string shortcut;
285 int priority = 50;
286 std::function<void()> callback;
287 std::function<bool()> enabled;
288};
289
290void Register(const ActionDef& action);
291std::vector<ActionDef> GetAll();
292void Clear();
293} // namespace WorkflowActions
294
299namespace Settings {
301 std::string key;
302 std::string section;
303 std::string default_value; // serialized
304 std::string description;
305};
306
307void Register(const SettingDef& setting);
308void add(const std::string& section, const std::string& key,
309 const std::string& default_val, const std::string& desc);
310std::vector<SettingDef> GetAll();
311} // namespace Settings
312
313} // namespace ContentRegistry
314
315} // namespace editor
316} // namespace yaze
317
318#endif // YAZE_APP_EDITOR_REGISTRY_CONTENT_REGISTRY_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
Interface for editor classes.
Definition editor.h:240
Instance-based runtime context replacing ContentRegistry::Context.
Base interface for all logical window content components.
std::vector< ProjectWorkflowHistoryEntry > workflow_history()
void SetGlobalContext(GlobalEditorContext *ctx)
void SetShowWorkflowOutputCallback(std::function< void()> callback)
void SetEditorWindowContext(const std::string &category, Editor *editor)
Rom * rom()
Get the current ROM instance.
void SetEventBus(::yaze::EventBus *bus)
Set the current EventBus instance.
::yaze::EventBus * event_bus()
Get the current EventBus instance.
void SetRom(Rom *rom)
Set the current ROM instance.
void SetGameData(::yaze::zelda3::GameData *data)
Set the current game data instance.
void AppendWorkflowHistory(const ProjectWorkflowHistoryEntry &entry)
Editor * current_editor()
Get the currently active editor.
void SetRunProjectWorkflowCallback(std::function< void()> callback)
void SetBuildWorkflowStatus(const ProjectWorkflowStatus &status)
void SetCancelBuildWorkflowCallback(std::function< void()> callback)
std::function< void()> cancel_build_workflow_callback()
void SetCurrentEditor(Editor *editor)
Set the currently active editor.
::yaze::zelda3::GameData * game_data()
Get the current game data instance.
ProjectWorkflowStatus build_workflow_status()
workflow::PlanningCapability * hack_planning_backend()
::yaze::project::YazeProject * current_project()
Get the current project instance.
void SetBuildWorkflowLog(const std::string &output)
void SetStartBuildWorkflowCallback(std::function< void()> callback)
void SetRunWorkflowStatus(const ProjectWorkflowStatus &status)
workflow::ValidationCapability * hack_validation_backend()
std::function< void()> run_project_workflow_callback()
void SetHackWorkflowBackend(workflow::HackWorkflowBackend *backend)
void Clear()
Clear all context state.
workflow::HackWorkflowBackend * hack_workflow_backend()
std::function< void()> show_workflow_output_callback()
std::function< void()> start_build_workflow_callback()
Editor * editor_window_context(const std::string &category)
workflow::ProgressionCapability * hack_progression_backend()
void SetCurrentProject(::yaze::project::YazeProject *project)
Set the current project instance.
void RegisterFactory(EditorFactory factory)
std::function< std::unique_ptr< Editor >(const EditorDependencies &)> EditorFactory
std::vector< std::unique_ptr< Editor > > CreateAll(const EditorDependencies &deps)
void Clear()
Clear all registered panels.
void Register(std::unique_ptr< WindowContent > panel)
Register a panel instance (Legacy/Global).
std::vector< WindowContent * > GetAll()
Get all registered panels.
void add()
Register a panel type for auto-creation.
WindowContent * Get(const std::string &id)
Get a specific panel by its ID.
std::function< std::unique_ptr< WindowContent >()> PanelFactory
void RegisterFactory(PanelFactory factory)
Register a panel factory.
std::vector< std::unique_ptr< WindowContent > > CreateAll()
Create new instances of all registered panels.
void Register(const SettingDef &setting)
void add(const std::string &section, const std::string &key, const std::string &default_val, const std::string &desc)
void add(const std::string &id, const std::string &key, const std::string &desc)
void Register(const ShortcutDef &shortcut)
Unified dependency container for all editor types.
Definition editor.h:164
Modern project structure with comprehensive settings consolidation.
Definition project.h:164