refactor(editor): enhance UI management and debugging tools
- Updated EditorManager to streamline UI component rendering, ensuring that UI elements like the Command Palette and Global Search are properly displayed. - Refactored MenuOrchestrator to introduce a new Debug menu, consolidating debugging tools and enhancing accessibility for users. - Improved PopupManager to include new popups for feature flags and data integrity checks, providing better feedback and control over debugging processes. Benefits: - Enhances user experience by organizing UI elements and debugging tools more effectively. - Improves maintainability by centralizing UI management and debugging functionalities within dedicated components.
This commit is contained in:
@@ -105,10 +105,8 @@ void UICoordinator::DrawAllUI() {
|
||||
// This is called from EditorManager::Update() - don't call menu bar stuff here
|
||||
|
||||
// Draw UI windows and dialogs
|
||||
// Session dialogs are drawn by SessionCoordinator separately to avoid duplication
|
||||
DrawCommandPalette(); // Ctrl+Shift+P
|
||||
DrawSessionSwitcher(); // Ctrl+Tab popup
|
||||
DrawSessionManager(); // Session management window
|
||||
DrawSessionRenameDialog(); // Rename popup
|
||||
DrawLayoutPresets(); // Layout preset dialogs
|
||||
DrawWelcomeScreen(); // Welcome screen
|
||||
DrawProjectHelp(); // Project help
|
||||
@@ -220,79 +218,31 @@ void UICoordinator::DrawContextSensitiveCardControl() {
|
||||
}
|
||||
}
|
||||
|
||||
void UICoordinator::DrawSessionSwitcher() {
|
||||
if (!show_session_switcher_) return;
|
||||
|
||||
// Material Design dialog styling
|
||||
ImGui::SetNextWindowSize(ImVec2(400, 300), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(16, 16));
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, gui::GetSurfaceVec4());
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, gui::GetOutlineVec4());
|
||||
|
||||
if (ImGui::Begin("Session Switcher", &show_session_switcher_,
|
||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse)) {
|
||||
|
||||
// Header with Material Design typography
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, gui::GetOnSurfaceVec4());
|
||||
ImGui::Text("%s Session Switcher", ICON_MD_TAB);
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::Separator();
|
||||
|
||||
// Session list with Material Design list styling
|
||||
for (size_t i = 0; i < session_coordinator_.GetActiveSessionCount(); ++i) {
|
||||
std::string session_name = session_coordinator_.GetSessionDisplayName(i);
|
||||
bool is_active = (i == session_coordinator_.GetActiveSessionIndex());
|
||||
|
||||
// Active session highlighting
|
||||
if (is_active) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, gui::GetPrimaryVec4());
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, gui::GetPrimaryHoverVec4());
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, gui::GetOnPrimaryVec4());
|
||||
}
|
||||
|
||||
std::string button_text = absl::StrFormat("%s %s",
|
||||
is_active ? ICON_MD_RADIO_BUTTON_CHECKED : ICON_MD_RADIO_BUTTON_UNCHECKED,
|
||||
session_name.c_str());
|
||||
|
||||
if (ImGui::Button(button_text.c_str(), ImVec2(-1, 0))) {
|
||||
session_coordinator_.SwitchToSession(i);
|
||||
show_session_switcher_ = false;
|
||||
}
|
||||
|
||||
if (is_active) {
|
||||
ImGui::PopStyleColor(3);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
// Action buttons with Material Design styling
|
||||
if (ImGui::Button(absl::StrFormat("%s New Session", ICON_MD_ADD).c_str(), ImVec2(-1, 0))) {
|
||||
session_coordinator_.CreateNewSession();
|
||||
show_session_switcher_ = false;
|
||||
}
|
||||
|
||||
if (ImGui::Button(absl::StrFormat("%s Close", ICON_MD_CLOSE).c_str(), ImVec2(-1, 0))) {
|
||||
show_session_switcher_ = false;
|
||||
}
|
||||
// ============================================================================
|
||||
// Session UI Delegation
|
||||
// ============================================================================
|
||||
// All session-related UI is now managed by SessionCoordinator to eliminate
|
||||
// duplication. UICoordinator methods delegate to SessionCoordinator.
|
||||
|
||||
void UICoordinator::ShowSessionSwitcher() {
|
||||
session_coordinator_.ShowSessionSwitcher();
|
||||
}
|
||||
|
||||
bool UICoordinator::IsSessionSwitcherVisible() const {
|
||||
return session_coordinator_.IsSessionSwitcherVisible();
|
||||
}
|
||||
|
||||
void UICoordinator::SetSessionSwitcherVisible(bool visible) {
|
||||
if (visible) {
|
||||
session_coordinator_.ShowSessionSwitcher();
|
||||
} else {
|
||||
session_coordinator_.HideSessionSwitcher();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void UICoordinator::DrawSessionManager() {
|
||||
// TODO: Implement session manager dialog
|
||||
// This would be a more comprehensive session management interface
|
||||
}
|
||||
|
||||
void UICoordinator::DrawSessionRenameDialog() {
|
||||
// TODO: Implement session rename dialog
|
||||
// This would allow users to rename sessions for better organization
|
||||
}
|
||||
// ============================================================================
|
||||
// Layout and Window Management UI
|
||||
// ============================================================================
|
||||
|
||||
void UICoordinator::DrawLayoutPresets() {
|
||||
// TODO: Implement layout presets UI
|
||||
@@ -516,6 +466,8 @@ void UICoordinator::DrawTestingUI() {
|
||||
void UICoordinator::DrawCommandPalette() {
|
||||
if (!show_command_palette_) return;
|
||||
|
||||
LOG_INFO("UICoordinator", "DrawCommandPalette() - rendering command palette");
|
||||
|
||||
using namespace ImGui;
|
||||
auto& theme = gui::ThemeManager::Get().GetCurrentTheme();
|
||||
|
||||
|
||||
@@ -87,11 +87,15 @@ class UICoordinator {
|
||||
// UI state management
|
||||
void ShowEditorSelection() { show_editor_selection_ = true; }
|
||||
void ShowDisplaySettings();
|
||||
void ShowSessionSwitcher() { show_session_switcher_ = true; }
|
||||
// Session switcher is now managed by SessionCoordinator
|
||||
void ShowSessionSwitcher();
|
||||
void HideCurrentEditorCards();
|
||||
void ToggleCardSidebar() { show_card_sidebar_ = !show_card_sidebar_; }
|
||||
void ShowGlobalSearch() { show_global_search_ = true; }
|
||||
void ShowCommandPalette() { show_command_palette_ = true; }
|
||||
void ShowCommandPalette() {
|
||||
LOG_INFO("UICoordinator", "ShowCommandPalette() called - setting flag to true");
|
||||
show_command_palette_ = true;
|
||||
}
|
||||
void ShowCardBrowser() { show_card_browser_ = true; }
|
||||
|
||||
// Window visibility management
|
||||
@@ -101,7 +105,8 @@ class UICoordinator {
|
||||
// UI state queries (EditorManager can check these)
|
||||
bool IsEditorSelectionVisible() const { return show_editor_selection_; }
|
||||
bool IsDisplaySettingsVisible() const { return show_display_settings_; }
|
||||
bool IsSessionSwitcherVisible() const { return show_session_switcher_; }
|
||||
// Session switcher visibility managed by SessionCoordinator
|
||||
bool IsSessionSwitcherVisible() const;
|
||||
bool IsWelcomeScreenVisible() const { return show_welcome_screen_; }
|
||||
bool IsWelcomeScreenManuallyClosed() const { return welcome_screen_manually_closed_; }
|
||||
bool IsGlobalSearchVisible() const { return show_global_search_; }
|
||||
@@ -115,7 +120,8 @@ class UICoordinator {
|
||||
// UI state setters (for programmatic control)
|
||||
void SetEditorSelectionVisible(bool visible) { show_editor_selection_ = visible; }
|
||||
void SetDisplaySettingsVisible(bool visible) { show_display_settings_ = visible; }
|
||||
void SetSessionSwitcherVisible(bool visible) { show_session_switcher_ = visible; }
|
||||
// Session switcher state managed by SessionCoordinator
|
||||
void SetSessionSwitcherVisible(bool visible);
|
||||
void SetWelcomeScreenVisible(bool visible) { show_welcome_screen_ = visible; }
|
||||
void SetWelcomeScreenManuallyClosed(bool closed) { welcome_screen_manually_closed_ = closed; }
|
||||
void SetGlobalSearchVisible(bool visible) { show_global_search_ = visible; }
|
||||
@@ -144,7 +150,7 @@ class UICoordinator {
|
||||
// UI state flags (UICoordinator owns all UI visibility state)
|
||||
bool show_editor_selection_ = false;
|
||||
bool show_display_settings_ = false;
|
||||
bool show_session_switcher_ = false;
|
||||
// show_session_switcher_ removed - managed by SessionCoordinator
|
||||
bool show_welcome_screen_ = true;
|
||||
bool welcome_screen_manually_closed_ = false;
|
||||
bool show_global_search_ = false;
|
||||
|
||||
Reference in New Issue
Block a user