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

Method SetUpFromSaveData

Source/PulseRouter.cpp:128–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void PulseRouter::SetUpFromSaveData()
129{
130 int numItems = mModuleSaveData.GetInt("num_items");
131 int oldNumItems = (int)mDestinationCables.size();
132 if (numItems > oldNumItems)
133 {
134 for (int i = oldNumItems; i < numItems; ++i)
135 {
136 mDestinationCables.push_back(new PatchCableSource(this, kConnectionType_Pulse));
137 mRouteSelector->AddLabel(" ", i);
138 AddPatchCableSource(mDestinationCables[i]);
139 mDestinationCables[i]->SetOverrideCableDir(ofVec2f(1, 0), PatchCableSource::Side::kRight);
140 ofRectangle rect = GetRect(true);
141 mDestinationCables[i]->SetManualPosition(rect.getMaxX() + 10, rect.y + rect.height / 2);
142 }
143 }
144 else if (numItems < oldNumItems)
145 {
146 for (int i = oldNumItems - 1; i >= numItems; --i)
147 {
148 mRouteSelector->RemoveLabel(i);
149 RemovePatchCableSource(mDestinationCables[i]);
150 }
151 mDestinationCables.resize(numItems);
152 }
153 mRadioButtonMode = mModuleSaveData.GetBool("radiobuttonmode");
154 mRouteSelector->SetMultiSelect(!mRadioButtonMode);
155 mOnlyShowActiveCables = mModuleSaveData.GetBool("only_show_active_cables");
156}
157
158void PulseRouter::SaveLayout(ofxJSONElement& moduleInfo)
159{

Callers

nothing calls this directly

Calls 11

ofVec2fClass · 0.85
GetIntMethod · 0.80
sizeMethod · 0.80
SetOverrideCableDirMethod · 0.80
SetManualPositionMethod · 0.80
getMaxXMethod · 0.80
resizeMethod · 0.80
GetBoolMethod · 0.80
SetMultiSelectMethod · 0.80
AddLabelMethod · 0.45
RemoveLabelMethod · 0.45

Tested by

no test coverage detected