From 1c71bab92077b4c2a618fd70478ae61fd390b33d Mon Sep 17 00:00:00 2001 From: Javier Serrano Polo Date: Mon, 10 Jul 2006 00:42:32 +0000 Subject: [PATCH] - upgraded combo box - improved bb-track management git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@221 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/core/bb_editor.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/core/bb_editor.cpp b/src/core/bb_editor.cpp index 5e1f145b4..6ab82c463 100644 --- a/src/core/bb_editor.cpp +++ b/src/core/bb_editor.cpp @@ -140,7 +140,7 @@ bbEditor::bbEditor( engine * _engine ) : QLabel * l = new QLabel( m_toolBar ); l->setPixmap( embed::getIconPixmap( "drum" ) ); - m_bbComboBox = new comboBox( m_toolBar, eng() ); + m_bbComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); m_bbComboBox->setFixedSize( 200, 22 ); connect( m_bbComboBox, SIGNAL( valueChanged( int ) ), this, SLOT( setCurrentBB( int ) ) ); @@ -271,17 +271,10 @@ void bbEditor::removeBB( csize _bb ) ( *it )->removeTCO( _bb ); ( *it )->getTrackContentWidget()->removeTact( _bb * 64 ); } -/* if( _bb == currentBB() && numOfBBs() > 0 ) - {*/ - if( _bb > 0) - { - setCurrentBB( _bb - 1 ); - } - else - { - setCurrentBB( 0 ); - } -// } + if( _bb <= currentBB() ) + { + setCurrentBB( tMax( (int)currentBB() - 1, 0 ) ); + } } @@ -300,6 +293,11 @@ void bbEditor::updateBBTrack( trackContentObject * _tco ) void bbEditor::updateComboBox( void ) { + disconnect( m_bbComboBox, SIGNAL( valueChanged( int ) ), + this, SLOT( setCurrentBB( int ) ) ); + + csize current_bb = currentBB(); + m_bbComboBox->clear(); for( csize i = 0; i < numOfBBs(); ++i ) @@ -308,7 +306,10 @@ void bbEditor::updateComboBox( void ) m_bbComboBox->addItem( bbt->trackLabel()->text(), bbt->trackLabel()->pixmap() ); } - m_bbComboBox->setValue( currentBB() ); + m_bbComboBox->setValue( current_bb ); + + connect( m_bbComboBox, SIGNAL( valueChanged( int ) ), + this, SLOT( setCurrentBB( int ) ) ); }