Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt

This commit is contained in:
cam900 2022-12-04 16:53:54 +09:00
commit 2ec35d903f
264 changed files with 836 additions and 166 deletions

View file

@ -1,25 +1,41 @@
package org.tildearrow.furnace; package org.tildearrow.furnace;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;
import org.libsdl.app.SDLActivity; import org.libsdl.app.SDLActivity;
public class MainActivity extends SDLActivity { public class MainActivity extends SDLActivity {
static final int TA_FILE_REQUEST=1000; static final int TA_FILE_REQUEST=1000;
static final int TA_FILE_SAVE_REQUEST=1001;
public boolean showFileDialog() { public void showFileDialog() {
Intent picker=new Intent(Intent.ACTION_GET_CONTENT); Intent picker=new Intent(Intent.ACTION_GET_CONTENT);
picker.setType("*/*"); picker.setType("*/*");
picker=Intent.createChooser(picker,"test"); picker=Intent.createChooser(picker,"test");
startActivityForResult(picker,TA_FILE_REQUEST); startActivityForResult(picker,TA_FILE_REQUEST);
}
return true; public void showSaveFileDialog() {
Intent picker=new Intent(Intent.ACTION_CREATE_DOCUMENT);
picker.addCategory(Intent.CATEGORY_OPENABLE);
picker.setType("*/*");
startActivityForResult(picker,TA_FILE_SAVE_REQUEST);
} }
@Override protected void onActivityResult(int request, int result, Intent intent) { @Override protected void onActivityResult(int request, int result, Intent intent) {
super.onActivityResult(request,result,intent); super.onActivityResult(request,result,intent);
if (request==TA_FILE_REQUEST) { if (request==TA_FILE_REQUEST) {
// TODO: fire an event here if (result==RESULT_OK) {
Uri path=intent.getData();
Context context=getApplicationContext();
Toast toast=Toast.makeText(context,path.toString(),Toast.LENGTH_SHORT);
toast.show();
}
} }
} }
} }

Binary file not shown.

BIN
demos/Swaggin_Dragon.dmf Normal file

Binary file not shown.

Binary file not shown.

View file

@ -74,11 +74,14 @@ SOFTWARE.
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif // IMGUI_DEFINE_MATH_OPERATORS #endif // IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_internal.h" #include "imgui_internal.h"
#include <IconsFontAwesome4.h>
#include <cstdlib> #include <cstdlib>
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#define DOUBLE_CLICKED ((singleClickSel && ImGui::IsMouseReleased(0)) || (!singleClickSel && ImGui::IsMouseDoubleClicked(0)))
#ifdef USE_THUMBNAILS #ifdef USE_THUMBNAILS
#ifndef DONT_DEFINE_AGAIN__STB_IMAGE_IMPLEMENTATION #ifndef DONT_DEFINE_AGAIN__STB_IMAGE_IMPLEMENTATION
#ifndef STB_IMAGE_IMPLEMENTATION #ifndef STB_IMAGE_IMPLEMENTATION
@ -117,7 +120,7 @@ namespace IGFD
#endif // IMGUI_BUTTON #endif // IMGUI_BUTTON
// locales // locales
#ifndef createDirButtonString #ifndef createDirButtonString
#define createDirButtonString "+" #define createDirButtonString ICON_FA_PLUS
#endif // createDirButtonString #endif // createDirButtonString
#ifndef okButtonString #ifndef okButtonString
#define okButtonString "OK" #define okButtonString "OK"
@ -126,13 +129,13 @@ namespace IGFD
#define cancelButtonString "Cancel" #define cancelButtonString "Cancel"
#endif // cancelButtonString #endif // cancelButtonString
#ifndef resetButtonString #ifndef resetButtonString
#define resetButtonString "R" #define resetButtonString ICON_FA_REPEAT
#endif // resetButtonString #endif // resetButtonString
#ifndef drivesButtonString #ifndef drivesButtonString
#define drivesButtonString "Drives" #define drivesButtonString "Drives"
#endif // drivesButtonString #endif // drivesButtonString
#ifndef editPathButtonString #ifndef editPathButtonString
#define editPathButtonString "E" #define editPathButtonString ICON_FA_PENCIL
#endif // editPathButtonString #endif // editPathButtonString
#ifndef searchString #ifndef searchString
#define searchString "Search" #define searchString "Search"
@ -147,10 +150,10 @@ namespace IGFD
#define fileEntryString "[File]" #define fileEntryString "[File]"
#endif // fileEntryString #endif // fileEntryString
#ifndef fileNameString #ifndef fileNameString
#define fileNameString "File Name:" #define fileNameString "Name:"
#endif // fileNameString #endif // fileNameString
#ifndef dirNameString #ifndef dirNameString
#define dirNameString "Directory Path:" #define dirNameString "Path:"
#endif // dirNameString #endif // dirNameString
#ifndef buttonResetSearchString #ifndef buttonResetSearchString
#define buttonResetSearchString "Reset search" #define buttonResetSearchString "Reset search"
@ -3319,7 +3322,7 @@ namespace IGFD
//// FILE DIALOG CONSTRUCTOR / DESTRUCTOR /////////////////////////////////////////// //// FILE DIALOG CONSTRUCTOR / DESTRUCTOR ///////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
IGFD::FileDialog::FileDialog() : BookMarkFeature(), KeyExplorerFeature(), ThumbnailFeature() {DpiScale=1.0f;} IGFD::FileDialog::FileDialog() : BookMarkFeature(), KeyExplorerFeature(), ThumbnailFeature() {DpiScale=1.0f; singleClickSel=false; mobileMode=false;}
IGFD::FileDialog::~FileDialog() = default; IGFD::FileDialog::~FileDialog() = default;
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
@ -3936,7 +3939,7 @@ namespace IGFD
vsnprintf(fdi.puVariadicBuffer, MAX_FILE_DIALOG_NAME_BUFFER, vFmt, args); vsnprintf(fdi.puVariadicBuffer, MAX_FILE_DIALOG_NAME_BUFFER, vFmt, args);
va_end(args); va_end(args);
float h = 0.0f; float h = /*mobileMode?(ImGui::GetFontSize()+10.0f*DpiScale):*/0.0f;
#ifdef USE_THUMBNAILS #ifdef USE_THUMBNAILS
if (prDisplayMode == DisplayModeEnum::THUMBNAILS_LIST) if (prDisplayMode == DisplayModeEnum::THUMBNAILS_LIST)
h = DisplayMode_ThumbailsList_ImageHeight; h = DisplayMode_ThumbailsList_ImageHeight;
@ -3972,7 +3975,7 @@ namespace IGFD
} }
else // no nav system => classic behavior else // no nav system => classic behavior
{ {
if (ImGui::IsMouseDoubleClicked(0)) // 0 -> left mouse button double click if (DOUBLE_CLICKED) // 0 -> left mouse button double click
{ {
isSelectingDir=true; isSelectingDir=true;
fdi.puPathClicked = fdi.SelectDirectory(vInfos); fdi.puPathClicked = fdi.SelectDirectory(vInfos);
@ -3987,7 +3990,7 @@ namespace IGFD
} }
else else
{ {
if (ImGui::IsMouseDoubleClicked(0)) { if (DOUBLE_CLICKED) {
fdi.SelectFileName(prFileDialogInternal, vInfos); fdi.SelectFileName(prFileDialogInternal, vInfos);
prFileDialogInternal.puIsOk = true; prFileDialogInternal.puIsOk = true;
return 2; return 2;

View file

@ -1142,6 +1142,8 @@ namespace IGFD
public: public:
bool puAnyWindowsHovered = false; // not remember why haha :) todo : to check if we can remove bool puAnyWindowsHovered = false; // not remember why haha :) todo : to check if we can remove
double DpiScale; double DpiScale;
bool singleClickSel;
bool mobileMode;
public: public:
static FileDialog* Instance() // Singleton for easier accces form anywhere but only one dialog at a time static FileDialog* Instance() // Singleton for easier accces form anywhere but only one dialog at a time

View file

@ -1178,6 +1178,9 @@ ImGuiIO::ImGuiIO()
ConfigViewportsNoDecoration = true; ConfigViewportsNoDecoration = true;
ConfigViewportsNoDefaultParent = false; ConfigViewportsNoDefaultParent = false;
// Inertial scrolling options (when ImGuiConfigFlags_InertialScrollEnable is set)
ConfigInertialScrollToleranceSqr = 36.0f;
// Miscellaneous options // Miscellaneous options
MouseDrawCursor = false; MouseDrawCursor = false;
#ifdef __APPLE__ #ifdef __APPLE__
@ -3313,6 +3316,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) : DrawListInst
TabId = GetID("#TAB"); TabId = GetID("#TAB");
ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);
ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f); ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);
InertialScrollSpeed = ImVec2(0.0f, 0.0f);
AutoFitFramesX = AutoFitFramesY = -1; AutoFitFramesX = AutoFitFramesY = -1;
AutoPosLastDirection = ImGuiDir_None; AutoPosLastDirection = ImGuiDir_None;
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = SetWindowDockAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = SetWindowDockAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing;
@ -3443,6 +3447,10 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
{ {
g.ActiveIdIsAlive = id; g.ActiveIdIsAlive = id;
g.ActiveIdSource = (g.NavActivateId == id || g.NavActivateInputId == id || g.NavJustMovedToId == id) ? (ImGuiInputSource)ImGuiInputSource_Nav : ImGuiInputSource_Mouse; g.ActiveIdSource = (g.NavActivateId == id || g.NavActivateInputId == id || g.NavJustMovedToId == id) ? (ImGuiInputSource)ImGuiInputSource_Nav : ImGuiInputSource_Mouse;
// TODO: check whether this works
if (g.LastItemData.InFlags & ImGuiItemFlags_NoInertialScroll) {
g.InertialScrollInhibited=true;
}
} }
// Clear declaration of inputs claimed by the widget // Clear declaration of inputs claimed by the widget
@ -3536,6 +3544,8 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
return false; return false;
if (!IsItemFocused()) if (!IsItemFocused())
return false; return false;
if (window->InertialScroll)
return false;
} }
else else
{ {
@ -3569,6 +3579,10 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled)) if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
return false; return false;
// Test for inertial scroll
if (window->InertialScroll)
return false;
// Special handling for calling after Begin() which represent the title bar or tab. // Special handling for calling after Begin() which represent the title bar or tab.
// When the window is skipped/collapsed (SkipItems==true) that last item (always ->MoveId submitted by Begin) // When the window is skipped/collapsed (SkipItems==true) that last item (always ->MoveId submitted by Begin)
// will never be overwritten so we need to detect the case. // will never be overwritten so we need to detect the case.
@ -3605,8 +3619,9 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
SetHoveredID(id); SetHoveredID(id);
// When disabled we'll return false but still set HoveredId // When disabled we'll return false but still set HoveredId
// Same thing if swiping
ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags); ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags);
if (item_flags & ImGuiItemFlags_Disabled) if (item_flags & ImGuiItemFlags_Disabled || window->InertialScroll)
{ {
// Release active id if turning disabled // Release active id if turning disabled
if (g.ActiveId == id) if (g.ActiveId == id)
@ -4156,6 +4171,8 @@ static void ImGui::UpdateMouseInputs()
if (IsMousePosValid(&io.MousePos)) if (IsMousePosValid(&io.MousePos))
io.MousePos = g.MouseLastValidPos = ImFloorSigned(io.MousePos); io.MousePos = g.MouseLastValidPos = ImFloorSigned(io.MousePos);
io.MouseDeltaPrev=io.MouseDelta;
// If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta
if (IsMousePosValid(&io.MousePos) && IsMousePosValid(&io.MousePosPrev)) if (IsMousePosValid(&io.MousePos) && IsMousePosValid(&io.MousePosPrev))
io.MouseDelta = io.MousePos - io.MousePosPrev; io.MouseDelta = io.MousePos - io.MousePosPrev;
@ -4166,6 +4183,18 @@ static void ImGui::UpdateMouseInputs()
if (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f) if (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f)
g.NavDisableMouseHover = false; g.NavDisableMouseHover = false;
// Update mouse speed
if (ImFabs(io.MouseDelta.x)>ImFabs(io.MouseDeltaPrev.x)) {
io.MouseSpeed.x=io.MouseDelta.x;
} else {
io.MouseSpeed.x=io.MouseDeltaPrev.x;
}
if (ImFabs(io.MouseDelta.y)>ImFabs(io.MouseDeltaPrev.y)) {
io.MouseSpeed.y=io.MouseDelta.y;
} else {
io.MouseSpeed.y=io.MouseDeltaPrev.y;
}
io.MousePosPrev = io.MousePos; io.MousePosPrev = io.MousePos;
for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++)
{ {
@ -4435,6 +4464,7 @@ void ImGui::NewFrame()
g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame); g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);
g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame)); g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame));
g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX; g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;
g.IO.IsSomethingHappening = false;
UpdateViewportsNewFrame(); UpdateViewportsNewFrame();
@ -5069,6 +5099,11 @@ void ImGui::EndFrame()
g.DragDropWithinSource = false; g.DragDropWithinSource = false;
} }
// Check for inertial scroll inhibit status
if (!g.IO.MouseDown[ImGuiMouseButton_Left]) {
g.InertialScrollInhibited=false;
}
// End frame // End frame
g.WithinFrameScope = false; g.WithinFrameScope = false;
g.FrameCountEnded = g.FrameCount; g.FrameCountEnded = g.FrameCount;
@ -6893,6 +6928,74 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->ScrollMax.x = ImMax(0.0f, window->ContentSize.x + window->WindowPadding.x * 2.0f - window->InnerRect.GetWidth()); window->ScrollMax.x = ImMax(0.0f, window->ContentSize.x + window->WindowPadding.x * 2.0f - window->InnerRect.GetWidth());
window->ScrollMax.y = ImMax(0.0f, window->ContentSize.y + window->WindowPadding.y * 2.0f - window->InnerRect.GetHeight()); window->ScrollMax.y = ImMax(0.0f, window->ContentSize.y + window->WindowPadding.y * 2.0f - window->InnerRect.GetHeight());
// Inertial scroll
if (g.IO.ConfigFlags & ImGuiConfigFlags_InertialScrollEnable) {
if ((g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow) == window) {
if ((g.IO.MouseDown[ImGuiMouseButton_Left] || g.IO.MouseReleased[ImGuiMouseButton_Left]) &&
g.ActiveId!=GetWindowScrollbarID(window,ImGuiAxis_X) &&
g.ActiveId!=GetWindowScrollbarID(window,ImGuiAxis_Y) &&
!g.InertialScrollInhibited) {
// launch inertial scroll
if (g.IO.MouseClicked[ImGuiMouseButton_Left]) {
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
window->InertialScroll=false;
g.InertialScroll=false;
g.WasInertialScroll=false;
} else {
if (g.IO.MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>g.IO.ConfigInertialScrollToleranceSqr) {
if (g.IO.MouseReleased[ImGuiMouseButton_Left]) {
window->InertialScrollSpeed=ImVec2(window->ScrollbarX?-g.IO.MouseSpeed.x:0.0f,window->ScrollbarY?-g.IO.MouseSpeed.y:0.0f);
window->InertialScroll=false;
g.InertialScroll=false;
} else {
window->InertialScrollSpeed=ImVec2(window->ScrollbarX?-g.IO.MouseDelta.x:0.0f,window->ScrollbarY?-g.IO.MouseDelta.y:0.0f);
if (window->ScrollbarX || window->ScrollbarY) {
window->InertialScroll=true;
g.InertialScroll=true;
g.WasInertialScroll=true;
}
}
} else {
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
window->InertialScroll=false;
g.InertialScroll=false;
}
}
} else if (g.InertialScrollInhibited) {
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
window->InertialScroll=false;
g.InertialScroll=false;
}
}
if (window->ScrollTarget.x == FLT_MAX && window->ScrollTarget.y == FLT_MAX) {
if (fabs(window->InertialScrollSpeed.x)>0.1f) {
window->Scroll.x=window->Scroll.x+window->InertialScrollSpeed.x;
window->InertialScrollSpeed.x*=0.95f;
g.IO.IsSomethingHappening = true;
} else {
window->InertialScrollSpeed.x=0.0f;
}
if (fabs(window->InertialScrollSpeed.y)>0.1f) {
window->Scroll.y=window->Scroll.y+window->InertialScrollSpeed.y;
window->InertialScrollSpeed.y*=0.95f;
g.IO.IsSomethingHappening = true;
} else {
window->InertialScrollSpeed.y=0.0f;
}
} else {
window->InertialScrollSpeed.x=0.0f;
window->InertialScrollSpeed.y=0.0f;
window->InertialScroll=false;
g.InertialScroll=false;
}
if (g.IO.MouseDown[ImGuiMouseButton_Left]) {
window->InertialScrollSpeed.x=0.0f;
window->InertialScrollSpeed.y=0.0f;
}
}
// Apply scrolling // Apply scrolling
window->Scroll = CalcNextScrollFromScrollTargetAndClamp(window); window->Scroll = CalcNextScrollFromScrollTargetAndClamp(window);
window->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); window->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);
@ -7455,6 +7558,35 @@ 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;
*/
ImGuiContext& g = *GImGui;
return g.InertialScroll;
}
// WasInertialScroll()
bool ImGui::WasInertialScroll()
{
ImGuiContext& g = *GImGui;
return g.WasInertialScroll;
}
// InhibitInertialScroll()
void ImGui::InhibitInertialScroll()
{
ImGuiContext& g = *GImGui;
g.InertialScrollInhibited=true;
}
// FIXME: Look into renaming this once we have settled the new Focus/Activation/TabStop system. // FIXME: Look into renaming this once we have settled the new Focus/Activation/TabStop system.
void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus) void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus)
{ {
@ -18612,8 +18744,9 @@ void ImGui::DebugNodeWindow(ImGuiWindow* window, const char* label)
(flags & ImGuiWindowFlags_NoMouseInputs)? "NoMouseInputs":"", (flags & ImGuiWindowFlags_NoNavInputs) ? "NoNavInputs" : "", (flags & ImGuiWindowFlags_AlwaysAutoResize) ? "AlwaysAutoResize" : ""); (flags & ImGuiWindowFlags_NoMouseInputs)? "NoMouseInputs":"", (flags & ImGuiWindowFlags_NoNavInputs) ? "NoNavInputs" : "", (flags & ImGuiWindowFlags_AlwaysAutoResize) ? "AlwaysAutoResize" : "");
BulletText("WindowClassId: 0x%08X", window->WindowClass.ClassId); BulletText("WindowClassId: 0x%08X", window->WindowClass.ClassId);
BulletText("Scroll: (%.2f/%.2f,%.2f/%.2f) Scrollbar:%s%s", window->Scroll.x, window->ScrollMax.x, window->Scroll.y, window->ScrollMax.y, window->ScrollbarX ? "X" : "", window->ScrollbarY ? "Y" : ""); BulletText("Scroll: (%.2f/%.2f,%.2f/%.2f) Scrollbar:%s%s", window->Scroll.x, window->ScrollMax.x, window->Scroll.y, window->ScrollMax.y, window->ScrollbarX ? "X" : "", window->ScrollbarY ? "Y" : "");
BulletText("InertialScrollSpeed: %.2f,%.2f",window->InertialScrollSpeed.x,window->InertialScrollSpeed.y);
BulletText("Active: %d/%d, WriteAccessed: %d, BeginOrderWithinContext: %d", window->Active, window->WasActive, window->WriteAccessed, (window->Active || window->WasActive) ? window->BeginOrderWithinContext : -1); BulletText("Active: %d/%d, WriteAccessed: %d, BeginOrderWithinContext: %d", window->Active, window->WasActive, window->WriteAccessed, (window->Active || window->WasActive) ? window->BeginOrderWithinContext : -1);
BulletText("Appearing: %d, Hidden: %d (CanSkip %d Cannot %d), SkipItems: %d", window->Appearing, window->Hidden, window->HiddenFramesCanSkipItems, window->HiddenFramesCannotSkipItems, window->SkipItems); BulletText("Appearing: %d, Hidden: %d (CanSkip %d Cannot %d), SkipItems: %d, InertialScroll: %d", window->Appearing, window->Hidden, window->HiddenFramesCanSkipItems, window->HiddenFramesCannotSkipItems, window->SkipItems, window->InertialScroll);
for (int layer = 0; layer < ImGuiNavLayer_COUNT; layer++) for (int layer = 0; layer < ImGuiNavLayer_COUNT; layer++)
{ {
ImRect r = window->NavRectRel[layer]; ImRect r = window->NavRectRel[layer];

View file

@ -838,6 +838,11 @@ namespace ImGui
IMGUI_API void BeginDisabled(bool disabled = true); IMGUI_API void BeginDisabled(bool disabled = true);
IMGUI_API void EndDisabled(); IMGUI_API void EndDisabled();
// Inertial scroll
IMGUI_API bool IsInertialScroll();
IMGUI_API bool WasInertialScroll();
IMGUI_API void InhibitInertialScroll();
// Clipping // Clipping
// - Mouse hovering is affected by ImGui::PushClipRect() calls, unlike direct calls to ImDrawList::PushClipRect() which are render only. // - Mouse hovering is affected by ImGui::PushClipRect() calls, unlike direct calls to ImDrawList::PushClipRect() which are render only.
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect); IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);
@ -1573,6 +1578,10 @@ enum ImGuiConfigFlags_
// [BETA] Docking // [BETA] Docking
ImGuiConfigFlags_DockingEnable = 1 << 6, // Docking enable flags. ImGuiConfigFlags_DockingEnable = 1 << 6, // Docking enable flags.
// [CUSTOM] Inertial scroll
ImGuiConfigFlags_InertialScrollEnable = 1 << 7, // Docking enable flags.
ImGuiConfigFlags_NoHoverColors = 1 << 8, // Disable all "hovered" color changes (useful for mobile).
// [BETA] Viewports // [BETA] Viewports
// When using viewports it is recommended that your default value for ImGuiCol_WindowBg is opaque (Alpha=1.0) so transition to a viewport won't be noticeable. // When using viewports it is recommended that your default value for ImGuiCol_WindowBg is opaque (Alpha=1.0) so transition to a viewport won't be noticeable.
ImGuiConfigFlags_ViewportsEnable = 1 << 10, // Viewport enable flags (require both ImGuiBackendFlags_PlatformHasViewports + ImGuiBackendFlags_RendererHasViewports set by the respective backends) ImGuiConfigFlags_ViewportsEnable = 1 << 10, // Viewport enable flags (require both ImGuiBackendFlags_PlatformHasViewports + ImGuiBackendFlags_RendererHasViewports set by the respective backends)
@ -2019,6 +2028,9 @@ struct ImGuiIO
bool ConfigViewportsNoDecoration; // = true // Disable default OS window decoration flag for secondary viewports. When a viewport doesn't want window decorations, ImGuiViewportFlags_NoDecoration will be set on it. Enabling decoration can create subsequent issues at OS levels (e.g. minimum window size). bool ConfigViewportsNoDecoration; // = true // Disable default OS window decoration flag for secondary viewports. When a viewport doesn't want window decorations, ImGuiViewportFlags_NoDecoration will be set on it. Enabling decoration can create subsequent issues at OS levels (e.g. minimum window size).
bool ConfigViewportsNoDefaultParent; // = false // Disable default OS parenting to main viewport for secondary viewports. By default, viewports are marked with ParentViewportId = <main_viewport>, expecting the platform backend to setup a parent/child relationship between the OS windows (some backend may ignore this). Set to true if you want the default to be 0, then all viewports will be top-level OS windows. bool ConfigViewportsNoDefaultParent; // = false // Disable default OS parenting to main viewport for secondary viewports. By default, viewports are marked with ParentViewportId = <main_viewport>, expecting the platform backend to setup a parent/child relationship between the OS windows (some backend may ignore this). Set to true if you want the default to be 0, then all viewports will be top-level OS windows.
// Inertial scrolling options (when ImGuiConfigFlags_InertialScrollEnable is set)
float ConfigInertialScrollToleranceSqr;// = 36.0f // After a point moves past this distance, inertial scroll begins
// Miscellaneous options // Miscellaneous options
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations. bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl. bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl.
@ -2087,6 +2099,7 @@ struct ImGuiIO
bool WantTextInput; // Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active). bool WantTextInput; // Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active).
bool WantSetMousePos; // MousePos has been altered, backend should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled. bool WantSetMousePos; // MousePos has been altered, backend should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled.
bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving! bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving!
bool IsSomethingHappening; // This is set to true when inertial scrolling is happening.
bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.
bool NavVisible; // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events). bool NavVisible; // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events).
float Framerate; // Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames. float Framerate; // Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames.
@ -2096,6 +2109,8 @@ struct ImGuiIO
int MetricsActiveWindows; // Number of active windows int MetricsActiveWindows; // Number of active windows
int MetricsActiveAllocations; // Number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts. int MetricsActiveAllocations; // Number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts.
ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.
ImVec2 MouseDeltaPrev; // Previous mouse delta.
ImVec2 MouseSpeed; // Average mouse speed in a short timeframe. Used for inertial scroll.
// Legacy: before 1.87, we required backend to fill io.KeyMap[] (imgui->native map) during initialization and io.KeysDown[] (native indices) every frame. // Legacy: before 1.87, we required backend to fill io.KeyMap[] (imgui->native map) during initialization and io.KeysDown[] (native indices) every frame.
// This is still temporarily supported as a legacy feature. However the new preferred scheme is for backend to call io.AddKeyEvent(). // This is still temporarily supported as a legacy feature. However the new preferred scheme is for backend to call io.AddKeyEvent().

View file

@ -815,7 +815,8 @@ enum ImGuiItemFlags_
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets) ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
ImGuiItemFlags_ReadOnly = 1 << 7, // false // [ALPHA] Allow hovering interactions but underlying value is not changed. ImGuiItemFlags_ReadOnly = 1 << 7, // false // [ALPHA] Allow hovering interactions but underlying value is not changed.
ImGuiItemFlags_Inputable = 1 << 8 // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature. ImGuiItemFlags_Inputable = 1 << 8, // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
ImGuiItemFlags_NoInertialScroll = 1 << 9 // false // Disable inertial scroll when activated
}; };
// Storage for LastItem data // Storage for LastItem data
@ -1935,6 +1936,11 @@ struct ImGuiContext
float NavWindowingHighlightAlpha; float NavWindowingHighlightAlpha;
bool NavWindowingToggleLayer; bool NavWindowingToggleLayer;
// Inertial scroll
bool InertialScrollInhibited; // Is inertial scroll inhibited? (e.g. by ImGuiItemFlags_NoInertialScroll)
bool InertialScroll; // Is any window being scrolled?
bool WasInertialScroll; // Was ^?
// Render // Render
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list) float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
ImGuiMouseCursor MouseCursor; ImGuiMouseCursor MouseCursor;
@ -2144,6 +2150,8 @@ struct ImGuiContext
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f; NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
NavWindowingToggleLayer = false; NavWindowingToggleLayer = false;
InertialScrollInhibited = false;
DimBgRatio = 0.0f; DimBgRatio = 0.0f;
MouseCursor = ImGuiMouseCursor_Arrow; MouseCursor = ImGuiMouseCursor_Arrow;
@ -2293,6 +2301,7 @@ struct IMGUI_API ImGuiWindow
ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
ImVec2 ScrollTargetEdgeSnapDist; // 0.0f = no snapping, >0.0f snapping threshold ImVec2 ScrollTargetEdgeSnapDist; // 0.0f = no snapping, >0.0f snapping threshold
ImVec2 ScrollbarSizes; // Size taken by each scrollbars on their smaller axis. Pay attention! ScrollbarSizes.x == width of the vertical scrollbar, ScrollbarSizes.y = height of the horizontal scrollbar. ImVec2 ScrollbarSizes; // Size taken by each scrollbars on their smaller axis. Pay attention! ScrollbarSizes.x == width of the vertical scrollbar, ScrollbarSizes.y = height of the horizontal scrollbar.
ImVec2 InertialScrollSpeed; // current speed of inertial scroll (AKA "swipe")
bool ScrollbarX, ScrollbarY; // Are scrollbars visible? bool ScrollbarX, ScrollbarY; // Are scrollbars visible?
bool ViewportOwned; bool ViewportOwned;
bool Active; // Set to true on Begin(), unless Collapsed bool Active; // Set to true on Begin(), unless Collapsed
@ -2306,6 +2315,7 @@ struct IMGUI_API ImGuiWindow
bool IsFallbackWindow; // Set on the "Debug##Default" window. bool IsFallbackWindow; // Set on the "Debug##Default" window.
bool IsExplicitChild; // Set when passed _ChildWindow, left to false by BeginDocked() bool IsExplicitChild; // Set when passed _ChildWindow, left to false by BeginDocked()
bool HasCloseButton; // Set when the window has a close button (p_open != NULL) bool HasCloseButton; // Set when the window has a close button (p_open != NULL)
bool InertialScroll; // Set when inertial scrolling is active
signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3) signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3)
short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs) short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
short BeginOrderWithinParent; // Begin() order within immediate parent window, if we are a child window. Otherwise 0. short BeginOrderWithinParent; // Begin() order within immediate parent window, if we are a child window. Otherwise 0.

View file

@ -998,7 +998,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
// Render // Render
const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg); const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg);
const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha); const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : (hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);
window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, flags); window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, flags);
ImRect grab_rect; ImRect grab_rect;
if (axis == ImGuiAxis_X) if (axis == ImGuiAxis_X)
@ -2949,7 +2949,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0; const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;
ItemSize(total_bb, style.FramePadding.y); ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemFlags_Inputable : 0)) if (!ItemAdd(total_bb, id, &frame_bb, (temp_input_allowed ? ImGuiItemFlags_Inputable : 0) | ImGuiItemFlags_NoInertialScroll))
return false; return false;
// Default format string when passing NULL // Default format string when passing NULL
@ -3113,7 +3113,7 @@ bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType d
const ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); const ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
ItemSize(bb, style.FramePadding.y); ItemSize(bb, style.FramePadding.y);
if (!ItemAdd(frame_bb, id)) if (!ItemAdd(frame_bb, id, NULL, ImGuiItemFlags_NoInertialScroll))
return false; return false;
// Default format string when passing NULL // Default format string when passing NULL
@ -6329,9 +6329,9 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
// Render // Render
if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld)) if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld))
hovered = true; hovered = true;
if (hovered || selected) if ((hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) || selected)
{ {
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : (hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
RenderFrame(bb.Min, bb.Max, col, false, 0.0f); RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
} }
RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding); RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more