GUI: add new settings and proper inslist scroll

- step on delete
- scroll step
This commit is contained in:
tildearrow 2022-02-04 00:03:30 -05:00
parent 764196c1ad
commit f03b410281
2 changed files with 97 additions and 58 deletions

View file

@ -966,6 +966,7 @@ void FurnaceGUI::drawInsList() {
} }
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginTable("InsListScroll",1,ImGuiTableFlags_ScrollY)) {
for (int i=0; i<(int)e->song.ins.size(); i++) { for (int i=0; i<(int)e->song.ins.size(); i++) {
DivInstrument* ins=e->song.ins[i]; DivInstrument* ins=e->song.ins[i];
String name; String name;
@ -1015,6 +1016,8 @@ void FurnaceGUI::drawInsList() {
name=fmt::sprintf(ICON_FA_QUESTION " %.2X: %s##_INS%d\n",i,ins->name,i); name=fmt::sprintf(ICON_FA_QUESTION " %.2X: %s##_INS%d\n",i,ins->name,i);
break; break;
} }
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (ImGui::Selectable(name.c_str(),curIns==i)) { if (ImGui::Selectable(name.c_str(),curIns==i)) {
curIns=i; curIns=i;
} }
@ -1025,6 +1028,8 @@ void FurnaceGUI::drawInsList() {
} }
} }
} }
ImGui::EndTable();
}
} }
if (ImGui::IsWindowFocused()) curWindow=GUI_WINDOW_INS_LIST; if (ImGui::IsWindowFocused()) curWindow=GUI_WINDOW_INS_LIST;
ImGui::End(); ImGui::End();
@ -2832,6 +2837,11 @@ void FurnaceGUI::drawSettings() {
settings.pullDeleteBehavior=pullDeleteBehaviorB; settings.pullDeleteBehavior=pullDeleteBehaviorB;
} }
bool stepOnDeleteB=settings.stepOnDelete;
if (ImGui::Checkbox("Move cursor by edit step on delete",&stepOnDeleteB)) {
settings.stepOnDelete=stepOnDeleteB;
}
bool allowEditDockingB=settings.allowEditDocking; bool allowEditDockingB=settings.allowEditDocking;
if (ImGui::Checkbox("Allow docking editors",&allowEditDockingB)) { if (ImGui::Checkbox("Allow docking editors",&allowEditDockingB)) {
settings.allowEditDocking=allowEditDockingB; settings.allowEditDocking=allowEditDockingB;
@ -2858,6 +2868,14 @@ void FurnaceGUI::drawSettings() {
if (ImGui::RadioButton("Yes, and move to next/prev pattern##wrapV2",settings.wrapVertical==2)) { if (ImGui::RadioButton("Yes, and move to next/prev pattern##wrapV2",settings.wrapVertical==2)) {
settings.wrapVertical=2; settings.wrapVertical=2;
} }
ImGui::Text("Cursor movement keys behavior:");
if (ImGui::RadioButton("Move by one##cmk0",settings.scrollStep==0)) {
settings.scrollStep=0;
}
if (ImGui::RadioButton("Move by Edit Step##cmk1",settings.scrollStep==1)) {
settings.scrollStep=1;
}
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("Audio")) { if (ImGui::BeginTabItem("Audio")) {
@ -2978,6 +2996,12 @@ void FurnaceGUI::drawSettings() {
settings.germanNotation=germanNotationB; settings.germanNotation=germanNotationB;
} }
// sorry. temporarily disabled until ImGui has a way to add separators in tables arbitrarily.
/*bool sysSeparatorsB=settings.sysSeparators;
if (ImGui::Checkbox("Add separators between systems in Orders",&sysSeparatorsB)) {
settings.sysSeparators=sysSeparatorsB;
}*/
bool partyTimeB=settings.partyTime; bool partyTimeB=settings.partyTime;
if (ImGui::Checkbox("About screen party time",&partyTimeB)) { if (ImGui::Checkbox("About screen party time",&partyTimeB)) {
settings.partyTime=partyTimeB; settings.partyTime=partyTimeB;
@ -3114,6 +3138,9 @@ void FurnaceGUI::syncSettings() {
if (settings.fmNames<0 || settings.fmNames>2) settings.fmNames=0; if (settings.fmNames<0 || settings.fmNames>2) settings.fmNames=0;
settings.partyTime=e->getConfInt("partyTime",0); settings.partyTime=e->getConfInt("partyTime",0);
settings.germanNotation=e->getConfInt("germanNotation",0); settings.germanNotation=e->getConfInt("germanNotation",0);
settings.stepOnDelete=e->getConfInt("stepOnDelete",0);
settings.scrollStep=e->getConfInt("scrollStep",0);
settings.sysSeparators=e->getConfInt("sysSeparators",1);
} }
#define PUT_UI_COLOR(source) e->setConf(#source,(int)ImGui::GetColorU32(uiColors[source])); #define PUT_UI_COLOR(source) e->setConf(#source,(int)ImGui::GetColorU32(uiColors[source]));
@ -3145,6 +3172,9 @@ void FurnaceGUI::commitSettings() {
e->setConf("overflowHighlight",settings.overflowHighlight); e->setConf("overflowHighlight",settings.overflowHighlight);
e->setConf("partyTime",settings.partyTime); e->setConf("partyTime",settings.partyTime);
e->setConf("germanNotation",settings.germanNotation); e->setConf("germanNotation",settings.germanNotation);
e->setConf("stepOnDelete",settings.stepOnDelete);
e->setConf("scrollStep",settings.scrollStep);
e->setConf("sysSeparators",settings.sysSeparators);
PUT_UI_COLOR(GUI_COLOR_BACKGROUND); PUT_UI_COLOR(GUI_COLOR_BACKGROUND);
PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND); PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND);
@ -4330,10 +4360,10 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
edit=!edit; edit=!edit;
break; break;
case SDLK_UP: case SDLK_UP:
moveCursor(0,-1,ev.key.keysym.mod&KMOD_SHIFT); moveCursor(0,-MAX(1,settings.scrollStep?editStep:1),ev.key.keysym.mod&KMOD_SHIFT);
break; break;
case SDLK_DOWN: case SDLK_DOWN:
moveCursor(0,1,ev.key.keysym.mod&KMOD_SHIFT); moveCursor(0,MAX(1,settings.scrollStep?editStep:1),ev.key.keysym.mod&KMOD_SHIFT);
break; break;
case SDLK_LEFT: case SDLK_LEFT:
moveCursor(-1,0,ev.key.keysym.mod&KMOD_SHIFT); moveCursor(-1,0,ev.key.keysym.mod&KMOD_SHIFT);
@ -4355,6 +4385,9 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
break; break;
case SDLK_DELETE: case SDLK_DELETE:
doDelete(); doDelete();
if (settings.stepOnDelete) {
moveCursor(0,editStep,false);
}
break; break;
case SDLK_BACKSPACE: case SDLK_BACKSPACE:
doPullDelete(); doPullDelete();

View file

@ -214,6 +214,9 @@ class FurnaceGUI {
int overflowHighlight; int overflowHighlight;
int partyTime; int partyTime;
int germanNotation; int germanNotation;
int stepOnDelete;
int scrollStep;
int sysSeparators;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
String mainFontPath; String mainFontPath;
String patFontPath; String patFontPath;
@ -243,6 +246,9 @@ class FurnaceGUI {
overflowHighlight(0), overflowHighlight(0),
partyTime(0), partyTime(0),
germanNotation(0), germanNotation(0),
stepOnDelete(0),
scrollStep(0),
sysSeparators(1),
maxUndoSteps(100), maxUndoSteps(100),
mainFontPath(""), mainFontPath(""),
patFontPath("") {} patFontPath("") {}