MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / ButtonClicked

Method ButtonClicked

Source/CanvasControls.cpp:167–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167void 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
202void CanvasControls::LoadLayout(const ofxJSONElement& moduleInfo)
203{

Callers

nothing calls this directly

Calls 7

GetHighlightedMethod · 0.80
GetUIControlsMethod · 0.80
RemoveElementMethod · 0.80
SetShowingMethod · 0.45
DeleteMethod · 0.45
ClearMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected