| 22438 | } |
| 22439 | |
| 22440 | void ImGui::DebugLogV(const char* fmt, va_list args) |
| 22441 | { |
| 22442 | ImGuiContext& g = *GImGui; |
| 22443 | const int old_size = g.DebugLogBuf.size(); |
| 22444 | if (g.ContextName[0] != 0) |
| 22445 | g.DebugLogBuf.appendf("[%s] [%05d] ", g.ContextName, g.FrameCount); |
| 22446 | else |
| 22447 | g.DebugLogBuf.appendf("[%05d] ", g.FrameCount); |
| 22448 | g.DebugLogBuf.appendfv(fmt, args); |
| 22449 | g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size()); |
| 22450 | if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY) |
| 22451 | IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size); |
| 22452 | #ifdef IMGUI_ENABLE_TEST_ENGINE |
| 22453 | // IMGUI_TEST_ENGINE_LOG() adds a trailing \n automatically |
| 22454 | const int new_size = g.DebugLogBuf.size(); |
| 22455 | const bool trailing_carriage_return = (g.DebugLogBuf[new_size - 1] == '\n'); |
| 22456 | if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTestEngine) |
| 22457 | IMGUI_TEST_ENGINE_LOG("%.*s", new_size - old_size - (trailing_carriage_return ? 1 : 0), g.DebugLogBuf.begin() + old_size); |
| 22458 | #endif |
| 22459 | } |
| 22460 | |
| 22461 | // FIXME-LAYOUT: To be done automatically via layout mode once we rework ItemSize/ItemAdd into ItemLayout. |
| 22462 | static void SameLineOrWrap(const ImVec2& size) |