mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-11-02 20:13:44 +08:00
cabana: flatten signal panel containers (#38904)
* cabana: flatten signal panel containers * cabana: keep messages and logs switch border
This commit is contained in:
@@ -281,7 +281,7 @@ void DetailWidget::drawTabWidget() {
|
||||
|
||||
void DetailWidget::draw() {
|
||||
tabbar_.draw();
|
||||
ImGui::BeginChild("message_content", ImVec2(0, 0), ImGuiChildFlags_Borders,
|
||||
ImGui::BeginChild("message_content", ImVec2(0, 0), ImGuiChildFlags_AlwaysUseWindowPadding,
|
||||
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);
|
||||
drawToolBar();
|
||||
|
||||
|
||||
@@ -682,12 +682,12 @@ float SignalView::toolBarRightWidth(const std::string &range_label) {
|
||||
}
|
||||
|
||||
// the width at which the tool bar stops squishing: the signal count and the filter box on the left, the
|
||||
// sparkline controls on the right, plus the borders and padding of the view's own child window
|
||||
// sparkline controls on the right. Padding is supplied by the message panel.
|
||||
float SignalView::minimumWidth() {
|
||||
const ImGuiStyle &style = ImGui::GetStyle();
|
||||
const float left_width = ImGui::CalcTextSize("Signals: 000").x + style.ItemSpacing.x + FILTER_WIDTH;
|
||||
// formatSeconds is mm:ss for every value the range slider allows
|
||||
return left_width + style.ItemSpacing.x + toolBarRightWidth("00:00") + (style.WindowPadding.x + style.ChildBorderSize) * 2;
|
||||
return left_width + style.ItemSpacing.x + toolBarRightWidth("00:00") + style.WindowPadding.x * 2;
|
||||
}
|
||||
|
||||
float SignalView::minimumHeight() {
|
||||
@@ -698,7 +698,7 @@ float SignalView::minimumHeight() {
|
||||
|
||||
void SignalView::draw() {
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, palette().surface);
|
||||
if (!ImGui::BeginChild("SignalView", ImVec2(0, 0), ImGuiChildFlags_Borders,
|
||||
if (!ImGui::BeginChild("SignalView", ImVec2(0, 0), ImGuiChildFlags_None,
|
||||
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleColor();
|
||||
@@ -885,6 +885,8 @@ void SignalView::drawIndexWidget(SignalModel::Item *item, const ImRect &rect) {
|
||||
const ImVec2 size = indexButtonsSize(iconButtonWidth());
|
||||
ImGui::SetCursorScreenPos(ImVec2(rect.Max.x - size.x, rect.Min.y + (rect.GetHeight() - size.y) * 0.5f));
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||
const auto sig = item->sig;
|
||||
const bool checked = item->chart_opened;
|
||||
if (checked) ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive));
|
||||
@@ -899,6 +901,8 @@ void SignalView::drawIndexWidget(SignalModel::Item *item, const ImRect &rect) {
|
||||
pending_action_ = [this, sig]() { UndoStack::instance()->push(new RemoveSigCommand(model_.msgId(), sig)); };
|
||||
}
|
||||
ImGui::SetItemTooltip("Remove signal");
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleVar();
|
||||
button_size_ = size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user