GUI: add "note preview behavior" setting

This commit is contained in:
tildearrow 2022-04-16 13:13:19 -05:00
parent b4ac5c7e6a
commit 330171edc3
4 changed files with 32 additions and 0 deletions

View File

@ -1,7 +1,11 @@
# to-do for 0.6pre1
- panning macro
- single macro for hard-panned chips
- two macros for soft-panned ones
- pitch macro
- relative mode
- test
- piano/input pad
- note input via piano
- input pad
@ -43,3 +47,4 @@
- settings: OK/Cancel buttons should be always visible
- Apply button in settings
- better FM chip names (number and codename)
- find and replace

View File

@ -1960,6 +1960,7 @@ int _processEvent(void* instance, SDL_Event* event) {
int FurnaceGUI::processEvent(SDL_Event* ev) {
if (ev->type==SDL_KEYDOWN) {
if (!ev->key.repeat && !wantCaptureKeyboard && (ev->key.keysym.mod&(~(KMOD_NUM|KMOD_CAPS|KMOD_SCROLL)))==0) {
if (settings.notePreviewBehavior==0) return 1;
switch (curWindow) {
case GUI_WINDOW_SAMPLE_EDIT:
case GUI_WINDOW_SAMPLE_LIST:
@ -1991,6 +1992,13 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
break;
case GUI_WINDOW_ORDERS: // ignore here
break;
case GUI_WINDOW_PATTERN:
if (settings.notePreviewBehavior==1) {
if (cursor.xFine!=0) break;
} else if (settings.notePreviewBehavior==2) {
if (edit && cursor.xFine!=0) break;
}
// fall-through
default:
try {
int key=noteKeys.at(ev->key.keysym.scancode);

View File

@ -819,6 +819,7 @@ class FurnaceGUI {
int oplStandardWaveNames;
int cursorMoveNoScroll;
int lowLatency;
int notePreviewBehavior;
unsigned int maxUndoSteps;
String mainFontPath;
String patFontPath;
@ -891,6 +892,7 @@ class FurnaceGUI {
oplStandardWaveNames(0),
cursorMoveNoScroll(0),
lowLatency(0),
notePreviewBehavior(1),
maxUndoSteps(100),
mainFontPath(""),
patFontPath(""),

View File

@ -301,6 +301,20 @@ void FurnaceGUI::drawSettings() {
settings.sysFileDialog=sysFileDialogB;
}
ImGui::Text("Note preview behavioe:");
if (ImGui::RadioButton("Never##npb0",settings.notePreviewBehavior==0)) {
settings.notePreviewBehavior=0;
}
if (ImGui::RadioButton("When cursor is in Note column##npb1",settings.notePreviewBehavior==1)) {
settings.notePreviewBehavior=1;
}
if (ImGui::RadioButton("When cursor is in Note column or not in edit mode##npb2",settings.notePreviewBehavior==2)) {
settings.notePreviewBehavior=2;
}
if (ImGui::RadioButton("Always##npb3",settings.notePreviewBehavior==3)) {
settings.notePreviewBehavior=3;
}
ImGui::Text("Wrap pattern cursor horizontally:");
if (ImGui::RadioButton("No##wrapH0",settings.wrapHorizontal==0)) {
settings.wrapHorizontal=0;
@ -1609,6 +1623,7 @@ void FurnaceGUI::syncSettings() {
settings.oplStandardWaveNames=e->getConfInt("oplStandardWaveNames",0);
settings.cursorMoveNoScroll=e->getConfInt("cursorMoveNoScroll",0);
settings.lowLatency=e->getConfInt("lowLatency",0);
settings.notePreviewBehavior=e->getConfInt("notePreviewBehavior",1);
clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.patFontSize,2,96);
@ -1670,6 +1685,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.oplStandardWaveNames,0,1);
clampSetting(settings.cursorMoveNoScroll,0,1);
clampSetting(settings.lowLatency,0,1);
clampSetting(settings.notePreviewBehavior,0,3);
// keybinds
for (int i=0; i<GUI_ACTION_MAX; i++) {
@ -1758,6 +1774,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("oplStandardWaveNames",settings.oplStandardWaveNames);
e->setConf("cursorMoveNoScroll",settings.cursorMoveNoScroll);
e->setConf("lowLatency",settings.lowLatency);
e->setConf("notePreviewBehavior",settings.notePreviewBehavior);
// colors
for (int i=0; i<GUI_COLOR_MAX; i++) {