mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-01 01:34:57 +08:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_glfw.cpp # backends/imgui_impl_sdl2.cpp # backends/imgui_impl_sdl3.cpp # backends/imgui_impl_win32.cpp
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2025-03-10: Map GLFW_KEY_WORLD_1 and GLFW_KEY_WORLD_2 into ImGuiKey_Oem102.
|
||||||
// 2025-03-03: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled with asserts enabled.
|
// 2025-03-03: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled with asserts enabled.
|
||||||
// 2025-02-21: [Docking] Update monitors and work areas information every frame, as the later may change regardless of monitor changes. (#8415)
|
// 2025-02-21: [Docking] Update monitors and work areas information every frame, as the later may change regardless of monitor changes. (#8415)
|
||||||
// 2024-11-05: [Docking] Added Linux workaround for spurious mouse up events emitted while dragging and creating new viewport. (#3158, #7733, #7922)
|
// 2024-11-05: [Docking] Added Linux workaround for spurious mouse up events emitted while dragging and creating new viewport. (#3158, #7733, #7922)
|
||||||
@@ -253,6 +254,8 @@ ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int keycode, int scancode)
|
|||||||
case GLFW_KEY_EQUAL: return ImGuiKey_Equal;
|
case GLFW_KEY_EQUAL: return ImGuiKey_Equal;
|
||||||
case GLFW_KEY_LEFT_BRACKET: return ImGuiKey_LeftBracket;
|
case GLFW_KEY_LEFT_BRACKET: return ImGuiKey_LeftBracket;
|
||||||
case GLFW_KEY_BACKSLASH: return ImGuiKey_Backslash;
|
case GLFW_KEY_BACKSLASH: return ImGuiKey_Backslash;
|
||||||
|
case GLFW_KEY_WORLD_1: return ImGuiKey_Oem102;
|
||||||
|
case GLFW_KEY_WORLD_2: return ImGuiKey_Oem102;
|
||||||
case GLFW_KEY_RIGHT_BRACKET: return ImGuiKey_RightBracket;
|
case GLFW_KEY_RIGHT_BRACKET: return ImGuiKey_RightBracket;
|
||||||
case GLFW_KEY_GRAVE_ACCENT: return ImGuiKey_GraveAccent;
|
case GLFW_KEY_GRAVE_ACCENT: return ImGuiKey_GraveAccent;
|
||||||
case GLFW_KEY_CAPS_LOCK: return ImGuiKey_CapsLock;
|
case GLFW_KEY_CAPS_LOCK: return ImGuiKey_CapsLock;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
// 2021-01-03: OpenGL: Backup, setup and restore GL_STENCIL_TEST state.
|
// 2021-01-03: OpenGL: Backup, setup and restore GL_STENCIL_TEST state.
|
||||||
// 2020-10-23: OpenGL: Backup, setup and restore GL_PRIMITIVE_RESTART state.
|
// 2020-10-23: OpenGL: Backup, setup and restore GL_PRIMITIVE_RESTART state.
|
||||||
// 2020-10-15: OpenGL: Use glGetString(GL_VERSION) instead of glGetIntegerv(GL_MAJOR_VERSION, ...) when the later returns zero (e.g. Desktop GL 2.x)
|
// 2020-10-15: OpenGL: Use glGetString(GL_VERSION) instead of glGetIntegerv(GL_MAJOR_VERSION, ...) when the later returns zero (e.g. Desktop GL 2.x)
|
||||||
// 2020-09-17: OpenGL: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 context which have the defines set by a loader.
|
// 2020-09-17: OpenGL: Fix to avoid compiling/calling glBindSampler() on ES or pre-3.3 context which have the defines set by a loader.
|
||||||
// 2020-07-10: OpenGL: Added support for glad2 OpenGL loader.
|
// 2020-07-10: OpenGL: Added support for glad2 OpenGL loader.
|
||||||
// 2020-05-08: OpenGL: Made default GLSL version 150 (instead of 130) on OSX.
|
// 2020-05-08: OpenGL: Made default GLSL version 150 (instead of 130) on OSX.
|
||||||
// 2020-04-21: OpenGL: Fixed handling of glClipControl(GL_UPPER_LEFT) by inverting projection matrix.
|
// 2020-04-21: OpenGL: Fixed handling of glClipControl(GL_UPPER_LEFT) by inverting projection matrix.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
// 2024-07-02: Update for io.SetPlatformImeDataFn() -> io.PlatformSetImeDataFn() renaming in main library.
|
// 2024-07-02: Update for io.SetPlatformImeDataFn() -> io.PlatformSetImeDataFn() renaming in main library.
|
||||||
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F20 function keys. Stopped mapping F13 into PrintScreen.
|
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F20 function keys. Stopped mapping F13 into PrintScreen.
|
||||||
// 2023-04-09: Inputs: Added support for io.AddMouseSourceEvent() to discriminate ImGuiMouseSource_Mouse/ImGuiMouseSource_Pen.
|
// 2023-04-09: Inputs: Added support for io.AddMouseSourceEvent() to discriminate ImGuiMouseSource_Mouse/ImGuiMouseSource_Pen.
|
||||||
// 2023-02-01: Fixed scroll wheel scaling for devices emitting events with hasPreciseScrollingDeltas==false (e.g. non-Apple mices).
|
// 2023-02-01: Fixed scroll wheel scaling for devices emitting events with hasPreciseScrollingDeltas==false (e.g. non-Apple mice).
|
||||||
// 2022-11-02: Fixed mouse coordinates before clicking the host window.
|
// 2022-11-02: Fixed mouse coordinates before clicking the host window.
|
||||||
// 2022-10-06: Fixed mouse inputs on flipped views.
|
// 2022-10-06: Fixed mouse inputs on flipped views.
|
||||||
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
|
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2025-03-10: When dealing with OEM keys, use scancodes instead of translated keycodes to choose ImGuiKey values. (#7136, #7201, #7206, #7306, #7670, #7672, #8468)
|
||||||
// 2025-02-26: Only start SDL_CaptureMouse() when mouse is being dragged, to mitigate issues with e.g.Linux debuggers not claiming capture back. (#6410, #3650)
|
// 2025-02-26: Only start SDL_CaptureMouse() when mouse is being dragged, to mitigate issues with e.g.Linux debuggers not claiming capture back. (#6410, #3650)
|
||||||
// 2025-02-25: [Docking] Revert to use SDL_GetDisplayBounds() for WorkPos/WorkRect if SDL_GetDisplayUsableBounds() failed.
|
// 2025-02-25: [Docking] Revert to use SDL_GetDisplayBounds() for WorkPos/WorkRect if SDL_GetDisplayUsableBounds() failed.
|
||||||
// 2025-02-24: Avoid calling SDL_GetGlobalMouseState() when mouse is in relative mode.
|
// 2025-02-24: Avoid calling SDL_GetGlobalMouseState() when mouse is in relative mode.
|
||||||
@@ -232,17 +233,17 @@ ImGuiKey ImGui_ImplSDL2_KeyEventToImGuiKey(SDL_Keycode keycode, SDL_Scancode sca
|
|||||||
case SDLK_SPACE: return ImGuiKey_Space;
|
case SDLK_SPACE: return ImGuiKey_Space;
|
||||||
case SDLK_RETURN: return ImGuiKey_Enter;
|
case SDLK_RETURN: return ImGuiKey_Enter;
|
||||||
case SDLK_ESCAPE: return ImGuiKey_Escape;
|
case SDLK_ESCAPE: return ImGuiKey_Escape;
|
||||||
case SDLK_QUOTE: return ImGuiKey_Apostrophe;
|
//case SDLK_QUOTE: return ImGuiKey_Apostrophe;
|
||||||
case SDLK_COMMA: return ImGuiKey_Comma;
|
case SDLK_COMMA: return ImGuiKey_Comma;
|
||||||
case SDLK_MINUS: return ImGuiKey_Minus;
|
//case SDLK_MINUS: return ImGuiKey_Minus;
|
||||||
case SDLK_PERIOD: return ImGuiKey_Period;
|
case SDLK_PERIOD: return ImGuiKey_Period;
|
||||||
case SDLK_SLASH: return ImGuiKey_Slash;
|
//case SDLK_SLASH: return ImGuiKey_Slash;
|
||||||
case SDLK_SEMICOLON: return ImGuiKey_Semicolon;
|
case SDLK_SEMICOLON: return ImGuiKey_Semicolon;
|
||||||
case SDLK_EQUALS: return ImGuiKey_Equal;
|
//case SDLK_EQUALS: return ImGuiKey_Equal;
|
||||||
case SDLK_LEFTBRACKET: return ImGuiKey_LeftBracket;
|
//case SDLK_LEFTBRACKET: return ImGuiKey_LeftBracket;
|
||||||
case SDLK_BACKSLASH: return ImGuiKey_Backslash;
|
//case SDLK_BACKSLASH: return ImGuiKey_Backslash;
|
||||||
case SDLK_RIGHTBRACKET: return ImGuiKey_RightBracket;
|
//case SDLK_RIGHTBRACKET: return ImGuiKey_RightBracket;
|
||||||
case SDLK_BACKQUOTE: return ImGuiKey_GraveAccent;
|
//case SDLK_BACKQUOTE: return ImGuiKey_GraveAccent;
|
||||||
case SDLK_CAPSLOCK: return ImGuiKey_CapsLock;
|
case SDLK_CAPSLOCK: return ImGuiKey_CapsLock;
|
||||||
case SDLK_SCROLLLOCK: return ImGuiKey_ScrollLock;
|
case SDLK_SCROLLLOCK: return ImGuiKey_ScrollLock;
|
||||||
case SDLK_NUMLOCKCLEAR: return ImGuiKey_NumLock;
|
case SDLK_NUMLOCKCLEAR: return ImGuiKey_NumLock;
|
||||||
@@ -338,6 +339,23 @@ ImGuiKey ImGui_ImplSDL2_KeyEventToImGuiKey(SDL_Keycode keycode, SDL_Scancode sca
|
|||||||
case SDLK_AC_FORWARD: return ImGuiKey_AppForward;
|
case SDLK_AC_FORWARD: return ImGuiKey_AppForward;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to scancode
|
||||||
|
switch (scancode)
|
||||||
|
{
|
||||||
|
case SDL_SCANCODE_GRAVE: return ImGuiKey_GraveAccent;
|
||||||
|
case SDL_SCANCODE_MINUS: return ImGuiKey_Minus;
|
||||||
|
case SDL_SCANCODE_EQUALS: return ImGuiKey_Equal;
|
||||||
|
case SDL_SCANCODE_LEFTBRACKET: return ImGuiKey_LeftBracket;
|
||||||
|
case SDL_SCANCODE_RIGHTBRACKET: return ImGuiKey_RightBracket;
|
||||||
|
case SDL_SCANCODE_NONUSBACKSLASH: return ImGuiKey_Oem102;
|
||||||
|
case SDL_SCANCODE_BACKSLASH: return ImGuiKey_Backslash;
|
||||||
|
case SDL_SCANCODE_SEMICOLON: return ImGuiKey_Semicolon;
|
||||||
|
case SDL_SCANCODE_APOSTROPHE: return ImGuiKey_Apostrophe;
|
||||||
|
case SDL_SCANCODE_COMMA: return ImGuiKey_Comma;
|
||||||
|
case SDL_SCANCODE_PERIOD: return ImGuiKey_Period;
|
||||||
|
case SDL_SCANCODE_SLASH: return ImGuiKey_Slash;
|
||||||
|
}
|
||||||
return ImGuiKey_None;
|
return ImGuiKey_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2025-03-10: When dealing with OEM keys, use scancodes instead of translated keycodes to choose ImGuiKey values. (#7136, #7201, #7206, #7306, #7670, #7672, #8468)
|
||||||
// 2025-02-26: Only start SDL_CaptureMouse() when mouse is being dragged, to mitigate issues with e.g.Linux debuggers not claiming capture back. (#6410, #3650)
|
// 2025-02-26: Only start SDL_CaptureMouse() when mouse is being dragged, to mitigate issues with e.g.Linux debuggers not claiming capture back. (#6410, #3650)
|
||||||
// 2025-02-25: [Docking] Revert to use SDL_GetDisplayBounds() for WorkPos/WorkRect if SDL_GetDisplayUsableBounds() failed.
|
// 2025-02-25: [Docking] Revert to use SDL_GetDisplayBounds() for WorkPos/WorkRect if SDL_GetDisplayUsableBounds() failed.
|
||||||
// 2025-02-24: Avoid calling SDL_GetGlobalMouseState() when mouse is in relative mode.
|
// 2025-02-24: Avoid calling SDL_GetGlobalMouseState() when mouse is in relative mode.
|
||||||
@@ -221,17 +222,17 @@ ImGuiKey ImGui_ImplSDL3_KeyEventToImGuiKey(SDL_Keycode keycode, SDL_Scancode sca
|
|||||||
case SDLK_SPACE: return ImGuiKey_Space;
|
case SDLK_SPACE: return ImGuiKey_Space;
|
||||||
case SDLK_RETURN: return ImGuiKey_Enter;
|
case SDLK_RETURN: return ImGuiKey_Enter;
|
||||||
case SDLK_ESCAPE: return ImGuiKey_Escape;
|
case SDLK_ESCAPE: return ImGuiKey_Escape;
|
||||||
case SDLK_APOSTROPHE: return ImGuiKey_Apostrophe;
|
//case SDLK_APOSTROPHE: return ImGuiKey_Apostrophe;
|
||||||
case SDLK_COMMA: return ImGuiKey_Comma;
|
case SDLK_COMMA: return ImGuiKey_Comma;
|
||||||
case SDLK_MINUS: return ImGuiKey_Minus;
|
//case SDLK_MINUS: return ImGuiKey_Minus;
|
||||||
case SDLK_PERIOD: return ImGuiKey_Period;
|
case SDLK_PERIOD: return ImGuiKey_Period;
|
||||||
case SDLK_SLASH: return ImGuiKey_Slash;
|
//case SDLK_SLASH: return ImGuiKey_Slash;
|
||||||
case SDLK_SEMICOLON: return ImGuiKey_Semicolon;
|
case SDLK_SEMICOLON: return ImGuiKey_Semicolon;
|
||||||
case SDLK_EQUALS: return ImGuiKey_Equal;
|
//case SDLK_EQUALS: return ImGuiKey_Equal;
|
||||||
case SDLK_LEFTBRACKET: return ImGuiKey_LeftBracket;
|
//case SDLK_LEFTBRACKET: return ImGuiKey_LeftBracket;
|
||||||
case SDLK_BACKSLASH: return ImGuiKey_Backslash;
|
//case SDLK_BACKSLASH: return ImGuiKey_Backslash;
|
||||||
case SDLK_RIGHTBRACKET: return ImGuiKey_RightBracket;
|
//case SDLK_RIGHTBRACKET: return ImGuiKey_RightBracket;
|
||||||
case SDLK_GRAVE: return ImGuiKey_GraveAccent;
|
//case SDLK_GRAVE: return ImGuiKey_GraveAccent;
|
||||||
case SDLK_CAPSLOCK: return ImGuiKey_CapsLock;
|
case SDLK_CAPSLOCK: return ImGuiKey_CapsLock;
|
||||||
case SDLK_SCROLLLOCK: return ImGuiKey_ScrollLock;
|
case SDLK_SCROLLLOCK: return ImGuiKey_ScrollLock;
|
||||||
case SDLK_NUMLOCKCLEAR: return ImGuiKey_NumLock;
|
case SDLK_NUMLOCKCLEAR: return ImGuiKey_NumLock;
|
||||||
@@ -310,6 +311,23 @@ ImGuiKey ImGui_ImplSDL3_KeyEventToImGuiKey(SDL_Keycode keycode, SDL_Scancode sca
|
|||||||
case SDLK_AC_FORWARD: return ImGuiKey_AppForward;
|
case SDLK_AC_FORWARD: return ImGuiKey_AppForward;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to scancode
|
||||||
|
switch (scancode)
|
||||||
|
{
|
||||||
|
case SDL_SCANCODE_GRAVE: return ImGuiKey_GraveAccent;
|
||||||
|
case SDL_SCANCODE_MINUS: return ImGuiKey_Minus;
|
||||||
|
case SDL_SCANCODE_EQUALS: return ImGuiKey_Equal;
|
||||||
|
case SDL_SCANCODE_LEFTBRACKET: return ImGuiKey_LeftBracket;
|
||||||
|
case SDL_SCANCODE_RIGHTBRACKET: return ImGuiKey_RightBracket;
|
||||||
|
case SDL_SCANCODE_NONUSBACKSLASH: return ImGuiKey_Oem102;
|
||||||
|
case SDL_SCANCODE_BACKSLASH: return ImGuiKey_Backslash;
|
||||||
|
case SDL_SCANCODE_SEMICOLON: return ImGuiKey_Semicolon;
|
||||||
|
case SDL_SCANCODE_APOSTROPHE: return ImGuiKey_Apostrophe;
|
||||||
|
case SDL_SCANCODE_COMMA: return ImGuiKey_Comma;
|
||||||
|
case SDL_SCANCODE_PERIOD: return ImGuiKey_Period;
|
||||||
|
case SDL_SCANCODE_SLASH: return ImGuiKey_Slash;
|
||||||
|
}
|
||||||
return ImGuiKey_None;
|
return ImGuiKey_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
||||||
// 2022-10-04: Vulkan: Added experimental ImGui_ImplVulkan_RemoveTexture() for api symmetry. (#914, #5738).
|
// 2022-10-04: Vulkan: Added experimental ImGui_ImplVulkan_RemoveTexture() for api symmetry. (#914, #5738).
|
||||||
// 2022-01-20: Vulkan: Added support for ImTextureID as VkDescriptorSet. User need to call ImGui_ImplVulkan_AddTexture(). Building for 32-bit targets requires '#define ImTextureID ImU64'. (#914).
|
// 2022-01-20: Vulkan: Added support for ImTextureID as VkDescriptorSet. User need to call ImGui_ImplVulkan_AddTexture(). Building for 32-bit targets requires '#define ImTextureID ImU64'. (#914).
|
||||||
// 2021-10-15: Vulkan: Call vkCmdSetScissor() at the end of render a full-viewport to reduce likehood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling vkCmdSetScissor() explicitly every frame.
|
// 2021-10-15: Vulkan: Call vkCmdSetScissor() at the end of render a full-viewport to reduce likelihood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling vkCmdSetScissor() explicitly every frame.
|
||||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
// 2021-03-22: Vulkan: Fix mapped memory validation error when buffer sizes are not multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize.
|
// 2021-03-22: Vulkan: Fix mapped memory validation error when buffer sizes are not multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize.
|
||||||
// 2021-02-18: Vulkan: Change blending equation to preserve alpha in output buffer.
|
// 2021-02-18: Vulkan: Change blending equation to preserve alpha in output buffer.
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2025-03-10: When dealing with OEM keys, use scancodes instead of translated keycodes to choose ImGuiKey values. (#7136, #7201, #7206, #7306, #7670, #7672, #8468)
|
||||||
// 2025-02-21: [Docking] WM_SETTINGCHANGE's SPI_SETWORKAREA message also triggers a refresh of monitor list. (#8415)
|
// 2025-02-21: [Docking] WM_SETTINGCHANGE's SPI_SETWORKAREA message also triggers a refresh of monitor list. (#8415)
|
||||||
// 2025-02-18: Added ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress mouse cursor support.
|
// 2025-02-18: Added ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress mouse cursor support.
|
||||||
// 2024-11-21: [Docking] Fixed a crash when multiple processes are running with multi-viewports, caused by misusage of GetProp(). (#8162, #8069)
|
// 2024-11-21: [Docking] Fixed a crash when multiple processes are running with multi-viewports, caused by misusage of GetProp(). (#8162, #8069)
|
||||||
@@ -526,6 +527,8 @@ ImGuiKey ImGui_ImplWin32_KeyEventToImGuiKey(WPARAM wParam, LPARAM lParam)
|
|||||||
if ((wParam == VK_RETURN) && (HIWORD(lParam) & KF_EXTENDED))
|
if ((wParam == VK_RETURN) && (HIWORD(lParam) & KF_EXTENDED))
|
||||||
return ImGuiKey_KeypadEnter;
|
return ImGuiKey_KeypadEnter;
|
||||||
|
|
||||||
|
const int scancode = (int)LOBYTE(HIWORD(lParam));
|
||||||
|
//IMGUI_DEBUG_LOG("scancode %3d, keycode = 0x%02X\n", scancode, wParam);
|
||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
case VK_TAB: return ImGuiKey_Tab;
|
case VK_TAB: return ImGuiKey_Tab;
|
||||||
@@ -543,17 +546,17 @@ ImGuiKey ImGui_ImplWin32_KeyEventToImGuiKey(WPARAM wParam, LPARAM lParam)
|
|||||||
case VK_SPACE: return ImGuiKey_Space;
|
case VK_SPACE: return ImGuiKey_Space;
|
||||||
case VK_RETURN: return ImGuiKey_Enter;
|
case VK_RETURN: return ImGuiKey_Enter;
|
||||||
case VK_ESCAPE: return ImGuiKey_Escape;
|
case VK_ESCAPE: return ImGuiKey_Escape;
|
||||||
case VK_OEM_7: return ImGuiKey_Apostrophe;
|
//case VK_OEM_7: return ImGuiKey_Apostrophe;
|
||||||
case VK_OEM_COMMA: return ImGuiKey_Comma;
|
case VK_OEM_COMMA: return ImGuiKey_Comma;
|
||||||
case VK_OEM_MINUS: return ImGuiKey_Minus;
|
//case VK_OEM_MINUS: return ImGuiKey_Minus;
|
||||||
case VK_OEM_PERIOD: return ImGuiKey_Period;
|
case VK_OEM_PERIOD: return ImGuiKey_Period;
|
||||||
case VK_OEM_2: return ImGuiKey_Slash;
|
//case VK_OEM_2: return ImGuiKey_Slash;
|
||||||
case VK_OEM_1: return ImGuiKey_Semicolon;
|
//case VK_OEM_1: return ImGuiKey_Semicolon;
|
||||||
case VK_OEM_PLUS: return ImGuiKey_Equal;
|
//case VK_OEM_PLUS: return ImGuiKey_Equal;
|
||||||
case VK_OEM_4: return ImGuiKey_LeftBracket;
|
//case VK_OEM_4: return ImGuiKey_LeftBracket;
|
||||||
case VK_OEM_5: return ImGuiKey_Backslash;
|
//case VK_OEM_5: return ImGuiKey_Backslash;
|
||||||
case VK_OEM_6: return ImGuiKey_RightBracket;
|
//case VK_OEM_6: return ImGuiKey_RightBracket;
|
||||||
case VK_OEM_3: return ImGuiKey_GraveAccent;
|
//case VK_OEM_3: return ImGuiKey_GraveAccent;
|
||||||
case VK_CAPITAL: return ImGuiKey_CapsLock;
|
case VK_CAPITAL: return ImGuiKey_CapsLock;
|
||||||
case VK_SCROLL: return ImGuiKey_ScrollLock;
|
case VK_SCROLL: return ImGuiKey_ScrollLock;
|
||||||
case VK_NUMLOCK: return ImGuiKey_NumLock;
|
case VK_NUMLOCK: return ImGuiKey_NumLock;
|
||||||
@@ -645,8 +648,28 @@ ImGuiKey ImGui_ImplWin32_KeyEventToImGuiKey(WPARAM wParam, LPARAM lParam)
|
|||||||
case VK_F24: return ImGuiKey_F24;
|
case VK_F24: return ImGuiKey_F24;
|
||||||
case VK_BROWSER_BACK: return ImGuiKey_AppBack;
|
case VK_BROWSER_BACK: return ImGuiKey_AppBack;
|
||||||
case VK_BROWSER_FORWARD: return ImGuiKey_AppForward;
|
case VK_BROWSER_FORWARD: return ImGuiKey_AppForward;
|
||||||
default: return ImGuiKey_None;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to scancode
|
||||||
|
// https://handmade.network/forums/t/2011-keyboard_inputs_-_scancodes,_raw_input,_text_input,_key_names
|
||||||
|
switch (scancode)
|
||||||
|
{
|
||||||
|
case 41: return ImGuiKey_GraveAccent; // VK_OEM_8 in EN-UK, VK_OEM_3 in EN-US, VK_OEM_7 in FR, VK_OEM_5 in DE, etc.
|
||||||
|
case 12: return ImGuiKey_Minus;
|
||||||
|
case 13: return ImGuiKey_Equal;
|
||||||
|
case 26: return ImGuiKey_LeftBracket;
|
||||||
|
case 27: return ImGuiKey_RightBracket;
|
||||||
|
case 86: return ImGuiKey_Oem102;
|
||||||
|
case 43: return ImGuiKey_Backslash;
|
||||||
|
case 39: return ImGuiKey_Semicolon;
|
||||||
|
case 40: return ImGuiKey_Apostrophe;
|
||||||
|
case 51: return ImGuiKey_Comma;
|
||||||
|
case 52: return ImGuiKey_Period;
|
||||||
|
case 53: return ImGuiKey_Slash;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ImGuiKey_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow compilation with old Windows SDK. MinGW doesn't have default _WIN32_WINNT/WINVER versions.
|
// Allow compilation with old Windows SDK. MinGW doesn't have default _WIN32_WINNT/WINVER versions.
|
||||||
|
|||||||
+84
-70
File diff suppressed because it is too large
Load Diff
+4
-3
@@ -543,7 +543,7 @@ The short answer is: obtain the desired DPI scale, load your fonts resized with
|
|||||||
|
|
||||||
Your application may want to detect DPI change and reload the fonts and reset style between frames.
|
Your application may want to detect DPI change and reload the fonts and reset style between frames.
|
||||||
|
|
||||||
Your ui code should avoid using hardcoded constants for size and positioning. Prefer to express values as multiple of reference values such as `ImGui::GetFontSize()` or `ImGui::GetFrameHeight()`. So e.g. instead of seeing a hardcoded height of 500 for a given item/window, you may want to use `30*ImGui::GetFontSize()` instead.
|
Your UI code should avoid using hardcoded constants for size and positioning. Prefer to express values as multiple of reference values such as `ImGui::GetFontSize()` or `ImGui::GetFrameHeight()`. So e.g. instead of seeing a hardcoded height of 500 for a given item/window, you may want to use `30*ImGui::GetFontSize()` instead.
|
||||||
|
|
||||||
Down the line Dear ImGui will provide a variety of standardized reference values to facilitate using this.
|
Down the line Dear ImGui will provide a variety of standardized reference values to facilitate using this.
|
||||||
|
|
||||||
@@ -562,7 +562,8 @@ Please note that if you are not using multi-viewports with multi-monitors using
|
|||||||
|
|
||||||
On Windows, in addition to scaling the font size (make sure to round to an integer) and using `style.ScaleAllSizes()`, you will need to inform Windows that your application is DPI aware. If this is not done, Windows will scale the application window and the UI text will be blurry. Potential solutions to indicate DPI awareness on Windows are:
|
On Windows, in addition to scaling the font size (make sure to round to an integer) and using `style.ScaleAllSizes()`, you will need to inform Windows that your application is DPI aware. If this is not done, Windows will scale the application window and the UI text will be blurry. Potential solutions to indicate DPI awareness on Windows are:
|
||||||
|
|
||||||
- For SDL: the flag `SDL_WINDOW_ALLOW_HIGHDPI` needs to be passed to `SDL_CreateWindow()``.
|
- For SDL2: the flag `SDL_WINDOW_ALLOW_HIGHDPI` needs to be passed to `SDL_CreateWindow()`.
|
||||||
|
- For SDL3: the flag `SDL_WINDOW_HIGH_PIXEL_DENSITY` needs to be passed to `SDL_CreateWindow()`.
|
||||||
- For GLFW: this is done automatically.
|
- For GLFW: this is done automatically.
|
||||||
- For other Windows projects with other backends, or wrapper projects:
|
- For other Windows projects with other backends, or wrapper projects:
|
||||||
- We provide a `ImGui_ImplWin32_EnableDpiAwareness()` helper method in the Win32 backend.
|
- We provide a `ImGui_ImplWin32_EnableDpiAwareness()` helper method in the Win32 backend.
|
||||||
@@ -666,7 +667,7 @@ You may take a look at:
|
|||||||
|
|
||||||
Yes. People have written game editors, data browsers, debuggers, profilers, and all sorts of non-trivial tools with the library. In my experience, the simplicity of the API is very empowering. Your UI runs close to your live data. Make the tools always-on and everybody in the team will be inclined to create new tools (as opposed to more "offline" UI toolkits where only a fraction of your team effectively creates tools). The list of sponsors below is also an indicator that serious game teams have been using the library.
|
Yes. People have written game editors, data browsers, debuggers, profilers, and all sorts of non-trivial tools with the library. In my experience, the simplicity of the API is very empowering. Your UI runs close to your live data. Make the tools always-on and everybody in the team will be inclined to create new tools (as opposed to more "offline" UI toolkits where only a fraction of your team effectively creates tools). The list of sponsors below is also an indicator that serious game teams have been using the library.
|
||||||
|
|
||||||
Dear ImGui is very programmer centric and the immediate-mode GUI paradigm might require you to readjust some habits before you can realize its full potential. Dear ImGui is about making things that are simple, efficient, and powerful.
|
Dear ImGui is very programmer-centric and the immediate-mode GUI paradigm might require you to readjust some habits before you can realize its full potential. Dear ImGui is about making things that are simple, efficient, and powerful.
|
||||||
|
|
||||||
Dear ImGui is built to be efficient and scalable toward the needs for AAA-quality applications running all day. The IMGUI paradigm offers different opportunities for optimization than the more typical RMGUI paradigm.
|
Dear ImGui is built to be efficient and scalable toward the needs for AAA-quality applications running all day. The IMGUI paradigm offers different opportunities for optimization than the more typical RMGUI paradigm.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -307,7 +307,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- nav: expose wrap around flags/logic to allow e.g. grid based layout (pressing NavRight on the right-most element would go to the next row, etc.). see internal's NavMoveRequestTryWrapping().
|
- nav: expose wrap around flags/logic to allow e.g. grid based layout (pressing NavRight on the right-most element would go to the next row, etc.). see internal's NavMoveRequestTryWrapping().
|
||||||
- nav: patterns to make it possible for arrows key to update selection (see JustMovedTo in range_select branch)
|
- nav: patterns to make it possible for arrows key to update selection (see JustMovedTo in range_select branch)
|
||||||
- nav: restore/find nearest NavId when current one disappear (e.g. pressed a button that disappear, or perhaps auto restoring when current button change name)
|
- nav: restore/find nearest NavId when current one disappear (e.g. pressed a button that disappear, or perhaps auto restoring when current button change name)
|
||||||
- nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
|
- nav: SetItemDefaultFocus() level of priority, so widgets like Selectable when inside a popup could claim a low-priority default focus on the first selected item
|
||||||
- nav: holding space to repeat a button doesn't show button activated during hold.
|
- nav: holding space to repeat a button doesn't show button activated during hold.
|
||||||
- nav: NavFlattened: init requests don't work properly on flattened siblings.
|
- nav: NavFlattened: init requests don't work properly on flattened siblings.
|
||||||
- nav: NavFlattened: pageup/pagedown/home/end don't work properly on flattened siblings.
|
- nav: NavFlattened: pageup/pagedown/home/end don't work properly on flattened siblings.
|
||||||
@@ -371,7 +371,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- backends: opengl: explicitly disable GL_STENCIL_TEST in bindings.
|
- backends: opengl: explicitly disable GL_STENCIL_TEST in bindings.
|
||||||
- backends: vulkan: viewport: support for synchronized swapping of multiple swap chains.
|
- backends: vulkan: viewport: support for synchronized swapping of multiple swap chains.
|
||||||
- backends: bgfx: https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
- backends: bgfx: https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
||||||
- backends: emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
|
- backends: emscripten: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
|
||||||
|
|
||||||
- bindings: ways to use clang ast dump to generate bindings or helpers for bindings? (e.g. clang++ -Xclang -ast-dump=json imgui.h) (--> use https://github.com/dearimgui/dear_bindings)
|
- bindings: ways to use clang ast dump to generate bindings or helpers for bindings? (e.g. clang++ -Xclang -ast-dump=json imgui.h) (--> use https://github.com/dearimgui/dear_bindings)
|
||||||
|
|
||||||
|
|||||||
@@ -666,7 +666,7 @@ CODE
|
|||||||
- 2022/04/05 (1.88) - inputs: renamed ImGuiKeyModFlags to ImGuiModFlags. Kept inline redirection enums (will obsolete). This was never used in public API functions but technically present in imgui.h and ImGuiIO.
|
- 2022/04/05 (1.88) - inputs: renamed ImGuiKeyModFlags to ImGuiModFlags. Kept inline redirection enums (will obsolete). This was never used in public API functions but technically present in imgui.h and ImGuiIO.
|
||||||
- 2022/01/20 (1.87) - inputs: reworded gamepad IO.
|
- 2022/01/20 (1.87) - inputs: reworded gamepad IO.
|
||||||
- Backend writing to io.NavInputs[] -> backend should call io.AddKeyEvent()/io.AddKeyAnalogEvent() with ImGuiKey_GamepadXXX values.
|
- Backend writing to io.NavInputs[] -> backend should call io.AddKeyEvent()/io.AddKeyAnalogEvent() with ImGuiKey_GamepadXXX values.
|
||||||
- 2022/01/19 (1.87) - sliders, drags: removed support for legacy arithmetic operators (+,+-,*,/) when inputing text. This doesn't break any api/code but a feature that used to be accessible by end-users (which seemingly no one used).
|
- 2022/01/19 (1.87) - sliders, drags: removed support for legacy arithmetic operators (+,+-,*,/) when inputting text. This doesn't break any api/code but a feature that used to be accessible by end-users (which seemingly no one used).
|
||||||
- 2022/01/17 (1.87) - inputs: reworked mouse IO.
|
- 2022/01/17 (1.87) - inputs: reworked mouse IO.
|
||||||
- Backend writing to io.MousePos -> backend should call io.AddMousePosEvent()
|
- Backend writing to io.MousePos -> backend should call io.AddMousePosEvent()
|
||||||
- Backend writing to io.MouseDown[] -> backend should call io.AddMouseButtonEvent()
|
- Backend writing to io.MouseDown[] -> backend should call io.AddMouseButtonEvent()
|
||||||
@@ -2046,15 +2046,15 @@ void ImStrncpy(char* dst, const char* src, size_t count)
|
|||||||
|
|
||||||
char* ImStrdup(const char* str)
|
char* ImStrdup(const char* str)
|
||||||
{
|
{
|
||||||
size_t len = strlen(str);
|
size_t len = ImStrlen(str);
|
||||||
void* buf = IM_ALLOC(len + 1);
|
void* buf = IM_ALLOC(len + 1);
|
||||||
return (char*)memcpy(buf, (const void*)str, len + 1);
|
return (char*)memcpy(buf, (const void*)str, len + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* src)
|
char* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* src)
|
||||||
{
|
{
|
||||||
size_t dst_buf_size = p_dst_size ? *p_dst_size : strlen(dst) + 1;
|
size_t dst_buf_size = p_dst_size ? *p_dst_size : ImStrlen(dst) + 1;
|
||||||
size_t src_size = strlen(src) + 1;
|
size_t src_size = ImStrlen(src) + 1;
|
||||||
if (dst_buf_size < src_size)
|
if (dst_buf_size < src_size)
|
||||||
{
|
{
|
||||||
IM_FREE(dst);
|
IM_FREE(dst);
|
||||||
@@ -2067,7 +2067,7 @@ char* ImStrdupcpy(char* dst, size_t* p_dst_size, const char* src)
|
|||||||
|
|
||||||
const char* ImStrchrRange(const char* str, const char* str_end, char c)
|
const char* ImStrchrRange(const char* str, const char* str_end, char c)
|
||||||
{
|
{
|
||||||
const char* p = (const char*)memchr(str, (int)c, str_end - str);
|
const char* p = (const char*)ImMemchr(str, (int)c, str_end - str);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2082,13 +2082,13 @@ int ImStrlenW(const ImWchar* str)
|
|||||||
// Find end-of-line. Return pointer will point to either first \n, either str_end.
|
// Find end-of-line. Return pointer will point to either first \n, either str_end.
|
||||||
const char* ImStreolRange(const char* str, const char* str_end)
|
const char* ImStreolRange(const char* str, const char* str_end)
|
||||||
{
|
{
|
||||||
const char* p = (const char*)memchr(str, '\n', str_end - str);
|
const char* p = (const char*)ImMemchr(str, '\n', str_end - str);
|
||||||
return p ? p : str_end;
|
return p ? p : str_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ImStrbol(const char* buf_mid_line, const char* buf_begin) // find beginning-of-line
|
const char* ImStrbol(const char* buf_mid_line, const char* buf_begin) // find beginning-of-line
|
||||||
{
|
{
|
||||||
IM_ASSERT_PARANOID(buf_mid_line >= buf_begin && buf_mid_line <= buf_begin + strlen(buf_begin));
|
IM_ASSERT_PARANOID(buf_mid_line >= buf_begin && buf_mid_line <= buf_begin + ImStrlen(buf_begin));
|
||||||
while (buf_mid_line > buf_begin && buf_mid_line[-1] != '\n')
|
while (buf_mid_line > buf_begin && buf_mid_line[-1] != '\n')
|
||||||
buf_mid_line--;
|
buf_mid_line--;
|
||||||
return buf_mid_line;
|
return buf_mid_line;
|
||||||
@@ -2097,7 +2097,7 @@ const char* ImStrbol(const char* buf_mid_line, const char* buf_begin) // find be
|
|||||||
const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end)
|
const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end)
|
||||||
{
|
{
|
||||||
if (!needle_end)
|
if (!needle_end)
|
||||||
needle_end = needle + strlen(needle);
|
needle_end = needle + ImStrlen(needle);
|
||||||
|
|
||||||
const char un0 = (char)ImToUpper(*needle);
|
const char un0 = (char)ImToUpper(*needle);
|
||||||
while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
|
while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
|
||||||
@@ -2218,7 +2218,7 @@ void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end,
|
|||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
buf = "(null)";
|
buf = "(null)";
|
||||||
*out_buf = buf;
|
*out_buf = buf;
|
||||||
if (out_buf_end) { *out_buf_end = buf + strlen(buf); }
|
if (out_buf_end) { *out_buf_end = buf + ImStrlen(buf); }
|
||||||
}
|
}
|
||||||
else if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '*' && fmt[3] == 's' && fmt[4] == 0)
|
else if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '*' && fmt[3] == 's' && fmt[4] == 0)
|
||||||
{
|
{
|
||||||
@@ -2627,11 +2627,11 @@ const char* ImTextFindPreviousUtf8Codepoint(const char* in_text_start, const cha
|
|||||||
int ImTextCountLines(const char* in_text, const char* in_text_end)
|
int ImTextCountLines(const char* in_text, const char* in_text_end)
|
||||||
{
|
{
|
||||||
if (in_text_end == NULL)
|
if (in_text_end == NULL)
|
||||||
in_text_end = in_text + strlen(in_text); // FIXME-OPT: Not optimal approach, discourage use for now.
|
in_text_end = in_text + ImStrlen(in_text); // FIXME-OPT: Not optimal approach, discourage use for now.
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (in_text < in_text_end)
|
while (in_text < in_text_end)
|
||||||
{
|
{
|
||||||
const char* line_end = (const char*)memchr(in_text, '\n', in_text_end - in_text);
|
const char* line_end = (const char*)ImMemchr(in_text, '\n', in_text_end - in_text);
|
||||||
in_text = line_end ? line_end + 1 : in_text_end;
|
in_text = line_end ? line_end + 1 : in_text_end;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@@ -2912,7 +2912,7 @@ void ImGuiTextFilter::ImGuiTextRange::split(char separator, ImVector<ImGuiTextRa
|
|||||||
void ImGuiTextFilter::Build()
|
void ImGuiTextFilter::Build()
|
||||||
{
|
{
|
||||||
Filters.resize(0);
|
Filters.resize(0);
|
||||||
ImGuiTextRange input_range(InputBuf, InputBuf + strlen(InputBuf));
|
ImGuiTextRange input_range(InputBuf, InputBuf + ImStrlen(InputBuf));
|
||||||
input_range.split(',', &Filters);
|
input_range.split(',', &Filters);
|
||||||
|
|
||||||
CountGrep = 0;
|
CountGrep = 0;
|
||||||
@@ -2980,7 +2980,7 @@ char ImGuiTextBuffer::EmptyString[1] = { 0 };
|
|||||||
|
|
||||||
void ImGuiTextBuffer::append(const char* str, const char* str_end)
|
void ImGuiTextBuffer::append(const char* str, const char* str_end)
|
||||||
{
|
{
|
||||||
int len = str_end ? (int)(str_end - str) : (int)strlen(str);
|
int len = str_end ? (int)(str_end - str) : (int)ImStrlen(str);
|
||||||
|
|
||||||
// Add zero-terminator the first time
|
// Add zero-terminator the first time
|
||||||
const int write_off = (Buf.Size != 0) ? Buf.Size : 1;
|
const int write_off = (Buf.Size != 0) ? Buf.Size : 1;
|
||||||
@@ -3039,7 +3039,7 @@ void ImGuiTextIndex::append(const char* base, int old_size, int new_size)
|
|||||||
if (EndOffset == 0 || base[EndOffset - 1] == '\n')
|
if (EndOffset == 0 || base[EndOffset - 1] == '\n')
|
||||||
LineOffsets.push_back(EndOffset);
|
LineOffsets.push_back(EndOffset);
|
||||||
const char* base_end = base + new_size;
|
const char* base_end = base + new_size;
|
||||||
for (const char* p = base + old_size; (p = (const char*)memchr(p, '\n', base_end - p)) != 0; )
|
for (const char* p = base + old_size; (p = (const char*)ImMemchr(p, '\n', base_end - p)) != 0; )
|
||||||
if (++p < base_end) // Don't push a trailing offset on last \n
|
if (++p < base_end) // Don't push a trailing offset on last \n
|
||||||
LineOffsets.push_back((int)(intptr_t)(p - base));
|
LineOffsets.push_back((int)(intptr_t)(p - base));
|
||||||
EndOffset = ImMax(EndOffset, new_size);
|
EndOffset = ImMax(EndOffset, new_size);
|
||||||
@@ -3671,7 +3671,7 @@ void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!text_end)
|
if (!text_end)
|
||||||
text_end = text + strlen(text); // FIXME-OPT
|
text_end = text + ImStrlen(text); // FIXME-OPT
|
||||||
text_display_end = text_end;
|
text_display_end = text_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3689,7 +3689,7 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end
|
|||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
|
||||||
if (!text_end)
|
if (!text_end)
|
||||||
text_end = text + strlen(text); // FIXME-OPT
|
text_end = text + ImStrlen(text); // FIXME-OPT
|
||||||
|
|
||||||
if (text != text_end)
|
if (text != text_end)
|
||||||
{
|
{
|
||||||
@@ -4390,7 +4390,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* ctx, const char* name) : DrawListInst(NUL
|
|||||||
memset(this, 0, sizeof(*this));
|
memset(this, 0, sizeof(*this));
|
||||||
Ctx = ctx;
|
Ctx = ctx;
|
||||||
Name = ImStrdup(name);
|
Name = ImStrdup(name);
|
||||||
NameBufLen = (int)strlen(name) + 1;
|
NameBufLen = (int)ImStrlen(name) + 1;
|
||||||
ID = ImHashStr(name);
|
ID = ImHashStr(name);
|
||||||
IDStack.push_back(ID);
|
IDStack.push_back(ID);
|
||||||
ViewportAllowPlatformMonitorExtend = -1;
|
ViewportAllowPlatformMonitorExtend = -1;
|
||||||
@@ -5082,7 +5082,7 @@ void ImGui::StartMouseMovingWindowOrNode(ImGuiWindow* window, ImGuiDockNode* nod
|
|||||||
|
|
||||||
// Handle mouse moving window
|
// Handle mouse moving window
|
||||||
// Note: moving window with the navigation keys (Square + d-pad / CTRL+TAB + Arrows) are processed in NavUpdateWindowing()
|
// Note: moving window with the navigation keys (Square + d-pad / CTRL+TAB + Arrows) are processed in NavUpdateWindowing()
|
||||||
// FIXME: We don't have strong guarantee that g.MovingWindow stay synched with g.ActiveId == g.MovingWindow->MoveId.
|
// FIXME: We don't have strong guarantee that g.MovingWindow stay synced with g.ActiveId == g.MovingWindow->MoveId.
|
||||||
// This is currently enforced by the fact that BeginDragDropSource() is setting all g.ActiveIdUsingXXXX flags to inhibit navigation inputs,
|
// This is currently enforced by the fact that BeginDragDropSource() is setting all g.ActiveIdUsingXXXX flags to inhibit navigation inputs,
|
||||||
// but if we should more thoroughly test cases where g.ActiveId or g.MovingWindow gets changed and not the other.
|
// but if we should more thoroughly test cases where g.ActiveId or g.MovingWindow gets changed and not the other.
|
||||||
void ImGui::UpdateMouseMovingWindowNewFrame()
|
void ImGui::UpdateMouseMovingWindowNewFrame()
|
||||||
@@ -6878,7 +6878,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si
|
|||||||
{
|
{
|
||||||
// Auto-fit when double-clicking
|
// Auto-fit when double-clicking
|
||||||
size_target = CalcWindowSizeAfterConstraint(window, size_auto_fit);
|
size_target = CalcWindowSizeAfterConstraint(window, size_auto_fit);
|
||||||
ret_auto_fit_mask = 0x03; // Both axises
|
ret_auto_fit_mask = 0x03; // Both axes
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
}
|
}
|
||||||
else if (held)
|
else if (held)
|
||||||
@@ -9388,7 +9388,7 @@ ImGuiKeyData* ImGui::GetKeyData(ImGuiContext* ctx, ImGuiKey key)
|
|||||||
return &g.IO.KeysData[key - ImGuiKey_NamedKey_BEGIN];
|
return &g.IO.KeysData[key - ImGuiKey_NamedKey_BEGIN];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
|
// Those names are provided for debugging purpose and are not meant to be saved persistently nor compared.
|
||||||
static const char* const GKeyNames[] =
|
static const char* const GKeyNames[] =
|
||||||
{
|
{
|
||||||
"Tab", "LeftArrow", "RightArrow", "UpArrow", "DownArrow", "PageUp", "PageDown",
|
"Tab", "LeftArrow", "RightArrow", "UpArrow", "DownArrow", "PageUp", "PageDown",
|
||||||
@@ -9403,7 +9403,7 @@ static const char* const GKeyNames[] =
|
|||||||
"Pause", "Keypad0", "Keypad1", "Keypad2", "Keypad3", "Keypad4", "Keypad5", "Keypad6",
|
"Pause", "Keypad0", "Keypad1", "Keypad2", "Keypad3", "Keypad4", "Keypad5", "Keypad6",
|
||||||
"Keypad7", "Keypad8", "Keypad9", "KeypadDecimal", "KeypadDivide", "KeypadMultiply",
|
"Keypad7", "Keypad8", "Keypad9", "KeypadDecimal", "KeypadDivide", "KeypadMultiply",
|
||||||
"KeypadSubtract", "KeypadAdd", "KeypadEnter", "KeypadEqual",
|
"KeypadSubtract", "KeypadAdd", "KeypadEnter", "KeypadEqual",
|
||||||
"AppBack", "AppForward",
|
"AppBack", "AppForward", "Oem102",
|
||||||
"GamepadStart", "GamepadBack",
|
"GamepadStart", "GamepadBack",
|
||||||
"GamepadFaceLeft", "GamepadFaceRight", "GamepadFaceUp", "GamepadFaceDown",
|
"GamepadFaceLeft", "GamepadFaceRight", "GamepadFaceUp", "GamepadFaceDown",
|
||||||
"GamepadDpadLeft", "GamepadDpadRight", "GamepadDpadUp", "GamepadDpadDown",
|
"GamepadDpadLeft", "GamepadDpadRight", "GamepadDpadUp", "GamepadDpadDown",
|
||||||
@@ -9445,7 +9445,7 @@ const char* ImGui::GetKeyChordName(ImGuiKeyChord key_chord)
|
|||||||
(key != ImGuiKey_None || key_chord == ImGuiKey_None) ? GetKeyName(key) : "");
|
(key != ImGuiKey_None || key_chord == ImGuiKey_None) ? GetKeyName(key) : "");
|
||||||
size_t len;
|
size_t len;
|
||||||
if (key == ImGuiKey_None && key_chord != 0)
|
if (key == ImGuiKey_None && key_chord != 0)
|
||||||
if ((len = strlen(g.TempKeychordName)) != 0) // Remove trailing '+'
|
if ((len = ImStrlen(g.TempKeychordName)) != 0) // Remove trailing '+'
|
||||||
g.TempKeychordName[len - 1] = 0;
|
g.TempKeychordName[len - 1] = 0;
|
||||||
return g.TempKeychordName;
|
return g.TempKeychordName;
|
||||||
}
|
}
|
||||||
@@ -10322,7 +10322,7 @@ void ImGui::UpdateMouseWheel()
|
|||||||
if (g.IO.MouseWheelRequestAxisSwap)
|
if (g.IO.MouseWheelRequestAxisSwap)
|
||||||
wheel = ImVec2(wheel.y, 0.0f);
|
wheel = ImVec2(wheel.y, 0.0f);
|
||||||
|
|
||||||
// Maintain a rough average of moving magnitude on both axises
|
// Maintain a rough average of moving magnitude on both axes
|
||||||
// FIXME: should by based on wall clock time rather than frame-counter
|
// FIXME: should by based on wall clock time rather than frame-counter
|
||||||
g.WheelingAxisAvg.x = ImExponentialMovingAverage(g.WheelingAxisAvg.x, ImAbs(wheel.x), 30);
|
g.WheelingAxisAvg.x = ImExponentialMovingAverage(g.WheelingAxisAvg.x, ImAbs(wheel.x), 30);
|
||||||
g.WheelingAxisAvg.y = ImExponentialMovingAverage(g.WheelingAxisAvg.y, ImAbs(wheel.y), 30);
|
g.WheelingAxisAvg.y = ImExponentialMovingAverage(g.WheelingAxisAvg.y, ImAbs(wheel.y), 30);
|
||||||
@@ -10335,7 +10335,7 @@ void ImGui::UpdateMouseWheel()
|
|||||||
|
|
||||||
// Mouse wheel scrolling: find target and apply
|
// Mouse wheel scrolling: find target and apply
|
||||||
// - don't renew lock if axis doesn't apply on the window.
|
// - don't renew lock if axis doesn't apply on the window.
|
||||||
// - select a main axis when both axises are being moved.
|
// - select a main axis when both axes are being moved.
|
||||||
if (ImGuiWindow* window = (g.WheelingWindow ? g.WheelingWindow : FindBestWheelingWindow(wheel)))
|
if (ImGuiWindow* window = (g.WheelingWindow ? g.WheelingWindow : FindBestWheelingWindow(wheel)))
|
||||||
if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))
|
if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))
|
||||||
{
|
{
|
||||||
@@ -14841,7 +14841,7 @@ bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_s
|
|||||||
cond = ImGuiCond_Always;
|
cond = ImGuiCond_Always;
|
||||||
|
|
||||||
IM_ASSERT(type != NULL);
|
IM_ASSERT(type != NULL);
|
||||||
IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
|
IM_ASSERT(ImStrlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
|
||||||
IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
|
IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
|
||||||
IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
|
IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
|
||||||
IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource()
|
IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource()
|
||||||
@@ -15085,7 +15085,7 @@ void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
LogRenderedText(ref_pos, prefix, prefix + strlen(prefix)); // Calculate end ourself to ensure "##" are included here.
|
LogRenderedText(ref_pos, prefix, prefix + ImStrlen(prefix)); // Calculate end ourself to ensure "##" are included here.
|
||||||
|
|
||||||
// Re-adjust padding if we have popped out of our starting depth
|
// Re-adjust padding if we have popped out of our starting depth
|
||||||
if (g.LogDepthRef > window->DC.TreeDepth)
|
if (g.LogDepthRef > window->DC.TreeDepth)
|
||||||
@@ -15118,7 +15118,7 @@ void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (suffix)
|
if (suffix)
|
||||||
LogRenderedText(ref_pos, suffix, suffix + strlen(suffix));
|
LogRenderedText(ref_pos, suffix, suffix + ImStrlen(suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start logging/capturing text output
|
// Start logging/capturing text output
|
||||||
@@ -15384,7 +15384,7 @@ void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size)
|
|||||||
// For user convenience, we allow passing a non zero-terminated string (hence the ini_size parameter).
|
// For user convenience, we allow passing a non zero-terminated string (hence the ini_size parameter).
|
||||||
// For our convenience and to make the code simpler, we'll also write zero-terminators within the buffer. So let's create a writable copy..
|
// For our convenience and to make the code simpler, we'll also write zero-terminators within the buffer. So let's create a writable copy..
|
||||||
if (ini_size == 0)
|
if (ini_size == 0)
|
||||||
ini_size = strlen(ini_data);
|
ini_size = ImStrlen(ini_data);
|
||||||
g.SettingsIniData.Buf.resize((int)ini_size + 1);
|
g.SettingsIniData.Buf.resize((int)ini_size + 1);
|
||||||
char* const buf = g.SettingsIniData.Buf.Data;
|
char* const buf = g.SettingsIniData.Buf.Data;
|
||||||
char* const buf_end = buf + ini_size;
|
char* const buf_end = buf + ini_size;
|
||||||
@@ -15485,7 +15485,7 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
|
|||||||
if (const char* p = strstr(name, "###"))
|
if (const char* p = strstr(name, "###"))
|
||||||
name = p;
|
name = p;
|
||||||
}
|
}
|
||||||
const size_t name_len = strlen(name);
|
const size_t name_len = ImStrlen(name);
|
||||||
|
|
||||||
// Allocate chunk
|
// Allocate chunk
|
||||||
const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1;
|
const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1;
|
||||||
@@ -20703,7 +20703,7 @@ static void Platform_SetClipboardTextFn_DefaultImpl(ImGuiContext*, const char* t
|
|||||||
if (!main_clipboard)
|
if (!main_clipboard)
|
||||||
PasteboardCreate(kPasteboardClipboard, &main_clipboard);
|
PasteboardCreate(kPasteboardClipboard, &main_clipboard);
|
||||||
PasteboardClear(main_clipboard);
|
PasteboardClear(main_clipboard);
|
||||||
CFDataRef cf_data = CFDataCreate(kCFAllocatorDefault, (const UInt8*)text, strlen(text));
|
CFDataRef cf_data = CFDataCreate(kCFAllocatorDefault, (const UInt8*)text, ImStrlen(text));
|
||||||
if (cf_data)
|
if (cf_data)
|
||||||
{
|
{
|
||||||
PasteboardPutItemFlavor(main_clipboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), cf_data, 0);
|
PasteboardPutItemFlavor(main_clipboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), cf_data, 0);
|
||||||
@@ -20757,7 +20757,7 @@ static void Platform_SetClipboardTextFn_DefaultImpl(ImGuiContext* ctx, const cha
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *ctx;
|
ImGuiContext& g = *ctx;
|
||||||
g.ClipboardHandlerData.clear();
|
g.ClipboardHandlerData.clear();
|
||||||
const char* text_end = text + strlen(text);
|
const char* text_end = text + ImStrlen(text);
|
||||||
g.ClipboardHandlerData.resize((int)(text_end - text) + 1);
|
g.ClipboardHandlerData.resize((int)(text_end - text) + 1);
|
||||||
memcpy(&g.ClipboardHandlerData[0], text, (size_t)(text_end - text));
|
memcpy(&g.ClipboardHandlerData[0], text, (size_t)(text_end - text));
|
||||||
g.ClipboardHandlerData[(int)(text_end - text)] = 0;
|
g.ClipboardHandlerData[(int)(text_end - text)] = 0;
|
||||||
@@ -20771,11 +20771,13 @@ static void Platform_SetClipboardTextFn_DefaultImpl(ImGuiContext* ctx, const cha
|
|||||||
#if defined(__APPLE__) && TARGET_OS_IPHONE
|
#if defined(__APPLE__) && TARGET_OS_IPHONE
|
||||||
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__3DS__)
|
||||||
|
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||||
|
#endif
|
||||||
#if defined(_WIN32) && defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
#if defined(_WIN32) && defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||||||
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif // #ifndef IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
#ifndef IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -22758,7 +22760,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
|
|||||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%d", (int)(intptr_t)data_id);
|
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%d", (int)(intptr_t)data_id);
|
||||||
break;
|
break;
|
||||||
case ImGuiDataType_String:
|
case ImGuiDataType_String:
|
||||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%.*s", data_id_end ? (int)((const char*)data_id_end - (const char*)data_id) : (int)strlen((const char*)data_id), (const char*)data_id);
|
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%.*s", data_id_end ? (int)((const char*)data_id_end - (const char*)data_id) : (int)ImStrlen((const char*)data_id), (const char*)data_id);
|
||||||
break;
|
break;
|
||||||
case ImGuiDataType_Pointer:
|
case ImGuiDataType_Pointer:
|
||||||
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "(void*)0x%p", data_id);
|
ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "(void*)0x%p", data_id);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
// Library Version
|
// Library Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||||
#define IMGUI_VERSION "1.91.9 WIP"
|
#define IMGUI_VERSION "1.91.9 WIP"
|
||||||
#define IMGUI_VERSION_NUM 19187
|
#define IMGUI_VERSION_NUM 19188
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||||
#define IMGUI_HAS_DOCK // Docking WIP branch
|
#define IMGUI_HAS_DOCK // Docking WIP branch
|
||||||
@@ -552,7 +552,7 @@ namespace ImGui
|
|||||||
IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args) IM_FMTLIST(2);
|
IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args) IM_FMTLIST(2);
|
||||||
IMGUI_API void BulletText(const char* fmt, ...) IM_FMTARGS(1); // shortcut for Bullet()+Text()
|
IMGUI_API void BulletText(const char* fmt, ...) IM_FMTARGS(1); // shortcut for Bullet()+Text()
|
||||||
IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
||||||
IMGUI_API void SeparatorText(const char* label); // currently: formatted text with an horizontal line
|
IMGUI_API void SeparatorText(const char* label); // currently: formatted text with a horizontal line
|
||||||
|
|
||||||
// Widgets: Main
|
// Widgets: Main
|
||||||
// - Most widgets return true when the value has been changed or when pressed/selected
|
// - Most widgets return true when the value has been changed or when pressed/selected
|
||||||
@@ -1003,7 +1003,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool IsKeyReleased(ImGuiKey key); // was key released (went from Down to !Down)?
|
IMGUI_API bool IsKeyReleased(ImGuiKey key); // was key released (went from Down to !Down)?
|
||||||
IMGUI_API bool IsKeyChordPressed(ImGuiKeyChord key_chord); // was key chord (mods + key) pressed, e.g. you can pass 'ImGuiMod_Ctrl | ImGuiKey_S' as a key-chord. This doesn't do any routing or focus check, please consider using Shortcut() function instead.
|
IMGUI_API bool IsKeyChordPressed(ImGuiKeyChord key_chord); // was key chord (mods + key) pressed, e.g. you can pass 'ImGuiMod_Ctrl | ImGuiKey_S' as a key-chord. This doesn't do any routing or focus check, please consider using Shortcut() function instead.
|
||||||
IMGUI_API int GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate
|
IMGUI_API int GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate
|
||||||
IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
|
IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names are provided for debugging purpose and are not meant to be saved persistently nor compared.
|
||||||
IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call.
|
IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call.
|
||||||
|
|
||||||
// Inputs Utilities: Shortcut Testing & Routing [BETA]
|
// Inputs Utilities: Shortcut Testing & Routing [BETA]
|
||||||
@@ -1553,6 +1553,7 @@ enum ImGuiKey : int
|
|||||||
ImGuiKey_KeypadEqual,
|
ImGuiKey_KeypadEqual,
|
||||||
ImGuiKey_AppBack, // Available on some keyboard/mouses. Often referred as "Browser Back"
|
ImGuiKey_AppBack, // Available on some keyboard/mouses. Often referred as "Browser Back"
|
||||||
ImGuiKey_AppForward,
|
ImGuiKey_AppForward,
|
||||||
|
ImGuiKey_Oem102, // Non-US backslash.
|
||||||
|
|
||||||
// Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION ACTION
|
// Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION ACTION
|
||||||
// (download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets)
|
// (download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets)
|
||||||
@@ -2527,7 +2528,7 @@ struct ImGuiIO
|
|||||||
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds.
|
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds.
|
||||||
bool MouseDownOwnedUnlessPopupClose[5]; // Track if button was clicked inside a dear imgui window.
|
bool MouseDownOwnedUnlessPopupClose[5]; // Track if button was clicked inside a dear imgui window.
|
||||||
bool MouseWheelRequestAxisSwap; // On a non-Mac system, holding SHIFT requests WheelY to perform the equivalent of a WheelX event. On a Mac system this is already enforced by the system.
|
bool MouseWheelRequestAxisSwap; // On a non-Mac system, holding SHIFT requests WheelY to perform the equivalent of a WheelX event. On a Mac system this is already enforced by the system.
|
||||||
bool MouseCtrlLeftAsRightClick; // (OSX) Set to true when the current click was a ctrl-click that spawned a simulated right click
|
bool MouseCtrlLeftAsRightClick; // (OSX) Set to true when the current click was a Ctrl+click that spawned a simulated right click
|
||||||
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
||||||
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
||||||
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
|
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
|
||||||
|
|||||||
+3
-3
@@ -8514,7 +8514,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
HelpMarker("When drawing circle primitives with \"num_segments == 0\" tesselation will be calculated automatically.");
|
HelpMarker("When drawing circle primitives with \"num_segments == 0\" tessellation will be calculated automatically.");
|
||||||
|
|
||||||
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
||||||
ImGui::DragFloat("Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Additional alpha multiplier for disabled items (multiply over current value of Alpha).");
|
ImGui::DragFloat("Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Additional alpha multiplier for disabled items (multiply over current value of Alpha).");
|
||||||
@@ -8545,7 +8545,7 @@ void ImGui::ShowUserGuide()
|
|||||||
ImGui::BulletText("CTRL+Tab to select a window.");
|
ImGui::BulletText("CTRL+Tab to select a window.");
|
||||||
if (io.FontAllowUserScaling)
|
if (io.FontAllowUserScaling)
|
||||||
ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
||||||
ImGui::BulletText("While inputing text:\n");
|
ImGui::BulletText("While inputting text:\n");
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
ImGui::BulletText("CTRL+Left/Right to word jump.");
|
ImGui::BulletText("CTRL+Left/Right to word jump.");
|
||||||
ImGui::BulletText("CTRL+A or double-click to select all.");
|
ImGui::BulletText("CTRL+A or double-click to select all.");
|
||||||
@@ -8976,7 +8976,7 @@ struct ExampleAppConsole
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Multiple matches. Complete as much as we can..
|
// Multiple matches. Complete as much as we can..
|
||||||
// So inputing "C"+Tab will complete to "CL" then display "CLEAR" and "CLASSIFY" as matches.
|
// So inputting "C"+Tab will complete to "CL" then display "CLEAR" and "CLASSIFY" as matches.
|
||||||
int match_len = (int)(word_end - word_start);
|
int match_len = (int)(word_end - word_start);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-6
@@ -143,6 +143,7 @@ namespace IMGUI_STB_NAMESPACE
|
|||||||
#define STBTT_fabs(x) ImFabs(x)
|
#define STBTT_fabs(x) ImFabs(x)
|
||||||
#define STBTT_ifloor(x) ((int)ImFloor(x))
|
#define STBTT_ifloor(x) ((int)ImFloor(x))
|
||||||
#define STBTT_iceil(x) ((int)ImCeil(x))
|
#define STBTT_iceil(x) ((int)ImCeil(x))
|
||||||
|
#define STBTT_strlen(x) ImStrlen(x)
|
||||||
#define STBTT_STATIC
|
#define STBTT_STATIC
|
||||||
#define STB_TRUETYPE_IMPLEMENTATION
|
#define STB_TRUETYPE_IMPLEMENTATION
|
||||||
#else
|
#else
|
||||||
@@ -2678,7 +2679,7 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels,
|
|||||||
{
|
{
|
||||||
// Store a short copy of filename into into the font name for convenience
|
// Store a short copy of filename into into the font name for convenience
|
||||||
const char* p;
|
const char* p;
|
||||||
for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
|
for (p = filename + ImStrlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
|
||||||
ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels);
|
ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels);
|
||||||
}
|
}
|
||||||
return AddFontFromMemoryTTF(data, (int)data_size, size_pixels, &font_cfg, glyph_ranges);
|
return AddFontFromMemoryTTF(data, (int)data_size, size_pixels, &font_cfg, glyph_ranges);
|
||||||
@@ -2713,7 +2714,7 @@ ImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_d
|
|||||||
|
|
||||||
ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges)
|
ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges)
|
||||||
{
|
{
|
||||||
int compressed_ttf_size = (((int)strlen(compressed_ttf_data_base85) + 4) / 5) * 4;
|
int compressed_ttf_size = (((int)ImStrlen(compressed_ttf_data_base85) + 4) / 5) * 4;
|
||||||
void* compressed_ttf = IM_ALLOC((size_t)compressed_ttf_size);
|
void* compressed_ttf = IM_ALLOC((size_t)compressed_ttf_size);
|
||||||
Decode85((const unsigned char*)compressed_ttf_data_base85, (unsigned char*)compressed_ttf);
|
Decode85((const unsigned char*)compressed_ttf_data_base85, (unsigned char*)compressed_ttf);
|
||||||
ImFont* font = AddFontFromMemoryCompressedTTF(compressed_ttf, compressed_ttf_size, size_pixels, font_cfg, glyph_ranges);
|
ImFont* font = AddFontFromMemoryCompressedTTF(compressed_ttf, compressed_ttf_size, size_pixels, font_cfg, glyph_ranges);
|
||||||
@@ -4035,7 +4036,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
|||||||
ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining)
|
ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining)
|
||||||
{
|
{
|
||||||
if (!text_end)
|
if (!text_end)
|
||||||
text_end = text_begin + strlen(text_begin); // FIXME-OPT: Need to avoid this.
|
text_end = text_begin + ImStrlen(text_begin); // FIXME-OPT: Need to avoid this.
|
||||||
|
|
||||||
const float line_height = size;
|
const float line_height = size;
|
||||||
const float scale = size / FontSize;
|
const float scale = size / FontSize;
|
||||||
@@ -4135,7 +4136,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!text_end)
|
if (!text_end)
|
||||||
text_end = text_begin + strlen(text_begin); // ImGui:: functions generally already provides a valid text_end, so this is merely to handle direct calls.
|
text_end = text_begin + ImStrlen(text_begin); // ImGui:: functions generally already provides a valid text_end, so this is merely to handle direct calls.
|
||||||
|
|
||||||
const float scale = size / FontSize;
|
const float scale = size / FontSize;
|
||||||
const float line_height = FontSize * scale;
|
const float line_height = FontSize * scale;
|
||||||
@@ -4147,7 +4148,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
|||||||
if (y + line_height < clip_rect.y)
|
if (y + line_height < clip_rect.y)
|
||||||
while (y + line_height < clip_rect.y && s < text_end)
|
while (y + line_height < clip_rect.y && s < text_end)
|
||||||
{
|
{
|
||||||
const char* line_end = (const char*)memchr(s, '\n', text_end - s);
|
const char* line_end = (const char*)ImMemchr(s, '\n', text_end - s);
|
||||||
if (word_wrap_enabled)
|
if (word_wrap_enabled)
|
||||||
{
|
{
|
||||||
// FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA().
|
// FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA().
|
||||||
@@ -4171,7 +4172,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
|||||||
float y_end = y;
|
float y_end = y;
|
||||||
while (y_end < clip_rect.w && s_end < text_end)
|
while (y_end < clip_rect.w && s_end < text_end)
|
||||||
{
|
{
|
||||||
s_end = (const char*)memchr(s_end, '\n', text_end - s_end);
|
s_end = (const char*)ImMemchr(s_end, '\n', text_end - s_end);
|
||||||
s_end = s_end ? s_end + 1 : text_end;
|
s_end = s_end ? s_end + 1 : text_end;
|
||||||
y_end += line_height;
|
y_end += line_height;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -383,6 +383,8 @@ static inline bool ImIsPowerOfTwo(ImU64 v) { return v != 0 && (v &
|
|||||||
static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
||||||
|
|
||||||
// Helpers: String
|
// Helpers: String
|
||||||
|
#define ImStrlen strlen
|
||||||
|
#define ImMemchr memchr
|
||||||
IMGUI_API int ImStricmp(const char* str1, const char* str2); // Case insensitive compare.
|
IMGUI_API int ImStricmp(const char* str1, const char* str2); // Case insensitive compare.
|
||||||
IMGUI_API int ImStrnicmp(const char* str1, const char* str2, size_t count); // Case insensitive compare to a certain count.
|
IMGUI_API int ImStrnicmp(const char* str1, const char* str2, size_t count); // Case insensitive compare to a certain count.
|
||||||
IMGUI_API void ImStrncpy(char* dst, const char* src, size_t count); // Copy to a certain count and always zero terminate (strncpy doesn't).
|
IMGUI_API void ImStrncpy(char* dst, const char* src, size_t count); // Copy to a certain count and always zero terminate (strncpy doesn't).
|
||||||
@@ -3037,7 +3039,7 @@ struct IMGUI_API ImGuiTable
|
|||||||
{
|
{
|
||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
ImGuiTableFlags Flags;
|
ImGuiTableFlags Flags;
|
||||||
void* RawData; // Single allocation to hold Columns[], DisplayOrderToIndex[] and RowCellData[]
|
void* RawData; // Single allocation to hold Columns[], DisplayOrderToIndex[], and RowCellData[]
|
||||||
ImGuiTableTempData* TempData; // Transient data while table is active. Point within g.CurrentTableStack[]
|
ImGuiTableTempData* TempData; // Transient data while table is active. Point within g.CurrentTableStack[]
|
||||||
ImSpan<ImGuiTableColumn> Columns; // Point within RawData[]
|
ImSpan<ImGuiTableColumn> Columns; // Point within RawData[]
|
||||||
ImSpan<ImGuiTableColumnIdx> DisplayOrderToIndex; // Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)
|
ImSpan<ImGuiTableColumnIdx> DisplayOrderToIndex; // Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)
|
||||||
@@ -3051,7 +3053,7 @@ struct IMGUI_API ImGuiTable
|
|||||||
int ColumnsCount; // Number of columns declared in BeginTable()
|
int ColumnsCount; // Number of columns declared in BeginTable()
|
||||||
int CurrentRow;
|
int CurrentRow;
|
||||||
int CurrentColumn;
|
int CurrentColumn;
|
||||||
ImS16 InstanceCurrent; // Count of BeginTable() calls with same ID in the same frame (generally 0). This is a little bit similar to BeginCount for a window, but multiple table with same ID look are multiple tables, they are just synched.
|
ImS16 InstanceCurrent; // Count of BeginTable() calls with same ID in the same frame (generally 0). This is a little bit similar to BeginCount for a window, but multiple tables with the same ID are multiple tables, they are just synced.
|
||||||
ImS16 InstanceInteracted; // Mark which instance (generally 0) of the same ID is being interacted with
|
ImS16 InstanceInteracted; // Mark which instance (generally 0) of the same ID is being interacted with
|
||||||
float RowPosY1;
|
float RowPosY1;
|
||||||
float RowPosY2;
|
float RowPosY2;
|
||||||
@@ -3083,7 +3085,7 @@ struct IMGUI_API ImGuiTable
|
|||||||
float AngledHeadersHeight; // Set by TableAngledHeadersRow(), used in TableUpdateLayout()
|
float AngledHeadersHeight; // Set by TableAngledHeadersRow(), used in TableUpdateLayout()
|
||||||
float AngledHeadersSlope; // Set by TableAngledHeadersRow(), used in TableUpdateLayout()
|
float AngledHeadersSlope; // Set by TableAngledHeadersRow(), used in TableUpdateLayout()
|
||||||
ImRect OuterRect; // Note: for non-scrolling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
|
ImRect OuterRect; // Note: for non-scrolling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
|
||||||
ImRect InnerRect; // InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is
|
ImRect InnerRect; // InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is "
|
||||||
ImRect WorkRect;
|
ImRect WorkRect;
|
||||||
ImRect InnerClipRect;
|
ImRect InnerClipRect;
|
||||||
ImRect BgClipRect; // We use this to cpu-clip cell background color fill, evolve during the frame as we cross frozen rows boundaries
|
ImRect BgClipRect; // We use this to cpu-clip cell background color fill, evolve during the frame as we cross frozen rows boundaries
|
||||||
|
|||||||
+3
-3
@@ -977,7 +977,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
// [Part 4] Apply final widths based on requested widths
|
// [Part 4] Apply final widths based on requested widths
|
||||||
const ImRect work_rect = table->WorkRect;
|
const ImRect work_rect = table->WorkRect;
|
||||||
const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1);
|
const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1);
|
||||||
const float width_removed = (table->HasScrollbarYPrev && !table->InnerWindow->ScrollbarY) ? g.Style.ScrollbarSize : 0.0f; // To synchronize decoration width of synched tables with mismatching scrollbar state (#5920)
|
const float width_removed = (table->HasScrollbarYPrev && !table->InnerWindow->ScrollbarY) ? g.Style.ScrollbarSize : 0.0f; // To synchronize decoration width of synced tables with mismatching scrollbar state (#5920)
|
||||||
const float width_avail = ImMax(1.0f, (((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth()) - width_removed);
|
const float width_avail = ImMax(1.0f, (((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth()) - width_removed);
|
||||||
const float width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests;
|
const float width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests;
|
||||||
float width_remaining_for_stretched_columns = width_avail_for_stretched_columns;
|
float width_remaining_for_stretched_columns = width_avail_for_stretched_columns;
|
||||||
@@ -1390,7 +1390,7 @@ void ImGui::EndTable()
|
|||||||
|
|
||||||
// Setup inner scrolling range
|
// Setup inner scrolling range
|
||||||
// FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y,
|
// FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y,
|
||||||
// but since the later is likely to be impossible to do we'd rather update both axises together.
|
// but since the later is likely to be impossible to do we'd rather update both axes together.
|
||||||
if (table->Flags & ImGuiTableFlags_ScrollX)
|
if (table->Flags & ImGuiTableFlags_ScrollX)
|
||||||
{
|
{
|
||||||
const float outer_padding_for_border = (table->Flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;
|
const float outer_padding_for_border = (table->Flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;
|
||||||
@@ -1648,7 +1648,7 @@ void ImGui::TableSetupColumn(const char* label, ImGuiTableColumnFlags flags, flo
|
|||||||
if (label != NULL && label[0] != 0)
|
if (label != NULL && label[0] != 0)
|
||||||
{
|
{
|
||||||
column->NameOffset = (ImS16)table->ColumnsNames.size();
|
column->NameOffset = (ImS16)table->ColumnsNames.size();
|
||||||
table->ColumnsNames.append(label, label + strlen(label) + 1);
|
table->ColumnsNames.append(label, label + ImStrlen(label) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+25
-25
@@ -169,7 +169,7 @@ void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags)
|
|||||||
// Calculate length
|
// Calculate length
|
||||||
const char* text_begin = text;
|
const char* text_begin = text;
|
||||||
if (text_end == NULL)
|
if (text_end == NULL)
|
||||||
text_end = text + strlen(text); // FIXME-OPT
|
text_end = text + ImStrlen(text); // FIXME-OPT
|
||||||
|
|
||||||
const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
|
const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
|
||||||
const float wrap_pos_x = window->DC.TextWrapPos;
|
const float wrap_pos_x = window->DC.TextWrapPos;
|
||||||
@@ -209,7 +209,7 @@ void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags)
|
|||||||
int lines_skipped = 0;
|
int lines_skipped = 0;
|
||||||
while (line < text_end && lines_skipped < lines_skippable)
|
while (line < text_end && lines_skipped < lines_skippable)
|
||||||
{
|
{
|
||||||
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
const char* line_end = (const char*)ImMemchr(line, '\n', text_end - line);
|
||||||
if (!line_end)
|
if (!line_end)
|
||||||
line_end = text_end;
|
line_end = text_end;
|
||||||
if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
|
if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
|
||||||
@@ -230,7 +230,7 @@ void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags)
|
|||||||
if (IsClippedEx(line_rect, 0))
|
if (IsClippedEx(line_rect, 0))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
const char* line_end = (const char*)ImMemchr(line, '\n', text_end - line);
|
||||||
if (!line_end)
|
if (!line_end)
|
||||||
line_end = text_end;
|
line_end = text_end;
|
||||||
text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
|
text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
|
||||||
@@ -245,7 +245,7 @@ void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags)
|
|||||||
int lines_skipped = 0;
|
int lines_skipped = 0;
|
||||||
while (line < text_end)
|
while (line < text_end)
|
||||||
{
|
{
|
||||||
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
const char* line_end = (const char*)ImMemchr(line, '\n', text_end - line);
|
||||||
if (!line_end)
|
if (!line_end)
|
||||||
line_end = text_end;
|
line_end = text_end;
|
||||||
if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
|
if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
|
||||||
@@ -2070,7 +2070,7 @@ static const char* Items_SingleStringGetter(void* data, int idx)
|
|||||||
{
|
{
|
||||||
if (idx == items_count)
|
if (idx == items_count)
|
||||||
break;
|
break;
|
||||||
p += strlen(p) + 1;
|
p += ImStrlen(p) + 1;
|
||||||
items_count++;
|
items_count++;
|
||||||
}
|
}
|
||||||
return *p ? p : NULL;
|
return *p ? p : NULL;
|
||||||
@@ -2138,7 +2138,7 @@ bool ImGui::Combo(const char* label, int* current_item, const char* items_separa
|
|||||||
const char* p = items_separated_by_zeros; // FIXME-OPT: Avoid computing this, or at least only when combo is open
|
const char* p = items_separated_by_zeros; // FIXME-OPT: Avoid computing this, or at least only when combo is open
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
p += strlen(p) + 1;
|
p += ImStrlen(p) + 1;
|
||||||
items_count++;
|
items_count++;
|
||||||
}
|
}
|
||||||
bool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items);
|
bool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items);
|
||||||
@@ -2648,7 +2648,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
|||||||
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
||||||
if (!temp_input_is_active)
|
if (!temp_input_is_active)
|
||||||
{
|
{
|
||||||
// Tabbing or CTRL-clicking on Drag turns it into an InputText
|
// Tabbing or CTRL+click on Drag turns it into an InputText
|
||||||
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
||||||
const bool double_clicked = (hovered && g.IO.MouseClickedCount[0] == 2 && TestKeyOwner(ImGuiKey_MouseLeft, id));
|
const bool double_clicked = (hovered && g.IO.MouseClickedCount[0] == 2 && TestKeyOwner(ImGuiKey_MouseLeft, id));
|
||||||
const bool make_active = (clicked || double_clicked || g.NavActivateId == id);
|
const bool make_active = (clicked || double_clicked || g.NavActivateId == id);
|
||||||
@@ -3252,7 +3252,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
|||||||
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
||||||
if (!temp_input_is_active)
|
if (!temp_input_is_active)
|
||||||
{
|
{
|
||||||
// Tabbing or CTRL-clicking on Slider turns it into an input box
|
// Tabbing or CTRL+click on Slider turns it into an input box
|
||||||
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
||||||
const bool make_active = (clicked || g.NavActivateId == id);
|
const bool make_active = (clicked || g.NavActivateId == id);
|
||||||
if (make_active && clicked)
|
if (make_active && clicked)
|
||||||
@@ -3905,7 +3905,7 @@ static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char**
|
|||||||
line_count++;
|
line_count++;
|
||||||
if (s_eol == NULL)
|
if (s_eol == NULL)
|
||||||
{
|
{
|
||||||
s = s + strlen(s);
|
s = s + ImStrlen(s);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s = s_eol + 1;
|
s = s_eol + 1;
|
||||||
@@ -4193,7 +4193,7 @@ void ImGuiInputTextState::OnCharPressed(unsigned int c)
|
|||||||
// The changes we had to make to stb_textedit_key made it very much UTF-8 specific which is not too great.
|
// The changes we had to make to stb_textedit_key made it very much UTF-8 specific which is not too great.
|
||||||
char utf8[5];
|
char utf8[5];
|
||||||
ImTextCharToUtf8(utf8, c);
|
ImTextCharToUtf8(utf8, c);
|
||||||
stb_textedit_text(this, Stb, utf8, (int)strlen(utf8));
|
stb_textedit_text(this, Stb, utf8, (int)ImStrlen(utf8));
|
||||||
CursorFollow = true;
|
CursorFollow = true;
|
||||||
CursorAnimReset();
|
CursorAnimReset();
|
||||||
}
|
}
|
||||||
@@ -4244,7 +4244,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons
|
|||||||
|
|
||||||
// Grow internal buffer if needed
|
// Grow internal buffer if needed
|
||||||
const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0;
|
const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0;
|
||||||
const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text);
|
const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)ImStrlen(new_text);
|
||||||
if (new_text_len + BufTextLen >= BufSize)
|
if (new_text_len + BufTextLen >= BufSize)
|
||||||
{
|
{
|
||||||
if (!is_resizable)
|
if (!is_resizable)
|
||||||
@@ -4566,7 +4566,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
const bool init_state = (init_make_active || user_scroll_active);
|
const bool init_state = (init_make_active || user_scroll_active);
|
||||||
if (init_reload_from_user_buf)
|
if (init_reload_from_user_buf)
|
||||||
{
|
{
|
||||||
int new_len = (int)strlen(buf);
|
int new_len = (int)ImStrlen(buf);
|
||||||
IM_ASSERT(new_len + 1 <= buf_size && "Is your input buffer properly zero-terminated?");
|
IM_ASSERT(new_len + 1 <= buf_size && "Is your input buffer properly zero-terminated?");
|
||||||
state->WantReloadUserBuf = false;
|
state->WantReloadUserBuf = false;
|
||||||
InputTextReconcileUndoState(state, state->TextA.Data, state->TextLen, buf, new_len);
|
InputTextReconcileUndoState(state, state->TextA.Data, state->TextLen, buf, new_len);
|
||||||
@@ -4588,7 +4588,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
|
|
||||||
// Take a copy of the initial buffer value.
|
// Take a copy of the initial buffer value.
|
||||||
// From the moment we focused we are normally ignoring the content of 'buf' (unless we are in read-only mode)
|
// From the moment we focused we are normally ignoring the content of 'buf' (unless we are in read-only mode)
|
||||||
const int buf_len = (int)strlen(buf);
|
const int buf_len = (int)ImStrlen(buf);
|
||||||
IM_ASSERT(buf_len + 1 <= buf_size && "Is your input buffer properly zero-terminated?");
|
IM_ASSERT(buf_len + 1 <= buf_size && "Is your input buffer properly zero-terminated?");
|
||||||
state->TextToRevertTo.resize(buf_len + 1); // UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string.
|
state->TextToRevertTo.resize(buf_len + 1); // UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string.
|
||||||
memcpy(state->TextToRevertTo.Data, buf, buf_len + 1);
|
memcpy(state->TextToRevertTo.Data, buf, buf_len + 1);
|
||||||
@@ -4673,7 +4673,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
|
|
||||||
// Read-only mode always ever read from source buffer. Refresh TextLen when active.
|
// Read-only mode always ever read from source buffer. Refresh TextLen when active.
|
||||||
if (is_readonly && state != NULL)
|
if (is_readonly && state != NULL)
|
||||||
state->TextLen = (int)strlen(buf);
|
state->TextLen = (int)ImStrlen(buf);
|
||||||
//if (is_readonly && state != NULL)
|
//if (is_readonly && state != NULL)
|
||||||
// state->TextA.clear(); // Uncomment to facilitate debugging, but we otherwise prefer to keep/amortize th allocation.
|
// state->TextA.clear(); // Uncomment to facilitate debugging, but we otherwise prefer to keep/amortize th allocation.
|
||||||
}
|
}
|
||||||
@@ -4952,7 +4952,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (const char* clipboard = GetClipboardText())
|
if (const char* clipboard = GetClipboardText())
|
||||||
{
|
{
|
||||||
// Filter pasted buffer
|
// Filter pasted buffer
|
||||||
const int clipboard_len = (int)strlen(clipboard);
|
const int clipboard_len = (int)ImStrlen(clipboard);
|
||||||
ImVector<char> clipboard_filtered;
|
ImVector<char> clipboard_filtered;
|
||||||
clipboard_filtered.reserve(clipboard_len + 1);
|
clipboard_filtered.reserve(clipboard_len + 1);
|
||||||
for (const char* s = clipboard; *s != 0; )
|
for (const char* s = clipboard; *s != 0; )
|
||||||
@@ -4964,7 +4964,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
continue;
|
continue;
|
||||||
char c_utf8[5];
|
char c_utf8[5];
|
||||||
ImTextCharToUtf8(c_utf8, c);
|
ImTextCharToUtf8(c_utf8, c);
|
||||||
int out_len = (int)strlen(c_utf8);
|
int out_len = (int)ImStrlen(c_utf8);
|
||||||
clipboard_filtered.resize(clipboard_filtered.Size + out_len);
|
clipboard_filtered.resize(clipboard_filtered.Size + out_len);
|
||||||
memcpy(clipboard_filtered.Data + clipboard_filtered.Size - out_len, c_utf8, out_len);
|
memcpy(clipboard_filtered.Data + clipboard_filtered.Size - out_len, c_utf8, out_len);
|
||||||
}
|
}
|
||||||
@@ -5094,7 +5094,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (buf_dirty)
|
if (buf_dirty)
|
||||||
{
|
{
|
||||||
// Callback may update buffer and thus set buf_dirty even in read-only mode.
|
// Callback may update buffer and thus set buf_dirty even in read-only mode.
|
||||||
IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text!
|
IM_ASSERT(callback_data.BufTextLen == (int)ImStrlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text!
|
||||||
InputTextReconcileUndoState(state, state->CallbackTextBackup.Data, state->CallbackTextBackup.Size - 1, callback_data.Buf, callback_data.BufTextLen);
|
InputTextReconcileUndoState(state, state->CallbackTextBackup.Data, state->CallbackTextBackup.Size - 1, callback_data.Buf, callback_data.BufTextLen);
|
||||||
state->TextLen = callback_data.BufTextLen; // Assume correct length and valid UTF-8 from user, saves us an extra strlen()
|
state->TextLen = callback_data.BufTextLen; // Assume correct length and valid UTF-8 from user, saves us an extra strlen()
|
||||||
state->CursorAnimReset();
|
state->CursorAnimReset();
|
||||||
@@ -5193,7 +5193,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (is_displaying_hint)
|
if (is_displaying_hint)
|
||||||
{
|
{
|
||||||
buf_display = hint;
|
buf_display = hint;
|
||||||
buf_display_end = hint + strlen(hint);
|
buf_display_end = hint + ImStrlen(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render text. We currently only render selection when the widget is active or while scrolling.
|
// Render text. We currently only render selection when the widget is active or while scrolling.
|
||||||
@@ -5226,7 +5226,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
int line_count = 1;
|
int line_count = 1;
|
||||||
if (is_multiline)
|
if (is_multiline)
|
||||||
{
|
{
|
||||||
for (const char* s = text_begin; (s = (const char*)memchr(s, '\n', (size_t)(text_end - s))) != NULL; s++)
|
for (const char* s = text_begin; (s = (const char*)ImMemchr(s, '\n', (size_t)(text_end - s))) != NULL; s++)
|
||||||
{
|
{
|
||||||
if (cursor_line_no == -1 && s >= cursor_ptr) { cursor_line_no = line_count; }
|
if (cursor_line_no == -1 && s >= cursor_ptr) { cursor_line_no = line_count; }
|
||||||
if (selmin_line_no == -1 && s >= selmin_ptr) { selmin_line_no = line_count; }
|
if (selmin_line_no == -1 && s >= selmin_ptr) { selmin_line_no = line_count; }
|
||||||
@@ -5304,7 +5304,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
break;
|
break;
|
||||||
if (rect_pos.y < clip_rect.y)
|
if (rect_pos.y < clip_rect.y)
|
||||||
{
|
{
|
||||||
p = (const char*)memchr((void*)p, '\n', text_selected_end - p);
|
p = (const char*)ImMemchr((void*)p, '\n', text_selected_end - p);
|
||||||
p = p ? p + 1 : text_selected_end;
|
p = p ? p + 1 : text_selected_end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5357,7 +5357,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
else if (!is_displaying_hint && g.ActiveId == id)
|
else if (!is_displaying_hint && g.ActiveId == id)
|
||||||
buf_display_end = buf_display + state->TextLen;
|
buf_display_end = buf_display + state->TextLen;
|
||||||
else if (!is_displaying_hint)
|
else if (!is_displaying_hint)
|
||||||
buf_display_end = buf_display + strlen(buf_display);
|
buf_display_end = buf_display + ImStrlen(buf_display);
|
||||||
|
|
||||||
if (is_multiline || (buf_display_end - buf_display) < buf_display_max_length)
|
if (is_multiline || (buf_display_end - buf_display) < buf_display_max_length)
|
||||||
{
|
{
|
||||||
@@ -5502,7 +5502,7 @@ static void ColorEditRestoreHS(const float* col, float* H, float* S, float* V)
|
|||||||
|
|
||||||
// Edit colors components (each component in 0.0f..1.0f range).
|
// Edit colors components (each component in 0.0f..1.0f range).
|
||||||
// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
|
// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
|
||||||
// With typical options: Left-click on color square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item.
|
// With typical options: Left-click on color square to open color picker. Right-click to open option menu. CTRL+Click over input fields to edit them and TAB to go to next item.
|
||||||
bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags)
|
bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
@@ -7191,7 +7191,7 @@ ImGuiTypingSelectRequest* ImGui::GetTypingSelectRequest(ImGuiTypingSelectFlags f
|
|||||||
|
|
||||||
// Append to buffer
|
// Append to buffer
|
||||||
const int buffer_max_len = IM_ARRAYSIZE(data->SearchBuffer) - 1;
|
const int buffer_max_len = IM_ARRAYSIZE(data->SearchBuffer) - 1;
|
||||||
int buffer_len = (int)strlen(data->SearchBuffer);
|
int buffer_len = (int)ImStrlen(data->SearchBuffer);
|
||||||
bool select_request = false;
|
bool select_request = false;
|
||||||
for (ImWchar w : g.IO.InputQueueCharacters)
|
for (ImWchar w : g.IO.InputQueueCharacters)
|
||||||
{
|
{
|
||||||
@@ -8910,7 +8910,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
|||||||
const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_NoSetKeyOwner | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_NoAutoClosePopups;
|
const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_NoSetKeyOwner | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_NoAutoClosePopups;
|
||||||
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
|
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
|
||||||
{
|
{
|
||||||
// Menu inside an horizontal menu bar
|
// Menu inside a horizontal menu bar
|
||||||
// Selectable extend their highlight by half ItemSpacing in each direction.
|
// Selectable extend their highlight by half ItemSpacing in each direction.
|
||||||
// For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()
|
// For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()
|
||||||
popup_pos = ImVec2(pos.x - 1.0f - IM_TRUNC(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight);
|
popup_pos = ImVec2(pos.x - 1.0f - IM_TRUNC(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight);
|
||||||
@@ -10170,7 +10170,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
|
tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
|
||||||
tab_bar->TabsNames.append(label, label + strlen(label) + 1);
|
tab_bar->TabsNames.append(label, label + ImStrlen(label) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update selected tab
|
// Update selected tab
|
||||||
|
|||||||
Reference in New Issue
Block a user