waveshaper_control_dialog.cpp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * waveshaper_control_dialog.cpp - control-dialog for waveshaper-effect
  3. *
  4. * Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
  5. * Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #include <QLayout>
  26. #include "waveshaper_control_dialog.h"
  27. #include "waveshaper_controls.h"
  28. #include "embed.h"
  29. #include "Graph.h"
  30. #include "PixmapButton.h"
  31. #include "ToolTip.h"
  32. #include "LedCheckbox.h"
  33. waveShaperControlDialog::waveShaperControlDialog(
  34. waveShaperControls * _controls ) :
  35. EffectControlDialog( _controls )
  36. {
  37. setAutoFillBackground( true );
  38. QPalette pal;
  39. pal.setBrush( backgroundRole(),
  40. PLUGIN_NAME::getIconPixmap( "artwork" ) );
  41. setPalette( pal );
  42. setFixedSize( 224, 274 );
  43. Graph * waveGraph = new Graph( this, Graph::LinearNonCyclicStyle, 204, 205 );
  44. waveGraph -> move( 10, 6 );
  45. waveGraph -> setModel( &_controls -> m_wavegraphModel );
  46. waveGraph -> setAutoFillBackground( true );
  47. pal = QPalette();
  48. pal.setBrush( backgroundRole(),
  49. PLUGIN_NAME::getIconPixmap("wavegraph") );
  50. waveGraph->setPalette( pal );
  51. waveGraph->setGraphColor( QColor( 85, 204, 145 ) );
  52. waveGraph -> setMaximumSize( 204, 205 );
  53. Knob * inputKnob = new Knob( knobBright_26, this);
  54. inputKnob -> setVolumeKnob( true );
  55. inputKnob -> setVolumeRatio( 1.0 );
  56. inputKnob -> move( 26, 225 );
  57. inputKnob->setModel( &_controls->m_inputModel );
  58. inputKnob->setLabel( tr( "INPUT" ) );
  59. inputKnob->setHintText( tr( "Input gain:" ) , "" );
  60. Knob * outputKnob = new Knob( knobBright_26, this );
  61. outputKnob -> setVolumeKnob( true );
  62. outputKnob -> setVolumeRatio( 1.0 );
  63. outputKnob -> move( 76, 225 );
  64. outputKnob->setModel( &_controls->m_outputModel );
  65. outputKnob->setLabel( tr( "OUTPUT" ) );
  66. outputKnob->setHintText( tr( "Output gain:" ), "" );
  67. PixmapButton * resetButton = new PixmapButton( this, tr("Reset waveform") );
  68. resetButton -> move( 162, 221 );
  69. resetButton -> resize( 13, 46 );
  70. resetButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "reset_active" ) );
  71. resetButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "reset_inactive" ) );
  72. ToolTip::add( resetButton, tr( "Click here to reset the wavegraph back to default" ) );
  73. PixmapButton * smoothButton = new PixmapButton( this, tr("Smooth waveform") );
  74. smoothButton -> move( 162, 237 );
  75. smoothButton -> resize( 13, 46 );
  76. smoothButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_active" ) );
  77. smoothButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_inactive" ) );
  78. ToolTip::add( smoothButton, tr( "Click here to apply smoothing to wavegraph" ) );
  79. PixmapButton * addOneButton = new PixmapButton( this, tr("Increase graph amplitude by 1dB") );
  80. addOneButton -> move( 131, 221 );
  81. addOneButton -> resize( 13, 29 );
  82. addOneButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "add1_active" ) );
  83. addOneButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "add1_inactive" ) );
  84. ToolTip::add( addOneButton, tr( "Click here to increase wavegraph amplitude by 1dB" ) );
  85. PixmapButton * subOneButton = new PixmapButton( this, tr("Decrease graph amplitude by 1dB") );
  86. subOneButton -> move( 131, 237 );
  87. subOneButton -> resize( 13, 29 );
  88. subOneButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sub1_active" ) );
  89. subOneButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "sub1_inactive" ) );
  90. ToolTip::add( subOneButton, tr( "Click here to decrease wavegraph amplitude by 1dB" ) );
  91. LedCheckBox * clipInputToggle = new LedCheckBox( "Clip input", this,
  92. tr( "Clip input" ), LedCheckBox::Green );
  93. clipInputToggle -> move( 131, 252 );
  94. clipInputToggle -> setModel( &_controls -> m_clipModel );
  95. ToolTip::add( clipInputToggle, tr( "Clip input signal to 0dB" ) );
  96. connect( resetButton, SIGNAL (clicked () ),
  97. _controls, SLOT ( resetClicked() ) );
  98. connect( smoothButton, SIGNAL (clicked () ),
  99. _controls, SLOT ( smoothClicked() ) );
  100. connect( addOneButton, SIGNAL( clicked() ),
  101. _controls, SLOT( addOneClicked() ) );
  102. connect( subOneButton, SIGNAL( clicked() ),
  103. _controls, SLOT( subOneClicked() ) );
  104. }