From 27a555f1298e2c71f671a08c0aada9b0feb8e123 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 16 Sep 2025 16:41:55 -0500 Subject: [PATCH] GUI: chip manager redesign, part 4 this selectable is so ugly and uncentered --- extern/imgui_patched/imgui_widgets.cpp | 9 +++++---- src/gui/gui.h | 2 +- src/gui/sysManager.cpp | 6 +++--- src/gui/sysMiscInfo.cpp | 6 ++++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/extern/imgui_patched/imgui_widgets.cpp b/extern/imgui_patched/imgui_widgets.cpp index 8124e13f6..57d30554e 100644 --- a/extern/imgui_patched/imgui_widgets.cpp +++ b/extern/imgui_patched/imgui_widgets.cpp @@ -597,14 +597,15 @@ void ImGui::ScrollText(ImGuiID id, const char* text, const ImVec2& pos, ImVec2 s if (size.x==0) { size.x=((window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max).x-pos.x; - if (textSize.x& actionMap, int first, int last); diff --git a/src/gui/sysManager.cpp b/src/gui/sysManager.cpp index 0d19ea55d..6bf8d1492 100644 --- a/src/gui/sysManager.cpp +++ b/src/gui/sysManager.cpp @@ -83,7 +83,7 @@ void FurnaceGUI::drawSysManager() { float buttonInnerSize=ImGui::CalcTextSize(ICON_FA_CLONE).x; float sideButtonSize=ImGui::GetStyle().ItemSpacing.x*3.0f+buttonInnerSize*3.0f+ImGui::GetStyle().FramePadding.x*6; ImGui::AlignTextToFramePadding(); - ImGui::ScrollText(ImGui::GetID(rackNameID.c_str()),sysDef->name,ImVec2(0.0f,0.0f),ImVec2(ImGui::GetContentRegionAvail().x-sideButtonSize,0)); + ImGui::ScrollText(ImGui::GetID(rackNameID.c_str()),sysDef->name,ImVec2(0.0f,0.0f),ImVec2(ImGui::GetContentRegionAvail().x-sideButtonSize,0),false); ImGui::Dummy(ImVec2(ImGui::GetContentRegionAvail().x-sideButtonSize,1.0f)); // action buttons ImGui::SameLine(); @@ -141,7 +141,7 @@ void FurnaceGUI::drawSysManager() { ImGui::EndDisabled(); // channel LEDs and chip config button - drawSystemChannelInfo(sysDef,dispatchOff,ImGui::GetContentRegionAvail().x-(ImGui::CalcTextSize(ICON_FA_CHEVRON_DOWN).x+ImGui::GetStyle().FramePadding.x*2.0f+ImGui::GetStyle().ItemSpacing.x)); + float height=drawSystemChannelInfo(sysDef,dispatchOff,ImGui::GetContentRegionAvail().x-(ImGui::CalcTextSize(ICON_FA_CHEVRON_DOWN).x+ImGui::GetStyle().FramePadding.x*2.0f+ImGui::GetStyle().ItemSpacing.x)); ImGuiID openedID=ImGui::GetID("OpenSysConfig"); bool opened=openedConfig->GetBool(openedID,false); @@ -152,7 +152,7 @@ void FurnaceGUI::drawSysManager() { ImGui::PushStyleColor(ImGuiCol_Button,0); ImGui::PushStyleColor(ImGuiCol_ButtonHovered,ImGui::GetColorU32(uiColors[GUI_COLOR_SCROLL])); ImGui::PushStyleColor(ImGuiCol_ButtonActive,ImGui::GetColorU32(uiColors[GUI_COLOR_SCROLL_ACTIVE])); - if (ImGui::SmallButton(opened?(ICON_FA_CHEVRON_UP "###OpenThing"):(ICON_FA_CHEVRON_DOWN "###OpenThing"))) { + if (ImGui::Selectable(opened?(ICON_FA_CHEVRON_UP "###OpenThing"):(ICON_FA_CHEVRON_DOWN "###OpenThing"),false,0,ImVec2(0,height))) { opened=!opened; openedConfig->SetBool(openedID,opened); } diff --git a/src/gui/sysMiscInfo.cpp b/src/gui/sysMiscInfo.cpp index 138d7efd2..724c1a605 100644 --- a/src/gui/sysMiscInfo.cpp +++ b/src/gui/sysMiscInfo.cpp @@ -296,14 +296,15 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) { } } -void FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffset, float tooltipWidth) { +float FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffset, float tooltipWidth) { ImDrawList* dl=ImGui::GetWindowDrawList(); const ImVec2 p=ImGui::GetCursorScreenPos(); if (tooltipWidth<=0.0f) tooltipWidth=ImGui::GetContentRegionAvail().x; ImVec2 sep=ImGui::GetStyle().ItemSpacing; + sep.x*=0.5f; ImVec2 ledSize=ImVec2( (tooltipWidth-sep.x*(whichDef->channels-1))/(float)whichDef->channels, - 8.0f*dpiScale + settings.iconSize*dpiScale ); if (ledSize.x<8.0f*dpiScale) ledSize.x=8.0f*dpiScale; float x=p.x, y=p.y; @@ -329,6 +330,7 @@ void FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffs x+=ledSize.x+sep.x; } ImGui::Dummy(ImVec2(tooltipWidth,(y-p.y)+ledSize.y)); + return (y-p.y)+ledSize.y; } void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {