From 9c9bca7098baa9d33d59ed05590dd607b03bcbc8 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 17 May 2010 23:17:16 +0200 Subject: [PATCH] EffectControl: store visibility information of attached EffectView For some effects it is helpful to know whether their attached EffectView is visible or not. This mainly concerns effects that actually do not touch the sound data but analyze it and display the results. --- include/EffectControls.h | 18 +++++++++++++++--- include/EffectView.h | 3 +-- src/gui/widgets/EffectView.cpp | 13 ++++++------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/include/EffectControls.h b/include/EffectControls.h index 71e58f0a7..a8883b83d 100644 --- a/include/EffectControls.h +++ b/include/EffectControls.h @@ -1,8 +1,8 @@ /* * EffectControls.h - model for effect-controls * - * Copyright (c) 2008 Tobias Doerffel - * + * Copyright (c) 2008-2010 Tobias Doerffel + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -38,7 +38,8 @@ public: EffectControls( Effect * _eff ) : JournallingObject(), Model( _eff ), - m_effect( _eff ) + m_effect( _eff ), + m_viewVisible( false ) { } @@ -50,6 +51,16 @@ public: virtual EffectControlDialog * createView() = 0; + void setViewVisible( bool _visible ) + { + m_viewVisible = _visible; + } + + bool isViewVisible() const + { + return m_viewVisible; + } + Effect * effect() { return m_effect; @@ -58,6 +69,7 @@ public: private: Effect * m_effect; + bool m_viewVisible; } ; diff --git a/include/EffectView.h b/include/EffectView.h index 172574379..6caa06b1f 100644 --- a/include/EffectView.h +++ b/include/EffectView.h @@ -2,7 +2,7 @@ * EffectView.h - view-component for an effect * * Copyright (c) 2006-2007 Danny McRae - * Copyright (c) 2007-2009 Tobias Doerffel + * Copyright (c) 2007-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -87,7 +87,6 @@ private: knob * m_gate; QMdiSubWindow * m_subWindow; EffectControlDialog * m_controlView; - bool m_show; } ; diff --git a/src/gui/widgets/EffectView.cpp b/src/gui/widgets/EffectView.cpp index 39ff50eff..764bcf6c5 100644 --- a/src/gui/widgets/EffectView.cpp +++ b/src/gui/widgets/EffectView.cpp @@ -2,7 +2,7 @@ * effect_view.cpp - view-component for an effect * * Copyright (c) 2006-2007 Danny McRae - * Copyright (c) 2007-2009 Tobias Doerffel + * Copyright (c) 2007-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -47,8 +47,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : PluginView( _model, _parent ), m_bg( embed::getIconPixmap( "effect_plugin" ) ), m_subWindow( NULL ), - m_controlView( NULL ), - m_show( true ) + m_controlView( NULL ) { setFixedSize( 210, 60 ); @@ -162,16 +161,16 @@ void EffectView::editControls() { if( m_subWindow ) { - if( m_show ) + if( !effect()->controls()->isViewVisible() ) { m_subWindow->show(); m_subWindow->raise(); - m_show = false; + effect()->controls()->setViewVisible( true ); } else { m_subWindow->hide(); - m_show = true; + effect()->controls()->setViewVisible( false ); } } } @@ -217,7 +216,7 @@ void EffectView::closeEffects() { m_subWindow->hide(); } - m_show = true; + effect()->controls()->setViewVisible( false ); }