GUI: UNTESTED STUFF

This commit is contained in:
tildearrow 2022-12-08 18:04:18 -05:00
parent 0afd233bfa
commit 8eca858d70
3 changed files with 48 additions and 18 deletions

View file

@ -48,28 +48,56 @@ void FurnaceGUI::drawMobileControls() {
} }
} }
} }
if (dragMobileEditButton) { if (dragMobileEditButton) {
mobileEditButtonPos.x=((ImGui::GetMousePos().x/canvasW)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasW); if (ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>ImGui::GetIO().ConfigInertialScrollToleranceSqr) {
mobileEditButtonPos.y=((ImGui::GetMousePos().y/canvasH)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasH); mobileEditButtonPos.x=((ImGui::GetMousePos().x/canvasW)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasW);
mobileEditButtonPos.y=((ImGui::GetMousePos().y/canvasH)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasH);
}
} }
if (mobileEditButtonPos.x<0) mobileEditButtonPos.x=0; if (mobileEditButtonPos.x<0) mobileEditButtonPos.x=0;
if (mobileEditButtonPos.x>1) mobileEditButtonPos.x=1; if (mobileEditButtonPos.x>1) mobileEditButtonPos.x=1;
if (mobileEditButtonPos.y<0) mobileEditButtonPos.y=0; if (mobileEditButtonPos.y<0) mobileEditButtonPos.y=0;
if (mobileEditButtonPos.y>1) mobileEditButtonPos.y=1; if (mobileEditButtonPos.y>1) mobileEditButtonPos.y=1;
ImGui::SetNextWindowPos(ImVec2(mobileEditButtonPos.x*canvasW, mobileEditButtonPos.y*canvasH));
ImGui::SetNextWindowSize(portrait?ImVec2(0.16*canvasW,0.16*canvasW):ImVec2(0.16*canvasH,0.16*canvasH)); if (mobileEdit) {
if (ImGui::Begin("MobileEdit",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoBackground|ImGuiWindowFlags_NoDecoration|globalWinFlags)) { mobileEditAnim+=ImGui::GetIO().DeltaTime*2.0;
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x; if (mobileEditAnim>1.0f) mobileEditAnim=1.0f;
mobileEditButtonSize=ImVec2(avail,avail); } else {
if (ImGui::Button("Edit", mobileEditButtonSize)) { mobileEditAnim-=ImGui::GetIO().DeltaTime*2.0;
//click if (mobileEditAnim<0.0f) mobileEditAnim=0.0f;
}
if (mobileEditAnim>0.0f) {
ImGui::SetNextWindowPos(ImVec2(0.0f,0.0f));
ImGui::SetNextWindowSize(ImVec2(canvasW,canvasH));
} else {
ImGui::SetNextWindowPos(ImVec2(mobileEditButtonPos.x*canvasW, mobileEditButtonPos.y*canvasH));
ImGui::SetNextWindowSize(portrait?ImVec2(0.16*canvasW,0.16*canvasW):ImVec2(0.16*canvasH,0.16*canvasH));
}
if (ImGui::Begin("MobileEdit",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoTitleBar/*|ImGuiWindowFlags_NoBackground|ImGuiWindowFlags_NoDecoration*/)) {
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && mobileEdit) {
mobileEdit=false;
} }
if (ImGui::IsItemActive()) {
if (CHECK_BUTTON_LONG_HOLD) { if (mobileEditAnim>0.0f) {
//drag ImGui::SetCursorPos(ImVec2(mobileEditButtonPos.x*canvasW,mobileEditButtonPos.y*canvasH));
if (!dragMobileEditButton) dragMobileEditButton=!dragMobileEditButton; } else {
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x;
mobileEditButtonSize=ImVec2(avail,avail);
}
if (ImGui::Button("Edit",mobileEditButtonSize)) {
// click
if (ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]<=ImGui::GetIO().ConfigInertialScrollToleranceSqr) {
mobileEdit=true;
} }
} }
if (ImGui::IsItemClicked() && !mobileEdit) {
dragMobileEditButton=true;
}
} }
ImGui::End(); ImGui::End();

View file

@ -5659,6 +5659,7 @@ FurnaceGUI::FurnaceGUI():
pendingInsSingle(false), pendingInsSingle(false),
displayPendingRawSample(false), displayPendingRawSample(false),
snesFilterHex(false), snesFilterHex(false),
mobileEdit(false),
vgmExportVersion(0x171), vgmExportVersion(0x171),
drawHalt(10), drawHalt(10),
zsmExportTickRate(60), zsmExportTickRate(60),
@ -5667,8 +5668,9 @@ FurnaceGUI::FurnaceGUI():
displayInsTypeListMakeInsSample(-1), displayInsTypeListMakeInsSample(-1),
mobileMenuPos(0.0f), mobileMenuPos(0.0f),
autoButtonSize(0.0f), autoButtonSize(0.0f),
mobileEditButtonPos(0.0f,0.0f), mobileEditAnim(0.0f),
mobileEditButtonSize(0.0f,0.0f), mobileEditButtonPos(0.7f,0.7f),
mobileEditButtonSize(60.0f,60.0f),
curSysSection(NULL), curSysSection(NULL),
pendingRawSampleDepth(8), pendingRawSampleDepth(8),
pendingRawSampleChannels(1), pendingRawSampleChannels(1),

View file

@ -1088,6 +1088,7 @@ class FurnaceGUI {
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu; bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly; bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex; bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex;
bool mobileEdit;
bool willExport[32]; bool willExport[32];
int vgmExportVersion; int vgmExportVersion;
int drawHalt; int drawHalt;
@ -1095,9 +1096,8 @@ class FurnaceGUI {
int macroPointSize; int macroPointSize;
int waveEditStyle; int waveEditStyle;
int displayInsTypeListMakeInsSample; int displayInsTypeListMakeInsSample;
float mobileMenuPos, autoButtonSize; float mobileMenuPos, autoButtonSize, mobileEditAnim;
ImVec2 mobileEditButtonPos; ImVec2 mobileEditButtonPos, mobileEditButtonSize;
ImVec2 mobileEditButtonSize;
const int* curSysSection; const int* curSysSection;
DivInstrumentFM opllPreview; DivInstrumentFM opllPreview;