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

Method addButton

hi_scripting/scripting/scriptnode/ui/DspNetworkComponents.cpp:3261–3590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3259}
3260
3261void DspNetworkGraph::WrapperWithMenuBar::addButton(const String& name)
3262{
3263 auto p = canvas.getContent<DspNetworkGraph>();
3264
3265 ActionButton* b = new ActionButton(p, name);
3266
3267 if (name == "probe")
3268 {
3269 b->actionFunction = Actions::toggleProbe;
3270 b->stateFunction = [](DspNetworkGraph& g) { return g.probeSelectionEnabled; };
3271 b->setTooltip("Enable parameter list selection");
3272 }
3273
3274 if(name == "save")
3275 {
3276 b->actionFunction = Actions::save;
3277 }
3278 if(name == "signal")
3279 {
3280 b->actionFunction = Actions::toggleSignalDisplay;
3281 b->stateFunction = [](DspNetworkGraph& g) { return g.network->isSignalDisplayEnabled(); };
3282 b->setTooltip("Display the signal flow in the cables");
3283 }
3284
3285 if(name == "export")
3286 {
3287 b->actionFunction = Actions::exportAsSnippet;
3288 b->setTooltip("Export the node and all references SNEX files as snippet");
3289 }
3290 if (name == "parameters")
3291 {
3292 b->actionFunction = Actions::showParameterPopup;
3293 b->setTooltip("Show all parameters in a popup");
3294 }
3295
3296 if(name == "lock")
3297 {
3298 b->actionFunction = Actions::lockContainer;
3299 b->setTooltip("Locks the current container");
3300 b->enabledFunction = [](DspNetworkGraph& g)
3301 {
3302 auto s = g.network->getSelection();
3303 return !s.isEmpty() && dynamic_cast<NodeContainer*>(s.getFirst().get()) != nullptr;
3304 };
3305
3306 b->stateFunction = [](DspNetworkGraph& g)
3307 {
3308 auto s = g.network->getSelection();
3309 return !s.isEmpty() && (bool)s.getFirst()->getValueTree()[PropertyIds::Locked];
3310 };
3311 }
3312
3313 if(name == "eject")
3314 {
3315 b->actionFunction = Actions::eject;
3316 b->setTooltip("Unload this Network");
3317 }
3318

Callers

nothing calls this directly

Calls 15

ColourFunction · 0.85
canBeFrozenMethod · 0.80
isFrozenMethod · 0.80
isBeingDebuggedMethod · 0.80
isBodyShownMethod · 0.80
setValueTreePropertyMethod · 0.80
setTooltipMethod · 0.45
getSelectionMethod · 0.45
isEmptyMethod · 0.45
getMethod · 0.45
getFirstMethod · 0.45

Tested by

no test coverage detected