GUI: chip manager redesign, part 2

This commit is contained in:
tildearrow 2025-09-16 04:48:02 -05:00
parent 70f512003e
commit d38b956030
2 changed files with 56 additions and 6 deletions

View file

@ -39,6 +39,7 @@ void FurnaceGUI::drawSysManager() {
//ImGui::SetNextWindowSizeConstraints(ImVec2(440.0f*dpiScale,400.0f*dpiScale),ImVec2(canvasW,canvasH));
}
if (ImGui::Begin("Chip Manager",&sysManagerOpen,globalWinFlags,_("Chip Manager"))) {
ImGuiStorage* openedConfig=ImGui::GetStateStorage();
ImGui::Checkbox(_("Preserve channel order"),&preserveChanPos);
ImGui::SameLine();
ImGui::Checkbox(_("Clone channel data"),&sysDupCloneChannels);
@ -137,9 +138,27 @@ void FurnaceGUI::drawSysManager() {
drawSystemChannelInfo(sysDef,dispatchOff);
/*ImGui::Indent();
ImGui::Separator();
ImGuiID openedID=ImGui::GetID("OpenSysConfig");
bool opened=openedConfig->GetBool(openedID,false);
if (opened) {
ImGui::Indent();
drawSysConf(i,i,e->song.system[i],e->song.systemFlags[i],true);
ImGui::Unindent();*/
ImGui::Unindent();
}
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize,0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameShading,0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding,0.0f);
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::Button(opened?(ICON_FA_CHEVRON_UP " " ICON_FA_CHEVRON_UP " " ICON_FA_CHEVRON_UP " " "###OpenThing"):(ICON_FA_CHEVRON_DOWN " " ICON_FA_CHEVRON_DOWN " " ICON_FA_CHEVRON_DOWN " " "###OpenThing"),ImVec2(ImGui::GetContentRegionAvail().x,0.0f))) {
opened=!opened;
openedConfig->SetBool(openedID,opened);
}
ImGui::PopStyleColor(3);
ImGui::PopStyleVar(3);
}
ImGui::EndChild();
ImGui::PopID();
@ -147,6 +166,30 @@ void FurnaceGUI::drawSysManager() {
dispatchOff+=sysDef->channels;
}
if (e->song.systemLen<DIV_MAX_CHIPS) {
ImGui::Button(ICON_FA_PLUS "##SysAdd");
if (ImGui::BeginPopupContextItem("SysPickerA",ImGuiPopupFlags_MouseButtonLeft)) {
DivSystem picked=systemPicker(false);
if (picked!=DIV_SYSTEM_NULL) {
if (!e->addSystem(picked)) {
showError(fmt::sprintf(_("cannot add chip! (%s)"),e->getLastError()));
} else {
MARK_MODIFIED;
}
if (e->song.autoSystem) {
autoDetectSystem();
}
updateWindowTitle();
updateROMExportAvail();
ImGui::CloseCurrentPopup();
}
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
}
/*
if (ImGui::BeginTable("SystemList",3)) {
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed);

View file

@ -314,9 +314,16 @@ void FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOffs
}
ImVec4 color=uiColors[whichDef->chanTypes[i]+GUI_COLOR_CHANNEL_FM];
if (keyHitOffset>=0) {
if (e->isChannelMuted(keyHitOffset+i)) {
color=uiColors[GUI_COLOR_CHANNEL_MUTED];
color.x*=MIN(1.0f,0.125f+keyHit1[keyHitOffset+i]*0.875f);
color.y*=MIN(1.0f,0.125f+keyHit1[keyHitOffset+i]*0.875f);
color.z*=MIN(1.0f,0.125f+keyHit1[keyHitOffset+i]*0.875f);
} else {
color.x*=MIN(1.0f,0.125f+keyHit1[keyHitOffset+i]*0.875f);
color.y*=MIN(1.0f,0.125f+keyHit1[keyHitOffset+i]*0.875f);
color.z*=MIN(1.0f,0.125f+keyHit1[keyHitOffset+i]*0.875f);
}
}
dl->AddRectFilled(ImVec2(x,y),ImVec2(x+ledSize.x,y+ledSize.y),ImGui::GetColorU32(color),ledSize.y);
x+=ledSize.x+sep.x;