3#include "absl/strings/str_format.h"
22#define SHORTCUT_CTRL(key) gui::FormatCtrlShortcut(ImGuiKey_##key).c_str()
23#define SHORTCUT_CTRL_SHIFT(key) \
24 gui::FormatCtrlShiftShortcut(ImGuiKey_##key).c_str()
34 : editor_manager_(editor_manager),
35 menu_builder_(menu_builder),
36 rom_manager_(rom_manager),
37 project_manager_(project_manager),
38 editor_registry_(editor_registry),
39 session_coordinator_(session_coordinator),
40 toast_manager_(toast_manager),
41 popup_manager_(popup_manager) {}
237 if (all_categories.empty()) {
241 if (ImGui::BeginMenu(
245 if (!active_category.empty()) {
248 if (!cards.empty()) {
249 ImGui::TextDisabled(
"%s", active_category.c_str());
250 for (
const auto& card : cards) {
253 const char* shortcut =
254 card.shortcut_hint.empty() ? nullptr : card.shortcut_hint.c_str();
255 if (ImGui::MenuItem(card.display_name.c_str(), shortcut,
265 if (ImGui::BeginMenu(
"All Categories")) {
266 for (
const auto& category : all_categories) {
271 if (ImGui::BeginMenu(category.c_str())) {
274 for (
const auto& card : cards) {
277 const char* shortcut = card.shortcut_hint.empty()
279 : card.shortcut_hint.c_str();
280 if (ImGui::MenuItem(card.display_name.c_str(), shortcut,
362 [
this]() { OnShowProposalDrawer(); })
367#ifdef YAZE_ENABLE_TESTING
375 [
this]() { OnRunIntegrationTests(); })
392 [
this]() { OnStartCollaboration(); })
394 [
this]() { OnJoinCollaboration(); })
396 [
this]() { OnShowNetworkStatus(); })
431 const auto layout_actions_enabled = [
this]() {
434 const auto apply_preset = [
this](
const char* preset_name) {
439 const auto reset_editor_layout = [
this]() {
457 [reset_editor_layout]() { reset_editor_layout(); },
nullptr,
458 layout_actions_enabled)
462 [apply_preset]() { apply_preset(
"Minimal"); },
nullptr,
463 layout_actions_enabled)
466 [apply_preset]() { apply_preset(
"Developer"); },
nullptr,
467 layout_actions_enabled)
470 [apply_preset]() { apply_preset(
"Designer"); },
nullptr,
471 layout_actions_enabled)
473 "Modder",
ICON_MD_BUILD, [apply_preset]() { apply_preset(
"Modder"); },
474 nullptr, layout_actions_enabled)
477 [apply_preset]() { apply_preset(
"Overworld Expert"); },
nullptr,
478 layout_actions_enabled)
481 [apply_preset]() { apply_preset(
"Dungeon Expert"); },
nullptr,
482 layout_actions_enabled)
485 [apply_preset]() { apply_preset(
"Testing"); },
nullptr,
486 layout_actions_enabled)
489 [apply_preset]() { apply_preset(
"Audio"); },
nullptr,
490 layout_actions_enabled)
562 absl::StrFormat(
"Failed to load ROM: %s", status.message()),
574 absl::StrFormat(
"Failed to save ROM: %s", status.message()),
592 absl::StrFormat(
"Failed to create project: %s", status.message()),
604 absl::StrFormat(
"Failed to open project: %s", status.message()),
616 absl::StrFormat(
"Failed to save project: %s", status.message()),
630 absl::StrFormat(
"Failed to save project as: %s", status.message()),
654 if (current_editor) {
655 auto status = current_editor->Undo();
658 absl::StrFormat(
"Undo failed: %s", status.message()),
668 if (current_editor) {
669 auto status = current_editor->Redo();
672 absl::StrFormat(
"Redo failed: %s", status.message()),
682 if (current_editor) {
683 auto status = current_editor->Cut();
695 if (current_editor) {
696 auto status = current_editor->Copy();
699 absl::StrFormat(
"Copy failed: %s", status.message()),
709 if (current_editor) {
710 auto status = current_editor->Paste();
713 absl::StrFormat(
"Paste failed: %s", status.message()),
723 if (current_editor) {
724 auto status = current_editor->Find();
727 absl::StrFormat(
"Find failed: %s", status.message()),
746 ui->ShowEditorSelection();
766 ui->SetEmulatorVisible(
true);
774 ui->SetPanelBrowserVisible(
true);
782 ui->SetWelcomeScreenVisible(
true);
787#ifdef YAZE_BUILD_AGENT_UI
788void MenuOrchestrator::OnShowAIAgent() {
791 ui->SetAIAgentVisible(
true);
796void MenuOrchestrator::OnShowChatHistory() {
799 ui->SetChatHistoryVisible(
true);
804void MenuOrchestrator::OnShowProposalDrawer() {
807 ui->SetProposalDrawerVisible(
true);
834 ui->ShowSessionSwitcher();
848 ui->ShowAllWindows();
910 ui->ShowGlobalSearch();
918 ui->ShowCommandPalette();
926 ui->SetPerformanceDashboardVisible(
true);
953 ui->SetResourceLabelManagerVisible(
true);
958#ifdef YAZE_ENABLE_TESTING
959void MenuOrchestrator::OnShowTestDashboard() {
965void MenuOrchestrator::OnRunAllTests() {
970void MenuOrchestrator::OnRunUnitTests() {
975void MenuOrchestrator::OnRunIntegrationTests() {
980void MenuOrchestrator::OnRunE2ETests() {
987void MenuOrchestrator::OnStartCollaboration() {
992void MenuOrchestrator::OnJoinCollaboration() {
997void MenuOrchestrator::OnShowNetworkStatus() {
1049 if (rom && rom->is_loaded()) {
1052 settings.
filename = rom->filename();
1053 auto status = rom->SaveToFile(settings);
1058 absl::StrFormat(
"Backup failed: %s", status.message()),
1072 absl::StrFormat(
"ROM validation failed: %s", status.message()),
1113 const auto* project =
1115 return project && !project->
filepath.empty();
1138 return "Unknown Editor";
1143 const std::string& action)
const {
1157#ifdef YAZE_ENABLE_TESTING
1161 if (!rom || !rom->is_loaded())
1175#ifdef YAZE_ENABLE_TESTING
1179 if (!rom || !rom->is_loaded())
1194 if (!rom || !rom->is_loaded())
1199 std::string version_str =
1200 (version == 0xFF) ?
"Vanilla" : absl::StrFormat(
"v%d", version);
1203 absl::StrFormat(
"ROM: %s | ZSCustomOverworld: %s", rom->title().c_str(),
1204 version_str.c_str()),
1212 if (!rom || !rom->is_loaded())
1221 flags.overworld.kLoadCustomOverworld = !flags.overworld.kLoadCustomOverworld;
1225 "Custom Overworld Loading: %s",
1226 flags.overworld.kLoadCustomOverworld ?
"Enabled" :
"Disabled"),
1234 if (!rom || !rom->is_loaded())
1238 flags.overworld.kApplyZSCustomOverworldASM =
1239 !flags.overworld.kApplyZSCustomOverworldASM;
1243 "ZSCustomOverworld ASM Application: %s",
1244 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 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