refactor: Update window creation and file dialog handling for improved consistency
- Replaced `SDL_Deleter` with `util::SDL_Deleter` in window creation for better utility usage. - Updated file dialog methods to consistently reference `core::FeatureFlags` for feature flag checks. - Refactored file extension retrieval in `EditorManager` to use `util::GetFileExtension` for consistency. - Adjusted `MusicEditor` constructor to accept a ROM pointer, enhancing initialization clarity. - Commented out unused code in `MusicEditor` to improve readability and maintainability. - Updated include paths in `overworld_editor.cc` for better organization. - Cleaned up commented-out code in `editor_selection_dialog.cc` and `welcome_screen.cc` for clarity.
This commit is contained in:
@@ -42,9 +42,10 @@ EditorSelectionDialog::EditorSelectionDialog() {
|
||||
|
||||
{EditorType::kAssembly, "Assembly", ICON_MD_CODE,
|
||||
"Write and edit assembly code", "Ctrl+9", false, false},
|
||||
|
||||
{EditorType::kMemory, "Hex Editor", ICON_MD_DATA_ARRAY,
|
||||
"Direct ROM memory editing", "Ctrl+0", false, true},
|
||||
|
||||
// TODO: Fix this
|
||||
// {EditorType::kHex, "Hex Editor", ICON_MD_DATA_ARRAY,
|
||||
// "Direct ROM memory editing", "Ctrl+0", false, true},
|
||||
|
||||
{EditorType::kSettings, "Settings", ICON_MD_SETTINGS,
|
||||
"Configure ROM and project settings", "", false, true},
|
||||
@@ -92,14 +93,15 @@ bool EditorSelectionDialog::Show(bool* p_open) {
|
||||
for (size_t i = 0; i < editors_.size(); ++i) {
|
||||
ImGui::TableNextColumn();
|
||||
DrawEditorCard(editors_[i], static_cast<int>(i));
|
||||
|
||||
if (selected_editor_ != EditorType::kNone) {
|
||||
editor_selected = true;
|
||||
MarkRecentlyUsed(selected_editor_);
|
||||
if (selection_callback_) {
|
||||
selection_callback_(selected_editor_);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Fix this
|
||||
// if (selected_editor_ != EditorType::kNone) {
|
||||
// editor_selected = true;
|
||||
// MarkRecentlyUsed(selected_editor_);
|
||||
// if (selection_callback_) {
|
||||
// selection_callback_(selected_editor_);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
@@ -230,7 +232,7 @@ void EditorSelectionDialog::LoadRecentEditors() {
|
||||
while (std::getline(ss, line) &&
|
||||
recent_editors_.size() < kMaxRecentEditors) {
|
||||
int type_int = std::stoi(line);
|
||||
if (type_int >= 0 && type_int < static_cast<int>(EditorType::kLast)) {
|
||||
if (type_int >= 0 && type_int < static_cast<int>(EditorType::kSettings)) {
|
||||
recent_editors_.push_back(static_cast<EditorType>(type_int));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,20 +30,21 @@ ImVec4 GetThemedColor(const char* color_name, const ImVec4& fallback) {
|
||||
auto& theme_mgr = gui::ThemeManager::Get();
|
||||
const auto& theme = theme_mgr.GetCurrentTheme();
|
||||
|
||||
// TODO: Fix this
|
||||
// Map color names to theme colors
|
||||
if (strcmp(color_name, "triforce_gold") == 0) {
|
||||
return theme.accent.to_im_vec4();
|
||||
} else if (strcmp(color_name, "hyrule_green") == 0) {
|
||||
return theme.success.to_im_vec4();
|
||||
} else if (strcmp(color_name, "master_sword_blue") == 0) {
|
||||
return theme.info.to_im_vec4();
|
||||
} else if (strcmp(color_name, "ganon_purple") == 0) {
|
||||
return theme.secondary.to_im_vec4();
|
||||
} else if (strcmp(color_name, "heart_red") == 0) {
|
||||
return theme.error.to_im_vec4();
|
||||
} else if (strcmp(color_name, "spirit_orange") == 0) {
|
||||
return theme.warning.to_im_vec4();
|
||||
}
|
||||
// if (strcmp(color_name, "triforce_gold") == 0) {
|
||||
// return theme.accent.to_im_vec4();
|
||||
// } else if (strcmp(color_name, "hyrule_green") == 0) {
|
||||
// return theme.success.to_im_vec4();
|
||||
// } else if (strcmp(color_name, "master_sword_blue") == 0) {
|
||||
// return theme.info.to_im_vec4();
|
||||
// } else if (strcmp(color_name, "ganon_purple") == 0) {
|
||||
// return theme.secondary.to_im_vec4();
|
||||
// } else if (strcmp(color_name, "heart_red") == 0) {
|
||||
// return theme.error.to_im_vec4();
|
||||
// } else if (strcmp(color_name, "spirit_orange") == 0) {
|
||||
// return theme.warning.to_im_vec4();
|
||||
// }
|
||||
|
||||
return fallback;
|
||||
}
|
||||
@@ -262,7 +263,7 @@ void WelcomeScreen::RefreshRecentProjects() {
|
||||
recent_projects_.clear();
|
||||
|
||||
// Use the ProjectManager singleton to get recent files
|
||||
auto& recent_files = core::ProjectManager::GetInstance().GetRecentFiles();
|
||||
auto& recent_files = core::RecentFilesManager::GetInstance().GetRecentFiles();
|
||||
|
||||
for (const auto& filepath : recent_files) {
|
||||
if (recent_projects_.size() >= kMaxRecentProjects) break;
|
||||
|
||||
Reference in New Issue
Block a user