yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
editor_registry.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SYSTEM_EDITOR_REGISTRY_H_
2#define YAZE_APP_EDITOR_SYSTEM_EDITOR_REGISTRY_H_
3
4#include <string>
5#include <unordered_map>
6#include <vector>
7
8#include "app/editor/editor.h"
9
10namespace yaze {
11namespace editor {
12
24 public:
25 EditorRegistry() = default;
26 ~EditorRegistry() = default;
27
28 // Editor type management (static methods for global access)
29 static bool IsPanelBasedEditor(EditorType type);
30 static std::string GetEditorCategory(EditorType type);
31 static EditorType GetEditorTypeFromCategory(const std::string& category);
32
37 static std::vector<std::string> GetAllEditorCategories();
38
39 // Editor navigation
40 void JumpToDungeonRoom(int room_id);
41 void JumpToOverworldMap(int map_id);
42 void SwitchToEditor(EditorType editor_type);
43
44 // Callbacks for navigation
45 void SetJumpToDungeonRoomCallback(std::function<void(int)> callback) {
46 jump_to_room_callback_ = std::move(callback);
47 }
48 void SetJumpToOverworldMapCallback(std::function<void(int)> callback) {
49 jump_to_map_callback_ = std::move(callback);
50 }
51
52 // Editor card management
54 void ShowEditorPanels(EditorType editor_type);
55 void ToggleEditorPanels(EditorType editor_type);
56
57 // Editor information
58 std::vector<EditorType> GetEditorsInCategory(
59 const std::string& category) const;
60 std::vector<std::string> GetAvailableCategories() const;
61 std::string GetEditorDisplayName(EditorType type) const;
62
63 // Editor lifecycle
64 void RegisterEditor(EditorType type, Editor* editor);
66 Editor* GetEditor(EditorType type) const;
67
68 // Editor state queries
69 bool IsEditorActive(EditorType type) const;
70 bool IsEditorVisible(EditorType type) const;
71 void SetEditorActive(EditorType type, bool active);
72
73 private:
74 // Editor type mappings
75 static const std::unordered_map<EditorType, std::string> kEditorCategories;
76 static const std::unordered_map<EditorType, std::string> kEditorNames;
77 static const std::unordered_map<EditorType, bool> kPanelBasedEditors;
78
79 // Registered editors
80 std::unordered_map<EditorType, Editor*> registered_editors_;
81
82 // Navigation callbacks
83 std::function<void(int)> jump_to_room_callback_;
84 std::function<void(int)> jump_to_map_callback_;
85
86 // Helper methods
87 bool IsValidEditorType(EditorType type) const;
88 void ValidateEditorType(EditorType type) const;
89};
90
91} // namespace editor
92} // namespace yaze
93
94#endif // YAZE_APP_EDITOR_SYSTEM_EDITOR_REGISTRY_H_
Manages editor types, categories, and lifecycle.
void RegisterEditor(EditorType type, Editor *editor)
static const std::unordered_map< EditorType, std::string > kEditorNames
static EditorType GetEditorTypeFromCategory(const std::string &category)
static const std::unordered_map< EditorType, std::string > kEditorCategories
void ValidateEditorType(EditorType type) const
static std::vector< std::string > GetAllEditorCategories()
Get all editor categories in display order for sidebar.
std::vector< EditorType > GetEditorsInCategory(const std::string &category) const
static bool IsPanelBasedEditor(EditorType type)
void SetJumpToDungeonRoomCallback(std::function< void(int)> callback)
void ShowEditorPanels(EditorType editor_type)
void SetJumpToOverworldMapCallback(std::function< void(int)> callback)
void SetEditorActive(EditorType type, bool active)
std::string GetEditorDisplayName(EditorType type) const
void ToggleEditorPanels(EditorType editor_type)
void UnregisterEditor(EditorType type)
bool IsEditorActive(EditorType type) const
bool IsValidEditorType(EditorType type) const
bool IsEditorVisible(EditorType type) const
std::function< void(int)> jump_to_room_callback_
void SwitchToEditor(EditorType editor_type)
std::vector< std::string > GetAvailableCategories() const
void JumpToDungeonRoom(int room_id)
std::function< void(int)> jump_to_map_callback_
static const std::unordered_map< EditorType, bool > kPanelBasedEditors
Editor * GetEditor(EditorType type) const
static std::string GetEditorCategory(EditorType type)
std::unordered_map< EditorType, Editor * > registered_editors_
Interface for editor classes.
Definition editor.h:179