Clean up stray check boxes before new event detection run

parent 91d733e0
......@@ -3336,6 +3336,13 @@ void wxStfDoc::SetIsIntegrated(std::size_t nchannel, std::size_t nsection, bool
}
void wxStfDoc::ClearEvents(std::size_t nchannel, std::size_t nsection) {
wxStfView* pView=(wxStfView*)GetFirstView();
if (pView!=NULL) {
wxStfGraph* pGraph = pView->GetGraph();
if (pGraph != NULL) {
pGraph->ClearEvents();
}
}
try {
sec_attr.at(nchannel).at(nsection).eventList.clear();
}
......
......@@ -574,6 +574,19 @@ void wxStfGraph::PlotEvents(wxDC& DC) {
SetFocus();
}
void wxStfGraph::ClearEvents() {
stf::SectionAttributes sec_attr;
try {
sec_attr = Doc()->GetCurrentSectionAttributes();
}
catch (const std::out_of_range& e) {
return;
}
for (event_it it2 = sec_attr.eventList.begin(); it2 != sec_attr.eventList.end(); ++it2) {
it2->GetCheckBox()->Destroy();
}
}
void wxStfGraph::DrawCrosshair( wxDC& DC, const wxPen& pen, const wxPen& printPen, int crosshairSize, double xch, double ych) {
if (isnan(xch) || isnan(ych)) {
return;
......
......@@ -210,6 +210,9 @@ public:
*/
void Fittowindow(bool refresh);
//! Destroys all event check boxes
void ClearEvents();
//! Set to true if the graph is drawn on a printer.
/*! \param value boolean determining whether the graph is printed.
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment