FxLine.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * FxLine.h - FX line widget
  3. *
  4. * Copyright (c) 2009 Andrew Kelley <superjoe30/at/gmail/dot/com>
  5. * Copyright (c) 2014 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. #ifndef FX_LINE_H
  26. #define FX_LINE_H
  27. #include <QGraphicsView>
  28. #include <QLineEdit>
  29. #include <QWidget>
  30. #include "Knob.h"
  31. #include "LcdWidget.h"
  32. #include "SendButtonIndicator.h"
  33. class FxMixerView;
  34. class SendButtonIndicator;
  35. class FxLine : public QWidget
  36. {
  37. Q_OBJECT
  38. public:
  39. Q_PROPERTY( QBrush backgroundActive READ backgroundActive WRITE setBackgroundActive )
  40. Q_PROPERTY( QColor strokeOuterActive READ strokeOuterActive WRITE setStrokeOuterActive )
  41. Q_PROPERTY( QColor strokeOuterInactive READ strokeOuterInactive WRITE setStrokeOuterInactive )
  42. Q_PROPERTY( QColor strokeInnerActive READ strokeInnerActive WRITE setStrokeInnerActive )
  43. Q_PROPERTY( QColor strokeInnerInactive READ strokeInnerInactive WRITE setStrokeInnerInactive )
  44. FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex);
  45. ~FxLine();
  46. virtual void paintEvent( QPaintEvent * );
  47. virtual void mousePressEvent( QMouseEvent * );
  48. virtual void mouseDoubleClickEvent( QMouseEvent * );
  49. virtual void contextMenuEvent( QContextMenuEvent * );
  50. inline int channelIndex() { return m_channelIndex; }
  51. void setChannelIndex(int index);
  52. Knob * m_sendKnob;
  53. SendButtonIndicator * m_sendBtn;
  54. QBrush backgroundActive() const;
  55. void setBackgroundActive( const QBrush & c );
  56. QColor strokeOuterActive() const;
  57. void setStrokeOuterActive( const QColor & c );
  58. QColor strokeOuterInactive() const;
  59. void setStrokeOuterInactive( const QColor & c );
  60. QColor strokeInnerActive() const;
  61. void setStrokeInnerActive( const QColor & c );
  62. QColor strokeInnerInactive() const;
  63. void setStrokeInnerInactive( const QColor & c );
  64. static const int FxLineHeight;
  65. private:
  66. void drawFxLine( QPainter* p, const FxLine *fxLine, bool isActive, bool sendToThis, bool receiveFromThis );
  67. QString elideName( const QString & name );
  68. FxMixerView * m_mv;
  69. LcdWidget* m_lcd;
  70. int m_channelIndex;
  71. QBrush m_backgroundActive;
  72. QColor m_strokeOuterActive;
  73. QColor m_strokeOuterInactive;
  74. QColor m_strokeInnerActive;
  75. QColor m_strokeInnerInactive;
  76. static QPixmap * s_sendBgArrow;
  77. static QPixmap * s_receiveBgArrow;
  78. bool m_inRename;
  79. QLineEdit * m_renameLineEdit;
  80. QGraphicsView * m_view;
  81. private slots:
  82. void renameChannel();
  83. void renameFinished();
  84. void removeChannel();
  85. void removeUnusedChannels();
  86. void moveChannelLeft();
  87. void moveChannelRight();
  88. void displayHelp();
  89. };
  90. #endif // FXLINE_H