asset directories, part 11

This commit is contained in:
tildearrow 2023-05-16 19:00:05 -05:00
parent 4195046283
commit bd8e8fbaff
4 changed files with 358 additions and 192 deletions

View file

@ -1635,15 +1635,14 @@ void DivEngine::checkAssetDir(std::vector<DivAssetDir>& dir, size_t entries) {
} }
} }
// create unsorted directory if it doesn't exist
if (unsortedDir==NULL) {
dir.push_back(DivAssetDir(""));
unsortedDir=&(*dir.rbegin());
}
// add missing items to unsorted directory // add missing items to unsorted directory
for (size_t i=0; i<entries; i++) { for (size_t i=0; i<entries; i++) {
if (!inAssetDir[i]) { if (!inAssetDir[i]) {
// create unsorted directory if it doesn't exist
if (unsortedDir==NULL) {
dir.push_back(DivAssetDir(""));
unsortedDir=&(*dir.rbegin());
}
unsortedDir->entries.push_back(i); unsortedDir->entries.push_back(i);
} }
} }

View file

@ -291,6 +291,8 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
curIns=i; curIns=i;
wavePreviewInit=true; wavePreviewInit=true;
updateFMPreview=true; updateFMPreview=true;
lastAssetType=0;
if (insListDir) nextWindow=GUI_WINDOW_PATTERN;
} }
if (wantScrollList && curIns==i) ImGui::SetScrollHereY(); if (wantScrollList && curIns==i) ImGui::SetScrollHereY();
if (settings.insFocusesPattern && patternOpen && ImGui::IsItemActivated()) { if (settings.insFocusesPattern && patternOpen && ImGui::IsItemActivated()) {
@ -298,6 +300,7 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
curIns=i; curIns=i;
wavePreviewInit=true; wavePreviewInit=true;
updateFMPreview=true; updateFMPreview=true;
lastAssetType=0;
} }
if (ImGui::IsItemHovered() && i>=0 && !mobileUI) { if (ImGui::IsItemHovered() && i>=0 && !mobileUI) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_TEXT]); ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_TEXT]);
@ -362,6 +365,7 @@ void FurnaceGUI::waveListItem(int i, float* wavePreview, int dir, int asset) {
if (wave->len>0) wavePreview[wave->len]=wave->data[wave->len-1]; if (wave->len>0) wavePreview[wave->len]=wave->data[wave->len-1];
if (ImGui::Selectable(fmt::sprintf("%d##_WAVE%d\n",i,i).c_str(),curWave==i)) { if (ImGui::Selectable(fmt::sprintf("%d##_WAVE%d\n",i,i).c_str(),curWave==i)) {
curWave=i; curWave=i;
lastAssetType=1;
} }
if (wantScrollList && curWave==i) ImGui::SetScrollHereY(); if (wantScrollList && curWave==i) ImGui::SetScrollHereY();
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
@ -370,6 +374,10 @@ void FurnaceGUI::waveListItem(int i, float* wavePreview, int dir, int asset) {
nextWindow=GUI_WINDOW_WAVE_EDIT; nextWindow=GUI_WINDOW_WAVE_EDIT;
} }
} }
if (waveListDir || (settings.unifiedDataView && insListDir)) {
DRAG_SOURCE(dir,asset);
DRAG_TARGET(dir,asset,e->song.waveDir);
}
ImGui::SameLine(); ImGui::SameLine();
PlotNoLerp(fmt::sprintf("##_WAVEP%d",i).c_str(),wavePreview,wave->len+1,0,NULL,0,wave->max); PlotNoLerp(fmt::sprintf("##_WAVEP%d",i).c_str(),wavePreview,wave->len+1,0,NULL,0,wave->max);
} }
@ -396,16 +404,21 @@ void FurnaceGUI::sampleListItem(int i, int dir, int asset) {
curSample=i; curSample=i;
samplePos=0; samplePos=0;
updateSampleTex=true; updateSampleTex=true;
lastAssetType=2;
} }
if (ImGui::IsItemHovered() && !mobileUI) { if (ImGui::IsItemHovered() && !mobileUI) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_TEXT]); ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_TEXT]);
ImGui::SetTooltip("Bank %d: %s",i/12,sampleNote[i%12]); ImGui::SetTooltip("(legacy bank %d: %s)",i/12,sampleNote[i%12]);
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
sampleEditOpen=true; sampleEditOpen=true;
nextWindow=GUI_WINDOW_SAMPLE_EDIT; nextWindow=GUI_WINDOW_SAMPLE_EDIT;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
if (sampleListDir || (settings.unifiedDataView && insListDir)) {
DRAG_SOURCE(dir,asset);
DRAG_TARGET(dir,asset,e->song.sampleDir);
}
if (memWarning) { if (memWarning) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text(ICON_FA_EXCLAMATION_TRIANGLE); ImGui::Text(ICON_FA_EXCLAMATION_TRIANGLE);
@ -435,203 +448,226 @@ void FurnaceGUI::drawInsList(bool asChild) {
if (began) { if (began) {
if (settings.unifiedDataView) settings.horizontalDataView=0; if (settings.unifiedDataView) settings.horizontalDataView=0;
if (ImGui::Button(ICON_FA_PLUS "##InsAdd")) { if (ImGui::Button(ICON_FA_PLUS "##InsAdd")) {
if (!settings.unifiedDataView) doAction(GUI_ACTION_INS_LIST_ADD); if (settings.unifiedDataView) {
switch (lastAssetType) {
case 0:
doAction(GUI_ACTION_INS_LIST_ADD);
break;
case 1:
doAction(GUI_ACTION_WAVE_LIST_ADD);
break;
case 2:
doAction(GUI_ACTION_SAMPLE_LIST_ADD);
break;
}
} else {
doAction(GUI_ACTION_INS_LIST_ADD);
}
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Add"); ImGui::SetTooltip("Add");
} }
if (settings.unifiedDataView) { if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
if (ImGui::BeginPopupContextItem("UnifiedAdd",ImGuiMouseButton_Left)) { displayInsTypeList=true;
if (ImGui::MenuItem("instrument")) { displayInsTypeListMakeInsSample=-1;
doAction(GUI_ACTION_INS_LIST_ADD);
}
if (ImGui::MenuItem("wavetable")) {
doAction(GUI_ACTION_WAVE_LIST_ADD);
}
if (ImGui::MenuItem("sample (create)")) {
doAction(GUI_ACTION_SAMPLE_LIST_ADD);
}
ImGui::EndPopup();
}
} else {
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
displayInsTypeList=true;
displayInsTypeListMakeInsSample=-1;
}
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_FILES_O "##InsClone")) { if (ImGui::Button(ICON_FA_FILES_O "##InsClone")) {
if (!settings.unifiedDataView) doAction(GUI_ACTION_INS_LIST_DUPLICATE); if (settings.unifiedDataView) {
switch (lastAssetType) {
case 0:
doAction(GUI_ACTION_INS_LIST_DUPLICATE);
break;
case 1:
doAction(GUI_ACTION_WAVE_LIST_DUPLICATE);
break;
case 2:
doAction(GUI_ACTION_SAMPLE_LIST_DUPLICATE);
break;
}
} else {
doAction(GUI_ACTION_INS_LIST_DUPLICATE);
}
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Duplicate"); ImGui::SetTooltip("Duplicate");
} }
if (settings.unifiedDataView) {
if (ImGui::BeginPopupContextItem("UnifiedClone",ImGuiMouseButton_Left)) {
if (ImGui::MenuItem("instrument")) {
doAction(GUI_ACTION_INS_LIST_DUPLICATE);
}
if (ImGui::MenuItem("wavetable")) {
doAction(GUI_ACTION_WAVE_LIST_DUPLICATE);
}
if (ImGui::MenuItem("sample")) {
doAction(GUI_ACTION_SAMPLE_LIST_DUPLICATE);
}
ImGui::EndPopup();
}
}
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_FOLDER_OPEN "##InsLoad")) { if (ImGui::Button(ICON_FA_FOLDER_OPEN "##InsLoad")) {
if (!settings.unifiedDataView) doAction(GUI_ACTION_INS_LIST_OPEN); if (settings.unifiedDataView) {
switch (lastAssetType) {
case 0:
doAction(GUI_ACTION_INS_LIST_OPEN);
break;
case 1:
doAction(GUI_ACTION_WAVE_LIST_OPEN);
break;
case 2:
doAction(GUI_ACTION_SAMPLE_LIST_OPEN);
break;
}
} else {
doAction(GUI_ACTION_INS_LIST_OPEN);
}
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Open"); ImGui::SetTooltip("Open");
} }
if (settings.unifiedDataView) { if (ImGui::BeginPopupContextItem("InsOpenOpt")) {
if (ImGui::BeginPopupContextItem("UnifiedLoad",ImGuiMouseButton_Left)) { if (ImGui::MenuItem("replace...")) {
if (ImGui::MenuItem("instrument")) { doAction((curIns>=0 && curIns<(int)e->song.ins.size())?GUI_ACTION_INS_LIST_OPEN_REPLACE:GUI_ACTION_INS_LIST_OPEN);
doAction(GUI_ACTION_INS_LIST_OPEN);
}
if (ImGui::MenuItem("instrument (replace...)")) {
doAction((curIns>=0 && curIns<(int)e->song.ins.size())?GUI_ACTION_INS_LIST_OPEN_REPLACE:GUI_ACTION_INS_LIST_OPEN);
}
if (ImGui::MenuItem("wavetable")) {
doAction(GUI_ACTION_WAVE_LIST_OPEN);
}
if (ImGui::MenuItem("sample")) {
doAction(GUI_ACTION_SAMPLE_LIST_OPEN);
}
ImGui::Separator();
if (ImGui::MenuItem("instrument from TX81Z")) {
doAction(GUI_ACTION_TX81Z_REQUEST);
}
ImGui::EndPopup();
} }
} else { ImGui::Separator();
if (ImGui::BeginPopupContextItem("InsOpenOpt")) { if (ImGui::MenuItem("load from TX81Z")) {
if (ImGui::MenuItem("replace...")) { doAction(GUI_ACTION_TX81Z_REQUEST);
doAction((curIns>=0 && curIns<(int)e->song.ins.size())?GUI_ACTION_INS_LIST_OPEN_REPLACE:GUI_ACTION_INS_LIST_OPEN);
}
ImGui::Separator();
if (ImGui::MenuItem("load from TX81Z")) {
doAction(GUI_ACTION_TX81Z_REQUEST);
}
ImGui::EndPopup();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Open (insert; right-click to replace)");
} }
ImGui::EndPopup();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Open (insert; right-click to replace)");
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_FLOPPY_O "##InsSave")) { if (ImGui::Button(ICON_FA_FLOPPY_O "##InsSave")) {
if (!settings.unifiedDataView) doAction(GUI_ACTION_INS_LIST_SAVE); if (settings.unifiedDataView) {
switch (lastAssetType) {
case 0:
doAction(GUI_ACTION_INS_LIST_SAVE);
break;
case 1:
doAction(GUI_ACTION_WAVE_LIST_SAVE);
break;
case 2:
doAction(GUI_ACTION_SAMPLE_LIST_SAVE);
break;
}
} else {
doAction(GUI_ACTION_INS_LIST_SAVE);
}
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Save"); ImGui::SetTooltip("Save");
} }
if (settings.unifiedDataView) { if (ImGui::BeginPopupContextItem("InsSaveFormats",ImGuiMouseButton_Right)) {
if (ImGui::BeginPopupContextItem("UnifiedSave",ImGuiMouseButton_Left)) { if (ImGui::MenuItem("save as .dmp...")) {
if (ImGui::MenuItem("instrument")) { doAction(GUI_ACTION_INS_LIST_SAVE_DMP);
doAction(GUI_ACTION_INS_LIST_SAVE);
}
if (ImGui::MenuItem("instrument (legacy .fui)")) {
doAction(GUI_ACTION_INS_LIST_SAVE_OLD);
}
if (ImGui::MenuItem("instrument (.dmp)")) {
doAction(GUI_ACTION_INS_LIST_SAVE_DMP);
}
if (ImGui::MenuItem("wavetable")) {
doAction(GUI_ACTION_WAVE_LIST_SAVE);
}
if (ImGui::MenuItem("wavetable (.dmw)")) {
doAction(GUI_ACTION_WAVE_LIST_SAVE_DMW);
}
if (ImGui::MenuItem("wavetable (raw)")) {
doAction(GUI_ACTION_WAVE_LIST_SAVE_RAW);
}
if (ImGui::MenuItem("sample")) {
doAction(GUI_ACTION_SAMPLE_LIST_SAVE);
}
ImGui::EndPopup();
}
} else {
if (ImGui::BeginPopupContextItem("InsSaveFormats",ImGuiMouseButton_Right)) {
if (ImGui::MenuItem("save in legacy format...")) {
doAction(GUI_ACTION_INS_LIST_SAVE_OLD);
}
if (ImGui::MenuItem("save as .dmp...")) {
doAction(GUI_ACTION_INS_LIST_SAVE_DMP);
}
ImGui::EndPopup();
} }
ImGui::EndPopup();
}
ImGui::SameLine();
pushToggleColors(insListDir);
if (ImGui::Button(ICON_FA_SITEMAP "##DirMode")) {
doAction(GUI_ACTION_INS_LIST_DIR_VIEW);
}
popToggleColors();
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Toggle folders/standard view");
}
if (!insListDir) {
ImGui::SameLine(); ImGui::SameLine();
pushToggleColors(insListDir); if (ImGui::ArrowButton("InsUp",ImGuiDir_Up)) {
if (ImGui::Button(ICON_FA_SITEMAP "##DirMode")) { if (settings.unifiedDataView) {
doAction(GUI_ACTION_INS_LIST_DIR_VIEW); switch (lastAssetType) {
} case 0:
popToggleColors(); doAction(GUI_ACTION_INS_LIST_MOVE_UP);
if (ImGui::IsItemHovered()) { break;
ImGui::SetTooltip("Toggle folders/standard view"); case 1:
} doAction(GUI_ACTION_WAVE_LIST_MOVE_UP);
if (!insListDir) { break;
ImGui::SameLine(); case 2:
if (ImGui::ArrowButton("InsUp",ImGuiDir_Up)) { doAction(GUI_ACTION_SAMPLE_LIST_MOVE_UP);
break;
}
} else {
doAction(GUI_ACTION_INS_LIST_MOVE_UP); doAction(GUI_ACTION_INS_LIST_MOVE_UP);
} }
if (ImGui::IsItemHovered()) { }
ImGui::SetTooltip("Move up"); if (ImGui::IsItemHovered()) {
} ImGui::SetTooltip("Move up");
ImGui::SameLine(); }
if (ImGui::ArrowButton("InsDown",ImGuiDir_Down)) { ImGui::SameLine();
if (ImGui::ArrowButton("InsDown",ImGuiDir_Down)) {
if (settings.unifiedDataView) {
switch (lastAssetType) {
case 0:
doAction(GUI_ACTION_INS_LIST_MOVE_DOWN);
break;
case 1:
doAction(GUI_ACTION_WAVE_LIST_MOVE_DOWN);
break;
case 2:
doAction(GUI_ACTION_SAMPLE_LIST_MOVE_DOWN);
break;
}
} else {
doAction(GUI_ACTION_INS_LIST_MOVE_DOWN); doAction(GUI_ACTION_INS_LIST_MOVE_DOWN);
} }
if (ImGui::IsItemHovered()) { }
ImGui::SetTooltip("Move down"); if (ImGui::IsItemHovered()) {
} ImGui::SetTooltip("Move down");
} else { }
} else {
ImGui::SameLine();
if (ImGui::Button(ICON_FA_FOLDER "##InsFolder")) {
folderString="";
}
if (ImGui::BeginPopupContextItem("NewInsFolder",ImGuiMouseButton_Left)) {
ImGui::InputText("##FolderName",&folderString);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_FOLDER "##InsFolder")) { ImGui::BeginDisabled(folderString.empty());
folderString=""; if (ImGui::Button("Create")) {
} if (settings.unifiedDataView) {
if (ImGui::BeginPopupContextItem("NewInsFolder",ImGuiMouseButton_Left)) { switch (lastAssetType) {
ImGui::InputText("##FolderName",&folderString); case 0:
ImGui::SameLine(); e->lockEngine([this]() {
ImGui::BeginDisabled(folderString.empty()); e->song.insDir.push_back(DivAssetDir(folderString));
if (ImGui::Button("Create")) { });
break;
case 1:
e->lockEngine([this]() {
e->song.waveDir.push_back(DivAssetDir(folderString));
});
break;
case 2:
e->lockEngine([this]() {
e->song.sampleDir.push_back(DivAssetDir(folderString));
});
break;
}
} else {
e->lockEngine([this]() { e->lockEngine([this]() {
e->song.insDir.push_back(DivAssetDir(folderString)); e->song.insDir.push_back(DivAssetDir(folderString));
}); });
ImGui::CloseCurrentPopup();
} }
ImGui::EndDisabled(); ImGui::CloseCurrentPopup();
ImGui::EndPopup();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("New folder");
} }
ImGui::EndDisabled();
ImGui::EndPopup();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("New folder");
} }
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_TIMES "##InsDelete")) { if (ImGui::Button(ICON_FA_TIMES "##InsDelete")) {
if (!settings.unifiedDataView) doAction(GUI_ACTION_INS_LIST_DELETE); if (settings.unifiedDataView) {
switch (lastAssetType) {
case 0:
doAction(GUI_ACTION_INS_LIST_DELETE);
break;
case 1:
doAction(GUI_ACTION_WAVE_LIST_DELETE);
break;
case 2:
doAction(GUI_ACTION_SAMPLE_LIST_DELETE);
break;
}
} else {
doAction(GUI_ACTION_INS_LIST_DELETE);
}
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Delete"); ImGui::SetTooltip("Delete");
} }
if (settings.unifiedDataView) {
if (ImGui::BeginPopupContextItem("UnifiedDelete",ImGuiMouseButton_Left)) {
if (ImGui::MenuItem("instrument")) {
doAction(GUI_ACTION_INS_LIST_DELETE);
}
if (ImGui::MenuItem("wavetable")) {
doAction(GUI_ACTION_WAVE_LIST_DELETE);
}
if (ImGui::MenuItem("sample")) {
doAction(GUI_ACTION_SAMPLE_LIST_DELETE);
}
ImGui::EndPopup();
}
}
ImGui::Separator(); ImGui::Separator();
int availableRows=ImGui::GetContentRegionAvail().y/ImGui::GetFrameHeight(); int availableRows=ImGui::GetContentRegionAvail().y/ImGui::GetFrameHeight();
if (availableRows<1) availableRows=1; if (availableRows<1) availableRows=1;
@ -643,7 +679,9 @@ void FurnaceGUI::drawInsList(bool asChild) {
if (settings.unifiedDataView) { if (settings.unifiedDataView) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text(ICON_FA_TASKS " Instruments"); if (ImGui::Selectable(ICON_FA_TASKS " Instruments",lastAssetType==0)) {
lastAssetType=0;
}
ImGui::Indent(); ImGui::Indent();
} }
@ -658,7 +696,7 @@ void FurnaceGUI::drawInsList(bool asChild) {
int dirIndex=0; int dirIndex=0;
int dirToDelete=-1; int dirToDelete=-1;
for (DivAssetDir& i: e->song.insDir) { for (DivAssetDir& i: e->song.insDir) {
String nodeName=fmt::sprintf("%s %s##_AD%d",i.name.empty()?ICON_FA_FOLDER_O:ICON_FA_FOLDER,i.name.empty()?"<uncategorized>":i.name,i.name.empty()?-1:dirIndex); String nodeName=fmt::sprintf("%s %s##_ADI%d",i.name.empty()?ICON_FA_FOLDER_O:ICON_FA_FOLDER,i.name.empty()?"<uncategorized>":i.name,i.name.empty()?-1:dirIndex);
String popupID=fmt::sprintf("DirRightMenu%d",dirIndex); String popupID=fmt::sprintf("DirRightMenu%d",dirIndex);
bool treeNode=ImGui::TreeNodeEx(nodeName.c_str(),ImGuiTreeNodeFlags_SpanAvailWidth|(i.name.empty()?ImGuiTreeNodeFlags_DefaultOpen:0)); bool treeNode=ImGui::TreeNodeEx(nodeName.c_str(),ImGuiTreeNodeFlags_SpanAvailWidth|(i.name.empty()?ImGuiTreeNodeFlags_DefaultOpen:0));
DRAG_SOURCE(dirIndex,-1); DRAG_SOURCE(dirIndex,-1);
@ -709,14 +747,18 @@ void FurnaceGUI::drawInsList(bool asChild) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text(ICON_FA_AREA_CHART " Wavetables"); if (ImGui::Selectable(ICON_FA_AREA_CHART " Wavetables",lastAssetType==1)) {
lastAssetType=1;
}
ImGui::Indent(); ImGui::Indent();
actualWaveList(); actualWaveList();
ImGui::Unindent(); ImGui::Unindent();
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text(ICON_FA_VOLUME_UP " Samples"); if (ImGui::Selectable(ICON_FA_VOLUME_UP " Samples",lastAssetType==2)) {
lastAssetType=2;
}
ImGui::Indent(); ImGui::Indent();
actualSampleList(); actualSampleList();
ImGui::Unindent(); ImGui::Unindent();
@ -805,19 +847,42 @@ void FurnaceGUI::drawWaveList(bool asChild) {
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Toggle folders/standard view"); ImGui::SetTooltip("Toggle folders/standard view");
} }
ImGui::SameLine(); if (!waveListDir) {
if (ImGui::ArrowButton("WaveUp",ImGuiDir_Up)) { ImGui::SameLine();
doAction(GUI_ACTION_WAVE_LIST_MOVE_UP); if (ImGui::ArrowButton("WaveUp",ImGuiDir_Up)) {
} doAction(GUI_ACTION_WAVE_LIST_MOVE_UP);
if (ImGui::IsItemHovered()) { }
ImGui::SetTooltip("Move up"); if (ImGui::IsItemHovered()) {
} ImGui::SetTooltip("Move up");
ImGui::SameLine(); }
if (ImGui::ArrowButton("WaveDown",ImGuiDir_Down)) { ImGui::SameLine();
doAction(GUI_ACTION_WAVE_LIST_MOVE_DOWN); if (ImGui::ArrowButton("WaveDown",ImGuiDir_Down)) {
} doAction(GUI_ACTION_WAVE_LIST_MOVE_DOWN);
if (ImGui::IsItemHovered()) { }
ImGui::SetTooltip("Move down"); if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Move down");
}
} else {
ImGui::SameLine();
if (ImGui::Button(ICON_FA_FOLDER "##WaveFolder")) {
folderString="";
}
if (ImGui::BeginPopupContextItem("NewWaveFolder",ImGuiMouseButton_Left)) {
ImGui::InputText("##FolderName",&folderString);
ImGui::SameLine();
ImGui::BeginDisabled(folderString.empty());
if (ImGui::Button("Create")) {
e->lockEngine([this]() {
e->song.waveDir.push_back(DivAssetDir(folderString));
});
ImGui::CloseCurrentPopup();
}
ImGui::EndDisabled();
ImGui::EndPopup();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("New folder");
}
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_TIMES "##WaveDelete")) { if (ImGui::Button(ICON_FA_TIMES "##WaveDelete")) {
@ -922,19 +987,42 @@ void FurnaceGUI::drawSampleList(bool asChild) {
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Toggle folders/standard view"); ImGui::SetTooltip("Toggle folders/standard view");
} }
ImGui::SameLine(); if (!sampleListDir) {
if (ImGui::ArrowButton("SampleUp",ImGuiDir_Up)) { ImGui::SameLine();
doAction(GUI_ACTION_SAMPLE_LIST_MOVE_UP); if (ImGui::ArrowButton("SampleUp",ImGuiDir_Up)) {
} doAction(GUI_ACTION_SAMPLE_LIST_MOVE_UP);
if (ImGui::IsItemHovered()) { }
ImGui::SetTooltip("Move up"); if (ImGui::IsItemHovered()) {
} ImGui::SetTooltip("Move up");
ImGui::SameLine(); }
if (ImGui::ArrowButton("SampleDown",ImGuiDir_Down)) { ImGui::SameLine();
doAction(GUI_ACTION_SAMPLE_LIST_MOVE_DOWN); if (ImGui::ArrowButton("SampleDown",ImGuiDir_Down)) {
} doAction(GUI_ACTION_SAMPLE_LIST_MOVE_DOWN);
if (ImGui::IsItemHovered()) { }
ImGui::SetTooltip("Move down"); if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Move down");
}
} else {
ImGui::SameLine();
if (ImGui::Button(ICON_FA_FOLDER "##SampleFolder")) {
folderString="";
}
if (ImGui::BeginPopupContextItem("NewSampleFolder",ImGuiMouseButton_Left)) {
ImGui::InputText("##FolderName",&folderString);
ImGui::SameLine();
ImGui::BeginDisabled(folderString.empty());
if (ImGui::Button("Create")) {
e->lockEngine([this]() {
e->song.sampleDir.push_back(DivAssetDir(folderString));
});
ImGui::CloseCurrentPopup();
}
ImGui::EndDisabled();
ImGui::EndPopup();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("New folder");
}
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_TIMES "##SampleDelete")) { if (ImGui::Button(ICON_FA_TIMES "##SampleDelete")) {
@ -974,17 +1062,94 @@ void FurnaceGUI::drawSampleList(bool asChild) {
void FurnaceGUI::actualWaveList() { void FurnaceGUI::actualWaveList() {
float wavePreview[257]; float wavePreview[257];
for (int i=0; i<(int)e->song.wave.size(); i++) {
if (waveListDir || (settings.unifiedDataView && insListDir)) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
waveListItem(i,wavePreview,-1,-1); int dirIndex=0;
int dirToDelete=-1;
for (DivAssetDir& i: e->song.waveDir) {
String nodeName=fmt::sprintf("%s %s##_ADW%d",i.name.empty()?ICON_FA_FOLDER_O:ICON_FA_FOLDER,i.name.empty()?"<uncategorized>":i.name,i.name.empty()?-1:dirIndex);
String popupID=fmt::sprintf("DirRightMenu%d",dirIndex);
bool treeNode=ImGui::TreeNodeEx(nodeName.c_str(),ImGuiTreeNodeFlags_SpanAvailWidth|(i.name.empty()?ImGuiTreeNodeFlags_DefaultOpen:0));
DRAG_SOURCE(dirIndex,-1);
DRAG_TARGET(dirIndex,-1,e->song.waveDir);
if (ImGui::BeginPopupContextItem(popupID.c_str())) {
if (ImGui::MenuItem("rename...")) {
editStr(&i.name);
}
if (ImGui::MenuItem("delete")) {
dirToDelete=dirIndex;
}
ImGui::EndPopup();
}
if (treeNode) {
int assetIndex=0;
for (int j: i.entries) {
waveListItem(j,wavePreview,dirIndex,assetIndex);
assetIndex++;
}
ImGui::TreePop();
}
dirIndex++;
}
if (dirToDelete!=-1) {
e->lockEngine([this,dirToDelete]() {
e->song.waveDir.erase(e->song.waveDir.begin()+dirToDelete);
e->checkAssetDir(e->song.waveDir,e->song.wave.size());
});
}
} else {
for (int i=0; i<(int)e->song.wave.size(); i++) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
waveListItem(i,wavePreview,-1,-1);
}
} }
} }
void FurnaceGUI::actualSampleList() { void FurnaceGUI::actualSampleList() {
for (int i=0; i<(int)e->song.sample.size(); i++) { if (sampleListDir || (settings.unifiedDataView && insListDir)) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
sampleListItem(i,-1,-1); int dirIndex=0;
int dirToDelete=-1;
for (DivAssetDir& i: e->song.sampleDir) {
String nodeName=fmt::sprintf("%s %s##_ADS%d",i.name.empty()?ICON_FA_FOLDER_O:ICON_FA_FOLDER,i.name.empty()?"<uncategorized>":i.name,i.name.empty()?-1:dirIndex);
String popupID=fmt::sprintf("DirRightMenu%d",dirIndex);
bool treeNode=ImGui::TreeNodeEx(nodeName.c_str(),ImGuiTreeNodeFlags_SpanAvailWidth|(i.name.empty()?ImGuiTreeNodeFlags_DefaultOpen:0));
DRAG_SOURCE(dirIndex,-1);
DRAG_TARGET(dirIndex,-1,e->song.sampleDir);
if (ImGui::BeginPopupContextItem(popupID.c_str())) {
if (ImGui::MenuItem("rename...")) {
editStr(&i.name);
}
if (ImGui::MenuItem("delete")) {
dirToDelete=dirIndex;
}
ImGui::EndPopup();
}
if (treeNode) {
int assetIndex=0;
for (int j: i.entries) {
sampleListItem(j,dirIndex,assetIndex);
assetIndex++;
}
ImGui::TreePop();
}
dirIndex++;
}
if (dirToDelete!=-1) {
e->lockEngine([this,dirToDelete]() {
e->song.sampleDir.erase(e->song.sampleDir.begin()+dirToDelete);
e->checkAssetDir(e->song.sampleDir,e->song.sample.size());
});
}
} else {
for (int i=0; i<(int)e->song.sample.size(); i++) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
sampleListItem(i,-1,-1);
}
} }
} }

View file

@ -6643,6 +6643,7 @@ FurnaceGUI::FurnaceGUI():
dragMobileMenu(false), dragMobileMenu(false),
dragMobileEditButton(false), dragMobileEditButton(false),
wantGrooveListFocus(false), wantGrooveListFocus(false),
lastAssetType(0),
curWindow(GUI_WINDOW_NOTHING), curWindow(GUI_WINDOW_NOTHING),
nextWindow(GUI_WINDOW_NOTHING), nextWindow(GUI_WINDOW_NOTHING),
curWindowLast(GUI_WINDOW_NOTHING), curWindowLast(GUI_WINDOW_NOTHING),

View file

@ -1628,6 +1628,7 @@ class FurnaceGUI {
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI; bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
bool collapseWindow, demandScrollX, fancyPattern, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble; bool collapseWindow, demandScrollX, fancyPattern, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
bool keepLoopAlive, keepGrooveAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu, dragMobileEditButton, wantGrooveListFocus; bool keepLoopAlive, keepGrooveAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu, dragMobileEditButton, wantGrooveListFocus;
unsigned char lastAssetType;
FurnaceGUIWindows curWindow, nextWindow, curWindowLast; FurnaceGUIWindows curWindow, nextWindow, curWindowLast;
std::atomic<FurnaceGUIWindows> curWindowThreadSafe; std::atomic<FurnaceGUIWindows> curWindowThreadSafe;
float peak[DIV_MAX_OUTPUTS]; float peak[DIV_MAX_OUTPUTS];