| 165 | } |
| 166 | |
| 167 | void CanvasControls::ButtonClicked(ClickButton* button, double time) |
| 168 | { |
| 169 | if (button == mRemoveElementButton) |
| 170 | { |
| 171 | mSelectedElement = nullptr; |
| 172 | std::vector<CanvasElement*> elementsToDelete; |
| 173 | for (auto* element : mCanvas->GetElements()) |
| 174 | { |
| 175 | if (element->GetHighlighted()) |
| 176 | elementsToDelete.push_back(element); |
| 177 | } |
| 178 | for (auto* element : elementsToDelete) |
| 179 | { |
| 180 | for (auto* control : element->GetUIControls()) |
| 181 | { |
| 182 | control->SetShowing(false); |
| 183 | RemoveUIControl(control); |
| 184 | control->Delete(); |
| 185 | } |
| 186 | mCanvas->RemoveElement(element); |
| 187 | } |
| 188 | } |
| 189 | if (button == mClearButton) |
| 190 | { |
| 191 | mCanvas->Clear(); |
| 192 | } |
| 193 | |
| 194 | std::vector<CanvasElement*> elements = mCanvas->GetElements(); //make a copy of the list, since I may modify the list through the actions below |
| 195 | for (auto* element : elements) |
| 196 | { |
| 197 | if (element->GetHighlighted()) |
| 198 | element->ButtonClicked(button->Name(), time); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | void CanvasControls::LoadLayout(const ofxJSONElement& moduleInfo) |
| 203 | { |
nothing calls this directly
no test coverage detected