diff --git a/simulation/halsim_gui/src/main/native/cpp/SimDeviceGui.cpp b/simulation/halsim_gui/src/main/native/cpp/SimDeviceGui.cpp index 95a92f1e0f..4a4de4bb23 100644 --- a/simulation/halsim_gui/src/main/native/cpp/SimDeviceGui.cpp +++ b/simulation/halsim_gui/src/main/native/cpp/SimDeviceGui.cpp @@ -61,6 +61,7 @@ class SimDevicesModel : public glass::Model { } // namespace static SimDevicesModel* gSimDevicesModel; +static bool gSimDevicesShowPrefix = false; void SimDevicesModel::Update() { HALSIM_EnumerateSimDevices( @@ -136,10 +137,14 @@ static void DisplaySimValue(const char* name, void* data, static void DisplaySimDevice(const char* name, void* data, HAL_SimDeviceHandle handle) { - // only show "Foo" portion of "Accel:Foo" - auto [type, id] = wpi::StringRef{name}.split(':'); - if (id.empty()) { - id = type; + wpi::StringRef id{name}; + if (!gSimDevicesShowPrefix) { + // only show "Foo" portion of "Accel:Foo" + wpi::StringRef type; + std::tie(type, id) = id.split(':'); + if (id.empty()) { + id = type; + } } if (glass::BeginDevice(id.data())) { HALSIM_EnumerateSimValues(handle, data, DisplaySimValue); @@ -154,8 +159,14 @@ void SimDeviceGui::Initialize() { [](glass::Window* win, glass::Model* model) { win->SetDefaultPos(1025, 20); win->SetDefaultSize(250, 695); - return glass::MakeFunctionView( - [=] { static_cast(model)->Display(); }); + win->DisableRenamePopup(); + return glass::MakeFunctionView([=] { + if (ImGui::BeginPopupContextItem()) { + ImGui::Checkbox("Show prefix", &gSimDevicesShowPrefix); + ImGui::EndPopup(); + } + static_cast(model)->Display(); + }); }); HALSimGui::halProvider.ShowDefault("Other Devices");