Merge branch 'stable-0.4' into stable-0.4-new-fx-mixer
This commit is contained in:
@@ -418,6 +418,19 @@ void AutomatableModel::unlinkModels( AutomatableModel * _model1,
|
||||
|
||||
|
||||
|
||||
void AutomatableModel::unlinkAllModels()
|
||||
{
|
||||
foreach( AutomatableModel* model, m_linkedModels )
|
||||
{
|
||||
unlinkModels( this, model );
|
||||
}
|
||||
|
||||
m_hasLinkedModels = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void AutomatableModel::setControllerConnection( ControllerConnection * _c )
|
||||
{
|
||||
m_controllerConnection = _c;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* AutomatableModelView.cpp - implementation of AutomatableModelView
|
||||
*
|
||||
* Copyright (c) 2011-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2011-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -35,9 +35,8 @@
|
||||
|
||||
|
||||
|
||||
AutomatableModelView::AutomatableModelView( ::Model * _model,
|
||||
QWidget * _this ) :
|
||||
ModelView( _model, _this ),
|
||||
AutomatableModelView::AutomatableModelView( ::Model* model, QWidget* _this ) :
|
||||
ModelView( model, _this ),
|
||||
m_description( QString::null ),
|
||||
m_unit( QString::null )
|
||||
{
|
||||
@@ -55,108 +54,102 @@ AutomatableModelView::~AutomatableModelView()
|
||||
|
||||
|
||||
|
||||
void AutomatableModelView::addDefaultActions( QMenu * _menu )
|
||||
void AutomatableModelView::addDefaultActions( QMenu* menu )
|
||||
{
|
||||
AutomatableModel * _model = modelUntyped();
|
||||
AutomatableModel* model = modelUntyped();
|
||||
|
||||
AutomatableModelViewSlots * amvSlots =
|
||||
new AutomatableModelViewSlots( this, _menu );
|
||||
|
||||
_menu->addAction( embed::getIconPixmap( "reload" ),
|
||||
AutomatableModel::tr( "&Reset (%1%2)" ).
|
||||
arg( _model->displayValue(
|
||||
_model->initValue<float>() ) ).
|
||||
arg( m_unit ),
|
||||
_model, SLOT( reset() ) );
|
||||
_menu->addSeparator();
|
||||
_menu->addAction( embed::getIconPixmap( "edit_copy" ),
|
||||
AutomatableModel::tr( "&Copy value (%1%2)" ).
|
||||
arg( _model->displayValue(
|
||||
_model->value<float>() ) ).
|
||||
arg( m_unit ),
|
||||
_model, SLOT( copyValue() ) );
|
||||
_menu->addAction( embed::getIconPixmap( "edit_paste" ),
|
||||
AutomatableModel::tr( "&Paste value (%1%2)").
|
||||
arg( _model->displayValue(
|
||||
AutomatableModel::copiedValue() ) ).
|
||||
arg( m_unit ),
|
||||
_model, SLOT( pasteValue() ) );
|
||||
AutomatableModelViewSlots* amvSlots = new AutomatableModelViewSlots( this, menu );
|
||||
|
||||
_menu->addSeparator();
|
||||
menu->addAction( embed::getIconPixmap( "reload" ),
|
||||
AutomatableModel::tr( "&Reset (%1%2)" ).
|
||||
arg( model->displayValue( model->initValue<float>() ) ).
|
||||
arg( m_unit ),
|
||||
model, SLOT( reset() ) );
|
||||
|
||||
_menu->addAction( embed::getIconPixmap( "automation" ),
|
||||
AutomatableModel::tr( "Edit song-global automation" ),
|
||||
amvSlots,
|
||||
SLOT( editSongGlobalAutomation() ) );
|
||||
menu->addSeparator();
|
||||
menu->addAction( embed::getIconPixmap( "edit_copy" ),
|
||||
AutomatableModel::tr( "&Copy value (%1%2)" ).
|
||||
arg( model->displayValue( model->value<float>() ) ).
|
||||
arg( m_unit ),
|
||||
model, SLOT( copyValue() ) );
|
||||
|
||||
_menu->addAction( QPixmap(),
|
||||
AutomatableModel::tr( "Remove song-global automation" ),
|
||||
amvSlots,
|
||||
SLOT( removeSongGlobalAutomation() ) );
|
||||
menu->addAction( embed::getIconPixmap( "edit_paste" ),
|
||||
AutomatableModel::tr( "&Paste value (%1%2)").
|
||||
arg( model->displayValue( AutomatableModel::copiedValue() ) ).
|
||||
arg( m_unit ),
|
||||
model, SLOT( pasteValue() ) );
|
||||
|
||||
_menu->addSeparator();
|
||||
menu->addSeparator();
|
||||
|
||||
menu->addAction( embed::getIconPixmap( "automation" ),
|
||||
AutomatableModel::tr( "Edit song-global automation" ),
|
||||
amvSlots,
|
||||
SLOT( editSongGlobalAutomation() ) );
|
||||
|
||||
menu->addAction( QPixmap(),
|
||||
AutomatableModel::tr( "Remove song-global automation" ),
|
||||
amvSlots,
|
||||
SLOT( removeSongGlobalAutomation() ) );
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
if( model->hasLinkedModels() )
|
||||
{
|
||||
menu->addAction( embed::getIconPixmap( "edit-delete" ),
|
||||
AutomatableModel::tr( "Remove all linked controls" ),
|
||||
amvSlots, SLOT( unlinkAllModels() ) );
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
QString controllerTxt;
|
||||
if( _model->getControllerConnection() )
|
||||
if( model->getControllerConnection() )
|
||||
{
|
||||
Controller * cont = _model->getControllerConnection()->
|
||||
getController();
|
||||
Controller* cont = model->getControllerConnection()->getController();
|
||||
if( cont )
|
||||
{
|
||||
controllerTxt =
|
||||
AutomatableModel::tr( "Connected to %1" ).
|
||||
arg( cont->name() );
|
||||
controllerTxt = AutomatableModel::tr( "Connected to %1" ).arg( cont->name() );
|
||||
}
|
||||
else
|
||||
{
|
||||
controllerTxt = AutomatableModel::tr(
|
||||
"Connected to controller" );
|
||||
controllerTxt = AutomatableModel::tr( "Connected to controller" );
|
||||
}
|
||||
|
||||
QMenu * contMenu = _menu->addMenu(
|
||||
embed::getIconPixmap( "controller" ),
|
||||
controllerTxt );
|
||||
QMenu* contMenu = menu->addMenu( embed::getIconPixmap( "controller" ), controllerTxt );
|
||||
|
||||
contMenu->addAction( embed::getIconPixmap( "controller" ),
|
||||
AutomatableModel::tr("Edit connection..."),
|
||||
amvSlots,
|
||||
SLOT( execConnectionDialog() ) );
|
||||
AutomatableModel::tr("Edit connection..."),
|
||||
amvSlots, SLOT( execConnectionDialog() ) );
|
||||
contMenu->addAction( embed::getIconPixmap( "cancel" ),
|
||||
AutomatableModel::tr("Remove connection"),
|
||||
amvSlots,
|
||||
SLOT( removeConnection() ) );
|
||||
AutomatableModel::tr("Remove connection"),
|
||||
amvSlots, SLOT( removeConnection() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
_menu->addAction( embed::getIconPixmap( "controller" ),
|
||||
AutomatableModel::tr("Connect to controller..."),
|
||||
amvSlots,
|
||||
SLOT( execConnectionDialog() ) );
|
||||
menu->addAction( embed::getIconPixmap( "controller" ),
|
||||
AutomatableModel::tr("Connect to controller..."),
|
||||
amvSlots, SLOT( execConnectionDialog() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void AutomatableModelView::setModel( Model * _model, bool _old_model_valid )
|
||||
void AutomatableModelView::setModel( Model* model, bool isOldModelValid )
|
||||
{
|
||||
ModelView::setModel( _model, _old_model_valid );
|
||||
ModelView::setModel( model, isOldModelValid );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void AutomatableModelView::mousePressEvent( QMouseEvent * _me )
|
||||
void AutomatableModelView::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
_me->modifiers() & Qt::ControlModifier )
|
||||
if( event->button() == Qt::LeftButton && event->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
new stringPairDrag( "automatable_model",
|
||||
QString::number( modelUntyped()->id() ),
|
||||
QPixmap(), widget() );
|
||||
_me->accept();
|
||||
new stringPairDrag( "automatable_model", QString::number( modelUntyped()->id() ), QPixmap(), widget() );
|
||||
event->accept();
|
||||
}
|
||||
else if( _me->button() == Qt::MidButton )
|
||||
else if( event->button() == Qt::MidButton )
|
||||
{
|
||||
modelUntyped()->reset();
|
||||
}
|
||||
@@ -167,15 +160,11 @@ void AutomatableModelView::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
|
||||
|
||||
AutomatableModelViewSlots::AutomatableModelViewSlots(
|
||||
AutomatableModelView * _amv,
|
||||
QObject * _parent ) :
|
||||
AutomatableModelViewSlots::AutomatableModelViewSlots( AutomatableModelView* amv, QObject* parent ) :
|
||||
QObject(),
|
||||
amv( _amv )
|
||||
m_amv( amv )
|
||||
{
|
||||
QObject::connect( _parent, SIGNAL( destroyed() ),
|
||||
this, SLOT( deleteLater() ),
|
||||
Qt::QueuedConnection );
|
||||
connect( parent, SIGNAL( destroyed() ), this, SLOT( deleteLater() ), Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
|
||||
@@ -185,31 +174,27 @@ void AutomatableModelViewSlots::execConnectionDialog()
|
||||
{
|
||||
// TODO[pg]: Display a dialog with list of controllers currently in the song
|
||||
// in addition to any system MIDI controllers
|
||||
AutomatableModel * m = amv->modelUntyped();
|
||||
AutomatableModel* m = m_amv->modelUntyped();
|
||||
|
||||
m->displayName();
|
||||
ControllerConnectionDialog * d = new ControllerConnectionDialog(
|
||||
(QWidget*)engine::mainWindow(), m );
|
||||
ControllerConnectionDialog d( (QWidget*) engine::mainWindow(), m );
|
||||
|
||||
if( d->exec() == 1)
|
||||
if( d.exec() == 1 )
|
||||
{
|
||||
// Actually chose something
|
||||
if (d->chosenController() != NULL )
|
||||
if( d.chosenController() )
|
||||
{
|
||||
// Update
|
||||
if( m->getControllerConnection() )
|
||||
{
|
||||
m->getControllerConnection()->
|
||||
setController( d->chosenController() );
|
||||
m->getControllerConnection()->setController( d.chosenController() );
|
||||
}
|
||||
// New
|
||||
else
|
||||
{
|
||||
ControllerConnection * cc =
|
||||
new ControllerConnection( d->chosenController() );
|
||||
ControllerConnection* cc = new ControllerConnection( d.chosenController() );
|
||||
m->setControllerConnection( cc );
|
||||
//cc->setTargetName( m->displayName() );
|
||||
|
||||
}
|
||||
}
|
||||
// no controller, so delete existing connection
|
||||
@@ -218,8 +203,6 @@ void AutomatableModelViewSlots::execConnectionDialog()
|
||||
removeConnection();
|
||||
}
|
||||
}
|
||||
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +210,7 @@ void AutomatableModelViewSlots::execConnectionDialog()
|
||||
|
||||
void AutomatableModelViewSlots::removeConnection()
|
||||
{
|
||||
AutomatableModel * m = amv->modelUntyped();
|
||||
AutomatableModel* m = m_amv->modelUntyped();
|
||||
|
||||
if( m->getControllerConnection() )
|
||||
{
|
||||
@@ -241,17 +224,21 @@ void AutomatableModelViewSlots::removeConnection()
|
||||
|
||||
void AutomatableModelViewSlots::editSongGlobalAutomation()
|
||||
{
|
||||
AutomationPattern::globalAutomationPattern( amv->modelUntyped() )->
|
||||
openInAutomationEditor();
|
||||
AutomationPattern::globalAutomationPattern( m_amv->modelUntyped() )->openInAutomationEditor();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AutomatableModelViewSlots::removeSongGlobalAutomation()
|
||||
{
|
||||
delete AutomationPattern::globalAutomationPattern( amv->modelUntyped() );
|
||||
delete AutomationPattern::globalAutomationPattern( m_amv->modelUntyped() );
|
||||
}
|
||||
|
||||
|
||||
void AutomatableModelViewSlots::unlinkAllModels()
|
||||
{
|
||||
m_amv->modelUntyped()->unlinkAllModels();
|
||||
}
|
||||
|
||||
|
||||
#include "moc_AutomatableModelView.cxx"
|
||||
|
||||
@@ -105,6 +105,10 @@ void exportProjectDialog::reject()
|
||||
(*it)->abortProcessing();
|
||||
}
|
||||
|
||||
if( m_activeRenderer ) {
|
||||
m_activeRenderer->abortProcessing();
|
||||
}
|
||||
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
@@ -144,6 +148,11 @@ void exportProjectDialog::closeEvent( QCloseEvent * _ce )
|
||||
(*it)->abortProcessing();
|
||||
}
|
||||
}
|
||||
|
||||
if( m_activeRenderer && m_activeRenderer->isRunning() ) {
|
||||
m_activeRenderer->abortProcessing();
|
||||
}
|
||||
|
||||
QDialog::closeEvent( _ce );
|
||||
}
|
||||
|
||||
@@ -172,9 +181,9 @@ void exportProjectDialog::popRender()
|
||||
|
||||
|
||||
// Pop next render job and start
|
||||
ProjectRenderer* r = m_renderers.back();
|
||||
m_activeRenderer = m_renderers.back();
|
||||
m_renderers.pop_back();
|
||||
render( r );
|
||||
render( m_activeRenderer );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2769,7 +2769,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
if( prKeyOrder[key % KeysPerOctave] == PR_WHITE_KEY_SMALL )
|
||||
{
|
||||
// draw a small one while checking if it is pressed or not
|
||||
if( m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
if( validPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
{
|
||||
p.drawPixmap( PIANO_X, y - WHITE_KEY_SMALL_HEIGHT, *s_whiteKeySmallPressedPm );
|
||||
}
|
||||
@@ -2785,7 +2785,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
PR_WHITE_KEY_BIG )
|
||||
{
|
||||
// draw a big one while checking if it is pressed or not
|
||||
if(m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
if( validPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
{
|
||||
p.drawPixmap( PIANO_X, y - WHITE_KEY_BIG_HEIGHT, *s_whiteKeyBigPressedPm );
|
||||
}
|
||||
@@ -2860,7 +2860,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// then draw it (calculation of y very complicated,
|
||||
// but that's the only working solution, sorry...)
|
||||
// check if the key is pressed or not
|
||||
if( m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
if( validPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
{
|
||||
p.drawPixmap( PIANO_X, y - ( first_white_key_height -
|
||||
WHITE_KEY_SMALL_HEIGHT ) -
|
||||
@@ -2922,7 +2922,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
bool triplets = ( quantization() % 3 != 0 );
|
||||
|
||||
int spt = midiTime::stepsPerTact();
|
||||
float pp16th = m_ppt / spt;
|
||||
float pp16th = (float)m_ppt / spt;
|
||||
int bpt = DefaultBeatsPerTact;
|
||||
if ( triplets ) {
|
||||
spt = static_cast<int>(1.5 * spt);
|
||||
@@ -3855,7 +3855,7 @@ midiTime pianoRoll::newNoteLen() const
|
||||
{
|
||||
return m_lenOfNewNotes;
|
||||
}
|
||||
return midiTime::ticksPerTact() / m_noteLenModel.currentText().right(
|
||||
return DefaultTicksPerTact / m_noteLenModel.currentText().right(
|
||||
m_noteLenModel.currentText().length() -
|
||||
2 ).toInt();
|
||||
}
|
||||
|
||||
@@ -123,7 +123,9 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
m_animateAFP(configManager::inst()->value( "ui",
|
||||
"animateafp").toInt() ),
|
||||
m_printNoteLabels(configManager::inst()->value( "ui",
|
||||
"printnotelabels").toInt() )
|
||||
"printnotelabels").toInt() ),
|
||||
m_displayWaveform(configManager::inst()->value( "ui",
|
||||
"displaywaveform").toInt() )
|
||||
{
|
||||
setWindowIcon( embed::getIconPixmap( "setup_general" ) );
|
||||
setWindowTitle( tr( "Setup LMMS" ) );
|
||||
@@ -282,6 +284,15 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
connect( noteLabels, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleNoteLabels( bool ) ) );
|
||||
|
||||
ledCheckBox * displayWaveform = new ledCheckBox(
|
||||
tr( "Enable waveform display by default" ),
|
||||
misc_tw );
|
||||
labelNumber++;
|
||||
displayWaveform->move( XDelta, YDelta*labelNumber );
|
||||
displayWaveform->setChecked( m_displayWaveform );
|
||||
connect( displayWaveform, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleDisplayWaveform( bool ) ) );
|
||||
|
||||
misc_tw->setFixedHeight( YDelta*labelNumber + HeaderSize );
|
||||
|
||||
|
||||
@@ -826,6 +837,8 @@ void setupDialog::accept()
|
||||
QString::number( m_animateAFP ) );
|
||||
configManager::inst()->setValue( "ui", "printnotelabels",
|
||||
QString::number( m_printNoteLabels ) );
|
||||
configManager::inst()->setValue( "ui", "displaywaveform",
|
||||
QString::number( m_displayWaveform ) );
|
||||
|
||||
|
||||
configManager::inst()->setWorkingDir( m_workingDir );
|
||||
@@ -1026,6 +1039,12 @@ void setupDialog::toggleNoteLabels( bool en )
|
||||
}
|
||||
|
||||
|
||||
void setupDialog::toggleDisplayWaveform( bool en )
|
||||
{
|
||||
m_displayWaveform = en;
|
||||
}
|
||||
|
||||
|
||||
void setupDialog::toggleOneInstrumentTrackWindow( bool _enabled )
|
||||
{
|
||||
m_oneInstrumentTrackWindow = _enabled;
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "tooltip.h"
|
||||
#include "song.h"
|
||||
|
||||
#include "config_mgr.h"
|
||||
|
||||
|
||||
|
||||
visualizationWidget::visualizationWidget( const QPixmap & _bg, QWidget * _p,
|
||||
@@ -45,6 +47,7 @@ visualizationWidget::visualizationWidget( const QPixmap & _bg, QWidget * _p,
|
||||
{
|
||||
setFixedSize( s_background.width(), s_background.height() );
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, true );
|
||||
setActive( configManager::inst()->value( "ui", "displaywaveform").toInt() );
|
||||
|
||||
const fpp_t frames = engine::mixer()->framesPerPeriod();
|
||||
m_buffer = new sampleFrame[frames];
|
||||
|
||||
Reference in New Issue
Block a user