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:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* AutomatableModel.h - declaration of class AutomatableModel
|
||||
*
|
||||
* Copyright (c) 2007-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2007-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -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" ) );
|
||||
@@ -211,6 +213,8 @@ public:
|
||||
inline bool armed(){ return m_armed; }
|
||||
inline void setArmed( bool _armed ){ m_armed = _armed; }
|
||||
|
||||
inline bool hasLinkedModels() { return m_hasLinkedModels; }
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void reset();
|
||||
@@ -289,7 +293,7 @@ class FloatModel : public AutomatableModel
|
||||
public:
|
||||
FloatModel( float _val = 0, float _min = 0, float _max = 0,
|
||||
float _step = 0, ::Model * _parent = NULL,
|
||||
const QString & _display_name = QString(),
|
||||
const QString & _display_name = QString(),
|
||||
bool _default_constructed = false ) :
|
||||
AutomatableModel( Float, _val, _min, _max, _step,
|
||||
_parent, _display_name, _default_constructed )
|
||||
@@ -306,7 +310,7 @@ class IntModel : public AutomatableModel
|
||||
public:
|
||||
IntModel( int _val = 0, int _min = 0, int _max = 0,
|
||||
::Model * _parent = NULL,
|
||||
const QString & _display_name = QString(),
|
||||
const QString & _display_name = QString(),
|
||||
bool _default_constructed = false ) :
|
||||
AutomatableModel( Integer, _val, _min, _max, 1,
|
||||
_parent, _display_name, _default_constructed )
|
||||
@@ -322,7 +326,7 @@ class BoolModel : public AutomatableModel
|
||||
{
|
||||
public:
|
||||
BoolModel( const bool _val = false, ::Model * _parent = NULL,
|
||||
const QString & _display_name = QString(),
|
||||
const QString & _display_name = QString(),
|
||||
bool _default_constructed = false ) :
|
||||
AutomatableModel( Bool, _val, false, true, 1,
|
||||
_parent, _display_name, _default_constructed )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* AutomatableModelView.h - class AutomatableModelView
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -101,6 +101,7 @@ public slots:
|
||||
void execConnectionDialog();
|
||||
void removeConnection();
|
||||
void editSongGlobalAutomation();
|
||||
void unlinkAllModels();
|
||||
void arm();
|
||||
void deArm();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user