GUI: long hold?
This commit is contained in:
parent
018d8379e6
commit
dc7aec2dc1
|
@ -7552,6 +7552,16 @@ void ImGui::EndDisabled()
|
|||
g.Style.Alpha = g.DisabledAlphaBackup; //PopStyleVar();
|
||||
}
|
||||
|
||||
// IsInertialScroll()
|
||||
|
||||
bool ImGui::IsInertialScroll()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window==NULL) return false;
|
||||
return window->InertialScroll;
|
||||
}
|
||||
|
||||
|
||||
// InhibitInertialScroll()
|
||||
|
||||
void ImGui::InhibitInertialScroll()
|
||||
|
|
|
@ -839,6 +839,7 @@ namespace ImGui
|
|||
IMGUI_API void EndDisabled();
|
||||
|
||||
// Inertial scroll
|
||||
IMGUI_API bool IsInertialScroll();
|
||||
IMGUI_API void InhibitInertialScroll();
|
||||
|
||||
// Clipping
|
||||
|
|
|
@ -5766,6 +5766,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
curWindowLast(GUI_WINDOW_NOTHING),
|
||||
curWindowThreadSafe(GUI_WINDOW_NOTHING),
|
||||
lastPatternWidth(0.0f),
|
||||
longThreshold(0.4f),
|
||||
latchNote(-1),
|
||||
latchIns(-2),
|
||||
latchVol(-1),
|
||||
|
|
|
@ -53,6 +53,11 @@
|
|||
_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()
|
||||
|
||||
// TODO:
|
||||
|
@ -1425,7 +1430,7 @@ class FurnaceGUI {
|
|||
float peak[2];
|
||||
float patChanX[DIV_MAX_CHANS+1];
|
||||
float patChanSlideY[DIV_MAX_CHANS+1];
|
||||
float lastPatternWidth;
|
||||
float lastPatternWidth, longThreshold;
|
||||
String nextDesc;
|
||||
String nextDescName;
|
||||
|
||||
|
|
|
@ -128,6 +128,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
if (ImGui::IsItemClicked()) {
|
||||
startSelection(0,0,i,true);
|
||||
}
|
||||
if (CHECK_LONG_HOLD) {
|
||||
ImGui::InhibitInertialScroll();
|
||||
NOTIFY_LONG_HOLD;
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
// for each column
|
||||
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)) {
|
||||
updateSelection(j,0,i);
|
||||
}
|
||||
if (CHECK_LONG_HOLD) {
|
||||
ImGui::InhibitInertialScroll();
|
||||
NOTIFY_LONG_HOLD;
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
// 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)) {
|
||||
updateSelection(j,1,i);
|
||||
}
|
||||
if (CHECK_LONG_HOLD) {
|
||||
ImGui::InhibitInertialScroll();
|
||||
NOTIFY_LONG_HOLD;
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
|
@ -252,6 +264,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||
updateSelection(j,2,i);
|
||||
}
|
||||
if (CHECK_LONG_HOLD) {
|
||||
ImGui::InhibitInertialScroll();
|
||||
NOTIFY_LONG_HOLD;
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
|
@ -297,6 +313,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||
updateSelection(j,index-1,i);
|
||||
}
|
||||
if (CHECK_LONG_HOLD) {
|
||||
ImGui::InhibitInertialScroll();
|
||||
NOTIFY_LONG_HOLD;
|
||||
}
|
||||
|
||||
// effect value
|
||||
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)) {
|
||||
updateSelection(j,index,i);
|
||||
}
|
||||
if (CHECK_LONG_HOLD) {
|
||||
ImGui::InhibitInertialScroll();
|
||||
NOTIFY_LONG_HOLD;
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue