Enhance editor UI and functionality with improved command palette and display settings

- Updated the command palette UI to include a search input with focus management, allowing users to filter and categorize commands more effectively.
- Enhanced the global search UI with tabbed results for recent files and labels, improving organization and accessibility.
- Refactored the display settings to be accessible via a popup, allowing customization without needing to load a ROM.
- Improved the welcome screen with enhanced particle effects and customization options, making it more visually appealing and user-friendly.
- Added functionality for global font scaling and theme management within the display settings, enhancing user experience.
This commit is contained in:
scawful
2025-09-27 10:12:54 -04:00
parent 730d01fcff
commit 41a3ee6ce2
7 changed files with 865 additions and 91 deletions

View File

@@ -38,6 +38,9 @@ void PopupManager::Initialize() {
popups_["Workspace Help"] = {"Workspace Help", false, [this]() { DrawWorkspaceHelpPopup(); }};
popups_["Session Limit Warning"] = {"Session Limit Warning", false, [this]() { DrawSessionLimitWarningPopup(); }};
popups_["Layout Reset Confirm"] = {"Reset Layout Confirmation", false, [this]() { DrawLayoutResetConfirmPopup(); }};
// Settings popups (accessible without ROM)
popups_["Display Settings"] = {"Display Settings", false, [this]() { DrawDisplaySettingsPopup(); }};
}
void PopupManager::DrawPopups() {
@@ -48,7 +51,14 @@ void PopupManager::DrawPopups() {
for (auto& [name, params] : popups_) {
if (params.is_visible) {
OpenPopup(name.c_str());
if (BeginPopupModal(name.c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
// Special handling for Display Settings popup to make it resizable
ImGuiWindowFlags popup_flags = ImGuiWindowFlags_AlwaysAutoResize;
if (name == "Display Settings") {
popup_flags = ImGuiWindowFlags_None; // Allow resizing for display settings
}
if (BeginPopupModal(name.c_str(), nullptr, popup_flags)) {
params.draw_function();
EndPopup();
}
@@ -491,5 +501,46 @@ void PopupManager::DrawLayoutResetConfirmPopup() {
}
}
void PopupManager::DrawDisplaySettingsPopup() {
// Set a comfortable default size with natural constraints
SetNextWindowSize(ImVec2(900, 700), ImGuiCond_FirstUseEver);
SetNextWindowSizeConstraints(ImVec2(600, 400), ImVec2(FLT_MAX, FLT_MAX));
Text("%s Display & Theme Settings", ICON_MD_DISPLAY_SETTINGS);
TextWrapped("Customize your YAZE experience - accessible anytime!");
Separator();
// Create a child window for scrollable content to avoid table conflicts
// Use remaining space minus the close button area
float available_height = GetContentRegionAvail().y - 60; // Reserve space for close button
if (BeginChild("DisplaySettingsContent", ImVec2(0, available_height), true, ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
// Use the popup-safe version to avoid table conflicts
gui::DrawDisplaySettingsForPopup();
Separator();
gui::TextWithSeparators("Font Manager");
gui::DrawFontManager();
// Global font scale (moved from the old display settings window)
ImGuiIO &io = GetIO();
Separator();
Text("Global Font Scale");
static float font_global_scale = io.FontGlobalScale;
if (SliderFloat("##global_scale", &font_global_scale, 0.5f, 1.8f, "%.2f")) {
if (editor_manager_) {
editor_manager_->SetFontGlobalScale(font_global_scale);
} else {
io.FontGlobalScale = font_global_scale;
}
}
}
EndChild();
Separator();
if (Button("Close", gui::kDefaultModalSize)) {
Hide("Display Settings");
}
}
} // namespace editor
} // namespace yaze

View File

@@ -86,6 +86,9 @@ class PopupManager {
void DrawWorkspaceHelpPopup();
void DrawSessionLimitWarningPopup();
void DrawLayoutResetConfirmPopup();
// Settings popups (accessible without ROM)
void DrawDisplaySettingsPopup();
EditorManager* editor_manager_;
std::unordered_map<std::string, PopupParams> popups_;