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 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

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

References kEditorCategories.

◆ GetAvailableCategories()

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

Definition at line 118 of file editor_registry.cc.

References kEditorCategories.

◆ GetEditorDisplayName()

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

Definition at line 132 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 140 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 180 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 191 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 152 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 160 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 165 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 170 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 201 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 211 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 221 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 230 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 67 of file editor_registry.h.

Referenced by GetEditorDisplayName().

◆ kPanelBasedEditors

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

Definition at line 68 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 74 of file editor_registry.h.

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


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