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;
27class LayoutManager;
28class UserSettings;
29struct EditorDependencies;
30
31namespace workflow {
32class HackWorkflowBackend;
33class ValidationCapability;
34class ProgressionCapability;
35class PlanningCapability;
36} // namespace workflow
37
56namespace ContentRegistry {
57
64namespace Context {
65
74
79Rom* rom();
80
85void SetRom(Rom* rom);
86
92
98
104
111void SetCurrentEditor(Editor* editor);
112
113Editor* editor_window_context(const std::string& category);
114void SetEditorWindowContext(const std::string& category, Editor* editor);
115
121
129
135
143
155void SetUserSettings(UserSettings* settings);
156
167void SetLayoutManager(LayoutManager* manager);
168
174
179std::string build_workflow_log();
180void SetBuildWorkflowLog(const std::string& output);
181std::vector<ProjectWorkflowHistoryEntry> workflow_history();
184std::function<void()> start_build_workflow_callback();
185void SetStartBuildWorkflowCallback(std::function<void()> callback);
186std::function<void()> run_project_workflow_callback();
187void SetRunProjectWorkflowCallback(std::function<void()> callback);
188std::function<void()> show_workflow_output_callback();
189void SetShowWorkflowOutputCallback(std::function<void()> callback);
190std::function<void()> cancel_build_workflow_callback();
191void SetCancelBuildWorkflowCallback(std::function<void()> callback);
192
198void Clear();
199} // namespace Context
200
210namespace Panels {
211using PanelFactory = std::function<std::unique_ptr<WindowContent>()>;
212
217void RegisterFactory(PanelFactory factory);
218
223template <typename T>
224void add() {
225 RegisterFactory([]() { return std::make_unique<T>(); });
226}
227
232std::vector<std::unique_ptr<WindowContent>> CreateAll();
233
238void Register(std::unique_ptr<WindowContent> panel);
239
244std::vector<WindowContent*> GetAll();
245
251WindowContent* Get(const std::string& id);
252
258void Clear();
259} // namespace Panels
260
262namespace WindowContents = Panels;
263
267namespace Editors {
269 std::function<std::unique_ptr<Editor>(const EditorDependencies&)>;
270
271void RegisterFactory(EditorFactory factory);
272
273template <typename T>
274void add() {
275 RegisterFactory([](const EditorDependencies& deps) {
276 auto editor = std::make_unique<T>();
277 editor->SetDependencies(deps);
278 return editor;
279 });
280}
281
282std::vector<std::unique_ptr<Editor>> CreateAll(const EditorDependencies& deps);
283} // namespace Editors
284
289namespace Shortcuts {
291 std::string id;
292 std::string default_key;
293 std::string description;
294};
295
296void Register(const ShortcutDef& shortcut);
297void add(const std::string& id, const std::string& key,
298 const std::string& desc);
299std::vector<ShortcutDef> GetAll();
300} // namespace Shortcuts
301
305namespace WorkflowActions {
306struct ActionDef {
307 std::string id;
308 std::string group;
309 std::string label;
310 std::string description;
311 std::string shortcut;
312 int priority = 50;
313 std::function<void()> callback;
314 std::function<bool()> enabled;
315};
316
317void Register(const ActionDef& action);
318std::vector<ActionDef> GetAll();
319void Clear();
320} // namespace WorkflowActions
321
326namespace Settings {
328 std::string key;
329 std::string section;
330 std::string default_value; // serialized
331 std::string description;
332};
333
334void Register(const SettingDef& setting);
335void add(const std::string& section, const std::string& key,
336 const std::string& default_val, const std::string& desc);
337std::vector<SettingDef> GetAll();
338} // namespace Settings
339
340} // namespace ContentRegistry
341
342} // namespace editor
343} // namespace yaze
344
345#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:245
Instance-based runtime context replacing ContentRegistry::Context.
Manages ImGui DockBuilder layouts for each editor type.
Manages user preferences and settings persistence.
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)
UserSettings * user_settings()
Get the current UserSettings instance.
Editor * current_editor()
Get the currently active editor.
void SetRunProjectWorkflowCallback(std::function< void()> callback)
LayoutManager * layout_manager()
Get the shared LayoutManager instance.
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.
void SetLayoutManager(LayoutManager *manager)
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 SetUserSettings(UserSettings *settings)
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:169
Modern project structure with comprehensive settings consolidation.
Definition project.h:172