GUI: add two ImGui settings

This commit is contained in:
tildearrow 2022-04-25 16:46:38 -05:00
parent 5821135b38
commit 8ba2787160
2 changed files with 28 additions and 0 deletions

View file

@ -842,6 +842,8 @@ class FurnaceGUI {
int notePreviewBehavior; int notePreviewBehavior;
int powerSave; int powerSave;
int absorbInsInput; int absorbInsInput;
int eventDelay;
int moveWindowTitle;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
String mainFontPath; String mainFontPath;
String patFontPath; String patFontPath;
@ -917,6 +919,8 @@ class FurnaceGUI {
notePreviewBehavior(1), notePreviewBehavior(1),
powerSave(1), powerSave(1),
absorbInsInput(0), absorbInsInput(0),
eventDelay(0),
moveWindowTitle(0),
maxUndoSteps(100), maxUndoSteps(100),
mainFontPath(""), mainFontPath(""),
patFontPath(""), patFontPath(""),

View file

@ -313,6 +313,21 @@ void FurnaceGUI::drawSettings() {
settings.sysFileDialog=sysFileDialogB; settings.sysFileDialog=sysFileDialogB;
} }
bool moveWindowTitleB=settings.moveWindowTitle;
if (ImGui::Checkbox("Only allow window movement when clicking on title bar",&moveWindowTitleB)) {
settings.moveWindowTitle=moveWindowTitleB;
applyUISettings(false);
}
bool eventDelayB=settings.eventDelay;
if (ImGui::Checkbox("Enable event delay",&eventDelayB)) {
settings.eventDelay=eventDelayB;
applyUISettings(false);
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("may cause issues with high-polling-rate mice when previewing notes.");
}
bool powerSaveB=settings.powerSave; bool powerSaveB=settings.powerSave;
if (ImGui::Checkbox("Power-saving mode",&powerSaveB)) { if (ImGui::Checkbox("Power-saving mode",&powerSaveB)) {
settings.powerSave=powerSaveB; settings.powerSave=powerSaveB;
@ -1651,6 +1666,8 @@ void FurnaceGUI::syncSettings() {
settings.notePreviewBehavior=e->getConfInt("notePreviewBehavior",1); settings.notePreviewBehavior=e->getConfInt("notePreviewBehavior",1);
settings.powerSave=e->getConfInt("powerSave",POWER_SAVE_DEFAULT); settings.powerSave=e->getConfInt("powerSave",POWER_SAVE_DEFAULT);
settings.absorbInsInput=e->getConfInt("absorbInsInput",0); settings.absorbInsInput=e->getConfInt("absorbInsInput",0);
settings.eventDelay=e->getConfInt("eventDelay",0);
settings.moveWindowTitle=e->getConfInt("moveWindowTitle",0);
clampSetting(settings.mainFontSize,2,96); clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.patFontSize,2,96); clampSetting(settings.patFontSize,2,96);
@ -1715,6 +1732,8 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.notePreviewBehavior,0,3); clampSetting(settings.notePreviewBehavior,0,3);
clampSetting(settings.powerSave,0,1); clampSetting(settings.powerSave,0,1);
clampSetting(settings.absorbInsInput,0,1); clampSetting(settings.absorbInsInput,0,1);
clampSetting(settings.eventDelay,0,1);
clampSetting(settings.moveWindowTitle,0,1);
// keybinds // keybinds
for (int i=0; i<GUI_ACTION_MAX; i++) { for (int i=0; i<GUI_ACTION_MAX; i++) {
@ -1806,6 +1825,8 @@ void FurnaceGUI::commitSettings() {
e->setConf("notePreviewBehavior",settings.notePreviewBehavior); e->setConf("notePreviewBehavior",settings.notePreviewBehavior);
e->setConf("powerSave",settings.powerSave); e->setConf("powerSave",settings.powerSave);
e->setConf("absorbInsInput",settings.absorbInsInput); e->setConf("absorbInsInput",settings.absorbInsInput);
e->setConf("eventDelay",settings.eventDelay);
e->setConf("moveWindowTitle",settings.moveWindowTitle);
// colors // colors
for (int i=0; i<GUI_COLOR_MAX; i++) { for (int i=0; i<GUI_COLOR_MAX; i++) {
@ -2317,6 +2338,9 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
ImGui::GetStyle()=sty; ImGui::GetStyle()=sty;
ImGui::GetIO().ConfigInputTrickleEventQueue=settings.eventDelay;
ImGui::GetIO().ConfigWindowsMoveFromTitleBarOnly=settings.moveWindowTitle;
for (int i=0; i<256; i++) { for (int i=0; i<256; i++) {
ImVec4& base=uiColors[GUI_COLOR_PATTERN_EFFECT_PITCH]; ImVec4& base=uiColors[GUI_COLOR_PATTERN_EFFECT_PITCH];
pitchGrad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w)); pitchGrad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));