mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 05:19:02 +08:00
Backends: amends to 1db1066 + merge minor bits from docking incl SetActiveIdUsingNavAndKeys().
No need to clear fields before deletion. DX12: renamed to match docking branch.
This commit is contained in:
parent
70c603854e
commit
b5a2bd1a5b
@ -49,7 +49,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// DirectX data
|
// DirectX data
|
||||||
struct FrameResources
|
struct ImGui_ImplDX12_RenderBuffers
|
||||||
{
|
{
|
||||||
ID3D12Resource* IndexBuffer;
|
ID3D12Resource* IndexBuffer;
|
||||||
ID3D12Resource* VertexBuffer;
|
ID3D12Resource* VertexBuffer;
|
||||||
@ -59,19 +59,19 @@ struct FrameResources
|
|||||||
|
|
||||||
struct ImGui_ImplDX12_Data
|
struct ImGui_ImplDX12_Data
|
||||||
{
|
{
|
||||||
ID3D12Device* pd3dDevice;
|
ID3D12Device* pd3dDevice;
|
||||||
ID3D12RootSignature* pRootSignature;
|
ID3D12RootSignature* pRootSignature;
|
||||||
ID3D12PipelineState* pPipelineState;
|
ID3D12PipelineState* pPipelineState;
|
||||||
DXGI_FORMAT RTVFormat;
|
DXGI_FORMAT RTVFormat;
|
||||||
ID3D12Resource* pFontTextureResource;
|
ID3D12Resource* pFontTextureResource;
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE hFontSrvCpuDescHandle;
|
D3D12_CPU_DESCRIPTOR_HANDLE hFontSrvCpuDescHandle;
|
||||||
D3D12_GPU_DESCRIPTOR_HANDLE hFontSrvGpuDescHandle;
|
D3D12_GPU_DESCRIPTOR_HANDLE hFontSrvGpuDescHandle;
|
||||||
|
|
||||||
FrameResources* pFrameResources;
|
ImGui_ImplDX12_RenderBuffers* pFrameResources;
|
||||||
UINT numFramesInFlight;
|
UINT numFramesInFlight;
|
||||||
UINT frameIndex;
|
UINT frameIndex;
|
||||||
|
|
||||||
ImGui_ImplDX12_Data() { memset(this, 0, sizeof(*this)); frameIndex = UINT_MAX; }
|
ImGui_ImplDX12_Data() { memset(this, 0, sizeof(*this)); frameIndex = UINT_MAX; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wrapping access to backend data (to facilitate multiple-contexts stored in io.BackendPlatformUserData)
|
// Wrapping access to backend data (to facilitate multiple-contexts stored in io.BackendPlatformUserData)
|
||||||
@ -93,7 +93,7 @@ struct VERTEX_CONSTANT_BUFFER
|
|||||||
float mvp[4][4];
|
float mvp[4][4];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ImGui_ImplDX12_SetupRenderState(ImDrawData* draw_data, ID3D12GraphicsCommandList* ctx, FrameResources* fr)
|
static void ImGui_ImplDX12_SetupRenderState(ImDrawData* draw_data, ID3D12GraphicsCommandList* ctx, ImGui_ImplDX12_RenderBuffers* fr)
|
||||||
{
|
{
|
||||||
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
|
|||||||
// If not, we can't just re-allocate the IB or VB, we'll have to do a proper allocator.
|
// If not, we can't just re-allocate the IB or VB, we'll have to do a proper allocator.
|
||||||
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
||||||
bd->frameIndex = bd->frameIndex + 1;
|
bd->frameIndex = bd->frameIndex + 1;
|
||||||
FrameResources* fr = &bd->pFrameResources[bd->frameIndex % bd->numFramesInFlight];
|
ImGui_ImplDX12_RenderBuffers* fr = &bd->pFrameResources[bd->frameIndex % bd->numFramesInFlight];
|
||||||
|
|
||||||
// Create and grow vertex/index buffers if needed
|
// Create and grow vertex/index buffers if needed
|
||||||
if (fr->VertexBuffer == NULL || fr->VertexBufferSize < draw_data->TotalVtxCount)
|
if (fr->VertexBuffer == NULL || fr->VertexBufferSize < draw_data->TotalVtxCount)
|
||||||
@ -433,10 +433,8 @@ static void ImGui_ImplDX12_CreateFontsTexture()
|
|||||||
|
|
||||||
bool ImGui_ImplDX12_CreateDeviceObjects()
|
bool ImGui_ImplDX12_CreateDeviceObjects()
|
||||||
{
|
{
|
||||||
if (ImGui::GetCurrentContext() == NULL)
|
|
||||||
return false;
|
|
||||||
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
||||||
if (!bd->pd3dDevice)
|
if (!bd || !bd->pd3dDevice)
|
||||||
return false;
|
return false;
|
||||||
if (bd->pPipelineState)
|
if (bd->pPipelineState)
|
||||||
ImGui_ImplDX12_InvalidateDeviceObjects();
|
ImGui_ImplDX12_InvalidateDeviceObjects();
|
||||||
@ -668,12 +666,10 @@ bool ImGui_ImplDX12_CreateDeviceObjects()
|
|||||||
|
|
||||||
void ImGui_ImplDX12_InvalidateDeviceObjects()
|
void ImGui_ImplDX12_InvalidateDeviceObjects()
|
||||||
{
|
{
|
||||||
if (ImGui::GetCurrentContext() == NULL)
|
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
||||||
|
if (!bd || !bd->pd3dDevice)
|
||||||
return;
|
return;
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
|
||||||
if (!bd->pd3dDevice)
|
|
||||||
return;
|
|
||||||
|
|
||||||
SafeRelease(bd->pRootSignature);
|
SafeRelease(bd->pRootSignature);
|
||||||
SafeRelease(bd->pPipelineState);
|
SafeRelease(bd->pPipelineState);
|
||||||
@ -682,7 +678,7 @@ void ImGui_ImplDX12_InvalidateDeviceObjects()
|
|||||||
|
|
||||||
for (UINT i = 0; i < bd->numFramesInFlight; i++)
|
for (UINT i = 0; i < bd->numFramesInFlight; i++)
|
||||||
{
|
{
|
||||||
FrameResources* fr = &bd->pFrameResources[i];
|
ImGui_ImplDX12_RenderBuffers* fr = &bd->pFrameResources[i];
|
||||||
SafeRelease(fr->IndexBuffer);
|
SafeRelease(fr->IndexBuffer);
|
||||||
SafeRelease(fr->VertexBuffer);
|
SafeRelease(fr->VertexBuffer);
|
||||||
}
|
}
|
||||||
@ -704,7 +700,7 @@ bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FO
|
|||||||
bd->RTVFormat = rtv_format;
|
bd->RTVFormat = rtv_format;
|
||||||
bd->hFontSrvCpuDescHandle = font_srv_cpu_desc_handle;
|
bd->hFontSrvCpuDescHandle = font_srv_cpu_desc_handle;
|
||||||
bd->hFontSrvGpuDescHandle = font_srv_gpu_desc_handle;
|
bd->hFontSrvGpuDescHandle = font_srv_gpu_desc_handle;
|
||||||
bd->pFrameResources = new FrameResources[num_frames_in_flight];
|
bd->pFrameResources = new ImGui_ImplDX12_RenderBuffers[num_frames_in_flight];
|
||||||
bd->numFramesInFlight = num_frames_in_flight;
|
bd->numFramesInFlight = num_frames_in_flight;
|
||||||
bd->frameIndex = UINT_MAX;
|
bd->frameIndex = UINT_MAX;
|
||||||
IM_UNUSED(cbv_srv_heap); // Unused in master branch (will be used by multi-viewports)
|
IM_UNUSED(cbv_srv_heap); // Unused in master branch (will be used by multi-viewports)
|
||||||
@ -712,7 +708,7 @@ bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FO
|
|||||||
// Create buffers with a default size (they will later be grown as needed)
|
// Create buffers with a default size (they will later be grown as needed)
|
||||||
for (int i = 0; i < num_frames_in_flight; i++)
|
for (int i = 0; i < num_frames_in_flight; i++)
|
||||||
{
|
{
|
||||||
FrameResources* fr = &bd->pFrameResources[i];
|
ImGui_ImplDX12_RenderBuffers* fr = &bd->pFrameResources[i];
|
||||||
fr->IndexBuffer = NULL;
|
fr->IndexBuffer = NULL;
|
||||||
fr->VertexBuffer = NULL;
|
fr->VertexBuffer = NULL;
|
||||||
fr->IndexBufferSize = 10000;
|
fr->IndexBufferSize = 10000;
|
||||||
@ -729,12 +725,6 @@ void ImGui_ImplDX12_Shutdown()
|
|||||||
|
|
||||||
ImGui_ImplDX12_InvalidateDeviceObjects();
|
ImGui_ImplDX12_InvalidateDeviceObjects();
|
||||||
delete[] bd->pFrameResources;
|
delete[] bd->pFrameResources;
|
||||||
bd->pFrameResources = NULL;
|
|
||||||
bd->pd3dDevice = NULL;
|
|
||||||
bd->hFontSrvCpuDescHandle.ptr = 0;
|
|
||||||
bd->hFontSrvGpuDescHandle.ptr = 0;
|
|
||||||
bd->numFramesInFlight = 0;
|
|
||||||
bd->frameIndex = UINT_MAX;
|
|
||||||
io.BackendRendererName = NULL;
|
io.BackendRendererName = NULL;
|
||||||
io.BackendRendererUserData = NULL;
|
io.BackendRendererUserData = NULL;
|
||||||
ImGui_ImplDX12_DestroyBackendData();
|
ImGui_ImplDX12_DestroyBackendData();
|
||||||
|
@ -273,14 +273,10 @@ void ImGui_ImplGlfw_Shutdown()
|
|||||||
glfwSetScrollCallback(bd->Window, bd->PrevUserCallbackScroll);
|
glfwSetScrollCallback(bd->Window, bd->PrevUserCallbackScroll);
|
||||||
glfwSetKeyCallback(bd->Window, bd->PrevUserCallbackKey);
|
glfwSetKeyCallback(bd->Window, bd->PrevUserCallbackKey);
|
||||||
glfwSetCharCallback(bd->Window, bd->PrevUserCallbackChar);
|
glfwSetCharCallback(bd->Window, bd->PrevUserCallbackChar);
|
||||||
bd->InstalledCallbacks = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
|
for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
|
||||||
{
|
|
||||||
glfwDestroyCursor(bd->MouseCursors[cursor_n]);
|
glfwDestroyCursor(bd->MouseCursors[cursor_n]);
|
||||||
bd->MouseCursors[cursor_n] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
io.BackendPlatformName = NULL;
|
io.BackendPlatformName = NULL;
|
||||||
io.BackendPlatformUserData = NULL;
|
io.BackendPlatformUserData = NULL;
|
||||||
|
@ -230,19 +230,18 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
|||||||
|
|
||||||
// Store GLSL version string so we can refer to it later in case we recreate shaders.
|
// Store GLSL version string so we can refer to it later in case we recreate shaders.
|
||||||
// Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
// Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
||||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
|
||||||
if (glsl_version == NULL)
|
if (glsl_version == NULL)
|
||||||
|
{
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
glsl_version = "#version 100";
|
glsl_version = "#version 100";
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_ES3)
|
#elif defined(IMGUI_IMPL_OPENGL_ES3)
|
||||||
if (glsl_version == NULL)
|
|
||||||
glsl_version = "#version 300 es";
|
glsl_version = "#version 300 es";
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
if (glsl_version == NULL)
|
|
||||||
glsl_version = "#version 150";
|
glsl_version = "#version 150";
|
||||||
#else
|
#else
|
||||||
if (glsl_version == NULL)
|
|
||||||
glsl_version = "#version 130";
|
glsl_version = "#version 130";
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(bd->GlslVersionString));
|
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(bd->GlslVersionString));
|
||||||
strcpy(bd->GlslVersionString, glsl_version);
|
strcpy(bd->GlslVersionString, glsl_version);
|
||||||
strcat(bd->GlslVersionString, "\n");
|
strcat(bd->GlslVersionString, "\n");
|
||||||
|
42
imgui.cpp
42
imgui.cpp
@ -3526,8 +3526,9 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window)
|
|||||||
FocusWindow(window);
|
FocusWindow(window);
|
||||||
SetActiveID(window->MoveId, window);
|
SetActiveID(window->MoveId, window);
|
||||||
g.NavDisableHighlight = true;
|
g.NavDisableHighlight = true;
|
||||||
|
g.ActiveIdClickOffset = g.IO.MouseClickedPos[0] - window->RootWindow->Pos;
|
||||||
g.ActiveIdNoClearOnFocusLoss = true;
|
g.ActiveIdNoClearOnFocusLoss = true;
|
||||||
g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos;
|
SetActiveIdUsingNavAndKeys();
|
||||||
|
|
||||||
bool can_move_window = true;
|
bool can_move_window = true;
|
||||||
if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||||
@ -3563,8 +3564,8 @@ void ImGui::UpdateMouseMovingWindowNewFrame()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClearActiveID();
|
|
||||||
g.MovingWindow = NULL;
|
g.MovingWindow = NULL;
|
||||||
|
ClearActiveID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4155,7 +4156,7 @@ void ImGui::Initialize(ImGuiContext* context)
|
|||||||
g.Viewports.push_back(viewport);
|
g.Viewports.push_back(viewport);
|
||||||
|
|
||||||
#ifdef IMGUI_HAS_DOCK
|
#ifdef IMGUI_HAS_DOCK
|
||||||
#endif // #ifdef IMGUI_HAS_DOCK
|
#endif
|
||||||
|
|
||||||
g.Initialized = true;
|
g.Initialized = true;
|
||||||
}
|
}
|
||||||
@ -4951,6 +4952,16 @@ void ImGui::SetItemUsingMouseWheel()
|
|||||||
g.ActiveIdUsingMouseWheel = true;
|
g.ActiveIdUsingMouseWheel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGui::SetActiveIdUsingNavAndKeys()
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
IM_ASSERT(g.ActiveId != 0);
|
||||||
|
g.ActiveIdUsingNavDirMask = ~(ImU32)0;
|
||||||
|
g.ActiveIdUsingNavInputMask = ~(ImU32)0;
|
||||||
|
g.ActiveIdUsingKeyInputMask = ~(ImU64)0;
|
||||||
|
NavMoveRequestCancel();
|
||||||
|
}
|
||||||
|
|
||||||
ImVec2 ImGui::GetItemRectMin()
|
ImVec2 ImGui::GetItemRectMin()
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindowRead();
|
ImGuiWindow* window = GetCurrentWindowRead();
|
||||||
@ -9608,7 +9619,7 @@ static void ImGui::NavUpdateWindowing()
|
|||||||
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
||||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
||||||
{
|
{
|
||||||
g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow; // FIXME-DOCK: Will need to use RootWindowDockStop
|
g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow;
|
||||||
g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
||||||
g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
|
g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
|
||||||
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad;
|
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad;
|
||||||
@ -9863,10 +9874,8 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|||||||
source_parent_id = window->IDStack.back();
|
source_parent_id = window->IDStack.back();
|
||||||
source_drag_active = IsMouseDragging(mouse_button);
|
source_drag_active = IsMouseDragging(mouse_button);
|
||||||
|
|
||||||
// Disable navigation and key inputs while dragging
|
// Disable navigation and key inputs while dragging + cancel existing request if any
|
||||||
g.ActiveIdUsingNavDirMask = ~(ImU32)0;
|
SetActiveIdUsingNavAndKeys();
|
||||||
g.ActiveIdUsingNavInputMask = ~(ImU32)0;
|
|
||||||
g.ActiveIdUsingKeyInputMask = ~(ImU64)0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -10628,8 +10637,9 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl
|
|||||||
window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
|
window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
|
||||||
}
|
}
|
||||||
IM_ASSERT(settings->ID == window->ID);
|
IM_ASSERT(settings->ID == window->ID);
|
||||||
settings->Pos = ImVec2ih((short)window->Pos.x, (short)window->Pos.y);
|
settings->Pos = ImVec2ih(window->Pos);
|
||||||
settings->Size = ImVec2ih((short)window->SizeFull.x, (short)window->SizeFull.y);
|
settings->Size = ImVec2ih(window->SizeFull);
|
||||||
|
|
||||||
settings->Collapsed = window->Collapsed;
|
settings->Collapsed = window->Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11233,6 +11243,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
Indent();
|
Indent();
|
||||||
Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]);
|
Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]);
|
||||||
Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
|
Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
|
||||||
|
Text("ActiveIdUsing: Wheel: %d, NavDirMask: %X, NavInputMask: %X, KeyInputMask: %llX", g.ActiveIdUsingMouseWheel, g.ActiveIdUsingNavDirMask, g.ActiveIdUsingNavInputMask, g.ActiveIdUsingKeyInputMask);
|
||||||
Text("HoveredId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not
|
Text("HoveredId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not
|
||||||
Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
||||||
Unindent();
|
Unindent();
|
||||||
@ -11585,7 +11596,14 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
|
|||||||
const char* buf_end = buf + IM_ARRAYSIZE(buf);
|
const char* buf_end = buf + IM_ARRAYSIZE(buf);
|
||||||
const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
|
const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
|
||||||
p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
|
p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
|
||||||
IM_UNUSED(p);
|
p += ImFormatString(p, buf_end - p, " { ");
|
||||||
|
for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++)
|
||||||
|
{
|
||||||
|
ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
|
||||||
|
p += ImFormatString(p, buf_end - p, "%s'%s'",
|
||||||
|
tab_n > 0 ? ", " : "", (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???");
|
||||||
|
}
|
||||||
|
p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } ");
|
||||||
if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
|
if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
|
||||||
bool open = TreeNode(label, "%s", buf);
|
bool open = TreeNode(label, "%s", buf);
|
||||||
if (!is_active) { PopStyleColor(); }
|
if (!is_active) { PopStyleColor(); }
|
||||||
@ -11605,7 +11623,7 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
|
|||||||
if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2);
|
if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2);
|
||||||
if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine();
|
if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine();
|
||||||
Text("%02d%c Tab 0x%08X '%s' Offset: %.1f, Width: %.1f/%.1f",
|
Text("%02d%c Tab 0x%08X '%s' Offset: %.1f, Width: %.1f/%.1f",
|
||||||
tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "", tab->Offset, tab->Width, tab->ContentWidth);
|
tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???", tab->Offset, tab->Width, tab->ContentWidth);
|
||||||
PopID();
|
PopID();
|
||||||
}
|
}
|
||||||
TreePop();
|
TreePop();
|
||||||
|
2
imgui.h
2
imgui.h
@ -2760,7 +2760,7 @@ struct ImFont
|
|||||||
// [SECTION] Viewports
|
// [SECTION] Viewports
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Flags stored in ImGuiViewport::Flags
|
// Flags stored in ImGuiViewport::Flags, giving indications to the platform backends.
|
||||||
enum ImGuiViewportFlags_
|
enum ImGuiViewportFlags_
|
||||||
{
|
{
|
||||||
ImGuiViewportFlags_None = 0,
|
ImGuiViewportFlags_None = 0,
|
||||||
|
@ -6974,12 +6974,12 @@ static void ShowExampleAppConstrainedResize(bool* p_open)
|
|||||||
// + a context-menu to choose which corner of the screen to use.
|
// + a context-menu to choose which corner of the screen to use.
|
||||||
static void ShowExampleAppSimpleOverlay(bool* p_open)
|
static void ShowExampleAppSimpleOverlay(bool* p_open)
|
||||||
{
|
{
|
||||||
const float PAD = 10.0f;
|
|
||||||
static int corner = 0;
|
static int corner = 0;
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||||
if (corner != -1)
|
if (corner != -1)
|
||||||
{
|
{
|
||||||
|
const float PAD = 10.0f;
|
||||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||||
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
|
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
|
||||||
ImVec2 work_size = viewport->WorkSize;
|
ImVec2 work_size = viewport->WorkSize;
|
||||||
|
@ -3730,6 +3730,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
|||||||
// - RenderMouseCursor()
|
// - RenderMouseCursor()
|
||||||
// - RenderArrowPointingAt()
|
// - RenderArrowPointingAt()
|
||||||
// - RenderRectFilledRangeH()
|
// - RenderRectFilledRangeH()
|
||||||
|
// - RenderRectFilledWithHole()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Function in need of a redesign (legacy mess)
|
// Function in need of a redesign (legacy mess)
|
||||||
// - RenderColorRectWithAlphaCheckerboard()
|
// - RenderColorRectWithAlphaCheckerboard()
|
||||||
|
@ -1142,7 +1142,7 @@ struct ImGuiNextWindowData
|
|||||||
ImGuiSizeCallback SizeCallback;
|
ImGuiSizeCallback SizeCallback;
|
||||||
void* SizeCallbackUserData;
|
void* SizeCallbackUserData;
|
||||||
float BgAlphaVal; // Override background alpha
|
float BgAlphaVal; // Override background alpha
|
||||||
ImVec2 MenuBarOffsetMinVal; // *Always on* This is not exposed publicly, so we don't clear it.
|
ImVec2 MenuBarOffsetMinVal; // (Always on) This is not exposed publicly, so we don't clear it and it doesn't have a corresponding flag (could we? for consistency?)
|
||||||
|
|
||||||
ImGuiNextWindowData() { memset(this, 0, sizeof(*this)); }
|
ImGuiNextWindowData() { memset(this, 0, sizeof(*this)); }
|
||||||
inline void ClearFlags() { Flags = ImGuiNextWindowDataFlags_None; }
|
inline void ClearFlags() { Flags = ImGuiNextWindowDataFlags_None; }
|
||||||
@ -2465,6 +2465,7 @@ namespace ImGui
|
|||||||
// Inputs
|
// Inputs
|
||||||
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
||||||
IMGUI_API void SetItemUsingMouseWheel();
|
IMGUI_API void SetItemUsingMouseWheel();
|
||||||
|
IMGUI_API void SetActiveIdUsingNavAndKeys();
|
||||||
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
||||||
inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; }
|
inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; }
|
||||||
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; IM_ASSERT(key < 64); return (g.ActiveIdUsingKeyInputMask & ((ImU64)1 << key)) != 0; }
|
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; IM_ASSERT(key < 64); return (g.ActiveIdUsingKeyInputMask & ((ImU64)1 << key)) != 0; }
|
||||||
@ -2709,8 +2710,8 @@ extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt,
|
|||||||
#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box
|
#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional)
|
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional)
|
||||||
#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log
|
#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log
|
||||||
#define IMGUI_TEST_ENGINE_ID_INFO(_ID,_TYPE,_DATA) if (g.TestEngineHookIdInfo == id) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA));
|
#define IMGUI_TEST_ENGINE_ID_INFO(_ID,_TYPE,_DATA) if (g.TestEngineHookIdInfo == _ID) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA));
|
||||||
#define IMGUI_TEST_ENGINE_ID_INFO2(_ID,_TYPE,_DATA,_DATA2) if (g.TestEngineHookIdInfo == id) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA), (const void*)(_DATA2));
|
#define IMGUI_TEST_ENGINE_ID_INFO2(_ID,_TYPE,_DATA,_DATA2) if (g.TestEngineHookIdInfo == _ID) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA), (const void*)(_DATA2));
|
||||||
#else
|
#else
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)0)
|
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -288,12 +288,7 @@ inline ImGuiTableFlags TableFixFlags(ImGuiTableFlags flags, ImGuiWindow* outer_w
|
|||||||
flags |= ImGuiTableFlags_NoSavedSettings;
|
flags |= ImGuiTableFlags_NoSavedSettings;
|
||||||
|
|
||||||
// Inherit _NoSavedSettings from top-level window (child windows always have _NoSavedSettings set)
|
// Inherit _NoSavedSettings from top-level window (child windows always have _NoSavedSettings set)
|
||||||
#ifdef IMGUI_HAS_DOCK
|
if (outer_window->RootWindow->Flags & ImGuiWindowFlags_NoSavedSettings)
|
||||||
ImGuiWindow* window_for_settings = outer_window->RootWindowDockStop;
|
|
||||||
#else
|
|
||||||
ImGuiWindow* window_for_settings = outer_window->RootWindow;
|
|
||||||
#endif
|
|
||||||
if (window_for_settings->Flags & ImGuiWindowFlags_NoSavedSettings)
|
|
||||||
flags |= ImGuiTableFlags_NoSavedSettings;
|
flags |= ImGuiTableFlags_NoSavedSettings;
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
|
Loading…
Reference in New Issue
Block a user