FxMixerView.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 LMMS_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. void keyPressEvent(QKeyEvent * e) override;
  58. void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
  59. void loadSettings( const QDomElement & _this ) override;
  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. void renameChannel(int index);
  82. // make sure the display syncs up with the fx 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<FxChannelView *> m_fxChannelViews;
  94. FxLine * m_currentFxLine;
  95. QScrollArea * channelArea;
  96. QHBoxLayout * chLayout;
  97. QWidget * m_channelAreaWidget;
  98. QStackedLayout * m_racksLayout;
  99. QWidget * m_racksWidget;
  100. void updateMaxChannelSelector();
  101. friend class FxChannelView;
  102. } ;
  103. #endif