giga-refactor, part 5

This commit is contained in:
tildearrow 2025-11-13 01:39:21 -05:00
parent 68768004b0
commit 5bde25cf2f
5 changed files with 39 additions and 18 deletions

View file

@ -3083,7 +3083,7 @@ class FurnaceGUI {
void drawRefPlayer();
void drawMultiInsSetup();
float drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffset=-1, float width=-1.0f);
float drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffset=-1, float width=-1.0f, int chanCount=-1);
void drawSystemChannelInfoText(const DivSysDef* whichDef);
void drawVolMeterInternal(ImDrawList* dl, ImRect rect, float* data, int chans, bool aspectRatio);

View file

@ -145,7 +145,7 @@ void FurnaceGUI::drawSysManager() {
// channel LEDs and chip config button
float height=0;
if (settings.rackShowLEDs) {
height=drawSystemChannelInfo(sysDef,dispatchOff,ImGui::GetContentRegionAvail().x-(ImGui::CalcTextSize(ICON_FA_CHEVRON_DOWN).x+ImGui::GetStyle().ItemSpacing.x));
height=drawSystemChannelInfo(sysDef,dispatchOff,ImGui::GetContentRegionAvail().x-(ImGui::CalcTextSize(ICON_FA_CHEVRON_DOWN).x+ImGui::GetStyle().ItemSpacing.x),e->song.systemChans[i]);
}
ImGuiID openedID=ImGui::GetID("OpenSysConfig");
@ -168,7 +168,7 @@ void FurnaceGUI::drawSysManager() {
ImGui::EndChild();
ImGui::PopID();
dispatchOff+=sysDef->channels;
dispatchOff+=e->song.systemChans[i];
}
if (e->song.systemLen<DIV_MAX_CHIPS) {

View file

@ -296,24 +296,28 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
}
}
float FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffset, float tooltipWidth) {
float FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffset, float tooltipWidth, int chanCount) {
if (whichDef==NULL) return 0;
if (chanCount<1) chanCount=whichDef->channels;
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,
(tooltipWidth-sep.x*(chanCount-1))/(float)chanCount,
settings.iconSize*dpiScale
);
if (ledSize.x<8.0f*dpiScale) ledSize.x=8.0f*dpiScale;
float x=p.x, y=p.y;
for (int i=0; i<whichDef->channels; i++) {
for (int i=0; i<chanCount; i++) {
if (x+ledSize.x-0.125>tooltipWidth+p.x) {
x=p.x;
y+=ledSize.y+sep.y;
}
ImVec4 color=uiColors[whichDef->chanTypes[i]+GUI_COLOR_CHANNEL_FM];
ImVec4 color=uiColors[GUI_COLOR_CHANNEL_BG];
if (i<whichDef->channels) color=uiColors[whichDef->chanTypes[i]+GUI_COLOR_CHANNEL_FM];
if (keyHitOffset>=0) {
if (e->isChannelMuted(keyHitOffset+i)) {
color=uiColors[GUI_COLOR_CHANNEL_MUTED];