void FxMixerView::moveChannelLeft(int index, int focusIndex) { // can't move master or first channel left or last channel right if( index <= 1 || index >= m_fxChannelViews.size() ) return; FxMixer *m = Engine::fxMixer(); // Move instruments channels m->moveChannelLeft( index ); // Update widgets models m_fxChannelViews[index]->setChannelIndex( index ); m_fxChannelViews[index - 1]->setChannelIndex( index - 1 ); // Focus on new position setCurrentFxLine( focusIndex ); }
void FxMixerView::moveChannelLeft(int index) { // can't move master or first channel left or last channel right if( index <= 1 || index >= m_fxChannelViews.size() ) return; int selIndex = m_currentFxLine->channelIndex(); FxMixer * mix = engine::fxMixer(); mix->moveChannelLeft(index); // refresh the two mixer views for( int i = index-1; i <= index; ++i ) { // delete the mixer view int replaceIndex = chLayout->indexOf(m_fxChannelViews[i]->m_fxLine); chLayout->removeWidget(m_fxChannelViews[i]->m_fxLine); m_racksLayout->removeWidget( m_fxChannelViews[i]->m_rackView ); delete m_fxChannelViews[i]->m_fader; delete m_fxChannelViews[i]->m_muteBtn; delete m_fxChannelViews[i]->m_soloBtn; delete m_fxChannelViews[i]->m_fxLine; delete m_fxChannelViews[i]; // add it again m_fxChannelViews[i] = new FxChannelView( m_channelAreaWidget, this, i ); chLayout->insertWidget( replaceIndex, m_fxChannelViews[i]->m_fxLine ); m_racksLayout->insertWidget( replaceIndex, m_fxChannelViews[i]->m_rackView ); } // keep selected channel if( selIndex == index ) { selIndex = index-1; } else if( selIndex == index - 1 ) { selIndex = index; } setCurrentFxLine(selIndex); }