File: DualFilterControlDialog.cpp

package info (click to toggle)
lmms 1.2.2%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 55,184 kB
  • sloc: cpp: 159,844; ansic: 98,570; python: 2,555; sh: 551; makefile: 27; xml: 18
file content (87 lines) | stat: -rwxr-xr-x 3,471 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * DualFilterControlDialog.cpp - control dialog for dual filter effect
 *
 * Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
 * Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 *
 * This file is part of LMMS - https://lmms.io
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program (see COPYING); if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA.
 *
 */

#include <QLayout>

#include "DualFilterControlDialog.h"
#include "DualFilterControls.h"
#include "embed.h"
#include "LedCheckbox.h"
#include "ComboBox.h"
#include "ToolTip.h"
#include "gui_templates.h"

#define makeknob( name, x, y, model, label, hint, unit ) 	\
	Knob * name = new Knob( knobBright_26, this); 			\
	name -> move( x, y );									\
	name ->setModel( &controls-> model );					\
	name ->setLabel( label );							\
	name ->setHintText( hint, unit );



DualFilterControlDialog::DualFilterControlDialog( DualFilterControls* controls ) :
	EffectControlDialog( controls )
{
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) );
	setPalette( pal );
	setFixedSize( 373, 109 );

	makeknob( cut1Knob, 24, 26, m_cut1Model, tr( "FREQ" ), tr( "Cutoff frequency" ), "Hz" )
	makeknob( res1Knob, 74, 26, m_res1Model, tr( "RESO" ), tr( "Resonance" ), "" )
	makeknob( gain1Knob, 124, 26, m_gain1Model, tr( "GAIN" ), tr( "Gain" ), "%" )
	makeknob( mixKnob, 173, 37, m_mixModel, tr( "MIX" ), tr( "Mix" ), "" )
	makeknob( cut2Knob, 222, 26, m_cut2Model, tr( "FREQ" ), tr( "Cutoff frequency" ), "Hz" )
	makeknob( res2Knob, 272, 26, m_res2Model, tr( "RESO" ), tr( "Resonance" ), "" )
	makeknob( gain2Knob, 322, 26, m_gain2Model, tr( "GAIN" ), tr( "Gain" ), "%" )

	gain1Knob-> setVolumeKnob( true );
	gain2Knob-> setVolumeKnob( true );

	LedCheckBox * enabled1Toggle = new LedCheckBox( "", this,
				tr( "Filter 1 enabled" ), LedCheckBox::Green );
	LedCheckBox * enabled2Toggle = new LedCheckBox( "", this,
				tr( "Filter 2 enabled" ), LedCheckBox::Green );

	enabled1Toggle -> move( 12, 11 );
	enabled1Toggle -> setModel( &controls -> m_enabled1Model );
	ToolTip::add( enabled1Toggle, tr( "Click to enable/disable Filter 1" ) );
	enabled2Toggle -> move( 210, 11 );
	enabled2Toggle -> setModel( &controls -> m_enabled2Model );
	ToolTip::add( enabled2Toggle, tr( "Click to enable/disable Filter 2" ) );

	ComboBox * m_filter1ComboBox = new ComboBox( this );
	m_filter1ComboBox->setGeometry( 19, 70, 137, 22 );
	m_filter1ComboBox->setFont( pointSize<8>( m_filter1ComboBox->font() ) );
	m_filter1ComboBox->setModel( &controls->m_filter1Model );

	ComboBox * m_filter2ComboBox = new ComboBox( this );
	m_filter2ComboBox->setGeometry( 217, 70, 137, 22 );
	m_filter2ComboBox->setFont( pointSize<8>( m_filter2ComboBox->font() ) );
	m_filter2ComboBox->setModel( &controls->m_filter2Model );
}