yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
editor_manager.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_EDITOR_MANAGER_H
2#define YAZE_APP_EDITOR_EDITOR_MANAGER_H
3
4#define IMGUI_DEFINE_MATH_OPERATORS
5
6#include <atomic>
7#include <cstddef>
8#include <functional>
9#include <memory>
10#include <optional>
11#include <string>
12#include <vector>
13
14#include "absl/status/status.h"
15#include "absl/strings/string_view.h"
21#include "app/editor/editor.h"
53#include "app/emu/emulator.h"
54#include "app/startup_flags.h"
55#include "core/project.h"
57#include "imgui/imgui.h"
58#include "rom/rom.h"
59#include "util/log.h"
60#include "yaze_config.h"
62
63// Forward declarations for gRPC-dependent types
64namespace yaze {
65class CanvasAutomationServiceImpl;
66}
67
68namespace yaze::editor {
69class AgentEditor;
70namespace workflow {
72} // namespace workflow
73} // namespace yaze::editor
74
75namespace yaze {
76
77// Forward declaration for AppConfig
78struct AppConfig;
79
80namespace editor {
81
82std::optional<EditorType> ParseEditorTypeFromString(absl::string_view name);
83
99 public:
106
112
113 // Constructor and destructor must be defined in .cc file for std::unique_ptr
114 // with forward-declared types
117
118 void Initialize(gfx::IRenderer* renderer, const std::string& filename = "");
119
120 // Processes startup flags to open a specific editor and panels.
121 void OpenEditorAndPanelsFromFlags(const std::string& editor_name,
122 const std::string& panels_str);
123
124 // Apply startup actions based on AppConfig
125 void ProcessStartupActions(const AppConfig& config);
126 void ApplyStartupVisibility(const AppConfig& config);
127 void SetStartupLoadHints(const AppConfig& config);
128
131
132 absl::Status Update();
133 void DrawMainMenuBar();
134
135 // Host visibility/focus lifecycle hook (e.g., OS space switching).
136 void HandleHostVisibilityChanged(bool visible);
137
138 auto emulator() -> emu::Emulator& { return emulator_; }
139 auto quit() const { return quit_; }
140 auto version() const { return version_; }
141
148 return right_drawer_manager_.get();
149 }
156 return window_manager_;
157 }
162 return session_coordinator_.get();
163 }
164 [[deprecated("Use window_host() instead.")]] PanelHost* panel_host() {
165 return window_host_.get();
166 }
167 [[deprecated("Use window_host() instead.")]] const PanelHost* panel_host()
168 const {
169 return window_host_.get();
170 }
172 const WindowHost* window_host() const { return window_host_.get(); }
173
174 // Layout offset calculation for dockspace adjustment
175 // Delegates to LayoutCoordinator for cleaner separation of concerns
185
186 absl::Status SetCurrentRom(Rom* rom);
187 Rom* GetCurrentRom() const override {
188 return session_coordinator_ ? session_coordinator_->GetCurrentRom()
189 : nullptr;
190 }
191 auto GetCurrentGameData() const -> zelda3::GameData* {
192 return session_coordinator_ ? session_coordinator_->GetCurrentGameData()
193 : nullptr;
194 }
196 return session_coordinator_ ? session_coordinator_->GetCurrentEditorSet()
197 : nullptr;
198 }
199 auto GetCurrentEditor() const -> Editor* override { return current_editor_; }
200 std::string GetCurrentRomHash() const {
202 }
213 std::vector<editor::RomFileManager::BackupEntry> GetRomBackups() const;
214 bool IsRomBackupRestorePending() const;
215 absl::Status RestoreRomBackup(const std::string& backup_path);
216 absl::Status DiscardPendingRomBackupRestore();
217 absl::Status PruneRomBackups();
218 void ConfirmRomWrite();
223
224 // Write conflict warning (ASM-owned address protection)
225 const std::vector<core::WriteConflict>& pending_write_conflicts() const {
227 }
230 void SetCurrentEditor(Editor* editor) override {
231 current_editor_ = editor;
232 // Update ContentRegistry context for panel access
234 // Update help panel's editor context for context-aware help
235 if (right_drawer_manager_ && editor) {
236 right_drawer_manager_->SetActiveEditor(editor->type());
237 }
238 }
240 size_t GetCurrentSessionId() const {
241 return session_coordinator_ ? session_coordinator_->GetActiveSessionId()
242 : 0;
243 }
246
247 // Session management helpers (compact, zero-based UI ordering)
248 size_t GetCurrentSessionIndex() const;
249
250 // Get current session's feature flags (falls back to global if no session)
252 size_t current_index = GetCurrentSessionIndex();
254 current_index < session_coordinator_->GetTotalSessionCount()) {
255 auto* session = static_cast<RomSession*>(
256 session_coordinator_->GetSession(current_index));
257 if (session) {
258 return &session->feature_flags;
259 }
260 }
261 return &core::FeatureFlags::get(); // Fallback to global
262 }
263
264 void SetFontGlobalScale(float scale) {
266 ImGui::GetIO().FontGlobalScale = scale;
267 auto status = user_settings_.Save();
268 if (!status.ok()) {
269 LOG_WARN("EditorManager", "Failed to save user settings: %s",
270 status.ToString().c_str());
271 }
272 }
273
275 const UserSettings& user_settings() const { return user_settings_; }
276
277 // Workspace management (delegates to WorkspaceManager)
279 void SaveWorkspacePreset(const std::string& name) {
281 }
282 void LoadWorkspacePreset(const std::string& name) {
284 }
285
286 // Jump-to functionality for cross-editor navigation
287 void SwitchToEditor(EditorType editor_type, bool force_visible = false,
288 bool from_dialog = false) override;
289 void DismissEditorSelection() override;
290
291 // Panel-based editor registry
292 static bool IsPanelBasedEditor(EditorType type);
293 bool IsSidebarVisible() const {
294 return ui_coordinator_ ? ui_coordinator_->IsPanelSidebarVisible() : false;
295 }
296 void SetSidebarVisible(bool visible) {
297 if (ui_coordinator_) {
298 ui_coordinator_->SetPanelSidebarVisible(visible);
299 }
300 }
301
302 // Lazy asset loading helpers
303 absl::Status EnsureEditorAssetsLoaded(EditorType type);
304 absl::Status EnsureGameDataLoaded();
305
306 // Session management
307 void CreateNewSession();
309 void CloseCurrentSession();
310 void RemoveSession(size_t index);
311 void SwitchToSession(size_t index);
312 void RequestSwitchToSession(size_t index) override { SwitchToSession(index); }
313 void RequestCloseSession(size_t index) override { RemoveSession(index); }
314 size_t GetActiveSessionCount() const;
315
316 // Workspace layout management
317 // Window management - inline delegation (reduces EditorManager bloat)
322 if (ui_coordinator_)
323 ui_coordinator_->ShowAllWindows();
324 }
326 if (ui_coordinator_)
327 ui_coordinator_->HideAllWindows();
328 }
329
330 // Layout presets (inline delegation)
334
335 // Panel layout presets (command palette accessible)
336 void ApplyLayoutPreset(const std::string& preset_name);
337 bool ApplyLayoutProfile(const std::string& profile_id);
339 void RestoreTemporaryLayoutSnapshot(bool clear_after_restore = false);
341
342 // Named, session-scoped layout snapshots (in-memory, multi-slot).
343 bool SaveLayoutSnapshotAs(const std::string& name);
344 bool RestoreLayoutSnapshot(const std::string& name,
345 bool remove_after_restore = false);
346 bool DeleteLayoutSnapshot(const std::string& name);
347 std::vector<std::string> ListLayoutSnapshots() const;
348
350
351 // Helper methods
352 std::string GenerateUniqueEditorTitle(EditorType type,
353 size_t session_index) const;
354 bool HasDuplicateSession(const std::string& filepath);
355 void RenameSession(size_t index, const std::string& new_name);
356 void Quit();
357
359 std::string GetPendingUnsavedSessionActionPrompt() const;
360 std::string GetPendingUnsavedSessionActionSaveLabel() const;
365
366 // Deferred action queue - actions executed safely on next frame
367 // Use this to avoid modifying ImGui state during menu/popup rendering
368 void QueueDeferredAction(std::function<void()> action) {
369 deferred_actions_.push_back(std::move(action));
370 pending_editor_deferred_actions_.fetch_add(1, std::memory_order_relaxed);
371 }
372
373 UiSyncState GetUiSyncStateSnapshot() const;
374
375 // Public for SessionCoordinator to configure new sessions
376 void ConfigureSession(RomSession* session) override;
377
378#ifdef YAZE_WITH_GRPC
379 void SetCanvasAutomationService(CanvasAutomationServiceImpl* service) {
380 canvas_automation_service_ = service;
381 }
382#endif
383
384 // UI visibility controls (public for MenuOrchestrator)
385 // UI visibility controls - inline for performance (single-line wrappers
386 // delegating to UICoordinator)
388 if (ui_coordinator_)
389 ui_coordinator_->SetImGuiDemoVisible(true);
390 }
392 if (ui_coordinator_)
393 ui_coordinator_->SetImGuiMetricsVisible(true);
394 }
395
396#ifdef YAZE_ENABLE_TESTING
397 void ShowTestDashboard() { show_test_dashboard_ = true; }
398#endif
399
400#ifdef YAZE_BUILD_AGENT_UI
401 void ShowAIAgent();
402 void ShowChatHistory();
403 AgentEditor* GetAgentEditor() { return agent_ui_.GetAgentEditor(); }
404 AgentUiController* GetAgentUiController() { return &agent_ui_; }
405#else
406 AgentEditor* GetAgentEditor() { return nullptr; }
408#endif
409#ifdef YAZE_BUILD_AGENT_UI
410 void ShowProposalDrawer() { proposal_drawer_.Show(); }
411#endif
412
413 // ROM and Project operations (public for MenuOrchestrator)
414 absl::Status LoadRom();
415 absl::Status SaveRom();
416 absl::Status SaveRomAs(const std::string& filename);
417 absl::Status ResumePendingRomSave();
418 absl::Status OpenRomOrProject(const std::string& filename);
419 absl::Status CreateNewProject(
420 const std::string& template_name = "Basic ROM Hack");
421 absl::Status CreateNewProjectFromRom(
422 const std::string& template_name, const std::string& rom_path,
423 const std::string& project_name,
424 const std::string& project_path = std::string());
425 absl::Status FinalizeNewProject(
426 const std::string& project_name,
427 const std::string& project_path = std::string());
428 absl::Status OpenProject();
429 absl::Status SaveProject();
430 absl::Status SaveProjectAs();
431 absl::Status SaveProjectAs(const std::string& filepath);
432 absl::Status AutosaveActiveSession();
433 absl::Status BuildCurrentProject();
436 absl::Status RunCurrentProject();
437
448 absl::Status ImportProject(const std::string& project_path);
449 absl::Status RepairCurrentProject();
450
451 // Project management
452 absl::Status LoadProjectWithRom();
453 absl::Status SwapProjectRom(const std::string& rom_path);
454 absl::Status ReloadProjectRom();
457 return &current_project_;
458 }
459 // True only for the session whose project is currently restored into
460 // current_project_. SessionCoordinator also performs transient switches
461 // while drawing inactive sessions, so its active session is not sufficient
462 // for routing project mutations or saves.
463 bool IsCurrentProjectContextOwnedBySession(size_t session_id) const {
464 return active_project_context_session_id_.has_value() &&
466 }
468 bool IsCurrentProjectDirty() const;
470
471 // Show project management panel in right sidebar
473
474 // Show project file editor
480
481 private:
482 absl::Status DrawRomSelector() = delete; // Moved to UICoordinator
483 // DrawContextSensitivePanelControl removed - card control moved to sidebar
484
485 // Optional loading_handle for WASM progress tracking (0 = create new)
486 absl::Status LoadAssets(uint64_t loading_handle = 0);
487 absl::Status LoadAssetsForMode(uint64_t loading_handle = 0);
488 absl::Status LoadAssetsLazy(uint64_t loading_handle = 0);
489 absl::Status InitializeEditorForType(EditorType type, EditorSet* editor_set,
490 Rom* rom);
491 void ResetAssetState(RomSession* session);
492 void MarkEditorInitialized(RomSession* session, EditorType type);
493 void MarkEditorLoaded(RomSession* session, EditorType type);
494 Editor* GetEditorByType(EditorType type, EditorSet* editor_set) const;
495 Editor* ResolveEditorForCategory(const std::string& category);
496 void SyncEditorContextForCategory(const std::string& category);
497 bool EditorRequiresGameData(EditorType type) const;
498 bool EditorInitRequiresGameData(EditorType type) const;
499 std::vector<EditorType> CollectEditorsToPreload(EditorSet* editor_set) const;
500
501 // Testing system
505 // Returns a preferred startup category, skipping "Emulator" to prevent
506 // the emulator panel from auto-opening on project load.
507 std::string GetPreferredStartupCategory(
508 const std::string& saved_category,
509 const std::vector<std::string>& available_categories) const;
510
511 // Session event handlers (EventBus subscribers)
512 void HandleSessionSwitched(size_t new_index, RomSession* session,
513 bool transient = false);
514 void HandleSessionCreated(size_t index, RomSession* session);
515 void HandleSessionClosed(size_t index);
516 // Initialization helpers (extracted from constructor for readability)
517 void SubscribeToEvents();
519 void RegisterEditors();
521 void InitializeServices();
527 void ProcessInput();
528 void UpdateEditorState();
530 void DrawInterface();
532 void UpdateSystemUIs();
533 void RunEmulator();
535
536 void HandleSessionRomLoaded(size_t index, Rom* rom);
538
539 // UI action event handler (EventBus subscriber for UIActionRequestEvent)
541
542 bool quit_ = false;
543
544 // Note: All show_* flags are being moved to UICoordinator
545 // Access via ui_coordinator_->IsXxxVisible() or SetXxxVisible()
546
547 // Workspace dialog flags (managed by EditorManager, not UI)
551
552 // Note: Most UI visibility flags have been moved to UICoordinator
553 // Access via ui_coordinator_->IsXxxVisible() or SetXxxVisible()
554
555 // Agent proposal drawer
558
559 // Agent UI (chat + editor), no-op when agent UI is disabled
561
562 // Project file editor
564
565 // Note: Editor selection dialog and welcome screen are now managed by
566 // UICoordinator Kept here for backward compatibility during transition
567 std::unique_ptr<DashboardPanel> dashboard_panel_;
576 std::vector<std::string> startup_panel_hints_;
577
578 // Properties panel for selection editing
580
581 // Project management panel for version control and ROM management
582 std::unique_ptr<ProjectManagementPanel> project_management_panel_;
583
584 std::string version_ = "";
585 absl::Status status_;
587
588 public:
589 private:
591 // Tracks which session is currently active so delegators (menus, popups,
592 // shortcuts) stay in sync without relying on per-editor context.
593
595
598 std::string previous_path;
599 std::string candidate_path;
600 };
601 std::optional<PendingProjectRomSelection> pending_project_rom_selection_;
605 // current_project_ is a stable-address working copy owned by the active
606 // user-facing session. Stable IDs survive UI-index compaction.
608 // The global FeatureFlags singleton is also rebound during transient frame
609 // iteration, so track which session currently owns its value separately.
611 // Non-owning view of the active session's VersionManager. Each RomSession
612 // owns its manager so EditorSet dependency pointers remain valid while that
613 // session is inactive.
616 std::unique_ptr<PopupManager> popup_manager_;
621
622 // New delegated components (dependency injection architecture)
624 window_manager_; // Window management with session awareness
625 std::unique_ptr<WindowHost> window_host_;
627 std::unique_ptr<MenuOrchestrator> menu_orchestrator_;
630 std::unique_ptr<UICoordinator> ui_coordinator_;
633 std::unique_ptr<SessionCoordinator> session_coordinator_;
634 std::unique_ptr<LayoutManager>
635 layout_manager_; // DockBuilder layout management
636 LayoutCoordinator layout_coordinator_; // Facade for layout operations
637 std::unique_ptr<RightDrawerManager>
638 right_drawer_manager_; // Right-side drawer system
639 StatusBar status_bar_; // Bottom status bar
640 std::unique_ptr<ActivityBar> activity_bar_;
642
653 const project::YazeProject& project);
656 absl::Status SaveActiveProjectEditingWork();
657 absl::Status PrepareRawProjectFileSave(const std::string& filepath,
658 const std::string& contents);
659 absl::Status CommitRawProjectFileSave(const std::string& filepath,
660 const std::string& contents);
661 absl::Status ReplaceActiveSessionRom(Rom&& rom, const std::string& filepath);
663 void RebaseCleanProjectFileDraft(const std::string& filepath);
665 std::optional<size_t> previous_session_id);
667 size_t previous_session_count);
669 absl::StatusOr<const project::YazeProject*>
671 ProjectWorkflowStatus MakeBuildStatus(const std::string& summary,
672 const std::string& detail,
674 const std::string& output_tail = "",
675 bool can_cancel = false) const;
676 ProjectWorkflowStatus MakeRunStatus(const std::string& summary,
677 const std::string& detail,
678 ProjectWorkflowState state) const;
679 absl::StatusOr<std::string> RunProjectBuildCommand();
680 absl::StatusOr<std::string> ResolveProjectBuildCommand() const;
681 absl::StatusOr<std::string> ResolveProjectRunTarget() const;
682 absl::Status CheckRomWritePolicy(
683 const std::optional<std::string>& target_filename = std::nullopt);
684 absl::Status CheckOracleRomSafetyPreSave(Rom* rom);
685 absl::Status SaveRomInternal(
686 const std::optional<std::string>& save_as_filename);
689 void FinishPendingRomSaveAttempt(const absl::Status& status);
690 void CancelPendingRomSave(bool hide_popups = false);
691 absl::Status StartPendingRomSave(
692 const std::optional<std::string>& save_as_filename);
693 absl::Status LoadRomInternal();
694 absl::Status OpenRomOrProjectInternal(const std::string& filename);
695 absl::Status OpenProjectInternal();
696 absl::Status ValidateProjectRomSelection(const std::string& rom_path);
697
707
709 size_t source_session_id = SIZE_MAX;
710 size_t target_session_id = SIZE_MAX;
711 std::string path;
712 };
713
714 std::optional<size_t> ResolveSessionIndexById(size_t session_id) const;
717 const PendingUnsavedSessionAction& action);
718 bool SessionHasPendingUnsavedWork(size_t session_index) const;
719 bool SessionHasPendingRomWork(size_t session_index) const;
721 bool HasPendingDungeonChangesForSession(size_t session_index) const;
722 int PendingDungeonRoomCountForSession(size_t session_index) const;
723 size_t PendingPaletteColorCountForSession(size_t session_index) const;
724 int ModifiedSessionCount() const;
725 std::string DescribePendingUnsavedWork(size_t session_index) const;
726 std::string DescribeAllPendingUnsavedWork() const;
727
728 float autosave_timer_ = 0.0f;
729 bool settings_dirty_ = false;
732 std::optional<PendingUnsavedSessionAction> pending_unsaved_session_action_;
733
734 // ROM lifecycle state (hash, write policy, confirmation dialogs, backups)
735 // Mutable because some const accessors delegate to it.
738 std::optional<std::string> save_as_filename;
739 size_t session_index = SIZE_MAX;
740 Rom* rom = nullptr;
741 };
742 std::optional<PendingRomSave> pending_rom_save_;
743
744 // Deferred action queue - executed at the start of each frame
745 std::vector<std::function<void()>> deferred_actions_;
747 std::atomic<uint64_t> ui_sync_frame_id_{0};
748 std::unique_ptr<BackgroundCommandTask> active_project_build_;
750
751 // Core Event Bus and Context
753 std::unique_ptr<GlobalEditorContext> editor_context_;
754 std::unique_ptr<workflow::HackWorkflowBackend> hack_workflow_backend_;
755
756#ifdef YAZE_WITH_GRPC
757 CanvasAutomationServiceImpl* canvas_automation_service_ = nullptr;
758#endif
759
760 // RAII helper for clean session context switching
762 public:
763 SessionScope(EditorManager* manager, size_t session_index);
765
766 private:
771 };
772
773 void ConfigureEditorDependencies(EditorSet* editor_set, Rom* rom,
774 size_t session_id);
776};
777
778} // namespace editor
779} // namespace yaze
780
781#endif // YAZE_APP_EDITOR_EDITOR_MANAGER_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
static Flags & get()
Definition features.h:119
Manages project versioning (Git) and ROM artifact snapshots.
Comprehensive AI Agent Platform & Bot Creator.
Central coordinator for all agent UI components.
Handles editor switching, layout initialization, and jump-to navigation.
SessionScope(EditorManager *manager, size_t session_index)
The EditorManager controls the main editor window and manages the various editor classes.
std::unique_ptr< SessionCoordinator > session_coordinator_
RomLifecycleManager rom_lifecycle_
void SaveWorkspacePreset(const std::string &name)
StartupVisibility welcome_mode_override_
void ConfirmPendingUnsavedSessionActionSaveAndContinue()
std::optional< PendingRomSave > pending_rom_save_
std::vector< EditorType > CollectEditorsToPreload(EditorSet *editor_set) const
void SwitchToEditor(EditorType editor_type, bool force_visible=false, bool from_dialog=false) override
std::unique_ptr< GlobalEditorContext > editor_context_
void RestoreProjectEditingStateForSession(RomSession *session)
auto GetCurrentGameData() const -> zelda3::GameData *
bool MaybeGuardPendingSessionAction(PendingUnsavedSessionAction action)
absl::Status SaveRomAs(const std::string &filename)
bool HasAnySessionPendingUnsavedWork() const
project::YazeProject current_project_
void HandleSessionSwitched(size_t new_index, RomSession *session, bool transient=false)
std::unique_ptr< RightDrawerManager > right_drawer_manager_
void SetCurrentEditor(Editor *editor) override
bool SaveLayoutSnapshotAs(const std::string &name)
absl::Status PrepareRawProjectFileSave(const std::string &filepath, const std::string &contents)
absl::Status LoadAssetsForMode(uint64_t loading_handle=0)
std::string GetPreferredStartupCategory(const std::string &saved_category, const std::vector< std::string > &available_categories) const
const WorkspaceWindowManager & window_manager() const
absl::StatusOr< std::string > RunProjectBuildCommand()
absl::Status CheckRomWritePolicy(const std::optional< std::string > &target_filename=std::nullopt)
Save the current ROM file.
void SwitchToSession(size_t index)
absl::Status RestoreRomBackup(const std::string &backup_path)
bool SessionHasPendingRomWork(size_t session_index) const
bool HasPendingPotItemSaveConfirmation() const
Rom * GetCurrentRom() const override
void CancelPendingRomSave(bool hide_popups=false)
int PendingDungeonRoomCountForSession(size_t session_index) const
bool HasDuplicateSession(const std::string &filepath)
WorkspaceManager * workspace_manager()
std::unique_ptr< LayoutManager > layout_manager_
std::unique_ptr< DashboardPanel > dashboard_panel_
void HandleSessionClosed(size_t index)
void ResetAssetState(RomSession *session)
void ProcessStartupActions(const AppConfig &config)
void LoadWorkspacePreset(const std::string &name)
std::string GenerateUniqueEditorTitle(EditorType type, size_t session_index) const
void RenameSession(size_t index, const std::string &new_name)
core::VersionManager * version_manager_
std::vector< editor::RomFileManager::BackupEntry > GetRomBackups() const
const UserSettings & user_settings() const
std::vector< std::string > ListLayoutSnapshots() const
SharedClipboard shared_clipboard_
bool EditorInitRequiresGameData(EditorType type) const
void SyncEditorContextForCategory(const std::string &category)
const RightDrawerManager * right_drawer_manager() const
UICoordinator * ui_coordinator()
void ShowProjectManagement()
Injects dependencies into all editors within an EditorSet.
Editor * ResolveEditorForCategory(const std::string &category)
void Initialize(gfx::IRenderer *renderer, const std::string &filename="")
std::optional< size_t > runtime_feature_flags_session_id_
absl::Status FinalizeNewProject(const std::string &project_name, const std::string &project_path=std::string())
std::string DescribeAllPendingUnsavedWork() const
project::RomWritePolicy GetProjectRomWritePolicy() const
void MarkEditorLoaded(RomSession *session, EditorType type)
absl::Status StartPendingRomSave(const std::optional< std::string > &save_as_filename)
absl::Status CreateNewProjectFromRom(const std::string &template_name, const std::string &rom_path, const std::string &project_name, const std::string &project_path=std::string())
absl::Status CreateNewProject(const std::string &template_name="Basic ROM Hack")
RightDrawerManager * right_drawer_manager()
void ConfirmPendingUnsavedSessionActionDiscardAndContinue()
absl::Status InitializeEditorForType(EditorType type, EditorSet *editor_set, Rom *rom)
LayoutCoordinator layout_coordinator_
absl::Status LoadAssets(uint64_t loading_handle=0)
std::string GetCurrentRomHash() const
bool HasPendingUnsavedSessionAction() const
absl::Status OpenRomOrProjectInternal(const std::string &filename)
auto GetCurrentEditorSet() const -> EditorSet *
std::string DescribePendingUnsavedWork(size_t session_index) const
void SetFontGlobalScale(float scale)
ProjectManagementPanel * project_management_panel()
void FinishPendingRomSaveAttempt(const absl::Status &status)
std::unique_ptr< MenuOrchestrator > menu_orchestrator_
void RequestSwitchToSession(size_t index) override
void HandleUIActionRequest(UIActionRequestEvent::Action action)
void ResolvePotItemSaveConfirmation(PotItemSaveDecision decision)
absl::Status CommitRawProjectFileSave(const std::string &filepath, const std::string &contents)
absl::Status SwapProjectRom(const std::string &rom_path)
absl::Status SaveActiveProjectEditingWork()
auto GetCurrentEditor() const -> Editor *override
void HandleSessionRomLoaded(size_t index, Rom *rom)
WorkspaceWindowManager & window_manager()
ProjectFileEditor project_file_editor_
void SetSidebarVisible(bool visible)
void HandleHostVisibilityChanged(bool visible)
void ApplyLayoutPreset(const std::string &preset_name)
void RestoreTemporaryLayoutSnapshot(bool clear_after_restore=false)
void ApplyStartupVisibility(const AppConfig &config)
void ExecutePendingUnsavedSessionAction(const PendingUnsavedSessionAction &action)
WorkspaceWindowManager window_manager_
size_t PendingPaletteColorCountForSession(size_t session_index) const
std::string GetProjectExpectedRomHash() const
const WindowHost * window_host() const
void PersistInputConfig(const emu::input::InputConfig &config)
absl::Status SaveRomInternal(const std::optional< std::string > &save_as_filename)
void SetStartupLoadHints(const AppConfig &config)
void RebaseCleanProjectFileDraft(const std::string &filepath)
std::optional< size_t > pending_project_open_previous_session_id_
absl::Status LoadAssetsLazy(uint64_t loading_handle=0)
bool PendingRomSaveMatchesActiveSession() const
absl::StatusOr< std::string > ResolveProjectBuildCommand() const
absl::Status DrawRomSelector()=delete
void SetAssetLoadMode(AssetLoadMode mode)
void DismissEditorSelection() override
absl::Status DiscardPendingRomBackupRestore()
const std::vector< core::WriteConflict > & pending_write_conflicts() const
std::atomic< uint64_t > ui_sync_frame_id_
std::optional< size_t > active_project_context_session_id_
std::string GetPendingUnsavedSessionActionContinueLabel() const
std::string GetPendingUnsavedSessionActionPrompt() const
const project::YazeProject * GetCurrentProject() const
bool ApplyLayoutProfile(const std::string &profile_id)
Editor * GetEditorByType(EditorType type, EditorSet *editor_set) const
StartupVisibility sidebar_mode_override_
RomLoadOptionsDialog rom_load_options_dialog_
absl::Status LoadRom()
Load a ROM file into a new or existing session.
std::vector< std::string > startup_panel_hints_
std::vector< std::function< void()> > deferred_actions_
void OpenEditorAndPanelsFromFlags(const std::string &editor_name, const std::string &panels_str)
project::RomRole GetProjectRomRole() const
StartupVisibility dashboard_mode_override_
void BindProjectContextToSession(RomSession *session, const project::YazeProject &project)
std::optional< size_t > ResolveSessionIndexById(size_t session_id) const
static bool IsPanelBasedEditor(EditorType type)
absl::Status Update()
Main update loop for the editor application.
SessionCoordinator * session_coordinator()
absl::StatusOr< std::string > ResolveProjectRunTarget() const
absl::Status ImportProject(const std::string &project_path)
AgentUiController * GetAgentUiController()
core::VersionManager * GetVersionManager()
WorkspaceWindowManager * GetWindowManager()
void RequestCloseSession(size_t index) override
size_t GetCurrentSessionId() const
Stable workspace identity; unlike the UI index, it does not compact.
bool ProjectFileDraftTargetsCurrentProject() const
absl::Status PrepareActiveProjectEditorDraftsForSave()
AssetLoadMode asset_load_mode() const
ProjectWorkflowStatus MakeRunStatus(const std::string &summary, const std::string &detail, ProjectWorkflowState state) const
project::YazeProject * GetCurrentProject()
void QueueDeferredAction(std::function< void()> action)
absl::Status ValidateProjectRomSelection(const std::string &rom_path)
SelectionPropertiesPanel selection_properties_panel_
bool DeleteLayoutSnapshot(const std::string &name)
const SessionCoordinator * session_coordinator() const
ProjectFileEditor * project_file_editor()
void ConfigureSession(RomSession *session) override
std::unique_ptr< ActivityBar > activity_bar_
ShortcutManager shortcut_manager_
auto emulator() -> emu::Emulator &
const PanelHost * panel_host() const
emu::input::InputConfig BuildInputConfigFromSettings() const
bool RestoreLayoutSnapshot(const std::string &name, bool remove_after_restore=false)
bool HasPendingDungeonChangesForSession(size_t session_index) const
std::optional< PendingUnsavedSessionAction > pending_unsaved_session_action_
void MarkEditorInitialized(RomSession *session, EditorType type)
bool SessionHasPendingUnsavedWork(size_t session_index) const
std::unique_ptr< BackgroundCommandTask > active_project_build_
bool IsCurrentProjectContextOwnedBySession(size_t session_id) const
core::FeatureFlags::Flags * GetCurrentFeatureFlags()
WorkspaceManager workspace_manager_
yaze::zelda3::Overworld * overworld() const
void ConfigureEditorDependencies(EditorSet *editor_set, Rom *rom, size_t session_id)
int pending_pot_item_unloaded_rooms() const
absl::StatusOr< const project::YazeProject * > PrepareActiveProjectContextForSave()
std::unique_ptr< ProjectManagementPanel > project_management_panel_
std::unique_ptr< workflow::HackWorkflowBackend > hack_workflow_backend_
absl::Status OpenRomOrProject(const std::string &filename)
void RestoreProjectContextAfterFailedOpen(std::optional< size_t > previous_session_id)
void RemoveSession(size_t index)
absl::Status CheckOracleRomSafetyPreSave(Rom *rom)
UiSyncState GetUiSyncStateSnapshot() const
ProjectWorkflowStatus MakeBuildStatus(const std::string &summary, const std::string &detail, ProjectWorkflowState state, const std::string &output_tail="", bool can_cancel=false) const
absl::Status DiscardProvisionalSessionCreatedSince(size_t previous_session_count)
absl::Status EnsureEditorAssetsLoaded(EditorType type)
std::unique_ptr< PopupManager > popup_manager_
bool RestoreProjectContextForSession(RomSession *session)
std::atomic< int > pending_editor_deferred_actions_
std::unique_ptr< UICoordinator > ui_coordinator_
EditorActivator editor_activator_
absl::Status SetCurrentRom(Rom *rom)
std::string GetPendingUnsavedSessionActionSaveLabel() const
std::optional< PendingProjectRomSelection > pending_project_rom_selection_
std::unique_ptr< WindowHost > window_host_
void HandleSessionCreated(size_t index, RomSession *session)
bool EditorRequiresGameData(EditorType type) const
absl::Status ReplaceActiveSessionRom(Rom &&rom, const std::string &filepath)
Manages editor types, categories, and lifecycle.
Contains a complete set of editors for a single ROM instance.
Interface for editor classes.
Definition editor.h:245
EditorType type() const
Definition editor.h:306
Interface for editor selection and navigation.
Interface for session configuration.
Facade class that coordinates all layout-related operations.
float GetBottomLayoutOffset() const
Get the bottom margin needed for status bar.
float GetRightLayoutOffset() const
Get the right margin needed for drawers.
float GetLeftLayoutOffset() const
Get the left margin needed for sidebar (Activity Bar + Side Panel)
Fluent interface for building ImGui menus with icons.
Editor for .yaze project files with syntax highlighting and validation.
Panel for managing project settings, ROM versions, and snapshots.
Handles all project file operations with ROM-first workflow.
ImGui drawer for displaying and managing agent proposals.
Manages right-side sliding drawers for agent chat, proposals, settings.
Handles all ROM file I/O operations.
Manages ROM and project persistence state.
bool IsRomHashMismatch() const
Check whether the ROM hash mismatches the project's expected hash.
const std::string & current_rom_hash() const
Get the cached ROM hash string.
const std::vector< core::WriteConflict > & pending_write_conflicts() const
ROM load options and ZSCustomOverworld upgrade dialog.
Full-editing properties panel for selected entities.
High-level orchestrator for multi-session UI.
A session-aware status bar displayed at the bottom of the application.
Definition status_bar.h:54
Handles all UI drawing operations and state management.
Manages user preferences and settings persistence.
Modern welcome screen with project grid and quick actions.
Low-level window operations with minimal dependencies.
Thin host API over WorkspaceWindowManager for declarative window workflows.
Definition panel_host.h:43
Manages workspace layouts, sessions, and presets.
void SaveWorkspacePreset(const std::string &name)
void LoadWorkspacePreset(const std::string &name)
absl::Status SaveWorkspaceLayout(const std::string &name="")
absl::Status LoadWorkspaceLayout(const std::string &name="")
Central registry for all editor cards with session awareness and dependency injection.
A class for emulating and debugging SNES games.
Definition emulator.h:41
Defines an abstract interface for all rendering operations.
Definition irenderer.h:60
Represents the full Overworld data, light and dark world.
Definition overworld.h:389
#define LOG_WARN(category, format,...)
Definition log.h:107
void SetCurrentEditor(Editor *editor)
Set the currently active editor.
Editors are the view controllers for the application.
std::optional< EditorType > ParseEditorTypeFromString(absl::string_view name)
StartupVisibility
Tri-state toggle used for startup UI visibility controls.
AssetLoadMode
Asset loading mode for editor resources.
Configuration options for the application startup.
Definition application.h:26
std::optional< std::string > save_as_filename
Represents a single session, containing a ROM and its associated editors.
core::FeatureFlags::Flags feature_flags
Input configuration (platform-agnostic key codes)
std::string expected_hash
Definition project.h:109
RomWritePolicy write_policy
Definition project.h:110
Modern project structure with comprehensive settings consolidation.
Definition project.h:172