MCPcopy Create free account
hub / github.com/SatDump/SatDump / drawPanel

Method drawPanel

src-interface/viewer/viewer.cpp:216–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214 }
215
216 void ViewerApplication::drawPanel()
217 {
218 if (ImGui::BeginTabBar("Viewer Prob Tabbar", ImGuiTabBarFlags_None))
219 {
220 ImGui::SetNextItemWidth(ImGui::GetWindowWidth() / 2);
221 if (ImGui::BeginTabItem("Products###productsviewertab"))
222 {
223 if (current_selected_tab != 0)
224 current_selected_tab = 0;
225
226 if (ImGui::CollapsingHeader("General", ImGuiTreeNodeFlags_DefaultOpen))
227 {
228 for (std::string dataset_name : opened_datasets)
229 {
230 if (products_cnt_in_dataset(dataset_name))
231 {
232 ImGui::TreeNodeEx(dataset_name.c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen);
233 ImGui::TreePush(std::string("##HandlerTree" + dataset_name).c_str());
234
235 { // Closing button
236 ImGui::SameLine();
237 ImGui::Text(" ");
238 ImGui::SameLine();
239
240 ImGui::PushStyleColor(ImGuiCol_Text, style::theme.red.Value);
241 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4());
242 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0);
243 if (ImGui::SmallButton(std::string(u8"\uf00d##dataset" + dataset_name).c_str()))
244 {
245 logger->info("Closing datset " + dataset_name);
246 for (int i = 0; i < (int)products_and_handlers.size(); i++)
247 if (products_and_handlers[i]->dataset_name == dataset_name)
248 {
249 products_and_handlers[i]->marked_for_close = true;
250 }
251 }
252 ImGui::PopStyleVar();
253 ImGui::PopStyleColor(2);
254 }
255
256 const ImColor TreeLineColor = ImColor(128, 128, 128, 255); // ImGui::GetColorU32(ImGuiCol_Text);
257 const float SmallOffsetX = 11.0f; // for now, a hardcoded value; should take into account tree indent size
258 ImDrawList *drawList = ImGui::GetWindowDrawList();
259
260 ImVec2 verticalLineStart = ImGui::GetCursorScreenPos();
261 verticalLineStart.x += SmallOffsetX; // to nicely line up with the arrow symbol
262 ImVec2 verticalLineEnd = verticalLineStart;
263
264 for (int i = 0; i < (int)products_and_handlers.size(); i++)
265 {
266 if (products_and_handlers[i]->dataset_name == dataset_name)
267 {
268 const float HorizontalTreeLineSize = 8.0f * ui_scale; // chosen arbitrarily
269 const ImRect childRect = renderHandler(*products_and_handlers[i], i); // RenderTree(child);
270 const float midpoint = (childRect.Min.y + childRect.Max.y) / 2.0f;
271 drawList->AddLine(ImVec2(verticalLineStart.x, midpoint), ImVec2(verticalLineStart.x + HorizontalTreeLineSize, midpoint), TreeLineColor);
272 verticalLineEnd.y = midpoint;
273 }

Callers

nothing calls this directly

Calls 15

SetNextItemWidthFunction · 0.85
PushStyleColorFunction · 0.85
ImVec4Class · 0.85
PushStyleVarFunction · 0.85
PopStyleVarFunction · 0.85
PopStyleColorFunction · 0.85
ImColorClass · 0.85
ImVec2Function · 0.85
SeparatorFunction · 0.85
pathClass · 0.85
c_strMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected