Implement multi-session support and welcome screen in EditorManager
- Removed the homepage display logic and replaced it with a welcome screen that appears when no ROM is loaded or no active editors are present. - Enhanced session management by iterating through all sessions to check for active editors, allowing for better multi-session docking. - Introduced new methods for generating unique editor titles based on session context and added feature flags for per-session configurations. - Added safeguards for ROM loading state checks in editor methods to prevent operations on unloaded ROMs.
This commit is contained in:
@@ -164,6 +164,10 @@ void OverworldEditor::Initialize() {
|
||||
}
|
||||
|
||||
absl::Status OverworldEditor::Load() {
|
||||
if (!rom_ || !rom_->is_loaded()) {
|
||||
return absl::FailedPreconditionError("ROM not loaded");
|
||||
}
|
||||
|
||||
RETURN_IF_ERROR(LoadGraphics());
|
||||
RETURN_IF_ERROR(
|
||||
tile16_editor_.Initialize(tile16_blockset_bmp_, current_gfx_bmp_,
|
||||
|
||||
@@ -106,6 +106,14 @@ class OverworldEditor : public Editor, public gfx::GfxContext {
|
||||
int jump_to_tab() { return jump_to_tab_; }
|
||||
int jump_to_tab_ = -1;
|
||||
|
||||
// ROM state methods (from Editor base class)
|
||||
bool IsRomLoaded() const override { return rom_ && rom_->is_loaded(); }
|
||||
std::string GetRomStatus() const override {
|
||||
if (!rom_) return "No ROM loaded";
|
||||
if (!rom_->is_loaded()) return "ROM failed to load";
|
||||
return absl::StrFormat("ROM loaded: %s", rom_->title());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Load the Bitmap objects for each OverworldMap.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user