Add option to prevent piano input

This commit is contained in:
YohananDiamond 2023-05-24 12:47:20 -03:00
parent 40c4632879
commit e07c14db81
3 changed files with 7 additions and 1 deletions

View file

@ -5954,6 +5954,7 @@ bool FurnaceGUI::init() {
pianoOptions=e->getConfBool("pianoOptions",pianoOptions);
pianoSharePosition=e->getConfBool("pianoSharePosition",pianoSharePosition);
pianoOptionsSet=e->getConfBool("pianoOptionsSet",pianoOptionsSet);
pianoReadonly=e->getConfBool("pianoReadonly",false);
pianoOffset=e->getConfInt("pianoOffset",pianoOffset);
pianoOffsetEdit=e->getConfInt("pianoOffsetEdit",pianoOffsetEdit);
pianoView=e->getConfInt("pianoView",pianoView);
@ -6389,6 +6390,7 @@ void FurnaceGUI::commitState() {
e->setConf("pianoOptions",pianoOptions);
e->setConf("pianoSharePosition",pianoSharePosition);
e->setConf("pianoOptionsSet",pianoOptionsSet);
e->setConf("pianoReadonly",pianoReadonly);
e->setConf("pianoOffset",pianoOffset);
e->setConf("pianoOffsetEdit",pianoOffsetEdit);
e->setConf("pianoView",pianoView);
@ -6835,6 +6837,7 @@ FurnaceGUI::FurnaceGUI():
pianoOptions(true),
pianoSharePosition(false),
pianoOptionsSet(false),
pianoReadonly(false),
pianoOffset(6),
pianoOffsetEdit(9),
pianoView(PIANO_LAYOUT_AUTOMATIC),
@ -6844,6 +6847,7 @@ FurnaceGUI::FurnaceGUI():
pianoOctavesEdit(4),
pianoOptions(false),
pianoSharePosition(true),
pianoReadonly(false),
pianoOffset(6),
pianoOffsetEdit(6),
pianoView(PIANO_LAYOUT_STANDARD),

View file

@ -1916,6 +1916,7 @@ class FurnaceGUI {
bool pianoOptions, pianoSharePosition, pianoOptionsSet;
float pianoKeyHit[180];
bool pianoKeyPressed[180];
bool pianoReadonly;
int pianoOffset, pianoOffsetEdit;
int pianoView, pianoInputPadMode;

View file

@ -123,6 +123,7 @@ void FurnaceGUI::drawPiano() {
pianoInputPadMode=PIANO_INPUT_PAD_SPLIT_VISIBLE;
}
ImGui::Checkbox("Share play/edit offset/range",&pianoSharePosition);
ImGui::Checkbox("Read-only (can't input notes)",&pianoReadonly);
ImGui::EndPopup();
}
@ -223,7 +224,7 @@ void FurnaceGUI::drawPiano() {
//ImGui::ItemSize(size,ImGui::GetStyle().FramePadding.y);
if (ImGui::ItemAdd(rect,ImGui::GetID("pianoDisplay"))) {
bool canInput=false;
if (ImGui::ItemHoverable(rect,ImGui::GetID("pianoDisplay"))) {
if (!pianoReadonly && ImGui::ItemHoverable(rect,ImGui::GetID("pianoDisplay"))) {
canInput=true;
ImGui::InhibitInertialScroll();
}