feat(editor): add hex editor and AI agent functionalities to MenuOrchestrator

- Implemented methods in EditorManager to show the hex editor, AI agent, and chat history, enhancing the editor's capabilities.
- Updated MenuOrchestrator to include new menu items for accessing the hex editor, AI agent, chat history, and other UI elements.
- Improved user interaction by providing quick access to essential features through keyboard shortcuts.

Benefits:
- Streamlines the user experience by integrating additional editor functionalities.
- Enhances the overall architecture by clearly defining roles for UI and editor operations within the MenuOrchestrator.
This commit is contained in:
scawful
2025-10-15 01:01:21 -04:00
parent 12480626f7
commit 5502b5246a
4 changed files with 110 additions and 3 deletions

View File

@@ -121,6 +121,21 @@ void EditorManager::HideCurrentEditorCards() {
card_manager.HideAllCardsInCategory(category);
}
void EditorManager::ShowHexEditor() {
auto& card_manager = gui::EditorCardManager::Get();
card_manager.ShowCard("memory.hex_editor");
}
#ifdef YAZE_WITH_GRPC
void EditorManager::ShowAIAgent() {
agent_editor_.set_active(true);
}
void EditorManager::ShowChatHistory() {
agent_chat_history_popup_.Toggle();
}
#endif
EditorManager::EditorManager()
: blank_editor_set_(nullptr, &user_settings_),
project_manager_(&toast_manager_),

View File

@@ -241,6 +241,19 @@ class EditorManager {
void ShowImGuiMetrics() {
if (ui_coordinator_) ui_coordinator_->SetImGuiMetricsVisible(true);
}
void ShowHexEditor();
void ShowEmulator() { show_emulator_ = true; }
void ShowCardBrowser() {
if (ui_coordinator_) ui_coordinator_->ShowCardBrowser();
}
void ShowWelcomeScreen() {
if (ui_coordinator_) ui_coordinator_->SetWelcomeScreenVisible(true);
}
#ifdef YAZE_WITH_GRPC
void ShowAIAgent();
void ShowChatHistory();
void ShowProposalDrawer() { proposal_drawer_.Show(); }
#endif
// ROM and Project operations (public for MenuOrchestrator)
absl::Status LoadRom();

View File

@@ -177,10 +177,34 @@ void MenuOrchestrator::AddViewMenuItems() {
[this]() { OnSwitchToEditor(EditorType::kPalette); }, "Ctrl+7")
.Item("Screens", ICON_MD_TV,
[this]() { OnSwitchToEditor(EditorType::kScreen); }, "Ctrl+8")
.Item("Hex Editor", ICON_MD_DATA_ARRAY,
[this]() { OnSwitchToEditor(EditorType::kHex); }, "Ctrl+9")
.Item("Assembly", ICON_MD_CODE,
[this]() { OnSwitchToEditor(EditorType::kAssembly); }, "Ctrl+0")
[this]() { OnSwitchToEditor(EditorType::kAssembly); }, "Ctrl+9")
.Item("Hex Editor", ICON_MD_DATA_ARRAY,
[this]() { OnShowHexEditor(); }, "Ctrl+0")
.Separator();
// Special Editors
#ifdef YAZE_WITH_GRPC
menu_builder_
.Item("AI Agent", ICON_MD_SMART_TOY,
[this]() { OnShowAIAgent(); }, "Ctrl+Shift+A")
.Item("Chat History", ICON_MD_CHAT,
[this]() { OnShowChatHistory(); }, "Ctrl+H")
.Item("Proposal Drawer", ICON_MD_PREVIEW,
[this]() { OnShowProposalDrawer(); }, "Ctrl+P");
#endif
menu_builder_
.Item("Emulator", ICON_MD_VIDEOGAME_ASSET,
[this]() { OnShowEmulator(); }, "Ctrl+Shift+E")
.Separator();
// Additional UI Elements
menu_builder_
.Item("Card Browser", ICON_MD_DASHBOARD,
[this]() { OnShowCardBrowser(); }, "Ctrl+Shift+B")
.Item("Welcome Screen", ICON_MD_HOME,
[this]() { OnShowWelcomeScreen(); })
.Separator();
// Display Settings
@@ -497,6 +521,51 @@ void MenuOrchestrator::OnShowDisplaySettings() {
}
}
void MenuOrchestrator::OnShowHexEditor() {
// Show hex editor card via EditorCardManager
if (editor_manager_) {
editor_manager_->ShowHexEditor();
}
}
void MenuOrchestrator::OnShowEmulator() {
if (editor_manager_) {
editor_manager_->ShowEmulator();
}
}
void MenuOrchestrator::OnShowCardBrowser() {
if (editor_manager_) {
editor_manager_->ShowCardBrowser();
}
}
void MenuOrchestrator::OnShowWelcomeScreen() {
if (editor_manager_) {
editor_manager_->ShowWelcomeScreen();
}
}
#ifdef YAZE_WITH_GRPC
void MenuOrchestrator::OnShowAIAgent() {
if (editor_manager_) {
editor_manager_->ShowAIAgent();
}
}
void MenuOrchestrator::OnShowChatHistory() {
if (editor_manager_) {
editor_manager_->ShowChatHistory();
}
}
void MenuOrchestrator::OnShowProposalDrawer() {
if (editor_manager_) {
editor_manager_->ShowProposalDrawer();
}
}
#endif
// Session management menu actions
void MenuOrchestrator::OnCreateNewSession() {
session_coordinator_.CreateNewSession();

View File

@@ -87,6 +87,16 @@ class MenuOrchestrator {
void OnSwitchToEditor(EditorType editor_type);
void OnShowEditorSelection();
void OnShowDisplaySettings();
void OnShowHexEditor();
void OnShowEmulator();
void OnShowCardBrowser();
void OnShowWelcomeScreen();
#ifdef YAZE_WITH_GRPC
void OnShowAIAgent();
void OnShowChatHistory();
void OnShowProposalDrawer();
#endif
// Session management menu actions
void OnCreateNewSession();