mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Updated ImGui.
This commit is contained in:
179
3rdparty/dear-imgui/imgui.cpp
vendored
179
3rdparty/dear-imgui/imgui.cpp
vendored
@@ -77,6 +77,7 @@ CODE
|
||||
// [SECTION] RENDER HELPERS
|
||||
// [SECTION] INITIALIZATION, SHUTDOWN
|
||||
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
|
||||
// [SECTION] FONTS
|
||||
// [SECTION] ID STACK
|
||||
// [SECTION] INPUTS
|
||||
// [SECTION] ERROR CHECKING, STATE RECOVERY
|
||||
@@ -431,10 +432,15 @@ CODE
|
||||
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2025/05/23 (1.92.0) - Fonts: changed ImFont::CalcWordWrapPositionA() to ImFont::CalcWordWrapPosition()
|
||||
- old: const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, ....);
|
||||
- new: const char* ImFont::CalcWordWrapPosition (float size, const char* text, ....);
|
||||
The leading 'float scale' parameters was changed to 'float size'. This was necessary as 'scale' is assuming standard font size which is a concept we aim to eliminate in an upcoming update. Kept inline redirection function.
|
||||
- 2025/05/15 (1.92.0) - TreeNode: renamed ImGuiTreeNodeFlags_NavLeftJumpsBackHere to ImGuiTreeNodeFlags_NavLeftJumpsToParent for clarity. Kept inline redirection enum (will obsolete).
|
||||
- 2025/05/15 (1.92.0) - Commented out PushAllowKeyboardFocus()/PopAllowKeyboardFocus() which was obsoleted in 1.89.4. Use PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop)/PopItemFlag() instead. (#3092)
|
||||
- 2025/05/15 (1.92.0) - Commented out ImGuiListClipper::ForceDisplayRangeByIndices() which was obsoleted in 1.89.6. Use ImGuiListClipper::IncludeItemsByIndex() instead.
|
||||
- 2025/03/05 (1.91.9) - BeginMenu(): Internals: reworked mangling of menu windows to use "###Menu_00" etc. instead of "##Menu_00", allowing them to also store the menu name before it. This shouldn't affect code unless directly accessing menu window from their mangled name.
|
||||
- 2025/04/16 (1.91.9) - Internals: RenderTextEllipsis() function removed the 'float clip_max_x' parameter directly preceding 'float ellipsis_max_x'. Values were identical for a vast majority of users. (#8387)
|
||||
- 2025/02/27 (1.91.9) - Image(): removed 'tint_col' and 'border_col' parameter from Image() function. Added ImageWithBg() replacement. (#8131, #8238)
|
||||
- old: void Image (ImTextureID tex_id, ImVec2 image_size, ImVec2 uv0 = (0,0), ImVec2 uv1 = (1,1), ImVec4 tint_col = (1,1,1,1), ImVec4 border_col = (0,0,0,0));
|
||||
- new: void Image (ImTextureID tex_id, ImVec2 image_size, ImVec2 uv0 = (0,0), ImVec2 uv1 = (1,1));
|
||||
@@ -1265,6 +1271,7 @@ static void UpdateMouseWheel();
|
||||
static void UpdateKeyRoutingTable(ImGuiKeyRoutingTable* rt);
|
||||
|
||||
// Misc
|
||||
static void UpdateFontsNewFrame();
|
||||
static void UpdateSettings();
|
||||
static int UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_hovered, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect);
|
||||
static void RenderWindowOuterBorders(ImGuiWindow* window);
|
||||
@@ -3190,10 +3197,17 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper)
|
||||
if (table)
|
||||
IM_ASSERT(table->RowPosY1 == clipper->StartPosY && table->RowPosY2 == window->DC.CursorPos.y);
|
||||
|
||||
clipper->ItemsHeight = (window->DC.CursorPos.y - clipper->StartPosY) / (float)(clipper->DisplayEnd - clipper->DisplayStart);
|
||||
bool affected_by_floating_point_precision = ImIsFloatAboveGuaranteedIntegerPrecision(clipper->StartPosY) || ImIsFloatAboveGuaranteedIntegerPrecision(window->DC.CursorPos.y);
|
||||
bool affected_by_floating_point_precision = ImIsFloatAboveGuaranteedIntegerPrecision((float)clipper->StartPosY) || ImIsFloatAboveGuaranteedIntegerPrecision(window->DC.CursorPos.y);
|
||||
if (affected_by_floating_point_precision)
|
||||
{
|
||||
// Mitigation/hack for very large range: assume last time height constitute line height.
|
||||
clipper->ItemsHeight = window->DC.PrevLineSize.y + g.Style.ItemSpacing.y; // FIXME: Technically wouldn't allow multi-line entries.
|
||||
window->DC.CursorPos.y = (float)(clipper->StartPosY + clipper->ItemsHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
clipper->ItemsHeight = (float)(window->DC.CursorPos.y - clipper->StartPosY) / (float)(clipper->DisplayEnd - clipper->DisplayStart);
|
||||
}
|
||||
if (clipper->ItemsHeight == 0.0f && clipper->ItemsCount == INT_MAX) // Accept that no item have been submitted if in indeterminate mode.
|
||||
return false;
|
||||
IM_ASSERT(clipper->ItemsHeight > 0.0f && "Unable to calculate item height! First item hasn't moved the cursor vertically!");
|
||||
@@ -3217,7 +3231,10 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper)
|
||||
// Add range selected to be included for navigation
|
||||
const bool is_nav_request = (g.NavMoveScoringItems && g.NavWindow && g.NavWindow->RootWindowForNav == window->RootWindowForNav);
|
||||
if (is_nav_request)
|
||||
{
|
||||
data->Ranges.push_back(ImGuiListClipperRange::FromPositions(g.NavScoringRect.Min.y, g.NavScoringRect.Max.y, 0, 0));
|
||||
data->Ranges.push_back(ImGuiListClipperRange::FromPositions(g.NavScoringNoClipRect.Min.y, g.NavScoringNoClipRect.Max.y, 0, 0));
|
||||
}
|
||||
if (is_nav_request && (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) && g.NavTabbingDir == -1)
|
||||
data->Ranges.push_back(ImGuiListClipperRange::FromIndices(clipper->ItemsCount - 1, clipper->ItemsCount));
|
||||
|
||||
@@ -3698,6 +3715,7 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, cons
|
||||
// Another overly complex function until we reorganize everything into a nice all-in-one helper.
|
||||
// This is made more complex because we have dissociated the layout rectangle (pos_min..pos_max) from 'ellipsis_max_x' which may be beyond it.
|
||||
// This is because in the context of tabs we selectively hide part of the text when the Close Button appears, but we don't want the ellipsis to move.
|
||||
// (BREAKING) On 2025/04/16 we removed the 'float clip_max_x' parameters which was preceeding 'float ellipsis_max' and was the same value for 99% of users.
|
||||
void ImGui::RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, float ellipsis_max_x, const char* text, const char* text_end_full, const ImVec2* text_size_if_known)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@@ -5214,10 +5232,8 @@ void ImGui::NewFrame()
|
||||
UpdateViewportsNewFrame();
|
||||
|
||||
// Setup current font and draw list shared data
|
||||
g.IO.Fonts->Locked = true;
|
||||
SetupDrawListSharedData();
|
||||
SetCurrentFont(GetDefaultFont());
|
||||
IM_ASSERT(g.Font->IsLoaded());
|
||||
UpdateFontsNewFrame();
|
||||
|
||||
// Mark rendering data as invalid to prevent user who may have a handle on it to use it.
|
||||
for (ImGuiViewportP* viewport : g.Viewports)
|
||||
@@ -6386,10 +6402,10 @@ static void CalcWindowContentSizes(ImGuiWindow* window, ImVec2* content_size_cur
|
||||
return;
|
||||
}
|
||||
|
||||
content_size_current->x = (window->ContentSizeExplicit.x != 0.0f) ? window->ContentSizeExplicit.x : IM_TRUNC(window->DC.CursorMaxPos.x - window->DC.CursorStartPos.x);
|
||||
content_size_current->y = (window->ContentSizeExplicit.y != 0.0f) ? window->ContentSizeExplicit.y : IM_TRUNC(window->DC.CursorMaxPos.y - window->DC.CursorStartPos.y);
|
||||
content_size_ideal->x = (window->ContentSizeExplicit.x != 0.0f) ? window->ContentSizeExplicit.x : IM_TRUNC(ImMax(window->DC.CursorMaxPos.x, window->DC.IdealMaxPos.x) - window->DC.CursorStartPos.x);
|
||||
content_size_ideal->y = (window->ContentSizeExplicit.y != 0.0f) ? window->ContentSizeExplicit.y : IM_TRUNC(ImMax(window->DC.CursorMaxPos.y, window->DC.IdealMaxPos.y) - window->DC.CursorStartPos.y);
|
||||
content_size_current->x = (window->ContentSizeExplicit.x != 0.0f) ? window->ContentSizeExplicit.x : ImTrunc64(window->DC.CursorMaxPos.x - window->DC.CursorStartPos.x);
|
||||
content_size_current->y = (window->ContentSizeExplicit.y != 0.0f) ? window->ContentSizeExplicit.y : ImTrunc64(window->DC.CursorMaxPos.y - window->DC.CursorStartPos.y);
|
||||
content_size_ideal->x = (window->ContentSizeExplicit.x != 0.0f) ? window->ContentSizeExplicit.x : ImTrunc64(ImMax(window->DC.CursorMaxPos.x, window->DC.IdealMaxPos.x) - window->DC.CursorStartPos.x);
|
||||
content_size_ideal->y = (window->ContentSizeExplicit.y != 0.0f) ? window->ContentSizeExplicit.y : ImTrunc64(ImMax(window->DC.CursorMaxPos.y, window->DC.IdealMaxPos.y) - window->DC.CursorStartPos.y);
|
||||
}
|
||||
|
||||
static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_contents)
|
||||
@@ -6400,17 +6416,20 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont
|
||||
const float decoration_h_without_scrollbars = window->DecoOuterSizeY1 + window->DecoOuterSizeY2 - window->ScrollbarSizes.y;
|
||||
ImVec2 size_pad = window->WindowPadding * 2.0f;
|
||||
ImVec2 size_desired = size_contents + size_pad + ImVec2(decoration_w_without_scrollbars, decoration_h_without_scrollbars);
|
||||
|
||||
// Determine maximum window size
|
||||
// Child windows are layed within their parent (unless they are also popups/menus) and thus have no restriction
|
||||
ImVec2 size_max = ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup)) ? ImVec2(FLT_MAX, FLT_MAX) : ImGui::GetMainViewport()->WorkSize - style.DisplaySafeAreaPadding * 2.0f;
|
||||
|
||||
if (window->Flags & ImGuiWindowFlags_Tooltip)
|
||||
{
|
||||
// Tooltip always resize
|
||||
return size_desired;
|
||||
// Tooltip always resize (up to maximum size)
|
||||
return ImMin(size_desired, size_max);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Maximum window size is determined by the viewport size or monitor size
|
||||
ImVec2 size_min = CalcWindowMinSize(window);
|
||||
ImVec2 size_max = ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup)) ? ImVec2(FLT_MAX, FLT_MAX) : ImGui::GetMainViewport()->WorkSize - style.DisplaySafeAreaPadding * 2.0f;
|
||||
ImVec2 size_auto_fit = ImClamp(size_desired, size_min, size_max);
|
||||
ImVec2 size_auto_fit = ImClamp(size_desired, ImMin(size_min, size_max), size_max);
|
||||
|
||||
// FIXME: CalcWindowAutoFitSize() doesn't take into account that only one axis may be auto-fit when calculating scrollbars,
|
||||
// we may need to compute/store three variants of size_auto_fit, for x/y/xy.
|
||||
@@ -7546,12 +7565,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->InnerClipRect.Max.y = ImFloor(window->InnerRect.Max.y - window->WindowBorderSize * 0.5f);
|
||||
window->InnerClipRect.ClipWithFull(host_rect);
|
||||
|
||||
// Default item width. Make it proportional to window size if window manually resizes
|
||||
if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
|
||||
window->ItemWidthDefault = ImTrunc(window->Size.x * 0.65f);
|
||||
else
|
||||
window->ItemWidthDefault = ImTrunc(g.FontSize * 16.0f);
|
||||
|
||||
// SCROLLING
|
||||
|
||||
// Lock down maximum scrolling
|
||||
@@ -7664,6 +7677,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->DC.LayoutType = ImGuiLayoutType_Vertical;
|
||||
window->DC.ParentLayoutType = parent_window ? parent_window->DC.LayoutType : ImGuiLayoutType_Vertical;
|
||||
|
||||
// Default item width. Make it proportional to window size if window manually resizes
|
||||
if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
|
||||
window->ItemWidthDefault = ImTrunc(window->Size.x * 0.65f);
|
||||
else
|
||||
window->ItemWidthDefault = ImTrunc(g.FontSize * 16.0f);
|
||||
window->DC.ItemWidth = window->ItemWidthDefault;
|
||||
window->DC.TextWrapPos = -1.0f; // disabled
|
||||
window->DC.ItemWidthStack.resize(0);
|
||||
@@ -7865,56 +7883,6 @@ void ImGui::End()
|
||||
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
|
||||
}
|
||||
|
||||
// Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only.
|
||||
void ImGui::SetCurrentFont(ImFont* font)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?
|
||||
IM_ASSERT(font->Scale > 0.0f);
|
||||
g.Font = font;
|
||||
g.FontBaseSize = ImMax(1.0f, g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale);
|
||||
g.FontSize = g.CurrentWindow ? g.CurrentWindow->CalcFontSize() : 0.0f;
|
||||
g.FontScale = g.FontSize / g.Font->FontSize;
|
||||
|
||||
ImFontAtlas* atlas = g.Font->ContainerAtlas;
|
||||
g.DrawListSharedData.TexUvWhitePixel = atlas->TexUvWhitePixel;
|
||||
g.DrawListSharedData.TexUvLines = atlas->TexUvLines;
|
||||
g.DrawListSharedData.Font = g.Font;
|
||||
g.DrawListSharedData.FontSize = g.FontSize;
|
||||
g.DrawListSharedData.FontScale = g.FontScale;
|
||||
}
|
||||
|
||||
// Use ImDrawList::_SetTextureID(), making our shared g.FontStack[] authoritative against window-local ImDrawList.
|
||||
// - Whereas ImDrawList::PushTextureID()/PopTextureID() is not to be used across Begin() calls.
|
||||
// - Note that we don't propagate current texture id when e.g. Begin()-ing into a new window, we never really did...
|
||||
// - Some code paths never really fully worked with multiple atlas textures.
|
||||
// - The right-ish solution may be to remove _SetTextureID() and make AddText/RenderText lazily call PushTextureID()/PopTextureID()
|
||||
// the same way AddImage() does, but then all other primitives would also need to? I don't think we should tackle this problem
|
||||
// because we have a concrete need and a test bed for multiple atlas textures.
|
||||
void ImGui::PushFont(ImFont* font)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (font == NULL)
|
||||
font = GetDefaultFont();
|
||||
g.FontStack.push_back(font);
|
||||
SetCurrentFont(font);
|
||||
g.CurrentWindow->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
|
||||
}
|
||||
|
||||
void ImGui::PopFont()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.FontStack.Size <= 0)
|
||||
{
|
||||
IM_ASSERT_USER_ERROR(0, "Calling PopFont() too many times!");
|
||||
return;
|
||||
}
|
||||
g.FontStack.pop_back();
|
||||
ImFont* font = g.FontStack.Size == 0 ? GetDefaultFont() : g.FontStack.back();
|
||||
SetCurrentFont(font);
|
||||
g.CurrentWindow->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
|
||||
}
|
||||
|
||||
void ImGui::PushItemFlag(ImGuiItemFlags option, bool enabled)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@@ -8539,6 +8507,71 @@ bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
|
||||
return window->ClipRect.Overlaps(ImRect(rect_min, rect_max));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] FONTS
|
||||
//-----------------------------------------------------------------------------
|
||||
// Most of the relevant font logic is in imgui_draw.cpp.
|
||||
// Those are high-level support functions.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ImGui::UpdateFontsNewFrame()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.IO.Fonts->Locked = true;
|
||||
SetCurrentFont(GetDefaultFont());
|
||||
IM_ASSERT(g.Font->IsLoaded());
|
||||
}
|
||||
|
||||
// Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only.
|
||||
void ImGui::SetCurrentFont(ImFont* font)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?
|
||||
IM_ASSERT(font->Scale > 0.0f);
|
||||
g.Font = font;
|
||||
g.FontBaseSize = ImMax(1.0f, g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale);
|
||||
g.FontSize = g.CurrentWindow ? g.CurrentWindow->CalcFontSize() : 0.0f;
|
||||
g.FontScale = g.FontSize / g.Font->FontSize;
|
||||
|
||||
ImFontAtlas* atlas = g.Font->ContainerAtlas;
|
||||
g.DrawListSharedData.TexUvWhitePixel = atlas->TexUvWhitePixel;
|
||||
g.DrawListSharedData.TexUvLines = atlas->TexUvLines;
|
||||
g.DrawListSharedData.Font = g.Font;
|
||||
g.DrawListSharedData.FontSize = g.FontSize;
|
||||
g.DrawListSharedData.FontScale = g.FontScale;
|
||||
}
|
||||
|
||||
// Use ImDrawList::_SetTextureID(), making our shared g.FontStack[] authoritative against window-local ImDrawList.
|
||||
// - Whereas ImDrawList::PushTextureID()/PopTextureID() is not to be used across Begin() calls.
|
||||
// - Note that we don't propagate current texture id when e.g. Begin()-ing into a new window, we never really did...
|
||||
// - Some code paths never really fully worked with multiple atlas textures.
|
||||
// - The right-ish solution may be to remove _SetTextureID() and make AddText/RenderText lazily call PushTextureID()/PopTextureID()
|
||||
// the same way AddImage() does, but then all other primitives would also need to? I don't think we should tackle this problem
|
||||
// because we have a concrete need and a test bed for multiple atlas textures.
|
||||
void ImGui::PushFont(ImFont* font)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (font == NULL)
|
||||
font = GetDefaultFont();
|
||||
g.FontStack.push_back(font);
|
||||
SetCurrentFont(font);
|
||||
g.CurrentWindow->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
|
||||
}
|
||||
|
||||
void ImGui::PopFont()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.FontStack.Size <= 0)
|
||||
{
|
||||
IM_ASSERT_USER_ERROR(0, "Calling PopFont() too many times!");
|
||||
return;
|
||||
}
|
||||
g.FontStack.pop_back();
|
||||
ImFont* font = g.FontStack.Size == 0 ? GetDefaultFont() : g.FontStack.back();
|
||||
SetCurrentFont(font);
|
||||
g.CurrentWindow->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] ID STACK
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -11144,7 +11177,7 @@ static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)
|
||||
}
|
||||
scroll[axis] = scroll_target - center_ratio * (window->SizeFull[axis] - decoration_size[axis]);
|
||||
}
|
||||
scroll[axis] = IM_ROUND(ImMax(scroll[axis], 0.0f));
|
||||
scroll[axis] = ImRound64(ImMax(scroll[axis], 0.0f));
|
||||
if (!window->Collapsed && !window->SkipItems)
|
||||
scroll[axis] = ImMin(scroll[axis], window->ScrollMax[axis]);
|
||||
}
|
||||
@@ -13350,7 +13383,7 @@ void ImGui::NavUpdateCreateMoveRequest()
|
||||
//if (!g.NavScoringNoClipRect.IsInverted()) { GetForegroundDrawList()->AddRect(g.NavScoringNoClipRect.Min, g.NavScoringNoClipRect.Max, IM_COL32(255, 200, 0, 255)); } // [DEBUG]
|
||||
}
|
||||
g.NavScoringRect = scoring_rect;
|
||||
g.NavScoringNoClipRect.Add(scoring_rect);
|
||||
//g.NavScoringNoClipRect.Add(scoring_rect);
|
||||
}
|
||||
|
||||
void ImGui::NavUpdateCreateTabbingRequest()
|
||||
@@ -13569,7 +13602,7 @@ static float ImGui::NavUpdatePageUpPageDown()
|
||||
if (g.NavLayer != ImGuiNavLayer_Main)
|
||||
NavRestoreLayer(ImGuiNavLayer_Main);
|
||||
|
||||
if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavWindowHasScrollY)
|
||||
if ((window->DC.NavLayersActiveMask & (1 << ImGuiNavLayer_Main)) == 0 && window->DC.NavWindowHasScrollY)
|
||||
{
|
||||
// Fallback manual-scroll when window has no navigable item
|
||||
if (IsKeyPressed(ImGuiKey_PageUp, ImGuiInputFlags_Repeat, ImGuiKeyOwner_NoOwner))
|
||||
|
||||
15
3rdparty/dear-imgui/imgui.h
vendored
15
3rdparty/dear-imgui/imgui.h
vendored
@@ -29,7 +29,7 @@
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.92.0 WIP"
|
||||
#define IMGUI_VERSION_NUM 19196
|
||||
#define IMGUI_VERSION_NUM 19197
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
/*
|
||||
@@ -559,13 +559,14 @@ namespace ImGui
|
||||
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL);
|
||||
IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
||||
IMGUI_API bool TextLink(const char* label); // hyperlink text button, return true when clicked
|
||||
IMGUI_API void TextLinkOpenURL(const char* label, const char* url = NULL); // hyperlink text button, automatically open file/url when clicked
|
||||
IMGUI_API bool TextLinkOpenURL(const char* label, const char* url = NULL); // hyperlink text button, automatically open file/url when clicked
|
||||
|
||||
// Widgets: Images
|
||||
// - Read about ImTextureID here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
|
||||
// - 'uv0' and 'uv1' are texture coordinates. Read about them from the same link above.
|
||||
// - Image() pads adds style.ImageBorderSize on each side, ImageButton() adds style.FramePadding on each side.
|
||||
// - ImageButton() draws a background based on regular Button() color + optionally an inner background if specified.
|
||||
// - An obsolete version of Image(), before 1.91.9 (March 2025), had a 'tint_col' parameter which is now supported by the ImageWithBg() function.
|
||||
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1));
|
||||
IMGUI_API void ImageWithBg(ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1));
|
||||
IMGUI_API bool ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1));
|
||||
@@ -2707,7 +2708,7 @@ struct ImGuiListClipper
|
||||
int DisplayEnd; // End of items to display (exclusive)
|
||||
int ItemsCount; // [Internal] Number of items
|
||||
float ItemsHeight; // [Internal] Height of item after a first step and item submission can calculate it
|
||||
float StartPosY; // [Internal] Cursor position at the time of Begin() or after table frozen rows are all processed
|
||||
double StartPosY; // [Internal] Cursor position at the time of Begin() or after table frozen rows are all processed
|
||||
double StartSeekOffsetY; // [Internal] Account for frozen rows in a table and initial loss of precision in very large windows.
|
||||
void* TempData; // [Internal] Internal data
|
||||
|
||||
@@ -3532,10 +3533,14 @@ struct ImFont
|
||||
// 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
|
||||
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
|
||||
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL); // utf8
|
||||
IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width);
|
||||
IMGUI_API const char* CalcWordWrapPosition(float size, const char* text, const char* text_end, float wrap_width);
|
||||
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, ImWchar c, const ImVec4* cpu_fine_clip = NULL);
|
||||
IMGUI_API void RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false);
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
inline const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) { return CalcWordWrapPosition(FontSize * scale, text, text_end, wrap_width); }
|
||||
#endif
|
||||
|
||||
// [Internal] Don't use!
|
||||
IMGUI_API void BuildLookupTable();
|
||||
IMGUI_API void ClearOutputData();
|
||||
@@ -3649,7 +3654,7 @@ struct ImGuiPlatformImeData
|
||||
namespace ImGui
|
||||
{
|
||||
// OBSOLETED in 1.91.9 (from February 2025)
|
||||
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col); // <-- border_col was removed in favor of ImGuiCol_ImageBorder.
|
||||
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col); // <-- 'border_col' was removed in favor of ImGuiCol_ImageBorder. If you use 'tint_col', use ImageWithBg() instead.
|
||||
// OBSOLETED in 1.91.0 (from July 2024)
|
||||
static inline void PushButtonRepeat(bool repeat) { PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat); }
|
||||
static inline void PopButtonRepeat() { PopItemFlag(); }
|
||||
|
||||
403
3rdparty/dear-imgui/imgui_demo.cpp
vendored
403
3rdparty/dear-imgui/imgui_demo.cpp
vendored
@@ -410,9 +410,19 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
return;
|
||||
}
|
||||
|
||||
// Most "big" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details.
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * -12); // e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets.
|
||||
//ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f); // e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align)
|
||||
// Most framed widgets share a common width settings. Remaining width is used for the label.
|
||||
// The width of the frame may be changed with PushItemWidth() or SetNextItemWidth().
|
||||
// - Positive value for absolute size, negative value for right-alignment.
|
||||
// - The default value is about GetWindowWidth() * 0.65f.
|
||||
// - See 'Demo->Layout->Widgets Width' for details.
|
||||
// Here we change the frame width based on how much width we want to give to the label.
|
||||
const float label_width_base = ImGui::GetFontSize() * 12; // Some amount of width for label, based on font size.
|
||||
const float label_width_max = ImGui::GetContentRegionAvail().x * 0.40f; // ...but always leave some room for framed widgets.
|
||||
const float label_width = IM_MIN(label_width_base, label_width_max);
|
||||
ImGui::PushItemWidth(-label_width); // Right-align: framed items will leave 'label_width' available for the label.
|
||||
//ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x * 0.40f); // e.g. Use 40% width for framed widgets, leaving 60% width for labels.
|
||||
//ImGui::PushItemWidth(-ImGui::GetContentRegionAvail().x * 0.40f); // e.g. Use 40% width for labels, leaving 60% width for framed widgets.
|
||||
//ImGui::PushItemWidth(ImGui::GetFontSize() * -12); // e.g. Use XXX width for labels, leaving the rest for framed widgets.
|
||||
|
||||
// Menu Bar
|
||||
DemoWindowMenuBar(&demo_data);
|
||||
@@ -4426,6 +4436,17 @@ static void DemoWindowLayout()
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::Text("SetNextItemWidth/PushItemWidth(-Min(GetContentRegionAvail().x * 0.40f, GetFontSize() * 12))");
|
||||
ImGui::PushItemWidth(-IM_MIN(ImGui::GetFontSize() * 12, ImGui::GetContentRegionAvail().x * 0.40f));
|
||||
ImGui::DragFloat("float##4a", &f);
|
||||
if (show_indented_items)
|
||||
{
|
||||
ImGui::Indent();
|
||||
ImGui::DragFloat("float (indented)##4b", &f);
|
||||
ImGui::Unindent();
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
// Demonstrate using PushItemWidth to surround three items.
|
||||
// Calling SetNextItemWidth() before each of them would have the same effect.
|
||||
ImGui::Text("SetNextItemWidth/PushItemWidth(-FLT_MIN)");
|
||||
@@ -8204,12 +8225,13 @@ static const char* GetTreeLinesFlagsName(ImGuiTreeNodeFlags flags)
|
||||
return "";
|
||||
}
|
||||
|
||||
// We omit the ImGui:: prefix in this function, as we don't expect user to be copy and pasting this code.
|
||||
void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
{
|
||||
IMGUI_DEMO_MARKER("Tools/Style Editor");
|
||||
// You can pass in a reference ImGuiStyle structure to compare to, revert to and save to
|
||||
// (without a reference style pointer, we will use one compared locally as a reference)
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImGuiStyle& style = GetStyle();
|
||||
static ImGuiStyle ref_saved_style;
|
||||
|
||||
// Default to using internal storage as reference
|
||||
@@ -8220,206 +8242,209 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
if (ref == NULL)
|
||||
ref = &ref_saved_style;
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
|
||||
PushItemWidth(GetWindowWidth() * 0.50f);
|
||||
|
||||
if (ImGui::ShowStyleSelector("Colors##Selector"))
|
||||
ref_saved_style = style;
|
||||
ImGui::ShowFontSelector("Fonts##Selector");
|
||||
{
|
||||
// General
|
||||
if (ShowStyleSelector("Colors##Selector"))
|
||||
ref_saved_style = style;
|
||||
ShowFontSelector("Fonts##Selector");
|
||||
|
||||
// Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f)
|
||||
if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"))
|
||||
style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding
|
||||
{ bool border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? 1.0f : 0.0f; } }
|
||||
ImGui::SameLine();
|
||||
{ bool border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? 1.0f : 0.0f; } }
|
||||
ImGui::SameLine();
|
||||
{ bool border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? 1.0f : 0.0f; } }
|
||||
// Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f)
|
||||
if (SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"))
|
||||
style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding
|
||||
{ bool border = (style.WindowBorderSize > 0.0f); if (Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? 1.0f : 0.0f; } }
|
||||
SameLine();
|
||||
{ bool border = (style.FrameBorderSize > 0.0f); if (Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? 1.0f : 0.0f; } }
|
||||
SameLine();
|
||||
{ bool border = (style.PopupBorderSize > 0.0f); if (Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? 1.0f : 0.0f; } }
|
||||
}
|
||||
|
||||
// Save/Revert button
|
||||
if (ImGui::Button("Save Ref"))
|
||||
if (Button("Save Ref"))
|
||||
*ref = ref_saved_style = style;
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Revert Ref"))
|
||||
SameLine();
|
||||
if (Button("Revert Ref"))
|
||||
style = *ref;
|
||||
ImGui::SameLine();
|
||||
SameLine();
|
||||
HelpMarker(
|
||||
"Save/Revert in local non-persistent storage. Default Colors definition are not affected. "
|
||||
"Use \"Export\" below to save them somewhere.");
|
||||
|
||||
ImGui::Separator();
|
||||
Separator();
|
||||
|
||||
if (ImGui::BeginTabBar("##tabs", ImGuiTabBarFlags_None))
|
||||
if (BeginTabBar("##tabs", ImGuiTabBarFlags_None))
|
||||
{
|
||||
if (ImGui::BeginTabItem("Sizes"))
|
||||
if (BeginTabItem("Sizes"))
|
||||
{
|
||||
ImGui::SeparatorText("Main");
|
||||
ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
|
||||
ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
|
||||
ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
|
||||
ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
|
||||
ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
|
||||
ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
|
||||
ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
|
||||
ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
|
||||
SeparatorText("Main");
|
||||
SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
|
||||
SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
|
||||
SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
|
||||
SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
|
||||
SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
|
||||
SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
|
||||
SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
|
||||
SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
|
||||
|
||||
ImGui::SeparatorText("Borders");
|
||||
ImGui::SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
ImGui::SliderFloat("ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
ImGui::SliderFloat("PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
ImGui::SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
SeparatorText("Borders");
|
||||
SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
SliderFloat("ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
SliderFloat("PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
|
||||
ImGui::SeparatorText("Rounding");
|
||||
ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 12.0f, "%.0f");
|
||||
ImGui::SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 12.0f, "%.0f");
|
||||
ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f");
|
||||
ImGui::SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f");
|
||||
ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
|
||||
ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f");
|
||||
SeparatorText("Rounding");
|
||||
SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 12.0f, "%.0f");
|
||||
SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 12.0f, "%.0f");
|
||||
SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f");
|
||||
SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f");
|
||||
SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
|
||||
SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f");
|
||||
|
||||
ImGui::SeparatorText("Tabs");
|
||||
ImGui::SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
ImGui::SliderFloat("TabBarBorderSize", &style.TabBarBorderSize, 0.0f, 2.0f, "%.0f");
|
||||
ImGui::SliderFloat("TabBarOverlineSize", &style.TabBarOverlineSize, 0.0f, 3.0f, "%.0f");
|
||||
ImGui::SameLine(); HelpMarker("Overline is only drawn over the selected tab when ImGuiTabBarFlags_DrawSelectedOverline is set.");
|
||||
ImGui::DragFloat("TabCloseButtonMinWidthSelected", &style.TabCloseButtonMinWidthSelected, 0.1f, -1.0f, 100.0f, (style.TabCloseButtonMinWidthSelected < 0.0f) ? "%.0f (Always)" : "%.0f");
|
||||
ImGui::DragFloat("TabCloseButtonMinWidthUnselected", &style.TabCloseButtonMinWidthUnselected, 0.1f, -1.0f, 100.0f, (style.TabCloseButtonMinWidthUnselected < 0.0f) ? "%.0f (Always)" : "%.0f");
|
||||
ImGui::SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f");
|
||||
SeparatorText("Tabs");
|
||||
SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
SliderFloat("TabBarBorderSize", &style.TabBarBorderSize, 0.0f, 2.0f, "%.0f");
|
||||
SliderFloat("TabBarOverlineSize", &style.TabBarOverlineSize, 0.0f, 3.0f, "%.0f");
|
||||
SameLine(); HelpMarker("Overline is only drawn over the selected tab when ImGuiTabBarFlags_DrawSelectedOverline is set.");
|
||||
DragFloat("TabCloseButtonMinWidthSelected", &style.TabCloseButtonMinWidthSelected, 0.1f, -1.0f, 100.0f, (style.TabCloseButtonMinWidthSelected < 0.0f) ? "%.0f (Always)" : "%.0f");
|
||||
DragFloat("TabCloseButtonMinWidthUnselected", &style.TabCloseButtonMinWidthUnselected, 0.1f, -1.0f, 100.0f, (style.TabCloseButtonMinWidthUnselected < 0.0f) ? "%.0f (Always)" : "%.0f");
|
||||
SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f");
|
||||
|
||||
ImGui::SeparatorText("Tables");
|
||||
ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f");
|
||||
ImGui::SliderAngle("TableAngledHeadersAngle", &style.TableAngledHeadersAngle, -50.0f, +50.0f);
|
||||
ImGui::SliderFloat2("TableAngledHeadersTextAlign", (float*)&style.TableAngledHeadersTextAlign, 0.0f, 1.0f, "%.2f");
|
||||
SeparatorText("Tables");
|
||||
SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f");
|
||||
SliderAngle("TableAngledHeadersAngle", &style.TableAngledHeadersAngle, -50.0f, +50.0f);
|
||||
SliderFloat2("TableAngledHeadersTextAlign", (float*)&style.TableAngledHeadersTextAlign, 0.0f, 1.0f, "%.2f");
|
||||
|
||||
ImGui::SeparatorText("Trees");
|
||||
bool combo_open = ImGui::BeginCombo("TreeLinesFlags", GetTreeLinesFlagsName(style.TreeLinesFlags));
|
||||
ImGui::SameLine();
|
||||
SeparatorText("Trees");
|
||||
bool combo_open = BeginCombo("TreeLinesFlags", GetTreeLinesFlagsName(style.TreeLinesFlags));
|
||||
SameLine();
|
||||
HelpMarker("[Experimental] Tree lines may not work in all situations (e.g. using a clipper) and may incurs slight traversal overhead.\n\nImGuiTreeNodeFlags_DrawLinesFull is faster than ImGuiTreeNodeFlags_DrawLinesToNode.");
|
||||
if (combo_open)
|
||||
{
|
||||
const ImGuiTreeNodeFlags options[] = { ImGuiTreeNodeFlags_DrawLinesNone, ImGuiTreeNodeFlags_DrawLinesFull, ImGuiTreeNodeFlags_DrawLinesToNodes };
|
||||
for (ImGuiTreeNodeFlags option : options)
|
||||
if (ImGui::Selectable(GetTreeLinesFlagsName(option), style.TreeLinesFlags == option))
|
||||
if (Selectable(GetTreeLinesFlagsName(option), style.TreeLinesFlags == option))
|
||||
style.TreeLinesFlags = option;
|
||||
ImGui::EndCombo();
|
||||
EndCombo();
|
||||
}
|
||||
ImGui::SliderFloat("TreeLinesSize", &style.TreeLinesSize, 0.0f, 2.0f, "%.0f");
|
||||
ImGui::SliderFloat("TreeLinesRounding", &style.TreeLinesRounding, 0.0f, 12.0f, "%.0f");
|
||||
SliderFloat("TreeLinesSize", &style.TreeLinesSize, 0.0f, 2.0f, "%.0f");
|
||||
SliderFloat("TreeLinesRounding", &style.TreeLinesRounding, 0.0f, 12.0f, "%.0f");
|
||||
|
||||
ImGui::SeparatorText("Windows");
|
||||
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
||||
ImGui::SliderFloat("WindowBorderHoverPadding", &style.WindowBorderHoverPadding, 1.0f, 20.0f, "%.0f");
|
||||
SeparatorText("Windows");
|
||||
SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
||||
SliderFloat("WindowBorderHoverPadding", &style.WindowBorderHoverPadding, 1.0f, 20.0f, "%.0f");
|
||||
int window_menu_button_position = style.WindowMenuButtonPosition + 1;
|
||||
if (ImGui::Combo("WindowMenuButtonPosition", (int*)&window_menu_button_position, "None\0Left\0Right\0"))
|
||||
if (Combo("WindowMenuButtonPosition", (int*)&window_menu_button_position, "None\0Left\0Right\0"))
|
||||
style.WindowMenuButtonPosition = (ImGuiDir)(window_menu_button_position - 1);
|
||||
|
||||
ImGui::SeparatorText("Widgets");
|
||||
ImGui::Combo("ColorButtonPosition", (int*)&style.ColorButtonPosition, "Left\0Right\0");
|
||||
ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f");
|
||||
ImGui::SameLine(); HelpMarker("Alignment applies when a button is larger than its text content.");
|
||||
ImGui::SliderFloat2("SelectableTextAlign", (float*)&style.SelectableTextAlign, 0.0f, 1.0f, "%.2f");
|
||||
ImGui::SameLine(); HelpMarker("Alignment applies when a selectable is larger than its text content.");
|
||||
ImGui::SliderFloat("SeparatorTextBorderSize", &style.SeparatorTextBorderSize, 0.0f, 10.0f, "%.0f");
|
||||
ImGui::SliderFloat2("SeparatorTextAlign", (float*)&style.SeparatorTextAlign, 0.0f, 1.0f, "%.2f");
|
||||
ImGui::SliderFloat2("SeparatorTextPadding", (float*)&style.SeparatorTextPadding, 0.0f, 40.0f, "%.0f");
|
||||
ImGui::SliderFloat("LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f");
|
||||
ImGui::SliderFloat("ImageBorderSize", &style.ImageBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
SeparatorText("Widgets");
|
||||
Combo("ColorButtonPosition", (int*)&style.ColorButtonPosition, "Left\0Right\0");
|
||||
SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f");
|
||||
SameLine(); HelpMarker("Alignment applies when a button is larger than its text content.");
|
||||
SliderFloat2("SelectableTextAlign", (float*)&style.SelectableTextAlign, 0.0f, 1.0f, "%.2f");
|
||||
SameLine(); HelpMarker("Alignment applies when a selectable is larger than its text content.");
|
||||
SliderFloat("SeparatorTextBorderSize", &style.SeparatorTextBorderSize, 0.0f, 10.0f, "%.0f");
|
||||
SliderFloat2("SeparatorTextAlign", (float*)&style.SeparatorTextAlign, 0.0f, 1.0f, "%.2f");
|
||||
SliderFloat2("SeparatorTextPadding", (float*)&style.SeparatorTextPadding, 0.0f, 40.0f, "%.0f");
|
||||
SliderFloat("LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f");
|
||||
SliderFloat("ImageBorderSize", &style.ImageBorderSize, 0.0f, 1.0f, "%.0f");
|
||||
|
||||
ImGui::SeparatorText("Tooltips");
|
||||
SeparatorText("Tooltips");
|
||||
for (int n = 0; n < 2; n++)
|
||||
if (ImGui::TreeNodeEx(n == 0 ? "HoverFlagsForTooltipMouse" : "HoverFlagsForTooltipNav"))
|
||||
if (TreeNodeEx(n == 0 ? "HoverFlagsForTooltipMouse" : "HoverFlagsForTooltipNav"))
|
||||
{
|
||||
ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse : &style.HoverFlagsForTooltipNav;
|
||||
ImGui::CheckboxFlags("ImGuiHoveredFlags_DelayNone", p, ImGuiHoveredFlags_DelayNone);
|
||||
ImGui::CheckboxFlags("ImGuiHoveredFlags_DelayShort", p, ImGuiHoveredFlags_DelayShort);
|
||||
ImGui::CheckboxFlags("ImGuiHoveredFlags_DelayNormal", p, ImGuiHoveredFlags_DelayNormal);
|
||||
ImGui::CheckboxFlags("ImGuiHoveredFlags_Stationary", p, ImGuiHoveredFlags_Stationary);
|
||||
ImGui::CheckboxFlags("ImGuiHoveredFlags_NoSharedDelay", p, ImGuiHoveredFlags_NoSharedDelay);
|
||||
ImGui::TreePop();
|
||||
CheckboxFlags("ImGuiHoveredFlags_DelayNone", p, ImGuiHoveredFlags_DelayNone);
|
||||
CheckboxFlags("ImGuiHoveredFlags_DelayShort", p, ImGuiHoveredFlags_DelayShort);
|
||||
CheckboxFlags("ImGuiHoveredFlags_DelayNormal", p, ImGuiHoveredFlags_DelayNormal);
|
||||
CheckboxFlags("ImGuiHoveredFlags_Stationary", p, ImGuiHoveredFlags_Stationary);
|
||||
CheckboxFlags("ImGuiHoveredFlags_NoSharedDelay", p, ImGuiHoveredFlags_NoSharedDelay);
|
||||
TreePop();
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Misc");
|
||||
ImGui::SliderFloat2("DisplayWindowPadding", (float*)&style.DisplayWindowPadding, 0.0f, 30.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Apply to regular windows: amount which we enforce to keep visible when moving near edges of your screen.");
|
||||
ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Apply to every windows, menus, popups, tooltips: amount where we avoid displaying contents. Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
|
||||
SeparatorText("Misc");
|
||||
SliderFloat2("DisplayWindowPadding", (float*)&style.DisplayWindowPadding, 0.0f, 30.0f, "%.0f"); SameLine(); HelpMarker("Apply to regular windows: amount which we enforce to keep visible when moving near edges of your screen.");
|
||||
SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); SameLine(); HelpMarker("Apply to every windows, menus, popups, tooltips: amount where we avoid displaying contents. Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
|
||||
|
||||
ImGui::EndTabItem();
|
||||
EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Colors"))
|
||||
if (BeginTabItem("Colors"))
|
||||
{
|
||||
static int output_dest = 0;
|
||||
static bool output_only_modified = true;
|
||||
if (ImGui::Button("Export"))
|
||||
if (Button("Export"))
|
||||
{
|
||||
if (output_dest == 0)
|
||||
ImGui::LogToClipboard();
|
||||
LogToClipboard();
|
||||
else
|
||||
ImGui::LogToTTY();
|
||||
ImGui::LogText("ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
|
||||
LogToTTY();
|
||||
LogText("ImVec4* colors = GetStyle().Colors;" IM_NEWLINE);
|
||||
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
||||
{
|
||||
const ImVec4& col = style.Colors[i];
|
||||
const char* name = ImGui::GetStyleColorName(i);
|
||||
const char* name = GetStyleColorName(i);
|
||||
if (!output_only_modified || memcmp(&col, &ref->Colors[i], sizeof(ImVec4)) != 0)
|
||||
ImGui::LogText("colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);" IM_NEWLINE,
|
||||
LogText("colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);" IM_NEWLINE,
|
||||
name, 23 - (int)strlen(name), "", col.x, col.y, col.z, col.w);
|
||||
}
|
||||
ImGui::LogFinish();
|
||||
LogFinish();
|
||||
}
|
||||
ImGui::SameLine(); ImGui::SetNextItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0");
|
||||
ImGui::SameLine(); ImGui::Checkbox("Only Modified Colors", &output_only_modified);
|
||||
SameLine(); SetNextItemWidth(120); Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0");
|
||||
SameLine(); Checkbox("Only Modified Colors", &output_only_modified);
|
||||
|
||||
static ImGuiTextFilter filter;
|
||||
filter.Draw("Filter colors", ImGui::GetFontSize() * 16);
|
||||
filter.Draw("Filter colors", GetFontSize() * 16);
|
||||
|
||||
static ImGuiColorEditFlags alpha_flags = 0;
|
||||
if (ImGui::RadioButton("Opaque", alpha_flags == ImGuiColorEditFlags_AlphaOpaque)) { alpha_flags = ImGuiColorEditFlags_AlphaOpaque; } ImGui::SameLine();
|
||||
if (ImGui::RadioButton("Alpha", alpha_flags == ImGuiColorEditFlags_None)) { alpha_flags = ImGuiColorEditFlags_None; } ImGui::SameLine();
|
||||
if (ImGui::RadioButton("Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) { alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf; } ImGui::SameLine();
|
||||
if (RadioButton("Opaque", alpha_flags == ImGuiColorEditFlags_AlphaOpaque)) { alpha_flags = ImGuiColorEditFlags_AlphaOpaque; } SameLine();
|
||||
if (RadioButton("Alpha", alpha_flags == ImGuiColorEditFlags_None)) { alpha_flags = ImGuiColorEditFlags_None; } SameLine();
|
||||
if (RadioButton("Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) { alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf; } SameLine();
|
||||
HelpMarker(
|
||||
"In the color list:\n"
|
||||
"Left-click on color square to open color picker,\n"
|
||||
"Right-click to open edit options menu.");
|
||||
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10), ImVec2(FLT_MAX, FLT_MAX));
|
||||
ImGui::BeginChild("##colors", ImVec2(0, 0), ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
|
||||
SetNextWindowSizeConstraints(ImVec2(0.0f, GetTextLineHeightWithSpacing() * 10), ImVec2(FLT_MAX, FLT_MAX));
|
||||
BeginChild("##colors", ImVec2(0, 0), ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
|
||||
PushItemWidth(GetFontSize() * -12);
|
||||
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
||||
{
|
||||
const char* name = ImGui::GetStyleColorName(i);
|
||||
const char* name = GetStyleColorName(i);
|
||||
if (!filter.PassFilter(name))
|
||||
continue;
|
||||
ImGui::PushID(i);
|
||||
PushID(i);
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
if (ImGui::Button("?"))
|
||||
ImGui::DebugFlashStyleColor((ImGuiCol)i);
|
||||
ImGui::SetItemTooltip("Flash given color to identify places where it is used.");
|
||||
ImGui::SameLine();
|
||||
if (Button("?"))
|
||||
DebugFlashStyleColor((ImGuiCol)i);
|
||||
SetItemTooltip("Flash given color to identify places where it is used.");
|
||||
SameLine();
|
||||
#endif
|
||||
ImGui::ColorEdit4("##color", (float*)&style.Colors[i], ImGuiColorEditFlags_AlphaBar | alpha_flags);
|
||||
ColorEdit4("##color", (float*)&style.Colors[i], ImGuiColorEditFlags_AlphaBar | alpha_flags);
|
||||
if (memcmp(&style.Colors[i], &ref->Colors[i], sizeof(ImVec4)) != 0)
|
||||
{
|
||||
// Tips: in a real user application, you may want to merge and use an icon font into the main font,
|
||||
// so instead of "Save"/"Revert" you'd use icons!
|
||||
// Read the FAQ and docs/FONTS.md about using icon fonts. It's really easy and super convenient!
|
||||
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Save")) { ref->Colors[i] = style.Colors[i]; }
|
||||
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Revert")) { style.Colors[i] = ref->Colors[i]; }
|
||||
SameLine(0.0f, style.ItemInnerSpacing.x); if (Button("Save")) { ref->Colors[i] = style.Colors[i]; }
|
||||
SameLine(0.0f, style.ItemInnerSpacing.x); if (Button("Revert")) { style.Colors[i] = ref->Colors[i]; }
|
||||
}
|
||||
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
|
||||
ImGui::TextUnformatted(name);
|
||||
ImGui::PopID();
|
||||
SameLine(0.0f, style.ItemInnerSpacing.x);
|
||||
TextUnformatted(name);
|
||||
PopID();
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::EndChild();
|
||||
PopItemWidth();
|
||||
EndChild();
|
||||
|
||||
ImGui::EndTabItem();
|
||||
EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Fonts"))
|
||||
if (BeginTabItem("Fonts"))
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiIO& io = GetIO();
|
||||
ImFontAtlas* atlas = io.Fonts;
|
||||
HelpMarker("Read FAQ and docs/FONTS.md for details on font loading.");
|
||||
ImGui::ShowFontAtlas(atlas);
|
||||
ShowFontAtlas(atlas);
|
||||
|
||||
// Post-baking font scaling. Note that this is NOT the nice way of scaling fonts, read below.
|
||||
// (we enforce hard clamping manually as by default DragFloat/SliderFloat allows CTRL+Click text to get out of bounds).
|
||||
@@ -8431,119 +8456,119 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
"rebuild the font atlas, and call style.ScaleAllSizes() on a reference ImGuiStyle structure.\n"
|
||||
"Using those settings here will give you poor quality results.");
|
||||
static float window_scale = 1.0f;
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
|
||||
if (ImGui::DragFloat("window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_AlwaysClamp)) // Scale only this window
|
||||
ImGui::SetWindowFontScale(window_scale);
|
||||
ImGui::DragFloat("global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_AlwaysClamp); // Scale everything
|
||||
ImGui::PopItemWidth();
|
||||
PushItemWidth(GetFontSize() * 8);
|
||||
if (DragFloat("window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_AlwaysClamp)) // Scale only this window
|
||||
SetWindowFontScale(window_scale);
|
||||
DragFloat("global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_AlwaysClamp); // Scale everything
|
||||
PopItemWidth();
|
||||
|
||||
ImGui::EndTabItem();
|
||||
EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Rendering"))
|
||||
if (BeginTabItem("Rendering"))
|
||||
{
|
||||
ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines);
|
||||
ImGui::SameLine();
|
||||
Checkbox("Anti-aliased lines", &style.AntiAliasedLines);
|
||||
SameLine();
|
||||
HelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.");
|
||||
|
||||
ImGui::Checkbox("Anti-aliased lines use texture", &style.AntiAliasedLinesUseTex);
|
||||
ImGui::SameLine();
|
||||
Checkbox("Anti-aliased lines use texture", &style.AntiAliasedLinesUseTex);
|
||||
SameLine();
|
||||
HelpMarker("Faster lines using texture data. Require backend to render with bilinear filtering (not point/nearest filtering).");
|
||||
|
||||
ImGui::Checkbox("Anti-aliased fill", &style.AntiAliasedFill);
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
|
||||
ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f, "%.2f");
|
||||
Checkbox("Anti-aliased fill", &style.AntiAliasedFill);
|
||||
PushItemWidth(GetFontSize() * 8);
|
||||
DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f, "%.2f");
|
||||
if (style.CurveTessellationTol < 0.10f) style.CurveTessellationTol = 0.10f;
|
||||
|
||||
// When editing the "Circle Segment Max Error" value, draw a preview of its effect on auto-tessellated circles.
|
||||
ImGui::DragFloat("Circle Tessellation Max Error", &style.CircleTessellationMaxError , 0.005f, 0.10f, 5.0f, "%.2f", ImGuiSliderFlags_AlwaysClamp);
|
||||
const bool show_samples = ImGui::IsItemActive();
|
||||
DragFloat("Circle Tessellation Max Error", &style.CircleTessellationMaxError , 0.005f, 0.10f, 5.0f, "%.2f", ImGuiSliderFlags_AlwaysClamp);
|
||||
const bool show_samples = IsItemActive();
|
||||
if (show_samples)
|
||||
ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
|
||||
if (show_samples && ImGui::BeginTooltip())
|
||||
SetNextWindowPos(GetCursorScreenPos());
|
||||
if (show_samples && BeginTooltip())
|
||||
{
|
||||
ImGui::TextUnformatted("(R = radius, N = approx number of segments)");
|
||||
ImGui::Spacing();
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
const float min_widget_width = ImGui::CalcTextSize("R: MMM\nN: MMM").x;
|
||||
TextUnformatted("(R = radius, N = approx number of segments)");
|
||||
Spacing();
|
||||
ImDrawList* draw_list = GetWindowDrawList();
|
||||
const float min_widget_width = CalcTextSize("R: MMM\nN: MMM").x;
|
||||
for (int n = 0; n < 8; n++)
|
||||
{
|
||||
const float RAD_MIN = 5.0f;
|
||||
const float RAD_MAX = 70.0f;
|
||||
const float rad = RAD_MIN + (RAD_MAX - RAD_MIN) * (float)n / (8.0f - 1.0f);
|
||||
|
||||
ImGui::BeginGroup();
|
||||
BeginGroup();
|
||||
|
||||
// N is not always exact here due to how PathArcTo() function work internally
|
||||
ImGui::Text("R: %.f\nN: %d", rad, draw_list->_CalcCircleAutoSegmentCount(rad));
|
||||
Text("R: %.f\nN: %d", rad, draw_list->_CalcCircleAutoSegmentCount(rad));
|
||||
|
||||
const float canvas_width = IM_MAX(min_widget_width, rad * 2.0f);
|
||||
const float offset_x = floorf(canvas_width * 0.5f);
|
||||
const float offset_y = floorf(RAD_MAX);
|
||||
|
||||
const ImVec2 p1 = ImGui::GetCursorScreenPos();
|
||||
draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad, ImGui::GetColorU32(ImGuiCol_Text));
|
||||
ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
|
||||
const ImVec2 p1 = GetCursorScreenPos();
|
||||
draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad, GetColorU32(ImGuiCol_Text));
|
||||
Dummy(ImVec2(canvas_width, RAD_MAX * 2));
|
||||
|
||||
/*
|
||||
const ImVec2 p2 = ImGui::GetCursorScreenPos();
|
||||
draw_list->AddCircleFilled(ImVec2(p2.x + offset_x, p2.y + offset_y), rad, ImGui::GetColorU32(ImGuiCol_Text));
|
||||
ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
|
||||
const ImVec2 p2 = GetCursorScreenPos();
|
||||
draw_list->AddCircleFilled(ImVec2(p2.x + offset_x, p2.y + offset_y), rad, GetColorU32(ImGuiCol_Text));
|
||||
Dummy(ImVec2(canvas_width, RAD_MAX * 2));
|
||||
*/
|
||||
|
||||
ImGui::EndGroup();
|
||||
ImGui::SameLine();
|
||||
EndGroup();
|
||||
SameLine();
|
||||
}
|
||||
ImGui::EndTooltip();
|
||||
EndTooltip();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
SameLine();
|
||||
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("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::PopItemWidth();
|
||||
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.
|
||||
DragFloat("Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f, 1.0f, "%.2f"); SameLine(); HelpMarker("Additional alpha multiplier for disabled items (multiply over current value of Alpha).");
|
||||
PopItemWidth();
|
||||
|
||||
ImGui::EndTabItem();
|
||||
EndTabItem();
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
EndTabBar();
|
||||
}
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
PopItemWidth();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] User Guide / ShowUserGuide()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// We omit the ImGui:: prefix in this function, as we don't expect user to be copy and pasting this code.
|
||||
void ImGui::ShowUserGuide()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui::BulletText("Double-click on title bar to collapse window.");
|
||||
ImGui::BulletText(
|
||||
ImGuiIO& io = GetIO();
|
||||
BulletText("Double-click on title bar to collapse window.");
|
||||
BulletText(
|
||||
"Click and drag on lower corner to resize window\n"
|
||||
"(double-click to auto fit window to its contents).");
|
||||
ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
|
||||
ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||
ImGui::BulletText("CTRL+Tab to select a window.");
|
||||
BulletText("CTRL+Click on a slider or drag box to input value as text.");
|
||||
BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||
BulletText("CTRL+Tab to select a window.");
|
||||
if (io.FontAllowUserScaling)
|
||||
ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
||||
ImGui::BulletText("While inputting text:\n");
|
||||
ImGui::Indent();
|
||||
ImGui::BulletText("CTRL+Left/Right to word jump.");
|
||||
ImGui::BulletText("CTRL+A or double-click to select all.");
|
||||
ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste.");
|
||||
ImGui::BulletText("CTRL+Z to undo, CTRL+Y/CTRL+SHIFT+Z to redo.");
|
||||
ImGui::BulletText("ESCAPE to revert.");
|
||||
ImGui::Unindent();
|
||||
ImGui::BulletText("With keyboard navigation enabled:");
|
||||
ImGui::Indent();
|
||||
ImGui::BulletText("Arrow keys to navigate.");
|
||||
ImGui::BulletText("Space to activate a widget.");
|
||||
ImGui::BulletText("Return to input text into a widget.");
|
||||
ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window.");
|
||||
ImGui::BulletText("Alt to jump to the menu layer of a window.");
|
||||
ImGui::Unindent();
|
||||
BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
||||
BulletText("While inputting text:\n");
|
||||
Indent();
|
||||
BulletText("CTRL+Left/Right to word jump.");
|
||||
BulletText("CTRL+A or double-click to select all.");
|
||||
BulletText("CTRL+X/C/V to use clipboard cut/copy/paste.");
|
||||
BulletText("CTRL+Z to undo, CTRL+Y/CTRL+SHIFT+Z to redo.");
|
||||
BulletText("ESCAPE to revert.");
|
||||
Unindent();
|
||||
BulletText("With keyboard navigation enabled:");
|
||||
Indent();
|
||||
BulletText("Arrow keys to navigate.");
|
||||
BulletText("Space to activate a widget.");
|
||||
BulletText("Return to input text into a widget.");
|
||||
BulletText("Escape to deactivate a widget, close popup, exit child window.");
|
||||
BulletText("Alt to jump to the menu layer of a window.");
|
||||
Unindent();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
13
3rdparty/dear-imgui/imgui_draw.cpp
vendored
13
3rdparty/dear-imgui/imgui_draw.cpp
vendored
@@ -3936,7 +3936,7 @@ static inline const char* CalcWordWrapNextLineStartA(const char* text, const cha
|
||||
// Simple word-wrapping for English, not full-featured. Please submit failing cases!
|
||||
// This will return the next location to wrap from. If no wrapping if necessary, this will fast-forward to e.g. text_end.
|
||||
// FIXME: Much possible improvements (don't cut things like "word !", "word!!!" but cut within "word,,,,", more sensible support for punctuations, support for Unicode punctuations, etc.)
|
||||
const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width)
|
||||
const char* ImFont::CalcWordWrapPosition(float size, const char* text, const char* text_end, float wrap_width)
|
||||
{
|
||||
// For references, possible wrap point marked with ^
|
||||
// "aaa bbb, ccc,ddd. eee fff. ggg!"
|
||||
@@ -3952,6 +3952,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
||||
float line_width = 0.0f;
|
||||
float word_width = 0.0f;
|
||||
float blank_width = 0.0f;
|
||||
const float scale = size / FontSize;
|
||||
wrap_width /= scale; // We work with unscaled widths to avoid scaling every characters
|
||||
|
||||
const char* word_end = text;
|
||||
@@ -4055,7 +4056,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
||||
{
|
||||
// Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.
|
||||
if (!word_wrap_eol)
|
||||
word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - line_width);
|
||||
word_wrap_eol = CalcWordWrapPosition(size, s, text_end, wrap_width - line_width);
|
||||
|
||||
if (s >= word_wrap_eol)
|
||||
{
|
||||
@@ -4175,10 +4176,10 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
||||
const char* line_end = (const char*)ImMemchr(s, '\n', text_end - s);
|
||||
if (word_wrap_enabled)
|
||||
{
|
||||
// FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA().
|
||||
// If the specs for CalcWordWrapPositionA() were reworked to optionally return on \n we could combine both.
|
||||
// FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPosition().
|
||||
// If the specs for CalcWordWrapPosition() were reworked to optionally return on \n we could combine both.
|
||||
// However it is still better than nothing performing the fast-forward!
|
||||
s = CalcWordWrapPositionA(scale, s, line_end ? line_end : text_end, wrap_width);
|
||||
s = CalcWordWrapPosition(size, s, line_end ? line_end : text_end, wrap_width);
|
||||
s = CalcWordWrapNextLineStartA(s, text_end);
|
||||
}
|
||||
else
|
||||
@@ -4223,7 +4224,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
||||
{
|
||||
// Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.
|
||||
if (!word_wrap_eol)
|
||||
word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - (x - origin_x));
|
||||
word_wrap_eol = CalcWordWrapPosition(size, s, text_end, wrap_width - (x - origin_x));
|
||||
|
||||
if (s >= word_wrap_eol)
|
||||
{
|
||||
|
||||
2
3rdparty/dear-imgui/imgui_internal.h
vendored
2
3rdparty/dear-imgui/imgui_internal.h
vendored
@@ -496,6 +496,8 @@ static inline float ImTrunc(float f)
|
||||
static inline ImVec2 ImTrunc(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); }
|
||||
static inline float ImFloor(float f) { return (float)((f >= 0 || (float)(int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf()
|
||||
static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2(ImFloor(v.x), ImFloor(v.y)); }
|
||||
static inline float ImTrunc64(float f) { return (float)(ImS64)(f); }
|
||||
static inline float ImRound64(float f) { return (float)(ImS64)(f + 0.5f); }
|
||||
static inline int ImModPositive(int a, int b) { return (a + b) % b; }
|
||||
static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }
|
||||
static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
|
||||
|
||||
19
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
19
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
@@ -1529,14 +1529,14 @@ bool ImGui::TextLink(const char* label)
|
||||
return pressed;
|
||||
}
|
||||
|
||||
void ImGui::TextLinkOpenURL(const char* label, const char* url)
|
||||
bool ImGui::TextLinkOpenURL(const char* label, const char* url)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (url == NULL)
|
||||
url = label;
|
||||
if (TextLink(label))
|
||||
if (g.PlatformIO.Platform_OpenInShellFn != NULL)
|
||||
g.PlatformIO.Platform_OpenInShellFn(&g, url);
|
||||
bool pressed = TextLink(label);
|
||||
if (pressed && g.PlatformIO.Platform_OpenInShellFn != NULL)
|
||||
g.PlatformIO.Platform_OpenInShellFn(&g, url);
|
||||
SetItemTooltip(LocalizeGetMsg(ImGuiLocKey_OpenLink_s), url); // It is more reassuring for user to _always_ display URL when we same as label
|
||||
if (BeginPopupContextItem())
|
||||
{
|
||||
@@ -1544,6 +1544,7 @@ void ImGui::TextLinkOpenURL(const char* label, const char* url)
|
||||
SetClipboardText(url);
|
||||
EndPopup();
|
||||
}
|
||||
return pressed;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -6704,13 +6705,12 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
if ((flags & ImGuiTreeNodeFlags_DrawLinesMask_) == 0)
|
||||
flags |= g.Style.TreeLinesFlags;
|
||||
const bool draw_tree_lines = (flags & (ImGuiTreeNodeFlags_DrawLinesFull | ImGuiTreeNodeFlags_DrawLinesToNodes)) && (frame_bb.Min.y < window->ClipRect.Max.y) && (g.Style.TreeLinesSize > 0.0f);
|
||||
if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
|
||||
if (!(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
|
||||
{
|
||||
store_tree_node_stack_data = draw_tree_lines;
|
||||
if ((flags & ImGuiTreeNodeFlags_NavLeftJumpsToParent) && !g.NavIdIsAlive)
|
||||
if (g.NavMoveDir == ImGuiDir_Left && g.NavWindow == window && NavMoveRequestButNoResultYet())
|
||||
store_tree_node_stack_data = true;
|
||||
if (draw_tree_lines)
|
||||
store_tree_node_stack_data = true;
|
||||
}
|
||||
|
||||
const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0;
|
||||
@@ -6903,7 +6903,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
TablePopBackgroundChannel();
|
||||
}
|
||||
|
||||
if (store_tree_node_stack_data && is_open)
|
||||
if (is_open && store_tree_node_stack_data)
|
||||
TreeNodeStoreStackData(flags, text_pos.x - text_offset_x); // Call before TreePushOverrideID()
|
||||
if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
|
||||
TreePushOverrideID(id); // Could use TreePush(label) but this avoid computing twice
|
||||
@@ -7004,7 +7004,7 @@ void ImGui::TreePop()
|
||||
window->DC.TreeDepth--;
|
||||
ImU32 tree_depth_mask = (1 << window->DC.TreeDepth);
|
||||
|
||||
if (window->DC.TreeHasStackDataDepthMask & tree_depth_mask) // Only set during request
|
||||
if (window->DC.TreeHasStackDataDepthMask & tree_depth_mask)
|
||||
{
|
||||
const ImGuiTreeNodeStackData* data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
|
||||
IM_ASSERT(data->ID == window->IDStack.back());
|
||||
@@ -7020,6 +7020,7 @@ void ImGui::TreePop()
|
||||
|
||||
g.TreeNodeStack.pop_back();
|
||||
window->DC.TreeHasStackDataDepthMask &= ~tree_depth_mask;
|
||||
window->DC.TreeRecordsClippedNodesY2Mask &= ~tree_depth_mask;
|
||||
}
|
||||
|
||||
IM_ASSERT(window->IDStack.Size > 1); // There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much.
|
||||
|
||||
4
3rdparty/dear-imgui/widgets/markdown.inl
vendored
4
3rdparty/dear-imgui/widgets/markdown.inl
vendored
@@ -147,7 +147,7 @@ namespace ImGui
|
||||
{
|
||||
const float scale = 1.0f;
|
||||
float widthLeft = GetContentRegionAvail().x;
|
||||
const char* endPrevLine = pFont->CalcWordWrapPositionA( scale, text, text_end, widthLeft );
|
||||
const char* endPrevLine = pFont->CalcWordWrapPosition( scale, text, text_end, widthLeft );
|
||||
ImGui::TextUnformatted( text, endPrevLine );
|
||||
if( bIndentToHere )
|
||||
{
|
||||
@@ -163,7 +163,7 @@ namespace ImGui
|
||||
{
|
||||
text = endPrevLine;
|
||||
if( *text == ' ' ) { ++text; } // skip a space at start of line
|
||||
endPrevLine = pFont->CalcWordWrapPositionA( scale, text, text_end, widthLeft );
|
||||
endPrevLine = pFont->CalcWordWrapPosition( scale, text, text_end, widthLeft );
|
||||
if (text == endPrevLine)
|
||||
{
|
||||
endPrevLine++;
|
||||
|
||||
Reference in New Issue
Block a user