mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-14 20:20:35 -04:00
Merge pull request #56 from grejppi/stable-0.4-bb_usability
B&B editor: adding and removing steps
This commit is contained in:
@@ -56,6 +56,8 @@ public slots:
|
||||
void stop();
|
||||
void updatePosition();
|
||||
void addAutomationTrack();
|
||||
void addSteps();
|
||||
void removeSteps();
|
||||
|
||||
private:
|
||||
virtual void keyPressEvent( QKeyEvent * _ke );
|
||||
|
||||
@@ -125,9 +125,6 @@ public:
|
||||
bool empty();
|
||||
|
||||
|
||||
void addSteps( int _n );
|
||||
void removeSteps( int _n );
|
||||
|
||||
virtual trackContentObjectView * createView( trackView * _tv );
|
||||
|
||||
|
||||
@@ -140,6 +137,8 @@ protected:
|
||||
|
||||
|
||||
protected slots:
|
||||
void addSteps();
|
||||
void removeSteps();
|
||||
void clear();
|
||||
void freeze();
|
||||
void unfreeze();
|
||||
@@ -164,6 +163,7 @@ private:
|
||||
|
||||
friend class patternView;
|
||||
friend class patternFreezeThread;
|
||||
friend class bbEditor;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -187,9 +187,6 @@ protected slots:
|
||||
void resetName();
|
||||
void changeName();
|
||||
|
||||
void addSteps( QAction * _item );
|
||||
void removeSteps( QAction * _item );
|
||||
|
||||
|
||||
protected:
|
||||
virtual void constructContextMenu( QMenu * );
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#include "tool_button.h"
|
||||
#include "config_mgr.h"
|
||||
|
||||
#include "TrackContainer.h"
|
||||
#include "pattern.h"
|
||||
|
||||
|
||||
|
||||
bbEditor::bbEditor( bbTrackContainer* tc ) :
|
||||
@@ -93,6 +96,16 @@ bbEditor::bbEditor( bbTrackContainer* tc ) :
|
||||
tr( "Add automation-track" ),
|
||||
this, SLOT( addAutomationTrack() ), m_toolBar );
|
||||
|
||||
toolButton * remove_bar = new toolButton(
|
||||
embed::getIconPixmap( "step_btn_remove" ),
|
||||
tr( "Remove steps" ),
|
||||
this, SLOT( removeSteps() ), m_toolBar );
|
||||
|
||||
toolButton * add_bar = new toolButton(
|
||||
embed::getIconPixmap( "step_btn_add" ),
|
||||
tr( "Add steps" ),
|
||||
this, SLOT( addSteps() ), m_toolBar );
|
||||
|
||||
|
||||
|
||||
m_playButton->setWhatsThis(
|
||||
@@ -119,6 +132,8 @@ bbEditor::bbEditor( bbTrackContainer* tc ) :
|
||||
tb_layout->addWidget( add_bb_track );
|
||||
tb_layout->addWidget( add_automation_track );
|
||||
tb_layout->addStretch();
|
||||
tb_layout->addWidget( remove_bar );
|
||||
tb_layout->addWidget( add_bar );
|
||||
tb_layout->addWidget( l );
|
||||
tb_layout->addSpacing( 15 );
|
||||
|
||||
@@ -219,6 +234,44 @@ void bbEditor::addAutomationTrack()
|
||||
|
||||
|
||||
|
||||
void bbEditor::addSteps()
|
||||
{
|
||||
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() ) );
|
||||
p->addSteps();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bbEditor::removeSteps()
|
||||
{
|
||||
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() ) );
|
||||
p->removeSteps();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bbEditor::keyPressEvent( QKeyEvent * _ke )
|
||||
{
|
||||
if ( _ke->key() == Qt::Key_Space )
|
||||
|
||||
@@ -485,9 +485,9 @@ void pattern::abortFreeze()
|
||||
|
||||
|
||||
|
||||
void pattern::addSteps( int _n )
|
||||
void pattern::addSteps()
|
||||
{
|
||||
m_steps += _n;
|
||||
m_steps += midiTime::stepsPerTact();
|
||||
ensureBeatNotes();
|
||||
emit dataChanged();
|
||||
}
|
||||
@@ -495,8 +495,9 @@ void pattern::addSteps( int _n )
|
||||
|
||||
|
||||
|
||||
void pattern::removeSteps( int _n )
|
||||
void pattern::removeSteps()
|
||||
{
|
||||
int _n = midiTime::stepsPerTact();
|
||||
if( _n < m_steps )
|
||||
{
|
||||
for( int i = m_steps - _n; i < m_steps; ++i )
|
||||
@@ -908,23 +909,6 @@ void patternView::changeName()
|
||||
|
||||
|
||||
|
||||
|
||||
void patternView::addSteps( QAction * _item )
|
||||
{
|
||||
m_pat->addSteps( _item->text().section( ' ', 0, 0 ).toInt() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void patternView::removeSteps( QAction * _item )
|
||||
{
|
||||
m_pat->removeSteps( _item->text().section( ' ', 0, 0 ).toInt() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void patternView::constructContextMenu( QMenu * _cm )
|
||||
{
|
||||
QAction * a = new QAction( embed::getIconPixmap( "piano" ),
|
||||
@@ -967,24 +951,10 @@ void patternView::constructContextMenu( QMenu * _cm )
|
||||
_cm->addSeparator();
|
||||
}
|
||||
|
||||
QMenu * add_step_menu = _cm->addMenu(
|
||||
embed::getIconPixmap( "step_btn_add" ),
|
||||
tr( "Add steps" ) );
|
||||
QMenu * remove_step_menu = _cm->addMenu(
|
||||
embed::getIconPixmap( "step_btn_remove" ),
|
||||
tr( "Remove steps" ) );
|
||||
connect( add_step_menu, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( addSteps( QAction * ) ) );
|
||||
connect( remove_step_menu, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( removeSteps( QAction * ) ) );
|
||||
for( int i = 1; i <= 16; i *= 2 )
|
||||
{
|
||||
const QString label = ( i == 1 ) ?
|
||||
tr( "1 step" ) :
|
||||
tr( "%1 steps" ).arg( i );
|
||||
add_step_menu->addAction( label );
|
||||
remove_step_menu->addAction( label );
|
||||
}
|
||||
_cm->addAction( embed::getIconPixmap( "step_btn_add" ),
|
||||
tr( "Add steps" ), m_pat, SLOT( addSteps() ) );
|
||||
_cm->addAction( embed::getIconPixmap( "step_btn_remove" ),
|
||||
tr( "Remove steps" ), m_pat, SLOT( removeSteps() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user