mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-02 09:17:26 +00:00
Merge remote-tracking branch 'alederer/wave-list-horizontal'
This commit is contained in:
commit
f7a861a01d
4 changed files with 57 additions and 8 deletions
|
@ -488,7 +488,7 @@ below all the binds, select a key from the dropdown list to add it. it will appe
|
||||||
|
|
||||||
- **Unified instrument/wavetable/sample list**: combines all three types of assets into one list.
|
- **Unified instrument/wavetable/sample list**: combines all three types of assets into one list.
|
||||||
- the buttons act as appropriate to the currently selected asset or header.
|
- the buttons act as appropriate to the currently selected asset or header.
|
||||||
- **Horizontal instrument list**: when there are more instruments than there is room to display them...
|
- **Horizontal instrument/wavetable list**: when there are more instruments/wavetables than there is room to display them...
|
||||||
- if on, scroll horizontally through multiple columns.
|
- if on, scroll horizontally through multiple columns.
|
||||||
- if off, scroll vertically in one long column.
|
- if off, scroll vertically in one long column.
|
||||||
- only appears if "Unified instrument/wavetable/sample list" is off.
|
- only appears if "Unified instrument/wavetable/sample list" is off.
|
||||||
|
|
|
@ -997,6 +997,37 @@ void FurnaceGUI::drawSampleList(bool asChild) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: template. any way to remove it?
|
||||||
|
template<typename func_waveItemData> void FurnaceGUI::waveListHorizontalGroup(float* wavePreview, int dir, int count, const func_waveItemData& waveItemData) {
|
||||||
|
if (count==0) return;
|
||||||
|
|
||||||
|
float idealWidthMin=225.0f*dpiScale;
|
||||||
|
float idealWidthMax=350.0f*dpiScale;
|
||||||
|
float availX=ImGui::GetContentRegionAvail().x;
|
||||||
|
int columnCount=CLAMP((int)(availX/idealWidthMin),1,count);
|
||||||
|
int rowCount=(int)ceilf(count/(float)columnCount);
|
||||||
|
columnCount=(int)ceilf(count/(float)rowCount);
|
||||||
|
float columnWidth=MIN(CLAMP(availX/columnCount,idealWidthMin,idealWidthMax),availX);
|
||||||
|
if (ImGui::BeginTable("##waveListGroupTable",columnCount,ImGuiTableFlags_SizingFixedSame)) {
|
||||||
|
for (int col=0; col<columnCount; col++) {
|
||||||
|
ImGui::TableSetupColumn("##column",ImGuiTableColumnFlags_WidthFixed,columnWidth);
|
||||||
|
}
|
||||||
|
for (int row=0; row<rowCount; row++) {
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
for (int col=0; col<columnCount; col++) {
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
int idx=row+col*rowCount;
|
||||||
|
if (idx>=count) continue;
|
||||||
|
|
||||||
|
int waveIdx, asset;
|
||||||
|
waveItemData(row+col*rowCount,&waveIdx,&asset);
|
||||||
|
waveListItem(waveIdx,wavePreview,dir,asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FurnaceGUI::actualWaveList() {
|
void FurnaceGUI::actualWaveList() {
|
||||||
float wavePreview[257];
|
float wavePreview[257];
|
||||||
|
|
||||||
|
@ -1021,11 +1052,18 @@ void FurnaceGUI::actualWaveList() {
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
if (treeNode) {
|
if (treeNode) {
|
||||||
|
if (settings.horizontalDataView) {
|
||||||
|
waveListHorizontalGroup(wavePreview,dirIndex,i.entries.size(),[&](int i_, int* waveIdx, int* asset) {
|
||||||
|
*waveIdx=i.entries[i_];
|
||||||
|
*asset=i_;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
int assetIndex=0;
|
int assetIndex=0;
|
||||||
for (int j: i.entries) {
|
for (int j: i.entries) {
|
||||||
waveListItem(j,wavePreview,dirIndex,assetIndex);
|
waveListItem(j,wavePreview,dirIndex,assetIndex);
|
||||||
assetIndex++;
|
assetIndex++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
dirIndex++;
|
dirIndex++;
|
||||||
|
@ -1036,6 +1074,14 @@ void FurnaceGUI::actualWaveList() {
|
||||||
e->checkAssetDir(e->song.waveDir,e->song.wave.size());
|
e->checkAssetDir(e->song.waveDir,e->song.wave.size());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (settings.horizontalDataView) {
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
waveListHorizontalGroup(wavePreview,-1,(int)e->song.wave.size(),[&](int i, int* waveIdx, int* asset) {
|
||||||
|
*waveIdx=i;
|
||||||
|
*asset=-1;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
for (int i=0; i<(int)e->song.wave.size(); i++) {
|
for (int i=0; i<(int)e->song.wave.size(); i++) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
@ -1043,6 +1089,7 @@ void FurnaceGUI::actualWaveList() {
|
||||||
waveListItem(i,wavePreview,-1,-1);
|
waveListItem(i,wavePreview,-1,-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::actualSampleList() {
|
void FurnaceGUI::actualSampleList() {
|
||||||
|
|
|
@ -2832,6 +2832,8 @@ class FurnaceGUI {
|
||||||
void actualWaveList();
|
void actualWaveList();
|
||||||
void actualSampleList();
|
void actualSampleList();
|
||||||
|
|
||||||
|
// HACK: template. any way to remove it?
|
||||||
|
template<typename func_waveItemData> void waveListHorizontalGroup(float* wavePreview, int dir, int count, const func_waveItemData& waveItemData);
|
||||||
void insListItem(int index, int dir, int asset);
|
void insListItem(int index, int dir, int asset);
|
||||||
void waveListItem(int index, float* wavePreview, int dir, int asset);
|
void waveListItem(int index, float* wavePreview, int dir, int asset);
|
||||||
void sampleListItem(int index, int dir, int asset);
|
void sampleListItem(int index, int dir, int asset);
|
||||||
|
|
|
@ -3588,7 +3588,7 @@ void FurnaceGUI::drawSettings() {
|
||||||
|
|
||||||
ImGui::BeginDisabled(settings.unifiedDataView);
|
ImGui::BeginDisabled(settings.unifiedDataView);
|
||||||
bool horizontalDataViewB=settings.horizontalDataView;
|
bool horizontalDataViewB=settings.horizontalDataView;
|
||||||
if (ImGui::Checkbox(_("Horizontal instrument list"),&horizontalDataViewB)) {
|
if (ImGui::Checkbox(_("Horizontal instrument/wavetable list"),&horizontalDataViewB)) {
|
||||||
settings.horizontalDataView=horizontalDataViewB;
|
settings.horizontalDataView=horizontalDataViewB;
|
||||||
settingsChanged=true;
|
settingsChanged=true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue