GUI: chip manager redesign, part 4
this selectable is so ugly and uncentered
This commit is contained in:
parent
72b94b029a
commit
27a555f129
9
extern/imgui_patched/imgui_widgets.cpp
vendored
9
extern/imgui_patched/imgui_widgets.cpp
vendored
|
@ -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<size.x) {
|
||||
size.x=textSize.x;
|
||||
mustNotScroll=true;
|
||||
}
|
||||
}
|
||||
if (size.y==0) {
|
||||
size.y=ImGui::GetFontSize();
|
||||
}
|
||||
// ???????
|
||||
if (textSize.x<size.x) {
|
||||
size.x=textSize.x;
|
||||
mustNotScroll=true;
|
||||
}
|
||||
|
||||
ImVec2 minArea=pos;
|
||||
if (pos.x==0 && pos.y==0) {
|
||||
|
|
|
@ -2974,7 +2974,7 @@ class FurnaceGUI {
|
|||
void drawTutorial();
|
||||
void drawXYOsc();
|
||||
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 assignActionMap(std::map<int,int>& actionMap, int first, int last);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue