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.
This commit is contained in:
Tobias Doerffel
2010-05-17 23:17:16 +02:00
parent ceacb484a1
commit 9c9bca7098
3 changed files with 22 additions and 12 deletions

View File

@@ -1,8 +1,8 @@
/*
* EffectControls.h - model for effect-controls
*
* Copyright (c) 2008 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
*
* 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;
} ;

View File

@@ -2,7 +2,7 @@
* EffectView.h - view-component for an effect
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* 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
*
@@ -87,7 +87,6 @@ private:
knob * m_gate;
QMdiSubWindow * m_subWindow;
EffectControlDialog * m_controlView;
bool m_show;
} ;

View File

@@ -2,7 +2,7 @@
* effect_view.cpp - view-component for an effect
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* 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
*
@@ -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 );
}