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

Central registry for all editor cards with session awareness and dependency injection. More...

#include <editor_card_registry.h>

Classes

struct  WorkspacePreset
 

Public Member Functions

 EditorCardRegistry ()=default
 
 ~EditorCardRegistry ()=default
 
 EditorCardRegistry (const EditorCardRegistry &)=delete
 
EditorCardRegistryoperator= (const EditorCardRegistry &)=delete
 
 EditorCardRegistry (EditorCardRegistry &&)=delete
 
EditorCardRegistryoperator= (EditorCardRegistry &&)=delete
 
void RegisterSession (size_t session_id)
 Register a new session in the registry.
 
void UnregisterSession (size_t session_id)
 Unregister a session and all its cards.
 
void SetActiveSession (size_t session_id)
 Set the currently active session.
 
void RegisterCard (size_t session_id, const CardInfo &base_info)
 Register a card for a specific session.
 
void RegisterCard (size_t session_id, const std::string &card_id, const std::string &display_name, const std::string &icon, const std::string &category, const std::string &shortcut_hint="", int priority=50, std::function< void()> on_show=nullptr, std::function< void()> on_hide=nullptr, bool visible_by_default=false)
 Register a card with inline parameters (convenience method)
 
void UnregisterCard (size_t session_id, const std::string &base_card_id)
 Unregister a specific card.
 
void UnregisterCardsWithPrefix (const std::string &prefix)
 Unregister all cards with a given prefix.
 
void ClearAllCards ()
 Remove all registered cards (use with caution)
 
bool ShowCard (size_t session_id, const std::string &base_card_id)
 Show a card programmatically.
 
bool HideCard (size_t session_id, const std::string &base_card_id)
 Hide a card programmatically.
 
bool ToggleCard (size_t session_id, const std::string &base_card_id)
 Toggle a card's visibility.
 
bool IsCardVisible (size_t session_id, const std::string &base_card_id) const
 Check if a card is currently visible.
 
bool * GetVisibilityFlag (size_t session_id, const std::string &base_card_id)
 Get visibility flag pointer for a card.
 
void ShowAllCardsInSession (size_t session_id)
 Show all cards in a specific session.
 
void HideAllCardsInSession (size_t session_id)
 Hide all cards in a specific session.
 
void ShowAllCardsInCategory (size_t session_id, const std::string &category)
 Show all cards in a category for a session.
 
void HideAllCardsInCategory (size_t session_id, const std::string &category)
 Hide all cards in a category for a session.
 
void ShowOnlyCard (size_t session_id, const std::string &base_card_id)
 Show only one card, hiding all others in its category.
 
std::vector< std::string > GetCardsInSession (size_t session_id) const
 Get all cards registered for a session.
 
std::vector< CardInfoGetCardsInCategory (size_t session_id, const std::string &category) const
 Get cards in a specific category for a session.
 
std::vector< std::string > GetAllCategories (size_t session_id) const
 Get all categories for a session.
 
const CardInfoGetCardInfo (size_t session_id, const std::string &base_card_id) const
 Get card metadata.
 
std::vector< std::string > GetAllCategories () const
 Get all registered categories across all sessions.
 
void DrawViewMenuSection (size_t session_id, const std::string &category)
 Draw view menu section for a category.
 
void DrawViewMenuAll (size_t session_id)
 Draw all categories as view menu submenus.
 
void DrawSidebar (size_t session_id, const std::string &category, const std::vector< std::string > &active_categories={}, std::function< void(const std::string &)> on_category_switch=nullptr, std::function< void()> on_collapse=nullptr)
 Draw sidebar for a category with session filtering.
 
void DrawCompactCardControl (size_t session_id, const std::string &category)
 Draw compact card control for active editor's cards.
 
void DrawInlineCardToggles (size_t session_id, const std::string &category)
 Draw minimal inline card toggles.
 
void DrawCardBrowser (size_t session_id, bool *p_open)
 Draw visual card browser/toggler.
 
void SavePreset (const std::string &name, const std::string &description="")
 
bool LoadPreset (const std::string &name)
 
void DeletePreset (const std::string &name)
 
std::vector< WorkspacePresetGetPresets () const
 
void ShowAll (size_t session_id)
 
void HideAll (size_t session_id)
 
void ResetToDefaults (size_t session_id)
 
size_t GetCardCount () const
 
size_t GetVisibleCardCount (size_t session_id) const
 
size_t GetSessionCount () const
 
std::string MakeCardId (size_t session_id, const std::string &base_id) const
 Generate session-aware card ID.
 
bool ShouldPrefixCards () const
 Check if card IDs should be prefixed.
 
void RegisterCard (const CardInfo &base_info)
 Register card for active session (convenience)
 
bool ShowCard (const std::string &base_card_id)
 Show card in active session (convenience)
 
bool HideCard (const std::string &base_card_id)
 Hide card in active session (convenience)
 
bool IsCardVisible (const std::string &base_card_id) const
 Check if card is visible in active session (convenience)
 
void HideAllCardsInCategory (const std::string &category)
 Hide all cards in category for active session (convenience)
 
void DrawCardBrowser (bool *p_open)
 Draw card browser for active session (convenience)
 
std::string GetActiveCategory () const
 Get active category (for sidebar)
 
void SetActiveCategory (const std::string &category)
 Set active category (for sidebar)
 
void ShowAllCardsInCategory (const std::string &category)
 Show all cards in category for active session (convenience)
 
bool * GetVisibilityFlag (const std::string &base_card_id)
 Get visibility flag for active session (convenience)
 
void ShowAll ()
 Show all cards for active session (convenience)
 
void HideAll ()
 Hide all cards for active session (convenience)
 
void DrawSidebar (const std::string &category, const std::vector< std::string > &active_categories={}, std::function< void(const std::string &)> on_category_switch=nullptr, std::function< void()> on_collapse=nullptr)
 Draw sidebar for active session (convenience)
 

Static Public Member Functions

static constexpr float GetSidebarWidth ()
 

Private Member Functions

void UpdateSessionCount ()
 
std::string GetPrefixedCardId (size_t session_id, const std::string &base_id) const
 
void UnregisterSessionCards (size_t session_id)
 
void SavePresetsToFile ()
 
void LoadPresetsFromFile ()
 
void DrawCardMenuItem (const CardInfo &info)
 
void DrawCardInSidebar (const CardInfo &info, bool is_active)
 

Private Attributes

std::unordered_map< std::string, CardInfocards_
 
std::unordered_map< std::string, bool > centralized_visibility_
 
size_t session_count_ = 0
 
size_t active_session_ = 0
 
std::unordered_map< size_t, std::vector< std::string > > session_cards_
 
std::unordered_map< size_t, std::unordered_map< std::string, std::string > > session_card_mapping_
 
std::unordered_map< std::string, WorkspacePresetpresets_
 
std::string active_category_
 
std::vector< std::string > recent_categories_
 

Static Private Attributes

static constexpr size_t kMaxRecentCategories = 5
 

Detailed Description

Central registry for all editor cards with session awareness and dependency injection.

This class combines the functionality of EditorCardManager (global card management) and SessionCardRegistry (session-aware prefixing) into a single, dependency-injected component that can be passed to editors.

Design Philosophy:

  • Dependency injection (no singleton pattern)
  • Session-aware card ID prefixing for multi-session support
  • Centralized visibility management
  • View menu integration
  • Workspace preset system
  • No direct GUI dependency in registration logic

Session-Aware Card IDs:

  • Single session: "dungeon.room_selector"
  • Multiple sessions: "s0.dungeon.room_selector", "s1.dungeon.room_selector"

Usage:

// In EditorManager:
EditorCardRegistry card_registry;
deps.card_registry = &card_registry;
// In Editor:
.card_id = "dungeon.room_selector",
.display_name = "Room Selector",
.icon = ICON_MD_LIST,
.category = "Dungeon",
.on_show = []() { }
});
// Programmatic control:
deps.card_registry->ShowCard(deps.session_id, "dungeon.room_selector");
Central registry for all editor cards with session awareness and dependency injection.
void RegisterCard(size_t session_id, const CardInfo &base_info)
Register a card for a specific session.
bool ShowCard(size_t session_id, const std::string &base_card_id)
Show a card programmatically.
Unified dependency container for all editor types.
Definition editor.h:64
EditorCardRegistry * card_registry
Definition editor.h:80

Definition at line 78 of file editor_card_registry.h.

Constructor & Destructor Documentation

◆ EditorCardRegistry() [1/3]

yaze::editor::EditorCardRegistry::EditorCardRegistry ( )
default

◆ ~EditorCardRegistry()

yaze::editor::EditorCardRegistry::~EditorCardRegistry ( )
default

◆ EditorCardRegistry() [2/3]

yaze::editor::EditorCardRegistry::EditorCardRegistry ( const EditorCardRegistry )
delete

◆ EditorCardRegistry() [3/3]

yaze::editor::EditorCardRegistry::EditorCardRegistry ( EditorCardRegistry &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

EditorCardRegistry & yaze::editor::EditorCardRegistry::operator= ( const EditorCardRegistry )
delete

◆ operator=() [2/2]

EditorCardRegistry & yaze::editor::EditorCardRegistry::operator= ( EditorCardRegistry &&  )
delete

◆ RegisterSession()

void yaze::editor::EditorCardRegistry::RegisterSession ( size_t  session_id)

Register a new session in the registry.

Parameters
session_idUnique session identifier

Creates internal tracking structures for the session. Must be called before registering cards for a session.

Definition at line 18 of file editor_card_registry.cc.

References LOG_INFO, session_card_mapping_, session_cards_, session_count_, and UpdateSessionCount().

Referenced by RegisterCard().

Here is the call graph for this function:

◆ UnregisterSession()

void yaze::editor::EditorCardRegistry::UnregisterSession ( size_t  session_id)

Unregister a session and all its cards.

Parameters
session_idSession identifier to remove

Automatically unregisters all cards associated with the session.

Definition at line 27 of file editor_card_registry.cc.

References active_session_, LOG_INFO, session_card_mapping_, session_cards_, session_count_, UnregisterSessionCards(), and UpdateSessionCount().

Referenced by yaze::editor::SessionCoordinator::ClearAllSessions(), and yaze::editor::SessionCoordinator::CloseSession().

Here is the call graph for this function:

◆ SetActiveSession()

void yaze::editor::EditorCardRegistry::SetActiveSession ( size_t  session_id)

Set the currently active session.

Parameters
session_idSession to make active

Used for determining whether to apply card ID prefixing.

Definition at line 47 of file editor_card_registry.cc.

References active_session_, and session_cards_.

Referenced by yaze::editor::SessionCoordinator::SwitchToSession().

◆ RegisterCard() [1/3]

void yaze::editor::EditorCardRegistry::RegisterCard ( size_t  session_id,
const CardInfo base_info 
)

◆ RegisterCard() [2/3]

void yaze::editor::EditorCardRegistry::RegisterCard ( size_t  session_id,
const std::string &  card_id,
const std::string &  display_name,
const std::string &  icon,
const std::string &  category,
const std::string &  shortcut_hint = "",
int  priority = 50,
std::function< void()>  on_show = nullptr,
std::function< void()>  on_hide = nullptr,
bool  visible_by_default = false 
)

◆ UnregisterCard()

void yaze::editor::EditorCardRegistry::UnregisterCard ( size_t  session_id,
const std::string &  base_card_id 
)

Unregister a specific card.

Parameters
session_idSession the card belongs to
base_card_idUnprefixed card ID

Definition at line 117 of file editor_card_registry.cc.

References cards_, centralized_visibility_, GetPrefixedCardId(), LOG_INFO, session_card_mapping_, and session_cards_.

Here is the call graph for this function:

◆ UnregisterCardsWithPrefix()

void yaze::editor::EditorCardRegistry::UnregisterCardsWithPrefix ( const std::string &  prefix)

Unregister all cards with a given prefix.

Parameters
prefixPrefix to match (e.g., "s0" or "s1.dungeon")

Useful for cleaning up session cards or category cards.

Definition at line 139 of file editor_card_registry.cc.

References cards_, centralized_visibility_, LOG_INFO, and session_cards_.

◆ ClearAllCards()

void yaze::editor::EditorCardRegistry::ClearAllCards ( )

Remove all registered cards (use with caution)

Definition at line 167 of file editor_card_registry.cc.

References cards_, centralized_visibility_, LOG_INFO, session_card_mapping_, session_cards_, and session_count_.

◆ ShowCard() [1/2]

bool yaze::editor::EditorCardRegistry::ShowCard ( size_t  session_id,
const std::string &  base_card_id 
)

Show a card programmatically.

Parameters
session_idSession the card belongs to
base_card_idUnprefixed card ID
Returns
true if card was found and shown

Definition at line 180 of file editor_card_registry.cc.

References cards_, and GetPrefixedCardId().

Referenced by yaze::editor::UICoordinator::DrawContextSensitiveCardControl(), yaze::editor::EditorManager::Initialize(), RegisterCard(), ShowCard(), yaze::editor::EditorManager::ShowHexEditor(), and ShowOnlyCard().

Here is the call graph for this function:

◆ HideCard() [1/2]

bool yaze::editor::EditorCardRegistry::HideCard ( size_t  session_id,
const std::string &  base_card_id 
)

Hide a card programmatically.

Definition at line 199 of file editor_card_registry.cc.

References cards_, and GetPrefixedCardId().

Referenced by yaze::editor::UICoordinator::DrawContextSensitiveCardControl(), and HideCard().

Here is the call graph for this function:

◆ ToggleCard()

bool yaze::editor::EditorCardRegistry::ToggleCard ( size_t  session_id,
const std::string &  base_card_id 
)

Toggle a card's visibility.

Definition at line 218 of file editor_card_registry.cc.

References cards_, and GetPrefixedCardId().

Referenced by DrawCompactCardControl(), and DrawSidebar().

Here is the call graph for this function:

◆ IsCardVisible() [1/2]

bool yaze::editor::EditorCardRegistry::IsCardVisible ( size_t  session_id,
const std::string &  base_card_id 
) const

Check if a card is currently visible.

Definition at line 239 of file editor_card_registry.cc.

References cards_, and GetPrefixedCardId().

Referenced by IsCardVisible().

Here is the call graph for this function:

◆ GetVisibilityFlag() [1/2]

bool * yaze::editor::EditorCardRegistry::GetVisibilityFlag ( size_t  session_id,
const std::string &  base_card_id 
)

Get visibility flag pointer for a card.

Returns
Pointer to bool controlling card visibility (for passing to EditorCard::Begin)

Definition at line 252 of file editor_card_registry.cc.

References cards_, and GetPrefixedCardId().

Referenced by yaze::editor::EditorManager::DrawMenuBar(), GetVisibilityFlag(), yaze::emu::Emulator::RenderEmulatorInterface(), yaze::editor::MessageEditor::Update(), and yaze::editor::SettingsEditor::Update().

Here is the call graph for this function:

◆ ShowAllCardsInSession()

void yaze::editor::EditorCardRegistry::ShowAllCardsInSession ( size_t  session_id)

Show all cards in a specific session.

Definition at line 269 of file editor_card_registry.cc.

References cards_, and session_cards_.

Referenced by ShowAll(), and yaze::editor::SessionCoordinator::ShowAllCardsInActiveSession().

◆ HideAllCardsInSession()

void yaze::editor::EditorCardRegistry::HideAllCardsInSession ( size_t  session_id)

Hide all cards in a specific session.

Definition at line 284 of file editor_card_registry.cc.

References cards_, and session_cards_.

Referenced by HideAll(), yaze::editor::SessionCoordinator::HideAllCardsInActiveSession(), and ResetToDefaults().

◆ ShowAllCardsInCategory() [1/2]

void yaze::editor::EditorCardRegistry::ShowAllCardsInCategory ( size_t  session_id,
const std::string &  category 
)

Show all cards in a category for a session.

Definition at line 299 of file editor_card_registry.cc.

References cards_, and session_cards_.

Referenced by DrawSidebar(), ShowAllCardsInCategory(), and yaze::editor::SessionCoordinator::ShowCardsInCategory().

◆ HideAllCardsInCategory() [1/2]

void yaze::editor::EditorCardRegistry::HideAllCardsInCategory ( size_t  session_id,
const std::string &  category 
)

◆ ShowOnlyCard()

void yaze::editor::EditorCardRegistry::ShowOnlyCard ( size_t  session_id,
const std::string &  base_card_id 
)

Show only one card, hiding all others in its category.

Definition at line 333 of file editor_card_registry.cc.

References cards_, GetPrefixedCardId(), HideAllCardsInCategory(), and ShowCard().

Here is the call graph for this function:

◆ GetCardsInSession()

std::vector< std::string > yaze::editor::EditorCardRegistry::GetCardsInSession ( size_t  session_id) const

Get all cards registered for a session.

Returns
Vector of prefixed card IDs

Definition at line 358 of file editor_card_registry.cc.

References session_cards_.

Referenced by DrawCardBrowser().

◆ GetCardsInCategory()

std::vector< CardInfo > yaze::editor::EditorCardRegistry::GetCardsInCategory ( size_t  session_id,
const std::string &  category 
) const

◆ GetAllCategories() [1/2]

std::vector< std::string > yaze::editor::EditorCardRegistry::GetAllCategories ( size_t  session_id) const

Get all categories for a session.

Definition at line 389 of file editor_card_registry.cc.

References cards_, and session_cards_.

◆ GetCardInfo()

const CardInfo * yaze::editor::EditorCardRegistry::GetCardInfo ( size_t  session_id,
const std::string &  base_card_id 
) const

Get card metadata.

Parameters
session_idSession the card belongs to
base_card_idUnprefixed card ID

Definition at line 407 of file editor_card_registry.cc.

References cards_, and GetPrefixedCardId().

Here is the call graph for this function:

◆ GetAllCategories() [2/2]

std::vector< std::string > yaze::editor::EditorCardRegistry::GetAllCategories ( ) const

Get all registered categories across all sessions.

Definition at line 421 of file editor_card_registry.cc.

References cards_.

Referenced by DrawCardBrowser(), and DrawViewMenuAll().

◆ DrawViewMenuSection()

void yaze::editor::EditorCardRegistry::DrawViewMenuSection ( size_t  session_id,
const std::string &  category 
)

Draw view menu section for a category.

Definition at line 436 of file editor_card_registry.cc.

References DrawCardMenuItem(), and GetCardsInCategory().

Referenced by DrawViewMenuAll().

Here is the call graph for this function:

◆ DrawViewMenuAll()

void yaze::editor::EditorCardRegistry::DrawViewMenuAll ( size_t  session_id)

Draw all categories as view menu submenus.

Definition at line 451 of file editor_card_registry.cc.

References DrawViewMenuSection(), and GetAllCategories().

Here is the call graph for this function:

◆ DrawSidebar() [1/2]

void yaze::editor::EditorCardRegistry::DrawSidebar ( size_t  session_id,
const std::string &  category,
const std::vector< std::string > &  active_categories = {},
std::function< void(const std::string &)>  on_category_switch = nullptr,
std::function< void()>  on_collapse = nullptr 
)

◆ GetSidebarWidth()

static constexpr float yaze::editor::EditorCardRegistry::GetSidebarWidth ( )
inlinestaticconstexpr

Definition at line 287 of file editor_card_registry.h.

Referenced by DrawSidebar().

◆ DrawCompactCardControl()

void yaze::editor::EditorCardRegistry::DrawCompactCardControl ( size_t  session_id,
const std::string &  category 
)

Draw compact card control for active editor's cards.

Definition at line 660 of file editor_card_registry.cc.

References GetCardsInCategory(), ICON_MD_DASHBOARD, and ToggleCard().

Here is the call graph for this function:

◆ DrawInlineCardToggles()

void yaze::editor::EditorCardRegistry::DrawInlineCardToggles ( size_t  session_id,
const std::string &  category 
)

Draw minimal inline card toggles.

Definition at line 681 of file editor_card_registry.cc.

References GetCardsInCategory().

Here is the call graph for this function:

◆ DrawCardBrowser() [1/2]

void yaze::editor::EditorCardRegistry::DrawCardBrowser ( size_t  session_id,
bool *  p_open 
)

Draw visual card browser/toggler.

Definition at line 698 of file editor_card_registry.cc.

References cards_, GetAllCategories(), GetCardsInCategory(), GetCardsInSession(), ICON_MD_DASHBOARD, and ICON_MD_SEARCH.

Referenced by DrawCardBrowser(), and yaze::editor::EditorManager::Update().

Here is the call graph for this function:

◆ SavePreset()

void yaze::editor::EditorCardRegistry::SavePreset ( const std::string &  name,
const std::string &  description = "" 
)

◆ LoadPreset()

bool yaze::editor::EditorCardRegistry::LoadPreset ( const std::string &  name)

Definition at line 828 of file editor_card_registry.cc.

References cards_, LOG_INFO, and presets_.

◆ DeletePreset()

void yaze::editor::EditorCardRegistry::DeletePreset ( const std::string &  name)

Definition at line 856 of file editor_card_registry.cc.

References presets_, and SavePresetsToFile().

Here is the call graph for this function:

◆ GetPresets()

std::vector< EditorCardRegistry::WorkspacePreset > yaze::editor::EditorCardRegistry::GetPresets ( ) const

Definition at line 861 of file editor_card_registry.cc.

References presets_.

◆ ShowAll() [1/2]

void yaze::editor::EditorCardRegistry::ShowAll ( size_t  session_id)

Definition at line 873 of file editor_card_registry.cc.

References ShowAllCardsInSession().

Referenced by yaze::editor::WorkspaceManager::ShowAllWindows().

Here is the call graph for this function:

◆ HideAll() [1/2]

void yaze::editor::EditorCardRegistry::HideAll ( size_t  session_id)

Definition at line 877 of file editor_card_registry.cc.

References HideAllCardsInSession().

Referenced by yaze::editor::WorkspaceManager::HideAllWindows().

Here is the call graph for this function:

◆ ResetToDefaults()

void yaze::editor::EditorCardRegistry::ResetToDefaults ( size_t  session_id)
Todo:
Load default visibility from config file or hardcoded defaults

Definition at line 881 of file editor_card_registry.cc.

References HideAllCardsInSession(), and LOG_INFO.

Here is the call graph for this function:

◆ GetCardCount()

size_t yaze::editor::EditorCardRegistry::GetCardCount ( ) const
inline

Definition at line 339 of file editor_card_registry.h.

References cards_.

◆ GetVisibleCardCount()

size_t yaze::editor::EditorCardRegistry::GetVisibleCardCount ( size_t  session_id) const

Definition at line 893 of file editor_card_registry.cc.

References cards_, and session_cards_.

◆ GetSessionCount()

size_t yaze::editor::EditorCardRegistry::GetSessionCount ( ) const
inline

Definition at line 341 of file editor_card_registry.h.

References session_count_.

◆ MakeCardId()

std::string yaze::editor::EditorCardRegistry::MakeCardId ( size_t  session_id,
const std::string &  base_id 
) const

Generate session-aware card ID.

Parameters
session_idSession identifier
base_idUnprefixed card ID
Returns
Prefixed ID if multiple sessions, otherwise base ID

Examples:

  • Single session: "dungeon.room_selector" → "dungeon.room_selector"
  • Multi-session: "dungeon.room_selector" → "s0.dungeon.room_selector"

Definition at line 913 of file editor_card_registry.cc.

References ShouldPrefixCards().

Referenced by RegisterCard().

Here is the call graph for this function:

◆ ShouldPrefixCards()

bool yaze::editor::EditorCardRegistry::ShouldPrefixCards ( ) const
inline

Check if card IDs should be prefixed.

Returns
true if session_count > 1

Definition at line 363 of file editor_card_registry.h.

References session_count_.

Referenced by MakeCardId().

◆ RegisterCard() [3/3]

void yaze::editor::EditorCardRegistry::RegisterCard ( const CardInfo base_info)
inline

Register card for active session (convenience)

Definition at line 372 of file editor_card_registry.h.

References active_session_, and RegisterCard().

Here is the call graph for this function:

◆ ShowCard() [2/2]

bool yaze::editor::EditorCardRegistry::ShowCard ( const std::string &  base_card_id)
inline

Show card in active session (convenience)

Definition at line 379 of file editor_card_registry.h.

References active_session_, and ShowCard().

Here is the call graph for this function:

◆ HideCard() [2/2]

bool yaze::editor::EditorCardRegistry::HideCard ( const std::string &  base_card_id)
inline

Hide card in active session (convenience)

Definition at line 386 of file editor_card_registry.h.

References active_session_, and HideCard().

Here is the call graph for this function:

◆ IsCardVisible() [2/2]

bool yaze::editor::EditorCardRegistry::IsCardVisible ( const std::string &  base_card_id) const
inline

Check if card is visible in active session (convenience)

Definition at line 393 of file editor_card_registry.h.

References active_session_, and IsCardVisible().

Here is the call graph for this function:

◆ HideAllCardsInCategory() [2/2]

void yaze::editor::EditorCardRegistry::HideAllCardsInCategory ( const std::string &  category)
inline

Hide all cards in category for active session (convenience)

Definition at line 400 of file editor_card_registry.h.

References active_session_, and HideAllCardsInCategory().

Here is the call graph for this function:

◆ DrawCardBrowser() [2/2]

void yaze::editor::EditorCardRegistry::DrawCardBrowser ( bool *  p_open)
inline

Draw card browser for active session (convenience)

Definition at line 407 of file editor_card_registry.h.

References active_session_, and DrawCardBrowser().

Here is the call graph for this function:

◆ GetActiveCategory()

std::string yaze::editor::EditorCardRegistry::GetActiveCategory ( ) const
inline

Get active category (for sidebar)

Definition at line 414 of file editor_card_registry.h.

References active_category_.

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

◆ SetActiveCategory()

void yaze::editor::EditorCardRegistry::SetActiveCategory ( const std::string &  category)
inline

Set active category (for sidebar)

Definition at line 419 of file editor_card_registry.h.

References active_category_.

Referenced by DrawSidebar(), yaze::editor::EditorManager::SwitchToEditor(), and yaze::editor::EditorManager::Update().

◆ ShowAllCardsInCategory() [2/2]

void yaze::editor::EditorCardRegistry::ShowAllCardsInCategory ( const std::string &  category)
inline

Show all cards in category for active session (convenience)

Definition at line 424 of file editor_card_registry.h.

References active_session_, and ShowAllCardsInCategory().

Here is the call graph for this function:

◆ GetVisibilityFlag() [2/2]

bool * yaze::editor::EditorCardRegistry::GetVisibilityFlag ( const std::string &  base_card_id)
inline

Get visibility flag for active session (convenience)

Definition at line 431 of file editor_card_registry.h.

References active_session_, and GetVisibilityFlag().

Here is the call graph for this function:

◆ ShowAll() [2/2]

void yaze::editor::EditorCardRegistry::ShowAll ( )
inline

Show all cards for active session (convenience)

Definition at line 438 of file editor_card_registry.h.

References active_session_, and ShowAll().

Referenced by ShowAll().

Here is the call graph for this function:

◆ HideAll() [2/2]

void yaze::editor::EditorCardRegistry::HideAll ( )
inline

Hide all cards for active session (convenience)

Definition at line 445 of file editor_card_registry.h.

References active_session_, and HideAll().

Referenced by HideAll().

Here is the call graph for this function:

◆ DrawSidebar() [2/2]

void yaze::editor::EditorCardRegistry::DrawSidebar ( const std::string &  category,
const std::vector< std::string > &  active_categories = {},
std::function< void(const std::string &)>  on_category_switch = nullptr,
std::function< void()>  on_collapse = nullptr 
)
inline

Draw sidebar for active session (convenience)

Definition at line 452 of file editor_card_registry.h.

◆ UpdateSessionCount()

void yaze::editor::EditorCardRegistry::UpdateSessionCount ( )
private

Definition at line 924 of file editor_card_registry.cc.

References session_cards_, and session_count_.

Referenced by RegisterSession(), and UnregisterSession().

◆ GetPrefixedCardId()

std::string yaze::editor::EditorCardRegistry::GetPrefixedCardId ( size_t  session_id,
const std::string &  base_id 
) const
private

◆ UnregisterSessionCards()

void yaze::editor::EditorCardRegistry::UnregisterSessionCards ( size_t  session_id)
private

Definition at line 946 of file editor_card_registry.cc.

References cards_, centralized_visibility_, and session_cards_.

Referenced by UnregisterSession().

◆ SavePresetsToFile()

void yaze::editor::EditorCardRegistry::SavePresetsToFile ( )
private
Todo:
Implement file I/O for presets

Definition at line 956 of file editor_card_registry.cc.

References LOG_INFO.

Referenced by DeletePreset(), and SavePreset().

◆ LoadPresetsFromFile()

void yaze::editor::EditorCardRegistry::LoadPresetsFromFile ( )
private
Todo:
Implement file I/O for presets

Definition at line 961 of file editor_card_registry.cc.

References LOG_INFO.

◆ DrawCardMenuItem()

◆ DrawCardInSidebar()

void yaze::editor::EditorCardRegistry::DrawCardInSidebar ( const CardInfo info,
bool  is_active 
)
private

Member Data Documentation

◆ cards_

◆ centralized_visibility_

std::unordered_map<std::string, bool> yaze::editor::EditorCardRegistry::centralized_visibility_
private

◆ session_count_

size_t yaze::editor::EditorCardRegistry::session_count_ = 0
private

◆ active_session_

size_t yaze::editor::EditorCardRegistry::active_session_ = 0
private

◆ session_cards_

◆ session_card_mapping_

std::unordered_map<size_t, std::unordered_map<std::string, std::string> > yaze::editor::EditorCardRegistry::session_card_mapping_
private

◆ presets_

std::unordered_map<std::string, WorkspacePreset> yaze::editor::EditorCardRegistry::presets_
private

Definition at line 477 of file editor_card_registry.h.

Referenced by DeletePreset(), GetPresets(), LoadPreset(), and SavePreset().

◆ active_category_

std::string yaze::editor::EditorCardRegistry::active_category_
private

Definition at line 480 of file editor_card_registry.h.

Referenced by GetActiveCategory(), and SetActiveCategory().

◆ recent_categories_

std::vector<std::string> yaze::editor::EditorCardRegistry::recent_categories_
private

Definition at line 481 of file editor_card_registry.h.

◆ kMaxRecentCategories

constexpr size_t yaze::editor::EditorCardRegistry::kMaxRecentCategories = 5
staticconstexprprivate

Definition at line 482 of file editor_card_registry.h.


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