|
@@ -908,7 +908,7 @@ static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 2.00f; // Lock
|
|
|
|
|
|
static void SetCurrentWindow(ImGuiWindow* window);
|
|
static void SetCurrentWindow(ImGuiWindow* window);
|
|
static void FindHoveredWindow();
|
|
static void FindHoveredWindow();
|
|
-static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags);
|
|
|
|
|
|
+static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags);
|
|
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges);
|
|
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges);
|
|
|
|
|
|
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);
|
|
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);
|
|
@@ -4874,7 +4874,15 @@ ImGuiWindow* ImGui::FindWindowByName(const char* name)
|
|
return FindWindowByID(id);
|
|
return FindWindowByID(id);
|
|
}
|
|
}
|
|
|
|
|
|
-static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
|
|
|
|
|
|
+static void ApplyWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settings)
|
|
|
|
+{
|
|
|
|
+ window->Pos = ImFloor(ImVec2(settings->Pos.x, settings->Pos.y));
|
|
|
|
+ if (settings->Size.x > 0 && settings->Size.y > 0)
|
|
|
|
+ window->Size = window->SizeFull = ImFloor(ImVec2(settings->Size.x, settings->Size.y));
|
|
|
|
+ window->Collapsed = settings->Collapsed;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
|
|
{
|
|
{
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
//IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags);
|
|
//IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags);
|
|
@@ -4894,12 +4902,8 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
|
|
// Retrieve settings from .ini file
|
|
// Retrieve settings from .ini file
|
|
window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
|
|
window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
|
|
SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false);
|
|
SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false);
|
|
- window->Pos = ImVec2(settings->Pos.x, settings->Pos.y);
|
|
|
|
- window->Collapsed = settings->Collapsed;
|
|
|
|
- if (settings->Size.x > 0 && settings->Size.y > 0)
|
|
|
|
- size = ImVec2(settings->Size.x, settings->Size.y);
|
|
|
|
|
|
+ ApplyWindowSettings(window, settings);
|
|
}
|
|
}
|
|
- window->Size = window->SizeFull = ImFloor(size);
|
|
|
|
window->DC.CursorStartPos = window->DC.CursorMaxPos = window->Pos; // So first call to CalcContentSize() doesn't return crazy values
|
|
window->DC.CursorStartPos = window->DC.CursorMaxPos = window->Pos; // So first call to CalcContentSize() doesn't return crazy values
|
|
|
|
|
|
if ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0)
|
|
if ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0)
|
|
@@ -5446,10 +5450,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
ImGuiWindow* window = FindWindowByName(name);
|
|
ImGuiWindow* window = FindWindowByName(name);
|
|
const bool window_just_created = (window == NULL);
|
|
const bool window_just_created = (window == NULL);
|
|
if (window_just_created)
|
|
if (window_just_created)
|
|
- {
|
|
|
|
- ImVec2 size_on_first_use = (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) ? g.NextWindowData.SizeVal : ImVec2(0.0f, 0.0f); // Any condition flag will do since we are creating a new window here.
|
|
|
|
- window = CreateNewWindow(name, size_on_first_use, flags);
|
|
|
|
- }
|
|
|
|
|
|
+ window = CreateNewWindow(name, flags);
|
|
|
|
|
|
// Automatically disable manual moving/resizing when NoInputs is set
|
|
// Automatically disable manual moving/resizing when NoInputs is set
|
|
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
|
|
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
|