MixerView.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * MixerView.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 MIXER_VIEW_H
  25. #define 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 MixerLine;
  39. class LMMS_EXPORT MixerView : public QWidget, public ModelView,
  40. public SerializingObjectHook
  41. {
  42. Q_OBJECT
  43. public:
  44. class MixerChannelView
  45. {
  46. public:
  47. MixerChannelView(QWidget * _parent, MixerView * _mv, int _chIndex );
  48. void setChannelIndex( int index );
  49. MixerLine * m_mixerLine;
  50. PixmapButton * m_muteBtn;
  51. PixmapButton * m_soloBtn;
  52. Fader * m_fader;
  53. EffectRackView * m_rackView;
  54. };
  55. MixerView();
  56. virtual ~MixerView();
  57. void keyPressEvent(QKeyEvent * e) override;
  58. void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
  59. void loadSettings( const QDomElement & _this ) override;
  60. inline MixerLine * currentMixerLine()
  61. {
  62. return m_currentMixerLine;
  63. }
  64. inline MixerChannelView * channelView(int index)
  65. {
  66. return m_mixerChannelViews[index];
  67. }
  68. void setCurrentMixerLine( MixerLine * _line );
  69. void setCurrentMixerLine( int _line );
  70. void clear();
  71. // display the send button and knob correctly
  72. void updateMixerLine(int index);
  73. // notify the view that a mixer 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. void renameChannel(int index);
  82. // make sure the display syncs up with the mixer.
  83. // useful for loading projects
  84. void refreshDisplay();
  85. public slots:
  86. int addNewChannel();
  87. protected:
  88. void closeEvent( QCloseEvent * _ce ) override;
  89. private slots:
  90. void updateFaders();
  91. void toggledSolo();
  92. private:
  93. QVector<MixerChannelView *> m_mixerChannelViews;
  94. MixerLine * m_currentMixerLine;
  95. QScrollArea * channelArea;
  96. QHBoxLayout * chLayout;
  97. QWidget * m_channelAreaWidget;
  98. QStackedLayout * m_racksLayout;
  99. QWidget * m_racksWidget;
  100. void updateMaxChannelSelector();
  101. friend class MixerChannelView;
  102. } ;
  103. #endif