update Dear ImGui to 1.90.4
This commit is contained in:
parent
61e29b6245
commit
a5007e813f
|
@ -581,7 +581,7 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform side (optional)
|
io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform side (optional)
|
||||||
#endif
|
#endif
|
||||||
#if GLFW_HAS_MOUSE_PASSTHROUGH || (GLFW_HAS_WINDOW_HOVERED && defined(_WIN32))
|
#if GLFW_HAS_MOUSE_PASSTHROUGH || GLFW_HAS_WINDOW_HOVERED
|
||||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; // We can call io.AddMouseViewportEvent() with correct data (optional)
|
io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; // We can call io.AddMouseViewportEvent() with correct data (optional)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -748,7 +748,8 @@ static void ImGui_ImplGlfw_UpdateMouseData()
|
||||||
|
|
||||||
// (Optional) When using multiple viewports: call io.AddMouseViewportEvent() with the viewport the OS mouse cursor is hovering.
|
// (Optional) When using multiple viewports: call io.AddMouseViewportEvent() with the viewport the OS mouse cursor is hovering.
|
||||||
// If ImGuiBackendFlags_HasMouseHoveredViewport is not set by the backend, Dear imGui will ignore this field and infer the information using its flawed heuristic.
|
// If ImGuiBackendFlags_HasMouseHoveredViewport is not set by the backend, Dear imGui will ignore this field and infer the information using its flawed heuristic.
|
||||||
// - [X] GLFW >= 3.3 backend ON WINDOWS ONLY does correctly ignore viewports with the _NoInputs flag.
|
// - [X] GLFW >= 3.3 backend ON WINDOWS ONLY does correctly ignore viewports with the _NoInputs flag (since we implement hit via our WndProc hook)
|
||||||
|
// On other platforms we rely on the library fallbacking to its own search when reporting a viewport with _NoInputs flag.
|
||||||
// - [!] GLFW <= 3.2 backend CANNOT correctly ignore viewports with the _NoInputs flag, and CANNOT reported Hovered Viewport because of mouse capture.
|
// - [!] GLFW <= 3.2 backend CANNOT correctly ignore viewports with the _NoInputs flag, and CANNOT reported Hovered Viewport because of mouse capture.
|
||||||
// Some backend are not able to handle that correctly. If a backend report an hovered viewport that has the _NoInputs flag (e.g. when dragging a window
|
// Some backend are not able to handle that correctly. If a backend report an hovered viewport that has the _NoInputs flag (e.g. when dragging a window
|
||||||
// for docking, the viewport has the _NoInputs flag in order to allow us to find the viewport under), then Dear ImGui is forced to ignore the value reported
|
// for docking, the viewport has the _NoInputs flag in order to allow us to find the viewport under), then Dear ImGui is forced to ignore the value reported
|
||||||
|
@ -756,12 +757,12 @@ static void ImGui_ImplGlfw_UpdateMouseData()
|
||||||
// - [X] GLFW backend correctly reports this regardless of another viewport behind focused and dragged from (we need this to find a useful drag and drop target).
|
// - [X] GLFW backend correctly reports this regardless of another viewport behind focused and dragged from (we need this to find a useful drag and drop target).
|
||||||
// FIXME: This is currently only correct on Win32. See what we do below with the WM_NCHITTEST, missing an equivalent for other systems.
|
// FIXME: This is currently only correct on Win32. See what we do below with the WM_NCHITTEST, missing an equivalent for other systems.
|
||||||
// See https://github.com/glfw/glfw/issues/1236 if you want to help in making this a GLFW feature.
|
// See https://github.com/glfw/glfw/issues/1236 if you want to help in making this a GLFW feature.
|
||||||
#if GLFW_HAS_MOUSE_PASSTHROUGH || (GLFW_HAS_WINDOW_HOVERED && defined(_WIN32))
|
|
||||||
const bool window_no_input = (viewport->Flags & ImGuiViewportFlags_NoInputs) != 0;
|
|
||||||
#if GLFW_HAS_MOUSE_PASSTHROUGH
|
#if GLFW_HAS_MOUSE_PASSTHROUGH
|
||||||
|
const bool window_no_input = (viewport->Flags & ImGuiViewportFlags_NoInputs) != 0;
|
||||||
glfwSetWindowAttrib(window, GLFW_MOUSE_PASSTHROUGH, window_no_input);
|
glfwSetWindowAttrib(window, GLFW_MOUSE_PASSTHROUGH, window_no_input);
|
||||||
#endif
|
#endif
|
||||||
if (glfwGetWindowAttrib(window, GLFW_HOVERED) && !window_no_input)
|
#if GLFW_HAS_MOUSE_PASSTHROUGH || GLFW_HAS_WINDOW_HOVERED
|
||||||
|
if (glfwGetWindowAttrib(window, GLFW_HOVERED))
|
||||||
mouse_viewport_id = viewport->ID;
|
mouse_viewport_id = viewport->ID;
|
||||||
#else
|
#else
|
||||||
// We cannot use bd->MouseWindow maintained from CursorEnter/Leave callbacks, because it is locked to the window capturing mouse.
|
// We cannot use bd->MouseWindow maintained from CursorEnter/Leave callbacks, because it is locked to the window capturing mouse.
|
||||||
|
|
|
@ -571,7 +571,6 @@ static void ImGui_ImplOSX_UpdateMouseCursor()
|
||||||
static void ImGui_ImplOSX_UpdateGamepads()
|
static void ImGui_ImplOSX_UpdateGamepads()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
memset(io.NavInputs, 0, sizeof(io.NavInputs));
|
|
||||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0) // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0) // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1667,13 +1667,17 @@ static void ImGui_ImplVulkan_CreateWindow(ImGuiViewport* viewport)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select Surface Format
|
// Select Surface Format
|
||||||
const VkFormat requestSurfaceImageFormat[] = {
|
ImVector<VkFormat> requestSurfaceImageFormats;
|
||||||
#if defined(IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING)
|
#ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING
|
||||||
v->UseDynamicRendering && v->ColorAttachmentFormat ? v->ColorAttachmentFormat : VK_FORMAT_B8G8R8A8_UNORM,
|
for (uint32_t n = 0; n < v->PipelineRenderingCreateInfo.colorAttachmentCount; n++)
|
||||||
|
requestSurfaceImageFormats.push_back(v->PipelineRenderingCreateInfo.pColorAttachmentFormats[n]);
|
||||||
#endif
|
#endif
|
||||||
VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
|
const VkFormat defaultFormats[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
|
||||||
|
for (VkFormat format : defaultFormats)
|
||||||
|
requestSurfaceImageFormats.push_back(format);
|
||||||
|
|
||||||
const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
|
const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
|
||||||
wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(v->PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);
|
wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(v->PhysicalDevice, wd->Surface, requestSurfaceImageFormats.Data, (size_t)requestSurfaceImageFormats.Size, requestSurfaceColorSpace);
|
||||||
|
|
||||||
// Select Present Mode
|
// Select Present Mode
|
||||||
// FIXME-VULKAN: Even thought mailbox seems to get us maximum framerate with a single window, it halves framerate with a second window etc. (w/ Nvidia and SDK 1.82.1)
|
// FIXME-VULKAN: Even thought mailbox seems to get us maximum framerate with a single window, it halves framerate with a second window etc. (w/ Nvidia and SDK 1.82.1)
|
||||||
|
|
78
extern/imgui_patched/imgui.cpp
vendored
78
extern/imgui_patched/imgui.cpp
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.90.3
|
// dear imgui, v1.90.4
|
||||||
// (main code and documentation)
|
// (main code and documentation)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
|
@ -925,7 +925,7 @@ CODE
|
||||||
Q: How can I easily use icons in my application?
|
Q: How can I easily use icons in my application?
|
||||||
Q: How can I load multiple fonts?
|
Q: How can I load multiple fonts?
|
||||||
Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
||||||
>> See https://www.dearimgui.com/faq and https://github.com/ocornut/imgui/edit/master/docs/FONTS.md
|
>> See https://www.dearimgui.com/faq and https://github.com/ocornut/imgui/blob/master/docs/FONTS.md
|
||||||
|
|
||||||
Q&A: Concerns
|
Q&A: Concerns
|
||||||
=============
|
=============
|
||||||
|
@ -3119,13 +3119,14 @@ const ImVec4& ImGui::GetStyleColorVec4(ImGuiCol idx)
|
||||||
return style.Colors[idx];
|
return style.Colors[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
ImU32 ImGui::GetColorU32(ImU32 col)
|
ImU32 ImGui::GetColorU32(ImU32 col, float alpha_mul)
|
||||||
{
|
{
|
||||||
ImGuiStyle& style = GImGui->Style;
|
ImGuiStyle& style = GImGui->Style;
|
||||||
if (style.Alpha >= 1.0f)
|
alpha_mul *= style.Alpha;
|
||||||
|
if (alpha_mul >= 1.0f)
|
||||||
return col;
|
return col;
|
||||||
ImU32 a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT;
|
ImU32 a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT;
|
||||||
a = (ImU32)(a * style.Alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range.
|
a = (ImU32)(a * alpha_mul); // We don't need to clamp 0..255 because alpha is in 0..1 range.
|
||||||
return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);
|
return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5358,7 +5359,7 @@ static void ImGui::RenderDimmedBackgrounds()
|
||||||
{
|
{
|
||||||
// Draw dimming behind modal or a begin stack child, whichever comes first in draw order.
|
// Draw dimming behind modal or a begin stack child, whichever comes first in draw order.
|
||||||
ImGuiWindow* dim_behind_window = FindBottomMostVisibleWindowWithinBeginStack(modal_window);
|
ImGuiWindow* dim_behind_window = FindBottomMostVisibleWindowWithinBeginStack(modal_window);
|
||||||
RenderDimmedBackgroundBehindWindow(dim_behind_window, GetColorU32(ImGuiCol_ModalWindowDimBg, g.DimBgRatio));
|
RenderDimmedBackgroundBehindWindow(dim_behind_window, GetColorU32(modal_window->DC.ModalDimBgColor, g.DimBgRatio));
|
||||||
viewports_already_dimmed[0] = modal_window->Viewport;
|
viewports_already_dimmed[0] = modal_window->Viewport;
|
||||||
}
|
}
|
||||||
else if (dim_bg_for_window_list)
|
else if (dim_bg_for_window_list)
|
||||||
|
@ -6104,22 +6105,25 @@ static ImGuiWindow* GetWindowForTitleAndMenuHeight(ImGuiWindow* window)
|
||||||
|
|
||||||
static inline ImVec2 CalcWindowMinSize(ImGuiWindow* window)
|
static inline ImVec2 CalcWindowMinSize(ImGuiWindow* window)
|
||||||
{
|
{
|
||||||
// Popups, menus and childs bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
|
// We give windows non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
|
||||||
// FIXME: the if/else could probably be removed, "reduce artifacts" section for all windows.
|
// FIXME: Essentially we want to restrict manual resizing to WindowMinSize+Decoration, and allow api resizing to be smaller.
|
||||||
|
// Perhaps should tend further a neater test for this.
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImVec2 size_min;
|
ImVec2 size_min;
|
||||||
if (window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_ChildWindow))
|
if ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup))
|
||||||
{
|
{
|
||||||
size_min.x = (window->ChildFlags & ImGuiChildFlags_ResizeX) ? g.Style.WindowMinSize.x : 4.0f;
|
size_min.x = (window->ChildFlags & ImGuiChildFlags_ResizeX) ? g.Style.WindowMinSize.x : 4.0f;
|
||||||
size_min.y = (window->ChildFlags & ImGuiChildFlags_ResizeY) ? g.Style.WindowMinSize.y : 4.0f;
|
size_min.y = (window->ChildFlags & ImGuiChildFlags_ResizeY) ? g.Style.WindowMinSize.y : 4.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGuiWindow* window_for_height = GetWindowForTitleAndMenuHeight(window);
|
|
||||||
size_min.x = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.x : 4.0f;
|
size_min.x = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.x : 4.0f;
|
||||||
size_min.y = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.y : 4.0f;
|
size_min.y = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.y : 4.0f;
|
||||||
size_min.y = ImMax(size_min.y, window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reduce artifacts with very small windows
|
||||||
|
ImGuiWindow* window_for_height = GetWindowForTitleAndMenuHeight(window);
|
||||||
|
size_min.y = ImMax(size_min.y, window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f));
|
||||||
return size_min;
|
return size_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7391,7 +7395,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags, const
|
||||||
// Handle manual resize: Resize Grips, Borders, Gamepad
|
// Handle manual resize: Resize Grips, Borders, Gamepad
|
||||||
int border_hovered = -1, border_held = -1;
|
int border_hovered = -1, border_held = -1;
|
||||||
ImU32 resize_grip_col[4] = {};
|
ImU32 resize_grip_col[4] = {};
|
||||||
const int resize_grip_count = (window->Flags & ImGuiWindowFlags_ChildWindow) ? 0 : g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // Allow resize from lower-left if we have the mouse cursor feedback for it.
|
const int resize_grip_count = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup)) ? 0 : g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // Allow resize from lower-left if we have the mouse cursor feedback for it.
|
||||||
const float resize_grip_draw_size = IM_TRUNC(ImMax(g.FontSize * 1.10f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));
|
const float resize_grip_draw_size = IM_TRUNC(ImMax(g.FontSize * 1.10f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));
|
||||||
if (handle_borders_and_resize_grips && !window->Collapsed)
|
if (handle_borders_and_resize_grips && !window->Collapsed)
|
||||||
if (int auto_fit_mask = UpdateWindowManualResize(window, size_auto_fit, &border_hovered, &border_held, resize_grip_count, &resize_grip_col[0], visibility_rect))
|
if (int auto_fit_mask = UpdateWindowManualResize(window, size_auto_fit, &border_hovered, &border_held, resize_grip_count, &resize_grip_col[0], visibility_rect))
|
||||||
|
@ -7676,6 +7680,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags, const
|
||||||
window->DC.TextWrapPos = -1.0f; // disabled
|
window->DC.TextWrapPos = -1.0f; // disabled
|
||||||
window->DC.ItemWidthStack.resize(0);
|
window->DC.ItemWidthStack.resize(0);
|
||||||
window->DC.TextWrapPosStack.resize(0);
|
window->DC.TextWrapPosStack.resize(0);
|
||||||
|
if (flags & ImGuiWindowFlags_Modal)
|
||||||
|
window->DC.ModalDimBgColor = ColorConvertFloat4ToU32(GetStyleColorVec4(ImGuiCol_ModalWindowDimBg));
|
||||||
|
|
||||||
if (window->AutoFitFramesX > 0)
|
if (window->AutoFitFramesX > 0)
|
||||||
window->AutoFitFramesX--;
|
window->AutoFitFramesX--;
|
||||||
|
@ -11743,7 +11749,7 @@ void ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Reopen: close child popups if any, then flag popup for open/reopen (set position, focus, init navigation)
|
// Reopen: close child popups if any, then flag popup for open/reopen (set position, focus, init navigation)
|
||||||
ClosePopupToLevel(current_stack_size, false);
|
ClosePopupToLevel(current_stack_size, true);
|
||||||
g.OpenPopupStack.push_back(popup_ref);
|
g.OpenPopupStack.push_back(popup_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12475,25 +12481,28 @@ static void ImGui::NavProcessItem()
|
||||||
|
|
||||||
// Process Move Request (scoring for navigation)
|
// Process Move Request (scoring for navigation)
|
||||||
// FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRect + scoring from a rect wrapped according to current wrapping policy)
|
// FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRect + scoring from a rect wrapped according to current wrapping policy)
|
||||||
if (g.NavMoveScoringItems && (item_flags & ImGuiItemFlags_Disabled) == 0 && (window->Flags & ImGuiWindowFlags_NoNavInputs) == 0)
|
if (g.NavMoveScoringItems && (item_flags & ImGuiItemFlags_Disabled) == 0)
|
||||||
{
|
{
|
||||||
const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) != 0;
|
if ((g.NavMoveFlags & ImGuiNavMoveFlags_FocusApi) || (window->Flags & ImGuiWindowFlags_NoNavInputs) == 0)
|
||||||
if (is_tabbing)
|
|
||||||
{
|
{
|
||||||
NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags);
|
const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) != 0;
|
||||||
}
|
if (is_tabbing)
|
||||||
else if (g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId))
|
{
|
||||||
{
|
NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags);
|
||||||
ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther;
|
}
|
||||||
if (NavScoreItem(result))
|
else if (g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId))
|
||||||
NavApplyItemToResult(result);
|
{
|
||||||
|
ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther;
|
||||||
|
if (NavScoreItem(result))
|
||||||
|
NavApplyItemToResult(result);
|
||||||
|
|
||||||
// Features like PageUp/PageDown need to maintain a separate score for the visible set of items.
|
// Features like PageUp/PageDown need to maintain a separate score for the visible set of items.
|
||||||
const float VISIBLE_RATIO = 0.70f;
|
const float VISIBLE_RATIO = 0.70f;
|
||||||
if ((g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb))
|
if ((g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb))
|
||||||
if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO)
|
if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO)
|
||||||
if (NavScoreItem(&g.NavMoveResultLocalVisible))
|
if (NavScoreItem(&g.NavMoveResultLocalVisible))
|
||||||
NavApplyItemToResult(&g.NavMoveResultLocalVisible);
|
NavApplyItemToResult(&g.NavMoveResultLocalVisible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21154,7 +21163,7 @@ void ImGui::DebugNodeFont(ImFont* font)
|
||||||
SetNextItemWidth(GetFontSize() * 8);
|
SetNextItemWidth(GetFontSize() * 8);
|
||||||
DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f");
|
DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f");
|
||||||
SameLine(); MetricsHelpMarker(
|
SameLine(); MetricsHelpMarker(
|
||||||
"Note than the default embedded font is NOT meant to be scaled.\n\n"
|
"Note that the default embedded font is NOT meant to be scaled.\n\n"
|
||||||
"Font are currently rendered into bitmaps at a given size at the time of building the atlas. "
|
"Font are currently rendered into bitmaps at a given size at the time of building the atlas. "
|
||||||
"You may oversample them to get some flexibility with scaling. "
|
"You may oversample them to get some flexibility with scaling. "
|
||||||
"You can also render at multiple sizes and select which one to use at runtime.\n\n"
|
"You can also render at multiple sizes and select which one to use at runtime.\n\n"
|
||||||
|
@ -21638,6 +21647,12 @@ void ImGui::DebugLocateItemResolveWithLastItem()
|
||||||
draw_list->AddLine(p1, p2, DEBUG_LOCATE_ITEM_COLOR);
|
draw_list->AddLine(p1, p2, DEBUG_LOCATE_ITEM_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGui::DebugStartItemPicker()
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
g.DebugItemPickerActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
// [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack.
|
// [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack.
|
||||||
void ImGui::UpdateDebugToolItemPicker()
|
void ImGui::UpdateDebugToolItemPicker()
|
||||||
{
|
{
|
||||||
|
@ -21806,7 +21821,7 @@ void ImGui::ShowIDStackToolWindow(bool* p_open)
|
||||||
Checkbox("Ctrl+C: copy path to clipboard", &tool->CopyToClipboardOnCtrlC);
|
Checkbox("Ctrl+C: copy path to clipboard", &tool->CopyToClipboardOnCtrlC);
|
||||||
SameLine();
|
SameLine();
|
||||||
TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.f, 1.f, 0.3f, 1.f) : ImVec4(), "*COPIED*");
|
TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.f, 1.f, 0.3f, 1.f) : ImVec4(), "*COPIED*");
|
||||||
if (tool->CopyToClipboardOnCtrlC && IsKeyDown(ImGuiMod_Ctrl) && IsKeyPressed(ImGuiKey_C))
|
if (tool->CopyToClipboardOnCtrlC && Shortcut(ImGuiMod_Ctrl | ImGuiKey_C, 0, ImGuiInputFlags_RouteGlobal))
|
||||||
{
|
{
|
||||||
tool->CopyToClipboardLastTime = (float)g.Time;
|
tool->CopyToClipboardLastTime = (float)g.Time;
|
||||||
char* p = g.TempBuffer.Data;
|
char* p = g.TempBuffer.Data;
|
||||||
|
@ -21873,6 +21888,7 @@ void ImGui::DebugLog(const char*, ...) {}
|
||||||
void ImGui::DebugLogV(const char*, va_list) {}
|
void ImGui::DebugLogV(const char*, va_list) {}
|
||||||
void ImGui::ShowDebugLogWindow(bool*) {}
|
void ImGui::ShowDebugLogWindow(bool*) {}
|
||||||
void ImGui::ShowIDStackToolWindow(bool*) {}
|
void ImGui::ShowIDStackToolWindow(bool*) {}
|
||||||
|
void ImGui::DebugStartItemPicker() {}
|
||||||
void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {}
|
void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {}
|
||||||
|
|
||||||
#endif // #ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
#endif // #ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||||
|
|
12
extern/imgui_patched/imgui.h
vendored
12
extern/imgui_patched/imgui.h
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.90.3
|
// dear imgui, v1.90.4
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
// 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.90.3"
|
#define IMGUI_VERSION "1.90.4"
|
||||||
#define IMGUI_VERSION_NUM 19030
|
#define IMGUI_VERSION_NUM 19040
|
||||||
#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
|
||||||
|
@ -452,7 +452,7 @@ namespace ImGui
|
||||||
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
||||||
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImDrawList
|
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImDrawList
|
||||||
IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||||
IMGUI_API ImU32 GetColorU32(ImU32 col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
IMGUI_API ImU32 GetColorU32(ImU32 col, float alpha_mul = 1.0f); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||||
IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in.
|
IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in.
|
||||||
|
|
||||||
// Layout cursor positioning
|
// Layout cursor positioning
|
||||||
|
@ -1005,6 +1005,7 @@ namespace ImGui
|
||||||
// - Your main debugging friend is the ShowMetricsWindow() function, which is also accessible from Demo->Tools->Metrics Debugger
|
// - Your main debugging friend is the ShowMetricsWindow() function, which is also accessible from Demo->Tools->Metrics Debugger
|
||||||
IMGUI_API void DebugTextEncoding(const char* text);
|
IMGUI_API void DebugTextEncoding(const char* text);
|
||||||
IMGUI_API void DebugFlashStyleColor(ImGuiCol idx);
|
IMGUI_API void DebugFlashStyleColor(ImGuiCol idx);
|
||||||
|
IMGUI_API void DebugStartItemPicker();
|
||||||
IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx); // This is called by IMGUI_CHECKVERSION() macro.
|
IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx); // This is called by IMGUI_CHECKVERSION() macro.
|
||||||
|
|
||||||
// Memory Allocators
|
// Memory Allocators
|
||||||
|
@ -2925,7 +2926,8 @@ struct ImDrawList
|
||||||
IMGUI_API void AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawFlags flags = 0);
|
IMGUI_API void AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawFlags flags = 0);
|
||||||
|
|
||||||
// Stateful path API, add points then finish with PathFillConvex() or PathStroke()
|
// Stateful path API, add points then finish with PathFillConvex() or PathStroke()
|
||||||
// - Filled shapes must always use clockwise winding order. The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing.
|
// - Important: filled shapes must always use clockwise winding order! The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing.
|
||||||
|
// so e.g. 'PathArcTo(center, radius, PI * -0.5f, PI)' is ok, whereas 'PathArcTo(center, radius, PI, PI * -0.5f)' won't have correct anti-aliasing when followed by PathFillConvex().
|
||||||
inline void PathClear() { _Path.Size = 0; }
|
inline void PathClear() { _Path.Size = 0; }
|
||||||
inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); }
|
inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); }
|
||||||
inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); }
|
inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); }
|
||||||
|
|
50
extern/imgui_patched/imgui_demo.cpp
vendored
50
extern/imgui_patched/imgui_demo.cpp
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.90.3
|
// dear imgui, v1.90.4
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
|
@ -418,6 +418,12 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||||
ImGui::MenuItem("Debug Log", NULL, &show_tool_debug_log, has_debug_tools);
|
ImGui::MenuItem("Debug Log", NULL, &show_tool_debug_log, has_debug_tools);
|
||||||
ImGui::MenuItem("ID Stack Tool", NULL, &show_tool_id_stack_tool, has_debug_tools);
|
ImGui::MenuItem("ID Stack Tool", NULL, &show_tool_id_stack_tool, has_debug_tools);
|
||||||
ImGui::MenuItem("Style Editor", NULL, &show_tool_style_editor);
|
ImGui::MenuItem("Style Editor", NULL, &show_tool_style_editor);
|
||||||
|
bool is_debugger_present = ImGui::GetIO().ConfigDebugIsDebuggerPresent;
|
||||||
|
if (ImGui::MenuItem("Item Picker", NULL, false, has_debug_tools && is_debugger_present))
|
||||||
|
ImGui::DebugStartItemPicker();
|
||||||
|
if (!is_debugger_present)
|
||||||
|
ImGui::SetItemTooltip("Requires io.ConfigDebugIsDebuggerPresent=true to be set.\n\nWe otherwise disable the menu option to avoid casual users crashing the application.\n\nYou can however always access the Item Picker in Metrics->Tools.");
|
||||||
|
ImGui::Separator();
|
||||||
ImGui::MenuItem("About Dear ImGui", NULL, &show_tool_about);
|
ImGui::MenuItem("About Dear ImGui", NULL, &show_tool_about);
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
@ -5383,23 +5389,26 @@ static void ShowDemoWindowTables()
|
||||||
const int rows_count = 12;
|
const int rows_count = 12;
|
||||||
|
|
||||||
static ImGuiTableFlags table_flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerH | ImGuiTableFlags_Hideable | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_HighlightHoveredColumn;
|
static ImGuiTableFlags table_flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerH | ImGuiTableFlags_Hideable | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_HighlightHoveredColumn;
|
||||||
|
static ImGuiTableColumnFlags column_flags = ImGuiTableColumnFlags_AngledHeader | ImGuiTableColumnFlags_WidthFixed;
|
||||||
static bool bools[columns_count * rows_count] = {}; // Dummy storage selection storage
|
static bool bools[columns_count * rows_count] = {}; // Dummy storage selection storage
|
||||||
static int frozen_cols = 1;
|
static int frozen_cols = 1;
|
||||||
static int frozen_rows = 2;
|
static int frozen_rows = 2;
|
||||||
ImGui::CheckboxFlags("_ScrollX", &table_flags, ImGuiTableFlags_ScrollX);
|
ImGui::CheckboxFlags("_ScrollX", &table_flags, ImGuiTableFlags_ScrollX);
|
||||||
ImGui::CheckboxFlags("_ScrollY", &table_flags, ImGuiTableFlags_ScrollY);
|
ImGui::CheckboxFlags("_ScrollY", &table_flags, ImGuiTableFlags_ScrollY);
|
||||||
|
ImGui::CheckboxFlags("_Resizable", &table_flags, ImGuiTableFlags_Resizable);
|
||||||
ImGui::CheckboxFlags("_NoBordersInBody", &table_flags, ImGuiTableFlags_NoBordersInBody);
|
ImGui::CheckboxFlags("_NoBordersInBody", &table_flags, ImGuiTableFlags_NoBordersInBody);
|
||||||
ImGui::CheckboxFlags("_HighlightHoveredColumn", &table_flags, ImGuiTableFlags_HighlightHoveredColumn);
|
ImGui::CheckboxFlags("_HighlightHoveredColumn", &table_flags, ImGuiTableFlags_HighlightHoveredColumn);
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
||||||
ImGui::SliderInt("Frozen columns", &frozen_cols, 0, 2);
|
ImGui::SliderInt("Frozen columns", &frozen_cols, 0, 2);
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
||||||
ImGui::SliderInt("Frozen rows", &frozen_rows, 0, 2);
|
ImGui::SliderInt("Frozen rows", &frozen_rows, 0, 2);
|
||||||
|
ImGui::CheckboxFlags("Disable header contributing to column width", &column_flags, ImGuiTableColumnFlags_NoHeaderWidth);
|
||||||
|
|
||||||
if (ImGui::BeginTable("table_angled_headers", columns_count, table_flags, ImVec2(0.0f, TEXT_BASE_HEIGHT * 12)))
|
if (ImGui::BeginTable("table_angled_headers", columns_count, table_flags, ImVec2(0.0f, TEXT_BASE_HEIGHT * 12)))
|
||||||
{
|
{
|
||||||
ImGui::TableSetupColumn(column_names[0], ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_NoReorder);
|
ImGui::TableSetupColumn(column_names[0], ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_NoReorder);
|
||||||
for (int n = 1; n < columns_count; n++)
|
for (int n = 1; n < columns_count; n++)
|
||||||
ImGui::TableSetupColumn(column_names[n], ImGuiTableColumnFlags_AngledHeader | ImGuiTableColumnFlags_WidthFixed);
|
ImGui::TableSetupColumn(column_names[n], column_flags);
|
||||||
ImGui::TableSetupScrollFreeze(frozen_cols, frozen_rows);
|
ImGui::TableSetupScrollFreeze(frozen_cols, frozen_rows);
|
||||||
|
|
||||||
ImGui::TableAngledHeadersRow(); // Draw angled headers for all columns with the ImGuiTableColumnFlags_AngledHeader flag.
|
ImGui::TableAngledHeadersRow(); // Draw angled headers for all columns with the ImGuiTableColumnFlags_AngledHeader flag.
|
||||||
|
@ -8130,6 +8139,9 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||||
const float rounding = sz / 5.0f;
|
const float rounding = sz / 5.0f;
|
||||||
const int circle_segments = circle_segments_override ? circle_segments_override_v : 0;
|
const int circle_segments = circle_segments_override ? circle_segments_override_v : 0;
|
||||||
const int curve_segments = curve_segments_override ? curve_segments_override_v : 0;
|
const int curve_segments = curve_segments_override ? curve_segments_override_v : 0;
|
||||||
|
const ImVec2 cp3[3] = { ImVec2(0.0f, sz * 0.6f), ImVec2(sz * 0.5f, -sz * 0.4f), ImVec2(sz, sz) }; // Control points for curves
|
||||||
|
const ImVec2 cp4[4] = { ImVec2(0.0f, 0.0f), ImVec2(sz * 1.3f, sz * 0.3f), ImVec2(sz - sz * 1.3f, sz - sz * 0.3f), ImVec2(sz, sz) };
|
||||||
|
|
||||||
float x = p.x + 4.0f;
|
float x = p.x + 4.0f;
|
||||||
float y = p.y + 4.0f;
|
float y = p.y + 4.0f;
|
||||||
for (int n = 0; n < 2; n++)
|
for (int n = 0; n < 2; n++)
|
||||||
|
@ -8148,17 +8160,23 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||||
draw_list->AddLine(ImVec2(x, y), ImVec2(x, y + sz), col, th); x += spacing; // Vertical line (note: drawing a filled rectangle will be faster!)
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x, y + sz), col, th); x += spacing; // Vertical line (note: drawing a filled rectangle will be faster!)
|
||||||
draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y + sz), col, th); x += sz + spacing; // Diagonal line
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y + sz), col, th); x += sz + spacing; // Diagonal line
|
||||||
|
|
||||||
|
// Path
|
||||||
|
draw_list->PathArcTo(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, 3.141592f, 3.141592f * -0.5f);
|
||||||
|
draw_list->PathStroke(col, ImDrawFlags_None, th);
|
||||||
|
x += sz + spacing;
|
||||||
|
|
||||||
// Quadratic Bezier Curve (3 control points)
|
// Quadratic Bezier Curve (3 control points)
|
||||||
ImVec2 cp3[3] = { ImVec2(x, y + sz * 0.6f), ImVec2(x + sz * 0.5f, y - sz * 0.4f), ImVec2(x + sz, y + sz) };
|
draw_list->AddBezierQuadratic(ImVec2(x + cp3[0].x, y + cp3[0].y), ImVec2(x + cp3[1].x, y + cp3[1].y), ImVec2(x + cp3[2].x, y + cp3[2].y), col, th, curve_segments);
|
||||||
draw_list->AddBezierQuadratic(cp3[0], cp3[1], cp3[2], col, th, curve_segments); x += sz + spacing;
|
x += sz + spacing;
|
||||||
|
|
||||||
// Cubic Bezier Curve (4 control points)
|
// Cubic Bezier Curve (4 control points)
|
||||||
ImVec2 cp4[4] = { ImVec2(x, y), ImVec2(x + sz * 1.3f, y + sz * 0.3f), ImVec2(x + sz - sz * 1.3f, y + sz - sz * 0.3f), ImVec2(x + sz, y + sz) };
|
draw_list->AddBezierCubic(ImVec2(x + cp4[0].x, y + cp4[0].y), ImVec2(x + cp4[1].x, y + cp4[1].y), ImVec2(x + cp4[2].x, y + cp4[2].y), ImVec2(x + cp4[3].x, y + cp4[3].y), col, th, curve_segments);
|
||||||
draw_list->AddBezierCubic(cp4[0], cp4[1], cp4[2], cp4[3], col, th, curve_segments);
|
|
||||||
|
|
||||||
x = p.x + 4;
|
x = p.x + 4;
|
||||||
y += sz + spacing;
|
y += sz + spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filled shapes
|
||||||
draw_list->AddNgonFilled(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz * 0.5f, col, ngon_sides); x += sz + spacing; // N-gon
|
draw_list->AddNgonFilled(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz * 0.5f, col, ngon_sides); x += sz + spacing; // N-gon
|
||||||
draw_list->AddCircleFilled(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz * 0.5f, col, circle_segments); x += sz + spacing; // Circle
|
draw_list->AddCircleFilled(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz * 0.5f, col, circle_segments); x += sz + spacing; // Circle
|
||||||
draw_list->AddEllipseFilled(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz * 0.5f, sz * 0.3f, col, -0.3f, circle_segments); x += sz + spacing;// Ellipse
|
draw_list->AddEllipseFilled(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz * 0.5f, sz * 0.3f, col, -0.3f, circle_segments); x += sz + spacing;// Ellipse
|
||||||
|
@ -8170,9 +8188,27 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||||
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + sz, y + thickness), col); x += sz + spacing; // Horizontal line (faster than AddLine, but only handle integer thickness)
|
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + sz, y + thickness), col); x += sz + spacing; // Horizontal line (faster than AddLine, but only handle integer thickness)
|
||||||
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + thickness, y + sz), col); x += spacing * 2.0f;// Vertical line (faster than AddLine, but only handle integer thickness)
|
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + thickness, y + sz), col); x += spacing * 2.0f;// Vertical line (faster than AddLine, but only handle integer thickness)
|
||||||
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + 1, y + 1), col); x += sz; // Pixel (faster than AddLine)
|
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + 1, y + 1), col); x += sz; // Pixel (faster than AddLine)
|
||||||
|
|
||||||
|
// Path
|
||||||
|
draw_list->PathArcTo(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz * 0.5f, 3.141592f * -0.5f, 3.141592f);
|
||||||
|
draw_list->PathFillConvex(col);
|
||||||
|
x += sz + spacing;
|
||||||
|
|
||||||
|
// Quadratic Bezier Curve (3 control points)
|
||||||
|
draw_list->PathLineTo(ImVec2(x + cp3[0].x, y + cp3[0].y));
|
||||||
|
draw_list->PathBezierQuadraticCurveTo(ImVec2(x + cp3[1].x, y + cp3[1].y), ImVec2(x + cp3[2].x, y + cp3[2].y), curve_segments);
|
||||||
|
draw_list->PathFillConvex(col);
|
||||||
|
x += sz + spacing;
|
||||||
|
|
||||||
|
// Cubic Bezier Curve (4 control points): this is concave so not drawing it yet
|
||||||
|
//draw_list->PathLineTo(ImVec2(x + cp4[0].x, y + cp4[0].y));
|
||||||
|
//draw_list->PathBezierCubicCurveTo(ImVec2(x + cp4[1].x, y + cp4[1].y), ImVec2(x + cp4[2].x, y + cp4[2].y), ImVec2(x + cp4[3].x, y + cp4[3].y), curve_segments);
|
||||||
|
//draw_list->PathFillConvex(col);
|
||||||
|
//x += sz + spacing;
|
||||||
|
|
||||||
draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x + sz, y + sz), IM_COL32(0, 0, 0, 255), IM_COL32(255, 0, 0, 255), IM_COL32(255, 255, 0, 255), IM_COL32(0, 255, 0, 255));
|
draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x + sz, y + sz), IM_COL32(0, 0, 0, 255), IM_COL32(255, 0, 0, 255), IM_COL32(255, 255, 0, 255), IM_COL32(0, 255, 0, 255));
|
||||||
|
|
||||||
ImGui::Dummy(ImVec2((sz + spacing) * 11.2f, (sz + spacing) * 3.0f));
|
ImGui::Dummy(ImVec2((sz + spacing) * 12.2f, (sz + spacing) * 3.0f));
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
10
extern/imgui_patched/imgui_draw.cpp
vendored
10
extern/imgui_patched/imgui_draw.cpp
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.90.3
|
// dear imgui, v1.90.4
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4117,8 +4117,8 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
draw_list->PathArcTo(ImVec2(x0, p1.y - rounding), rounding, IM_PI - arc0_e, IM_PI - arc0_b, 3); // BL
|
draw_list->PathArcTo(ImVec2(x0, p1.y - rounding), rounding, IM_PI - arc0_e, IM_PI - arc0_b); // BL
|
||||||
draw_list->PathArcTo(ImVec2(x0, p0.y + rounding), rounding, IM_PI + arc0_b, IM_PI + arc0_e, 3); // TR
|
draw_list->PathArcTo(ImVec2(x0, p0.y + rounding), rounding, IM_PI + arc0_b, IM_PI + arc0_e); // TR
|
||||||
}
|
}
|
||||||
if (p1.x > rect.Min.x + rounding)
|
if (p1.x > rect.Min.x + rounding)
|
||||||
{
|
{
|
||||||
|
@ -4137,8 +4137,8 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
draw_list->PathArcTo(ImVec2(x1, p0.y + rounding), rounding, -arc1_e, -arc1_b, 3); // TR
|
draw_list->PathArcTo(ImVec2(x1, p0.y + rounding), rounding, -arc1_e, -arc1_b); // TR
|
||||||
draw_list->PathArcTo(ImVec2(x1, p1.y - rounding), rounding, +arc1_b, +arc1_e, 3); // BR
|
draw_list->PathArcTo(ImVec2(x1, p1.y - rounding), rounding, +arc1_b, +arc1_e); // BR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draw_list->PathFillConvex(col);
|
draw_list->PathFillConvex(col);
|
||||||
|
|
8
extern/imgui_patched/imgui_internal.h
vendored
8
extern/imgui_patched/imgui_internal.h
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.90.3
|
// dear imgui, v1.90.4
|
||||||
// (internal structures/api)
|
// (internal structures/api)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
|
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
|
||||||
|
@ -2715,6 +2715,7 @@ struct IMGUI_API ImGuiWindowTempData
|
||||||
int CurrentTableIdx; // Current table index (into g.Tables)
|
int CurrentTableIdx; // Current table index (into g.Tables)
|
||||||
ImGuiLayoutType LayoutType;
|
ImGuiLayoutType LayoutType;
|
||||||
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
||||||
|
ImU32 ModalDimBgColor;
|
||||||
|
|
||||||
// Local parameters stacks
|
// Local parameters stacks
|
||||||
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
||||||
|
@ -3180,7 +3181,7 @@ struct IMGUI_API ImGuiTableTempData
|
||||||
{
|
{
|
||||||
int TableIndex; // Index in g.Tables.Buf[] pool
|
int TableIndex; // Index in g.Tables.Buf[] pool
|
||||||
float LastTimeActive; // Last timestamp this structure was used
|
float LastTimeActive; // Last timestamp this structure was used
|
||||||
float AngledheadersExtraWidth; // Used in EndTable()
|
float AngledHeadersExtraWidth; // Used in EndTable()
|
||||||
|
|
||||||
ImVec2 UserOuterSize; // outer_size.x passed to BeginTable()
|
ImVec2 UserOuterSize; // outer_size.x passed to BeginTable()
|
||||||
ImDrawListSplitter DrawSplitter;
|
ImDrawListSplitter DrawSplitter;
|
||||||
|
@ -3624,7 +3625,7 @@ namespace ImGui
|
||||||
IMGUI_API float TableGetHeaderAngledMaxLabelWidth();
|
IMGUI_API float TableGetHeaderAngledMaxLabelWidth();
|
||||||
IMGUI_API void TablePushBackgroundChannel();
|
IMGUI_API void TablePushBackgroundChannel();
|
||||||
IMGUI_API void TablePopBackgroundChannel();
|
IMGUI_API void TablePopBackgroundChannel();
|
||||||
IMGUI_API void TableAngledHeadersRowEx(float angle, float label_width = 0.0f);
|
IMGUI_API void TableAngledHeadersRowEx(float angle, float max_label_width = 0.0f);
|
||||||
|
|
||||||
// Tables: Internals
|
// Tables: Internals
|
||||||
inline ImGuiTable* GetCurrentTable() { ImGuiContext& g = *GImGui; return g.CurrentTable; }
|
inline ImGuiTable* GetCurrentTable() { ImGuiContext& g = *GImGui; return g.CurrentTable; }
|
||||||
|
@ -3815,7 +3816,6 @@ namespace ImGui
|
||||||
IMGUI_API void DebugBreakClearData();
|
IMGUI_API void DebugBreakClearData();
|
||||||
IMGUI_API bool DebugBreakButton(const char* label, const char* description_of_location);
|
IMGUI_API bool DebugBreakButton(const char* label, const char* description_of_location);
|
||||||
IMGUI_API void DebugBreakButtonTooltip(bool keyboard_only, const char* description_of_location);
|
IMGUI_API void DebugBreakButtonTooltip(bool keyboard_only, const char* description_of_location);
|
||||||
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
|
||||||
IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas);
|
IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas);
|
||||||
IMGUI_API void DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* data_id, const void* data_id_end);
|
IMGUI_API void DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* data_id, const void* data_id_end);
|
||||||
IMGUI_API void DebugNodeColumns(ImGuiOldColumns* columns);
|
IMGUI_API void DebugNodeColumns(ImGuiOldColumns* columns);
|
||||||
|
|
76
extern/imgui_patched/imgui_tables.cpp
vendored
76
extern/imgui_patched/imgui_tables.cpp
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.90.3
|
// dear imgui, v1.90.4
|
||||||
// (tables and columns code)
|
// (tables and columns code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -501,7 +501,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||||
table->DeclColumnsCount = table->AngledHeadersCount = 0;
|
table->DeclColumnsCount = table->AngledHeadersCount = 0;
|
||||||
if (previous_frame_active + 1 < g.FrameCount)
|
if (previous_frame_active + 1 < g.FrameCount)
|
||||||
table->IsActiveIdInTable = false;
|
table->IsActiveIdInTable = false;
|
||||||
temp_data->AngledheadersExtraWidth = 0.0f;
|
temp_data->AngledHeadersExtraWidth = 0.0f;
|
||||||
|
|
||||||
// Using opaque colors facilitate overlapping lines of the grid, otherwise we'd need to improve TableDrawBorders()
|
// Using opaque colors facilitate overlapping lines of the grid, otherwise we'd need to improve TableDrawBorders()
|
||||||
table->BorderColorStrong = GetColorU32(ImGuiCol_TableBorderStrong);
|
table->BorderColorStrong = GetColorU32(ImGuiCol_TableBorderStrong);
|
||||||
|
@ -1347,7 +1347,7 @@ void ImGui::EndTable()
|
||||||
max_pos_x = ImMax(max_pos_x, table->Columns[table->RightMostEnabledColumn].WorkMaxX + table->CellPaddingX + table->OuterPaddingX - outer_padding_for_border);
|
max_pos_x = ImMax(max_pos_x, table->Columns[table->RightMostEnabledColumn].WorkMaxX + table->CellPaddingX + table->OuterPaddingX - outer_padding_for_border);
|
||||||
if (table->ResizedColumn != -1)
|
if (table->ResizedColumn != -1)
|
||||||
max_pos_x = ImMax(max_pos_x, table->ResizeLockMinContentsX2);
|
max_pos_x = ImMax(max_pos_x, table->ResizeLockMinContentsX2);
|
||||||
table->InnerWindow->DC.CursorMaxPos.x = max_pos_x + table->TempData->AngledheadersExtraWidth;
|
table->InnerWindow->DC.CursorMaxPos.x = max_pos_x + table->TempData->AngledHeadersExtraWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pop clipping rect
|
// Pop clipping rect
|
||||||
|
@ -1465,7 +1465,7 @@ void ImGui::EndTable()
|
||||||
}
|
}
|
||||||
else if (temp_data->UserOuterSize.x <= 0.0f)
|
else if (temp_data->UserOuterSize.x <= 0.0f)
|
||||||
{
|
{
|
||||||
const float decoration_size = table->TempData->AngledheadersExtraWidth + ((table->Flags & ImGuiTableFlags_ScrollX) ? inner_window->ScrollbarSizes.x : 0.0f);
|
const float decoration_size = table->TempData->AngledHeadersExtraWidth + ((table->Flags & ImGuiTableFlags_ScrollX) ? inner_window->ScrollbarSizes.x : 0.0f);
|
||||||
outer_window->DC.IdealMaxPos.x = ImMax(outer_window->DC.IdealMaxPos.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth + decoration_size - temp_data->UserOuterSize.x);
|
outer_window->DC.IdealMaxPos.x = ImMax(outer_window->DC.IdealMaxPos.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth + decoration_size - temp_data->UserOuterSize.x);
|
||||||
outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, ImMin(table->OuterRect.Max.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth));
|
outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, ImMin(table->OuterRect.Max.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth));
|
||||||
}
|
}
|
||||||
|
@ -1570,6 +1570,7 @@ void ImGui::TableSetupColumn(const char* label, ImGuiTableColumnFlags flags, flo
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store name (append with zero-terminator in contiguous buffer)
|
// Store name (append with zero-terminator in contiguous buffer)
|
||||||
|
// FIXME: If we recorded the number of \n in names we could compute header row height
|
||||||
column->NameOffset = -1;
|
column->NameOffset = -1;
|
||||||
if (label != NULL && label[0] != 0)
|
if (label != NULL && label[0] != 0)
|
||||||
{
|
{
|
||||||
|
@ -2157,6 +2158,8 @@ void ImGui::TableEndCell(ImGuiTable* table)
|
||||||
// - TableSetColumnWidthAutoAll() [Internal]
|
// - TableSetColumnWidthAutoAll() [Internal]
|
||||||
// - TableUpdateColumnsWeightFromWidth() [Internal]
|
// - TableUpdateColumnsWeightFromWidth() [Internal]
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
// Note that actual columns widths are computed in TableUpdateLayout().
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
// Maximum column content width given current layout. Use column->MinX so this value on a per-column basis.
|
// Maximum column content width given current layout. Use column->MinX so this value on a per-column basis.
|
||||||
float ImGui::TableGetMaxColumnWidth(const ImGuiTable* table, int column_n)
|
float ImGui::TableGetMaxColumnWidth(const ImGuiTable* table, int column_n)
|
||||||
|
@ -2930,6 +2933,7 @@ void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
||||||
// [SECTION] Tables: Headers
|
// [SECTION] Tables: Headers
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// - TableGetHeaderRowHeight() [Internal]
|
// - TableGetHeaderRowHeight() [Internal]
|
||||||
|
// - TableGetHeaderAngledMaxLabelWidth() [Internal]
|
||||||
// - TableHeadersRow()
|
// - TableHeadersRow()
|
||||||
// - TableHeader()
|
// - TableHeader()
|
||||||
// - TableAngledHeadersRow()
|
// - TableAngledHeadersRow()
|
||||||
|
@ -2961,7 +2965,7 @@ float ImGui::TableGetHeaderAngledMaxLabelWidth()
|
||||||
if (IM_BITARRAY_TESTBIT(table->EnabledMaskByIndex, column_n))
|
if (IM_BITARRAY_TESTBIT(table->EnabledMaskByIndex, column_n))
|
||||||
if (table->Columns[column_n].Flags & ImGuiTableColumnFlags_AngledHeader)
|
if (table->Columns[column_n].Flags & ImGuiTableColumnFlags_AngledHeader)
|
||||||
width = ImMax(width, CalcTextSize(TableGetColumnName(table, column_n), NULL, true).x);
|
width = ImMax(width, CalcTextSize(TableGetColumnName(table, column_n), NULL, true).x);
|
||||||
return width + g.Style.CellPadding.x * 2.0f;
|
return width + g.Style.CellPadding.y * 2.0f; // Swap padding
|
||||||
}
|
}
|
||||||
|
|
||||||
// [Public] This is a helper to output TableHeader() calls based on the column names declared in TableSetupColumn().
|
// [Public] This is a helper to output TableHeader() calls based on the column names declared in TableSetupColumn().
|
||||||
|
@ -3183,25 +3187,25 @@ void ImGui::TableAngledHeadersRowEx(float angle, float max_label_width)
|
||||||
|
|
||||||
// Calculate our base metrics and set angled headers data _before_ the first call to TableNextRow()
|
// Calculate our base metrics and set angled headers data _before_ the first call to TableNextRow()
|
||||||
// FIXME-STYLE: Would it be better for user to submit 'max_label_width' or 'row_height' ? One can be derived from the other.
|
// FIXME-STYLE: Would it be better for user to submit 'max_label_width' or 'row_height' ? One can be derived from the other.
|
||||||
const float header_height = table->RowCellPaddingY * 2.0f + g.FontSize;
|
const float header_height = g.FontSize + g.Style.CellPadding.x * 2.0f;
|
||||||
const float row_height = ImFabs(ImRotate(ImVec2(max_label_width, flip_label ? +header_height : -header_height), cos_a, sin_a).y);
|
const float row_height = ImFabs(ImRotate(ImVec2(max_label_width, flip_label ? +header_height : -header_height), cos_a, sin_a).y);
|
||||||
const ImVec2 header_angled_vector = unit_right * (row_height / -sin_a);
|
|
||||||
table->AngledHeadersHeight = row_height;
|
table->AngledHeadersHeight = row_height;
|
||||||
table->AngledHeadersSlope = (sin_a != 0.0f) ? (cos_a / sin_a) : 0.0f;
|
table->AngledHeadersSlope = (sin_a != 0.0f) ? (cos_a / sin_a) : 0.0f;
|
||||||
|
const ImVec2 header_angled_vector = unit_right * (row_height / -sin_a); // vector from bottom-left to top-left, and from bottom-right to top-right
|
||||||
|
|
||||||
// Declare row, override and draw our own background
|
// Declare row, override and draw our own background
|
||||||
TableNextRow(ImGuiTableRowFlags_Headers, row_height);
|
TableNextRow(ImGuiTableRowFlags_Headers, row_height);
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
|
const ImRect row_r(table->WorkRect.Min.x, table->BgClipRect.Min.y, table->WorkRect.Max.x, table->RowPosY2);
|
||||||
table->DrawSplitter->SetCurrentChannel(draw_list, TABLE_DRAW_CHANNEL_BG0);
|
table->DrawSplitter->SetCurrentChannel(draw_list, TABLE_DRAW_CHANNEL_BG0);
|
||||||
float clip_rect_min_x = table->BgClipRect.Min.x;
|
float clip_rect_min_x = table->BgClipRect.Min.x;
|
||||||
if (table->FreezeColumnsCount > 0)
|
if (table->FreezeColumnsCount > 0)
|
||||||
clip_rect_min_x = ImMax(clip_rect_min_x, table->Columns[table->FreezeColumnsCount - 1].MaxX);
|
clip_rect_min_x = ImMax(clip_rect_min_x, table->Columns[table->FreezeColumnsCount - 1].MaxX);
|
||||||
TableSetBgColor(ImGuiTableBgTarget_RowBg0, 0); // Cancel
|
TableSetBgColor(ImGuiTableBgTarget_RowBg0, 0); // Cancel
|
||||||
PushClipRect(table->BgClipRect.Min, table->BgClipRect.Max, false); // Span all columns
|
PushClipRect(table->BgClipRect.Min, table->BgClipRect.Max, false); // Span all columns
|
||||||
draw_list->AddRectFilled(table->BgClipRect.Min, table->BgClipRect.Max, GetColorU32(ImGuiCol_TableHeaderBg, 0.25f)); // FIXME-STYLE: Change row background with an arbitrary color.
|
draw_list->AddRectFilled(ImVec2(table->BgClipRect.Min.x, row_r.Min.y), ImVec2(table->BgClipRect.Max.x, row_r.Max.y), GetColorU32(ImGuiCol_TableHeaderBg, 0.25f)); // FIXME-STYLE: Change row background with an arbitrary color.
|
||||||
PushClipRect(ImVec2(clip_rect_min_x, table->BgClipRect.Min.y), table->BgClipRect.Max, true); // Span all columns
|
PushClipRect(ImVec2(clip_rect_min_x, table->BgClipRect.Min.y), table->BgClipRect.Max, true); // Span all columns
|
||||||
|
|
||||||
const ImRect row_r(table->WorkRect.Min.x, table->BgClipRect.Min.y, table->WorkRect.Max.x, window->DC.CursorPos.y + row_height);
|
|
||||||
const ImGuiID row_id = GetID("##AngledHeaders");
|
const ImGuiID row_id = GetID("##AngledHeaders");
|
||||||
ButtonBehavior(row_r, row_id, NULL, NULL);
|
ButtonBehavior(row_r, row_id, NULL, NULL);
|
||||||
KeepAliveID(row_id);
|
KeepAliveID(row_id);
|
||||||
|
@ -3212,7 +3216,9 @@ void ImGui::TableAngledHeadersRowEx(float angle, float max_label_width)
|
||||||
if (table_instance->HoveredRowLast == 0 && table->HoveredColumnBorder == -1 && (g.ActiveId == 0 || g.ActiveId == row_id || (table->IsActiveIdInTable || g.DragDropActive)))
|
if (table_instance->HoveredRowLast == 0 && table->HoveredColumnBorder == -1 && (g.ActiveId == 0 || g.ActiveId == row_id || (table->IsActiveIdInTable || g.DragDropActive)))
|
||||||
highlight_column_n = table->HoveredColumnBody;
|
highlight_column_n = table->HoveredColumnBody;
|
||||||
|
|
||||||
|
// Draw background and labels in first pass, then all borders.
|
||||||
float max_x = 0.0f;
|
float max_x = 0.0f;
|
||||||
|
ImVec2 padding = g.Style.CellPadding; // We will always use swapped component
|
||||||
for (int pass = 0; pass < 2; pass++)
|
for (int pass = 0; pass < 2; pass++)
|
||||||
for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
|
for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
|
||||||
{
|
{
|
||||||
|
@ -3234,25 +3240,45 @@ void ImGui::TableAngledHeadersRowEx(float angle, float max_label_width)
|
||||||
draw_list->AddQuadFilled(bg_shape[0], bg_shape[1], bg_shape[2], bg_shape[3], GetColorU32(ImGuiCol_TableHeaderBg));
|
draw_list->AddQuadFilled(bg_shape[0], bg_shape[1], bg_shape[2], bg_shape[3], GetColorU32(ImGuiCol_TableHeaderBg));
|
||||||
if (column_n == highlight_column_n)
|
if (column_n == highlight_column_n)
|
||||||
draw_list->AddQuadFilled(bg_shape[0], bg_shape[1], bg_shape[2], bg_shape[3], GetColorU32(ImGuiCol_Header)); // Highlight on hover
|
draw_list->AddQuadFilled(bg_shape[0], bg_shape[1], bg_shape[2], bg_shape[3], GetColorU32(ImGuiCol_Header)); // Highlight on hover
|
||||||
//draw_list->AddQuad(bg_shape[0], bg_shape[1], bg_shape[2], bg_shape[3], GetColorU32(ImGuiCol_TableBorderLight), 1.0f);
|
|
||||||
max_x = ImMax(max_x, bg_shape[3].x);
|
max_x = ImMax(max_x, bg_shape[3].x);
|
||||||
|
|
||||||
// Draw label (first draw at an offset where RenderTextXXX() function won't meddle with applying current ClipRect, then transform to final offset)
|
// Draw label
|
||||||
// FIXME: May be worth tidying up all those operations to make them easier to understand.
|
// - First draw at an offset where RenderTextXXX() function won't meddle with applying current ClipRect, then transform to final offset.
|
||||||
|
// - Handle multiple lines manually, as we want each lines to follow on the horizontal border, rather than see a whole block rotated.
|
||||||
const char* label_name = TableGetColumnName(table, column_n);
|
const char* label_name = TableGetColumnName(table, column_n);
|
||||||
const float clip_width = max_label_width - (sin_a * table->RowCellPaddingY);
|
const char* label_name_end = FindRenderedTextEnd(label_name);
|
||||||
ImRect label_r(window->ClipRect.Min, window->ClipRect.Min + ImVec2(clip_width + (flip_label ? 0.0f : table->CellPaddingX), header_height + table->RowCellPaddingY));
|
const float line_off_step_x = g.FontSize / -sin_a;
|
||||||
ImVec2 label_size = CalcTextSize(label_name, NULL, true);
|
float line_off_curr_x = 0.0f;
|
||||||
ImVec2 label_off = ImVec2(flip_label ? ImMax(0.0f, max_label_width - label_size.x - table->CellPaddingX) : table->CellPaddingX, table->RowCellPaddingY);
|
while (label_name < label_name_end)
|
||||||
int vtx_idx_begin = draw_list->_VtxCurrentIdx;
|
{
|
||||||
RenderTextEllipsis(draw_list, label_r.Min + label_off, label_r.Max, label_r.Max.x, label_r.Max.x, label_name, NULL, &label_size);
|
const char* label_name_eol = strchr(label_name, '\n');
|
||||||
//if (g.IO.KeyShift) { draw_list->AddRect(label_r.Min, label_r.Max, IM_COL32(0, 255, 0, 255), 0.0f, 0, 2.0f); }
|
if (label_name_eol == NULL)
|
||||||
int vtx_idx_end = draw_list->_VtxCurrentIdx;
|
label_name_eol = label_name_end;
|
||||||
|
|
||||||
// Rotate and offset label
|
// FIXME: Individual line clipping for right-most column is broken for negative angles.
|
||||||
ImVec2 pivot_in = label_r.GetBL();
|
ImVec2 label_size = CalcTextSize(label_name, label_name_eol);
|
||||||
ImVec2 pivot_out = ImVec2(column->WorkMinX, row_r.Max.y) + (flip_label ? (unit_right * clip_width) : ImVec2(header_height, 0.0f));
|
float clip_width = max_label_width - padding.y; // Using padding.y*2.0f would be symetrical but hide more text.
|
||||||
ShadeVertsTransformPos(draw_list, vtx_idx_begin, vtx_idx_end, pivot_in, label_cos_a, label_sin_a, pivot_out); // Rotate and offset
|
float clip_height = ImMin(label_size.y, column->ClipRect.Max.x - column->WorkMinX - line_off_curr_x);
|
||||||
|
ImRect clip_r(window->ClipRect.Min, window->ClipRect.Min + ImVec2(clip_width, clip_height));
|
||||||
|
int vtx_idx_begin = draw_list->_VtxCurrentIdx;
|
||||||
|
RenderTextEllipsis(draw_list, clip_r.Min, clip_r.Max, clip_r.Max.x, clip_r.Max.x, label_name, label_name_eol, &label_size);
|
||||||
|
int vtx_idx_end = draw_list->_VtxCurrentIdx;
|
||||||
|
|
||||||
|
// Rotate and offset label
|
||||||
|
ImVec2 pivot_in = ImVec2(window->ClipRect.Min.x, window->ClipRect.Min.y + label_size.y);
|
||||||
|
ImVec2 pivot_out = ImVec2(column->WorkMinX, row_r.Max.y);
|
||||||
|
line_off_curr_x += line_off_step_x;
|
||||||
|
pivot_out += unit_right * padding.y;
|
||||||
|
if (flip_label)
|
||||||
|
pivot_out += unit_right * (clip_width - ImMax(0.0f, clip_width - label_size.x));
|
||||||
|
pivot_out.x += flip_label ? line_off_curr_x - line_off_step_x : line_off_curr_x;
|
||||||
|
ShadeVertsTransformPos(draw_list, vtx_idx_begin, vtx_idx_end, pivot_in, label_cos_a, label_sin_a, pivot_out); // Rotate and offset
|
||||||
|
//if (g.IO.KeyShift) { ImDrawList* fg_dl = GetForegroundDrawList(); vtx_idx_begin = fg_dl->_VtxCurrentIdx; fg_dl->AddRect(clip_r.Min, clip_r.Max, IM_COL32(0, 255, 0, 255), 0.0f, 0, 2.0f); ShadeVertsTransformPos(fg_dl, vtx_idx_begin, fg_dl->_VtxCurrentIdx, pivot_in, label_cos_a, label_sin_a, pivot_out); }
|
||||||
|
|
||||||
|
// Register header width
|
||||||
|
column->ContentMaxXHeadersUsed = column->ContentMaxXHeadersIdeal = column->WorkMinX + ImCeil(line_off_curr_x);
|
||||||
|
label_name = label_name_eol + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pass == 1)
|
if (pass == 1)
|
||||||
{
|
{
|
||||||
|
@ -3262,7 +3288,7 @@ void ImGui::TableAngledHeadersRowEx(float angle, float max_label_width)
|
||||||
}
|
}
|
||||||
PopClipRect();
|
PopClipRect();
|
||||||
PopClipRect();
|
PopClipRect();
|
||||||
table->TempData->AngledheadersExtraWidth = ImMax(0.0f, max_x - table->Columns[table->RightMostEnabledColumn].MaxX);
|
table->TempData->AngledHeadersExtraWidth = ImMax(0.0f, max_x - table->Columns[table->RightMostEnabledColumn].MaxX);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
2
extern/imgui_patched/imgui_widgets.cpp
vendored
2
extern/imgui_patched/imgui_widgets.cpp
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.90.3
|
// dear imgui, v1.90.4
|
||||||
// (widgets code)
|
// (widgets code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue