GUI: improve create ins from sample functionality

pull request #740
This commit is contained in:
tildearrow 2022-11-13 18:29:37 -05:00
parent 9ef3ec19bc
commit c5df68f8af
6 changed files with 94 additions and 7 deletions

View file

@ -4409,6 +4409,11 @@ bool FurnaceGUI::loop() {
ImGui::OpenPopup("Import Raw Sample");
}
if (displayInsTypeList) {
displayInsTypeList=false;
ImGui::OpenPopup("InsTypeList");
}
if (displayExporting) {
displayExporting=false;
ImGui::OpenPopup("Rendering...");
@ -4789,6 +4794,31 @@ bool FurnaceGUI::loop() {
ImGui::EndPopup();
}
if (ImGui::BeginPopup("InsTypeList",ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) {
char temp[1024];
for (DivInstrumentType& i: makeInsTypeList) {
strncpy(temp,insTypes[i],1023);
if (ImGui::MenuItem(temp)) {
// create ins
curIns=e->addInstrument(-1,i);
if (curIns==-1) {
showError("too many instruments!");
} else {
if (displayInsTypeListMakeInsSample>=0 && displayInsTypeListMakeInsSample<(int)e->song.sample.size()) {
e->song.ins[curIns]->type=i;
e->song.ins[curIns]->name=e->song.sample[displayInsTypeListMakeInsSample]->name;
e->song.ins[curIns]->amiga.initSample=displayInsTypeListMakeInsSample;
if (i!=DIV_INS_AMIGA) e->song.ins[curIns]->amiga.useSample=true;
nextWindow=GUI_WINDOW_INS_EDIT;
wavePreviewInit=true;
}
MARK_MODIFIED;
}
}
}
ImGui::EndPopup();
}
// TODO:
// - multiple selection
// - replace instrument
@ -5506,6 +5536,7 @@ FurnaceGUI::FurnaceGUI():
zsmExportLoop(true),
vgmExportPatternHints(false),
vgmExportDirectStream(false),
displayInsTypeList(false),
portrait(false),
injectBackUp(false),
mobileMenuOpen(false),
@ -5526,6 +5557,7 @@ FurnaceGUI::FurnaceGUI():
zsmExportTickRate(60),
macroPointSize(16),
waveEditStyle(0),
displayInsTypeListMakeInsSample(-1),
mobileMenuPos(0.0f),
autoButtonSize(0.0f),
curSysSection(NULL),