diff --git a/src/ui/windows/console_tab.cpp b/src/ui/windows/console_tab.cpp index 4d67e8b..66bd58f 100644 --- a/src/ui/windows/console_tab.cpp +++ b/src/ui/windows/console_tab.cpp @@ -791,7 +791,10 @@ void ConsoleTab::renderOutput() win_min.y + ImGui::GetWindowHeight()); bool mouse_in_output = (mouse_pos.x >= win_min.x && mouse_pos.x < win_max.x && mouse_pos.y >= win_min.y && mouse_pos.y < win_max.y && - !ImGui::IsPopupOpen("", ImGuiPopupFlags_AnyPopup)); + !ImGui::IsPopupOpen("", ImGuiPopupFlags_AnyPopup) && + // The RPC reference is a BeginOverlayDialog (not an ImGui popup), so it + // isn't caught above; suppress the output's text cursor + selection under it. + !show_commands_popup_); handleOutputInteraction(mouse_pos, mouse_in_output); // Draw the visible lines: accent bars, JSON indent guides, selection + filter highlight, @@ -1576,7 +1579,7 @@ void ConsoleTab::renderCommandDetail(const ConsoleCommandEntry& cmd, const char* // Heading: command name, then category + a safety badge for consequential commands. ImGui::PushFont(Type().subtitle1()); - ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(IM_COL32(120, 190, 255, 255)), "%s", cmd.name); + ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(Primary()), "%s", cmd.name); ImGui::PopFont(); ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(OnSurfaceDisabled()), "%s", catLabel); if (cmd.destructive) { @@ -1663,7 +1666,7 @@ void ConsoleTab::renderCommandDetail(const ConsoleCommandEntry& cmd, const char* ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(OnSurfaceMedium()), "%s", TR("console_ref_builds")); ImGui::PushFont(mono); ImGui::PushTextWrapPos(0.0f); - ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(IM_COL32(150, 200, 150, 255)), "%s", built.c_str()); + ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(FloorLight(IM_COL32(150, 200, 150, 255))), "%s", built.c_str()); ImGui::PopTextWrapPos(); ImGui::PopFont(); } @@ -1674,7 +1677,7 @@ void ConsoleTab::renderCommandDetail(const ConsoleCommandEntry& cmd, const char* ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(OnSurfaceMedium()), "%s", TR("console_ref_example")); ImGui::PushFont(mono); ImGui::PushTextWrapPos(0.0f); - ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(IM_COL32(150, 200, 150, 255)), "%s", cmd.example); + ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(FloorLight(IM_COL32(150, 200, 150, 255))), "%s", cmd.example); ImGui::PopTextWrapPos(); ImGui::PopFont(); ImGui::Dummy(ImVec2(0, Layout::spacingMd())); @@ -1808,23 +1811,37 @@ void ConsoleTab::renderCommandsPopup() float detailW = contentW - masterW - gap; ImFont* mono = Type().mono(); - ImU32 nameCol = IM_COL32(100, 180, 255, 255); + // The panes are theme-adaptive glass (light on light skins), so floor the link-blue to a readable + // contrast on light surfaces (FloorLight is a no-op on dark themes). + ImU32 nameCol = FloorLight(IM_COL32(100, 180, 255, 255)); float rowH = std::max(20.0f * dp, mono->LegacySize + 6.0f * dp); - // One master row: mono command name + a warning dot for consequential commands. Click selects - // (drives the detail pane); double-click inserts. + // One master row: mono command name + a warning dot for consequential commands, with a soft + // rounded selection/hover fill (Material, not the default sharp Selectable highlight). Click + // selects (drives the detail pane); double-click inserts. auto drawRow = [&](int c, int i) { const ConsoleCommandEntry& cmd = categories[c].commands[i]; bool sel = (cmd_sel_cat_ == c && cmd_sel_idx_ == i); ImGui::PushID(c * 1000 + i); ImVec2 rmn = ImGui::GetCursorScreenPos(); - if (ImGui::Selectable("##cmdrow", sel, ImGuiSelectableFlags_SpanAvailWidth, ImVec2(0, rowH))) - { cmd_sel_cat_ = c; cmd_sel_idx_ = i; } - if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0, 0, 0, 0)); // we draw our own fill + ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0, 0, 0, 0)); + ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0, 0, 0, 0)); + bool clicked = ImGui::Selectable("##cmdrow", sel, ImGuiSelectableFlags_SpanAvailWidth, + ImVec2(0, rowH)); + ImGui::PopStyleColor(3); + bool hov = ImGui::IsItemHovered(); + if (clicked) { cmd_sel_cat_ = c; cmd_sel_idx_ = i; } + if (hov) { ImGui::SetMouseCursor(ImGuiMouseCursor_Hand); if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) insertCommandToInput(cmd); } ImDrawList* dl = ImGui::GetWindowDrawList(); + float rowW = ImGui::GetItemRectSize().x; + if (sel || hov) + dl->AddRectFilled(ImVec2(rmn.x, rmn.y + 1.0f * dp), + ImVec2(rmn.x + rowW, rmn.y + rowH - 1.0f * dp), + sel ? WithAlpha(Primary(), 52) : WithAlpha(OnSurface(), 16), 6.0f * dp); float tx = rmn.x + Layout::spacingSm(); if (cmd.destructive) { float r = 3.0f * dp; @@ -1836,8 +1853,19 @@ void ConsoleTab::renderCommandsPopup() ImGui::PopID(); }; + // Both panes sit on soft Material glass surfaces (no hard 1px child border) with inner padding. + GlassPanelSpec paneGlass; + paneGlass.rounding = 14.0f; + paneGlass.fillAlpha = 30; + paneGlass.borderAlpha = 30; + // MASTER pane. - ImGui::BeginChild("##cmdMaster", ImVec2(masterW, bodyH), true); + { + ImVec2 mMin = ImGui::GetCursorScreenPos(); + DrawGlassPanel(ImGui::GetWindowDrawList(), mMin, ImVec2(mMin.x + masterW, mMin.y + bodyH), paneGlass); + } + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Layout::spacingMd(), Layout::spacingSm())); + ImGui::BeginChild("##cmdMaster", ImVec2(masterW, bodyH), ImGuiChildFlags_AlwaysUseWindowPadding); { if (order.empty()) { Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), TR("console_ref_no_match")); @@ -1845,21 +1873,33 @@ void ConsoleTab::renderCommandsPopup() for (auto& p : order) drawRow(p.first, p.second); } else { for (int c = 0; c < (int)categories.size(); c++) { + // Subtle accent-labelled section header (no heavy filled bar). + ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0, 0, 0, 0)); + ImGui::PushStyleColor(ImGuiCol_HeaderHovered, + ImGui::ColorConvertU32ToFloat4(WithAlpha(OnSurface(), 14))); + ImGui::PushStyleColor(ImGuiCol_HeaderActive, + ImGui::ColorConvertU32ToFloat4(WithAlpha(OnSurface(), 20))); ImGui::PushStyleColor(ImGuiCol_Text, ImGui::ColorConvertU32ToFloat4(Primary())); bool open = ImGui::CollapsingHeader(consoleCategoryLabel(categories[c].name), ImGuiTreeNodeFlags_DefaultOpen); - ImGui::PopStyleColor(); + ImGui::PopStyleColor(4); if (open) for (int i = 0; i < categories[c].count; i++) drawRow(c, i); } } } ImGui::EndChild(); + ImGui::PopStyleVar(); ImGui::SameLine(0, gap); // DETAIL pane. - ImGui::BeginChild("##cmdDetail", ImVec2(detailW, bodyH), true); + { + ImVec2 dMin = ImGui::GetCursorScreenPos(); + DrawGlassPanel(ImGui::GetWindowDrawList(), dMin, ImVec2(dMin.x + detailW, dMin.y + bodyH), paneGlass); + } + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Layout::spacingLg(), Layout::spacingMd())); + ImGui::BeginChild("##cmdDetail", ImVec2(detailW, bodyH), ImGuiChildFlags_AlwaysUseWindowPadding); if (cmd_sel_cat_ >= 0 && cmd_sel_cat_ < (int)categories.size() && cmd_sel_idx_ >= 0 && cmd_sel_idx_ < categories[cmd_sel_cat_].count) { renderCommandDetail(categories[cmd_sel_cat_].commands[cmd_sel_idx_], @@ -1870,6 +1910,7 @@ void ConsoleTab::renderCommandsPopup() Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), TR("console_ref_select_hint")); } ImGui::EndChild(); + ImGui::PopStyleVar(); // Footer. ImGui::Dummy(ImVec2(0, Layout::spacingXs()));