mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-07 21:39:54 +02:00
Merge branch 'viewport' into docking
# Conflicts: # imgui.cpp # imgui_widgets.cpp
This commit is contained in:
31
imgui.cpp
31
imgui.cpp
@ -863,21 +863,21 @@ CODE
|
||||
|
||||
#include <ctype.h> // toupper, isprint
|
||||
#include <stdio.h> // vsnprintf, sscanf, printf
|
||||
#include <wchar.h> // wcslen
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||
#include <stddef.h> // intptr_t
|
||||
#else
|
||||
#include <stdint.h> // intptr_t
|
||||
#endif
|
||||
|
||||
// Debug options
|
||||
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL
|
||||
#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
|
||||
#define IMGUI_DEBUG_DOCKING_INI 0 // Save additional comments in .ini file (makes saving slower)
|
||||
|
||||
// Visual Studio warnings
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable: 4127) // condition expression is constant
|
||||
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||
#pragma warning (disable: 4127) // condition expression is constant
|
||||
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||
#endif
|
||||
|
||||
// Clang/GCC warnings with -Weverything
|
||||
@ -972,6 +972,14 @@ static int FindPlatformMonitorForRect(const ImRect& r);
|
||||
|
||||
}
|
||||
|
||||
// Test engine hooks (imgui-test)
|
||||
//#define IMGUI_ENABLE_TEST_ENGINE_HOOKS
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE_HOOKS
|
||||
extern void ImGuiTestEngineHook_PreNewFrame();
|
||||
extern void ImGuiTestEngineHook_PostNewFrame();
|
||||
extern void ImGuiTestEngineHook_ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] CONTEXT AND MEMORY ALLOCATORS
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1235,7 +1243,10 @@ const char* ImStrchrRange(const char* str, const char* str_end, char c)
|
||||
|
||||
int ImStrlenW(const ImWchar* str)
|
||||
{
|
||||
return (int)wcslen((const wchar_t*)str);
|
||||
//return (int)wcslen((const wchar_t*)str); // FIXME-OPT: Could use this when wchar_t are 16-bits
|
||||
int n = 0;
|
||||
while (*str++) n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
// Find end-of-line. Return pointer will point to either first \n, either str_end.
|
||||
@ -2640,6 +2651,10 @@ void ImGui::ItemSize(const ImRect& bb, float text_offset_y)
|
||||
// declare their minimum size requirement to ItemSize() and then use a larger region for drawing/interaction, which is passed to ItemAdd().
|
||||
bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg)
|
||||
{
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE_HOOKS
|
||||
ImGuiTestEngineHook_ItemAdd(bb, id, nav_bb_arg);
|
||||
#endif
|
||||
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
@ -3219,6 +3234,10 @@ void ImGui::NewFrame()
|
||||
IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?");
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE_HOOKS
|
||||
ImGuiTestEngineHook_PreNewFrame();
|
||||
#endif
|
||||
|
||||
// Check user data
|
||||
// (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument)
|
||||
IM_ASSERT(g.Initialized);
|
||||
@ -3435,6 +3454,10 @@ void ImGui::NewFrame()
|
||||
// We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags.
|
||||
SetNextWindowSize(ImVec2(400,400), ImGuiCond_FirstUseEver);
|
||||
Begin("Debug##Default");
|
||||
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE_HOOKS
|
||||
ImGuiTestEngineHook_PostNewFrame();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImGui::Initialize(ImGuiContext* context)
|
||||
|
Reference in New Issue
Block a user