|
@@ -611,18 +611,24 @@ void MIDICCToCVInterface::processMidi(std::vector<unsigned char> msg) { |
|
|
|
|
|
|
|
|
struct CCTextField : TextField { |
|
|
struct CCTextField : TextField { |
|
|
void onTextChange(); |
|
|
void onTextChange(); |
|
|
|
|
|
void draw(NVGcontext *vg); |
|
|
int *ccNum; |
|
|
int *ccNum; |
|
|
bool *inited; |
|
|
bool *inited; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
void CCTextField::draw(NVGcontext *vg) { |
|
|
|
|
|
/* This is necessary, since the save |
|
|
|
|
|
* file is loaded after constructing the widget*/ |
|
|
|
|
|
if (*inited) { |
|
|
|
|
|
*inited = false; |
|
|
|
|
|
text = std::to_string(*ccNum); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TextField::draw(vg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void CCTextField::onTextChange() { |
|
|
void CCTextField::onTextChange() { |
|
|
if (text.size() > 0) { |
|
|
if (text.size() > 0) { |
|
|
if (*inited) { |
|
|
|
|
|
*inited = false; |
|
|
|
|
|
text = std::to_string(*ccNum); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
*ccNum = std::stoi(text); |
|
|
*ccNum = std::stoi(text); |
|
|
// Only allow valid cc numbers |
|
|
// Only allow valid cc numbers |
|
|