diff --git a/MixingGroup.cpp b/MixingGroup.cpp index 64fb59a..57d05aa 100644 --- a/MixingGroup.cpp +++ b/MixingGroup.cpp @@ -89,6 +89,11 @@ void MixingGroup::setAction (Action a) if (update_action_ == ACTION_NONE) update_action_ = ACTION_UPDATE; } + else if (a == ACTION_FINISH) { + // only needs to finish if an action was done + if (update_action_ != ACTION_NONE) + update_action_ = ACTION_FINISH; + } else update_action_ = a; } @@ -106,7 +111,15 @@ void MixingGroup::update (float) setActive(currentsource != sources_.end()); // perform action - if (update_action_ == ACTION_UPDATE ) { + if (update_action_ == ACTION_FINISH ) { + // update barycenter + recenter(); + // clear index, delete lines_, and recreate path and index with remaining sources + createLineStrip(); + // update only once + update_action_ = ACTION_NONE; + } + else if (update_action_ == ACTION_UPDATE ) { std::vector p = lines_->path(); diff --git a/MixingGroup.h b/MixingGroup.h index 6aace5a..de60033 100644 --- a/MixingGroup.h +++ b/MixingGroup.h @@ -36,7 +36,8 @@ public: ACTION_UPDATE = 1, ACTION_GRAB_ONE = 2, ACTION_GRAB_ALL = 3, - ACTION_ROTATE_ALL = 4 + ACTION_ROTATE_ALL = 4, + ACTION_FINISH = 5 } Action; void setAction (Action a) ; inline Action action () { return update_action_; } diff --git a/MixingView.cpp b/MixingView.cpp index 7b45227..0702ba1 100644 --- a/MixingView.cpp +++ b/MixingView.cpp @@ -476,7 +476,7 @@ void MixingView::terminate() // terminate all mixing group actions for (auto g = Mixer::manager().session()->beginMixingGroup(); g != Mixer::manager().session()->endMixingGroup(); g++) - (*g)->setAction( MixingGroup::ACTION_NONE ); + (*g)->setAction( MixingGroup::ACTION_FINISH ); } diff --git a/Source.cpp b/Source.cpp index 82dbb2e..4aa6d94 100644 --- a/Source.cpp +++ b/Source.cpp @@ -60,6 +60,7 @@ Source::Source() : initialized_(false), symbol_(nullptr), active_(true), locked_ overlay_mixinggroup_ = new Switch; overlay_mixinggroup_->translation_.z = 0.1; center = new Symbol(Symbol::CIRCLE_POINT, glm::vec3(0.f, 0.f, 0.1f)); + center->scale_= glm::vec3(1.6f, 1.6f, 1.f); center->color = glm::vec4( COLOR_MIXING_GROUP, 0.96f); overlay_mixinggroup_->attach(center); rotation_mixingroup_ = new Symbol(Symbol::ROTATION, glm::vec3(0.f, 0.f, 0.1f)); @@ -304,7 +305,11 @@ void Source::setMode(Source::Mode m) for (auto o = overlays_.begin(); o != overlays_.end(); o++) (*o).second->visible_ = current & !locked_; - overlay_mixinggroup_->visible_ = mixinggroup_!= nullptr; + // the lock icon + locker_->setActive( locked_ ? 0 : 1); + + // the mixing group overlay + overlay_mixinggroup_->visible_ = mixinggroup_!= nullptr && !locked_; overlay_mixinggroup_->setActive(current); // show in appearance view if current @@ -453,8 +458,7 @@ void Source::setLocked (bool on) { locked_ = on; - // the lock icon - locker_->setActive( on ? 0 : 1); + setMode(mode_); } // Transfer functions from coordinates to alpha (1 - transparency)