2 #include <imgui_internal.h>
5 : _screenW(screenWidth),
6 _screenH(screenHeight),
7 _fontHeading(fontHeading),
29 float framePadding = 0.02f *
_screenH;
30 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(framePadding, framePadding));
31 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.f);
32 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(framePadding, framePadding));
33 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(framePadding, framePadding));
34 ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 2.f * framePadding +
_fontHeading->FontSize);
37 if (!ImGui::Begin(title, p_open))
40 ImGui::PopStyleVar(5);
49 if (ImGui::BeginPopup(
"Options"))
56 if (ImGui::Button(
"Options"))
57 ImGui::OpenPopup(
"Options");
59 bool clearIt = ImGui::Button(
"Clear");
61 bool copy = ImGui::Button(
"Copy");
63 _filter.Draw(
"Filter", -100.0f);
66 ImGui::BeginChild(
"scrolling", ImVec2(0, 0),
false, ImGuiWindowFlags_HorizontalScrollbar);
71 ImGui::LogToClipboard();
73 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
74 const char* buf =
_buf.begin();
75 const char* buf_end =
_buf.end();
82 for (
int line_no = 0; line_no <
_lineOffsets.Size; line_no++)
86 if (
_filter.PassFilter(line_start, line_end))
87 ImGui::TextUnformatted(line_start, line_end);
101 ImGuiListClipper clipper;
103 while (clipper.Step())
105 for (
int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++)
109 ImGui::TextUnformatted(line_start, line_end);
114 ImGui::PopStyleVar();
116 if (
_autoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
117 ImGui::SetScrollHereY(1.0f);
122 ImGui::PopStyleVar(5);
128 int old_size =
_buf.size();
131 _buf.appendfv(fmt, args);
133 for (
int new_size =
_buf.size(); old_size < new_size; old_size++)
134 if (
_buf[old_size] ==
'\n')
ImVector< int > _lineOffsets
void addLog(const char *fmt,...) IM_FMTARGS(2)
LogWindow(int screenWidth, int screenHeight, ImFont *fontHeading, ImFont *fontText)
void draw(const char *title, bool *p_open=NULL)
void post(const std::string &message) override