refactor(editor): improve visibility management for card-based editors

- Updated EditorManager to pass visibility flags directly to memory and assembly editors, enhancing the responsiveness of the editor interface.
- Simplified visibility checks by retrieving flags from the EditorCardManager, ensuring accurate updates based on user interactions.

Benefits:
- Streamlines the editor update process, improving user experience by ensuring editors reflect their visibility state accurately.
This commit is contained in:
scawful
2025-10-12 20:52:37 -04:00
parent e5aff24bfc
commit a2e219c33b

View File

@@ -1568,15 +1568,19 @@ void EditorManager::DrawMenuBar() {
ShowMetricsWindow(&show_imgui_metrics_);
auto& card_manager = gui::EditorCardManager::Get();
if (card_manager.IsCardVisible("memory.hex_editor") && current_editor_set_) {
bool show_memory = true;
current_editor_set_->memory_editor_.Update(show_memory);
if (current_editor_set_) {
// Pass the actual visibility flag pointer so the X button works
bool* hex_visibility = card_manager.GetVisibilityFlag("memory.hex_editor");
if (hex_visibility && *hex_visibility) {
current_editor_set_->memory_editor_.Update(*hex_visibility);
}
bool* assembly_visibility = card_manager.GetVisibilityFlag("assembly.editor");
if (assembly_visibility && *assembly_visibility) {
current_editor_set_->assembly_editor_.Update(*card_manager.GetVisibilityFlag("assembly.editor"));
}
}
if (card_manager.IsCardVisible("assembly.editor") && current_editor_set_) {
bool show_asm = true;
current_editor_set_->assembly_editor_.Update(show_asm);
}
// Project file editor
project_file_editor_.Draw();
if (show_performance_dashboard_) {