Added option to duplicate first bar, in BBEditor
Added a new button to the action bar, using step_btn_duplicate.png The new button, aswell as adding a bar to the patten, then copies the first bar to the last. fixes #457 BBEditor Duplicate Pattern. updated image, changed function name Have updated the new image step_button_duplicate.png Renamed the function from duplicateFirstBarAtEnd to duplicateSteps. BBEditor renamed function duplicateSteps renamed duplicateSteps() to cloneSteps() as requested BBEditor rechange duplicateSteps to cloneSteps BB Editor changed actionBtn text from duplicate to clone
This commit is contained in:
BIN
data/themes/default/step_btn_duplicate.png
Normal file
BIN
data/themes/default/step_btn_duplicate.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 544 B |
@@ -82,6 +82,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void addSteps();
|
||||
void cloneSteps();
|
||||
void removeSteps();
|
||||
void addAutomationTrack();
|
||||
|
||||
@@ -91,6 +92,7 @@ protected slots:
|
||||
|
||||
private:
|
||||
BBTrackContainer * m_bbtc;
|
||||
void makeSteps( bool clone );
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ protected:
|
||||
|
||||
protected slots:
|
||||
void addSteps();
|
||||
void cloneSteps();
|
||||
void removeSteps();
|
||||
void clear();
|
||||
void changeTimeSignature();
|
||||
|
||||
@@ -102,7 +102,9 @@ BBEditor::BBEditor( BBTrackContainer* tc ) :
|
||||
m_toolBar->addAction(embed::getIconPixmap("step_btn_remove"), tr("Remove steps"),
|
||||
m_trackContainerView, SLOT(removeSteps()));
|
||||
m_toolBar->addAction(embed::getIconPixmap("step_btn_add"), tr("Add steps"),
|
||||
m_trackContainerView, SLOT(addSteps()));
|
||||
m_trackContainerView, SLOT( addSteps()));
|
||||
m_toolBar->addAction( embed::getIconPixmap( "step_btn_duplicate" ), tr( "Clone Steps" ),
|
||||
m_trackContainerView, SLOT( cloneSteps() ) );
|
||||
m_toolBar->addSeparator();
|
||||
|
||||
connect( &tc->m_bbComboBoxModel, SIGNAL( dataChanged() ),
|
||||
@@ -170,17 +172,12 @@ BBTrackContainerView::BBTrackContainerView(BBTrackContainer* tc) :
|
||||
|
||||
void BBTrackContainerView::addSteps()
|
||||
{
|
||||
TrackContainer::TrackList tl = model()->tracks();
|
||||
makeSteps( false );
|
||||
}
|
||||
|
||||
for( TrackContainer::TrackList::iterator it = tl.begin();
|
||||
it != tl.end(); ++it )
|
||||
{
|
||||
if( ( *it )->type() == Track::InstrumentTrack )
|
||||
{
|
||||
Pattern* p = static_cast<Pattern *>( ( *it )->getTCO( m_bbtc->currentBB() ) );
|
||||
p->addSteps();
|
||||
}
|
||||
}
|
||||
void BBTrackContainerView::cloneSteps()
|
||||
{
|
||||
makeSteps( true );
|
||||
}
|
||||
|
||||
|
||||
@@ -264,3 +261,27 @@ void BBTrackContainerView::updatePosition()
|
||||
//realignTracks();
|
||||
emit positionChanged( m_currentPosition );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BBTrackContainerView::makeSteps( bool clone )
|
||||
{
|
||||
TrackContainer::TrackList tl = model()->tracks();
|
||||
|
||||
for( TrackContainer::TrackList::iterator it = tl.begin();
|
||||
it != tl.end(); ++it )
|
||||
{
|
||||
if( ( *it )->type() == Track::InstrumentTrack )
|
||||
{
|
||||
Pattern* p = static_cast<Pattern *>( ( *it )->getTCO( m_bbtc->currentBB() ) );
|
||||
if( clone )
|
||||
{
|
||||
p->cloneSteps();
|
||||
} else
|
||||
{
|
||||
p->addSteps();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,6 +478,29 @@ void Pattern::addSteps()
|
||||
updateBBTrack();
|
||||
}
|
||||
|
||||
void Pattern::cloneSteps()
|
||||
{
|
||||
int oldLength = m_steps;
|
||||
m_steps += MidiTime::stepsPerTact();
|
||||
ensureBeatNotes();
|
||||
for(int i = 0; i < MidiTime::stepsPerTact(); ++i )
|
||||
{
|
||||
Note *toCopy = noteAtStep( i );
|
||||
if( toCopy )
|
||||
{
|
||||
setStep( oldLength + i, true );
|
||||
Note *newNote = noteAtStep( oldLength + i );
|
||||
newNote->setKey( toCopy->key() );
|
||||
newNote->setLength( toCopy->length() );
|
||||
newNote->setPanning( toCopy->getPanning() );
|
||||
newNote->setVolume( toCopy->getVolume() );
|
||||
}
|
||||
}
|
||||
ensureBeatNotes();
|
||||
emit dataChanged();
|
||||
updateBBTrack();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user