dev92 - GUI: customizable channel collapsing!

This commit is contained in:
tildearrow 2022-05-04 23:36:03 -05:00
parent c3e55ae117
commit 202a528477
5 changed files with 25 additions and 11 deletions

View File

@ -45,8 +45,8 @@
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
#define BUSY_END isBusy.unlock(); softLocked=false;
#define DIV_VERSION "dev91"
#define DIV_ENGINE_VERSION 91
#define DIV_VERSION "dev92"
#define DIV_ENGINE_VERSION 92
// for imports
#define DIV_VERSION_MOD 0xff01

View File

@ -1315,6 +1315,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
ds.chanCollapse[i]=reader.readC();
}
if (ds.version<92) {
for (int i=0; i<tchans; i++) {
if (ds.chanCollapse[i]>0) ds.chanCollapse[i]=3;
}
}
for (int i=0; i<tchans; i++) {
ds.chanName[i]=reader.readString();
}

View File

@ -345,7 +345,7 @@ struct DivSong {
std::vector<DivSample*> sample;
bool chanShow[DIV_MAX_CHANS];
bool chanCollapse[DIV_MAX_CHANS];
unsigned char chanCollapse[DIV_MAX_CHANS];
DivInstrument nullIns, nullInsOPLL, nullInsOPL, nullInsQSound;
DivWavetable nullWave;
@ -452,7 +452,7 @@ struct DivSong {
}
for (int i=0; i<DIV_MAX_CHANS; i++) {
chanShow[i]=true;
chanCollapse[i]=false;
chanCollapse[i]=0;
}
system[0]=DIV_SYSTEM_YM2612;
system[1]=DIV_SYSTEM_SMS;

View File

@ -83,10 +83,10 @@ void FurnaceGUI::finishSelection() {
if (cursor.y<0) cursor.y=0;
if (cursor.y>=e->song.patLen) cursor.y=e->song.patLen-1;
if (e->song.chanCollapse[selEnd.xCoarse]) {
if (e->song.chanCollapse[selStart.xCoarse]==3) {
selStart.xFine=0;
}
if (e->song.chanCollapse[selEnd.xCoarse]) {
if (e->song.chanCollapse[selEnd.xCoarse] && selEnd.xFine>=(3-e->song.chanCollapse[selEnd.xCoarse])) {
selEnd.xFine=2+e->song.pat[cursor.xCoarse].effectCols*2;
}
@ -105,7 +105,7 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) {
demandScrollX=true;
if (x>0) {
for (int i=0; i<x; i++) {
if (++cursor.xFine>=(e->song.chanCollapse[cursor.xCoarse]?1:(3+e->song.pat[cursor.xCoarse].effectCols*2))) {
if (++cursor.xFine>=(e->song.chanCollapse[cursor.xCoarse]?(4-e->song.chanCollapse[cursor.xCoarse]):(3+e->song.pat[cursor.xCoarse].effectCols*2))) {
cursor.xFine=0;
if (++cursor.xCoarse>=lastChannel) {
if (settings.wrapHorizontal!=0 && !select) {
@ -113,7 +113,7 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) {
if (settings.wrapHorizontal==2) y++;
} else {
cursor.xCoarse=lastChannel-1;
cursor.xFine=e->song.chanCollapse[cursor.xCoarse]?0:(2+e->song.pat[cursor.xCoarse].effectCols*2);
cursor.xFine=e->song.chanCollapse[cursor.xCoarse]?(3-e->song.chanCollapse[cursor.xCoarse]):(2+e->song.pat[cursor.xCoarse].effectCols*2);
}
} else {
while (!e->song.chanShow[cursor.xCoarse]) {
@ -141,7 +141,7 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) {
if (cursor.xCoarse<0) break;
}
if (e->song.chanCollapse[cursor.xCoarse]) {
cursor.xFine=0;
cursor.xFine=3-e->song.chanCollapse[cursor.xCoarse];
} else {
cursor.xFine=2+e->song.pat[cursor.xCoarse].effectCols*2;
}

View File

@ -145,7 +145,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PopStyleColor();
// the following is only visible when the channel is not collapsed
if (!e->song.chanCollapse[j]) {
if (e->song.chanCollapse[j]<3) {
// instrument
if (pat->data[i][2]==-1) {
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
@ -183,7 +183,9 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
updateSelection(j,1,i);
}
ImGui::PopStyleColor();
}
if (e->song.chanCollapse[j]<2) {
// volume
if (pat->data[i][3]==-1) {
sprintf(id,"..##PV_%d_%d",i,j);
@ -215,7 +217,9 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
updateSelection(j,2,i);
}
ImGui::PopStyleColor();
}
if (e->song.chanCollapse[j]<1) {
// effects
for (int k=0; k<e->song.pat[j].effectCols; k++) {
int index=4+(k<<1);
@ -499,7 +503,11 @@ void FurnaceGUI::drawPattern() {
snprintf(chanID,2048,"%c##_HCH%d",e->song.chanCollapse[i]?'+':'-',i);
ImGui::SetCursorPosX(ImGui::GetCursorPosX()+4.0f*dpiScale);
if (ImGui::SmallButton(chanID)) {
e->song.chanCollapse[i]=!e->song.chanCollapse[i];
if (e->song.chanCollapse[i]==0) {
e->song.chanCollapse[i]=3;
} else if (e->song.chanCollapse[i]>0) {
e->song.chanCollapse[i]--;
}
}
if (!e->song.chanCollapse[i]) {
ImGui::SameLine();