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< EditorTypeGetEditorsInCategory (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)
 
EditorGetEditor (EditorType type) const
 
void RegisterFactory (EditorType type, EditorFactory factory)
 
void UnregisterFactory (EditorType type)
 
bool HasFactory (EditorType type) const
 
std::unique_ptr< EditorCreateEditor (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 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, EditorFactoryeditor_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 24 of file editor_registry.h.

Member Typedef Documentation

◆ EditorFactory

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

Definition at line 26 of file editor_registry.h.

Constructor & Destructor Documentation

◆ EditorRegistry()

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

◆ ~EditorRegistry()

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

Member Function Documentation

◆ IsPanelBasedEditor()

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

◆ 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 65 of file editor_registry.cc.

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

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

◆ 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 104 of file editor_registry.cc.

Referenced by yaze::editor::EditorManager::DrawInterface(), and yaze::editor::CommandPalette::RegisterEditorCommands().

◆ GetEditorsInCategory()

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

Definition at line 123 of file editor_registry.cc.

References kEditorCategories.

◆ GetAvailableCategories()

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

Definition at line 136 of file editor_registry.cc.

References kEditorCategories.

◆ GetEditorDisplayName()

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

Definition at line 150 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 158 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 198 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 209 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 170 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 178 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 183 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 188 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 219 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 229 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 239 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 248 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"}}

Definition at line 73 of file editor_registry.h.

Referenced by GetEditorDisplayName(), and GetEditorName().

◆ kPanelBasedEditors

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

Definition at line 74 of file editor_registry.h.

Referenced by IsPanelBasedEditor().

◆ 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 80 of file editor_registry.h.

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


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