MCPcopy Create free account
hub / github.com/VCVRack/Rack / onSelectKey

Method onSelectKey

src/app/ParamWidget.cpp:35–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 }
34
35 void onSelectKey(const SelectKeyEvent& e) override {
36 if (e.action == GLFW_PRESS && (e.isKeyCommand(GLFW_KEY_ENTER) || e.isKeyCommand(GLFW_KEY_KP_ENTER))) {
37 engine::ParamQuantity* pq = paramWidget->getParamQuantity();
38 assert(pq);
39 float oldValue = pq->getValue();
40 if (pq)
41 pq->setDisplayValueString(text);
42 float newValue = pq->getValue();
43
44 if (oldValue != newValue) {
45 // Push ParamChange history action
46 history::ParamChange* h = new history::ParamChange;
47 h->moduleId = paramWidget->module->id;
48 h->paramId = paramWidget->paramId;
49 h->oldValue = oldValue;
50 h->newValue = newValue;
51 APP->history->push(h);
52 }
53
54 ui::MenuOverlay* overlay = getAncestorOfType<ui::MenuOverlay>();
55 overlay->requestDelete();
56 e.consume(this);
57 }
58
59 if (!e.getTarget())
60 TextField::onSelectKey(e);
61 }
62};
63
64

Callers

nothing calls this directly

Calls 8

isKeyCommandMethod · 0.80
requestDeleteMethod · 0.80
consumeMethod · 0.80
getTargetMethod · 0.80
getParamQuantityMethod · 0.45
getValueMethod · 0.45
setDisplayValueStringMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected