#include <command_palette.h>
Public Member Functions | |
| void | AddCommand (const std::string &name, const std::string &category, const std::string &description, const std::string &shortcut, std::function< void()> callback) |
| void | RecordUsage (const std::string &name) |
| std::vector< CommandEntry > | SearchCommands (const std::string &query) |
| std::vector< CommandEntry > | GetRecentCommands (int limit=10) |
| std::vector< CommandEntry > | GetFrequentCommands (int limit=10) |
| std::vector< CommandEntry > | GetAllCommands () const |
| Get all registered commands. | |
| size_t | GetCommandCount () const |
| Get command count. | |
| void | Clear () |
| Clear all commands. | |
| void | RegisterPanelCommands (PanelManager *panel_manager, size_t session_id) |
| Register all panel toggle commands from PanelManager. | |
| void | RegisterEditorCommands (std::function< void(const std::string &)> switch_callback) |
| Register all editor switch commands. | |
| void | RegisterLayoutCommands (std::function< void(const std::string &)> apply_callback) |
| Register layout preset commands. | |
| void | RegisterRecentFilesCommands (std::function< void(const std::string &)> open_callback) |
| Register commands to open recent files. | |
| void | RegisterDungeonRoomCommands (size_t session_id) |
| Register dungeon room navigation commands. | |
| void | SaveHistory (const std::string &filepath) |
| Save command usage history to disk. | |
| void | LoadHistory (const std::string &filepath) |
| Load command usage history from disk. | |
Static Public Member Functions | |
| static int | FuzzyScore (const std::string &text, const std::string &query) |
Private Attributes | |
| std::unordered_map< std::string, CommandEntry > | commands_ |
Definition at line 40 of file command_palette.h.
| void yaze::editor::CommandPalette::AddCommand | ( | const std::string & | name, |
| const std::string & | category, | ||
| const std::string & | description, | ||
| const std::string & | shortcut, | ||
| std::function< void()> | callback ) |
Definition at line 22 of file command_palette.cc.
References yaze::editor::CommandEntry::callback, yaze::editor::CommandEntry::category, commands_, yaze::editor::CommandEntry::description, yaze::editor::CommandEntry::name, and yaze::editor::CommandEntry::shortcut.
Referenced by yaze::editor::UICoordinator::InitializeCommandPalette(), RegisterDungeonRoomCommands(), RegisterEditorCommands(), RegisterLayoutCommands(), RegisterPanelCommands(), and RegisterRecentFilesCommands().
| void yaze::editor::CommandPalette::RecordUsage | ( | const std::string & | name | ) |
Definition at line 36 of file command_palette.cc.
References commands_, and yaze::editor::CommandEntry::usage_count.
Referenced by yaze::editor::UICoordinator::DrawCommandPalette(), and yaze::editor::CommandPaletteWidget::ExecuteCommand().
| std::vector< CommandEntry > yaze::editor::CommandPalette::SearchCommands | ( | const std::string & | query | ) |
Definition at line 91 of file command_palette.cc.
References commands_, and FuzzyScore().
Referenced by yaze::editor::CommandPaletteWidget::Draw().

| std::vector< CommandEntry > yaze::editor::CommandPalette::GetRecentCommands | ( | int | limit = 10 | ) |
Definition at line 132 of file command_palette.cc.
References commands_.
Referenced by yaze::editor::CommandPaletteWidget::Draw(), and yaze::editor::UICoordinator::DrawCommandPalette().
| std::vector< CommandEntry > yaze::editor::CommandPalette::GetFrequentCommands | ( | int | limit = 10 | ) |
Definition at line 153 of file command_palette.cc.
References commands_.
Referenced by yaze::editor::CommandPaletteWidget::Draw(), and yaze::editor::UICoordinator::DrawCommandPalette().
| std::vector< CommandEntry > yaze::editor::CommandPalette::GetAllCommands | ( | ) | const |
Get all registered commands.
Definition at line 236 of file command_palette.cc.
References commands_.
Referenced by yaze::editor::CommandPaletteWidget::Draw(), and yaze::editor::UICoordinator::DrawCommandPalette().
|
inline |
|
inline |
Clear all commands.
Definition at line 68 of file command_palette.h.
References commands_.
Referenced by yaze::editor::UICoordinator::InitializeCommandPalette().
| void yaze::editor::CommandPalette::RegisterPanelCommands | ( | PanelManager * | panel_manager, |
| size_t | session_id ) |
Register all panel toggle commands from PanelManager.
| panel_manager | The panel manager to query for panels |
| session_id | Current session ID for panel prefixing |
Definition at line 245 of file command_palette.cc.
References AddCommand(), yaze::editor::PanelManager::GetAllPanelDescriptors(), yaze::editor::PanelManager::HidePanel(), yaze::editor::CommandCategory::kPanel, and yaze::editor::PanelManager::TogglePanel().
Referenced by yaze::editor::UICoordinator::InitializeCommandPalette().

| void yaze::editor::CommandPalette::RegisterEditorCommands | ( | std::function< void(const std::string &)> | switch_callback | ) |
Register all editor switch commands.
| switch_callback | Callback to switch to an editor category |
Definition at line 292 of file command_palette.cc.
References AddCommand(), yaze::editor::EditorRegistry::GetAllEditorCategories(), and yaze::editor::CommandCategory::kEditor.
Referenced by yaze::editor::UICoordinator::InitializeCommandPalette().

| void yaze::editor::CommandPalette::RegisterLayoutCommands | ( | std::function< void(const std::string &)> | apply_callback | ) |
Register layout preset commands.
| apply_callback | Callback to apply a layout preset by name |
Definition at line 307 of file command_palette.cc.
References AddCommand(), and yaze::editor::CommandCategory::kLayout.

| void yaze::editor::CommandPalette::RegisterRecentFilesCommands | ( | std::function< void(const std::string &)> | open_callback | ) |
Register commands to open recent files.
| open_callback | Callback to open a file by path |
Creates "Open Recent: <filename>" commands for each file in RecentFilesManager. Files are checked for existence before registration.
Definition at line 376 of file command_palette.cc.
References AddCommand(), yaze::project::RecentFilesManager::GetInstance(), yaze::project::RecentFilesManager::GetRecentFiles(), and yaze::editor::CommandCategory::kFile.
Referenced by yaze::editor::UICoordinator::InitializeCommandPalette().

| void yaze::editor::CommandPalette::RegisterDungeonRoomCommands | ( | size_t | session_id | ) |
Register dungeon room navigation commands.
Adds one command per room ID (0x000-0x127) using the ResourceLabelProvider label (when available). Commands publish JumpToRoomRequestEvent.
Definition at line 399 of file command_palette.cc.
References AddCommand(), yaze::editor::JumpToRoomRequestEvent::Create(), yaze::editor::ContentRegistry::Context::event_bus(), yaze::zelda3::GetRoomLabel(), and yaze::editor::CommandCategory::kNavigation.
Referenced by yaze::editor::UICoordinator::InitializeCommandPalette().

| void yaze::editor::CommandPalette::SaveHistory | ( | const std::string & | filepath | ) |
Save command usage history to disk.
| filepath | Path to save JSON history file |
Definition at line 174 of file command_palette.cc.
References commands_, yaze::Json::dump(), LOG_ERROR, LOG_INFO, and yaze::Json::object().
Referenced by yaze::editor::UICoordinator::DrawCommandPalette().

| void yaze::editor::CommandPalette::LoadHistory | ( | const std::string & | filepath | ) |
Load command usage history from disk.
| filepath | Path to load JSON history file from |
Definition at line 200 of file command_palette.cc.
References commands_, yaze::Json::contains(), yaze::Json::is_object(), yaze::Json::items(), LOG_ERROR, LOG_INFO, and yaze::Json::parse().
Referenced by yaze::editor::UICoordinator::InitializeCommandPalette().

|
static |
Definition at line 47 of file command_palette.cc.
Referenced by yaze::editor::UICoordinator::DrawPanelFinder(), and SearchCommands().
|
private |
Definition at line 128 of file command_palette.h.
Referenced by AddCommand(), Clear(), GetAllCommands(), GetCommandCount(), GetFrequentCommands(), GetRecentCommands(), LoadHistory(), RecordUsage(), SaveHistory(), and SearchCommands().