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

Method pasteJsonAction

src/app/ModuleWidget.cpp:530–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530bool ModuleWidget::pasteJsonAction(json_t* moduleJ) {
531 engine::Module::jsonStripIds(moduleJ);
532
533 json_t* oldModuleJ = toJson();
534 DEFER({json_decref(oldModuleJ);});
535
536 try {
537 fromJson(moduleJ);
538 }
539 catch (Exception& e) {
540 WARN("%s", e.what());
541 return false;
542 }
543
544 // history::ModuleChange
545 history::ModuleChange* h = new history::ModuleChange;
546 h->name = string::translate("ModuleWidget.history.pastePreset");
547 h->moduleId = module->id;
548 json_incref(oldModuleJ);
549 h->oldModuleJ = oldModuleJ;
550 json_incref(moduleJ);
551 h->newModuleJ = moduleJ;
552 APP->history->push(h);
553 return true;
554}
555
556void ModuleWidget::copyClipboard() {
557 json_t* moduleJ = toJson();

Callers

nothing calls this directly

Calls 5

toJsonFunction · 0.85
fromJsonFunction · 0.85
translateFunction · 0.85
whatMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected