3#include "absl/status/status.h"
4#include "absl/strings/str_format.h"
23#define SHORTCUT_CTRL(key) gui::FormatCtrlShortcut(ImGuiKey_##key).c_str()
24#define SHORTCUT_CTRL_SHIFT(key) \
25 gui::FormatCtrlShiftShortcut(ImGuiKey_##key).c_str()
35 : editor_manager_(editor_manager),
36 menu_builder_(menu_builder),
37 rom_manager_(rom_manager),
38 project_manager_(project_manager),
39 editor_registry_(editor_registry),
40 session_coordinator_(session_coordinator),
41 toast_manager_(toast_manager),
42 popup_manager_(popup_manager) {}
228 const auto layout_enabled = [
this]() {
240 nullptr, layout_enabled)
248 nullptr, layout_enabled)
256 nullptr, layout_enabled)
264 nullptr, layout_enabled)
283 nullptr, layout_enabled)
301 if (all_categories.empty()) {
302 ImGui::TextDisabled(
"No panels available");
307 if (ImGui::MenuItem(absl::StrFormat(
"%s Panel Browser",
ICON_MD_APPS).c_str(),
323 for (
const auto& category : all_categories) {
325 std::string label = category;
326 if (category == active_category) {
332 if (ImGui::BeginMenu(label.c_str())) {
336 ImGui::TextDisabled(
"No panels in this category");
350 for (
const auto& card : cards) {
353 const char* shortcut =
354 card.shortcut_hint.empty() ? nullptr : card.shortcut_hint.c_str();
357 std::string item_label =
364 if (ImGui::MenuItem(item_label.c_str(), shortcut)) {
390#ifdef YAZE_ENABLE_TESTING
403 AddCollaborationMenuItems();
473#ifdef YAZE_BUILD_AGENT_UI
478 [
this]() { OnShowProposalDrawer(); })
486#ifdef YAZE_ENABLE_TESTING
494 [
this]() { OnRunIntegrationTests(); })
498 "Testing support disabled (YAZE_ENABLE_TESTING=OFF)",
ICON_MD_INFO);
504void MenuOrchestrator::AddCollaborationMenuItems() {
508 [
this]() { OnStartCollaboration(); })
510 [
this]() { OnJoinCollaboration(); })
512 [
this]() { OnShowNetworkStatus(); })
547 const auto layout_actions_enabled = [
this]() {
568 nullptr, layout_actions_enabled)
577 nullptr, layout_actions_enabled)
585 nullptr, layout_actions_enabled)
593 nullptr, layout_actions_enabled)
601 nullptr, layout_actions_enabled)
610 nullptr, layout_actions_enabled)
618 nullptr, layout_actions_enabled)
626 nullptr, layout_actions_enabled)
635 nullptr, layout_actions_enabled)
639 layout_actions_enabled)
645 layout_actions_enabled)
653 nullptr, layout_actions_enabled)
661 nullptr, layout_actions_enabled)
669 nullptr, layout_actions_enabled)
677 nullptr, layout_actions_enabled)
748 absl::StrFormat(
"Failed to load ROM: %s", status.message()),
759 if (absl::IsCancelled(status)) {
763 absl::StrFormat(
"Failed to save ROM: %s", status.message()),
781 absl::StrFormat(
"Failed to create project: %s", status.message()),
793 absl::StrFormat(
"Failed to open project: %s", status.message()),
805 absl::StrFormat(
"Failed to save project: %s", status.message()),
819 absl::StrFormat(
"Failed to save project as: %s", status.message()),
843 if (current_editor) {
846 auto status = current_editor->
Undo();
854 absl::StrFormat(
"Undo failed: %s", status.message()),
864 if (current_editor) {
867 auto status = current_editor->
Redo();
875 absl::StrFormat(
"Redo failed: %s", status.message()),
885 if (current_editor) {
886 auto status = current_editor->
Cut();
898 if (current_editor) {
899 auto status = current_editor->
Copy();
902 absl::StrFormat(
"Copy failed: %s", status.message()),
912 if (current_editor) {
913 auto status = current_editor->
Paste();
916 absl::StrFormat(
"Paste failed: %s", status.message()),
926 if (current_editor) {
927 auto status = current_editor->
Find();
930 absl::StrFormat(
"Find failed: %s", status.message()),
949 ui->ShowEditorSelection();
969 ui->SetPanelBrowserVisible(
true);
977 ui->ShowPanelFinder();
985 ui->SetWelcomeScreenVisible(
true);
990#ifdef YAZE_BUILD_AGENT_UI
991void MenuOrchestrator::OnShowAIAgent() {
994 ui->SetAIAgentVisible(
true);
999void MenuOrchestrator::OnShowProposalDrawer() {
1002 ui->SetProposalDrawerVisible(
true);
1025 ui->ShowSessionSwitcher();
1039 ui->ShowAllWindows();
1101 ui->ShowGlobalSearch();
1109 ui->ShowCommandPalette();
1117 ui->SetPerformanceDashboardVisible(
true);
1144 ui->SetResourceLabelManagerVisible(
true);
1149#ifdef YAZE_ENABLE_TESTING
1150void MenuOrchestrator::OnShowTestDashboard() {
1156void MenuOrchestrator::OnRunAllTests() {
1161void MenuOrchestrator::OnRunUnitTests() {
1166void MenuOrchestrator::OnRunIntegrationTests() {
1171void MenuOrchestrator::OnRunE2ETests() {
1173 "E2E runner is not wired in-app yet. Use scripts/agents/run-tests.sh or "
1179#ifdef YAZE_WITH_GRPC
1180void MenuOrchestrator::OnStartCollaboration() {
1182 "Collaboration session start is not wired yet. Run yaze-server and use "
1183 "the web client for live sync.",
1187void MenuOrchestrator::OnJoinCollaboration() {
1189 "Join collaboration is not wired yet. Use the web client + yaze-server.",
1193void MenuOrchestrator::OnShowNetworkStatus() {
1244 absl::StrFormat(
"Backup failed: %s", status.message()),
1257 absl::StrFormat(
"ROM validation failed: %s", status.message()),
1298 const auto* project =
1300 return project && !project->
filepath.empty();
1323 return "Unknown Editor";
1328 const std::string& action)
const {
1342#ifdef YAZE_ENABLE_TESTING
1360#ifdef YAZE_ENABLE_TESTING
1384 std::string version_str =
1385 (version == 0xFF) ?
"Vanilla" : absl::StrFormat(
"v%d", version);
1388 absl::StrFormat(
"ROM: %s | ZSCustomOverworld: %s", rom->
title().c_str(),
1389 version_str.c_str()),
1406 flags.overworld.kLoadCustomOverworld = !flags.overworld.kLoadCustomOverworld;
1410 "Custom Overworld Loading: %s",
1411 flags.overworld.kLoadCustomOverworld ?
"Enabled" :
"Disabled"),
1423 flags.overworld.kApplyZSCustomOverworldASM =
1424 !flags.overworld.kApplyZSCustomOverworldASM;
1428 "ZSCustomOverworld ASM Application: %s",
1429 flags.overworld.kApplyZSCustomOverworldASM ?
"Enabled" :
"Disabled"),
The EditorManager controls the main editor window and manages the various editor classes.
absl::Status SaveProjectAs()
void SwitchToEditor(EditorType editor_type, bool force_visible=false, bool from_dialog=false) override
absl::Status OpenProject()
Rom * GetCurrentRom() const override
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)
void RestoreTemporaryLayoutSnapshot(bool clear_after_restore=false)
auto GetCurrentEditor() const -> Editor *
absl::Status SaveProject()
void SaveWorkspaceLayout()
bool ApplyLayoutProfile(const std::string &profile_id)
absl::Status LoadRom()
Load a ROM file into a new or existing session.
PanelManager & panel_manager()
void ShowProjectFileEditor()
size_t GetCurrentSessionId() const
void ClearTemporaryLayoutSnapshot()
project::YazeProject * GetCurrentProject()
void QueueDeferredAction(std::function< void()> action)
void CaptureTemporaryLayoutSnapshot()
void ResetCurrentEditorLayout()
Manages editor types, categories, and lifecycle.
virtual absl::Status Cut()=0
virtual absl::Status Copy()=0
virtual absl::Status Redo()=0
virtual std::string GetRedoDescription() const
virtual absl::Status Find()=0
virtual absl::Status Paste()=0
virtual absl::Status Undo()=0
virtual std::string GetUndoDescription() const
void ToggleSidebarVisibility()
std::vector< std::string > GetAllCategories(size_t session_id) const
bool TogglePanel(size_t session_id, const std::string &base_card_id)
void HideAllPanelsInSession(size_t session_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
void ShowAllPanelsInCategory(size_t session_id, const std::string &category)
void HideAllPanelsInCategory(size_t session_id, const std::string &category)
void ShowAllPanelsInSession(size_t session_id)
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
absl::Status CreateBackup(Rom *rom)
bool IsRomLoaded(Rom *rom) const
High-level orchestrator for multi-session UI.
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_BOOKMARK_ADD
#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_CHECK_BOX_OUTLINE_BLANK
#define ICON_MD_VIEW_SIDEBAR
#define ICON_MD_BOOKMARK_REMOVE
#define ICON_MD_SMART_TOY
#define ICON_MD_GROUP_ADD
constexpr int OverworldCustomASMHasBeenApplied