AutomatableModelView/ContextMenu: option for unlinking all controls

Integrated patch by Rodrigo Rodrigues da Silva which adds an option
to all AutomatableModelView's context menu allowing to unlink all
linked controls.
This commit is contained in:
Tobias Doerffel
2010-07-28 21:24:14 +02:00
parent 9e42d4388e
commit 68abd34908
4 changed files with 47 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
/*
* AutomatableModel.cpp - some implementations of AutomatableModel-class
*
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -248,7 +248,7 @@ void AutomatableModel::setAutomatedValue( const float _value )
void AutomatableModel::setRange( const float _min, const float _max,
const float _step )
{
if( ( m_maxValue != _max ) || ( m_minValue != _min ) )
if( ( m_maxValue != _max ) || ( m_minValue != _min ) )
{
m_minValue = _min;
m_maxValue = _max;
@@ -423,6 +423,20 @@ void AutomatableModel::unlinkModels( AutomatableModel * _model1,
void AutomatableModel::unlinkAllModels()
{
AutomatableModel * _model;
foreach( _model, m_linkedModels )
{
unlinkModels( this, _model );
}
m_hasLinkedModels = false;
}
void AutomatableModel::setControllerConnection( ControllerConnection * _c )
{
m_controllerConnection = _c;

View File

@@ -1,8 +1,8 @@
/*
* automatable_model_view.cpp - implementation of AutomatableModelView
* AutomatableModelView.cpp - implementation of AutomatableModelView
*
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
@@ -22,7 +22,6 @@
*
*/
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
@@ -69,6 +68,7 @@ void AutomatableModelView::addDefaultActions( QMenu * _menu )
_model->initValue<float>() ) ).
arg( m_unit ),
_model, SLOT( reset() ) );
_menu->addSeparator();
_menu->addAction( embed::getIconPixmap( "edit_copy" ),
AutomatableModel::tr( "&Copy value (%1%2)" ).
@@ -91,6 +91,14 @@ void AutomatableModelView::addDefaultActions( QMenu * _menu )
SLOT( editSongGlobalAutomation() ) );
_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() )
{
@@ -259,6 +267,15 @@ void AutomatableModelViewSlots::editSongGlobalAutomation()
void AutomatableModelViewSlots::unlinkAllModels()
{
AutomatableModel * m = amv->modelUntyped();
m->unlinkAllModels();
}
void AutomatableModelViewSlots::arm()
{
amv->modelUntyped()->setArmed( true );