125 lines
2.8 KiB
C++
125 lines
2.8 KiB
C++
#ifndef TRACK_H
|
|
#define TRACK_H
|
|
|
|
#include <QVector>
|
|
#include <memory>
|
|
|
|
#include "nodes/oldeffectnode.h"
|
|
#include "tracktypes.h"
|
|
#include "undo/comboaction.h"
|
|
#include "timeline/selection.h"
|
|
#include "nodes/node.h"
|
|
|
|
class Sequence;
|
|
class Transition;
|
|
|
|
namespace olive {
|
|
namespace timeline {
|
|
const int kGhostThickness = 2;
|
|
const int kClipTextPadding = 3;
|
|
|
|
/**
|
|
* @brief Set default track sizes
|
|
*
|
|
* Olive has a few default constants used for adjusting track heights in the Timeline. For HiDPI, it makes
|
|
* sense to multiply these by the current DPI scale. It uses a variable from QApplication to do this multiplication,
|
|
* which means the QApplication instance needs to be instantiated before these are calculated. Therefore, call this
|
|
* function ONCE after QApplication is created to multiply the track heights correctly.
|
|
*/
|
|
void MultiplyTrackSizesByDPI();
|
|
|
|
extern int kTrackDefaultHeight;
|
|
extern int kTrackMinHeight;
|
|
extern int kTrackHeightIncrement;
|
|
|
|
extern int kTimelineLabelFixedWidth;
|
|
}
|
|
}
|
|
|
|
class Sequence;
|
|
|
|
class Track : public Node
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
Track(Sequence* parent, olive::TrackType type);
|
|
Track* copy(Sequence* parent);
|
|
|
|
Sequence* sequence();
|
|
|
|
void Save(QXmlStreamWriter& stream);
|
|
|
|
olive::TrackType type();
|
|
|
|
int height();
|
|
void set_height(int h);
|
|
|
|
QString name();
|
|
void SetName(const QString& s);
|
|
|
|
void AddClip(ClipPtr clip);
|
|
int ClipCount();
|
|
ClipPtr GetClip(int i);
|
|
void RemoveClip(int i);
|
|
void RemoveClip(Clip* c);
|
|
QVector<Clip*> GetAllClips();
|
|
QVector<Clip*> GetSelectedClips(bool containing);
|
|
ClipPtr GetClipObjectFromRawPtr(Clip* c);
|
|
Clip* GetClipFromPoint(long point);
|
|
bool ContainsClip(Clip* c);
|
|
|
|
Track* Previous();
|
|
Track* Next();
|
|
Track* Sibling(int diff);
|
|
|
|
int Index();
|
|
|
|
bool IsClipSelected(int clip_index, bool containing = true);
|
|
bool IsClipSelected(Clip* clip, bool containing = true);
|
|
bool IsTransitionSelected(Transition* t);
|
|
|
|
void DeleteArea(ComboAction *ca, const Selection& s);
|
|
void DeleteArea(ComboAction *ca, long in, long out);
|
|
|
|
void SelectArea(long in, long out);
|
|
void SelectClip(Clip *c);
|
|
void SelectAll();
|
|
void SelectAtPoint(long point);
|
|
void TidySelections();
|
|
void ClearSelections();
|
|
void DeselectArea(long in, long out);
|
|
QVector<Selection> Selections();
|
|
|
|
long GetEndFrame();
|
|
|
|
bool IsEffectivelyMuted();
|
|
bool IsMuted();
|
|
bool IsSoloed();
|
|
bool IsLocked();
|
|
|
|
public slots:
|
|
void SetMuted(bool muted);
|
|
void SetSoloed(bool soloed);
|
|
void SetLocked(bool locked);
|
|
|
|
signals:
|
|
void HeightChanged(int height);
|
|
|
|
private:
|
|
void ResizeClipArray(int new_size);
|
|
|
|
olive::TrackType type_;
|
|
int height_;
|
|
QVector<ClipPtr> clips_;
|
|
QVector<OldEffectNodePtr> effects_;
|
|
QVector<Selection> selections_;
|
|
|
|
bool muted_;
|
|
bool soloed_;
|
|
bool locked_;
|
|
|
|
QString name_;
|
|
};
|
|
|
|
#endif // TRACK_H
|