diff --git a/include/AutomatableModel.h b/include/AutomatableModel.h index 453949b73..2913d2efc 100644 --- a/include/AutomatableModel.h +++ b/include/AutomatableModel.h @@ -180,6 +180,8 @@ public: static void unlinkModels( AutomatableModel * _m1, AutomatableModel * _m2 ); + void unlinkAllModels(); + virtual void saveSettings( QDomDocument & _doc, QDomElement & _this, const QString & _name = QString( "value" ) ); @@ -208,6 +210,11 @@ public: return "0"; } + bool hasLinkedModels() const + { + return m_hasLinkedModels; + } + public slots: virtual void reset(); diff --git a/include/AutomatableModelView.h b/include/AutomatableModelView.h index 1c35d02aa..f213db405 100644 --- a/include/AutomatableModelView.h +++ b/include/AutomatableModelView.h @@ -34,43 +34,43 @@ class QMenu; class EXPORT AutomatableModelView : public ModelView { public: - AutomatableModelView( Model * _model, QWidget * _this ); + AutomatableModelView( Model* model, QWidget* _this ); virtual ~AutomatableModelView(); // some basic functions for convenience - AutomatableModel * modelUntyped() + AutomatableModel* modelUntyped() { - return( castModel() ); + return castModel(); } - const AutomatableModel * modelUntyped() const + const AutomatableModel* modelUntyped() const { - return( castModel() ); + return castModel(); } - virtual void setModel( Model * _model, bool _old_model_valid = true ); + virtual void setModel( Model* model, bool isOldModelValid = true ); template inline T value() const { - return( modelUntyped() ? modelUntyped()->value() : 0 ); + return modelUntyped() ? modelUntyped()->value() : 0; } - inline void setDescription( const QString & _desc ) + inline void setDescription( const QString& desc ) { - m_description = _desc; + m_description = desc; } - inline void setUnit( const QString & _unit ) + inline void setUnit( const QString& unit ) { - m_unit = _unit; + m_unit = unit; } - void addDefaultActions( QMenu * _menu ); + void addDefaultActions( QMenu* menu ); protected: - virtual void mousePressEvent( QMouseEvent * _ev ); + virtual void mousePressEvent( QMouseEvent* event ); QString m_description; QString m_unit; @@ -84,19 +84,18 @@ class AutomatableModelViewSlots : public QObject { Q_OBJECT public: - AutomatableModelViewSlots( - AutomatableModelView * _amv, - QObject * _parent ); + AutomatableModelViewSlots( AutomatableModelView* amv, QObject* parent ); public slots: void execConnectionDialog(); void removeConnection(); void editSongGlobalAutomation(); + void unlinkAllModels(); void removeSongGlobalAutomation(); protected: - AutomatableModelView * amv; + AutomatableModelView* m_amv; } ; @@ -107,19 +106,19 @@ protected: class EXPORT type##ModelView : public AutomatableModelView \ { \ public: \ - type##ModelView( Model * _model, QWidget * _this ) : \ - AutomatableModelView( _model, _this ) \ + type##ModelView( Model* model, QWidget* _this ) : \ + AutomatableModelView( model, _this ) \ { \ } \ \ - type##Model * model() \ + type##Model* model() \ { \ - return( castModel() ); \ + return castModel(); \ } \ \ - const type##Model * model() const \ + const type##Model* model() const \ { \ - return( castModel() ); \ + return castModel(); \ } \ } diff --git a/include/setup_dialog.h b/include/setup_dialog.h index 82f66eae8..f5bd00676 100644 --- a/include/setup_dialog.h +++ b/include/setup_dialog.h @@ -111,6 +111,7 @@ private slots: void toggleSyncVSTPlugins( bool _enabled ); void toggleAnimateAFP( bool _enabled ); void toggleNoteLabels( bool en ); + void toggleDisplayWaveform( bool en ); private: @@ -162,6 +163,7 @@ private: bool m_syncVSTPlugins; bool m_animateAFP; bool m_printNoteLabels; + bool m_displayWaveform; typedef QMap AswMap; typedef QMap MswMap; diff --git a/plugins/zynaddsubfx/CMakeLists.txt b/plugins/zynaddsubfx/CMakeLists.txt index b24afefee..2b7f3a49f 100644 --- a/plugins/zynaddsubfx/CMakeLists.txt +++ b/plugins/zynaddsubfx/CMakeLists.txt @@ -125,6 +125,8 @@ IF(LMMS_BUILD_WIN64) ELSEIF(LMMS_BUILD_WIN32) SET(FLTK_EXTRA_FLAGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/modules/Win32Toolchain.cmake") ENDIF(LMMS_BUILD_WIN64) -ADD_CUSTOM_TARGET(libfltk COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/fltk && cd ${CMAKE_CURRENT_BINARY_DIR}/fltk && ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/fltk ${FLTK_EXTRA_FLAGS} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/cmake/modules/ -DFLTK_USE_SYSTEM_ZLIB:BOOL=ON -DFLTK_USE_SYSTEM_JPEG:BOOL=ON -DFLTK_USE_SYSTEM_PNG:BOOL=ON -DOPTION_BUILD_EXAMPLES:BOOL=OFF -DCMAKE_BUILD_TYPE=release -DFREETYPE_PATH=${FREETYPE_INCLUDE_DIR_ft2build} && ${CMAKE_BUILD_TOOL}) + +FIND_PACKAGE(Freetype REQUIRED) +ADD_CUSTOM_TARGET(libfltk COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/fltk && cd ${CMAKE_CURRENT_BINARY_DIR}/fltk && ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/fltk ${FLTK_EXTRA_FLAGS} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/cmake/modules/ -DFLTK_USE_SYSTEM_ZLIB:BOOL=ON -DFLTK_USE_SYSTEM_JPEG:BOOL=ON -DFLTK_USE_SYSTEM_PNG:BOOL=ON -DOPTION_BUILD_EXAMPLES:BOOL=OFF -DCMAKE_BUILD_TYPE=release -DFREETYPE_PATH=${FREETYPE_INCLUDE_DIR_freetype2} && ${CMAKE_BUILD_TOOL}) ADD_DEPENDENCIES(RemoteZynAddSubFx libfltk) diff --git a/src/core/AutomatableModel.cpp b/src/core/AutomatableModel.cpp index 034be3bb5..895e2342d 100644 --- a/src/core/AutomatableModel.cpp +++ b/src/core/AutomatableModel.cpp @@ -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; diff --git a/src/gui/AutomatableModelView.cpp b/src/gui/AutomatableModelView.cpp index 3d1995636..bf035ad35 100644 --- a/src/gui/AutomatableModelView.cpp +++ b/src/gui/AutomatableModelView.cpp @@ -1,7 +1,7 @@ /* * AutomatableModelView.cpp - implementation of AutomatableModelView * - * Copyright (c) 2011-2013 Tobias Doerffel + * Copyright (c) 2011-2014 Tobias Doerffel * * 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() ) ). - 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() ) ). - 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() ) ). + 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() ) ). + 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" diff --git a/src/gui/setup_dialog.cpp b/src/gui/setup_dialog.cpp index ffebdfd29..dcda537de 100644 --- a/src/gui/setup_dialog.cpp +++ b/src/gui/setup_dialog.cpp @@ -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; diff --git a/src/gui/widgets/visualization_widget.cpp b/src/gui/widgets/visualization_widget.cpp index d1437932b..7dee75d33 100644 --- a/src/gui/widgets/visualization_widget.cpp +++ b/src/gui/widgets/visualization_widget.cpp @@ -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];