|
|
@@ -510,11 +510,11 @@
|
|
|
|
|
|
Q: How can I easily use icons in my application?
|
|
|
A: The most convenient and practical way is to merge an icon font such as FontAwesome inside you main font. Then you can refer to icons within your
|
|
|
- strings. Read 'How can I load multiple fonts?' and the file 'extra_fonts/README.txt' for instructions and useful header files.
|
|
|
+ strings. Read 'How can I load multiple fonts?' and the file 'misc/fonts/README.txt' for instructions and useful header files.
|
|
|
|
|
|
Q: How can I load multiple fonts?
|
|
|
A: Use the font atlas to pack them into a single texture:
|
|
|
- (Read extra_fonts/README.txt and the code in ImFontAtlas for more details.)
|
|
|
+ (Read misc/fonts/README.txt and the code in ImFontAtlas for more details.)
|
|
|
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
ImFont* font0 = io.Fonts->AddFontDefault();
|
|
|
@@ -672,7 +672,6 @@ static void MarkIniSettingsDirty(ImGuiWindow* window);
|
|
|
|
|
|
static ImRect GetViewportRect();
|
|
|
|
|
|
-static void CloseInactivePopups(ImGuiWindow* ref_window);
|
|
|
static void ClosePopupToLevel(int remaining);
|
|
|
static ImGuiWindow* GetFrontMostModalRootWindow();
|
|
|
|
|
|
@@ -2552,7 +2551,7 @@ void ImGui::NewFrame()
|
|
|
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
|
|
g.CurrentWindowStack.resize(0);
|
|
|
g.CurrentPopupStack.resize(0);
|
|
|
- CloseInactivePopups(g.NavWindow);
|
|
|
+ ClosePopupsOverWindow(g.NavWindow);
|
|
|
|
|
|
// Create implicit window - we will only render it if the user has added something to it.
|
|
|
// We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags.
|
|
|
@@ -3003,7 +3002,7 @@ void ImGui::EndFrame()
|
|
|
}
|
|
|
|
|
|
// With right mouse button we close popups without changing focus
|
|
|
- // (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger)
|
|
|
+ // (The left mouse button path calls FocusWindow which will lead NewFrame->ClosePopupsOverWindow to trigger)
|
|
|
if (g.IO.MouseClicked[1])
|
|
|
{
|
|
|
// Find the top-most window between HoveredWindow and the front most Modal Window.
|
|
|
@@ -3020,7 +3019,7 @@ void ImGui::EndFrame()
|
|
|
if (window == g.HoveredWindow)
|
|
|
hovered_window_above_modal = true;
|
|
|
}
|
|
|
- CloseInactivePopups(hovered_window_above_modal ? g.HoveredWindow : modal);
|
|
|
+ ClosePopupsOverWindow(hovered_window_above_modal ? g.HoveredWindow : modal);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -3775,7 +3774,7 @@ void ImGui::OpenPopupEx(ImGuiID id)
|
|
|
else
|
|
|
g.OpenPopupStack[current_stack_size] = popup_ref;
|
|
|
|
|
|
- // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by CloseInactivePopups().
|
|
|
+ // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by ClosePopupsOverWindow().
|
|
|
// This is equivalent to what ClosePopupToLevel() does.
|
|
|
//if (g.OpenPopupStack[current_stack_size].PopupId == id)
|
|
|
// FocusWindow(parent_window);
|
|
|
@@ -3788,7 +3787,7 @@ void ImGui::OpenPopup(const char* str_id)
|
|
|
OpenPopupEx(g.CurrentWindow->GetID(str_id));
|
|
|
}
|
|
|
|
|
|
-static void CloseInactivePopups(ImGuiWindow* ref_window)
|
|
|
+void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
if (g.OpenPopupStack.empty())
|
|
|
@@ -5164,7 +5163,8 @@ void ImGui::Scrollbar(ImGuiLayoutType direction)
|
|
|
void ImGui::BringWindowToFront(ImGuiWindow* window)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- if (g.Windows.back() == window)
|
|
|
+ ImGuiWindow* current_front_window = g.Windows.back();
|
|
|
+ if (current_front_window == window || current_front_window->RootWindow == window)
|
|
|
return;
|
|
|
for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window
|
|
|
if (g.Windows[i] == window)
|
|
|
@@ -6462,12 +6462,13 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos, float radius)
|
|
|
|
|
|
// Render
|
|
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton);
|
|
|
- const ImVec2 center = bb.GetCenter();
|
|
|
+ ImVec2 center = bb.GetCenter();
|
|
|
window->DrawList->AddCircleFilled(center, ImMax(2.0f, radius), col, 12);
|
|
|
|
|
|
const float cross_extent = (radius * 0.7071f) - 1.0f;
|
|
|
if (hovered)
|
|
|
{
|
|
|
+ center -= ImVec2(0.5f, 0.5f);
|
|
|
window->DrawList->AddLine(center + ImVec2(+cross_extent,+cross_extent), center + ImVec2(-cross_extent,-cross_extent), GetColorU32(ImGuiCol_Text));
|
|
|
window->DrawList->AddLine(center + ImVec2(+cross_extent,-cross_extent), center + ImVec2(-cross_extent,+cross_extent), GetColorU32(ImGuiCol_Text));
|
|
|
}
|
|
|
@@ -6574,8 +6575,9 @@ void ImGui::LogToTTY(int max_depth)
|
|
|
return;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
- g.LogEnabled = true;
|
|
|
+ IM_ASSERT(g.LogFile == NULL);
|
|
|
g.LogFile = stdout;
|
|
|
+ g.LogEnabled = true;
|
|
|
g.LogStartDepth = window->DC.TreeDepth;
|
|
|
if (max_depth >= 0)
|
|
|
g.LogAutoExpandMaxDepth = max_depth;
|
|
|
@@ -6596,6 +6598,7 @@ void ImGui::LogToFile(int max_depth, const char* filename)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ IM_ASSERT(g.LogFile == NULL);
|
|
|
g.LogFile = ImFileOpen(filename, "ab");
|
|
|
if (!g.LogFile)
|
|
|
{
|
|
|
@@ -6616,8 +6619,9 @@ void ImGui::LogToClipboard(int max_depth)
|
|
|
return;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
- g.LogEnabled = true;
|
|
|
+ IM_ASSERT(g.LogFile == NULL);
|
|
|
g.LogFile = NULL;
|
|
|
+ g.LogEnabled = true;
|
|
|
g.LogStartDepth = window->DC.TreeDepth;
|
|
|
if (max_depth >= 0)
|
|
|
g.LogAutoExpandMaxDepth = max_depth;
|
|
|
@@ -6630,7 +6634,6 @@ void ImGui::LogFinish()
|
|
|
return;
|
|
|
|
|
|
LogText(IM_NEWLINE);
|
|
|
- g.LogEnabled = false;
|
|
|
if (g.LogFile != NULL)
|
|
|
{
|
|
|
if (g.LogFile == stdout)
|
|
|
@@ -6644,6 +6647,7 @@ void ImGui::LogFinish()
|
|
|
SetClipboardText(g.LogClipboard->begin());
|
|
|
g.LogClipboard->clear();
|
|
|
}
|
|
|
+ g.LogEnabled = false;
|
|
|
}
|
|
|
|
|
|
// Helper to display logging buttons
|