|
@@ -847,9 +847,9 @@ static void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted
|
|
|
static ImRect GetViewportRect();
|
|
|
|
|
|
// Settings
|
|
|
-static void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name);
|
|
|
-static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line);
|
|
|
-static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf);
|
|
|
+static void* WindowSettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name);
|
|
|
+static void WindowSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line);
|
|
|
+static void WindowSettingsHandler_WriteAll(ImGuiContext*, ImGuiSettingsHandler*, ImGuiTextBuffer* buf);
|
|
|
|
|
|
// Platform Dependents default implementation for IO functions
|
|
|
static const char* GetClipboardTextFn_DefaultImpl(void* user_data);
|
|
@@ -1242,6 +1242,13 @@ void ImStrTrimBlanks(char* buf)
|
|
|
buf[p - p_start] = 0; // Zero terminate
|
|
|
}
|
|
|
|
|
|
+const char* ImStrSkipBlank(const char* str)
|
|
|
+{
|
|
|
+ while (str[0] == ' ' || str[0] == '\t')
|
|
|
+ str++;
|
|
|
+ return str;
|
|
|
+}
|
|
|
+
|
|
|
// A) MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size).
|
|
|
// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm.
|
|
|
// B) When buf==NULL vsnprintf() will return the output size.
|
|
@@ -3744,13 +3751,15 @@ void ImGui::Initialize(ImGuiContext* context)
|
|
|
IM_ASSERT(!g.Initialized && !g.SettingsLoaded);
|
|
|
|
|
|
// Add .ini handle for ImGuiWindow type
|
|
|
- ImGuiSettingsHandler ini_handler;
|
|
|
- ini_handler.TypeName = "Window";
|
|
|
- ini_handler.TypeHash = ImHashStr("Window");
|
|
|
- ini_handler.ReadOpenFn = SettingsHandlerWindow_ReadOpen;
|
|
|
- ini_handler.ReadLineFn = SettingsHandlerWindow_ReadLine;
|
|
|
- ini_handler.WriteAllFn = SettingsHandlerWindow_WriteAll;
|
|
|
- g.SettingsHandlers.push_back(ini_handler);
|
|
|
+ {
|
|
|
+ ImGuiSettingsHandler ini_handler;
|
|
|
+ ini_handler.TypeName = "Window";
|
|
|
+ ini_handler.TypeHash = ImHashStr("Window");
|
|
|
+ ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen;
|
|
|
+ ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine;
|
|
|
+ ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll;
|
|
|
+ g.SettingsHandlers.push_back(ini_handler);
|
|
|
+ }
|
|
|
|
|
|
g.Initialized = true;
|
|
|
}
|
|
@@ -9342,7 +9351,7 @@ const char* ImGui::SaveIniSettingsToMemory(size_t* out_size)
|
|
|
return g.SettingsIniData.c_str();
|
|
|
}
|
|
|
|
|
|
-static void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name)
|
|
|
+static void* WindowSettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name)
|
|
|
{
|
|
|
ImGuiWindowSettings* settings = ImGui::FindWindowSettings(ImHashStr(name));
|
|
|
if (!settings)
|
|
@@ -9350,7 +9359,7 @@ static void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*
|
|
|
return (void*)settings;
|
|
|
}
|
|
|
|
|
|
-static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line)
|
|
|
+static void WindowSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line)
|
|
|
{
|
|
|
ImGuiWindowSettings* settings = (ImGuiWindowSettings*)entry;
|
|
|
int x, y;
|
|
@@ -9360,7 +9369,7 @@ static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*,
|
|
|
else if (sscanf(line, "Collapsed=%d", &i) == 1) settings->Collapsed = (i != 0);
|
|
|
}
|
|
|
|
|
|
-static void SettingsHandlerWindow_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
|
|
|
+static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
|
|
|
{
|
|
|
// Gather data from windows that were active during this session
|
|
|
// (if a window wasn't opened in this session we preserve its settings)
|
|
@@ -9393,7 +9402,7 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl
|
|
|
buf->appendf("Pos=%d,%d\n", settings->Pos.x, settings->Pos.y);
|
|
|
buf->appendf("Size=%d,%d\n", settings->Size.x, settings->Size.y);
|
|
|
buf->appendf("Collapsed=%d\n", settings->Collapsed);
|
|
|
- buf->appendf("\n");
|
|
|
+ buf->append("\n");
|
|
|
}
|
|
|
}
|
|
|
|