MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / Draw

Method Draw

samples/luxcoreui/logwindow.cpp:45–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void LogWindow::Draw() {
46 if (!opened)
47 return;
48
49 ImGui::SetNextWindowSize(ImVec2(512.f, 200.f), ImGuiSetCond_Appearing);
50
51 if (ImGui::Begin(windowTitle.c_str(), &opened)) {
52 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4.f);
53
54 if (ImGui::Button("Clear"))
55 Clear();
56 ImGui::SameLine();
57
58 const bool copy = ImGui::Button("Copy");
59 ImGui::SameLine();
60
61 filter.Draw("Filter", -100.0f);
62 ImGui::Separator();
63 ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
64 if (copy)
65 ImGui::LogToClipboard();
66
67 if (filter.IsActive()) {
68 const char *bufferBegin = buffer.begin();
69 const char *line = bufferBegin;
70 for (int lineNumber = 0; line != NULL; lineNumber++) {
71 const char *line_end = (lineNumber < lineOffsets.Size) ? bufferBegin + lineOffsets[lineNumber] : NULL;
72
73 if (filter.PassFilter(line, line_end))
74 ImGui::TextUnformatted(line, line_end);
75 line = line_end && line_end[1] ? line_end + 1 : NULL;
76 }
77 } else
78 ImGui::TextUnformatted(buffer.begin());
79
80 if (scrollToBottom)
81 ImGui::SetScrollHere(1.0f);
82 scrollToBottom = false;
83
84 ImGui::EndChild();
85 ImGui::PopStyleVar();
86 }
87 ImGui::End();
88}

Callers 1

RunAppMethod · 0.45

Calls 5

ImVec2Class · 0.85
c_strMethod · 0.80
IsActiveMethod · 0.80
PassFilterMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected