lmms
Cross-platform music production software
Loading...
Searching...
No Matches
TrackView.h
Go to the documentation of this file.
1/*
2 * TrackView.h - declaration of TrackView 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_GUI_TRACK_VIEW_H
26#define LMMS_GUI_TRACK_VIEW_H
27
28#include <QWidget>
29
30#include "JournallingObject.h"
31#include "ModelView.h"
32#include "TrackContentWidget.h"
34
35class QMenu;
36
37namespace lmms
38{
39
40class Track;
41class Clip;
42
43
44namespace gui
45{
46
47class FadeButton;
49
50
52const int TRACK_OP_WIDTH = 78;
53// This shaves 150-ish pixels off track buttons,
54// ruled from config: ui.compacttrackbuttons
57
58
59class TrackView : public QWidget, public ModelView, public JournallingObject
60{
61 Q_OBJECT
62public:
71
72 ~TrackView() override = default;
73
74 inline const Track * getTrack() const
75 {
76 return m_track;
77 }
78
79 inline Track * getTrack()
80 {
81 return m_track;
82 }
83
88
93
94 inline QWidget * getTrackSettingsWidget()
95 {
97 }
98
103
104 bool isMovingTrack() const
105 {
106 return m_action == Action::Move;
107 }
108
110 virtual void update();
111
115 virtual QMenu* createMixerMenu(QString title, QString newMixerLabel);
116
117
118public slots:
119
121 virtual bool close();
122
123
124protected:
126 void modelChanged() override;
127
128 void saveSettings( QDomDocument& doc, QDomElement& element ) override
129 {
130 Q_UNUSED(doc)
131 Q_UNUSED(element)
132 }
133
134 void loadSettings( const QDomElement& element ) override
135 {
136 Q_UNUSED(element)
137 }
138
139 QString nodeName() const override
140 {
141 return "trackview";
142 }
143
144
147 void dragEnterEvent(QDragEnterEvent* dee) override;
148
155 void dropEvent(QDropEvent* de) override;
156
166 void mousePressEvent(QMouseEvent* me) override;
167
181 void mouseMoveEvent(QMouseEvent* me) override;
182
185 void mouseReleaseEvent(QMouseEvent* me) override;
186
187 void wheelEvent(QWheelEvent* we) override;
188
191 void paintEvent(QPaintEvent* pe) override;
192
195 void resizeEvent(QResizeEvent* re) override;
196
197private:
198 void resizeToHeight(int height);
199
200private:
201 enum class Action
202 {
204 Move,
205 Resize
206 } ;
207
210
214
216
218 {
219 return nullptr;
220 }
221
222 void setIndicatorMute(FadeButton* indicator, bool muted);
223
224 friend class TrackLabelButton;
225
226
227private slots:
230 void createClipView(lmms::Clip* clip);
231
232 void muteChanged();
233 void onTrackGripGrabbed();
234 void onTrackGripReleased();
235} ;
236
237
238} // namespace gui
239
240} // namespace lmms
241
242#endif // LMMS_GUI_TRACK_VIEW_H
Definition Clip.h:50
JournallingObject()
Definition JournallingObject.cpp:36
Base-class for all tracks.
Definition Track.h:67
Definition FadeButton.h:38
ModelView(Model *model, QWidget *widget)
Definition ModelView.cpp:33
Definition TrackContainerView.h:71
Definition TrackContentWidget.h:48
The grip and the mute/solo buttons of a track.
Definition TrackOperationsWidget.h:41
TrackContainerView * m_trackContainerView
Definition TrackView.h:209
friend class TrackLabelButton
Definition TrackView.h:224
TrackOperationsWidget * getTrackOperationsWidget()
Definition TrackView.h:89
void dragEnterEvent(QDragEnterEvent *dee) override
Start a drag event on this track View.
Definition TrackView.cpp:179
virtual bool close()
Close this track View.
Definition TrackView.cpp:156
void muteChanged()
Definition TrackView.cpp:356
void dropEvent(QDropEvent *de) override
Accept a drop event on this track View.
Definition TrackView.cpp:188
Action m_action
Definition TrackView.h:215
void modelChanged() override
Register that the model of this track View has changed.
Definition TrackView.cpp:165
virtual void update()
Update this track View and all its content objects.
Definition TrackView.cpp:133
QWidget m_trackSettingsWidget
Definition TrackView.h:212
virtual QMenu * createMixerMenu(QString title, QString newMixerLabel)
Create a menu for assigning/creating channels for this track.
Definition TrackView.cpp:146
void resizeToHeight(int height)
Definition TrackView.cpp:381
void saveSettings(QDomDocument &doc, QDomElement &element) override
Definition TrackView.h:128
~TrackView() override=default
TrackView(Track *track, TrackContainerView *tcv)
Create a new track View.
Definition TrackView.cpp:52
void resizeEvent(QResizeEvent *re) override
Resize this track View.
Definition TrackView.cpp:113
TrackOperationsWidget m_trackOperationsWidget
Definition TrackView.h:211
void wheelEvent(QWheelEvent *we) override
Definition TrackView.cpp:310
const Track * getTrack() const
Definition TrackView.h:74
QWidget * getTrackSettingsWidget()
Definition TrackView.h:94
void paintEvent(QPaintEvent *pe) override
Repaint this track View.
Definition TrackView.cpp:332
TrackContainerView * trackContainerView()
Definition TrackView.h:84
QString nodeName() const override
Definition TrackView.h:139
void createClipView(lmms::Clip *clip)
Create a Clip View in this track View.
Definition TrackView.cpp:343
Track * getTrack()
Definition TrackView.h:79
bool isMovingTrack() const
Definition TrackView.h:104
void onTrackGripReleased()
Definition TrackView.cpp:368
void mousePressEvent(QMouseEvent *me) override
Handle a mouse press event on this track View.
Definition TrackView.cpp:207
virtual FadeButton * getActivityIndicator()
Definition TrackView.h:217
void mouseReleaseEvent(QMouseEvent *me) override
Handle a mouse release event on this track View.
Definition TrackView.cpp:298
Action
Definition TrackView.h:202
@ None
Definition TrackView.h:203
@ Move
Definition TrackView.h:204
void onTrackGripGrabbed()
Definition TrackView.cpp:363
void setIndicatorMute(FadeButton *indicator, bool muted)
Definition TrackView.cpp:375
TrackContentWidget * getTrackContentWidget()
Definition TrackView.h:99
Track * m_track
Definition TrackView.h:208
TrackContentWidget m_trackContentWidget
Definition TrackView.h:213
void mouseMoveEvent(QMouseEvent *me) override
Handle a mouse move event on this track View.
Definition TrackView.cpp:249
void loadSettings(const QDomElement &element) override
Definition TrackView.h:134
Definition AudioPortAudio.cpp:209
const int TRACK_OP_WIDTH
Definition TrackView.h:52
const int TRACK_OP_WIDTH_COMPACT
Definition TrackView.h:56
const int DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT
Definition TrackView.h:55
const int DEFAULT_SETTINGS_WIDGET_WIDTH
Definition TrackView.h:51
Definition RemotePluginBase.cpp:34
@ None
Definition LadspaBase.h:49