13#ifdef YAZE_ENABLE_TESTING
27 .dungeon_tile_patterns =
41 const bool needs_version_manager =
48 if (needs_version_manager) {
71 if (ImGui::GetCurrentContext() !=
nullptr) {
78 const auto custom_object_state =
82 custom_object_manager.ActivateRuntimeContext(
86 custom_object_manager.RestoreState(custom_object_state);
182 "Session %zu has no project context; saves are disabled",
192 const auto custom_object_state =
257 if (session !=
nullptr && !category.empty() &&
261 const size_t session_id = session ? session->
session_id() : new_index;
275 const size_t active_editor_index =
EditorTypeIndex(active_editor_type);
276 const bool active_session_editor_initialized =
277 session !=
nullptr &&
280 if (!transient && active_editor !=
nullptr &&
282 active_session_editor_initialized &&
287#ifdef YAZE_ENABLE_TESTING
295 LOG_DEBUG(
"EditorManager",
"Session switched to %zu via EventBus", new_index);
316 const size_t session_id = session ? session->
session_id() : index;
326 LOG_INFO(
"EditorManager",
"Session %zu created via EventBus", index);
339 auto* closing_session =
343 if (closing_session !=
nullptr) {
345 closing_session->session_id());
347 if (closing_session !=
nullptr &&
359 palette_session = active_session;
360 if (closing_session !=
nullptr && active_session == closing_session &&
362 const size_t replacement_index = index > 0 ? index - 1 : 1;
368 palette_session ? &palette_session->
game_data :
nullptr);
380#ifdef YAZE_ENABLE_TESTING
385 LOG_INFO(
"EditorManager",
"Session %zu closed via EventBus", index);
404#ifdef YAZE_ENABLE_TESTING
410 LOG_INFO(
"EditorManager",
"ROM loaded in session %zu via EventBus", index);
419 if (index == current_index ||
428 current_session_id, target_session_id})) {
445 size_t session_index)
447 prev_rom_(manager->GetCurrentRom()),
448 prev_editor_set_(manager->GetCurrentEditorSet()),
449 prev_session_index_(manager->GetCurrentSessionIndex()) {
456 manager_->session_coordinator_->SwitchToSession(prev_session_index_);
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
static RomSettings & Get()
void SetAddressOverrides(const RomAddressOverrides &overrides)
void InitializeEditorLayout(EditorType type)
Initialize the DockBuilder layout for an editor.
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_
std::optional< PendingRomSave > pending_rom_save_
void ApplyDefaultBackupPolicy()
void RestoreProjectEditingStateForSession(RomSession *session)
bool MaybeGuardPendingSessionAction(PendingUnsavedSessionAction action)
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
void SwitchToSession(size_t index)
bool pending_project_open_transition_
Rom * GetCurrentRom() const override
void CancelPendingRomSave(bool hide_popups=false)
std::unique_ptr< LayoutManager > layout_manager_
void HandleSessionClosed(size_t index)
void ResetAssetState(RomSession *session)
core::VersionManager * version_manager_
Editor * ResolveEditorForCategory(const std::string &category)
std::optional< size_t > runtime_feature_flags_session_id_
uint64_t project_rom_selection_generation_
void HandleSessionRomLoaded(size_t index, Rom *rom)
void RestoreCurrentRomIdentity()
ProjectFileEditor project_file_editor_
WorkspaceWindowManager window_manager_
std::optional< size_t > pending_project_open_previous_session_id_
void CaptureActiveProjectContext()
bool PendingRomSaveMatchesActiveSession() const
std::optional< size_t > active_project_context_session_id_
void BindProjectContextToSession(RomSession *session, const project::YazeProject &project)
void ApplyCurrentProjectRuntimeContext()
void RefreshHackWorkflowBackend()
size_t GetCurrentSessionIndex() const
size_t GetCurrentSessionId() const
Stable workspace identity; unlike the UI index, it does not compact.
SelectionPropertiesPanel selection_properties_panel_
void ConfigureSession(RomSession *session) override
void RefreshResourceLabelProvider()
void SyncLayoutScopeFromCurrentProject()
UserSettings user_settings_
void ConfigureEditorDependencies(EditorSet *editor_set, Rom *rom, size_t session_id)
std::unique_ptr< ProjectManagementPanel > project_management_panel_
bool RestoreProjectContextForSession(RomSession *session)
EditorActivator editor_activator_
std::optional< PendingProjectRomSelection > pending_project_rom_selection_
void HandleSessionCreated(size_t index, RomSession *session)
void CaptureRuntimeFeatureFlags()
static bool IsPanelBasedEditor(EditorType type)
size_t session_id() const
void set_user_settings(UserSettings *settings)
SettingsPanel * GetSettingsPanel() const
Interface for editor classes.
void RestoreState(const ProjectFileEditorState &state, project::YazeProject *project)
void ResetForProject(project::YazeProject *project)
void SetProjectContext(const project::YazeProject *project)
void ApplyDefaultBackupPolicy(bool enabled, const std::string &folder, int retention_count, bool keep_daily, int keep_daily_days)
Apply default backup policy from user settings.
void ClearSelection()
Clear the current selection.
void RestoreVisibilityState(size_t session_id, const std::unordered_map< std::string, bool > &state, bool publish_events=false)
Restore panel visibility state from persistence.
std::string GetActiveCategory() const
static constexpr const char * kDashboardCategory
void RegisterRegistryWindowContentsForSession(size_t session_id)
Register descriptors for all registry window contents in a session.
void RestorePinnedState(const std::unordered_map< std::string, bool > &state)
Restore pinned panel state from persistence.
void BindGraphicsSheets(GraphicsSheets *sheets, const void *owner)
void ActivateSession(zelda3::GameData *game_data)
Select the palette state for a ROM session without resnapshotting it.
void CommitColorEdit(uint64_t caller_id=0)
static PaletteManager & Get()
Get the singleton instance.
void SetCurrentRom(Rom *rom)
static TestManager & Get()
void RemoveRuntimeContext(uint64_t context_id)
static CustomObjectManager & Get()
void ActivateRuntimeContext(uint64_t context_id, const State &state)
void ActivateStandaloneContext()
void RefreshFeatureFlagMappings()
static DrawRoutineRegistry & Get()
#define LOG_DEBUG(category, format,...)
#define LOG_ERROR(category, format,...)
#define LOG_INFO(category, format,...)
void SetEditorWindowContext(const std::string &category, Editor *editor)
void SetRom(Rom *rom)
Set the current ROM instance.
void SetGameData(::yaze::zelda3::GameData *data)
Set the current game data instance.
void Clear()
Clear all context state.
void SetCurrentProject(::yaze::project::YazeProject *project)
Set the current project instance.
zelda3::CustomObjectManager::State BuildCustomObjectRuntimeState(const project::YazeProject &project)
Editors are the view controllers for the application.
size_t EditorTypeIndex(EditorType type)
Represents a single session, containing a ROM and its associated editors.
core::FeatureFlags::Flags feature_flags
void ActivateGraphicsDisplay()
ProjectFileEditorState project_file_editor_state
size_t session_id() const
std::array< bool, kEditorTypeCount > editor_initialized
zelda3::GameData game_data
std::unique_ptr< core::VersionManager > version_manager
std::optional< project::YazeProject > project_context
std::unordered_map< std::string, std::unordered_map< std::string, bool > > panel_visibility_state
std::unordered_map< std::string, bool > pinned_panels
int backup_keep_daily_days
int backup_retention_count
float autosave_interval_secs
Modern project structure with comprehensive settings consolidation.
std::string rom_backup_folder
std::unordered_map< int, std::vector< std::string > > custom_object_files
std::string custom_objects_folder
bool project_opened() const
WorkspaceSettings workspace_settings
std::string GetAbsolutePath(const std::string &relative_path) const
std::string dungeon_tile_patterns
core::FeatureFlags::Flags feature_flags
core::RomAddressOverrides rom_address_overrides