3#include "absl/strings/str_format.h"
22#define SHORTCUT_CTRL(key) gui::FormatCtrlShortcut(ImGuiKey_##key).c_str()
23#define SHORTCUT_CTRL_SHIFT(key) gui::FormatCtrlShiftShortcut(ImGuiKey_##key).c_str()
33 : editor_manager_(editor_manager),
34 menu_builder_(menu_builder),
35 rom_manager_(rom_manager),
36 project_manager_(project_manager),
37 editor_registry_(editor_registry),
38 session_coordinator_(session_coordinator),
39 toast_manager_(toast_manager),
40 popup_manager_(popup_manager) {}
222 if (all_categories.empty()) {
229 if (!active_category.empty()) {
231 if (!cards.empty()) {
232 ImGui::TextDisabled(
"%s", active_category.c_str());
233 for (
const auto& card : cards) {
235 const char* shortcut = card.shortcut_hint.empty() ? nullptr : card.shortcut_hint.c_str();
236 if (ImGui::MenuItem(card.display_name.c_str(), shortcut, &is_visible)) {
245 if (ImGui::BeginMenu(
"All Categories")) {
246 for (
const auto& category : all_categories) {
251 if (ImGui::BeginMenu(category.c_str())) {
253 for (
const auto& card : cards) {
255 const char* shortcut = card.shortcut_hint.empty() ? nullptr : card.shortcut_hint.c_str();
256 if (ImGui::MenuItem(card.display_name.c_str(), shortcut, &is_visible)) {
341 [
this]() { OnShowProposalDrawer(); })
346#ifdef YAZE_ENABLE_TESTING
354 [
this]() { OnRunIntegrationTests(); })
371 [
this]() { OnStartCollaboration(); })
373 [
this]() { OnJoinCollaboration(); })
375 [
this]() { OnShowNetworkStatus(); })
410 const auto layout_actions_enabled = [
this]() {
return HasCurrentEditor(); };
411 const auto apply_preset = [
this](
const char* preset_name) {
416 const auto reset_editor_layout = [
this]() {
433 [reset_editor_layout]() { reset_editor_layout(); },
nullptr,
434 layout_actions_enabled)
437 [apply_preset]() { apply_preset(
"Minimal"); },
nullptr,
438 layout_actions_enabled)
440 [apply_preset]() { apply_preset(
"Developer"); },
nullptr,
441 layout_actions_enabled)
443 [apply_preset]() { apply_preset(
"Designer"); },
nullptr,
444 layout_actions_enabled)
446 [apply_preset]() { apply_preset(
"Modder"); },
nullptr,
447 layout_actions_enabled)
449 [apply_preset]() { apply_preset(
"Overworld Expert"); },
nullptr,
450 layout_actions_enabled)
452 [apply_preset]() { apply_preset(
"Dungeon Expert"); },
nullptr,
453 layout_actions_enabled)
455 [apply_preset]() { apply_preset(
"Testing"); },
nullptr,
456 layout_actions_enabled)
458 [apply_preset]() { apply_preset(
"Audio"); },
nullptr,
459 layout_actions_enabled)
529 absl::StrFormat(
"Failed to load ROM: %s", status.message()),
541 absl::StrFormat(
"Failed to save ROM: %s", status.message()),
559 absl::StrFormat(
"Failed to create project: %s", status.message()),
571 absl::StrFormat(
"Failed to open project: %s", status.message()),
583 absl::StrFormat(
"Failed to save project: %s", status.message()),
597 absl::StrFormat(
"Failed to save project as: %s", status.message()),
621 if (current_editor) {
622 auto status = current_editor->Undo();
625 absl::StrFormat(
"Undo failed: %s", status.message()),
635 if (current_editor) {
636 auto status = current_editor->Redo();
639 absl::StrFormat(
"Redo failed: %s", status.message()),
649 if (current_editor) {
650 auto status = current_editor->Cut();
662 if (current_editor) {
663 auto status = current_editor->Copy();
666 absl::StrFormat(
"Copy failed: %s", status.message()),
676 if (current_editor) {
677 auto status = current_editor->Paste();
680 absl::StrFormat(
"Paste failed: %s", status.message()),
690 if (current_editor) {
691 auto status = current_editor->Find();
694 absl::StrFormat(
"Find failed: %s", status.message()),
713 ui->ShowEditorSelection();
732 ui->SetEmulatorVisible(
true);
740 ui->SetPanelBrowserVisible(
true);
748 ui->SetWelcomeScreenVisible(
true);
760#ifdef YAZE_BUILD_AGENT_UI
761void MenuOrchestrator::OnShowAIAgent() {
764 ui->SetAIAgentVisible(
true);
769void MenuOrchestrator::OnShowChatHistory() {
772 ui->SetChatHistoryVisible(
true);
777void MenuOrchestrator::OnShowProposalDrawer() {
780 ui->SetProposalDrawerVisible(
true);
807 ui->ShowSessionSwitcher();
821 ui->ShowAllWindows();
883 ui->ShowGlobalSearch();
891 ui->ShowCommandPalette();
899 ui->SetPerformanceDashboardVisible(
true);
925 ui->SetResourceLabelManagerVisible(
true);
930#ifdef YAZE_ENABLE_TESTING
931void MenuOrchestrator::OnShowTestDashboard() {
937void MenuOrchestrator::OnRunAllTests() {
942void MenuOrchestrator::OnRunUnitTests() {
947void MenuOrchestrator::OnRunIntegrationTests() {
952void MenuOrchestrator::OnRunE2ETests() {
959void MenuOrchestrator::OnStartCollaboration() {
964void MenuOrchestrator::OnJoinCollaboration() {
969void MenuOrchestrator::OnShowNetworkStatus() {
1021 if (rom && rom->is_loaded()) {
1024 settings.
filename = rom->filename();
1025 auto status = rom->SaveToFile(settings);
1030 absl::StrFormat(
"Backup failed: %s", status.message()),
1044 absl::StrFormat(
"ROM validation failed: %s", status.message()),
1086 return project && !project->
filepath.empty();
1109 return "Unknown Editor";
1114 const std::string& action)
const {
1128#ifdef YAZE_ENABLE_TESTING
1132 if (!rom || !rom->is_loaded())
1146#ifdef YAZE_ENABLE_TESTING
1150 if (!rom || !rom->is_loaded())
1165 if (!rom || !rom->is_loaded())
1170 std::string version_str =
1171 (version == 0xFF) ?
"Vanilla" : absl::StrFormat(
"v%d", version);
1174 absl::StrFormat(
"ROM: %s | ZSCustomOverworld: %s", rom->title().c_str(),
1175 version_str.c_str()),
1183 if (!rom || !rom->is_loaded())
1192 flags.overworld.kLoadCustomOverworld = !flags.overworld.kLoadCustomOverworld;
1196 "Custom Overworld Loading: %s",
1197 flags.overworld.kLoadCustomOverworld ?
"Enabled" :
"Disabled"),
1205 if (!rom || !rom->is_loaded())
1209 flags.overworld.kApplyZSCustomOverworldASM =
1210 !flags.overworld.kApplyZSCustomOverworldASM;
1214 "ZSCustomOverworld ASM Application: %s",
1215 flags.overworld.kApplyZSCustomOverworldASM ?
"Enabled" :
"Disabled"),
The EditorManager controls the main editor window and manages the various editor classes.
absl::Status SaveProjectAs()
absl::Status OpenProject()
void LoadWorkspaceLayout()
UICoordinator * ui_coordinator()
void ShowProjectManagement()
Injects dependencies into all editors within an EditorSet.
void ResetWorkspaceLayout()
absl::Status CreateNewProject(const std::string &template_name="Basic ROM Hack")
void ApplyLayoutPreset(const std::string &preset_name)
auto GetCurrentEditor() const -> Editor *
absl::Status SaveProject()
void SaveWorkspaceLayout()
absl::Status LoadRom()
Load a ROM file into a new or existing session.
PanelManager & panel_manager()
void OpenLayoutDesigner()
void ShowProjectFileEditor()
size_t GetCurrentSessionId() const
project::YazeProject * GetCurrentProject()
void QueueDeferredAction(std::function< void()> action)
void SwitchToEditor(EditorType editor_type, bool force_visible=false, bool from_dialog=false)
auto GetCurrentRom() const -> Rom *
absl::Status SaveRom()
Save the current ROM file.
void ResetCurrentEditorLayout()
Manages editor types, categories, and lifecycle.
void ToggleSidebarVisibility()
std::vector< std::string > GetAllCategories(size_t session_id) const
bool TogglePanel(size_t session_id, const std::string &base_card_id)
std::vector< PanelDescriptor > GetPanelsInCategory(size_t session_id, const std::string &category) const
bool ShowPanel(size_t session_id, const std::string &base_card_id)
std::string GetActiveCategory() const
bool IsPanelVisible(size_t session_id, const std::string &base_card_id) const
bool IsSidebarVisible() const
Handles all project file operations with ROM-first workflow.
bool HasActiveProject() const
std::string GetProjectName() const
Handles all ROM file I/O operations.
absl::Status ValidateRom(Rom *rom)
std::string GetRomFilename(Rom *rom) const
bool IsRomLoaded(Rom *rom) const
High-level orchestrator for multi-session UI.
void SwitchToSession(size_t index)
size_t GetActiveSessionIndex() const
void CloseCurrentSession()
void DuplicateCurrentSession()
bool HasMultipleSessions() const
void SetEnabled(bool enabled)
Enable or disable the status bar.
void Show(const std::string &message, ToastType type=ToastType::kInfo, float ttl_seconds=3.0f)
#define ICON_MD_DEVELOPER_MODE
#define ICON_MD_FOLDER_OPEN
#define ICON_MD_CONTENT_CUT
#define ICON_MD_VOLUNTEER_ACTIVISM
#define ICON_MD_FILE_OPEN
#define ICON_MD_CHECK_BOX
#define ICON_MD_EXIT_TO_APP
#define ICON_MD_VIEW_QUILT
#define ICON_MD_FOLDER_SPECIAL
#define ICON_MD_VIEW_LIST
#define ICON_MD_NEW_RELEASES
#define ICON_MD_PLAY_ARROW
#define ICON_MD_SWAP_HORIZ
#define ICON_MD_DESIGN_SERVICES
#define ICON_MD_INTEGRATION_INSTRUCTIONS
#define ICON_MD_SWITCH_ACCOUNT
#define ICON_MD_VISIBILITY
#define ICON_MD_BUG_REPORT
#define ICON_MD_BUILD_CIRCLE
#define ICON_MD_MUSIC_NOTE
#define ICON_MD_CONTENT_PASTE
#define ICON_MD_VISIBILITY_OFF
#define ICON_MD_DISPLAY_SETTINGS
#define ICON_MD_VIEW_COMPACT
#define ICON_MD_PLAY_CIRCLE
#define ICON_MD_CHECK_CIRCLE
#define ICON_MD_DESCRIPTION
#define ICON_MD_HORIZONTAL_RULE
#define ICON_MD_CREATE_NEW_FOLDER
#define ICON_MD_DASHBOARD
#define ICON_MD_CONTENT_COPY
#define ICON_MD_ANALYTICS
#define ICON_MD_VIEW_SIDEBAR
#define ICON_MD_GROUP_ADD
constexpr int OverworldCustomASMHasBeenApplied