Refactor EditorManager: remove DrawRomMenu method and simplify Close function

This commit is contained in:
scawful
2025-02-10 11:50:17 -05:00
parent c7608a8c0f
commit 169bd09495
3 changed files with 2 additions and 18 deletions

View File

@@ -435,7 +435,7 @@ void EditorManager::DrawMenuContent() {
if (rom()->is_loaded()) {
MENU_ITEM("Close") {
status_ = rom()->Close();
rom()->Close();
rom_assets_loaded_ = false;
}
}
@@ -705,20 +705,6 @@ void EditorManager::DrawMenuContent() {
}
}
void EditorManager::DrawRomMenu() {
if (roms_.empty()) return;
// Dropdown in the center of the menu bar with ROMs
if (BeginMenu("ROM")) {
for (size_t i = 0; i < roms_.size(); ++i) {
if (MenuItem(roms_[i]->title().c_str())) {
current_rom_ = roms_[i].get();
}
}
EndMenu();
}
}
void EditorManager::LoadRom() {
auto file_name = FileDialogWrapper::ShowOpenFileDialog();
auto load_rom = rom()->LoadFromFile(file_name);

View File

@@ -68,7 +68,6 @@ class EditorManager : public SharedRom {
void DrawMenuBar();
void DrawMenuContent();
void DrawRomMenu();
void LoadRom();
void SaveRom();

View File

@@ -104,11 +104,10 @@ class Rom {
size_ = size;
}
absl::Status Close() {
void Close() {
rom_data_.clear();
size_ = 0;
is_loaded_ = false;
return absl::OkStatus();
}
absl::StatusOr<uint8_t> ReadByte(int offset);