GUI: chip manager redesign, part 4

this selectable is so ugly and uncentered
This commit is contained in:
tildearrow 2025-09-16 16:41:55 -05:00
parent 72b94b029a
commit 27a555f129
4 changed files with 13 additions and 10 deletions

View file

@ -597,14 +597,15 @@ void ImGui::ScrollText(ImGuiID id, const char* text, const ImVec2& pos, ImVec2 s
if (size.x==0) { if (size.x==0) {
size.x=((window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max).x-pos.x; size.x=((window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max).x-pos.x;
if (textSize.x<size.x) {
size.x=textSize.x;
mustNotScroll=true;
}
} }
if (size.y==0) { if (size.y==0) {
size.y=ImGui::GetFontSize(); size.y=ImGui::GetFontSize();
} }
// ???????
if (textSize.x<size.x) {
size.x=textSize.x;
mustNotScroll=true;
}
ImVec2 minArea=pos; ImVec2 minArea=pos;
if (pos.x==0 && pos.y==0) { if (pos.x==0 && pos.y==0) {

View file

@ -2974,7 +2974,7 @@ class FurnaceGUI {
void drawTutorial(); void drawTutorial();
void drawXYOsc(); void drawXYOsc();
void drawUserPresets(); void drawUserPresets();
void drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffset=-1, float width=-1.0f); float drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffset=-1, float width=-1.0f);
void drawSystemChannelInfoText(const DivSysDef* whichDef); void drawSystemChannelInfoText(const DivSysDef* whichDef);
void assignActionMap(std::map<int,int>& actionMap, int first, int last); void assignActionMap(std::map<int,int>& actionMap, int first, int last);

View file

@ -83,7 +83,7 @@ void FurnaceGUI::drawSysManager() {
float buttonInnerSize=ImGui::CalcTextSize(ICON_FA_CLONE).x; float buttonInnerSize=ImGui::CalcTextSize(ICON_FA_CLONE).x;
float sideButtonSize=ImGui::GetStyle().ItemSpacing.x*3.0f+buttonInnerSize*3.0f+ImGui::GetStyle().FramePadding.x*6; float sideButtonSize=ImGui::GetStyle().ItemSpacing.x*3.0f+buttonInnerSize*3.0f+ImGui::GetStyle().FramePadding.x*6;
ImGui::AlignTextToFramePadding(); 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)); ImGui::Dummy(ImVec2(ImGui::GetContentRegionAvail().x-sideButtonSize,1.0f));
// action buttons // action buttons
ImGui::SameLine(); ImGui::SameLine();
@ -141,7 +141,7 @@ void FurnaceGUI::drawSysManager() {
ImGui::EndDisabled(); ImGui::EndDisabled();
// channel LEDs and chip config button // 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"); ImGuiID openedID=ImGui::GetID("OpenSysConfig");
bool opened=openedConfig->GetBool(openedID,false); bool opened=openedConfig->GetBool(openedID,false);
@ -152,7 +152,7 @@ void FurnaceGUI::drawSysManager() {
ImGui::PushStyleColor(ImGuiCol_Button,0); ImGui::PushStyleColor(ImGuiCol_Button,0);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered,ImGui::GetColorU32(uiColors[GUI_COLOR_SCROLL])); ImGui::PushStyleColor(ImGuiCol_ButtonHovered,ImGui::GetColorU32(uiColors[GUI_COLOR_SCROLL]));
ImGui::PushStyleColor(ImGuiCol_ButtonActive,ImGui::GetColorU32(uiColors[GUI_COLOR_SCROLL_ACTIVE])); 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; opened=!opened;
openedConfig->SetBool(openedID,opened); openedConfig->SetBool(openedID,opened);
} }

View file

@ -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(); ImDrawList* dl=ImGui::GetWindowDrawList();
const ImVec2 p=ImGui::GetCursorScreenPos(); const ImVec2 p=ImGui::GetCursorScreenPos();
if (tooltipWidth<=0.0f) tooltipWidth=ImGui::GetContentRegionAvail().x; if (tooltipWidth<=0.0f) tooltipWidth=ImGui::GetContentRegionAvail().x;
ImVec2 sep=ImGui::GetStyle().ItemSpacing; ImVec2 sep=ImGui::GetStyle().ItemSpacing;
sep.x*=0.5f;
ImVec2 ledSize=ImVec2( ImVec2 ledSize=ImVec2(
(tooltipWidth-sep.x*(whichDef->channels-1))/(float)whichDef->channels, (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; if (ledSize.x<8.0f*dpiScale) ledSize.x=8.0f*dpiScale;
float x=p.x, y=p.y; float x=p.x, y=p.y;
@ -329,6 +330,7 @@ void FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffs
x+=ledSize.x+sep.x; x+=ledSize.x+sep.x;
} }
ImGui::Dummy(ImVec2(tooltipWidth,(y-p.y)+ledSize.y)); ImGui::Dummy(ImVec2(tooltipWidth,(y-p.y)+ledSize.y));
return (y-p.y)+ledSize.y;
} }
void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) { void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {