feat(editor): enhance EditorManager with card-based editor functionality

- Introduced methods to determine if an editor is card-based and to retrieve its category.
- Implemented a sidebar toggle shortcut (Ctrl+B) for managing card visibility.
- Added functionality to hide current editor cards when switching editors.
- Updated editor initialization to register global shortcuts for activating specific editors.
- Enhanced the Update method to draw a sidebar for the current category editor.

Benefits:
- Improved user experience by organizing editor cards and providing quick access to editor categories.
- Streamlined editor management, making it easier to switch between different editing contexts.
This commit is contained in:
scawful
2025-10-12 11:57:39 -04:00
parent b7f78008b7
commit 312522d709
20 changed files with 2213 additions and 343 deletions

View File

@@ -254,50 +254,7 @@ void ThemedProgressBar(float fraction, const ImVec2& size, const char* overlay)
// ============================================================================
// Palette Editor Widgets
// ============================================================================
bool PaletteColorButton(const char* label, const yaze::gfx::SnesColor& color,
bool is_selected, bool is_modified,
const ImVec2& size) {
const auto& theme = GetTheme();
int style_count = 0;
// Draw modified indicator with warning border
if (is_modified) {
ImGui::PushStyleColor(ImGuiCol_Border, ConvertColorToImVec4(theme.warning));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 2.0f);
style_count++;
}
// Draw selection border (overrides modified if both)
if (is_selected) {
ImGui::PushStyleColor(ImGuiCol_Border, ConvertColorToImVec4(theme.accent));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 3.0f);
if (is_modified) {
ImGui::PopStyleVar(); // Remove modified border style
ImGui::PopStyleColor(); // Remove modified border color
}
style_count = 1; // Override count
}
// Convert SNES color to ImGui format
ImVec4 col = ConvertSnesColorToImVec4(color);
// Draw color button
bool clicked = ImGui::ColorButton(label, col,
ImGuiColorEditFlags_NoAlpha |
ImGuiColorEditFlags_NoPicker |
ImGuiColorEditFlags_NoTooltip,
size);
// Cleanup styles
if (style_count > 0) {
ImGui::PopStyleVar();
ImGui::PopStyleColor();
}
return clicked;
}
// NOTE: PaletteColorButton moved to color.cc
void ColorInfoPanel(const yaze::gfx::SnesColor& color,
bool show_snes_format,