void FxMixerView::refreshDisplay() { // delete all views and re-add them for( int i = 1; i<m_fxChannelViews.size(); ++i ) { chLayout->removeWidget(m_fxChannelViews[i]->m_fxLine); 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]; m_racksLayout->removeWidget( m_fxChannelViews[i]->m_rackView ); } m_channelAreaWidget->adjustSize(); // re-add the views m_fxChannelViews.resize(engine::fxMixer()->numChannels()); for( int i = 1; i < m_fxChannelViews.size(); ++i ) { m_fxChannelViews[i] = new FxChannelView(m_channelAreaWidget, this, i); chLayout->addWidget(m_fxChannelViews[i]->m_fxLine); m_racksLayout->addWidget( m_fxChannelViews[i]->m_rackView ); } // set selected fx line to 0 setCurrentFxLine( 0 ); // update all fx lines for( int i = 0; i < m_fxChannelViews.size(); ++i ) { updateFxLine( i ); } updateMaxChannelSelector(); }
void FxMixerView::addNewChannel() { // add new fx mixer channel and redraw the form. FxMixer * mix = engine::fxMixer(); int newChannelIndex = mix->createChannel(); m_fxChannelViews.push_back(new FxChannelView(m_channelAreaWidget, this, newChannelIndex)); chLayout->addWidget(m_fxChannelViews[newChannelIndex]->m_fxLine); updateFxLine(newChannelIndex); updateMaxChannelSelector(); }
void FxMixerView::deleteChannel(int index) { // can't delete master if( index == 0 ) return; // remember selected line int selLine = m_currentFxLine->channelIndex(); // in case the deleted channel is soloed or the remaining // channels will be left in a muted state Engine::fxMixer()->clearChannel(index); // delete the real channel Engine::fxMixer()->deleteChannel(index); // delete the view chLayout->removeWidget(m_fxChannelViews[index]->m_fxLine); m_racksLayout->removeWidget( m_fxChannelViews[index]->m_rackView ); delete m_fxChannelViews[index]->m_fader; delete m_fxChannelViews[index]->m_muteBtn; delete m_fxChannelViews[index]->m_soloBtn; // delete fxLine later to prevent a crash when deleting from context menu m_fxChannelViews[index]->m_fxLine->hide(); m_fxChannelViews[index]->m_fxLine->deleteLater(); delete m_fxChannelViews[index]->m_rackView; delete m_fxChannelViews[index]; m_channelAreaWidget->adjustSize(); // make sure every channel knows what index it is for(int i=0; i<m_fxChannelViews.size(); ++i) { if( i > index ) { m_fxChannelViews[i]->m_fxLine->setChannelIndex(i-1); } } m_fxChannelViews.remove(index); // select the next channel if( selLine >= m_fxChannelViews.size() ) { selLine = m_fxChannelViews.size()-1; } setCurrentFxLine(selLine); updateMaxChannelSelector(); }
void FxMixerView::deleteChannel(int index) { // can't delete master if( index == 0 ) return; // remember selected line int selLine = m_currentFxLine->channelIndex(); // delete the real channel engine::fxMixer()->deleteChannel(index); // delete the view chLayout->removeWidget(m_fxChannelViews[index]->m_fxLine); delete m_fxChannelViews[index]->m_fader; delete m_fxChannelViews[index]->m_muteBtn; delete m_fxChannelViews[index]->m_soloBtn; delete m_fxChannelViews[index]->m_fxLine; delete m_fxChannelViews[index]; m_channelAreaWidget->adjustSize(); // delete the fx rack m_racksLayout->removeWidget( m_fxChannelViews[index]->m_rackView ); // make sure every channel knows what index it is for(int i=0; i<m_fxChannelViews.size(); ++i) { if( i > index ) { m_fxChannelViews[i]->m_fxLine->setChannelIndex(i-1); } } m_fxChannelViews.remove(index); // select the next channel if( selLine >= m_fxChannelViews.size() ) { selLine = m_fxChannelViews.size()-1; } setCurrentFxLine(selLine); updateMaxChannelSelector(); }