mirror of
https://github.com/PCSX2/pcsx2.git
synced 2025-12-16 04:08:48 +00:00
3rdparty: Update ImGui to 1.92.2b
This commit is contained in:
parent
4b08672f99
commit
49f4c36b0e
7687
3rdparty/imgui/CHANGELOG.txt
vendored
Normal file
7687
3rdparty/imgui/CHANGELOG.txt
vendored
Normal file
File diff suppressed because it is too large
Load Diff
76
3rdparty/imgui/include/imgui.h
vendored
76
3rdparty/imgui/include/imgui.h
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.1
|
||||
// dear imgui, v1.92.2b
|
||||
// (headers)
|
||||
|
||||
// Help:
|
||||
@ -28,8 +28,8 @@
|
||||
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.92.1"
|
||||
#define IMGUI_VERSION_NUM 19210
|
||||
#define IMGUI_VERSION "1.92.2b"
|
||||
#define IMGUI_VERSION_NUM 19222
|
||||
#define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000
|
||||
#define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198
|
||||
|
||||
@ -317,7 +317,7 @@ IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||
// - When a Rendered Backend creates a texture, it store its native identifier into a ImTextureID value.
|
||||
// (e.g. Used by DX11 backend to a `ID3D11ShaderResourceView*`; Used by OpenGL backends to store `GLuint`;
|
||||
// Used by SDLGPU backend to store a `SDL_GPUTextureSamplerBinding*`, etc.).
|
||||
// - User may submit their own textures to e.g. ImGui::Image() function by passing the same type.
|
||||
// - User may submit their own textures to e.g. ImGui::Image() function by passing this value.
|
||||
// - During the rendering loop, the Renderer Backend retrieve the ImTextureID, which stored inside a
|
||||
// ImTextureRef, which is stored inside a ImDrawCmd.
|
||||
// - Compile-time type configuration:
|
||||
@ -337,15 +337,17 @@ typedef ImU64 ImTextureID; // Default: store up to 64-bits (any pointer or
|
||||
#define ImTextureID_Invalid ((ImTextureID)0)
|
||||
#endif
|
||||
|
||||
// ImTextureRef = higher-level identifier for a texture.
|
||||
// ImTextureRef = higher-level identifier for a texture. Store a ImTextureID _or_ a ImTextureData*.
|
||||
// The identifier is valid even before the texture has been uploaded to the GPU/graphics system.
|
||||
// This is what gets passed to functions such as `ImGui::Image()`, `ImDrawList::AddImage()`.
|
||||
// This is what gets stored in draw commands (`ImDrawCmd`) to identify a texture during rendering.
|
||||
// - When a texture is created by user code (e.g. custom images), we directly stores the low-level ImTextureID.
|
||||
// Because of this, when displaying your own texture you are likely to ever only manage ImTextureID values on your side.
|
||||
// - When a texture is created by the backend, we stores a ImTextureData* which becomes an indirection
|
||||
// to extract the ImTextureID value during rendering, after texture upload has happened.
|
||||
// - There is no constructor to create a ImTextureID from a ImTextureData* as we don't expect this
|
||||
// to be useful to the end-user, and it would be erroneously called by many legacy code.
|
||||
// - To create a ImTextureRef from a ImTextureData you can use ImTextureData::GetTexRef().
|
||||
// We intentionally do not provide an ImTextureRef constructor for this: we don't expect this
|
||||
// to be frequently useful to the end-user, and it would be erroneously called by many legacy code.
|
||||
// - If you want to bind the current atlas when using custom rectangle, you can use io.Fonts->TexRef.
|
||||
// - Binding generators for languages such as C (which don't have constructors), should provide a helper, e.g.
|
||||
// inline ImTextureRef ImTextureRefFromID(ImTextureID tex_id) { ImTextureRef tex_ref = { ._TexData = NULL, .TexID = tex_id }; return tex_ref; }
|
||||
@ -914,7 +916,7 @@ namespace ImGui
|
||||
IMGUI_API ImGuiTableSortSpecs* TableGetSortSpecs(); // get latest sort specs for the table (NULL if not sorting). Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable().
|
||||
IMGUI_API int TableGetColumnCount(); // return number of columns (value passed to BeginTable)
|
||||
IMGUI_API int TableGetColumnIndex(); // return current column index.
|
||||
IMGUI_API int TableGetRowIndex(); // return current row index.
|
||||
IMGUI_API int TableGetRowIndex(); // return current row index (header rows are accounted for)
|
||||
IMGUI_API const char* TableGetColumnName(int column_n = -1); // return "" if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column.
|
||||
IMGUI_API ImGuiTableColumnFlags TableGetColumnFlags(int column_n = -1); // return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column.
|
||||
IMGUI_API void TableSetColumnEnabled(int column_n, bool v);// change user accessible enabled/disabled state of a column. Set to false to hide the column. User can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody)
|
||||
@ -1368,10 +1370,17 @@ enum ImGuiTabBarFlags_
|
||||
ImGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4, // Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll)
|
||||
ImGuiTabBarFlags_NoTooltip = 1 << 5, // Disable tooltips when hovering a tab
|
||||
ImGuiTabBarFlags_DrawSelectedOverline = 1 << 6, // Draw selected overline markers over selected tab
|
||||
ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 7, // Resize tabs when they don't fit
|
||||
ImGuiTabBarFlags_FittingPolicyScroll = 1 << 8, // Add scroll buttons when tabs don't fit
|
||||
ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll,
|
||||
ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown,
|
||||
|
||||
// Fitting/Resize policy
|
||||
ImGuiTabBarFlags_FittingPolicyMixed = 1 << 7, // Shrink down tabs when they don't fit, until width is style.TabMinWidthShrink, then enable scrolling buttons.
|
||||
ImGuiTabBarFlags_FittingPolicyShrink = 1 << 8, // Shrink down tabs when they don't fit
|
||||
ImGuiTabBarFlags_FittingPolicyScroll = 1 << 9, // Enable scrolling buttons when tabs don't fit
|
||||
ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyMixed | ImGuiTabBarFlags_FittingPolicyShrink | ImGuiTabBarFlags_FittingPolicyScroll,
|
||||
ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyMixed,
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
ImGuiTabBarFlags_FittingPolicyResizeDown = ImGuiTabBarFlags_FittingPolicyShrink, // Renamed in 1.92.2
|
||||
#endif
|
||||
};
|
||||
|
||||
// Flags for ImGui::BeginTabItem()
|
||||
@ -1801,6 +1810,8 @@ enum ImGuiStyleVar_
|
||||
ImGuiStyleVar_ImageBorderSize, // float ImageBorderSize
|
||||
ImGuiStyleVar_TabRounding, // float TabRounding
|
||||
ImGuiStyleVar_TabBorderSize, // float TabBorderSize
|
||||
ImGuiStyleVar_TabMinWidthBase, // float TabMinWidthBase
|
||||
ImGuiStyleVar_TabMinWidthShrink, // float TabMinWidthShrink
|
||||
ImGuiStyleVar_TabBarBorderSize, // float TabBarBorderSize
|
||||
ImGuiStyleVar_TabBarOverlineSize, // float TabBarOverlineSize
|
||||
ImGuiStyleVar_TableAngledHeadersAngle, // float TableAngledHeadersAngle
|
||||
@ -2170,7 +2181,7 @@ struct ImVector
|
||||
// Constructors, destructor
|
||||
inline ImVector() { Size = Capacity = 0; Data = NULL; }
|
||||
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
||||
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); if (src.Data) memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
|
||||
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); if (Data && src.Data) memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
|
||||
inline ~ImVector() { if (Data) IM_FREE(Data); } // Important: does not destruct anything
|
||||
|
||||
inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } } // Important: does not destruct anything
|
||||
@ -2266,6 +2277,8 @@ struct ImGuiStyle
|
||||
float ImageBorderSize; // Thickness of border around Image() calls.
|
||||
float TabRounding; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
||||
float TabBorderSize; // Thickness of border around tabs.
|
||||
float TabMinWidthBase; // Minimum tab width, to make tabs larger than their contents. TabBar buttons are not affected.
|
||||
float TabMinWidthShrink; // Minimum tab width after shrinking, when using ImGuiTabBarFlags_FittingPolicyMixed policy.
|
||||
float TabCloseButtonMinWidthSelected; // -1: always visible. 0.0f: visible when hovered. >0.0f: visible when hovered if minimum width.
|
||||
float TabCloseButtonMinWidthUnselected; // -1: always visible. 0.0f: visible when hovered. >0.0f: visible when hovered if minimum width. FLT_MAX: never show close button when unselected.
|
||||
float TabBarBorderSize; // Thickness of tab-bar separator, which takes on the tab active color to denote focus.
|
||||
@ -2512,10 +2525,10 @@ struct ImGuiIO
|
||||
float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text. >0 scrolls Up, <0 scrolls Down. Hold SHIFT to turn vertical scroll into horizontal scroll.
|
||||
float MouseWheelH; // Mouse wheel Horizontal. >0 scrolls Left, <0 scrolls Right. Most users don't have a mouse with a horizontal wheel, may not be filled by all backends.
|
||||
ImGuiMouseSource MouseSource; // Mouse actual input peripheral (Mouse/TouchScreen/Pen).
|
||||
bool KeyCtrl; // Keyboard modifier down: Control
|
||||
bool KeyCtrl; // Keyboard modifier down: Ctrl (non-macOS), Cmd (macOS)
|
||||
bool KeyShift; // Keyboard modifier down: Shift
|
||||
bool KeyAlt; // Keyboard modifier down: Alt
|
||||
bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows
|
||||
bool KeySuper; // Keyboard modifier down: Windows/Super (non-macOS), Ctrl (macOS)
|
||||
|
||||
// Other state maintained from data above + IO function calls
|
||||
ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags. Read-only, updated by NewFrame()
|
||||
@ -3359,7 +3372,7 @@ struct ImDrawList
|
||||
struct ImDrawData
|
||||
{
|
||||
bool Valid; // Only valid after Render() is called and before the next NewFrame() is called.
|
||||
int CmdListsCount; // Number of ImDrawList* to render. (== CmdLists.Size). Exists for legacy reason.
|
||||
int CmdListsCount; // == CmdLists.Size. (OBSOLETE: exists for legacy reasons). Number of ImDrawList* to render.
|
||||
int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size
|
||||
int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size
|
||||
ImVector<ImDrawList*> CmdLists; // Array of ImDrawList* to render. The ImDrawLists are owned by ImGuiContext and only pointed to from here.
|
||||
@ -3424,7 +3437,7 @@ struct ImTextureRect
|
||||
struct ImTextureData
|
||||
{
|
||||
//------------------------------------------ core / backend ---------------------------------------
|
||||
int UniqueID; // w - // Sequential index to facilitate identifying a texture when debugging/printing. Unique per atlas.
|
||||
int UniqueID; // w - // [DEBUG] Sequential index to facilitate identifying a texture when debugging/printing. Unique per atlas.
|
||||
ImTextureStatus Status; // rw rw // ImTextureStatus_OK/_WantCreate/_WantUpdates/_WantDestroy. Always use SetStatus() to modify!
|
||||
void* BackendUserData; // - rw // Convenience storage for backend. Some backends may have enough with TexID.
|
||||
ImTextureID TexID; // r w // Backend-specific texture identifier. Always use SetTexID() to modify! The identifier will stored in ImDrawCmd::GetTexID() and passed to backend's RenderDrawData function.
|
||||
@ -3442,7 +3455,7 @@ struct ImTextureData
|
||||
bool WantDestroyNextFrame; // rw - // [Internal] Queued to set ImTextureStatus_WantDestroy next frame. May still be used in the current frame.
|
||||
|
||||
// Functions
|
||||
ImTextureData() { memset(this, 0, sizeof(*this)); TexID = ImTextureID_Invalid; }
|
||||
ImTextureData() { memset(this, 0, sizeof(*this)); Status = ImTextureStatus_Destroyed; TexID = ImTextureID_Invalid; }
|
||||
~ImTextureData() { DestroyPixels(); }
|
||||
IMGUI_API void Create(ImTextureFormat format, int w, int h);
|
||||
IMGUI_API void DestroyPixels();
|
||||
@ -3744,9 +3757,10 @@ struct ImFontBaked
|
||||
float Ascent, Descent; // 4+4 // out // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] (unscaled)
|
||||
unsigned int MetricsTotalSurface:26;// 3 // out // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
||||
unsigned int WantDestroy:1; // 0 // // Queued for destroy
|
||||
unsigned int LockLoadingFallback:1; // 0 // //
|
||||
int LastUsedFrame; // 4 // // Record of that time this was bounds
|
||||
ImGuiID BakedId; // 4 //
|
||||
unsigned int LoadNoFallback:1; // 0 // // Disable loading fallback in lower-level calls.
|
||||
unsigned int LoadNoRenderOnLayout:1;// 0 // // Enable a two-steps mode where CalcTextSize() calls will load AdvanceX *without* rendering/packing glyphs. Only advantagous if you know that the glyph is unlikely to actually be rendered, otherwise it is slower because we'd do one query on the first CalcTextSize and one query on the first Draw.
|
||||
int LastUsedFrame; // 4 // // Record of that time this was bounds
|
||||
ImGuiID BakedId; // 4 // // Unique ID for this baked storage
|
||||
ImFont* ContainerFont; // 4-8 // in // Parent font
|
||||
void* FontLoaderDatas; // 4-8 // // Font loader opaque storage (per baked font * sources): single contiguous buffer allocated by imgui, passed to loader.
|
||||
|
||||
@ -3956,24 +3970,24 @@ struct ImGuiPlatformImeData
|
||||
namespace ImGui
|
||||
{
|
||||
// OBSOLETED in 1.92.0 (from June 2025)
|
||||
static inline void PushFont(ImFont* font) { PushFont(font, font ? font->LegacySize : 0.0f); }
|
||||
inline void PushFont(ImFont* font) { PushFont(font, font ? font->LegacySize : 0.0f); }
|
||||
IMGUI_API void SetWindowFontScale(float scale); // Set font scale factor for current window. Prefer using PushFont(NULL, style.FontSizeBase * factor) or use style.FontScaleMain to scale all windows.
|
||||
// OBSOLETED in 1.91.9 (from February 2025)
|
||||
IMGUI_API void Image(ImTextureRef tex_ref, 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(); }
|
||||
static inline void PushTabStop(bool tab_stop) { PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); }
|
||||
static inline void PopTabStop() { PopItemFlag(); }
|
||||
inline void PushButtonRepeat(bool repeat) { PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat); }
|
||||
inline void PopButtonRepeat() { PopItemFlag(); }
|
||||
inline void PushTabStop(bool tab_stop) { PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); }
|
||||
inline void PopTabStop() { PopItemFlag(); }
|
||||
IMGUI_API ImVec2 GetContentRegionMax(); // Content boundaries max (e.g. window boundaries including scrolling, or current column boundaries). You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // Content boundaries min for the window (roughly (0,0)-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMax(); // Content boundaries max for the window (roughly (0,0)+Size-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
// OBSOLETED in 1.90.0 (from September 2023)
|
||||
static inline bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags window_flags = 0) { return BeginChild(id, size, ImGuiChildFlags_FrameStyle, window_flags); }
|
||||
static inline void EndChildFrame() { EndChild(); }
|
||||
//static inline bool BeginChild(const char* str_id, const ImVec2& size_arg, bool borders, ImGuiWindowFlags window_flags){ return BeginChild(str_id, size_arg, borders ? ImGuiChildFlags_Borders : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Borders
|
||||
//static inline bool BeginChild(ImGuiID id, const ImVec2& size_arg, bool borders, ImGuiWindowFlags window_flags) { return BeginChild(id, size_arg, borders ? ImGuiChildFlags_Borders : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Borders
|
||||
static inline void ShowStackToolWindow(bool* p_open = NULL) { ShowIDStackToolWindow(p_open); }
|
||||
inline bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags window_flags = 0) { return BeginChild(id, size, ImGuiChildFlags_FrameStyle, window_flags); }
|
||||
inline void EndChildFrame() { EndChild(); }
|
||||
//inline bool BeginChild(const char* str_id, const ImVec2& size_arg, bool borders, ImGuiWindowFlags window_flags){ return BeginChild(str_id, size_arg, borders ? ImGuiChildFlags_Borders : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Borders
|
||||
//inline bool BeginChild(ImGuiID id, const ImVec2& size_arg, bool borders, ImGuiWindowFlags window_flags) { return BeginChild(id, size_arg, borders ? ImGuiChildFlags_Borders : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Borders
|
||||
inline void ShowStackToolWindow(bool* p_open = NULL) { ShowIDStackToolWindow(p_open); }
|
||||
IMGUI_API bool Combo(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int popup_max_height_in_items = -1);
|
||||
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int height_in_items = -1);
|
||||
// OBSOLETED in 1.89.7 (from June 2023)
|
||||
|
||||
135
3rdparty/imgui/include/imgui_internal.h
vendored
135
3rdparty/imgui/include/imgui_internal.h
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.1
|
||||
// dear imgui, v1.92.2b
|
||||
// (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.
|
||||
@ -369,17 +369,17 @@ IMGUI_API ImGuiID ImHashStr(const char* data, size_t data_size = 0, ImGuiI
|
||||
|
||||
// Helpers: Sorting
|
||||
#ifndef ImQsort
|
||||
static inline void ImQsort(void* base, size_t count, size_t size_of_element, int(IMGUI_CDECL *compare_func)(void const*, void const*)) { if (count > 1) qsort(base, count, size_of_element, compare_func); }
|
||||
inline void ImQsort(void* base, size_t count, size_t size_of_element, int(IMGUI_CDECL *compare_func)(void const*, void const*)) { if (count > 1) qsort(base, count, size_of_element, compare_func); }
|
||||
#endif
|
||||
|
||||
// Helpers: Color Blending
|
||||
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);
|
||||
|
||||
// Helpers: Bit manipulation
|
||||
static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }
|
||||
static inline bool ImIsPowerOfTwo(ImU64 v) { return v != 0 && (v & (v - 1)) == 0; }
|
||||
static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
||||
static inline unsigned int ImCountSetBits(unsigned int v) { unsigned int count = 0; while (v > 0) { v = v & (v - 1); count++; } return count; }
|
||||
inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }
|
||||
inline bool ImIsPowerOfTwo(ImU64 v) { return v != 0 && (v & (v - 1)) == 0; }
|
||||
inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
||||
inline unsigned int ImCountSetBits(unsigned int v) { unsigned int count = 0; while (v > 0) { v = v & (v - 1); count++; } return count; }
|
||||
|
||||
// Helpers: String
|
||||
#define ImStrlen strlen
|
||||
@ -398,10 +398,10 @@ IMGUI_API const char* ImStrSkipBlank(const char* str);
|
||||
IMGUI_API int ImStrlenW(const ImWchar* str); // Computer string length (ImWchar string)
|
||||
IMGUI_API const char* ImStrbol(const char* buf_mid_line, const char* buf_begin); // Find beginning-of-line
|
||||
IM_MSVC_RUNTIME_CHECKS_OFF
|
||||
static inline char ImToUpper(char c) { return (c >= 'a' && c <= 'z') ? c &= ~32 : c; }
|
||||
static inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; }
|
||||
static inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
||||
static inline bool ImCharIsXdigitA(char c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); }
|
||||
inline char ImToUpper(char c) { return (c >= 'a' && c <= 'z') ? c &= ~32 : c; }
|
||||
inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; }
|
||||
inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
||||
inline bool ImCharIsXdigitA(char c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); }
|
||||
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||
|
||||
// Helpers: Formatting
|
||||
@ -417,7 +417,7 @@ IMGUI_API const char* ImParseFormatSanitizeForScanning(const char* fmt_in, cha
|
||||
IMGUI_API int ImParseFormatPrecision(const char* format, int default_value);
|
||||
|
||||
// Helpers: UTF-8 <> wchar conversions
|
||||
IMGUI_API const char* ImTextCharToUtf8(char out_buf[5], unsigned int c); // return out_buf
|
||||
IMGUI_API int ImTextCharToUtf8(char out_buf[5], unsigned int c); // return output UTF-8 bytes count
|
||||
IMGUI_API int ImTextStrToUtf8(char* out_buf, int out_buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count
|
||||
IMGUI_API int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end); // read one character. return input UTF-8 bytes count
|
||||
IMGUI_API int ImTextStrFromUtf8(ImWchar* out_buf, int out_buf_size, const char* in_text, const char* in_text_end, const char** in_remaining = NULL); // return input UTF-8 bytes count
|
||||
@ -431,11 +431,11 @@ IMGUI_API int ImTextCountLines(const char* in_text, const char* in_tex
|
||||
#ifdef IMGUI_DISABLE_FILE_FUNCTIONS
|
||||
#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
||||
typedef void* ImFileHandle;
|
||||
static inline ImFileHandle ImFileOpen(const char*, const char*) { return NULL; }
|
||||
static inline bool ImFileClose(ImFileHandle) { return false; }
|
||||
static inline ImU64 ImFileGetSize(ImFileHandle) { return (ImU64)-1; }
|
||||
static inline ImU64 ImFileRead(void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||||
static inline ImU64 ImFileWrite(const void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||||
inline ImFileHandle ImFileOpen(const char*, const char*) { return NULL; }
|
||||
inline bool ImFileClose(ImFileHandle) { return false; }
|
||||
inline ImU64 ImFileGetSize(ImFileHandle) { return (ImU64)-1; }
|
||||
inline ImU64 ImFileRead(void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||||
inline ImU64 ImFileWrite(const void*, ImU64, ImU64, ImFileHandle) { return 0; }
|
||||
#endif
|
||||
#ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
||||
typedef FILE* ImFileHandle;
|
||||
@ -462,56 +462,56 @@ IM_MSVC_RUNTIME_CHECKS_OFF
|
||||
#define ImAtan2(Y, X) atan2f((Y), (X))
|
||||
#define ImAtof(STR) atof(STR)
|
||||
#define ImCeil(X) ceilf(X)
|
||||
static inline float ImPow(float x, float y) { return powf(x, y); } // DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision
|
||||
static inline double ImPow(double x, double y) { return pow(x, y); }
|
||||
static inline float ImLog(float x) { return logf(x); } // DragBehaviorT/SliderBehaviorT uses ImLog with either float/double and need the precision
|
||||
static inline double ImLog(double x) { return log(x); }
|
||||
static inline int ImAbs(int x) { return x < 0 ? -x : x; }
|
||||
static inline float ImAbs(float x) { return fabsf(x); }
|
||||
static inline double ImAbs(double x) { return fabs(x); }
|
||||
static inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : (x > 0.0f) ? 1.0f : 0.0f; } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
||||
static inline double ImSign(double x) { return (x < 0.0) ? -1.0 : (x > 0.0) ? 1.0 : 0.0; }
|
||||
inline float ImPow(float x, float y) { return powf(x, y); } // DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision
|
||||
inline double ImPow(double x, double y) { return pow(x, y); }
|
||||
inline float ImLog(float x) { return logf(x); } // DragBehaviorT/SliderBehaviorT uses ImLog with either float/double and need the precision
|
||||
inline double ImLog(double x) { return log(x); }
|
||||
inline int ImAbs(int x) { return x < 0 ? -x : x; }
|
||||
inline float ImAbs(float x) { return fabsf(x); }
|
||||
inline double ImAbs(double x) { return fabs(x); }
|
||||
inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : (x > 0.0f) ? 1.0f : 0.0f; } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
||||
inline double ImSign(double x) { return (x < 0.0) ? -1.0 : (x > 0.0) ? 1.0 : 0.0; }
|
||||
#ifdef IMGUI_ENABLE_SSE
|
||||
static inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
||||
inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
||||
#else
|
||||
static inline float ImRsqrt(float x) { return 1.0f / sqrtf(x); }
|
||||
inline float ImRsqrt(float x) { return 1.0f / sqrtf(x); }
|
||||
#endif
|
||||
static inline double ImRsqrt(double x) { return 1.0 / sqrt(x); }
|
||||
inline double ImRsqrt(double x) { return 1.0 / sqrt(x); }
|
||||
#endif
|
||||
// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double
|
||||
// (Exceptionally using templates here but we could also redefine them for those types)
|
||||
template<typename T> static inline T ImMin(T lhs, T rhs) { return lhs < rhs ? lhs : rhs; }
|
||||
template<typename T> static inline T ImMax(T lhs, T rhs) { return lhs >= rhs ? lhs : rhs; }
|
||||
template<typename T> static inline T ImClamp(T v, T mn, T mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
||||
template<typename T> static inline T ImLerp(T a, T b, float t) { return (T)(a + (b - a) * t); }
|
||||
template<typename T> static inline void ImSwap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
|
||||
template<typename T> static inline T ImAddClampOverflow(T a, T b, T mn, T mx) { if (b < 0 && (a < mn - b)) return mn; if (b > 0 && (a > mx - b)) return mx; return a + b; }
|
||||
template<typename T> static inline T ImSubClampOverflow(T a, T b, T mn, T mx) { if (b > 0 && (a < mn + b)) return mn; if (b < 0 && (a > mx + b)) return mx; return a - b; }
|
||||
template<typename T> T ImMin(T lhs, T rhs) { return lhs < rhs ? lhs : rhs; }
|
||||
template<typename T> T ImMax(T lhs, T rhs) { return lhs >= rhs ? lhs : rhs; }
|
||||
template<typename T> T ImClamp(T v, T mn, T mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
||||
template<typename T> T ImLerp(T a, T b, float t) { return (T)(a + (b - a) * t); }
|
||||
template<typename T> void ImSwap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
|
||||
template<typename T> T ImAddClampOverflow(T a, T b, T mn, T mx) { if (b < 0 && (a < mn - b)) return mn; if (b > 0 && (a > mx - b)) return mx; return a + b; }
|
||||
template<typename T> T ImSubClampOverflow(T a, T b, T mn, T mx) { if (b > 0 && (a < mn + b)) return mn; if (b < 0 && (a > mx + b)) return mx; return a - b; }
|
||||
// - Misc maths helpers
|
||||
static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }
|
||||
static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }
|
||||
static inline ImVec2 ImClamp(const ImVec2& v, const ImVec2&mn, const ImVec2&mx) { return ImVec2((v.x < mn.x) ? mn.x : (v.x > mx.x) ? mx.x : v.x, (v.y < mn.y) ? mn.y : (v.y > mx.y) ? mx.y : v.y); }
|
||||
static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }
|
||||
static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }
|
||||
static inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); }
|
||||
static inline float ImSaturate(float f) { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }
|
||||
static inline float ImLengthSqr(const ImVec2& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y); }
|
||||
static inline float ImLengthSqr(const ImVec4& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y) + (lhs.z * lhs.z) + (lhs.w * lhs.w); }
|
||||
static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = (lhs.x * lhs.x) + (lhs.y * lhs.y); if (d > 0.0f) return ImRsqrt(d); return fail_value; }
|
||||
static inline float ImTrunc(float f) { return (float)(int)(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); }
|
||||
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
||||
static inline float ImLinearRemapClamp(float s0, float s1, float d0, float d1, float x) { return ImSaturate((x - s0) / (s1 - s0)) * (d1 - d0) + d0; }
|
||||
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||||
static inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; }
|
||||
static inline float ImExponentialMovingAverage(float avg, float sample, int n) { avg -= avg / n; avg += sample / n; return avg; }
|
||||
inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }
|
||||
inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }
|
||||
inline ImVec2 ImClamp(const ImVec2& v, const ImVec2&mn, const ImVec2&mx){ return ImVec2((v.x < mn.x) ? mn.x : (v.x > mx.x) ? mx.x : v.x, (v.y < mn.y) ? mn.y : (v.y > mx.y) ? mx.y : v.y); }
|
||||
inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }
|
||||
inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }
|
||||
inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); }
|
||||
inline float ImSaturate(float f) { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }
|
||||
inline float ImLengthSqr(const ImVec2& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y); }
|
||||
inline float ImLengthSqr(const ImVec4& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y) + (lhs.z * lhs.z) + (lhs.w * lhs.w); }
|
||||
inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = (lhs.x * lhs.x) + (lhs.y * lhs.y); if (d > 0.0f) return ImRsqrt(d); return fail_value; }
|
||||
inline float ImTrunc(float f) { return (float)(int)(f); }
|
||||
inline ImVec2 ImTrunc(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); }
|
||||
inline float ImFloor(float f) { return (float)((f >= 0 || (float)(int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf()
|
||||
inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2(ImFloor(v.x), ImFloor(v.y)); }
|
||||
inline float ImTrunc64(float f) { return (float)(ImS64)(f); }
|
||||
inline float ImRound64(float f) { return (float)(ImS64)(f + 0.5f); }
|
||||
inline int ImModPositive(int a, int b) { return (a + b) % b; }
|
||||
inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }
|
||||
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); }
|
||||
inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
||||
inline float ImLinearRemapClamp(float s0, float s1, float d0, float d1, float x) { return ImSaturate((x - s0) / (s1 - s0)) * (d1 - d0) + d0; }
|
||||
inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||||
inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; }
|
||||
inline float ImExponentialMovingAverage(float avg, float sample, int n){ avg -= avg / n; avg += sample / n; return avg; }
|
||||
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||
|
||||
// Helpers: Geometry
|
||||
@ -1487,7 +1487,7 @@ enum ImGuiInputEventType
|
||||
ImGuiInputEventType_COUNT
|
||||
};
|
||||
|
||||
enum ImGuiInputSource
|
||||
enum ImGuiInputSource : int
|
||||
{
|
||||
ImGuiInputSource_None = 0,
|
||||
ImGuiInputSource_Mouse, // Note: may be Mouse or TouchScreen or Pen. See io.MouseSource to distinguish them.
|
||||
@ -2212,6 +2212,7 @@ struct ImGuiContext
|
||||
bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state.
|
||||
bool ActiveIdHasBeenEditedThisFrame;
|
||||
bool ActiveIdFromShortcut;
|
||||
ImGuiID ActiveIdDisabledId; // When clicking a disabled item we set ActiveId=window->MoveId to avoid interference with widget code. Actual item ID is stored here.
|
||||
int ActiveIdMouseButton : 8;
|
||||
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
||||
ImGuiWindow* ActiveIdWindow;
|
||||
@ -2328,8 +2329,8 @@ struct ImGuiContext
|
||||
float NavWindowingTimer;
|
||||
float NavWindowingHighlightAlpha;
|
||||
ImGuiInputSource NavWindowingInputSource;
|
||||
bool NavWindowingToggleLayer;
|
||||
ImGuiKey NavWindowingToggleKey;
|
||||
bool NavWindowingToggleLayer; // Set while Alt or GamepadMenu is held, may be cleared by other operations, and processed when releasing the key.
|
||||
ImGuiKey NavWindowingToggleKey; // Keyboard/gamepad key used when toggling to menu layer.
|
||||
ImVec2 NavWindowingAccumDeltaPos;
|
||||
ImVec2 NavWindowingAccumDeltaSize;
|
||||
|
||||
@ -2735,7 +2736,7 @@ struct ImGuiTabItem
|
||||
int LastFrameSelected; // This allows us to infer an ordered list of the last activated tabs with little maintenance
|
||||
float Offset; // Position relative to beginning of tab
|
||||
float Width; // Width currently displayed
|
||||
float ContentWidth; // Width of label, stored during BeginTabItem() call
|
||||
float ContentWidth; // Width of label + padding, stored during BeginTabItem() call (misnamed as "Content" would normally imply width of label only)
|
||||
float RequestedWidth; // Width optionally requested by caller, -1.0f is unused
|
||||
ImS32 NameOffset; // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames
|
||||
ImS16 BeginOrder; // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable
|
||||
@ -2758,6 +2759,7 @@ struct IMGUI_API ImGuiTabBar
|
||||
int CurrFrameVisible;
|
||||
int PrevFrameVisible;
|
||||
ImRect BarRect;
|
||||
float BarRectPrevWidth; // Backup of previous width. When width change we enforce keep horizontal scroll on focused tab.
|
||||
float CurrTabsContentsHeight;
|
||||
float PrevTabsContentsHeight; // Record the height of contents submitted below the tab bar
|
||||
float WidthAllTabs; // Actual width of all tabs (locked during layout)
|
||||
@ -2776,6 +2778,7 @@ struct IMGUI_API ImGuiTabBar
|
||||
bool WantLayout;
|
||||
bool VisibleTabWasSubmitted;
|
||||
bool TabsAddedNew; // Set to true when a new tab item or button has been added to the tab bar during last frame
|
||||
bool ScrollButtonEnabled;
|
||||
ImS16 TabsActiveCount; // Number of tabs submitted this frame.
|
||||
ImS16 LastTabItemIdx; // Index of last BeginTabItem() tab for use by EndTabItem()
|
||||
float ItemSpacingY;
|
||||
@ -3124,7 +3127,7 @@ namespace ImGui
|
||||
IMGUI_API void SetNextWindowRefreshPolicy(ImGuiWindowRefreshFlags flags);
|
||||
|
||||
// Fonts, drawing
|
||||
IMGUI_API void RegisterUserTexture(ImTextureData* tex); // Register external texture
|
||||
IMGUI_API void RegisterUserTexture(ImTextureData* tex); // Register external texture. EXPERIMENTAL: DO NOT USE YET.
|
||||
IMGUI_API void UnregisterUserTexture(ImTextureData* tex);
|
||||
IMGUI_API void RegisterFontAtlas(ImFontAtlas* atlas);
|
||||
IMGUI_API void UnregisterFontAtlas(ImFontAtlas* atlas);
|
||||
@ -3150,6 +3153,7 @@ namespace ImGui
|
||||
IMGUI_API void UpdateHoveredWindowAndCaptureFlags(const ImVec2& mouse_pos);
|
||||
IMGUI_API void FindHoveredWindowEx(const ImVec2& pos, bool find_first_and_in_any_viewport, ImGuiWindow** out_hovered_window, ImGuiWindow** out_hovered_window_under_moving_window);
|
||||
IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window);
|
||||
IMGUI_API void StopMouseMovingWindow();
|
||||
IMGUI_API void UpdateMouseMovingWindowNewFrame();
|
||||
IMGUI_API void UpdateMouseMovingWindowEndFrame();
|
||||
|
||||
@ -3221,7 +3225,7 @@ namespace ImGui
|
||||
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h);
|
||||
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
||||
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
||||
IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess);
|
||||
IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess, float width_min);
|
||||
|
||||
// Parameter stacks (shared)
|
||||
IMGUI_API const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx);
|
||||
@ -3671,7 +3675,6 @@ namespace ImGui
|
||||
//inline bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0) { return TreeNodeUpdateNextOpen(id, flags); } // Renamed in 1.89
|
||||
//inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // Removed in 1.87: Mapping from named key is always identity!
|
||||
|
||||
// Refactored focus/nav/tabbing system in 1.82 and 1.84. If you have old/custom copy-and-pasted widgets which used FocusableItemRegister():
|
||||
// Refactored focus/nav/tabbing system in 1.82 and 1.84. If you have old/custom copy-and-pasted widgets which used FocusableItemRegister():
|
||||
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)'
|
||||
// (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Focused) != 0'
|
||||
|
||||
277
3rdparty/imgui/src/imgui.cpp
vendored
277
3rdparty/imgui/src/imgui.cpp
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.1
|
||||
// dear imgui, v1.92.2b
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
@ -24,7 +24,7 @@
|
||||
// For first-time users having issues compiling/linking/running:
|
||||
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
||||
// Everything else should be asked in 'Issues'! We are building a database of cross-linked knowledge there.
|
||||
// Since 1.92, we encourage font loading question to also be posted in 'Issues'.
|
||||
// Since 1.92, we encourage font loading questions to also be posted in 'Issues'.
|
||||
|
||||
// Copyright (c) 2014-2025 Omar Cornut
|
||||
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
|
||||
@ -78,7 +78,7 @@ CODE
|
||||
// [SECTION] RENDER HELPERS
|
||||
// [SECTION] INITIALIZATION, SHUTDOWN
|
||||
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
|
||||
// [SECTION] FONTS
|
||||
// [SECTION] FONTS, TEXTURES
|
||||
// [SECTION] ID STACK
|
||||
// [SECTION] INPUTS
|
||||
// [SECTION] ERROR CHECKING, STATE RECOVERY
|
||||
@ -392,7 +392,9 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
||||
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/06/25 (1.92.0) - layout: commented out legacy ErrorCheckUsingSetCursorPosToExtendParentBoundaries() fallback obsoleted in 1.89 (August 2022) which allowed a SetCursorPos()/SetCursorScreenPos() call WITHOUT AN ITEM
|
||||
- 2025/08/08 (1.92.2) - Backends: SDL_GPU3: Changed ImTextureID type from SDL_GPUTextureSamplerBinding* to SDL_GPUTexture*, which is more natural and easier for user to manage. If you need to change the current sampler, you can access the ImGui_ImplSDLGPU3_RenderState struct. (#8866, #8163, #7998, #7988)
|
||||
- 2025/07/31 (1.92.2) - Tabs: Renamed ImGuiTabBarFlags_FittingPolicyResizeDown to ImGuiTabBarFlags_FittingPolicyShrink. Kept inline redirection enum (will obsolete).
|
||||
- 2025/06/25 (1.92.0) - Layout: commented out legacy ErrorCheckUsingSetCursorPosToExtendParentBoundaries() fallback obsoleted in 1.89 (August 2022) which allowed a SetCursorPos()/SetCursorScreenPos() call WITHOUT AN ITEM
|
||||
to extend parent window/cell boundaries. Replaced with assert/tooltip that would already happens if previously using IMGUI_DISABLE_OBSOLETE_FUNCTIONS. (#5548, #4510, #3355, #1760, #1490, #4152, #150)
|
||||
- Incorrect way to make a window content size 200x200:
|
||||
Begin(...) + SetCursorScreenPos(GetCursorScreenPos() + ImVec2(200,200)) + End();
|
||||
@ -432,6 +434,8 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
||||
cfg2.MergeMode = true;
|
||||
io.Fonts->AddFontFromFileTTF("FontAwesome4.ttf", 0.0f, &cfg2);
|
||||
- You can use `Metrics/Debugger->Fonts->Font->Input Glyphs Overlap Detection Tool` to see list of glyphs available in multiple font sources. This can facilitate unde
|
||||
- Fonts: **IMPORTANT** on Thread Safety:
|
||||
- A few functions such as font->CalcTextSizeA() were, by sheer luck (== accidentally) thread-safe even thou we had never provided that guarantee. They are definitively not thread-safe anymore as new glyphs may be loaded.
|
||||
- Fonts: ImFont::FontSize was removed and does not make sense anymore. ImFont::LegacySize is the size passed to AddFont().
|
||||
- Fonts: Removed support for PushFont(NULL) which was a shortcut for "default font".
|
||||
- Fonts: Renamed/moved 'io.FontGlobalScale' to 'style.FontScaleMain'.
|
||||
@ -1287,7 +1291,7 @@ static float NavUpdatePageUpPageDown();
|
||||
static inline void NavUpdateAnyRequestFlag();
|
||||
static void NavUpdateCreateWrappingRequest();
|
||||
static void NavEndFrame();
|
||||
static bool NavScoreItem(ImGuiNavItemData* result);
|
||||
static bool NavScoreItem(ImGuiNavItemData* result, const ImRect& nav_bb);
|
||||
static void NavApplyItemToResult(ImGuiNavItemData* result);
|
||||
static void NavProcessItem();
|
||||
static void NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flags, ImGuiNavMoveFlags move_flags);
|
||||
@ -1415,6 +1419,8 @@ ImGuiStyle::ImGuiStyle()
|
||||
ImageBorderSize = 0.0f; // Thickness of border around tabs.
|
||||
TabRounding = 5.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
||||
TabBorderSize = 0.0f; // Thickness of border around tabs.
|
||||
TabMinWidthBase = 1.0f; // Minimum tab width, to make tabs larger than their contents. TabBar buttons are not affected.
|
||||
TabMinWidthShrink = 80.0f; // Minimum tab width after shrinking, when using ImGuiTabBarFlags_FittingPolicyMixed policy.
|
||||
TabCloseButtonMinWidthSelected = -1.0f; // -1: always visible. 0.0f: visible when hovered. >0.0f: visible when hovered if minimum width.
|
||||
TabCloseButtonMinWidthUnselected = 0.0f; // -1: always visible. 0.0f: visible when hovered. >0.0f: visible when hovered if minimum width. FLT_MAX: never show close button when unselected.
|
||||
TabBarBorderSize = 1.0f; // Thickness of tab-bar separator, which takes on the tab active color to denote focus.
|
||||
@ -1481,6 +1487,8 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
||||
LogSliderDeadzone = ImTrunc(LogSliderDeadzone * scale_factor);
|
||||
ImageBorderSize = ImTrunc(ImageBorderSize * scale_factor);
|
||||
TabRounding = ImTrunc(TabRounding * scale_factor);
|
||||
TabMinWidthBase = ImTrunc(TabMinWidthBase * scale_factor);
|
||||
TabMinWidthShrink = ImTrunc(TabMinWidthShrink * scale_factor);
|
||||
TabCloseButtonMinWidthSelected = (TabCloseButtonMinWidthSelected > 0.0f && TabCloseButtonMinWidthSelected != FLT_MAX) ? ImTrunc(TabCloseButtonMinWidthSelected * scale_factor) : TabCloseButtonMinWidthSelected;
|
||||
TabCloseButtonMinWidthUnselected = (TabCloseButtonMinWidthUnselected > 0.0f && TabCloseButtonMinWidthUnselected != FLT_MAX) ? ImTrunc(TabCloseButtonMinWidthUnselected * scale_factor) : TabCloseButtonMinWidthUnselected;
|
||||
TabBarOverlineSize = ImTrunc(TabBarOverlineSize * scale_factor);
|
||||
@ -2582,11 +2590,11 @@ static inline int ImTextCharToUtf8_inline(char* buf, int buf_size, unsigned int
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* ImTextCharToUtf8(char out_buf[5], unsigned int c)
|
||||
int ImTextCharToUtf8(char out_buf[5], unsigned int c)
|
||||
{
|
||||
int count = ImTextCharToUtf8_inline(out_buf, 5, c);
|
||||
out_buf[count] = 0;
|
||||
return out_buf;
|
||||
return count;
|
||||
}
|
||||
|
||||
// Not optimal but we very rarely use this function.
|
||||
@ -3123,7 +3131,7 @@ static void ImGuiListClipper_SeekCursorAndSetupPrevLine(float pos_y, float line_
|
||||
ImGui::TableEndRow(table);
|
||||
table->RowPosY2 = window->DC.CursorPos.y;
|
||||
const int row_increase = (int)((off_y / line_height) + 0.5f);
|
||||
//table->CurrentRow += row_increase; // Can't do without fixing TableEndRow()
|
||||
table->CurrentRow += row_increase;
|
||||
table->RowBgColorCounter += row_increase;
|
||||
}
|
||||
}
|
||||
@ -3500,6 +3508,8 @@ static const ImGuiStyleVarInfo GStyleVarsInfo[] =
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ImageBorderSize) }, // ImGuiStyleVar_ImageBorderSize
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TabBorderSize) }, // ImGuiStyleVar_TabBorderSize
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TabMinWidthBase) }, // ImGuiStyleVar_TabMinWidthBase
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TabMinWidthShrink) }, // ImGuiStyleVar_TabMinWidthShrink
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TabBarBorderSize) }, // ImGuiStyleVar_TabBarBorderSize
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TabBarOverlineSize) }, // ImGuiStyleVar_TabBarOverlineSize
|
||||
{ 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, TableAngledHeadersAngle)}, // ImGuiStyleVar_TableAngledHeadersAngle
|
||||
@ -4053,6 +4063,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
||||
ActiveIdClickOffset = ImVec2(-1, -1);
|
||||
ActiveIdWindow = NULL;
|
||||
ActiveIdSource = ImGuiInputSource_None;
|
||||
ActiveIdDisabledId = 0;
|
||||
ActiveIdMouseButton = -1;
|
||||
ActiveIdPreviousFrame = 0;
|
||||
memset(&DeactivatedItemData, 0, sizeof(DeactivatedItemData));
|
||||
@ -4501,15 +4512,6 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
||||
// Clear previous active id
|
||||
if (g.ActiveId != 0)
|
||||
{
|
||||
// While most behaved code would make an effort to not steal active id during window move/drag operations,
|
||||
// we at least need to be resilient to it. Canceling the move is rather aggressive and users of 'master' branch
|
||||
// may prefer the weird ill-defined half working situation ('docking' did assert), so may need to rework that.
|
||||
if (g.MovingWindow != NULL && g.ActiveId == g.MovingWindow->MoveId)
|
||||
{
|
||||
IMGUI_DEBUG_LOG_ACTIVEID("SetActiveID() cancel MovingWindow\n");
|
||||
g.MovingWindow = NULL;
|
||||
}
|
||||
|
||||
// Store deactivate data
|
||||
ImGuiDeactivatedItemData* deactivated_data = &g.DeactivatedItemData;
|
||||
deactivated_data->ID = g.ActiveId;
|
||||
@ -4522,6 +4524,15 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
||||
// One common scenario leading to this is: pressing Key ->NavMoveRequestApplyResult() -> ClearActiveID()
|
||||
if (g.InputTextState.ID == g.ActiveId)
|
||||
InputTextDeactivateHook(g.ActiveId);
|
||||
|
||||
// While most behaved code would make an effort to not steal active id during window move/drag operations,
|
||||
// we at least need to be resilient to it. Canceling the move is rather aggressive and users of 'master' branch
|
||||
// may prefer the weird ill-defined half working situation ('docking' did assert), so may need to rework that.
|
||||
if (g.MovingWindow != NULL && g.ActiveId == g.MovingWindow->MoveId)
|
||||
{
|
||||
IMGUI_DEBUG_LOG_ACTIVEID("SetActiveID() cancel MovingWindow\n");
|
||||
StopMouseMovingWindow();
|
||||
}
|
||||
}
|
||||
|
||||
// Set active id
|
||||
@ -4545,6 +4556,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
||||
g.ActiveIdWindow = window;
|
||||
g.ActiveIdHasBeenEditedThisFrame = false;
|
||||
g.ActiveIdFromShortcut = false;
|
||||
g.ActiveIdDisabledId = 0;
|
||||
if (id)
|
||||
{
|
||||
g.ActiveIdIsAlive = id;
|
||||
@ -4688,8 +4700,17 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
||||
const ImGuiID id = g.LastItemData.ID;
|
||||
if ((flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) == 0)
|
||||
if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap)
|
||||
if (g.ActiveId != window->MoveId)
|
||||
{
|
||||
// When ActiveId == MoveId it means that either:
|
||||
// - (1) user clicked on void _or_ an item with no id, which triggers moving window (ActiveId is set even when window has _NoMove flag)
|
||||
// - the (id == 0) test handles it, however, IsItemHovered() will leak between id==0 items (mostly visible when using _NoMove). // FIXME: May be fixed.
|
||||
// - (2) user clicked a disabled item. UpdateMouseMovingWindowEndFrame() uses ActiveId == MoveId to avoid interference with item logic + sets ActiveIdDisabledId.
|
||||
bool cancel_is_hovered = true;
|
||||
if (g.ActiveId == window->MoveId && (id == 0 || g.ActiveIdDisabledId == id))
|
||||
cancel_is_hovered = false;
|
||||
if (cancel_is_hovered)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Test if interactions on this window are blocked by an active popup or modal.
|
||||
// The ImGuiHoveredFlags_AllowWhenBlockedByPopup flag will be tested here.
|
||||
@ -4770,7 +4791,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flag
|
||||
if (!g.ActiveIdFromShortcut)
|
||||
return false;
|
||||
|
||||
// Done with rectangle culling so we can perform heavier checks now.
|
||||
// We are done with rectangle culling so we can perform heavier checks now.
|
||||
if (!(item_flags & ImGuiItemFlags_NoWindowHoverableCheck) && !IsWindowContentHoverable(window, ImGuiHoveredFlags_None))
|
||||
{
|
||||
g.HoveredIdIsDisabled = true;
|
||||
@ -5075,6 +5096,19 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window)
|
||||
g.MovingWindow = window;
|
||||
}
|
||||
|
||||
// This is not 100% symetric with StartMouseMovingWindow().
|
||||
// We do NOT clear ActiveID, because:
|
||||
// - It would lead to rather confusing recursive code paths. Caller can call ClearActiveID() if desired.
|
||||
// - Some code intentionally cancel moving but keep the ActiveID to lock inputs (e.g. code path taken when clicking a disabled item).
|
||||
void ImGui::StopMouseMovingWindow()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
// [nb: docking branch has more stuff in this function]
|
||||
|
||||
g.MovingWindow = NULL;
|
||||
}
|
||||
|
||||
// Handle mouse moving window
|
||||
// Note: moving window with the navigation keys (Square + d-pad / CTRL+TAB + Arrows) are processed in NavUpdateWindowing()
|
||||
// FIXME: We don't have strong guarantee that g.MovingWindow stay synced with g.ActiveId == g.MovingWindow->MoveId.
|
||||
@ -5098,7 +5132,7 @@ void ImGui::UpdateMouseMovingWindowNewFrame()
|
||||
}
|
||||
else
|
||||
{
|
||||
g.MovingWindow = NULL;
|
||||
StopMouseMovingWindow();
|
||||
ClearActiveID();
|
||||
}
|
||||
}
|
||||
@ -5140,6 +5174,9 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
||||
{
|
||||
StartMouseMovingWindow(g.HoveredWindow); //-V595
|
||||
|
||||
// FIXME: In principal we might be able to call StopMouseMovingWindow() below.
|
||||
// Please note how StartMouseMovingWindow() and StopMouseMovingWindow() and not entirely symetrical, at the later doesn't clear ActiveId.
|
||||
|
||||
// Cancel moving if clicked outside of title bar
|
||||
if (g.IO.ConfigWindowsMoveFromTitleBarOnly)
|
||||
if (!(root_window->Flags & ImGuiWindowFlags_NoTitleBar))
|
||||
@ -5147,9 +5184,12 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
||||
g.MovingWindow = NULL;
|
||||
|
||||
// Cancel moving if clicked over an item which was disabled or inhibited by popups
|
||||
// (when g.HoveredIdIsDisabled == true && g.HoveredId == 0 we are inhibited by popups, when g.HoveredIdIsDisabled == true && g.HoveredId != 0 we are over a disabled item)0 already)
|
||||
// (when g.HoveredIdIsDisabled == true && g.HoveredId == 0 we are inhibited by popups, when g.HoveredIdIsDisabled == true && g.HoveredId != 0 we are over a disabled item)
|
||||
if (g.HoveredIdIsDisabled)
|
||||
{
|
||||
g.MovingWindow = NULL;
|
||||
g.ActiveIdDisabledId = g.HoveredId;
|
||||
}
|
||||
}
|
||||
else if (root_window == NULL && g.NavWindow != NULL)
|
||||
{
|
||||
@ -5261,46 +5301,6 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags(const ImVec2& mouse_pos)
|
||||
io.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false;
|
||||
}
|
||||
|
||||
static void ImGui::UpdateTexturesNewFrame()
|
||||
{
|
||||
// Cannot update every atlases based on atlas's FrameCount < g.FrameCount, because an atlas may be shared by multiple contexts with different frame count.
|
||||
ImGuiContext& g = *GImGui;
|
||||
const bool has_textures = (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures) != 0;
|
||||
for (ImFontAtlas* atlas : g.FontAtlases)
|
||||
{
|
||||
if (atlas->OwnerContext == &g)
|
||||
{
|
||||
ImFontAtlasUpdateNewFrame(atlas, g.FrameCount, has_textures);
|
||||
}
|
||||
else
|
||||
{
|
||||
// (1) If you manage font atlases yourself, e.g. create a ImFontAtlas yourself you need to call ImFontAtlasUpdateNewFrame() on it.
|
||||
// Otherwise, calling ImGui::CreateContext() without parameter will create an atlas owned by the context.
|
||||
// (2) If you have multiple font atlases, make sure the 'atlas->RendererHasTextures' as specified in the ImFontAtlasUpdateNewFrame() call matches for that.
|
||||
// (3) If you have multiple imgui contexts, they also need to have a matching value for ImGuiBackendFlags_RendererHasTextures.
|
||||
IM_ASSERT(atlas->Builder != NULL && atlas->Builder->FrameCount != -1);
|
||||
IM_ASSERT(atlas->RendererHasTextures == has_textures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build a single texture list
|
||||
static void ImGui::UpdateTexturesEndFrame()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.PlatformIO.Textures.resize(0);
|
||||
for (ImFontAtlas* atlas : g.FontAtlases)
|
||||
for (ImTextureData* tex : atlas->TexList)
|
||||
{
|
||||
// We provide this information so backends can decide whether to destroy textures.
|
||||
// This means in practice that if N imgui contexts are created with a shared atlas, we assume all of them have a backend initialized.
|
||||
tex->RefCount = (unsigned short)atlas->RefCount;
|
||||
g.PlatformIO.Textures.push_back(tex);
|
||||
}
|
||||
for (ImTextureData* tex : g.UserTextures)
|
||||
g.PlatformIO.Textures.push_back(tex);
|
||||
}
|
||||
|
||||
// Called once a frame. Followed by SetCurrentFont() which sets up the remaining data.
|
||||
// FIXME-VIEWPORT: the concept of a single ClipRectFullscreen is not ideal!
|
||||
static void SetupDrawListSharedData()
|
||||
@ -7618,12 +7618,19 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Decide if we are going to handle borders and resize grips
|
||||
// 'window->SkipItems' is not updated yet so for child windows we rely on ParentWindow to avoid submitting decorations. (#8815)
|
||||
// Whenever we add support for full decorated child windows we will likely make this logic more general.
|
||||
bool handle_borders_and_resize_grips = true;
|
||||
if ((flags & ImGuiWindowFlags_ChildWindow) && window->ParentWindow->SkipItems)
|
||||
handle_borders_and_resize_grips = false;
|
||||
|
||||
// Handle manual resize: Resize Grips, Borders, Gamepad
|
||||
int border_hovered = -1, border_held = -1;
|
||||
ImU32 resize_grip_col[4] = {};
|
||||
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));
|
||||
if (!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 (auto_fit_mask & (1 << ImGuiAxis_X))
|
||||
@ -7760,7 +7767,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// Handle title bar, scrollbar, resize grips and resize borders
|
||||
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
|
||||
const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);
|
||||
const bool handle_borders_and_resize_grips = true; // This exists to facilitate merge with 'docking' branch.
|
||||
RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, handle_borders_and_resize_grips, resize_grip_count, resize_grip_col, resize_grip_draw_size);
|
||||
|
||||
if (render_decorations_in_parent)
|
||||
@ -8671,11 +8677,13 @@ bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] FONTS
|
||||
// [SECTION] FONTS, TEXTURES
|
||||
//-----------------------------------------------------------------------------
|
||||
// Most of the relevant font logic is in imgui_draw.cpp.
|
||||
// Those are high-level support functions.
|
||||
//-----------------------------------------------------------------------------
|
||||
// - UpdateTexturesNewFrame() [Internal]
|
||||
// - UpdateTexturesEndFrame() [Internal]
|
||||
// - UpdateFontsNewFrame() [Internal]
|
||||
// - UpdateFontsEndFrame() [Internal]
|
||||
// - GetDefaultFont() [Internal]
|
||||
@ -8690,6 +8698,46 @@ bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
|
||||
// - PopFont()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void ImGui::UpdateTexturesNewFrame()
|
||||
{
|
||||
// Cannot update every atlases based on atlas's FrameCount < g.FrameCount, because an atlas may be shared by multiple contexts with different frame count.
|
||||
ImGuiContext& g = *GImGui;
|
||||
const bool has_textures = (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures) != 0;
|
||||
for (ImFontAtlas* atlas : g.FontAtlases)
|
||||
{
|
||||
if (atlas->OwnerContext == &g)
|
||||
{
|
||||
ImFontAtlasUpdateNewFrame(atlas, g.FrameCount, has_textures);
|
||||
}
|
||||
else
|
||||
{
|
||||
// (1) If you manage font atlases yourself, e.g. create a ImFontAtlas yourself you need to call ImFontAtlasUpdateNewFrame() on it.
|
||||
// Otherwise, calling ImGui::CreateContext() without parameter will create an atlas owned by the context.
|
||||
// (2) If you have multiple font atlases, make sure the 'atlas->RendererHasTextures' as specified in the ImFontAtlasUpdateNewFrame() call matches for that.
|
||||
// (3) If you have multiple imgui contexts, they also need to have a matching value for ImGuiBackendFlags_RendererHasTextures.
|
||||
IM_ASSERT(atlas->Builder != NULL && atlas->Builder->FrameCount != -1);
|
||||
IM_ASSERT(atlas->RendererHasTextures == has_textures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build a single texture list
|
||||
static void ImGui::UpdateTexturesEndFrame()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.PlatformIO.Textures.resize(0);
|
||||
for (ImFontAtlas* atlas : g.FontAtlases)
|
||||
for (ImTextureData* tex : atlas->TexList)
|
||||
{
|
||||
// We provide this information so backends can decide whether to destroy textures.
|
||||
// This means in practice that if N imgui contexts are created with a shared atlas, we assume all of them have a backend initialized.
|
||||
tex->RefCount = (unsigned short)atlas->RefCount;
|
||||
g.PlatformIO.Textures.push_back(tex);
|
||||
}
|
||||
for (ImTextureData* tex : g.UserTextures)
|
||||
g.PlatformIO.Textures.push_back(tex);
|
||||
}
|
||||
|
||||
void ImGui::UpdateFontsNewFrame()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@ -8732,16 +8780,19 @@ ImFont* ImGui::GetDefaultFont()
|
||||
return g.IO.FontDefault ? g.IO.FontDefault : atlas->Fonts[0];
|
||||
}
|
||||
|
||||
// EXPERIMENTAL: DO NOT USE YET.
|
||||
void ImGui::RegisterUserTexture(ImTextureData* tex)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(tex->RefCount > 0);
|
||||
tex->RefCount++;
|
||||
g.UserTextures.push_back(tex);
|
||||
}
|
||||
|
||||
void ImGui::UnregisterUserTexture(ImTextureData* tex)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(tex->RefCount > 0);
|
||||
tex->RefCount--;
|
||||
g.UserTextures.find_erase(tex);
|
||||
}
|
||||
|
||||
@ -8802,11 +8853,14 @@ void ImGui::UpdateCurrentFontSize(float restore_font_size_after_scaling)
|
||||
g.Style.FontSizeBase = g.FontSizeBase;
|
||||
|
||||
// Early out to avoid hidden window keeping bakes referenced and out of GC reach.
|
||||
// However this would leave a pretty subtle and damning error surface area if g.FontBaked was mismatching, so for now we null it.
|
||||
// However this would leave a pretty subtle and damning error surface area if g.FontBaked was mismatching.
|
||||
// FIXME: perhaps g.FontSize should be updated?
|
||||
if (window != NULL && window->SkipItems)
|
||||
if (g.CurrentTable == NULL || g.CurrentTable->CurrentColumn != -1) // See 8465#issuecomment-2951509561. Ideally the SkipItems=true in tables would be amended with extra data.
|
||||
{
|
||||
ImGuiTable* table = g.CurrentTable;
|
||||
if (table == NULL || (table->CurrentColumn != -1 && table->Columns[table->CurrentColumn].IsSkipItems == false)) // See 8465#issuecomment-2951509561 and #8865. Ideally the SkipItems=true in tables would be amended with extra data.
|
||||
return;
|
||||
}
|
||||
|
||||
// Restoring is pretty much only used by PopFont()
|
||||
float final_size = (restore_font_size_after_scaling > 0.0f) ? restore_font_size_after_scaling : 0.0f;
|
||||
@ -10135,13 +10189,17 @@ void ImGui::SetNextFrameWantCaptureMouse(bool want_capture_mouse)
|
||||
static const char* GetInputSourceName(ImGuiInputSource source)
|
||||
{
|
||||
const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad" };
|
||||
IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT && source >= 0 && source < ImGuiInputSource_COUNT);
|
||||
IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT);
|
||||
if (source < 0 || source >= ImGuiInputSource_COUNT)
|
||||
return "Unknown";
|
||||
return input_source_names[source];
|
||||
}
|
||||
static const char* GetMouseSourceName(ImGuiMouseSource source)
|
||||
{
|
||||
const char* mouse_source_names[] = { "Mouse", "TouchScreen", "Pen" };
|
||||
IM_ASSERT(IM_ARRAYSIZE(mouse_source_names) == ImGuiMouseSource_COUNT && source >= 0 && source < ImGuiMouseSource_COUNT);
|
||||
IM_ASSERT(IM_ARRAYSIZE(mouse_source_names) == ImGuiMouseSource_COUNT);
|
||||
if (source < 0 || source >= ImGuiMouseSource_COUNT)
|
||||
return "Unknown";
|
||||
return mouse_source_names[source];
|
||||
}
|
||||
static void DebugPrintInputEvent(const char* prefix, const ImGuiInputEvent* e)
|
||||
@ -12501,10 +12559,10 @@ bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)
|
||||
|
||||
IM_ASSERT(cur_window); // Not inside a Begin()/End()
|
||||
const bool popup_hierarchy = (flags & ImGuiFocusedFlags_NoPopupHierarchy) == 0;
|
||||
if (flags & ImGuiHoveredFlags_RootWindow)
|
||||
if (flags & ImGuiFocusedFlags_RootWindow)
|
||||
cur_window = GetCombinedRootWindow(cur_window, popup_hierarchy);
|
||||
|
||||
if (flags & ImGuiHoveredFlags_ChildWindows)
|
||||
if (flags & ImGuiFocusedFlags_ChildWindows)
|
||||
return IsWindowChildOf(ref_window, cur_window, popup_hierarchy);
|
||||
else
|
||||
return (ref_window == cur_window);
|
||||
@ -12826,7 +12884,7 @@ static float inline NavScoreItemDistInterval(float cand_min, float cand_max, flo
|
||||
}
|
||||
|
||||
// Scoring function for keyboard/gamepad directional navigation. Based on https://gist.github.com/rygorous/6981057
|
||||
static bool ImGui::NavScoreItem(ImGuiNavItemData* result)
|
||||
static bool ImGui::NavScoreItem(ImGuiNavItemData* result, const ImRect& nav_bb)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
@ -12834,7 +12892,7 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result)
|
||||
return false;
|
||||
|
||||
// FIXME: Those are not good variables names
|
||||
ImRect cand = g.LastItemData.NavRect; // Current item nav rectangle
|
||||
ImRect cand = nav_bb; // Current item nav rectangle
|
||||
const ImRect curr = g.NavScoringRect; // Current modified source rect (NB: we've applied Max.x = Min.x in NavUpdate() to inhibit the effect of having varied item width)
|
||||
g.NavScoringDebugCount++;
|
||||
|
||||
@ -13001,13 +13059,13 @@ static void ImGui::NavProcessItem()
|
||||
const ImGuiID id = g.LastItemData.ID;
|
||||
const ImGuiItemFlags item_flags = g.LastItemData.ItemFlags;
|
||||
|
||||
// When inside a container that isn't scrollable with Left<>Right, clip NavRect accordingly (#2221)
|
||||
// When inside a container that isn't scrollable with Left<>Right, clip NavRect accordingly (#2221, #8816)
|
||||
ImRect nav_bb = g.LastItemData.NavRect;
|
||||
if (window->DC.NavIsScrollPushableX == false)
|
||||
{
|
||||
g.LastItemData.NavRect.Min.x = ImClamp(g.LastItemData.NavRect.Min.x, window->ClipRect.Min.x, window->ClipRect.Max.x);
|
||||
g.LastItemData.NavRect.Max.x = ImClamp(g.LastItemData.NavRect.Max.x, window->ClipRect.Min.x, window->ClipRect.Max.x);
|
||||
nav_bb.Min.x = ImClamp(nav_bb.Min.x, window->ClipRect.Min.x, window->ClipRect.Max.x);
|
||||
nav_bb.Max.x = ImClamp(nav_bb.Max.x, window->ClipRect.Min.x, window->ClipRect.Max.x);
|
||||
}
|
||||
const ImRect nav_bb = g.LastItemData.NavRect;
|
||||
|
||||
// Process Init Request
|
||||
if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent && (item_flags & ImGuiItemFlags_Disabled) == 0)
|
||||
@ -13039,14 +13097,14 @@ static void ImGui::NavProcessItem()
|
||||
else if (g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId))
|
||||
{
|
||||
ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther;
|
||||
if (NavScoreItem(result))
|
||||
if (NavScoreItem(result, nav_bb))
|
||||
NavApplyItemToResult(result);
|
||||
|
||||
// Features like PageUp/PageDown need to maintain a separate score for the visible set of items.
|
||||
const float VISIBLE_RATIO = 0.70f;
|
||||
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 (NavScoreItem(&g.NavMoveResultLocalVisible))
|
||||
if (NavScoreItem(&g.NavMoveResultLocalVisible, nav_bb))
|
||||
NavApplyItemToResult(&g.NavMoveResultLocalVisible);
|
||||
}
|
||||
}
|
||||
@ -13706,6 +13764,7 @@ void ImGui::NavUpdateCreateMoveRequest()
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare scoring rectangle.
|
||||
// For scoring we use a single segment on the left side our current item bounding box (not touching the edge to avoid box overlap with zero-spaced items)
|
||||
ImRect scoring_rect;
|
||||
if (window != NULL)
|
||||
@ -14116,6 +14175,7 @@ static void ImGui::NavUpdateWindowingApplyFocus(ImGuiWindow* apply_focus_window)
|
||||
SetNavCursorVisibleAfterMove();
|
||||
ClosePopupsOverWindow(apply_focus_window, false);
|
||||
FocusWindow(apply_focus_window, ImGuiFocusRequestFlags_RestoreFocusedChild);
|
||||
IM_ASSERT(g.NavWindow != NULL);
|
||||
apply_focus_window = g.NavWindow;
|
||||
if (apply_focus_window->NavLastIds[0] == 0)
|
||||
NavInitWindow(apply_focus_window, false);
|
||||
@ -14164,9 +14224,16 @@ static void ImGui::NavUpdateWindowing()
|
||||
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||
const bool keyboard_next_window = allow_windowing && g.ConfigNavWindowingKeyNext && Shortcut(g.ConfigNavWindowingKeyNext, ImGuiInputFlags_Repeat | ImGuiInputFlags_RouteAlways, owner_id);
|
||||
const bool keyboard_prev_window = allow_windowing && g.ConfigNavWindowingKeyPrev && Shortcut(g.ConfigNavWindowingKeyPrev, ImGuiInputFlags_Repeat | ImGuiInputFlags_RouteAlways, owner_id);
|
||||
const bool start_windowing_with_gamepad = allow_windowing && nav_gamepad_active && !g.NavWindowingTarget && Shortcut(ImGuiKey_NavGamepadMenu, ImGuiInputFlags_RouteAlways, owner_id);
|
||||
const bool start_toggling_with_gamepad = nav_gamepad_active && !g.NavWindowingTarget && Shortcut(ImGuiKey_NavGamepadMenu, ImGuiInputFlags_RouteAlways, owner_id);
|
||||
const bool start_windowing_with_gamepad = allow_windowing && start_toggling_with_gamepad;
|
||||
const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && (keyboard_next_window || keyboard_prev_window); // Note: enabled even without NavEnableKeyboard!
|
||||
bool just_started_windowing_from_null_focus = false;
|
||||
if (start_toggling_with_gamepad)
|
||||
{
|
||||
g.NavWindowingToggleLayer = true; // Gamepad starts toggling layer
|
||||
g.NavWindowingToggleKey = ImGuiKey_NavGamepadMenu;
|
||||
g.NavWindowingInputSource = g.NavInputSource = ImGuiInputSource_Gamepad;
|
||||
}
|
||||
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
||||
{
|
||||
@ -14174,7 +14241,6 @@ static void ImGui::NavUpdateWindowing()
|
||||
g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow; // Current location
|
||||
g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
||||
g.NavWindowingAccumDeltaPos = g.NavWindowingAccumDeltaSize = ImVec2(0.0f, 0.0f);
|
||||
g.NavWindowingToggleLayer = start_windowing_with_gamepad ? true : false; // Gamepad starts toggling layer
|
||||
g.NavWindowingInputSource = g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad;
|
||||
if (g.NavWindow == NULL)
|
||||
just_started_windowing_from_null_focus = true;
|
||||
@ -15654,10 +15720,14 @@ static void Platform_SetImeDataFn_DefaultImpl(ImGuiContext*, ImGuiViewport*, ImG
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] METRICS/DEBUGGER WINDOW
|
||||
//-----------------------------------------------------------------------------
|
||||
// - MetricsHelpMarker() [Internal]
|
||||
// - DebugRenderViewportThumbnail() [Internal]
|
||||
// - RenderViewportsThumbnails() [Internal]
|
||||
// - DebugRenderKeyboardPreview() [Internal]
|
||||
// - DebugTextEncoding()
|
||||
// - MetricsHelpMarker() [Internal]
|
||||
// - DebugFlashStyleColorStop() [Internal]
|
||||
// - DebugFlashStyleColor()
|
||||
// - UpdateDebugToolFlashStyleColor() [Internal]
|
||||
// - ShowFontAtlas() [Internal but called by Demo!]
|
||||
// - DebugNodeTexture() [Internal]
|
||||
// - ShowMetricsWindow()
|
||||
@ -15675,6 +15745,21 @@ static void Platform_SetImeDataFn_DefaultImpl(ImGuiContext*, ImGuiViewport*, ImG
|
||||
// - DebugNodeWindowsListByBeginStackParent() [Internal]
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if !defined(IMGUI_DISABLE_DEMO_WINDOWS) || !defined(IMGUI_DISABLE_DEBUG_TOOLS)
|
||||
// Avoid naming collision with imgui_demo.cpp's HelpMarker() for unity builds.
|
||||
static void MetricsHelpMarker(const char* desc)
|
||||
{
|
||||
ImGui::TextDisabled("(?)");
|
||||
if (ImGui::BeginItemTooltip())
|
||||
{
|
||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||
ImGui::TextUnformatted(desc);
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
|
||||
void ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb)
|
||||
@ -15863,19 +15948,6 @@ static const char* FormatTextureIDForDebugDisplay(char* buf, int buf_size, const
|
||||
return FormatTextureIDForDebugDisplay(buf, (int)(buf_end - buf), cmd->TexRef.GetTexID()); // Calling TexRef::GetTexID() to avoid assert of cmd->GetTexID()
|
||||
}
|
||||
|
||||
// Avoid naming collision with imgui_demo.cpp's HelpMarker() for unity builds.
|
||||
static void MetricsHelpMarker(const char* desc)
|
||||
{
|
||||
ImGui::TextDisabled("(?)");
|
||||
if (ImGui::BeginItemTooltip())
|
||||
{
|
||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||
ImGui::TextUnformatted(desc);
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IMGUI_ENABLE_FREETYPE
|
||||
namespace ImGuiFreeType { IMGUI_API const ImFontLoader* GetFontLoader(); IMGUI_API bool DebugEditFontLoaderFlags(unsigned int* p_font_builder_flags); }
|
||||
#endif
|
||||
@ -16917,14 +16989,16 @@ void ImGui::DebugNodeFont(ImFont* font)
|
||||
#endif
|
||||
|
||||
char c_str[5];
|
||||
Text("Fallback character: '%s' (U+%04X)", ImTextCharToUtf8(c_str, font->FallbackChar), font->FallbackChar);
|
||||
Text("Ellipsis character: '%s' (U+%04X)", ImTextCharToUtf8(c_str, font->EllipsisChar), font->EllipsisChar);
|
||||
ImTextCharToUtf8(c_str, font->FallbackChar);
|
||||
Text("Fallback character: '%s' (U+%04X)", c_str, font->FallbackChar);
|
||||
ImTextCharToUtf8(c_str, font->EllipsisChar);
|
||||
Text("Ellipsis character: '%s' (U+%04X)", c_str, font->EllipsisChar);
|
||||
|
||||
for (int src_n = 0; src_n < font->Sources.Size; src_n++)
|
||||
{
|
||||
ImFontConfig* src = font->Sources[src_n];
|
||||
if (TreeNode(src, "Input %d: \'%s\', Oversample: %d,%d, PixelSnapH: %d, Offset: (%.1f,%.1f)",
|
||||
src_n, src->Name, src->OversampleH, src->OversampleV, src->PixelSnapH, src->GlyphOffset.x, src->GlyphOffset.y))
|
||||
if (TreeNode(src, "Input %d: \'%s\' [%d], Oversample: %d,%d, PixelSnapH: %d, Offset: (%.1f,%.1f)",
|
||||
src_n, src->Name, src->FontNo, src->OversampleH, src->OversampleV, src->PixelSnapH, src->GlyphOffset.x, src->GlyphOffset.y))
|
||||
{
|
||||
const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader;
|
||||
Text("Loader: '%s'", loader->Name ? loader->Name : "N/A");
|
||||
@ -16960,7 +17034,10 @@ void ImGui::DebugNodeFont(ImFont* font)
|
||||
{
|
||||
char utf8_buf[5];
|
||||
for (unsigned int n = c; n < c_end; n++)
|
||||
BulletText("Codepoint U+%04X (%s)", n, ImTextCharToUtf8(utf8_buf, n));
|
||||
{
|
||||
ImTextCharToUtf8(utf8_buf, n);
|
||||
BulletText("Codepoint U+%04X (%s)", n, utf8_buf);
|
||||
}
|
||||
TreePop();
|
||||
}
|
||||
TableNextColumn();
|
||||
|
||||
40
3rdparty/imgui/src/imgui_demo.cpp
vendored
40
3rdparty/imgui/src/imgui_demo.cpp
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.1
|
||||
// dear imgui, v1.92.2b
|
||||
// (demo code)
|
||||
|
||||
// Help:
|
||||
@ -2170,7 +2170,7 @@ static void DemoWindowWidgetsQueryingStatuses()
|
||||
);
|
||||
ImGui::BulletText(
|
||||
"with Hovering Delay or Stationary test:\n"
|
||||
"IsItemHovered() = = %d\n"
|
||||
"IsItemHovered() = %d\n"
|
||||
"IsItemHovered(_Stationary) = %d\n"
|
||||
"IsItemHovered(_DelayShort) = %d\n"
|
||||
"IsItemHovered(_DelayNormal) = %d\n"
|
||||
@ -3379,6 +3379,18 @@ static void DemoWindowWidgetsSelectionAndMultiSelect(ImGuiDemoWindowData* demo_d
|
||||
// [SECTION] DemoWindowWidgetsTabs()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void EditTabBarFittingPolicyFlags(ImGuiTabBarFlags* p_flags)
|
||||
{
|
||||
if ((*p_flags & ImGuiTabBarFlags_FittingPolicyMask_) == 0)
|
||||
*p_flags |= ImGuiTabBarFlags_FittingPolicyDefault_;
|
||||
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyMixed", p_flags, ImGuiTabBarFlags_FittingPolicyMixed))
|
||||
*p_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyMixed);
|
||||
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyShrink", p_flags, ImGuiTabBarFlags_FittingPolicyShrink))
|
||||
*p_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyShrink);
|
||||
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyScroll", p_flags, ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
*p_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyScroll);
|
||||
}
|
||||
|
||||
static void DemoWindowWidgetsTabs()
|
||||
{
|
||||
IMGUI_DEMO_MARKER("Widgets/Tabs");
|
||||
@ -3421,12 +3433,7 @@ static void DemoWindowWidgetsTabs()
|
||||
ImGui::CheckboxFlags("ImGuiTabBarFlags_TabListPopupButton", &tab_bar_flags, ImGuiTabBarFlags_TabListPopupButton);
|
||||
ImGui::CheckboxFlags("ImGuiTabBarFlags_NoCloseWithMiddleMouseButton", &tab_bar_flags, ImGuiTabBarFlags_NoCloseWithMiddleMouseButton);
|
||||
ImGui::CheckboxFlags("ImGuiTabBarFlags_DrawSelectedOverline", &tab_bar_flags, ImGuiTabBarFlags_DrawSelectedOverline);
|
||||
if ((tab_bar_flags & ImGuiTabBarFlags_FittingPolicyMask_) == 0)
|
||||
tab_bar_flags |= ImGuiTabBarFlags_FittingPolicyDefault_;
|
||||
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyResizeDown", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyResizeDown))
|
||||
tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyResizeDown);
|
||||
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyScroll", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyScroll);
|
||||
EditTabBarFittingPolicyFlags(&tab_bar_flags);
|
||||
|
||||
// Tab Bar
|
||||
ImGui::AlignTextToFramePadding();
|
||||
@ -3475,12 +3482,8 @@ static void DemoWindowWidgetsTabs()
|
||||
ImGui::Checkbox("Show Trailing TabItemButton()", &show_trailing_button);
|
||||
|
||||
// Expose some other flags which are useful to showcase how they interact with Leading/Trailing tabs
|
||||
static ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_AutoSelectNewTabs | ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_FittingPolicyResizeDown;
|
||||
ImGui::CheckboxFlags("ImGuiTabBarFlags_TabListPopupButton", &tab_bar_flags, ImGuiTabBarFlags_TabListPopupButton);
|
||||
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyResizeDown", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyResizeDown))
|
||||
tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyResizeDown);
|
||||
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyScroll", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyScroll);
|
||||
static ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_AutoSelectNewTabs | ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_FittingPolicyShrink;
|
||||
EditTabBarFittingPolicyFlags(&tab_bar_flags);
|
||||
|
||||
if (ImGui::BeginTabBar("MyTabBar", tab_bar_flags))
|
||||
{
|
||||
@ -8096,6 +8099,9 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
||||
ImGui::Separator();
|
||||
ImGui::Text("sizeof(size_t): %d, sizeof(ImDrawIdx): %d, sizeof(ImDrawVert): %d", (int)sizeof(size_t), (int)sizeof(ImDrawIdx), (int)sizeof(ImDrawVert));
|
||||
ImGui::Text("define: __cplusplus=%d", (int)__cplusplus);
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||
ImGui::Text("define: IMGUI_ENABLE_TEST_ENGINE");
|
||||
#endif
|
||||
#ifdef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
ImGui::Text("define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS");
|
||||
#endif
|
||||
@ -8341,8 +8347,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
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");
|
||||
DragFloat("TabMinWidthBase", &style.TabMinWidthBase, 0.5f, 1.0f, 500.0f, "%.0f");
|
||||
DragFloat("TabMinWidthShrink", &style.TabMinWidthShrink, 0.5f, 1.0f, 500.0f, "%0.f");
|
||||
DragFloat("TabCloseButtonMinWidthSelected", &style.TabCloseButtonMinWidthSelected, 0.5f, -1.0f, 100.0f, (style.TabCloseButtonMinWidthSelected < 0.0f) ? "%.0f (Always)" : "%.0f");
|
||||
DragFloat("TabCloseButtonMinWidthUnselected", &style.TabCloseButtonMinWidthUnselected, 0.5f, -1.0f, 100.0f, (style.TabCloseButtonMinWidthUnselected < 0.0f) ? "%.0f (Always)" : "%.0f");
|
||||
SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f");
|
||||
|
||||
SeparatorText("Tables");
|
||||
|
||||
74
3rdparty/imgui/src/imgui_draw.cpp
vendored
74
3rdparty/imgui/src/imgui_draw.cpp
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.1
|
||||
// dear imgui, v1.92.2b
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
@ -2312,17 +2312,16 @@ void ImDrawData::DeIndexAllBuffers()
|
||||
{
|
||||
ImVector<ImDrawVert> new_vtx_buffer;
|
||||
TotalVtxCount = TotalIdxCount = 0;
|
||||
for (int i = 0; i < CmdListsCount; i++)
|
||||
for (ImDrawList* draw_list : CmdLists)
|
||||
{
|
||||
ImDrawList* cmd_list = CmdLists[i];
|
||||
if (cmd_list->IdxBuffer.empty())
|
||||
if (draw_list->IdxBuffer.empty())
|
||||
continue;
|
||||
new_vtx_buffer.resize(cmd_list->IdxBuffer.Size);
|
||||
for (int j = 0; j < cmd_list->IdxBuffer.Size; j++)
|
||||
new_vtx_buffer[j] = cmd_list->VtxBuffer[cmd_list->IdxBuffer[j]];
|
||||
cmd_list->VtxBuffer.swap(new_vtx_buffer);
|
||||
cmd_list->IdxBuffer.resize(0);
|
||||
TotalVtxCount += cmd_list->VtxBuffer.Size;
|
||||
new_vtx_buffer.resize(draw_list->IdxBuffer.Size);
|
||||
for (int j = 0; j < draw_list->IdxBuffer.Size; j++)
|
||||
new_vtx_buffer[j] = draw_list->VtxBuffer[draw_list->IdxBuffer[j]];
|
||||
draw_list->VtxBuffer.swap(new_vtx_buffer);
|
||||
draw_list->IdxBuffer.resize(0);
|
||||
TotalVtxCount += draw_list->VtxBuffer.Size;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2457,8 +2456,10 @@ const char* ImTextureDataGetFormatName(ImTextureFormat format)
|
||||
|
||||
void ImTextureData::Create(ImTextureFormat format, int w, int h)
|
||||
{
|
||||
IM_ASSERT(Status == ImTextureStatus_Destroyed);
|
||||
DestroyPixels();
|
||||
Format = format;
|
||||
Status = ImTextureStatus_WantCreate;
|
||||
Width = w;
|
||||
Height = h;
|
||||
BytesPerPixel = ImTextureDataGetFormatBytesPerPixel(format);
|
||||
@ -2630,6 +2631,7 @@ ImFontAtlas::ImFontAtlas()
|
||||
TexMinHeight = 128;
|
||||
TexMaxWidth = 8192;
|
||||
TexMaxHeight = 8192;
|
||||
TexRef._TexID = ImTextureID_Invalid;
|
||||
RendererHasTextures = false; // Assumed false by default, as apps can call e.g Atlas::Build() after backend init and before ImGui can update.
|
||||
TexNextUniqueID = 1;
|
||||
FontNextUniqueID = 1;
|
||||
@ -2739,10 +2741,9 @@ void ImFontAtlasUpdateNewFrame(ImFontAtlas* atlas, int frame_count, bool rendere
|
||||
if (atlas->Builder == NULL) // This will only happen if fonts were not already loaded.
|
||||
ImFontAtlasBuildMain(atlas);
|
||||
}
|
||||
else // Legacy backend
|
||||
{
|
||||
// Legacy backend
|
||||
if (!atlas->RendererHasTextures)
|
||||
IM_ASSERT_USER_ERROR(atlas->TexIsBuilt, "Backend does not support ImGuiBackendFlags_RendererHasTextures, and font atlas is not built! Update backend OR make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8().");
|
||||
}
|
||||
if (atlas->TexIsBuilt && atlas->Builder->PreloadedAllGlyphsRanges)
|
||||
IM_ASSERT_USER_ERROR(atlas->RendererHasTextures == false, "Called ImFontAtlas::Build() before ImGuiBackendFlags_RendererHasTextures got set! With new backends: you don't need to call Build().");
|
||||
|
||||
@ -2797,8 +2798,9 @@ void ImFontAtlasUpdateNewFrame(ImFontAtlas* atlas, int frame_count, bool rendere
|
||||
}
|
||||
else if (tex->WantDestroyNextFrame && tex->Status != ImTextureStatus_WantDestroy)
|
||||
{
|
||||
// Request destroy. Keep bool as it allows us to keep track of things.
|
||||
// We don't destroy pixels right away, as backend may have an in-flight copy from RAM.
|
||||
// Request destroy.
|
||||
// - Keep bool to true in order to differentiate a planned destroy vs a destroy decided by the backend.
|
||||
// - We don't destroy pixels right away, as backend may have an in-flight copy from RAM.
|
||||
IM_ASSERT(tex->Status == ImTextureStatus_OK || tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantUpdates);
|
||||
tex->Status = ImTextureStatus_WantDestroy;
|
||||
}
|
||||
@ -2954,7 +2956,7 @@ void ImFontAtlasTextureBlockQueueUpload(ImFontAtlas* atlas, ImTextureData* tex,
|
||||
tex->UsedRect.h = (unsigned short)(ImMax(tex->UsedRect.y + tex->UsedRect.h, req.y + req.h) - tex->UsedRect.y);
|
||||
atlas->TexIsBuilt = false;
|
||||
|
||||
// No need to queue if status is _WantCreate
|
||||
// No need to queue if status is == ImTextureStatus_WantCreate
|
||||
if (tex->Status == ImTextureStatus_OK || tex->Status == ImTextureStatus_WantUpdates)
|
||||
{
|
||||
tex->Status = ImTextureStatus_WantUpdates;
|
||||
@ -3361,11 +3363,7 @@ void ImFontAtlasBuildMain(ImFontAtlas* atlas)
|
||||
{
|
||||
IM_ASSERT(!atlas->Locked && "Cannot modify a locked ImFontAtlas!");
|
||||
if (atlas->TexData && atlas->TexData->Format != atlas->TexDesiredFormat)
|
||||
{
|
||||
ImVec2i new_tex_size = ImFontAtlasTextureGetSizeEstimate(atlas);
|
||||
ImFontAtlasBuildDestroy(atlas);
|
||||
ImFontAtlasTextureAdd(atlas, new_tex_size.x, new_tex_size.y);
|
||||
}
|
||||
ImFontAtlasBuildClear(atlas);
|
||||
|
||||
if (atlas->Builder == NULL)
|
||||
ImFontAtlasBuildInit(atlas);
|
||||
@ -3971,7 +3969,6 @@ ImTextureData* ImFontAtlasTextureAdd(ImFontAtlas* atlas, int w, int h)
|
||||
}
|
||||
|
||||
new_tex->Create(atlas->TexDesiredFormat, w, h);
|
||||
new_tex->Status = ImTextureStatus_WantCreate;
|
||||
atlas->TexIsBuilt = false;
|
||||
|
||||
ImFontAtlasBuildSetTexture(atlas, new_tex);
|
||||
@ -4375,6 +4372,7 @@ ImTextureRect* ImFontAtlasPackGetRectSafe(ImFontAtlas* atlas, ImFontAtlasRectId
|
||||
if (atlas->Builder == NULL)
|
||||
ImFontAtlasBuildInit(atlas);
|
||||
ImFontAtlasBuilder* builder = (ImFontAtlasBuilder*)atlas->Builder;
|
||||
IM_MSVC_WARNING_SUPPRESS(28182); // Static Analysis false positive "warning C28182: Dereferencing NULL pointer 'builder'"
|
||||
if (index_idx >= builder->RectsIndex.Size)
|
||||
return NULL;
|
||||
ImFontAtlasRectEntry* index_entry = &builder->RectsIndex[index_idx];
|
||||
@ -4417,7 +4415,7 @@ static ImFontGlyph* ImFontBaked_BuildLoadGlyph(ImFontBaked* baked, ImWchar codep
|
||||
if (atlas->Locked || (font->Flags & ImFontFlags_NoLoadGlyphs))
|
||||
{
|
||||
// Lazily load fallback glyph
|
||||
if (baked->FallbackGlyphIndex == -1 && baked->LockLoadingFallback == 0)
|
||||
if (baked->FallbackGlyphIndex == -1 && baked->LoadNoFallback == 0)
|
||||
ImFontAtlasBuildSetupFontBakedFallback(baked);
|
||||
return NULL;
|
||||
}
|
||||
@ -4469,7 +4467,7 @@ static ImFontGlyph* ImFontBaked_BuildLoadGlyph(ImFontBaked* baked, ImWchar codep
|
||||
}
|
||||
|
||||
// Lazily load fallback glyph
|
||||
if (baked->LockLoadingFallback)
|
||||
if (baked->LoadNoFallback)
|
||||
return NULL;
|
||||
if (baked->FallbackGlyphIndex == -1)
|
||||
ImFontAtlasBuildSetupFontBakedFallback(baked);
|
||||
@ -4483,7 +4481,7 @@ static ImFontGlyph* ImFontBaked_BuildLoadGlyph(ImFontBaked* baked, ImWchar codep
|
||||
|
||||
static float ImFontBaked_BuildLoadGlyphAdvanceX(ImFontBaked* baked, ImWchar codepoint)
|
||||
{
|
||||
if (baked->Size >= IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE)
|
||||
if (baked->Size >= IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE || baked->LoadNoRenderOnLayout)
|
||||
{
|
||||
// First load AdvanceX value used by CalcTextSize() API then load the rest when loaded by drawing API.
|
||||
float only_advance_x = 0.0f;
|
||||
@ -4572,15 +4570,16 @@ static bool ImGui_ImplStbTrueType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig*
|
||||
}
|
||||
src->FontLoaderData = bd_font_data;
|
||||
|
||||
const float ref_size = src->DstFont->Sources[0]->SizePixels;
|
||||
if (src->MergeMode && src->SizePixels == 0.0f)
|
||||
src->SizePixels = src->DstFont->Sources[0]->SizePixels;
|
||||
src->SizePixels = ref_size;
|
||||
|
||||
if (src->SizePixels >= 0.0f)
|
||||
bd_font_data->ScaleFactor = stbtt_ScaleForPixelHeight(&bd_font_data->FontInfo, 1.0f);
|
||||
else
|
||||
bd_font_data->ScaleFactor = stbtt_ScaleForMappingEmToPixels(&bd_font_data->FontInfo, 1.0f);
|
||||
if (src->MergeMode && src->SizePixels != 0.0f)
|
||||
bd_font_data->ScaleFactor *= src->SizePixels / src->DstFont->Sources[0]->SizePixels; // FIXME-NEWATLAS: Should tidy up that a bit
|
||||
if (src->MergeMode && src->SizePixels != 0.0f && ref_size != 0.0f)
|
||||
bd_font_data->ScaleFactor *= src->SizePixels / ref_size; // FIXME-NEWATLAS: Should tidy up that a bit
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -4679,15 +4678,12 @@ static bool ImGui_ImplStbTrueType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontC
|
||||
builder->TempBuffer.resize(w * h * 1);
|
||||
unsigned char* bitmap_pixels = builder->TempBuffer.Data;
|
||||
memset(bitmap_pixels, 0, w * h * 1);
|
||||
stbtt_MakeGlyphBitmapSubpixel(&bd_font_data->FontInfo, bitmap_pixels, r->w - oversample_h + 1, r->h - oversample_v + 1, w,
|
||||
scale_for_raster_x, scale_for_raster_y, 0, 0, glyph_index);
|
||||
|
||||
// Oversampling
|
||||
// Render with oversampling
|
||||
// (those functions conveniently assert if pixels are not cleared, which is another safety layer)
|
||||
if (oversample_h > 1)
|
||||
stbtt__h_prefilter(bitmap_pixels, r->w, r->h, r->w, oversample_h);
|
||||
if (oversample_v > 1)
|
||||
stbtt__v_prefilter(bitmap_pixels, r->w, r->h, r->w, oversample_v);
|
||||
float sub_x, sub_y;
|
||||
stbtt_MakeGlyphBitmapSubpixelPrefilter(&bd_font_data->FontInfo, bitmap_pixels, w, h, w,
|
||||
scale_for_raster_x, scale_for_raster_y, 0, 0, oversample_h, oversample_v, &sub_x, &sub_y, glyph_index);
|
||||
|
||||
const float ref_size = baked->ContainerFont->Sources[0]->SizePixels;
|
||||
const float offsets_scale = (ref_size != 0.0f) ? (baked->Size / ref_size) : 1.0f;
|
||||
@ -4697,8 +4693,8 @@ static bool ImGui_ImplStbTrueType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontC
|
||||
font_off_x = IM_ROUND(font_off_x);
|
||||
if (src->PixelSnapV)
|
||||
font_off_y = IM_ROUND(font_off_y);
|
||||
font_off_x += stbtt__oversample_shift(oversample_h);
|
||||
font_off_y += stbtt__oversample_shift(oversample_v) + IM_ROUND(baked->Ascent);
|
||||
font_off_x += sub_x;
|
||||
font_off_y += sub_y + IM_ROUND(baked->Ascent);
|
||||
float recip_h = 1.0f / (oversample_h * rasterizer_density);
|
||||
float recip_v = 1.0f / (oversample_v * rasterizer_density);
|
||||
|
||||
@ -5225,9 +5221,9 @@ ImFontGlyph* ImFontBaked::FindGlyphNoFallback(ImWchar c)
|
||||
if (i != IM_FONTGLYPH_INDEX_UNUSED)
|
||||
return &Glyphs.Data[i];
|
||||
}
|
||||
LockLoadingFallback = true; // This is actually a rare call, not done in hot-loop, so we prioritize not adding extra cruft to ImFontBaked_BuildLoadGlyph() call sites.
|
||||
LoadNoFallback = true; // This is actually a rare call, not done in hot-loop, so we prioritize not adding extra cruft to ImFontBaked_BuildLoadGlyph() call sites.
|
||||
ImFontGlyph* glyph = ImFontBaked_BuildLoadGlyph(this, c, NULL);
|
||||
LockLoadingFallback = false;
|
||||
LoadNoFallback = false;
|
||||
return glyph;
|
||||
}
|
||||
|
||||
|
||||
16
3rdparty/imgui/src/imgui_freetype.cpp
vendored
16
3rdparty/imgui/src/imgui_freetype.cpp
vendored
@ -344,7 +344,7 @@ static void* FreeType_Realloc(FT_Memory /*memory*/, long cur_size, long new_size
|
||||
return block;
|
||||
}
|
||||
|
||||
bool ImGui_ImplFreeType_LoaderInit(ImFontAtlas* atlas)
|
||||
static bool ImGui_ImplFreeType_LoaderInit(ImFontAtlas* atlas)
|
||||
{
|
||||
IM_ASSERT(atlas->FontLoaderData == nullptr);
|
||||
ImGui_ImplFreeType_Data* bd = IM_NEW(ImGui_ImplFreeType_Data)();
|
||||
@ -384,7 +384,7 @@ bool ImGui_ImplFreeType_LoaderInit(ImFontAtlas* atlas)
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplFreeType_LoaderShutdown(ImFontAtlas* atlas)
|
||||
static void ImGui_ImplFreeType_LoaderShutdown(ImFontAtlas* atlas)
|
||||
{
|
||||
ImGui_ImplFreeType_Data* bd = (ImGui_ImplFreeType_Data*)atlas->FontLoaderData;
|
||||
IM_ASSERT(bd != nullptr);
|
||||
@ -393,7 +393,7 @@ void ImGui_ImplFreeType_LoaderShutdown(ImFontAtlas* atlas)
|
||||
atlas->FontLoaderData = nullptr;
|
||||
}
|
||||
|
||||
bool ImGui_ImplFreeType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig* src)
|
||||
static bool ImGui_ImplFreeType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig* src)
|
||||
{
|
||||
ImGui_ImplFreeType_Data* bd = (ImGui_ImplFreeType_Data*)atlas->FontLoaderData;
|
||||
ImGui_ImplFreeType_FontSrcData* bd_font_data = IM_NEW(ImGui_ImplFreeType_FontSrcData);
|
||||
@ -410,7 +410,7 @@ bool ImGui_ImplFreeType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig* src)
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplFreeType_FontSrcDestroy(ImFontAtlas* atlas, ImFontConfig* src)
|
||||
static void ImGui_ImplFreeType_FontSrcDestroy(ImFontAtlas* atlas, ImFontConfig* src)
|
||||
{
|
||||
IM_UNUSED(atlas);
|
||||
ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
|
||||
@ -418,7 +418,7 @@ void ImGui_ImplFreeType_FontSrcDestroy(ImFontAtlas* atlas, ImFontConfig* src)
|
||||
src->FontLoaderData = nullptr;
|
||||
}
|
||||
|
||||
bool ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src)
|
||||
static bool ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src)
|
||||
{
|
||||
IM_UNUSED(atlas);
|
||||
float size = baked->Size;
|
||||
@ -464,7 +464,7 @@ bool ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* src, ImF
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplFreeType_FontBakedDestroy(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src)
|
||||
static void ImGui_ImplFreeType_FontBakedDestroy(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src)
|
||||
{
|
||||
IM_UNUSED(atlas);
|
||||
IM_UNUSED(baked);
|
||||
@ -475,7 +475,7 @@ void ImGui_ImplFreeType_FontBakedDestroy(ImFontAtlas* atlas, ImFontConfig* src,
|
||||
bd_baked_data->~ImGui_ImplFreeType_FontSrcBakedData(); // ~IM_PLACEMENT_DELETE()
|
||||
}
|
||||
|
||||
bool ImGui_ImplFreeType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src, ImWchar codepoint, ImFontGlyph* out_glyph, float* out_advance_x)
|
||||
static bool ImGui_ImplFreeType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src, ImWchar codepoint, ImFontGlyph* out_glyph, float* out_advance_x)
|
||||
{
|
||||
ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
|
||||
uint32_t glyph_index = FT_Get_Char_Index(bd_font_data->FtFace, codepoint);
|
||||
@ -566,7 +566,7 @@ bool ImGui_ImplFreeType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontConfig* src
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui_ImplFreetype_FontSrcContainsGlyph(ImFontAtlas* atlas, ImFontConfig* src, ImWchar codepoint)
|
||||
static bool ImGui_ImplFreetype_FontSrcContainsGlyph(ImFontAtlas* atlas, ImFontConfig* src, ImWchar codepoint)
|
||||
{
|
||||
IM_UNUSED(atlas);
|
||||
ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
|
||||
|
||||
13
3rdparty/imgui/src/imgui_tables.cpp
vendored
13
3rdparty/imgui/src/imgui_tables.cpp
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.1
|
||||
// dear imgui, v1.92.2b
|
||||
// (tables and columns code)
|
||||
|
||||
/*
|
||||
@ -542,7 +542,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||
|
||||
// Make table current
|
||||
g.CurrentTable = table;
|
||||
outer_window->DC.NavIsScrollPushableX = false; // Shortcut for NavUpdateCurrentWindowIsScrollPushableX();
|
||||
inner_window->DC.NavIsScrollPushableX = false; // Shortcut for NavUpdateCurrentWindowIsScrollPushableX();
|
||||
outer_window->DC.CurrentTableIdx = table_idx;
|
||||
if (inner_window != outer_window) // So EndChild() within the inner window can restore the table properly.
|
||||
inner_window->DC.CurrentTableIdx = table_idx;
|
||||
@ -1825,6 +1825,11 @@ void ImGui::TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiTable* table = g.CurrentTable;
|
||||
IM_ASSERT(target != ImGuiTableBgTarget_None);
|
||||
if (table == NULL)
|
||||
{
|
||||
IM_ASSERT_USER_ERROR(table != NULL, "Call should only be done while in BeginTable() scope!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (color == IM_COL32_DISABLE)
|
||||
color = 0;
|
||||
@ -2876,9 +2881,7 @@ ImGuiTableSortSpecs* ImGui::TableGetSortSpecs()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiTable* table = g.CurrentTable;
|
||||
IM_ASSERT(table != NULL);
|
||||
|
||||
if (!(table->Flags & ImGuiTableFlags_Sortable))
|
||||
if (table == NULL || !(table->Flags & ImGuiTableFlags_Sortable))
|
||||
return NULL;
|
||||
|
||||
// Require layout (in case TableHeadersRow() hasn't been called) as it may alter IsSortSpecsDirty in some paths.
|
||||
|
||||
60
3rdparty/imgui/src/imgui_widgets.cpp
vendored
60
3rdparty/imgui/src/imgui_widgets.cpp
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.92.1
|
||||
// dear imgui, v1.92.2b
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@ -1830,27 +1830,31 @@ static int IMGUI_CDECL ShrinkWidthItemComparer(const void* lhs, const void* rhs)
|
||||
|
||||
// Shrink excess width from a set of item, by removing width from the larger items first.
|
||||
// Set items Width to -1.0f to disable shrinking this item.
|
||||
void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess)
|
||||
void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess, float width_min)
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
if (items[0].Width >= 0.0f)
|
||||
items[0].Width = ImMax(items[0].Width - width_excess, 1.0f);
|
||||
items[0].Width = ImMax(items[0].Width - width_excess, width_min);
|
||||
return;
|
||||
}
|
||||
ImQsort(items, (size_t)count, sizeof(ImGuiShrinkWidthItem), ShrinkWidthItemComparer);
|
||||
ImQsort(items, (size_t)count, sizeof(ImGuiShrinkWidthItem), ShrinkWidthItemComparer); // Sort largest first, smallest last.
|
||||
int count_same_width = 1;
|
||||
while (width_excess > 0.0f && count_same_width < count)
|
||||
while (width_excess > 0.001f && count_same_width < count)
|
||||
{
|
||||
while (count_same_width < count && items[0].Width <= items[count_same_width].Width)
|
||||
count_same_width++;
|
||||
float max_width_to_remove_per_item = (count_same_width < count && items[count_same_width].Width >= 0.0f) ? (items[0].Width - items[count_same_width].Width) : (items[0].Width - 1.0f);
|
||||
max_width_to_remove_per_item = ImMin(items[0].Width - width_min, max_width_to_remove_per_item);
|
||||
if (max_width_to_remove_per_item <= 0.0f)
|
||||
break;
|
||||
float width_to_remove_per_item = ImMin(width_excess / count_same_width, max_width_to_remove_per_item);
|
||||
float base_width_to_remove_per_item = ImMin(width_excess / count_same_width, max_width_to_remove_per_item);
|
||||
for (int item_n = 0; item_n < count_same_width; item_n++)
|
||||
items[item_n].Width -= width_to_remove_per_item;
|
||||
width_excess -= width_to_remove_per_item * count_same_width;
|
||||
{
|
||||
float width_to_remove_for_this_item = ImMin(base_width_to_remove_per_item, items[item_n].Width - width_min);
|
||||
items[item_n].Width -= width_to_remove_for_this_item;
|
||||
width_excess -= width_to_remove_for_this_item;
|
||||
}
|
||||
}
|
||||
|
||||
// Round width and redistribute remainder
|
||||
@ -4940,7 +4944,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
{
|
||||
// Determine if we turn Enter into a \n character
|
||||
bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;
|
||||
if (!is_multiline || is_gamepad_validate || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))
|
||||
if (!is_multiline || is_gamepad_validate || (ctrl_enter_for_new_line != io.KeyCtrl))
|
||||
{
|
||||
validated = true;
|
||||
if (io.ConfigInputTextEnterKeepActive && !is_multiline)
|
||||
@ -8879,6 +8883,7 @@ void ImGui::EndMenuBar()
|
||||
|
||||
PopClipRect();
|
||||
PopID();
|
||||
IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'"
|
||||
window->DC.MenuBarOffset.x = window->DC.CursorPos.x - window->Pos.x; // Save horizontal position so next append can reuse it. This is kinda equivalent to a per-layer CursorPos.
|
||||
|
||||
// FIXME: Extremely confusing, cleanup by (a) working on WorkRect stack system (b) not using a Group confusingly here.
|
||||
@ -9358,6 +9363,7 @@ struct ImGuiTabBarSection
|
||||
{
|
||||
int TabCount; // Number of tabs in this section.
|
||||
float Width; // Sum of width of tabs in this section (after shrinking down)
|
||||
float WidthAfterShrinkMinWidth;
|
||||
float Spacing; // Horizontal spacing at the end of the section.
|
||||
|
||||
ImGuiTabBarSection() { memset(this, 0, sizeof(*this)); }
|
||||
@ -9429,8 +9435,8 @@ bool ImGui::BeginTabBar(const char* str_id, ImGuiTabBarFlags flags)
|
||||
ImGuiTabBar* tab_bar = g.TabBars.GetOrAddByKey(id);
|
||||
ImRect tab_bar_bb = ImRect(window->DC.CursorPos.x, window->DC.CursorPos.y, window->WorkRect.Max.x, window->DC.CursorPos.y + g.FontSize + g.Style.FramePadding.y * 2);
|
||||
tab_bar->ID = id;
|
||||
tab_bar->SeparatorMinX = tab_bar->BarRect.Min.x - IM_TRUNC(window->WindowPadding.x * 0.5f);
|
||||
tab_bar->SeparatorMaxX = tab_bar->BarRect.Max.x + IM_TRUNC(window->WindowPadding.x * 0.5f);
|
||||
tab_bar->SeparatorMinX = tab_bar_bb.Min.x - IM_TRUNC(window->WindowPadding.x * 0.5f);
|
||||
tab_bar->SeparatorMaxX = tab_bar_bb.Max.x + IM_TRUNC(window->WindowPadding.x * 0.5f);
|
||||
//if (g.NavWindow && IsWindowChildOf(g.NavWindow, window, false, false))
|
||||
flags |= ImGuiTabBarFlags_IsFocused;
|
||||
return BeginTabBarEx(tab_bar, tab_bar_bb, flags);
|
||||
@ -9550,6 +9556,10 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||
ImGuiContext& g = *GImGui;
|
||||
tab_bar->WantLayout = false;
|
||||
|
||||
// Track selected tab when resizing our parent down
|
||||
const bool scroll_to_selected_tab = (tab_bar->BarRectPrevWidth > tab_bar->BarRect.GetWidth());
|
||||
tab_bar->BarRectPrevWidth = tab_bar->BarRect.GetWidth();
|
||||
|
||||
// Garbage collect by compacting list
|
||||
// Detect if we need to sort out tab list (e.g. in rare case where a tab changed section)
|
||||
int tab_dst_n = 0;
|
||||
@ -9626,6 +9636,9 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||
int shrink_buffer_indexes[3] = { 0, sections[0].TabCount + sections[2].TabCount, sections[0].TabCount };
|
||||
g.ShrinkWidthBuffer.resize(tab_bar->Tabs.Size);
|
||||
|
||||
// Minimum shrink width
|
||||
const float shrink_min_width = (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyMixed) ? g.Style.TabMinWidthShrink : 1.0f;
|
||||
|
||||
// Compute ideal tabs widths + store them into shrink buffer
|
||||
ImGuiTabItem* most_recently_selected_tab = NULL;
|
||||
int curr_section_n = -1;
|
||||
@ -9648,10 +9661,13 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||
const char* tab_name = TabBarGetTabName(tab_bar, tab);
|
||||
const bool has_close_button_or_unsaved_marker = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) == 0 || (tab->Flags & ImGuiTabItemFlags_UnsavedDocument);
|
||||
tab->ContentWidth = (tab->RequestedWidth >= 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button_or_unsaved_marker).x;
|
||||
if ((tab->Flags & ImGuiTabItemFlags_Button) == 0)
|
||||
tab->ContentWidth = ImMax(tab->ContentWidth, g.Style.TabMinWidthBase);
|
||||
|
||||
int section_n = TabItemGetSectionIdx(tab);
|
||||
ImGuiTabBarSection* section = §ions[section_n];
|
||||
section->Width += tab->ContentWidth + (section_n == curr_section_n ? g.Style.ItemInnerSpacing.x : 0.0f);
|
||||
section->WidthAfterShrinkMinWidth += ImMin(tab->ContentWidth, shrink_min_width) + (section_n == curr_section_n ? g.Style.ItemInnerSpacing.x : 0.0f);
|
||||
curr_section_n = section_n;
|
||||
|
||||
// Store data so we can build an array sorted by width if we need to shrink tabs down
|
||||
@ -9663,19 +9679,28 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||
}
|
||||
|
||||
// Compute total ideal width (used for e.g. auto-resizing a window)
|
||||
float width_all_tabs_after_min_width_shrink = 0.0f;
|
||||
tab_bar->WidthAllTabsIdeal = 0.0f;
|
||||
for (int section_n = 0; section_n < 3; section_n++)
|
||||
{
|
||||
tab_bar->WidthAllTabsIdeal += sections[section_n].Width + sections[section_n].Spacing;
|
||||
width_all_tabs_after_min_width_shrink += sections[section_n].WidthAfterShrinkMinWidth + sections[section_n].Spacing;
|
||||
}
|
||||
|
||||
// Horizontal scrolling buttons
|
||||
// (note that TabBarScrollButtons() will alter BarRect.Max.x)
|
||||
if ((tab_bar->WidthAllTabsIdeal > tab_bar->BarRect.GetWidth() && tab_bar->Tabs.Size > 1) && !(tab_bar->Flags & ImGuiTabBarFlags_NoTabListScrollingButtons) && (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
// Important: note that TabBarScrollButtons() will alter BarRect.Max.x.
|
||||
const bool can_scroll = (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll) || (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyMixed);
|
||||
const float width_all_tabs_to_use_for_scroll = (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll) ? tab_bar->WidthAllTabs : width_all_tabs_after_min_width_shrink;
|
||||
tab_bar->ScrollButtonEnabled = ((width_all_tabs_to_use_for_scroll > tab_bar->BarRect.GetWidth() && tab_bar->Tabs.Size > 1) && !(tab_bar->Flags & ImGuiTabBarFlags_NoTabListScrollingButtons) && can_scroll);
|
||||
if (tab_bar->ScrollButtonEnabled)
|
||||
if (ImGuiTabItem* scroll_and_select_tab = TabBarScrollingButtons(tab_bar))
|
||||
{
|
||||
scroll_to_tab_id = scroll_and_select_tab->ID;
|
||||
if ((scroll_and_select_tab->Flags & ImGuiTabItemFlags_Button) == 0)
|
||||
tab_bar->SelectedTabId = scroll_to_tab_id;
|
||||
}
|
||||
if (scroll_to_tab_id == 0 && scroll_to_selected_tab)
|
||||
scroll_to_tab_id = tab_bar->SelectedTabId;
|
||||
|
||||
// Shrink widths if full tabs don't fit in their allocated space
|
||||
float section_0_w = sections[0].Width + sections[0].Spacing;
|
||||
@ -9689,11 +9714,12 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||
width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section
|
||||
|
||||
// With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore
|
||||
if (width_excess >= 1.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible))
|
||||
const bool can_shrink = (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyShrink) || (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyMixed);
|
||||
if (width_excess >= 1.0f && (can_shrink || !central_section_is_visible))
|
||||
{
|
||||
int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount);
|
||||
int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);
|
||||
ShrinkWidths(g.ShrinkWidthBuffer.Data + shrink_data_offset, shrink_data_count, width_excess);
|
||||
ShrinkWidths(g.ShrinkWidthBuffer.Data + shrink_data_offset, shrink_data_count, width_excess, shrink_min_width);
|
||||
|
||||
// Apply shrunk values into tabs and sections
|
||||
for (int tab_n = shrink_data_offset; tab_n < shrink_data_offset + shrink_data_count; tab_n++)
|
||||
@ -9748,7 +9774,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||
// Apply request requests
|
||||
if (scroll_to_tab_id != 0)
|
||||
TabBarScrollToTab(tab_bar, scroll_to_tab_id, sections);
|
||||
else if ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll) && IsMouseHoveringRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, true) && IsWindowContentHoverable(g.CurrentWindow))
|
||||
else if (tab_bar->ScrollButtonEnabled && IsMouseHoveringRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, true) && IsWindowContentHoverable(g.CurrentWindow))
|
||||
{
|
||||
const float wheel = g.IO.MouseWheelRequestAxisSwap ? g.IO.MouseWheel : g.IO.MouseWheelH;
|
||||
const ImGuiKey wheel_key = g.IO.MouseWheelRequestAxisSwap ? ImGuiKey_MouseWheelY : ImGuiKey_MouseWheelX;
|
||||
@ -10022,7 +10048,7 @@ static ImGuiTabItem* ImGui::TabBarScrollingButtons(ImGuiTabBar* tab_bar)
|
||||
|
||||
PushStyleColor(ImGuiCol_Text, arrow_col);
|
||||
PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||
PushItemFlag(ImGuiItemFlags_ButtonRepeat, true);
|
||||
PushItemFlag(ImGuiItemFlags_ButtonRepeat | ImGuiItemFlags_NoNav, true);
|
||||
const float backup_repeat_delay = g.IO.KeyRepeatDelay;
|
||||
const float backup_repeat_rate = g.IO.KeyRepeatRate;
|
||||
g.IO.KeyRepeatDelay = 0.250f;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user