diff --git a/openpilot/tools/cabana/ui/inistate.cc b/openpilot/tools/cabana/ui/inistate.cc index 4dffec494f..258344126a 100644 --- a/openpilot/tools/cabana/ui/inistate.cc +++ b/openpilot/tools/cabana/ui/inistate.cc @@ -107,6 +107,15 @@ std::string migrateQtState() { return std::string(buf.c_str()); } +void migrateDockLayout() { + // Show dock tabs hidden by older layouts. + if (const auto *center = ImGui::FindWindowSettingsByID(ImHashStr("###CenterWidget"))) { + if (auto *node = ImGui::DockBuilderGetNode(center->DockId)) { + node->LocalFlags &= ~ImGuiDockNodeFlags_NoTabBar; + } + } +} + } // namespace void addSettingsHandler() { @@ -123,6 +132,8 @@ void load() { if (settings.ui_state.empty()) settings.ui_state = migrateQtState(); if (!settings.ui_state.empty()) ImGui::LoadIniSettingsFromMemory(settings.ui_state.data(), settings.ui_state.size()); + + migrateDockLayout(); } void applyWindowGeometry(GLFWwindow *window) { diff --git a/openpilot/tools/cabana/ui/mainwin.cc b/openpilot/tools/cabana/ui/mainwin.cc index e7c971b6a8..924c37c0b5 100644 --- a/openpilot/tools/cabana/ui/mainwin.cc +++ b/openpilot/tools/cabana/ui/mainwin.cc @@ -31,7 +31,7 @@ namespace { // dock window ids (the visible titles change, the part after ### is the identity) constexpr const char *VIDEO_PANEL = "###VideoPanel"; -constexpr const char *CENTER_PANEL = "###CenterWidget"; +constexpr const char *CENTER_PANEL = "Signals###CenterWidget"; constexpr const char *CHARTS_WINDOW = "Charts###ChartsWindow"; } // namespace @@ -777,8 +777,6 @@ void MainWindow::drawDockspace() { // the status bar sits below the dockspace: reserve its height plus the item spacing between the two, // otherwise the host window is a few pixels taller than the viewport and scrolls const float status_height = full_screen_ ? 0.0f : ImGui::GetFrameHeight() + ImGui::GetStyle().ItemSpacing.y; - const float top_gap = full_screen_ ? 0.0f : ImGui::GetStyle().ItemSpacing.y; - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + top_gap); const ImVec2 dock_size(ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y - status_height); const ImGuiID dock_id = ImGui::GetID("cabana_dockspace"); if (reset_layout_ || ImGui::DockBuilderGetNode(dock_id) == nullptr || @@ -796,7 +794,6 @@ void MainWindow::drawDockspace() { ImGui::DockBuilderDockWindow(MESSAGES_PANEL_ID, left); ImGui::DockBuilderDockWindow(VIDEO_PANEL, right); ImGui::DockBuilderDockWindow(CENTER_PANEL, center); - ImGui::DockBuilderGetNode(center)->LocalFlags |= ImGuiDockNodeFlags_NoTabBar; ImGui::DockBuilderFinish(dock_id); reset_layout_ = false; } @@ -879,13 +876,12 @@ void MainWindow::draw() { drawDockspace(); // the central widget has no scrollbars of its own (the views inside scroll) + setNextPanelClass(); if (beginPanel(CENTER_PANEL, nullptr, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) { - ImGui::BeginChild("center", ImVec2(0, 0), ImGuiChildFlags_Borders, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); center_widget_.draw(); if (auto *detail = center_widget_.getDetailWidget(); detail && help_overlay_.visible()) { for (const auto &[text, rect] : detail->helpRects()) help_overlay_.add(text, rect); } - ImGui::EndChild(); } ImGui::End(); // Submit the same dock windows while loading, so ImGui doesn't collapse their diff --git a/openpilot/tools/cabana/ui/widgets/detailwidget.cc b/openpilot/tools/cabana/ui/widgets/detailwidget.cc index 944662b7a1..988cf4b3cb 100644 --- a/openpilot/tools/cabana/ui/widgets/detailwidget.cc +++ b/openpilot/tools/cabana/ui/widgets/detailwidget.cc @@ -280,6 +280,8 @@ void DetailWidget::drawTabWidget() { void DetailWidget::draw() { tabbar_.draw(); + ImGui::BeginChild("message_content", ImVec2(0, 0), ImGuiChildFlags_Borders, + ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); drawToolBar(); if (warning_widget_visible_) { @@ -289,6 +291,7 @@ void DetailWidget::draw() { } drawTabWidget(); + ImGui::EndChild(); if (edit_dlg_ && !edit_dlg_->draw()) { if (edit_dlg_->accepted()) {