backport default sys picker from B

This commit is contained in:
freq-mod 2024-08-24 11:24:58 +02:00
parent db19b13ce4
commit 46e48e42ea
6 changed files with 21 additions and 17 deletions

View file

@ -4488,7 +4488,7 @@ bool FurnaceGUI::loop() {
} else {
if (ImGui::BeginMenu(_("add chip..."))) {
exitDisabledTimer=1;
DivSystem picked=systemPicker();
DivSystem picked=systemPicker(false);
if (picked!=DIV_SYSTEM_NULL) {
if (!e->addSystem(picked)) {
showError(fmt::sprintf(_("cannot add chip! (%s)"),e->getLastError()));
@ -4519,7 +4519,7 @@ bool FurnaceGUI::loop() {
ImGui::Checkbox(_("Preserve channel positions"),&preserveChanPos);
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::BeginMenu(fmt::sprintf("%d. %s##_SYSC%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
DivSystem picked=systemPicker();
DivSystem picked=systemPicker(false);
if (picked!=DIV_SYSTEM_NULL) {
if (e->changeSystem(i,picked,preserveChanPos)) {
MARK_MODIFIED;

View file

@ -2929,7 +2929,7 @@ class FurnaceGUI {
void doReplace();
void doDrag();
void editOptions(bool topMenu);
DivSystem systemPicker();
DivSystem systemPicker(bool full_width);
void noteInput(int num, int key, int vol=-1);
void valueInput(int num, bool direct=false, int target=-1);
void orderInput(int num);

View file

@ -1084,15 +1084,19 @@ void FurnaceGUI::drawSettings() {
ImGui::PushID(i);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize(_("Invert")).x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0);
if (ImGui::BeginCombo("##System",getSystemName(sysID))) {
for (int j=0; availableSystems[j]; j++) {
if (ImGui::Selectable(getSystemName((DivSystem)availableSystems[j]),sysID==availableSystems[j])) {
sysID=(DivSystem)availableSystems[j];
if (ImGui::BeginCombo("##System",getSystemName(sysID),ImGuiComboFlags_HeightLargest)) {
sysID=systemPicker(true);
if (sysID!=DIV_SYSTEM_NULL)
{
settings.initialSys.set(fmt::sprintf("id%d",i),(int)e->systemToFileFur(sysID));
settings.initialSys.set(fmt::sprintf("flags%d",i),"");
settingsChanged=true;
ImGui::CloseCurrentPopup();
}
}
ImGui::EndCombo();
}

View file

@ -102,7 +102,7 @@ void FurnaceGUI::drawSysManager() {
ImGui::SameLine();
ImGui::Button(_("Change##SysChange"));
if (ImGui::BeginPopupContextItem("SysPickerC",ImGuiPopupFlags_MouseButtonLeft)) {
DivSystem picked=systemPicker();
DivSystem picked=systemPicker(false);
if (picked!=DIV_SYSTEM_NULL) {
if (e->changeSystem(i,picked,preserveChanPos)) {
MARK_MODIFIED;
@ -138,7 +138,7 @@ void FurnaceGUI::drawSysManager() {
ImGui::TableNextColumn();
ImGui::Button(ICON_FA_PLUS "##SysAdd");
if (ImGui::BeginPopupContextItem("SysPickerA",ImGuiPopupFlags_MouseButtonLeft)) {
DivSystem picked=systemPicker();
DivSystem picked=systemPicker(false);
if (picked!=DIV_SYSTEM_NULL) {
if (!e->addSystem(picked)) {
showError(fmt::sprintf(_("cannot add chip! (%s)"),e->getLastError()));

View file

@ -23,7 +23,7 @@
#include "guiConst.h"
#include <imgui.h>
DivSystem FurnaceGUI::systemPicker() {
DivSystem FurnaceGUI::systemPicker(bool full_width) {
DivSystem ret=DIV_SYSTEM_NULL;
DivSystem hoveredSys=DIV_SYSTEM_NULL;
bool reissueSearch=false;
@ -61,7 +61,7 @@ DivSystem FurnaceGUI::systemPicker() {
}
}
}
if (ImGui::BeginTable("SysList",1,ImGuiTableFlags_ScrollY,ImVec2(500.0f*dpiScale,200.0*dpiScale))) {
if (ImGui::BeginTable("SysList",1,ImGuiTableFlags_ScrollY,ImVec2(full_width ? ImGui::GetContentRegionAvail().x : 500.0f*dpiScale,200.0f*dpiScale))) {
if (sysSearchQuery.empty()) {
// display chip list
for (int j=0; curSysSection[j]; j++) {

View file

@ -392,7 +392,7 @@ void FurnaceGUI::drawUserPresets() {
tempID=fmt::sprintf("%s##USystem",getSystemName(chip.sys));
ImGui::Button(tempID.c_str(),ImVec2(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize(_("Invert")).x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0,0));
if (ImGui::BeginPopupContextItem("SysPickerCU",ImGuiPopupFlags_MouseButtonLeft)) {
DivSystem picked=systemPicker();
DivSystem picked=systemPicker(false);
if (picked!=DIV_SYSTEM_NULL) {
chip.sys=picked;
mustBake=true;
@ -456,7 +456,7 @@ void FurnaceGUI::drawUserPresets() {
ImGui::Button(ICON_FA_PLUS "##SysAddU");
if (ImGui::BeginPopupContextItem("SysPickerU",ImGuiPopupFlags_MouseButtonLeft)) {
DivSystem picked=systemPicker();
DivSystem picked=systemPicker(false);
if (picked!=DIV_SYSTEM_NULL) {
preset->orig.push_back(FurnaceGUISysDefChip(picked,1.0f,0.0f,""));
mustBake=true;