cabana: clean up UI wording and formatting (#38803)

This commit is contained in:
Trey Moen
2026-09-07 14:56:19 -07:00
committed by GitHub
parent 3e54af9db8
commit bb86bee688
11 changed files with 51 additions and 51 deletions
@@ -69,7 +69,7 @@ std::string ChartsWidget::whatsThis() const {
<b>Click</b>: Click to seek to a corresponding time.<br />
<b>Drag</b>: Zoom into the chart.<br />
<b>Shift + Drag</b>: Scrub through the chart to view values.<br />
<b>Right Mouse</b>: Open the context menu.<br />
<b>Right-click</b>: Open the context menu.<br />
)";
}
@@ -43,7 +43,7 @@ bool SignalSelector::draw() {
ImGui::BeginGroup();
ImGui::TextUnformatted("Available Signals");
// a combo popup with a filter box
const char *preview = msgs_combo_index_ >= 0 ? msgs_combo_[msgs_combo_index_].text.c_str() : "Select a msg...";
const char *preview = msgs_combo_index_ >= 0 ? msgs_combo_[msgs_combo_index_].text.c_str() : "Select a message...";
ImGui::SetNextItemWidth(column_w);
if (ImGui::BeginCombo("##msgs_combo", preview)) {
if (ImGui::IsWindowAppearing()) {
@@ -51,7 +51,7 @@ bool SignalSelector::draw() {
ImGui::SetKeyboardFocusHere();
}
ImGui::SetNextItemWidth(-FLT_MIN);
inputText("##msgs_filter", &msgs_combo_filter_, "Select a msg...");
inputText("##msgs_filter", &msgs_combo_filter_, "Select a message...");
for (int i = 0; i < (int)msgs_combo_.size(); ++i) {
if (!msgs_combo_filter_.empty() && !utils::containsCI(msgs_combo_[i].text, msgs_combo_filter_)) continue;
if (ImGui::Selectable(msgs_combo_[i].text.c_str(), i == msgs_combo_index_)) {
@@ -68,7 +68,7 @@ void draw() {
ImGui::Separator();
if (!box.detailed_text.empty()) {
// the details button sits at the left of the button box
if (ImGui::Button(g_show_details ? "Hide Details..." : "Show Details...")) g_show_details = !g_show_details;
if (ImGui::Button(g_show_details ? "Hide Details" : "Show Details")) g_show_details = !g_show_details;
ImGui::SameLine();
}
dialogButtons("OK", &result, &done, true, box.has_cancel ? "Cancel" : nullptr);
@@ -61,7 +61,7 @@ void RoutesDialog::setRouteList(const std::vector<routes::RouteInfo> &list, bool
if (success) {
for (const auto &route : list) {
const int mins = static_cast<int>((route.end_ms - route.start_ms) / 60000);
s_.routes.push_back({routes::formatUnixMs(route.start_ms) + " " + std::to_string(mins) + "min", route.name});
s_.routes.push_back({routes::formatUnixMs(route.start_ms) + " " + std::to_string(mins) + " min", route.name});
}
if (!s_.routes.empty()) s_.route_index = 0;
} else {
@@ -80,7 +80,7 @@ void RoutesDialog::finish(bool accepted) {
void RoutesDialog::draw() {
if (!open_) return;
if (!beginDialog("Remote routes", &popup_, ImVec2(480.0f, 420.0f))) return;
if (!beginDialog("Remote Routes", &popup_, ImVec2(480.0f, 420.0f))) return;
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Device");
@@ -19,15 +19,15 @@ void OpenReplayWidget::draw() {
ImGui::TextUnformatted("Route");
ImGui::SameLine();
ImGui::SetNextItemWidth(-250.0f);
inputText("##route", &route_, "Enter route name or browse for local/remote route");
inputText("##route", &route_, "Enter a route name or browse for a local or remote route");
ImGui::SameLine();
if (ImGui::Button("Remote route...")) {
if (ImGui::Button("Remote Route...")) {
routes_dialog_.open(utils::guarded(alive_, [this](bool accepted, const std::string &route) {
if (accepted) route_ = route;
}));
}
ImGui::SameLine();
if (ImGui::Button("Local route...")) {
if (ImGui::Button("Local Route...")) {
FileDialog::getExistingDirectory("Open Local Route", settings.last_route_dir, utils::guarded(alive_, [this](const std::string &dir) {
if (!dir.empty()) {
route_ = dir;
@@ -128,7 +128,7 @@ void OpenPandaWidget::buildConfigForm() {
void OpenPandaWidget::draw() {
if (already_connected_) {
ImGui::Text("Already connected to %s.", can->routeName().c_str());
ImGui::TextUnformatted("Close the current connection via [File menu -> Close Stream] before connecting to another Panda.");
ImGui::TextUnformatted("Select File > Close Stream before connecting to another panda.");
return;
}
ImGui::AlignTextToFramePadding();
@@ -193,7 +193,7 @@ void OpenDeviceWidget::draw() {
ImGui::SameLine(label_width);
ImGui::BeginDisabled(mode_ != 1);
ImGui::SetNextItemWidth(-1.0f);
validatedText("##ip", &ip_address_, validateIpAddress, "Enter device Ip Address", ipValidator);
validatedText("##ip", &ip_address_, validateIpAddress, "Enter device IP address", ipValidator);
ImGui::EndDisabled();
}
@@ -263,7 +263,7 @@ void StreamSelector::open(Callback on_done) {
void StreamSelector::draw() {
if (!open_) return;
if (!beginDialog("Open stream", &popup_, ImVec2(768.0f, 0.0f))) return;
if (!beginDialog("Open Stream", &popup_, ImVec2(768.0f, 0.0f))) return;
AbstractOpenStreamWidget *current = nullptr;
const ImVec4 pane = ImGui::GetStyleColorVec4(ImGuiCol_WindowBg);
@@ -287,10 +287,10 @@ void StreamSelector::draw() {
first_frame_ = false;
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("dbc File");
ImGui::TextUnformatted("DBC File");
ImGui::SameLine();
ImGui::SetNextItemWidth(-90.0f);
inputText("##dbc", &dbc_file_, "Choose a dbc file to open", ImGuiInputTextFlags_ReadOnly);
inputText("##dbc", &dbc_file_, "Choose a DBC file to open", ImGuiInputTextFlags_ReadOnly);
ImGui::SameLine();
if (ImGui::Button("Browse...")) {
FileDialog::getOpenFileName("Open File", settings.last_dir, ".dbc", [this](const std::string &fn) {
+18 -18
View File
@@ -92,7 +92,7 @@ void MainWindow::loadFingerprints() {
void MainWindow::drawFileMenu() {
const bool has_stream = hasStream();
if (ImGui::MenuItem("Open Stream...")) selectAndOpenStream();
if (ImGui::MenuItem("Close stream", nullptr, false, has_stream)) closeStream();
if (ImGui::MenuItem("Close Stream", nullptr, false, has_stream)) closeStream();
if (ImGui::MenuItem("Export to CSV...", nullptr, false, has_stream)) exportToCSV();
ImGui::Separator();
@@ -115,7 +115,7 @@ void MainWindow::drawFileMenu() {
}
ImGui::EndMenu();
}
if (ImGui::MenuItem("Load DBC From Clipboard")) loadFromClipboard();
if (ImGui::MenuItem("Load DBC from Clipboard")) loadFromClipboard();
ImGui::Separator();
const int cnt = dbc()->nonEmptyDBCCount();
@@ -123,7 +123,7 @@ void MainWindow::drawFileMenu() {
if (ImGui::MenuItem(save_text.c_str(), shortcut("S").c_str(), false, cnt > 0)) save();
if (ImGui::MenuItem("Save DBC As...", shortcut("Shift+S").c_str(), false, cnt == 1)) saveAs();
// TODO: Support clipboard for multiple files
if (ImGui::MenuItem("Copy DBC To Clipboard", nullptr, false, cnt == 1)) saveToClipboard();
if (ImGui::MenuItem("Copy DBC to Clipboard", nullptr, false, cnt == 1)) saveToClipboard();
ImGui::Separator();
if (ImGui::MenuItem("Settings...")) openSettings();
@@ -283,7 +283,7 @@ void MainWindow::closeStream() {
if (dbc()->nonEmptyDBCCount() > 0) {
dbc()->fileChanged();
}
showStatusMessage("stream closed");
showStatusMessage("Stream closed");
}
void MainWindow::exportToCSV() {
@@ -315,7 +315,7 @@ void MainWindow::loadFile(const std::string &fn, SourceSet s, std::function<void
std::string error;
if (dbc()->open(s, fn, &error)) {
updateRecentFiles(fn);
showStatusMessage("DBC File " + fn + " loaded", 2000);
showStatusMessage("DBC file " + fn + " loaded", 2000);
if (then) then();
} else {
MessageBox::warning("Failed to load DBC file", "Failed to parse DBC file " + fn, error, then);
@@ -333,11 +333,11 @@ void MainWindow::loadDBCFromOpendbc(const std::string &name) {
void MainWindow::loadFromClipboard(SourceSet s, bool close_all) {
std::string text;
if (!utils::getClipboardText(&text)) {
MessageBox::warning("Load From Clipboard", "No clipboard tool found. Install xclip (X11) or wl-clipboard (Wayland).");
MessageBox::warning("Load from Clipboard", "No clipboard tool found. Install xclip (X11) or wl-clipboard (Wayland).");
return;
}
if (text.empty()) {
MessageBox::warning("Load From Clipboard", "Clipboard is empty.");
MessageBox::warning("Load from Clipboard", "Clipboard is empty.");
return;
}
@@ -345,9 +345,9 @@ void MainWindow::loadFromClipboard(SourceSet s, bool close_all) {
std::string error;
bool ret = dbc()->open(s, std::string(""), text, &error);
if (ret && dbc()->nonEmptyDBCCount() > 0) {
MessageBox::information("Load From Clipboard", "DBC Successfully Loaded!");
MessageBox::information("Load from Clipboard", "DBC loaded successfully.");
} else {
MessageBox::warning("Failed to load DBC from clipboard", "Make sure that you paste the text with correct format.", error);
MessageBox::warning("Failed to load DBC from clipboard", "Make sure the clipboard contains correctly formatted DBC text.", error);
}
});
}
@@ -512,9 +512,9 @@ void MainWindow::saveFileToClipboard(DBCFile *dbc_file) {
void MainWindow::copyToClipboard(const std::string &text) {
if (utils::setClipboardText(text)) {
MessageBox::information("Copy To Clipboard", "DBC Successfully copied!");
MessageBox::information("Copy to Clipboard", "DBC copied successfully.");
} else {
MessageBox::warning("Copy To Clipboard", "Failed to copy DBC to clipboard. Install xclip (X11) or wl-clipboard (Wayland).");
MessageBox::warning("Copy to Clipboard", "Failed to copy DBC to clipboard. Install xclip (X11) or wl-clipboard (Wayland).");
}
}
@@ -528,9 +528,9 @@ void MainWindow::drawManageDBCsMenu() {
const std::string title = "Bus " + std::to_string(source) + " (" + (dbc_file ? dbc_file->name() : "No DBCs loaded") + ")";
ImGui::PushID(source);
if (ImGui::BeginMenu(title.c_str())) {
if (ImGui::MenuItem("New DBC File...")) newFile(ss);
if (ImGui::MenuItem("New DBC File")) newFile(ss);
if (ImGui::MenuItem("Open DBC File...")) openFile(ss);
if (ImGui::MenuItem("Load DBC From Clipboard...")) loadFromClipboard(ss, false);
if (ImGui::MenuItem("Load DBC from Clipboard")) loadFromClipboard(ss, false);
// Show sub-menu for each dbc for this source.
if (dbc_file) {
@@ -538,9 +538,9 @@ void MainWindow::drawManageDBCsMenu() {
ImGui::MenuItem((dbc_file->name() + " (" + toString(dbc()->sources(dbc_file)) + ")").c_str(), nullptr, false, false);
if (ImGui::MenuItem("Save...")) saveFile(dbc_file);
if (ImGui::MenuItem("Save As...")) saveFileAs(dbc_file);
if (ImGui::MenuItem("Copy to Clipboard...")) saveFileToClipboard(dbc_file);
if (ImGui::MenuItem("Remove from this bus...")) closeFile(ss, {});
if (ImGui::MenuItem("Remove from all buses...")) closeFile(dbc_file);
if (ImGui::MenuItem("Copy to Clipboard")) saveFileToClipboard(dbc_file);
if (ImGui::MenuItem("Remove from This Bus...")) closeFile(ss, {});
if (ImGui::MenuItem("Remove from All Buses...")) closeFile(dbc_file);
}
ImGui::EndMenu();
}
@@ -578,7 +578,7 @@ void MainWindow::remindSaveChanges(std::function<void()> then) {
if (then) then();
return;
}
std::string text = "You have unsaved changes. Press ok to save them, cancel to discard.";
std::string text = "You have unsaved changes. Select OK to save them or Cancel to discard them.";
MessageBox::question("Unsaved Changes", text, [this, then](bool ok) {
if (ok) {
save([this, then]() { remindSaveChanges(then); });
@@ -755,7 +755,7 @@ void MainWindow::drawStatusBar() {
ImGui::TextUnformatted(bar.message.c_str());
} else {
bar.message.clear();
ImGui::TextUnformatted("For Help, Press F1");
ImGui::TextUnformatted("For help, press F1");
}
if (bar.progress_visible) {
ImGui::SameLine(width - pad - 300.0f);
@@ -89,7 +89,7 @@ bool FindSignalDlg::draw() {
drawFindGroup();
ImGui::EndChild();
if (searched_) {
ImGui::Text("%zu matches. right click on an item to create signal. double click to open message",
ImGui::Text("%zu matches. Right-click an item to create a signal. Double-click to open the message.",
search_.filtered_signals.size());
}
}
@@ -103,12 +103,12 @@ void FindSignalDlg::drawMessageGroup() {
ImGui::TextUnformatted("Bus");
ImGui::SameLine(80);
ImGui::SetNextItemWidth(-1);
inputText("##bus", &bus_, "comma-separated values. Leave blank for all");
inputText("##bus", &bus_, "Comma-separated values. Leave blank for all.");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Address");
ImGui::SameLine(80);
ImGui::SetNextItemWidth(-1);
inputText("##address", &address_, "comma-separated hex values. Leave blank for all");
inputText("##address", &address_, "Comma-separated hex values. Leave blank for all.");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Time");
ImGui::SameLine(80);
@@ -138,7 +138,7 @@ void FindSignalDlg::drawPropertiesGroup() {
ImGui::SetNextItemWidth(70);
if (ImGui::InputInt("##max_size", &max_size_, 1, 10)) max_size_ = std::clamp(max_size_, 1, 64);
ImGui::SameLine();
checkBox("Little endian", &little_endian_);
checkBox("Little Endian", &little_endian_);
ImGui::SameLine();
checkBox("Signed", &is_signed_);
ImGui::AlignTextToFramePadding();
@@ -157,7 +157,7 @@ void FindSignalDlg::drawPropertiesGroup() {
void FindSignalDlg::drawFindGroup() {
static const char *compare_items[] = {"=", ">", ">=", "!=", "<", "<=", "between"};
const int compare_count = IM_ARRAYSIZE(compare_items);
ImGui::TextUnformatted("Find signal");
ImGui::TextUnformatted("Find Signal");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Value");
ImGui::SameLine();
@@ -177,14 +177,14 @@ void FindSignalDlg::drawFindGroup() {
ImGui::SameLine();
const bool first = !searching_ && search_.histories.empty();
ImGui::BeginDisabled(searching_ || search_.histories.size() <= 1);
if (ImGui::Button("Undo prev find")) {
if (ImGui::Button("Undo Previous Find")) {
search_.undo();
searched_ = true;
}
ImGui::EndDisabled();
ImGui::SameLine();
ImGui::BeginDisabled(searching_ || (search_.filtered_signals.empty() && !first));
if (ImGui::Button(searching_ ? "Finding ...." : (first ? "Find" : "Find Next"))) search();
if (ImGui::Button(searching_ ? "Finding..." : (first ? "Find" : "Find Next"))) search();
ImGui::EndDisabled();
ImGui::SameLine();
ImGui::BeginDisabled(searching_ || first);
@@ -203,7 +203,7 @@ void FindSignalDlg::drawFindGroup() {
}
void FindSignalDlg::drawTable() {
static const char *titles[] = {"Id", "Start Bit, size", "(time, value)"};
static const char *titles[] = {"ID", "Start Bit, Size", "(Time, Value)"};
const int columns = IM_ARRAYSIZE(titles);
const ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings;
if (!ImGui::BeginTable("view", columns + 1, flags, ImVec2(0, 0))) return;
@@ -9,7 +9,7 @@
#include "tools/cabana/ui/util.h"
FindSimilarBitsDlg::FindSimilarBitsDlg() {
setTitle("Find similar bits");
setTitle("Find Similar Bits");
for (int bus : can->sources) {
bus_items_.push_back(bus);
@@ -64,7 +64,7 @@ bool FindSimilarBitsDlg::draw() {
ImGui::SetNextItemWidth(60);
ImGui::Combo("##equal", &equal_, "Yes\0No\0");
ImGui::SameLine();
ImGui::TextUnformatted("Min msg count");
ImGui::TextUnformatted("Minimum Message Count");
ImGui::SameLine();
ImGui::SetNextItemWidth(80);
if (ImGui::InputInt("##min_msgs", &min_msgs_, 1, 10)) min_msgs_ = std::max(min_msgs_, 0);
@@ -86,7 +86,7 @@ void FindSimilarBitsDlg::drawTable() {
const ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings;
if (!ImGui::BeginTable("table", 7, flags, ImVec2(0, 0))) return;
ImGui::TableSetupScrollFreeze(0, 1);
static const char *headers[] = {"address", "byte idx", "bit idx", "mismatches", "total msgs", "% mismatched"};
static const char *headers[] = {"Address", "Byte Index", "Bit Index", "Mismatches", "Messages", "Mismatched (%)"};
// the fixed widths are section sizes: imgui adds the cell padding on top of the column width
const float padding = ImGui::GetStyle().CellPadding.x * 2;
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 40.0f - padding); // vertical header: row number
@@ -310,7 +310,7 @@ std::vector<std::pair<std::string, ImRect>> DetailWidget::helpRects() const {
EditMessageDialog::EditMessageDialog(const MessageId &msg_id, const std::string &title, int size, float parent_width)
: msg_id_(msg_id), original_name_(title), name_edit_(title), size_spin_(size), width_(parent_width * 0.9f) {
window_title_ = "Edit message: " + msg_id.toString();
window_title_ = "Edit Message: " + msg_id.toString();
if (auto msg = dbc()->msg(msg_id)) {
node_ = msg->transmitter;
@@ -438,10 +438,10 @@ void CenterWidget::drawWelcomeWidget() {
y += ImGui::GetFrameHeightWithSpacing();
};
centered("<-Select a message to view details", y);
centered("<- Select a message to view details", y);
y += ImGui::GetTextLineHeightWithSpacing();
newShortcutRow("Pause", "Space");
newShortcutRow("Help", "F1");
newShortcutRow("WhatsThis", "Shift+F1");
newShortcutRow("What's This?", "Shift+F1");
ImGui::PopStyleColor();
}
@@ -231,11 +231,11 @@ std::string MessagesWidget::whatsThis() const {
return R"(
<b>Message View</b><br/>
<span style="color:gray">Byte color</span><br />
<span style="color:gray;">&#9632; </span> constant changing<br />
<span style="color:gray;">&#9632; </span> constantly changing<br />
<span style="color:blue;">&#9632; </span> increasing<br />
<span style="color:red;">&#9632; </span> decreasing<br />
<span style="color:gray">Shortcuts</span><br />
Horizontal Scrolling: <span style="background-color:lightGray;color:gray">&nbsp;shift+wheel&nbsp;</span>
Horizontal Scrolling: <span style="background-color:lightGray;color:gray">&nbsp;Shift+Wheel&nbsp;</span>
)";
}
@@ -310,10 +310,10 @@ void MessagesWidget::drawContextMenu() {
}
}
ImGui::Separator();
if (ImGui::MenuItem("Multi-Line bytes", nullptr, settings.multiple_lines_hex)) {
if (ImGui::MenuItem("Multiline Bytes", nullptr, settings.multiple_lines_hex)) {
setMultiLineBytes(!settings.multiple_lines_hex);
}
if (ImGui::MenuItem("Show inactive messages", nullptr, list_.show_inactive_messages)) {
if (ImGui::MenuItem("Show Inactive Messages", nullptr, list_.show_inactive_messages)) {
list_.showInactiveMessages(!list_.show_inactive_messages);
}
ImGui::EndPopup();
@@ -883,7 +883,7 @@ void SignalView::drawIndexWidget(SignalModel::Item *item, const ImRect &rect) {
showChart(model_.msgId(), sig, item->chart_opened, ImGui::GetIO().KeyShift);
}
if (checked) ImGui::PopStyleColor();
ImGui::SetItemTooltip("%s", checked ? "Close Plot" : "Show Plot\nSHIFT click to add to previous opened plot");
ImGui::SetItemTooltip("%s", checked ? "Close Plot" : "Show Plot\nShift-click to add to the previously opened plot");
ImGui::SameLine(0.0f, spacing);
if (iconButton("remove", icon::X_LG) && !editor_open_on_press_) {
pending_action_ = [this, sig]() { UndoStack::instance()->push(new RemoveSigCommand(model_.msgId(), sig)); };