From 93efa5415f42e0dbf2901cd2b3b611c34ae8e628 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 19 Nov 2019 20:48:11 +0100 Subject: [PATCH] Renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS. (#1038) Renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS. --- docs/CHANGELOG.txt | 2 ++ imconfig.h | 6 +++--- imgui.cpp | 6 ++++-- imgui_demo.cpp | 8 ++++---- imgui_internal.h | 12 ++++++++++-- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 513cd335..37382268 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -50,6 +50,8 @@ Breaking Changes: Effectively it made io.KeyRepeatRate behave like it was set to (io.KeyRepeatRate + io.KeyRepeatDelay). Fixed the code and altered default io.KeyRepeatRate,Delay from 0.250,0.050 to 0.300,0.050 to compensate. If you never altered io.KeyRepeatRate nor used GetKeyPressedAmount() this won't affect you. +- Misc: Renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS. (#1038) +- Misc: Renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS. - Backends: DX12: Added extra ID3D12DescriptorHeap parameter to ImGui_ImplDX12_Init() function. The value is unused in master branch but will be used by the multi-viewport feature. (#2851) [@obfuscate] diff --git a/imconfig.h b/imconfig.h index 45e75ecf..97194541 100644 --- a/imconfig.h +++ b/imconfig.h @@ -34,9 +34,9 @@ //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). -//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices'). -//#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf. -//#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h. +//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). +//#define IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) +//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). //---- Include imgui_user.h at the end of imgui.h as a convenience diff --git a/imgui.cpp b/imgui.cpp index eaa36d25..b5da86a4 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -352,6 +352,8 @@ CODE When you are not sure about a 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. + - 2019/11/19 (1.74) - renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS for consistency. + - 2019/11/19 (1.74) - renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS for consistency. - 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017): Begin() (5 arguments signature), IsRootWindowOrAnyChildHovered(), AlignFirstTextHeightToWidgets(), SetNextWindowPosCenter(), ImFont::Glyph. See docs/Changelog.txt or grep this log for details and new names, or see how they were implemented until 1.73. - 2019/10/14 (1.74) - inputs: Fixed a miscalculation in the keyboard/mouse "typematic" repeat delay/rate calculation, used by keys and e.g. repeating mouse buttons as well as the GetKeyPressedAmount() function. if you were using a non-default value for io.KeyRepeatRate (previous default was 0.250), you can add +io.KeyRepeatDelay to it to compensate for the fix. @@ -1251,7 +1253,7 @@ const char* ImStrSkipBlank(const char* str) // A) MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size). // Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm. // B) When buf==NULL vsnprintf() will return the output size. -#ifndef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS +#ifndef IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS //#define IMGUI_USE_STB_SPRINTF #ifdef IMGUI_USE_STB_SPRINTF @@ -1295,7 +1297,7 @@ int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args) buf[w] = 0; return w; } -#endif // #ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS +#endif // #ifdef IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS // CRC32 needs a 1KB lookup table (not cache friendly) // Although the code to generate the table is simple and shorter than the table itself, using a const table allows us to easily: diff --git a/imgui_demo.cpp b/imgui_demo.cpp index deaf4bc4..e45756f1 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -3106,11 +3106,11 @@ void ImGui::ShowAboutWindow(bool* p_open) #ifdef IMGUI_DISABLE_WIN32_FUNCTIONS ImGui::Text("define: IMGUI_DISABLE_WIN32_FUNCTIONS"); #endif -#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS - ImGui::Text("define: IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS"); +#ifdef IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS + ImGui::Text("define: IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS"); #endif -#ifdef IMGUI_DISABLE_MATH_FUNCTIONS - ImGui::Text("define: IMGUI_DISABLE_MATH_FUNCTIONS"); +#ifdef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS + ImGui::Text("define: IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS"); #endif #ifdef IMGUI_DISABLE_DEFAULT_ALLOCATORS ImGui::Text("define: IMGUI_DISABLE_DEFAULT_ALLOCATORS"); diff --git a/imgui_internal.h b/imgui_internal.h index bbdf0b6a..2696e748 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -31,7 +31,7 @@ Index of this file: #error Must include imgui.h before imgui_internal.h #endif -#include // FILE* +#include // FILE*, sscanf #include // NULL, malloc, free, qsort, atoi, atof #include // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf #include // INT_MIN, INT_MAX @@ -60,6 +60,14 @@ Index of this file: #pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead #endif +// Legacy defines +#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Obsolete Since 1.74 +#error Use IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS +#endif +#ifdef IMGUI_DISABLE_MATH_FUNCTIONS // Obsolete Since 1.74 +#error Use IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS +#endif + //----------------------------------------------------------------------------- // Forward declarations //----------------------------------------------------------------------------- @@ -254,7 +262,7 @@ static inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs) // Helpers: Maths // - Wrapper for standard libs functions. (Note that imgui_demo.cpp does _not_ use them to keep the code easy to copy) -#ifndef IMGUI_DISABLE_MATH_FUNCTIONS +#ifndef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS static inline float ImFabs(float x) { return fabsf(x); } static inline float ImSqrt(float x) { return sqrtf(x); } static inline float ImPow(float x, float y) { return powf(x, y); }