FxMixerView.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * FxMixerView.h - effect-mixer-view for LMMS
  3. *
  4. * Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef FX_MIXER_VIEW_H
  25. #define FX_MIXER_VIEW_H
  26. #include <QWidget>
  27. #include <QHBoxLayout>
  28. #include <QStackedLayout>
  29. #include <QScrollArea>
  30. #include "ModelView.h"
  31. #include "Engine.h"
  32. #include "Fader.h"
  33. #include "PixmapButton.h"
  34. #include "ToolTip.h"
  35. #include "embed.h"
  36. #include "EffectRackView.h"
  37. class QButtonGroup;
  38. class FxLine;
  39. class EXPORT FxMixerView : public QWidget, public ModelView,
  40. public SerializingObjectHook
  41. {
  42. Q_OBJECT
  43. public:
  44. class FxChannelView
  45. {
  46. public:
  47. FxChannelView(QWidget * _parent, FxMixerView * _mv, int _chIndex );
  48. void setChannelIndex( int index );
  49. FxLine * m_fxLine;
  50. PixmapButton * m_muteBtn;
  51. PixmapButton * m_soloBtn;
  52. Fader * m_fader;
  53. EffectRackView * m_rackView;
  54. };
  55. FxMixerView();
  56. virtual ~FxMixerView();
  57. virtual void keyPressEvent(QKeyEvent * e);
  58. virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
  59. virtual void loadSettings( const QDomElement & _this );
  60. inline FxLine * currentFxLine()
  61. {
  62. return m_currentFxLine;
  63. }
  64. inline FxChannelView * channelView(int index)
  65. {
  66. return m_fxChannelViews[index];
  67. }
  68. void setCurrentFxLine( FxLine * _line );
  69. void setCurrentFxLine( int _line );
  70. void clear();
  71. // display the send button and knob correctly
  72. void updateFxLine(int index);
  73. // notify the view that an fx channel was deleted
  74. void deleteChannel(int index);
  75. // delete all unused channels
  76. void deleteUnusedChannels();
  77. // move the channel to the left or right
  78. void moveChannelLeft(int index);
  79. void moveChannelLeft(int index, int focusIndex);
  80. void moveChannelRight(int index);
  81. // make sure the display syncs up with the fx mixer.
  82. // useful for loading projects
  83. void refreshDisplay();
  84. public slots:
  85. int addNewChannel();
  86. protected:
  87. virtual void closeEvent( QCloseEvent * _ce );
  88. private slots:
  89. void updateFaders();
  90. void toggledSolo();
  91. private:
  92. QVector<FxChannelView *> m_fxChannelViews;
  93. FxLine * m_currentFxLine;
  94. QScrollArea * channelArea;
  95. QHBoxLayout * chLayout;
  96. QWidget * m_channelAreaWidget;
  97. QStackedLayout * m_racksLayout;
  98. QWidget * m_racksWidget;
  99. void updateMaxChannelSelector();
  100. friend class FxChannelView;
  101. } ;
  102. #endif