LMMS
Loading...
Searching...
No Matches
Clip.h
Go to the documentation of this file.
1/*
2 * TrackConteintObject.h - declaration of Clip class
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
25#ifndef LMMS_CLIP_H
26#define LMMS_CLIP_H
27
28#include <optional>
29
30#include <QColor>
31
32#include "AutomatableModel.h"
33
34
35namespace lmms
36{
37
38class Track;
39
40namespace gui
41{
42
43class ClipView;
44class TrackView;
45
46} // namespace gui
47
48
49class LMMS_EXPORT Clip : public Model, public JournallingObject
50{
51 Q_OBJECT
52 mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel);
53 mapPropertyFromModel(bool,isSolo,setSolo,m_soloModel);
54public:
55 Clip( Track * track );
56 ~Clip() override;
57
58 inline Track * getTrack() const
59 {
60 return m_track;
61 }
62
63 inline const QString & name() const
64 {
65 return m_name;
66 }
67
68 inline void setName( const QString & name )
69 {
70 m_name = name;
71 emit dataChanged();
72 }
73
74 QString displayName() const override
75 {
76 return name();
77 }
78
79
80 inline const TimePos & startPosition() const
81 {
82 return m_startPosition;
83 }
84
85 inline TimePos endPosition() const
86 {
87 const int sp = m_startPosition;
88 return sp + m_length;
89 }
90
91 inline const TimePos & length() const
92 {
93 return m_length;
94 }
95
96
97 bool hasTrackContainer() const;
98
99 bool isInPattern() const;
100
101 bool manuallyResizable() const;
102
109 void setAutoResize(const bool r)
110 {
111 m_autoResize = r;
112 }
113
114 bool getAutoResize() const
115 {
116 return m_autoResize;
117 }
118
119 auto color() const -> const std::optional<QColor>& { return m_color; }
120 void setColor(const std::optional<QColor>& color);
121
122 virtual void movePosition( const TimePos & pos );
123 virtual void changeLength( const TimePos & length );
124 virtual void updateLength() {};
125
127
128 inline void selectViewOnCreate( bool select )
129 {
130 m_selectViewOnCreate = select;
131 }
132
134 {
136 }
137
139 static bool comparePosition(const Clip* a, const Clip* b);
140
141 TimePos startTimeOffset() const;
142 void setStartTimeOffset( const TimePos &startTimeOffset );
143
144 // Will copy the state of a clip to another clip
145 static void copyStateTo( Clip *src, Clip *dst );
146
151 virtual Clip* clone() = 0;
152
153public slots:
154 void toggleMute();
155
156
157signals:
162
163protected:
164 Clip(const Clip& other);
165
166private:
168 QString m_name;
169
173
176 bool m_autoResize = true;
177
179
180 std::optional<QColor> m_color;
181
182 friend class ClipView;
183
184} ;
185
186
187} // namespace lmms
188
189#endif // LMMS_CLIP_H
uint8_t a
Definition Spc_Cpu.h:141
uint8_t sp
Definition Spc_Cpu.h:145
Definition AutomatableModel.h:497
Definition Clip.h:50
virtual Clip * clone()=0
friend class ClipView
Definition Clip.h:182
mapPropertyFromModel(bool, isMuted, setMuted, m_mutedModel)
TimePos m_startTimeOffset
Definition Clip.h:172
BoolModel m_mutedModel
Definition Clip.h:174
QString m_name
Definition Clip.h:168
virtual gui::ClipView * createView(gui::TrackView *tv)=0
virtual void updateLength()
Definition Clip.h:124
void selectViewOnCreate(bool select)
Definition Clip.h:128
std::optional< QColor > m_color
Definition Clip.h:180
QString displayName() const override
Definition Clip.h:74
const QString & name() const
Definition Clip.h:63
void toggleMute()
Mutes this Clip.
Definition Clip.cpp:203
void positionChanged()
void colorChanged()
Clip(Track *track)
Create a new Clip.
Definition Clip.cpp:47
bool m_autoResize
Definition Clip.h:176
const TimePos & startPosition() const
Definition Clip.h:80
auto color() const -> const std::optional< QColor > &
Definition Clip.h:119
void destroyedClip()
bool getSelectViewOnCreate()
Definition Clip.h:133
TimePos endPosition() const
Definition Clip.h:85
Track * m_track
Definition Clip.h:167
bool getAutoResize() const
Definition Clip.h:114
Track * getTrack() const
Definition Clip.h:58
bool m_selectViewOnCreate
Definition Clip.h:178
BoolModel m_soloModel
Definition Clip.h:175
mapPropertyFromModel(bool, isSolo, setSolo, m_soloModel)
const TimePos & length() const
Definition Clip.h:91
TimePos m_startPosition
Definition Clip.h:170
void lengthChanged()
TimePos m_length
Definition Clip.h:171
void setAutoResize(const bool r)
Set whether a clip has been resized yet by the user or the knife tool.
Definition Clip.h:109
void setName(const QString &name)
Definition Clip.h:68
JournallingObject()
Definition JournallingObject.cpp:36
void dataChanged()
Model(Model *parent, QString displayName=QString(), bool defaultConstructed=false)
Definition Model.cpp:30
Definition TimePos.h:68
Base-class for all tracks.
Definition Track.h:68
Definition ClipView.h:52
Definition TrackView.h:60
static const char * name
Definition pugl.h:1582
Definition AudioPortAudio.cpp:223
Definition AudioAlsa.cpp:35
Definition juce_Uuid.h:141
png_uint_32 length
Definition png.c:2247
int r
Definition crypt.c:458
b
Definition crypt.c:628
#define const
Definition zconf.h:137