yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::EditorRegistry Class Reference

Manages editor types, categories, and lifecycle. More...

#include <editor_registry.h>

Public Types

using EditorFactory = std::function<std::unique_ptr<Editor>(Rom*)>
 

Public Member Functions

 EditorRegistry ()=default
 
 ~EditorRegistry ()=default
 
std::vector< EditorType > GetEditorsInCategory (const std::string &category) const
 
std::vector< std::string > GetAvailableCategories () const
 
std::string GetEditorDisplayName (EditorType type) const
 
void RegisterEditor (EditorType type, Editor *editor)
 
void UnregisterEditor (EditorType type)
 
Editor * GetEditor (EditorType type) const
 
void RegisterFactory (EditorType type, EditorFactory factory)
 
void UnregisterFactory (EditorType type)
 
bool HasFactory (EditorType type) const
 
std::unique_ptr< Editor > CreateEditor (EditorType type, Rom *rom) const
 
bool IsEditorActive (EditorType type) const
 
bool IsEditorVisible (EditorType type) const
 
void SetEditorActive (EditorType type, bool active)
 

Static Public Member Functions

static bool IsPanelBasedEditor (EditorType type)
 
static bool UpdateAllowedWithoutLoadedRom (EditorType type)
 
static bool IsExperimentalEditor (EditorType type)
 
static EditorExperimentPolicy GetExperimentPolicy (EditorType type)
 
static bool ShouldWarnAboutExperimentalEditor (EditorType type, bool experiments_enabled)
 
static std::string GetEditorName (EditorType type)
 
static std::string GetEditorCategory (EditorType type)
 
static EditorType GetEditorTypeFromCategory (const std::string &category)
 
static std::vector< std::string > GetAllEditorCategories ()
 Get all editor categories in display order for sidebar.
 

Private Member Functions

bool IsValidEditorType (EditorType type) const
 
void ValidateEditorType (EditorType type) const
 

Private Attributes

std::unordered_map< EditorType, Editor * > registered_editors_
 
std::unordered_map< EditorType, EditorFactory > editor_factories_
 

Static Private Attributes

static const std::unordered_map< EditorType, std::string > kEditorCategories
 
static const std::unordered_map< EditorType, std::string > kEditorNames
 
static const std::unordered_map< EditorType, bool > kPanelBasedEditors
 

Detailed Description

Manages editor types, categories, and lifecycle.

Extracted from EditorManager to provide focused editor management:

  • Editor type classification and categorization
  • Editor registration + factories (EditorSet/session creation)
  • Lightweight editor state queries (active/visible)

Definition at line 36 of file editor_registry.h.

Member Typedef Documentation

◆ EditorFactory

using yaze::editor::EditorRegistry::EditorFactory = std::function<std::unique_ptr<Editor>(Rom*)>

Definition at line 38 of file editor_registry.h.

Constructor & Destructor Documentation

◆ EditorRegistry()

yaze::editor::EditorRegistry::EditorRegistry ( )
default

◆ ~EditorRegistry()

yaze::editor::EditorRegistry::~EditorRegistry ( )
default

Member Function Documentation

◆ IsPanelBasedEditor()

◆ UpdateAllowedWithoutLoadedRom()

bool yaze::editor::EditorRegistry::UpdateAllowedWithoutLoadedRom ( EditorType type)
static

Editors that can Initialize()/Update() on an active session before a ROM is loaded (e.g. Graphics prototype lab, Assembly folder editing).

Definition at line 68 of file editor_registry.cc.

References yaze::editor::kAssembly, yaze::editor::kGraphics, and yaze::editor::kPlanning.

Referenced by yaze::editor::EditorManager::EnsureEditorAssetsLoaded(), and yaze::editor::SessionCoordinator::UpdateSessions().

◆ IsExperimentalEditor()

bool yaze::editor::EditorRegistry::IsExperimentalEditor ( EditorType type)
static

Editors still marked experimental/in-development. Never a visibility gate.

Definition at line 79 of file editor_registry.cc.

References yaze::editor::EditorExperimentPolicy::experimental, and GetExperimentPolicy().

Here is the call graph for this function:

◆ GetExperimentPolicy()

◆ ShouldWarnAboutExperimentalEditor()

bool yaze::editor::EditorRegistry::ShouldWarnAboutExperimentalEditor ( EditorType type,
bool experiments_enabled )
static

◆ GetEditorName()

std::string yaze::editor::EditorRegistry::GetEditorName ( EditorType type)
static

◆ GetEditorCategory()

◆ GetEditorTypeFromCategory()

◆ GetAllEditorCategories()

std::vector< std::string > yaze::editor::EditorRegistry::GetAllEditorCategories ( )
static

Get all editor categories in display order for sidebar.

Returns
Vector of category names in preferred display order

Definition at line 139 of file editor_registry.cc.

Referenced by yaze::editor::EditorManager::DrawInterface().

◆ GetEditorsInCategory()

std::vector< EditorType > yaze::editor::EditorRegistry::GetEditorsInCategory ( const std::string & category) const

Definition at line 159 of file editor_registry.cc.

References kEditorCategories.

◆ GetAvailableCategories()

std::vector< std::string > yaze::editor::EditorRegistry::GetAvailableCategories ( ) const

Definition at line 172 of file editor_registry.cc.

References kEditorCategories.

◆ GetEditorDisplayName()

std::string yaze::editor::EditorRegistry::GetEditorDisplayName ( EditorType type) const

Definition at line 186 of file editor_registry.cc.

References kEditorNames.

Referenced by RegisterEditor(), and UnregisterEditor().

◆ RegisterEditor()

void yaze::editor::EditorRegistry::RegisterEditor ( EditorType type,
Editor * editor )

Definition at line 194 of file editor_registry.cc.

References GetEditorDisplayName(), registered_editors_, and ValidateEditorType().

Here is the call graph for this function:

◆ UnregisterEditor()

void yaze::editor::EditorRegistry::UnregisterEditor ( EditorType type)

Definition at line 234 of file editor_registry.cc.

References GetEditorDisplayName(), registered_editors_, and ValidateEditorType().

Here is the call graph for this function:

◆ GetEditor()

Editor * yaze::editor::EditorRegistry::GetEditor ( EditorType type) const

Definition at line 245 of file editor_registry.cc.

References registered_editors_, and ValidateEditorType().

Here is the call graph for this function:

◆ RegisterFactory()

void yaze::editor::EditorRegistry::RegisterFactory ( EditorType type,
EditorFactory factory )

Definition at line 206 of file editor_registry.cc.

References editor_factories_, and ValidateEditorType().

Referenced by yaze::editor::RegisterDefaultEditorFactories().

Here is the call graph for this function:

◆ UnregisterFactory()

void yaze::editor::EditorRegistry::UnregisterFactory ( EditorType type)

Definition at line 214 of file editor_registry.cc.

References editor_factories_, and ValidateEditorType().

Here is the call graph for this function:

◆ HasFactory()

bool yaze::editor::EditorRegistry::HasFactory ( EditorType type) const

Definition at line 219 of file editor_registry.cc.

References editor_factories_, and ValidateEditorType().

Here is the call graph for this function:

◆ CreateEditor()

std::unique_ptr< Editor > yaze::editor::EditorRegistry::CreateEditor ( EditorType type,
Rom * rom ) const

Definition at line 224 of file editor_registry.cc.

References editor_factories_, and ValidateEditorType().

Referenced by yaze::editor::EditorSet::EditorSet().

Here is the call graph for this function:

◆ IsEditorActive()

bool yaze::editor::EditorRegistry::IsEditorActive ( EditorType type) const

Definition at line 255 of file editor_registry.cc.

References registered_editors_, and ValidateEditorType().

Here is the call graph for this function:

◆ IsEditorVisible()

bool yaze::editor::EditorRegistry::IsEditorVisible ( EditorType type) const

Definition at line 265 of file editor_registry.cc.

References registered_editors_, and ValidateEditorType().

Here is the call graph for this function:

◆ SetEditorActive()

void yaze::editor::EditorRegistry::SetEditorActive ( EditorType type,
bool active )

Definition at line 275 of file editor_registry.cc.

References registered_editors_, and ValidateEditorType().

Here is the call graph for this function:

◆ IsValidEditorType()

bool yaze::editor::EditorRegistry::IsValidEditorType ( EditorType type) const
private

Definition at line 284 of file editor_registry.cc.

References kEditorCategories.

Referenced by ValidateEditorType().

◆ ValidateEditorType()

void yaze::editor::EditorRegistry::ValidateEditorType ( EditorType type) const
private

Member Data Documentation

◆ kEditorCategories

◆ kEditorNames

const std::unordered_map< EditorType, std::string > yaze::editor::EditorRegistry::kEditorNames
staticprivate
Initial value:
=
{{EditorType::kDungeon, "Dungeon Editor"},
{EditorType::kOverworld, "Overworld Editor"},
{EditorType::kGraphics, "Graphics Editor"},
{EditorType::kPalette, "Palette Editor"},
{EditorType::kSprite, "Sprite Editor"},
{EditorType::kScreen, "Screen Editor"},
{EditorType::kMessage, "Message Editor"},
{EditorType::kMusic, "Music Editor"},
{EditorType::kAssembly, "Assembly Editor"},
{EditorType::kEmulator, "Emulator Editor"},
{EditorType::kHex, "Hex Editor"},
{EditorType::kAgent, "Agent Editor"},
{EditorType::kSettings, "Settings Editor"},
{EditorType::kPlanning, "Planning Editor"}}

Definition at line 90 of file editor_registry.h.

Referenced by GetEditorDisplayName(), and GetEditorName().

◆ kPanelBasedEditors

const std::unordered_map< EditorType, bool > yaze::editor::EditorRegistry::kPanelBasedEditors
staticprivate

◆ registered_editors_

std::unordered_map<EditorType, Editor*> yaze::editor::EditorRegistry::registered_editors_
private

◆ editor_factories_

std::unordered_map<EditorType, EditorFactory> yaze::editor::EditorRegistry::editor_factories_
private

Definition at line 97 of file editor_registry.h.

Referenced by CreateEditor(), HasFactory(), RegisterFactory(), and UnregisterFactory().


The documentation for this class was generated from the following files: