mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
ImGuiTextBuffer: Renamed append() helper to appendf(), appendv() to appendfv(). Added reserve().
This commit is contained in:
parent
0f955b818d
commit
532f564fd3
@ -213,6 +213,7 @@
|
|||||||
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
||||||
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||||
|
|
||||||
|
- 2017/11/27 (1.53) - renamed ImGuiTextBuffer::append() helper to appendf(), appendv() to appendfv(). If you copied the 'Log' demo in your code, it uses appendv() so that needs to be renamed.
|
||||||
- 2017/11/18 (1.53) - Style, Begin: removed ImGuiWindowFlags_ShowBorders window flag. Borders are now fully set up in the ImGuiStyle structure (see e.g. style.FrameBorderSize, style.WindowBorderSize). Use ImGui::ShowStyleEditor() to look them up.
|
- 2017/11/18 (1.53) - Style, Begin: removed ImGuiWindowFlags_ShowBorders window flag. Borders are now fully set up in the ImGuiStyle structure (see e.g. style.FrameBorderSize, style.WindowBorderSize). Use ImGui::ShowStyleEditor() to look them up.
|
||||||
Please note that the style system will keep evolving (hopefully stabilizing in Q1 2018), and so custom styles will probably subtly break over time. It is recommended you use the StyleColorsClassic(), StyleColorsDark(), StyleColorsLight() functions.
|
Please note that the style system will keep evolving (hopefully stabilizing in Q1 2018), and so custom styles will probably subtly break over time. It is recommended you use the StyleColorsClassic(), StyleColorsDark(), StyleColorsLight() functions.
|
||||||
- 2017/11/18 (1.53) - Style: removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency.
|
- 2017/11/18 (1.53) - Style: removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency.
|
||||||
@ -1643,7 +1644,7 @@ bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helper: Text buffer for logging/accumulating text
|
// Helper: Text buffer for logging/accumulating text
|
||||||
void ImGuiTextBuffer::appendv(const char* fmt, va_list args)
|
void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
|
||||||
{
|
{
|
||||||
va_list args_copy;
|
va_list args_copy;
|
||||||
va_copy(args_copy, args);
|
va_copy(args_copy, args);
|
||||||
@ -1664,11 +1665,11 @@ void ImGuiTextBuffer::appendv(const char* fmt, va_list args)
|
|||||||
ImFormatStringV(&Buf[write_off - 1], len + 1, fmt, args_copy);
|
ImFormatStringV(&Buf[write_off - 1], len + 1, fmt, args_copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiTextBuffer::append(const char* fmt, ...)
|
void ImGuiTextBuffer::appendf(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
appendv(fmt, args);
|
appendfv(fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2947,7 +2948,7 @@ void ImGui::LogText(const char* fmt, ...)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g.LogClipboard->appendv(fmt, args);
|
g.LogClipboard->appendfv(fmt, args);
|
||||||
}
|
}
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
5
imgui.h
5
imgui.h
@ -1048,9 +1048,10 @@ struct ImGuiTextBuffer
|
|||||||
int size() const { return Buf.Size - 1; }
|
int size() const { return Buf.Size - 1; }
|
||||||
bool empty() { return Buf.Size <= 1; }
|
bool empty() { return Buf.Size <= 1; }
|
||||||
void clear() { Buf.clear(); Buf.push_back(0); }
|
void clear() { Buf.clear(); Buf.push_back(0); }
|
||||||
|
void reserve(int capacity) { Buf.reserve(capacity); }
|
||||||
const char* c_str() const { return Buf.Data; }
|
const char* c_str() const { return Buf.Data; }
|
||||||
IMGUI_API void append(const char* fmt, ...) IM_FMTARGS(2);
|
IMGUI_API void appendf(const char* fmt, ...) IM_FMTARGS(2);
|
||||||
IMGUI_API void appendv(const char* fmt, va_list args) IM_FMTLIST(2);
|
IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper: Simple Key->value storage
|
// Helper: Simple Key->value storage
|
||||||
|
@ -2707,7 +2707,7 @@ struct ExampleAppLog
|
|||||||
int old_size = Buf.size();
|
int old_size = Buf.size();
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
Buf.appendv(fmt, args);
|
Buf.appendfv(fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
for (int new_size = Buf.size(); old_size < new_size; old_size++)
|
for (int new_size = Buf.size(); old_size < new_size; old_size++)
|
||||||
if (Buf[old_size] == '\n')
|
if (Buf[old_size] == '\n')
|
||||||
@ -2911,7 +2911,7 @@ static void ShowExampleAppLongText(bool* p_open)
|
|||||||
if (ImGui::Button("Add 1000 lines"))
|
if (ImGui::Button("Add 1000 lines"))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 1000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
log.append("%i The quick brown fox jumps over the lazy dog\n", lines+i);
|
log.appendf("%i The quick brown fox jumps over the lazy dog\n", lines+i);
|
||||||
lines += 1000;
|
lines += 1000;
|
||||||
}
|
}
|
||||||
ImGui::BeginChild("Log");
|
ImGui::BeginChild("Log");
|
||||||
|
Loading…
Reference in New Issue
Block a user