MCPcopy Create free account
hub / github.com/christophhart/HISE / Comp

Method Comp

hi_scripting/scripting/scriptnode/ui/PropertyEditor.cpp:238–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238NodePropertyComponent::Comp::Comp(ValueTree d, NodeBase* n) :
239 v(d.getPropertyAsValue(PropertyIds::Value, n->getUndoManager()))
240{
241 Identifier propId = Identifier(d[PropertyIds::ID].toString().fromLastOccurrenceOf(".", false, false));
242
243 if (propId == PropertyIds::FillMode || propId == PropertyIds::UseResetValue || propId == PropertyIds::UseFreqDomain)
244 {
245 TextButton* t = new TextButton();
246 t->setButtonText("Enabled");
247 t->setClickingTogglesState(true);
248 t->getToggleStateValue().referTo(v);
249 t->setLookAndFeel(&laf);
250
251 editor = t;
252 addAndMakeVisible(editor);
253 }
254 else if (propId == PropertyIds::Callback)
255 {
256 Array<var> values;
257
258 StringArray sa = getListForId(propId, n);
259
260 for (auto s : sa)
261 values.add(s);
262
263 auto c = new ComboBox();
264
265 c->addItemList(sa, 1);
266 c->addListener(this);
267 v.addListener(this);
268
269 editor = c;
270
271 valueChanged(v);
272 }
273#if HISE_INCLUDE_SNEX
274 else if (propId == PropertyIds::Code)
275 {
276 TextButton* jp = new TextButton("Edit Code");
277
278 {
279 jp->onClick = [this, n]()
280 {
281
282 auto pTree = n->getPropertyTree().getChildWithProperty(PropertyIds::ID, PropertyIds::Code.toString());
283 if (pTree.isValid())
284 {
285 if (auto sp = this->findParentComponentOfClass<ZoomableViewport>())
286 {
287 if (auto m = static_cast<snex::ui::WorkbenchManager*>(n->getScriptProcessor()->getMainController_()->getWorkbenchManager()))
288 {
289 auto v = n->getPropertyTree().getChildWithProperty(PropertyIds::ID, PropertyIds::Code.toString()).getPropertyAsValue(PropertyIds::Value, n->getUndoManager());
290
291 auto cp = new snex::ui::WorkbenchData::ValueBasedCodeProvider(nullptr, v, n->getId());
292
293 auto wb = m->getWorkbenchDataForCodeProvider(cp, true);
294
295 auto pg = new snex::jit::SnexPlayground(wb.get());

Callers

nothing calls this directly

Calls 15

jminFunction · 0.85
setButtonTextMethod · 0.80
addItemListMethod · 0.80
getMainController_Method · 0.80
reducedMethod · 0.80
setCurrentModalWindowMethod · 0.80
getCurrentTargetMethod · 0.80
valueChangedFunction · 0.50
getPropertyAsValueMethod · 0.45
getUndoManagerMethod · 0.45

Tested by

no test coverage detected