Skip to content

Commit

Permalink
feature: moved recorder mode to the plot tree settings
Browse files Browse the repository at this point in the history
  • Loading branch information
klonyyy committed Feb 5, 2025
1 parent 58646e4 commit 8d9c157
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/Gui/GuiPlotsTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ void PlotsTree::draw()
plot->statisticsSeries = 0;
}

if (plotGroupHandler->getGroup(selectedGroup)->getAcquisitionType() == PlotGroup::AcquisitionType::RECORDER)
drawRecorderRunMode();

/* Staticstics */
ImGui::BeginDisabled(plot->getType() != Plot::Type::CURVE);
bool mx0 = plot->markerX0.getState();
Expand Down Expand Up @@ -406,3 +409,43 @@ void PlotsTree::drawMenuPlotPopup(const std::string& name, std::function<void()>
}
ImGui::PopID();
}

void PlotsTree::drawRecorderRunMode()
{
auto activePlotGroup = plotGroupHandler->getActiveGroup();

auto setSettingsAndRestart = [&](PlotGroup::RecorderSettings& settings)
{
activePlotGroup->setRecorderSettings(settings);
viewerDataHandler->setState(ViewerDataHandler::State::STOP);
viewerDataHandler->getState();
plotGroupHandler->eraseAllPlotsData();
viewerDataHandler->setState(ViewerDataHandler::State::RUN);
viewerDataHandler->getState();
};

if (activePlotGroup->getAcquisitionType() == PlotGroup::AcquisitionType::RECORDER)
{
auto settings = activePlotGroup->getRecorderSettings();

if (ImGui::RadioButton("run ", settings.mode == PlotGroup::RecorderMode::RUN))
{
settings.mode = PlotGroup::RecorderMode::RUN;
setSettingsAndRestart(settings);
}

ImGui::SameLine();
if (ImGui::RadioButton("normal ", settings.mode == PlotGroup::RecorderMode::NORMAL))
{
settings.mode = PlotGroup::RecorderMode::NORMAL;
setSettingsAndRestart(settings);
}

ImGui::SameLine();
if (ImGui::RadioButton("single ", settings.mode == PlotGroup::RecorderMode::SINGLE))
{
settings.mode = PlotGroup::RecorderMode::SINGLE;
setSettingsAndRestart(settings);
}
}
}
1 change: 1 addition & 0 deletions src/Gui/GuiPlotsTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class PlotsTree
void drawMenuGroupPopup(const std::string& name, std::function<void()> onNewSamplingGroup, std::function<void()> onNewRecorderGroup, std::function<void()> onNewPlot, std::function<void(const std::string&)> onDelete, std::function<void(const std::string&)> onProperties);
void drawMenuNewGroupPopup(const std::string& name, std::function<void()> onNewSamplingGroup, std::function<void()> onNewRecorderGroup);
void drawMenuPlotPopup(const std::string& name, std::function<void()> onNewPlot, std::function<void(const std::string&)> onDelete, std::function<void(const std::string&)> onProperties);
void drawRecorderRunMode();

private:
ViewerDataHandler* viewerDataHandler;
Expand Down

0 comments on commit 8d9c157

Please sign in to comment.