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"
52#include "app/emu/emulator.h"
53#include "app/startup_flags.h"
54#include "core/project.h"
56#include "imgui/imgui.h"
57#include "rom/rom.h"
58#include "util/log.h"
59#include "yaze_config.h"
61
62// Forward declarations for gRPC-dependent types
63namespace yaze {
64class CanvasAutomationServiceImpl;
65}
66
67namespace yaze::editor {
68class AgentEditor;
69namespace workflow {
71} // namespace workflow
72} // namespace yaze::editor
73
74namespace yaze {
75
76// Forward declaration for AppConfig
77struct AppConfig;
78
79namespace editor {
80
81std::optional<EditorType> ParseEditorTypeFromString(absl::string_view name);
82class EditorManagerLayoutTestPeer;
83
100
101 public:
108
114
115 // Constructor and destructor must be defined in .cc file for std::unique_ptr
116 // with forward-declared types
119
120 void Initialize(gfx::IRenderer* renderer, const std::string& filename = "");
121
122 // Processes startup flags to open a specific editor and panels.
123 void OpenEditorAndPanelsFromFlags(const std::string& editor_name,
124 const std::string& panels_str);
125
126 // Apply startup actions based on AppConfig
127 void ProcessStartupActions(const AppConfig& config);
128 void ApplyStartupVisibility(const AppConfig& config);
129 void SetStartupLoadHints(const AppConfig& config);
130
133
134 absl::Status Update();
135 void DrawMainMenuBar();
136
137 // Host visibility/focus lifecycle hook (e.g., OS space switching).
138 void HandleHostVisibilityChanged(bool visible);
139
140 auto emulator() -> emu::Emulator& { return emulator_; }
141 auto quit() const { return quit_; }
142 auto version() const { return version_; }
143
150 return right_drawer_manager_.get();
151 }
158 return window_manager_;
159 }
164 return session_coordinator_.get();
165 }
166 [[deprecated("Use window_host() instead.")]] PanelHost* panel_host() {
167 return window_host_.get();
168 }
169 [[deprecated("Use window_host() instead.")]] const PanelHost* panel_host()
170 const {
171 return window_host_.get();
172 }
174 const WindowHost* window_host() const { return window_host_.get(); }
175
176 // Layout offset calculation for dockspace adjustment
177 // Delegates to LayoutCoordinator for cleaner separation of concerns
187
188 absl::Status SetCurrentRom(Rom* rom);
189 Rom* GetCurrentRom() const override {
190 return session_coordinator_ ? session_coordinator_->GetCurrentRom()
191 : nullptr;
192 }
193 auto GetCurrentGameData() const -> zelda3::GameData* {
194 return session_coordinator_ ? session_coordinator_->GetCurrentGameData()
195 : nullptr;
196 }
198 return session_coordinator_ ? session_coordinator_->GetCurrentEditorSet()
199 : nullptr;
200 }
201 auto GetCurrentEditor() const -> Editor* override { return current_editor_; }
202 std::string GetCurrentRomHash() const {
204 }
215 std::vector<editor::RomFileManager::BackupEntry> GetRomBackups() const;
216 bool IsRomBackupRestorePending() const;
217 absl::Status RestoreRomBackup(const std::string& backup_path);
218 absl::Status DiscardPendingRomBackupRestore();
219 absl::Status PruneRomBackups();
220 void ConfirmRomWrite();
225
226 // Write conflict warning (ASM-owned address protection)
227 const std::vector<core::WriteConflict>& pending_write_conflicts() const {
229 }
232 void SetCurrentEditor(Editor* editor) override {
233 current_editor_ = editor;
234 // Update ContentRegistry context for panel access
236 // Update help panel's editor context for context-aware help
237 if (right_drawer_manager_ && editor) {
238 right_drawer_manager_->SetActiveEditor(editor->type());
239 }
240 }
242 size_t GetCurrentSessionId() const {
243 return session_coordinator_ ? session_coordinator_->GetActiveSessionId()
244 : 0;
245 }
248
249 // Session management helpers (compact, zero-based UI ordering)
250 size_t GetCurrentSessionIndex() const;
251
252 // Get current session's feature flags (falls back to global if no session)
254 size_t current_index = GetCurrentSessionIndex();
256 current_index < session_coordinator_->GetTotalSessionCount()) {
257 auto* session = static_cast<RomSession*>(
258 session_coordinator_->GetSession(current_index));
259 if (session) {
260 return &session->feature_flags;
261 }
262 }
263 return &core::FeatureFlags::get(); // Fallback to global
264 }
265
266 void SetFontGlobalScale(float scale) {
268 ImGui::GetIO().FontGlobalScale = scale;
269 auto status = user_settings_.Save();
270 if (!status.ok()) {
271 LOG_WARN("EditorManager", "Failed to save user settings: %s",
272 status.ToString().c_str());
273 }
274 }
275
277 const UserSettings& user_settings() const { return user_settings_; }
278
279 // Workspace management (delegates to WorkspaceManager)
281 void SaveWorkspacePreset(const std::string& name) {
283 }
284 void LoadWorkspacePreset(const std::string& name) {
286 }
287
288 // Jump-to functionality for cross-editor navigation
289 void SwitchToEditor(EditorType editor_type, bool force_visible = false,
290 bool from_dialog = false) override;
291 void DismissEditorSelection() override;
292
293 // Panel-based editor registry
294 static bool IsPanelBasedEditor(EditorType type);
295 bool IsSidebarVisible() const {
296 return ui_coordinator_ ? ui_coordinator_->IsPanelSidebarVisible() : false;
297 }
298 void SetSidebarVisible(bool visible) {
299 if (ui_coordinator_) {
300 ui_coordinator_->SetPanelSidebarVisible(visible);
301 }
302 }
303
304 // Lazy asset loading helpers
305 absl::Status EnsureEditorAssetsLoaded(EditorType type);
306 absl::Status EnsureGameDataLoaded();
307
308 // Session management
309 void CreateNewSession();
311 void CloseCurrentSession();
312 void RemoveSession(size_t index);
313 void SwitchToSession(size_t index);
314 void RequestSwitchToSession(size_t index) override { SwitchToSession(index); }
315 void RequestCloseSession(size_t index) override { RemoveSession(index); }
316 size_t GetActiveSessionCount() const;
317
318 // Workspace layout management
319 // Window management - inline delegation (reduces EditorManager bloat)
324 if (ui_coordinator_)
325 ui_coordinator_->ShowAllWindows();
326 }
328 if (ui_coordinator_)
329 ui_coordinator_->HideAllWindows();
330 }
331
332 // Layout presets (inline delegation)
336
337 // Panel layout presets (command palette accessible)
338 void ApplyLayoutPreset(const std::string& preset_name);
339 bool ApplyLayoutProfile(const std::string& profile_id);
341 void RestoreTemporaryLayoutSnapshot(bool clear_after_restore = false);
343
344 // Named, session-scoped layout snapshots (in-memory, multi-slot).
345 bool SaveLayoutSnapshotAs(const std::string& name);
346 bool RestoreLayoutSnapshot(const std::string& name,
347 bool remove_after_restore = false);
348 bool DeleteLayoutSnapshot(const std::string& name);
349 std::vector<std::string> ListLayoutSnapshots() const;
350
352
353 // Helper methods
354 std::string GenerateUniqueEditorTitle(EditorType type,
355 size_t session_index) const;
356 bool HasDuplicateSession(const std::string& filepath);
357 void RenameSession(size_t index, const std::string& new_name);
358 void Quit();
359
361 std::string GetPendingUnsavedSessionActionPrompt() const;
362 std::string GetPendingUnsavedSessionActionSaveLabel() const;
367
368 // Deferred action queue - actions executed safely on next frame
369 // Use this to avoid modifying ImGui state during menu/popup rendering
370 void QueueDeferredAction(std::function<void()> action) {
371 deferred_actions_.push_back(std::move(action));
372 pending_editor_deferred_actions_.fetch_add(1, std::memory_order_relaxed);
373 }
374
375 UiSyncState GetUiSyncStateSnapshot() const;
376
377 // Public for SessionCoordinator to configure new sessions
378 void ConfigureSession(RomSession* session) override;
379
380#ifdef YAZE_WITH_GRPC
381 void SetCanvasAutomationService(CanvasAutomationServiceImpl* service) {
382 canvas_automation_service_ = service;
383 }
384#endif
385
386 // UI visibility controls (public for MenuOrchestrator)
387 // UI visibility controls - inline for performance (single-line wrappers
388 // delegating to UICoordinator)
390 if (ui_coordinator_)
391 ui_coordinator_->SetImGuiDemoVisible(true);
392 }
394 if (ui_coordinator_)
395 ui_coordinator_->SetImGuiMetricsVisible(true);
396 }
397
398#ifdef YAZE_ENABLE_TESTING
399 void ShowTestDashboard() { show_test_dashboard_ = true; }
400#endif
401
402#ifdef YAZE_BUILD_AGENT_UI
403 void ShowAIAgent();
404 void ShowChatHistory();
405 AgentEditor* GetAgentEditor() { return agent_ui_.GetAgentEditor(); }
406 AgentUiController* GetAgentUiController() { return &agent_ui_; }
407#else
408 AgentEditor* GetAgentEditor() { return nullptr; }
410#endif
411#ifdef YAZE_BUILD_AGENT_UI
412 void ShowProposalDrawer() { proposal_drawer_.Show(); }
413#endif
414
415 // ROM and Project operations (public for MenuOrchestrator)
416 absl::Status LoadRom();
417 absl::Status SaveRom();
418 absl::Status SaveRomAs(const std::string& filename);
419 absl::Status ResumePendingRomSave();
420 absl::Status OpenRomOrProject(const std::string& filename);
421 absl::Status CreateNewProject(
422 const std::string& template_name = "Basic ROM Hack");
423 absl::Status CreateNewProjectFromRom(
424 const std::string& template_name, const std::string& rom_path,
425 const std::string& project_name,
426 const std::string& project_path = std::string());
427 absl::Status FinalizeNewProject(
428 const std::string& project_name,
429 const std::string& project_path = std::string());
430 absl::Status OpenProject();
431 absl::Status SaveProject();
432 absl::Status SaveProjectAs();
433 absl::Status SaveProjectAs(const std::string& filepath);
434 absl::Status AutosaveActiveSession();
435 absl::Status BuildCurrentProject();
438 absl::Status RunCurrentProject();
439
450 absl::Status ImportProject(const std::string& project_path);
451 absl::Status RepairCurrentProject();
452
453 // Project management
454 absl::Status LoadProjectWithRom();
455 absl::Status SwapProjectRom(const std::string& rom_path);
456 absl::Status ReloadProjectRom();
459 return &current_project_;
460 }
461 // True only for the session whose project is currently restored into
462 // current_project_. SessionCoordinator also performs transient switches
463 // while drawing inactive sessions, so its active session is not sufficient
464 // for routing project mutations or saves.
465 bool IsCurrentProjectContextOwnedBySession(size_t session_id) const {
466 return active_project_context_session_id_.has_value() &&
468 }
470 bool IsCurrentProjectDirty() const;
472
473 // Show project management panel in right sidebar
475
476 // Show project file editor
482
483 private:
484 absl::Status DrawRomSelector() = delete; // Moved to UICoordinator
485 // DrawContextSensitivePanelControl removed - card control moved to sidebar
486
487 // Optional loading_handle for WASM progress tracking (0 = create new)
488 absl::Status LoadAssets(uint64_t loading_handle = 0);
489 absl::Status LoadAssetsForMode(uint64_t loading_handle = 0);
490 absl::Status LoadAssetsLazy(uint64_t loading_handle = 0);
491 absl::Status InitializeEditorForType(EditorType type, EditorSet* editor_set,
492 Rom* rom);
493 void ResetAssetState(RomSession* session);
494 void MarkEditorInitialized(RomSession* session, EditorType type);
495 void MarkEditorLoaded(RomSession* session, EditorType type);
498 Editor* GetEditorByType(EditorType type, EditorSet* editor_set) const;
499 Editor* ResolveEditorForCategory(const std::string& category);
500 void SyncEditorContextForCategory(const std::string& category);
501 bool EditorRequiresGameData(EditorType type) const;
502 bool EditorInitRequiresGameData(EditorType type) const;
503 std::vector<EditorType> CollectEditorsToPreload(EditorSet* editor_set) const;
504
505 // Testing system
509 // Returns a preferred startup category. Honors the last-active category
510 // (including Emulator). Never defaults to Emulator when nothing was saved.
511 std::string GetPreferredStartupCategory(
512 const std::string& saved_category,
513 const std::vector<std::string>& available_categories) const;
514
515 // Session event handlers (EventBus subscribers)
516 void HandleSessionSwitched(size_t new_index, RomSession* session,
517 bool transient = false);
518 void HandleSessionCreated(size_t index, RomSession* session);
519 void HandleSessionClosed(size_t index);
520 // Initialization helpers (extracted from constructor for readability)
521 void SubscribeToEvents();
523 void RegisterEditors();
525 void InitializeServices();
530 void ProcessInput();
531 void UpdateEditorState();
533 void DrawInterface();
535 void UpdateSystemUIs();
536 void RunEmulator();
538
539 void HandleSessionRomLoaded(size_t index, Rom* rom);
541
542 // UI action event handler (EventBus subscriber for UIActionRequestEvent)
544
545 bool quit_ = false;
546
547 // Note: All show_* flags are being moved to UICoordinator
548 // Access via ui_coordinator_->IsXxxVisible() or SetXxxVisible()
549
550 // Workspace dialog flags (managed by EditorManager, not UI)
554
555 // Note: Most UI visibility flags have been moved to UICoordinator
556 // Access via ui_coordinator_->IsXxxVisible() or SetXxxVisible()
557
558 // Agent proposal drawer
561
562 // Agent UI (chat + editor), no-op when agent UI is disabled
564
565 // Project file editor
567
568 // Editor selection and the Welcome screen are managed by UICoordinator.
569 std::unique_ptr<DashboardPanel> dashboard_panel_;
577 std::vector<std::string> startup_panel_hints_;
578
579 // Properties panel for selection editing
581
582 // Project management panel for version control and ROM management
583 std::unique_ptr<ProjectManagementPanel> project_management_panel_;
584
585 std::string version_ = "";
586 absl::Status status_;
588
589 public:
590 private:
592 // Tracks which session is currently active so delegators (menus, popups,
593 // shortcuts) stay in sync without relying on per-editor context.
594
596
599 std::string previous_path;
600 std::string candidate_path;
601 };
602 std::optional<PendingProjectRomSelection> pending_project_rom_selection_;
606 // current_project_ is a stable-address working copy owned by the active
607 // user-facing session. Stable IDs survive UI-index compaction.
609 // The global FeatureFlags singleton is also rebound during transient frame
610 // iteration, so track which session currently owns its value separately.
612 // Non-owning view of the active session's VersionManager. Each RomSession
613 // owns its manager so EditorSet dependency pointers remain valid while that
614 // session is inactive.
617 std::unique_ptr<PopupManager> popup_manager_;
622
623 // New delegated components (dependency injection architecture)
625 window_manager_; // Window management with session awareness
626 std::unique_ptr<WindowHost> window_host_;
628 std::unique_ptr<MenuOrchestrator> menu_orchestrator_;
631 std::unique_ptr<UICoordinator> ui_coordinator_;
634 std::unique_ptr<SessionCoordinator> session_coordinator_;
635 std::unique_ptr<LayoutManager>
636 layout_manager_; // DockBuilder layout management
637 LayoutCoordinator layout_coordinator_; // Facade for layout operations
638 std::unique_ptr<RightDrawerManager>
639 right_drawer_manager_; // Right-side drawer system
640 StatusBar status_bar_; // Bottom status bar
641 std::unique_ptr<ActivityBar> activity_bar_;
643
654 const project::YazeProject& project);
657 absl::Status SaveActiveProjectEditingWork();
658 absl::Status PrepareRawProjectFileSave(const std::string& filepath,
659 const std::string& contents);
660 absl::Status CommitRawProjectFileSave(const std::string& filepath,
661 const std::string& contents);
662 absl::Status ReplaceActiveSessionRom(Rom&& rom, const std::string& filepath);
664 void RebaseCleanProjectFileDraft(const std::string& filepath);
666 std::optional<size_t> previous_session_id);
668 size_t previous_session_count);
670 absl::StatusOr<const project::YazeProject*>
672 ProjectWorkflowStatus MakeBuildStatus(const std::string& summary,
673 const std::string& detail,
675 const std::string& output_tail = "",
676 bool can_cancel = false) const;
677 ProjectWorkflowStatus MakeRunStatus(const std::string& summary,
678 const std::string& detail,
679 ProjectWorkflowState state) const;
680 absl::StatusOr<std::string> RunProjectBuildCommand();
681 absl::StatusOr<std::string> ResolveProjectBuildCommand() const;
682 absl::StatusOr<std::string> ResolveProjectRunTarget() const;
683 absl::Status CheckRomWritePolicy(
684 const std::optional<std::string>& target_filename = std::nullopt);
685 absl::Status CheckOracleRomSafetyPreSave(Rom* rom);
686 absl::Status SaveRomInternal(
687 const std::optional<std::string>& save_as_filename);
690 void FinishPendingRomSaveAttempt(const absl::Status& status);
691 void CancelPendingRomSave(bool hide_popups = false);
692 absl::Status StartPendingRomSave(
693 const std::optional<std::string>& save_as_filename);
694 absl::Status LoadRomInternal();
695 absl::Status OpenRomOrProjectInternal(const std::string& filename);
696 absl::Status OpenProjectInternal();
697 absl::Status ValidateProjectRomSelection(const std::string& rom_path);
698
708
710 size_t source_session_id = SIZE_MAX;
711 size_t target_session_id = SIZE_MAX;
712 std::string path;
713 };
714
715 std::optional<size_t> ResolveSessionIndexById(size_t session_id) const;
718 const PendingUnsavedSessionAction& action);
719 bool SessionHasPendingUnsavedWork(size_t session_index) const;
720 bool SessionHasPendingRomWork(size_t session_index) const;
722 bool HasPendingDungeonChangesForSession(size_t session_index) const;
723 int PendingDungeonRoomCountForSession(size_t session_index) const;
724 size_t PendingPaletteColorCountForSession(size_t session_index) const;
725 int ModifiedSessionCount() const;
726 std::string DescribePendingUnsavedWork(size_t session_index) const;
727 std::string CompactPendingUnsavedWorkLabel(size_t session_index) const;
728 std::string DescribeAllPendingUnsavedWork() const;
729
730 float autosave_timer_ = 0.0f;
731 bool settings_dirty_ = false;
734 std::optional<PendingUnsavedSessionAction> pending_unsaved_session_action_;
735
736 // ROM lifecycle state (hash, write policy, confirmation dialogs, backups)
737 // Mutable because some const accessors delegate to it.
740 std::optional<std::string> save_as_filename;
741 size_t session_index = SIZE_MAX;
742 Rom* rom = nullptr;
743 };
744 std::optional<PendingRomSave> pending_rom_save_;
745
746 // Deferred action queue - executed at the start of each frame
747 std::vector<std::function<void()>> deferred_actions_;
749 std::atomic<uint64_t> ui_sync_frame_id_{0};
750 std::unique_ptr<BackgroundCommandTask> active_project_build_;
752
753 // Core Event Bus and Context
755 std::unique_ptr<GlobalEditorContext> editor_context_;
756 std::unique_ptr<workflow::HackWorkflowBackend> hack_workflow_backend_;
757
758#ifdef YAZE_WITH_GRPC
759 CanvasAutomationServiceImpl* canvas_automation_service_ = nullptr;
760#endif
761
762 // RAII helper for clean session context switching
764 public:
765 SessionScope(EditorManager* manager, size_t session_index);
767
768 private:
773 };
774
775 void ConfigureEditorDependencies(EditorSet* editor_set, Rom* rom,
776 size_t session_id);
778};
779
780} // namespace editor
781} // namespace yaze
782
783#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
std::string CompactPendingUnsavedWorkLabel(size_t session_index) 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())
friend class EditorManagerLayoutTestPeer
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
void RestoreActiveEditorLayoutAfterAssets(RomSession *session)
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 RestoreEditorLayoutAfterAssets(RomSession *session, EditorType type)
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:311
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:57
Handles all UI drawing operations and state management.
Manages user preferences and settings persistence.
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:108
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