|
@@ -276,9 +276,9 @@ void ImGui::TextV(const char* fmt, va_list args)
|
|
|
return;
|
|
|
|
|
|
// FIXME-OPT: Handle the %s shortcut?
|
|
|
- ImGuiContext& g = *GImGui;
|
|
|
- const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
|
|
|
- TextEx(g.TempBuffer, text_end, ImGuiTextFlags_NoWidthForLargeClippedText);
|
|
|
+ const char* text, *text_end;
|
|
|
+ ImFormatStringToTempBufferV(&text, &text_end, fmt, args);
|
|
|
+ TextEx(text, text_end, ImGuiTextFlags_NoWidthForLargeClippedText);
|
|
|
}
|
|
|
|
|
|
void ImGui::TextColored(const ImVec4& col, const char* fmt, ...)
|
|
@@ -359,8 +359,8 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
|
|
|
const ImGuiStyle& style = g.Style;
|
|
|
const float w = CalcItemWidth();
|
|
|
|
|
|
- const char* value_text_begin = &g.TempBuffer[0];
|
|
|
- const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
|
|
|
+ const char* value_text_begin, *value_text_end;
|
|
|
+ ImFormatStringToTempBufferV(&value_text_begin, &value_text_end, fmt, args);
|
|
|
const ImVec2 value_size = CalcTextSize(value_text_begin, value_text_end, false);
|
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
|
|
@@ -395,8 +395,8 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
const ImGuiStyle& style = g.Style;
|
|
|
|
|
|
- const char* text_begin = g.TempBuffer;
|
|
|
- const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
|
|
|
+ const char* text_begin, *text_end;
|
|
|
+ ImFormatStringToTempBufferV(&text_begin, &text_end, fmt, args);
|
|
|
const ImVec2 label_size = CalcTextSize(text_begin, text_end, false);
|
|
|
const ImVec2 total_size = ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x * 2) : 0.0f), label_size.y); // Empty text doesn't add padding
|
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
@@ -1910,9 +1910,9 @@ static const char* PatchFormatStringFloatToInt(const char* fmt)
|
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
|
if (fmt_start == fmt && fmt_end[0] == 0)
|
|
|
return "%d";
|
|
|
- ImGuiContext& g = *GImGui;
|
|
|
- ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%.*s%%d%s", (int)(fmt_start - fmt), fmt, fmt_end); // Honor leading and trailing decorations, but lose alignment/precision.
|
|
|
- return g.TempBuffer;
|
|
|
+ const char* tmp_format;
|
|
|
+ ImFormatStringToTempBuffer(&tmp_format, NULL, "%.*s%%d%s", (int)(fmt_start - fmt), fmt, fmt_end); // Honor leading and trailing decorations, but lose alignment/precision.
|
|
|
+ return tmp_format;
|
|
|
#else
|
|
|
IM_ASSERT(0 && "DragInt(): Invalid format string!"); // Old versions used a default parameter of "%.0f", please replace with e.g. "%d"
|
|
|
#endif
|
|
@@ -5835,9 +5835,9 @@ bool ImGui::TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char
|
|
|
if (window->SkipItems)
|
|
|
return false;
|
|
|
|
|
|
- ImGuiContext& g = *GImGui;
|
|
|
- const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
|
|
|
- return TreeNodeBehavior(window->GetID(str_id), flags, g.TempBuffer, label_end);
|
|
|
+ const char* label, *label_end;
|
|
|
+ ImFormatStringToTempBufferV(&label, &label_end, fmt, args);
|
|
|
+ return TreeNodeBehavior(window->GetID(str_id), flags, label, label_end);
|
|
|
}
|
|
|
|
|
|
bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args)
|
|
@@ -5846,9 +5846,9 @@ bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char
|
|
|
if (window->SkipItems)
|
|
|
return false;
|
|
|
|
|
|
- ImGuiContext& g = *GImGui;
|
|
|
- const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
|
|
|
- return TreeNodeBehavior(window->GetID(ptr_id), flags, g.TempBuffer, label_end);
|
|
|
+ const char* label, *label_end;
|
|
|
+ ImFormatStringToTempBufferV(&label, &label_end, fmt, args);
|
|
|
+ return TreeNodeBehavior(window->GetID(ptr_id), flags, label, label_end);
|
|
|
}
|
|
|
|
|
|
bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags)
|