GUI: long hold?
This commit is contained in:
parent
018d8379e6
commit
dc7aec2dc1
10
extern/imgui_patched/imgui.cpp
vendored
10
extern/imgui_patched/imgui.cpp
vendored
|
@ -7552,6 +7552,16 @@ void ImGui::EndDisabled()
|
||||||
g.Style.Alpha = g.DisabledAlphaBackup; //PopStyleVar();
|
g.Style.Alpha = g.DisabledAlphaBackup; //PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsInertialScroll()
|
||||||
|
|
||||||
|
bool ImGui::IsInertialScroll()
|
||||||
|
{
|
||||||
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
|
if (window==NULL) return false;
|
||||||
|
return window->InertialScroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// InhibitInertialScroll()
|
// InhibitInertialScroll()
|
||||||
|
|
||||||
void ImGui::InhibitInertialScroll()
|
void ImGui::InhibitInertialScroll()
|
||||||
|
|
1
extern/imgui_patched/imgui.h
vendored
1
extern/imgui_patched/imgui.h
vendored
|
@ -839,6 +839,7 @@ namespace ImGui
|
||||||
IMGUI_API void EndDisabled();
|
IMGUI_API void EndDisabled();
|
||||||
|
|
||||||
// Inertial scroll
|
// Inertial scroll
|
||||||
|
IMGUI_API bool IsInertialScroll();
|
||||||
IMGUI_API void InhibitInertialScroll();
|
IMGUI_API void InhibitInertialScroll();
|
||||||
|
|
||||||
// Clipping
|
// Clipping
|
||||||
|
|
|
@ -5766,6 +5766,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
curWindowLast(GUI_WINDOW_NOTHING),
|
curWindowLast(GUI_WINDOW_NOTHING),
|
||||||
curWindowThreadSafe(GUI_WINDOW_NOTHING),
|
curWindowThreadSafe(GUI_WINDOW_NOTHING),
|
||||||
lastPatternWidth(0.0f),
|
lastPatternWidth(0.0f),
|
||||||
|
longThreshold(0.4f),
|
||||||
latchNote(-1),
|
latchNote(-1),
|
||||||
latchIns(-2),
|
latchIns(-2),
|
||||||
latchVol(-1),
|
latchVol(-1),
|
||||||
|
|
|
@ -53,6 +53,11 @@
|
||||||
_wi->std.waveMacro.vScroll=-1; \
|
_wi->std.waveMacro.vScroll=-1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CHECK_LONG_HOLD (mobileUI && ImGui::GetIO().MouseDown[ImGuiMouseButton_Left] && ImGui::GetIO().MouseDownDuration[ImGuiMouseButton_Left]>longThreshold && !ImGui::IsInertialScroll())
|
||||||
|
|
||||||
|
// for now
|
||||||
|
#define NOTIFY_LONG_HOLD logV("long hold");
|
||||||
|
|
||||||
#define BIND_FOR(x) getKeyName(actionKeys[x],true).c_str()
|
#define BIND_FOR(x) getKeyName(actionKeys[x],true).c_str()
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
|
@ -1425,7 +1430,7 @@ class FurnaceGUI {
|
||||||
float peak[2];
|
float peak[2];
|
||||||
float patChanX[DIV_MAX_CHANS+1];
|
float patChanX[DIV_MAX_CHANS+1];
|
||||||
float patChanSlideY[DIV_MAX_CHANS+1];
|
float patChanSlideY[DIV_MAX_CHANS+1];
|
||||||
float lastPatternWidth;
|
float lastPatternWidth, longThreshold;
|
||||||
String nextDesc;
|
String nextDesc;
|
||||||
String nextDescName;
|
String nextDescName;
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
||||||
if (ImGui::IsItemClicked()) {
|
if (ImGui::IsItemClicked()) {
|
||||||
startSelection(0,0,i,true);
|
startSelection(0,0,i,true);
|
||||||
}
|
}
|
||||||
|
if (CHECK_LONG_HOLD) {
|
||||||
|
ImGui::InhibitInertialScroll();
|
||||||
|
NOTIFY_LONG_HOLD;
|
||||||
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
// for each column
|
// for each column
|
||||||
for (int j=0; j<chans; j++) {
|
for (int j=0; j<chans; j++) {
|
||||||
|
@ -178,6 +182,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||||
updateSelection(j,0,i);
|
updateSelection(j,0,i);
|
||||||
}
|
}
|
||||||
|
if (CHECK_LONG_HOLD) {
|
||||||
|
ImGui::InhibitInertialScroll();
|
||||||
|
NOTIFY_LONG_HOLD;
|
||||||
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
// the following is only visible when the channel is not collapsed
|
// the following is only visible when the channel is not collapsed
|
||||||
|
@ -218,6 +226,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||||
updateSelection(j,1,i);
|
updateSelection(j,1,i);
|
||||||
}
|
}
|
||||||
|
if (CHECK_LONG_HOLD) {
|
||||||
|
ImGui::InhibitInertialScroll();
|
||||||
|
NOTIFY_LONG_HOLD;
|
||||||
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +264,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||||
updateSelection(j,2,i);
|
updateSelection(j,2,i);
|
||||||
}
|
}
|
||||||
|
if (CHECK_LONG_HOLD) {
|
||||||
|
ImGui::InhibitInertialScroll();
|
||||||
|
NOTIFY_LONG_HOLD;
|
||||||
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,6 +313,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||||
updateSelection(j,index-1,i);
|
updateSelection(j,index-1,i);
|
||||||
}
|
}
|
||||||
|
if (CHECK_LONG_HOLD) {
|
||||||
|
ImGui::InhibitInertialScroll();
|
||||||
|
NOTIFY_LONG_HOLD;
|
||||||
|
}
|
||||||
|
|
||||||
// effect value
|
// effect value
|
||||||
if (pat->data[i][index+1]==-1) {
|
if (pat->data[i][index+1]==-1) {
|
||||||
|
@ -323,6 +343,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||||
updateSelection(j,index,i);
|
updateSelection(j,index,i);
|
||||||
}
|
}
|
||||||
|
if (CHECK_LONG_HOLD) {
|
||||||
|
ImGui::InhibitInertialScroll();
|
||||||
|
NOTIFY_LONG_HOLD;
|
||||||
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue