GUI: implement no-nibble-push value input

This commit is contained in:
tildearrow 2022-04-13 17:42:55 -05:00
parent e86174921b
commit 720f046f28
4 changed files with 17 additions and 3 deletions

View File

@ -967,8 +967,12 @@ void FurnaceGUI::valueInput(int num, bool direct, int target) {
pat->data[cursor.y][target]=num&0xff;
} else {
if (pat->data[cursor.y][target]==-1) pat->data[cursor.y][target]=0;
if (!settings.pushNibble && !curNibble) {
pat->data[cursor.y][target]=num;
} else {
pat->data[cursor.y][target]=((pat->data[cursor.y][target]<<4)|num)&0xff;
}
}
if (cursor.xFine==1) { // instrument
if (pat->data[cursor.y][target]>=(int)e->song.ins.size()) {
pat->data[cursor.y][target]&=0x0f;

View File

@ -811,6 +811,7 @@ class FurnaceGUI {
int separateFMColors;
int insEditColorize;
int metroVol;
int pushNibble;
unsigned int maxUndoSteps;
String mainFontPath;
String patFontPath;
@ -878,6 +879,7 @@ class FurnaceGUI {
separateFMColors(0),
insEditColorize(0),
metroVol(100),
pushNibble(0),
maxUndoSteps(100),
mainFontPath(""),
patFontPath(""),

View File

@ -454,8 +454,8 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_CHANNEL_FM,"",ImVec4(0.2f,0.8f,1.0f,1.0f)),
D(GUI_COLOR_CHANNEL_PULSE,"",ImVec4(0.4f,1.0f,0.2f,1.0f)),
D(GUI_COLOR_CHANNEL_NOISE,"",ImVec4(0.8f,0.8f,0.8f,1.0f)),
D(GUI_COLOR_CHANNEL_WAVE,"",ImVec4(1.0f,0.9f,0.2f,1.0f)),
D(GUI_COLOR_CHANNEL_PCM,"",ImVec4(1.0f,0.5f,0.2f,1.0f)),
D(GUI_COLOR_CHANNEL_WAVE,"",ImVec4(1.0f,0.5f,0.2f,1.0f)),
D(GUI_COLOR_CHANNEL_PCM,"",ImVec4(1.0f,0.9f,0.2f,1.0f)),
D(GUI_COLOR_CHANNEL_OP,"",ImVec4(0.2f,0.4f,1.0f,1.0f)),
D(GUI_COLOR_CHANNEL_MUTED,"",ImVec4(0.5f,0.5f,0.5f,1.0f)),

View File

@ -236,6 +236,11 @@ void FurnaceGUI::drawSettings() {
settings.soloAction=2;
}
bool pushNibbleB=settings.pushNibble;
if (ImGui::Checkbox("Push value when overwriting instead of clearing it",&pushNibbleB)) {
settings.pushNibble=pushNibbleB;
}
bool pullDeleteBehaviorB=settings.pullDeleteBehavior;
if (ImGui::Checkbox("Move cursor up on backspace-delete",&pullDeleteBehaviorB)) {
settings.pullDeleteBehavior=pullDeleteBehaviorB;
@ -1568,6 +1573,7 @@ void FurnaceGUI::syncSettings() {
settings.separateFMColors=e->getConfInt("separateFMColors",0);
settings.insEditColorize=e->getConfInt("insEditColorize",0);
settings.metroVol=e->getConfInt("metroVol",100);
settings.pushNibble=e->getConfInt("pushNibble",0);
clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.patFontSize,2,96);
@ -1624,6 +1630,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.separateFMColors,0,1);
clampSetting(settings.insEditColorize,0,1);
clampSetting(settings.metroVol,0,200);
clampSetting(settings.pushNibble,0,1);
// keybinds
for (int i=0; i<GUI_ACTION_MAX; i++) {
@ -1707,6 +1714,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("separateFMColors",settings.separateFMColors);
e->setConf("insEditColorize",settings.insEditColorize);
e->setConf("metroVol",settings.metroVol);
e->setConf("pushNibble",settings.pushNibble);
// colors
for (int i=0; i<GUI_COLOR_MAX; i++) {