123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- /*
- * TrackView.h - declaration of TrackView class
- *
- * Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
- *
- * This file is part of LMMS - https://lmms.io
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program (see COPYING); if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA.
- *
- */
- #ifndef TRACK_VIEW_H
- #define TRACK_VIEW_H
- #include <QWidget>
- #include "JournallingObject.h"
- #include "ModelView.h"
- #include "TrackContentWidget.h"
- #include "TrackOperationsWidget.h"
- class QMenu;
- class FadeButton;
- class Track;
- class TrackContainerView;
- class Clip;
- const int DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
- const int TRACK_OP_WIDTH = 78;
- // This shaves 150-ish pixels off track buttons,
- // ruled from config: ui.compacttrackbuttons
- const int DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT = 96;
- const int TRACK_OP_WIDTH_COMPACT = 62;
- const int CLIP_BORDER_WIDTH = 2;
- class TrackView : public QWidget, public ModelView, public JournallingObject
- {
- Q_OBJECT
- public:
- TrackView( Track * _track, TrackContainerView* tcv );
- virtual ~TrackView();
- inline const Track * getTrack() const
- {
- return m_track;
- }
- inline Track * getTrack()
- {
- return m_track;
- }
- inline TrackContainerView* trackContainerView()
- {
- return m_trackContainerView;
- }
- inline TrackOperationsWidget * getTrackOperationsWidget()
- {
- return &m_trackOperationsWidget;
- }
- inline QWidget * getTrackSettingsWidget()
- {
- return &m_trackSettingsWidget;
- }
- inline TrackContentWidget * getTrackContentWidget()
- {
- return &m_trackContentWidget;
- }
- bool isMovingTrack() const
- {
- return m_action == MoveTrack;
- }
- virtual void update();
- // Create a menu for assigning/creating channels for this track
- // Currently instrument track and sample track supports it
- virtual QMenu * createMixerMenu(QString title, QString newMixerLabel);
- public slots:
- virtual bool close();
- protected:
- void modelChanged() override;
- void saveSettings( QDomDocument& doc, QDomElement& element ) override
- {
- Q_UNUSED(doc)
- Q_UNUSED(element)
- }
- void loadSettings( const QDomElement& element ) override
- {
- Q_UNUSED(element)
- }
- QString nodeName() const override
- {
- return "trackview";
- }
- void dragEnterEvent( QDragEnterEvent * dee ) override;
- void dropEvent( QDropEvent * de ) override;
- void mousePressEvent( QMouseEvent * me ) override;
- void mouseMoveEvent( QMouseEvent * me ) override;
- void mouseReleaseEvent( QMouseEvent * me ) override;
- void paintEvent( QPaintEvent * pe ) override;
- void resizeEvent( QResizeEvent * re ) override;
- private:
- enum Actions
- {
- NoAction,
- MoveTrack,
- ResizeTrack
- } ;
- Track * m_track;
- TrackContainerView * m_trackContainerView;
- TrackOperationsWidget m_trackOperationsWidget;
- QWidget m_trackSettingsWidget;
- TrackContentWidget m_trackContentWidget;
- Actions m_action;
- virtual FadeButton * getActivityIndicator()
- {
- return nullptr;
- }
- void setIndicatorMute(FadeButton* indicator, bool muted);
- friend class TrackLabelButton;
- private slots:
- void createClipView( Clip * clip );
- void muteChanged();
- } ;
- #endif
|