3#include <unordered_set>
5#include "absl/strings/str_format.h"
12const std::unordered_map<EditorType, std::string>
73 const std::string& category) {
75 if (cat == category) {
108 printf(
"[EditorRegistry] JumpToDungeonRoom(%d) called (no callback)\n", room_id);
120 printf(
"[EditorRegistry] JumpToOverworldMap(%d) called (no callback)\n", map_id);
132 if (type != editor_type && editor) {
133 editor->set_active(
false);
138 it->second->set_active(
true);
139 printf(
"[EditorRegistry] Switched to %s\n",
148 printf(
"[EditorRegistry] Hiding cards for %s\n",
159 printf(
"[EditorRegistry] Showing cards for %s\n",
169 printf(
"[EditorRegistry] Toggling cards for %s\n",
175 const std::string& category)
const {
176 std::vector<EditorType> editors;
179 if (cat == category) {
180 editors.push_back(type);
188 std::vector<std::string> categories;
189 std::unordered_set<std::string> seen;
192 if (seen.find(category) == seen.end()) {
193 categories.push_back(category);
194 seen.insert(category);
206 return "Unknown Editor";
213 throw std::invalid_argument(
"Editor pointer cannot be null");
217 printf(
"[EditorRegistry] Registered %s\n",
227 printf(
"[EditorRegistry] Unregistered %s\n",
247 return it->second->active();
257 return it->second->active();
267 it->second->set_active(active);
277 throw std::invalid_argument(
278 absl::StrFormat(
"Invalid editor type: %d",
static_cast<int>(type)));
void HideCurrentEditorPanels()
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 ShowEditorPanels(EditorType editor_type)
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
void JumpToOverworldMap(int map_id)
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.