PatternTrack.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * PatternTrack.h - a track representing a pattern in the PatternStore
  3. *
  4. * Copyright (c) 2004-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 PATTERN_TRACK_H
  25. #define PATTERN_TRACK_H
  26. #include <QtCore/QMap>
  27. #include "PatternClipView.h"
  28. #include "Track.h"
  29. class TrackLabelButton;
  30. class TrackContainer;
  31. /*! Track type used in the Song (Editor) to reference a pattern in the PatternStore */
  32. class LMMS_EXPORT PatternTrack : public Track
  33. {
  34. Q_OBJECT
  35. public:
  36. PatternTrack(TrackContainer* tc);
  37. virtual ~PatternTrack();
  38. virtual bool play( const TimePos & _start, const fpp_t _frames,
  39. const f_cnt_t _frame_base, int _clip_num = -1 ) override;
  40. TrackView * createView( TrackContainerView* tcv ) override;
  41. Clip* createClip(const TimePos & pos) override;
  42. virtual void saveTrackSpecificSettings( QDomDocument & _doc,
  43. QDomElement & _parent ) override;
  44. void loadTrackSpecificSettings( const QDomElement & _this ) override;
  45. static PatternTrack* findPatternTrack(int pattern_num);
  46. static void swapPatternTracks(Track* track1, Track* track2);
  47. int patternIndex()
  48. {
  49. return s_infoMap[this];
  50. }
  51. bool automationDisabled( Track * _track )
  52. {
  53. return( m_disabledTracks.contains( _track ) );
  54. }
  55. void disableAutomation( Track * _track )
  56. {
  57. m_disabledTracks.append( _track );
  58. }
  59. void enableAutomation( Track * _track )
  60. {
  61. m_disabledTracks.removeAll( _track );
  62. }
  63. protected:
  64. inline QString nodeName() const override
  65. {
  66. return "patterntrack";
  67. }
  68. private:
  69. QList<Track *> m_disabledTracks;
  70. typedef QMap<PatternTrack*, int> infoMap;
  71. static infoMap s_infoMap;
  72. friend class PatternTrackView;
  73. } ;
  74. #endif