Browse Source

In ModuleWidget::removeAction() unset module position from rack and push to history.

tags/v2.1.1
Andrew Belt 2 years ago
parent
commit
2e6f5d1ed7
1 changed files with 12 additions and 5 deletions
  1. +12
    -5
      src/app/ModuleWidget.cpp

+ 12
- 5
src/app/ModuleWidget.cpp View File

@@ -886,16 +886,23 @@ void ModuleWidget::bypassAction(bool bypassed) {
}

void ModuleWidget::removeAction() {
history::ComplexAction* complexAction = new history::ComplexAction;
complexAction->name = "delete module";
appendDisconnectActions(complexAction);
history::ComplexAction* h = new history::ComplexAction;
h->name = "delete module";

// Disconnect cables
appendDisconnectActions(h);

// Unset module position from rack.
APP->scene->rack->updateModuleOldPositions();
APP->scene->rack->forceUnsetModulePos(this);
h->push(APP->scene->rack->getModuleDragAction());

// history::ModuleRemove
history::ModuleRemove* moduleRemove = new history::ModuleRemove;
moduleRemove->setModule(this);
complexAction->push(moduleRemove);
h->push(moduleRemove);

APP->history->push(complexAction);
APP->history->push(h);

// This removes the module and transfers ownership to caller
APP->scene->rack->removeModule(this);


Loading…
Cancel
Save