60 static ImVec4
const col_from { 1.0f, 0.8f, 0.6f, 1.0f };
61 static ImVec4
const col_to { 0.6f, 0.6f, 0.4f, 1.0f };
62 static ImVec4
const col_to_ok { 0.2f, 1.0f, 0.2f, 1.0f };
63 static ImVec4
const col_to_dbg { 0.2f, 0.2f, 1.0f, 1.0f };
64 static ImVec4
const col_to_inf { 0.4f, 0.7f, 0.4f, 1.0f };
65 static ImVec4
const col_to_err { 1.0f, 0.4f, 0.4f, 1.0f };
66 static ImVec4
const col_to_ftl { 1.0f, 0.0f, 0.0f, 1.0f };
68 ImGui::Text(
"Legend: "); ImGui::SameLine();
69 ImGui::TextColored(col_from,
"From Serial Device; "); ImGui::SameLine();
70 ImGui::TextColored(col_to,
"To Serial Device, with accents for "); ImGui::SameLine();
71 ImGui::TextColored(col_to_ok,
"OK, "); ImGui::SameLine();
72 ImGui::TextColored(col_to_dbg,
"DBG, "); ImGui::SameLine();
73 ImGui::TextColored(col_to_inf,
"INF, "); ImGui::SameLine();
74 ImGui::TextColored(col_to_err,
"ERR, "); ImGui::SameLine();
75 ImGui::TextColored(col_to_ftl,
"FTL");
78 ImGui::BeginChild(
"ScrollingRegion", ImVec2(0, 0),
false, ImGuiWindowFlags_HorizontalScrollbar);
81 if (ImGui::BeginPopupContextWindow())
83 if (ImGui::Selectable(
"Clear")) clear();
88 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1));
91 std::lock_guard<std::mutex> _(itsDataMtx);
92 for (
auto const & p : itsData)
95 auto const & s = p.second;
103 if (s ==
"OK") color = col_to_ok;
110 ImGui::PushStyleColor(ImGuiCol_Text, color);
111 ImGui::TextUnformatted(s.c_str());
112 ImGui::PopStyleColor();
115 static bool autoScroll =
true;
116 static bool scrollToBottom =
true;
118 if (scrollToBottom || (autoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())) ImGui::SetScrollHereY(1.0f);
119 scrollToBottom =
false;
121 ImGui::PopStyleVar();