Internals: SettingsHandlerWindow_ReadLine uses context parameter.

This commit is contained in:
omar 2019-04-27 17:11:06 +02:00
parent ae405b83a4
commit a1c432d1ad

View File

@ -9374,21 +9374,22 @@ static void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*
return (void*)settings; return (void*)settings;
} }
static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line) static void SettingsHandlerWindow_ReadLine(ImGuiContext* ctx, ImGuiSettingsHandler*, void* entry, const char* line)
{ {
ImGuiContext& g = *ctx;
ImGuiWindowSettings* settings = (ImGuiWindowSettings*)entry; ImGuiWindowSettings* settings = (ImGuiWindowSettings*)entry;
float x, y; float x, y;
int i; int i;
if (sscanf(line, "Pos=%f,%f", &x, &y) == 2) settings->Pos = ImVec2(x, y); if (sscanf(line, "Pos=%f,%f", &x, &y) == 2) settings->Pos = ImVec2(x, y);
else if (sscanf(line, "Size=%f,%f", &x, &y) == 2) settings->Size = ImMax(ImVec2(x, y), GImGui->Style.WindowMinSize); else if (sscanf(line, "Size=%f,%f", &x, &y) == 2) settings->Size = ImMax(ImVec2(x, y), g.Style.WindowMinSize);
else if (sscanf(line, "Collapsed=%d", &i) == 1) settings->Collapsed = (i != 0); else if (sscanf(line, "Collapsed=%d", &i) == 1) settings->Collapsed = (i != 0);
} }
static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) static void SettingsHandlerWindow_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
{ {
// Gather data from windows that were active during this session // Gather data from windows that were active during this session
// (if a window wasn't opened in this session we preserve its settings) // (if a window wasn't opened in this session we preserve its settings)
ImGuiContext& g = *imgui_ctx; ImGuiContext& g = *ctx;
for (int i = 0; i != g.Windows.Size; i++) for (int i = 0; i != g.Windows.Size; i++)
{ {
ImGuiWindow* window = g.Windows[i]; ImGuiWindow* window = g.Windows[i];