LMMS
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:
63 TrackView( Track * _track, TrackContainerView* tcv );
64 ~TrackView() override = default;
65
66 inline const Track * getTrack() const
67 {
68 return m_track;
69 }
70
71 inline Track * getTrack()
72 {
73 return m_track;
74 }
75
80
85
86 inline QWidget * getTrackSettingsWidget()
87 {
89 }
90
95
96 bool isMovingTrack() const
97 {
98 return m_action == Action::Move;
99 }
100
101 virtual void update();
102
103 // Create a menu for assigning/creating channels for this track
104 // Currently instrument track and sample track supports it
105 virtual QMenu * createMixerMenu(QString title, QString newMixerLabel);
106
107
108public slots:
109 virtual bool close();
110
111
112protected:
113 void modelChanged() override;
114
115 void saveSettings( QDomDocument& doc, QDomElement& element ) override
116 {
117 Q_UNUSED(doc)
118 Q_UNUSED(element)
119 }
120
121 void loadSettings( const QDomElement& element ) override
122 {
123 Q_UNUSED(element)
124 }
125
126 QString nodeName() const override
127 {
128 return "trackview";
129 }
130
131
132 void dragEnterEvent( QDragEnterEvent * dee ) override;
133 void dropEvent( QDropEvent * de ) override;
134 void mousePressEvent( QMouseEvent * me ) override;
135 void mouseMoveEvent( QMouseEvent * me ) override;
136 void mouseReleaseEvent( QMouseEvent * me ) override;
137 void wheelEvent(QWheelEvent* we) override;
138 void paintEvent( QPaintEvent * pe ) override;
139 void resizeEvent( QResizeEvent * re ) override;
140
141private:
142 void resizeToHeight(int height);
143
144private:
145 enum class Action
146 {
150 } ;
151
154
158
160
162 {
163 return nullptr;
164 }
165
166 void setIndicatorMute(FadeButton* indicator, bool muted);
167
168 friend class TrackLabelButton;
169
170
171private slots:
172 void createClipView( lmms::Clip * clip );
173 void muteChanged();
174 void onTrackGripGrabbed();
175 void onTrackGripReleased();
176} ;
177
178
179} // namespace gui
180
181} // namespace lmms
182
183#endif // LMMS_GUI_TRACK_VIEW_H
Definition Clip.h:50
JournallingObject()
Definition JournallingObject.cpp:36
Base-class for all tracks.
Definition Track.h:68
Definition FadeButton.h:38
ModelView(Model *model, QWidget *widget)
Definition ModelView.cpp:33
Definition TrackContainerView.h:71
Definition TrackContentWidget.h:48
Definition TrackOperationsWidget.h:40
TrackContainerView * m_trackContainerView
Definition TrackView.h:153
friend class TrackLabelButton
Definition TrackView.h:168
TrackOperationsWidget * getTrackOperationsWidget()
Definition TrackView.h:81
void dragEnterEvent(QDragEnterEvent *dee) override
Start a drag event on this track View.
Definition TrackView.cpp:212
virtual bool close()
Close this track View.
Definition TrackView.cpp:182
void muteChanged()
Definition TrackView.cpp:439
void dropEvent(QDropEvent *de) override
Accept a drop event on this track View.
Definition TrackView.cpp:229
Action m_action
Definition TrackView.h:159
void modelChanged() override
Register that the model of this track View has changed.
Definition TrackView.cpp:194
virtual void update()
Update this track View and all its content objects.
Definition TrackView.cpp:153
QWidget m_trackSettingsWidget
Definition TrackView.h:156
virtual QMenu * createMixerMenu(QString title, QString newMixerLabel)
Create a menu for assigning/creating channels for this track.
Definition TrackView.cpp:169
void resizeToHeight(int height)
Definition TrackView.cpp:465
void saveSettings(QDomDocument &doc, QDomElement &element) override
Definition TrackView.h:115
~TrackView() override=default
void resizeEvent(QResizeEvent *re) override
Resize this track View.
Definition TrackView.cpp:131
TrackOperationsWidget m_trackOperationsWidget
Definition TrackView.h:155
void wheelEvent(QWheelEvent *we) override
Definition TrackView.cpp:384
const Track * getTrack() const
Definition TrackView.h:66
QWidget * getTrackSettingsWidget()
Definition TrackView.h:86
void paintEvent(QPaintEvent *pe) override
Repaint this track View.
Definition TrackView.cpp:410
TrackContainerView * trackContainerView()
Definition TrackView.h:76
QString nodeName() const override
Definition TrackView.h:126
void createClipView(lmms::Clip *clip)
Create a Clip View in this track View.
Definition TrackView.cpp:426
Track * getTrack()
Definition TrackView.h:71
bool isMovingTrack() const
Definition TrackView.h:96
void onTrackGripReleased()
Definition TrackView.cpp:451
void mousePressEvent(QMouseEvent *me) override
Handle a mouse press event on this track View.
Definition TrackView.cpp:261
virtual FadeButton * getActivityIndicator()
Definition TrackView.h:161
void mouseReleaseEvent(QMouseEvent *me) override
Handle a mouse release event on this track View.
Definition TrackView.cpp:372
Action
Definition TrackView.h:146
@ Move
Definition TrackView.h:148
@ Resize
Definition TrackView.h:149
void onTrackGripGrabbed()
Definition TrackView.cpp:446
void setIndicatorMute(FadeButton *indicator, bool muted)
Definition TrackView.cpp:458
TrackContentWidget * getTrackContentWidget()
Definition TrackView.h:91
TrackView(Track *_track, TrackContainerView *tcv)
Create a new track View.
Definition TrackView.cpp:61
Track * m_track
Definition TrackView.h:152
TrackContentWidget m_trackContentWidget
Definition TrackView.h:157
void mouseMoveEvent(QMouseEvent *me) override
Handle a mouse move event on this track View.
Definition TrackView.cpp:319
void loadSettings(const QDomElement &element) override
Definition TrackView.h:121
static const char * title
Definition pugl.h:1747
static int int height
Definition pugl.h:1594
Definition AudioPortAudio.cpp:223
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 AudioAlsa.cpp:35
const float muted
Definition tuning.h:12
static ZCONST char Far None[]
Definition unzip.c:380