MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / pasteClipboardAction

Method pasteClipboardAction

src/override/ModuleWidget.cpp:589–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589bool ModuleWidget::pasteClipboardAction() {
590 const char* json = glfwGetClipboardString(APP->window->win);
591 if (!json) {
592 WARN("Could not get text from clipboard.");
593 return false;
594 }
595
596 json_error_t error;
597 json_t* moduleJ = json_loads(json, 0, &error);
598 if (!moduleJ) {
599 WARN("JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text);
600 return false;
601 }
602 DEFER({json_decref(moduleJ);});
603
604 return pasteJsonAction(moduleJ);
605}
606
607void ModuleWidget::load(std::string filename) {
608 FILE* file = std::fopen(filename.c_str(), "r");

Callers 3

onHoverKeyMethod · 0.45
createContextMenuMethod · 0.45

Calls 1

glfwGetClipboardStringFunction · 0.50

Tested by

no test coverage detected