Skip to content

Commit

Permalink
fix: do not allow bar and XY plot in recorder
Browse files Browse the repository at this point in the history
  • Loading branch information
klonyyy committed Feb 5, 2025
1 parent 4b0941d commit 58646e4
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/Gui/GuiPlotEdit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,32 @@ class PlotEditWindow
popup.show("Error!", "Plot already exists!", 1.5f);
}

const char* plotTypes[] = {"curve", "bar", "table", "XY"};
int32_t typeCombo = (int32_t)editedPlot->getType();
const std::array<std::string, 4> plotTypes = {"curve", "bar", "table", "XY"};
bool isRecorder = plotGroupHandler->getActiveGroup()->getAcquisitionType() == PlotGroup::AcquisitionType::RECORDER;
const std::array<bool, plotTypes.size()> disabledOptions = {false, isRecorder, false, isRecorder};

size_t typeCombo = (int32_t)editedPlot->getType();
GuiHelper::drawTextAlignedToSize("type:", alignment);
ImGui::SameLine();
if (ImGui::Combo("##combo", &typeCombo, plotTypes, IM_ARRAYSIZE(plotTypes)))
editedPlot->setType((Plot::Type)typeCombo);
if (ImGui::BeginCombo("##combo", plotTypes[typeCombo].c_str()))
{
for (size_t i = 0; i < plotTypes.size(); i++)
{
if (disabledOptions[i])
ImGui::BeginDisabled(true);

if (ImGui::Selectable(plotTypes[i].c_str(), typeCombo == i))
{
typeCombo = i;
editedPlot->setType((Plot::Type)typeCombo);
break;
}

if (disabledOptions[i])
ImGui::EndDisabled();
}
ImGui::EndCombo();
}

/* XY plot settings section*/

Expand Down

0 comments on commit 58646e4

Please sign in to comment.