diff --git a/dialogs/speeddialog.cpp b/dialogs/speeddialog.cpp index 9c82c2705..9b7cad23e 100644 --- a/dialogs/speeddialog.cpp +++ b/dialogs/speeddialog.cpp @@ -113,7 +113,7 @@ int SpeedDialog::exec() { } if (process_video) { - double media_frame_rate = c->MediaFrameRate(); + double media_frame_rate = c->media_frame_rate(); // get "default" frame rate" if (enable_frame_rate) { @@ -193,7 +193,7 @@ void SpeedDialog::percent_update() { // get frame rate if (frame_rate->isEnabled() && c->type() == olive::kTypeVideo) { - double clip_fr = c->MediaFrameRate() * percent->value(); + double clip_fr = c->media_frame_rate() * percent->value(); if (got_fr) { if (!qIsNaN(fr_val) && !qFuzzyCompare(fr_val, clip_fr)) { fr_val = qSNaN(); @@ -237,7 +237,7 @@ void SpeedDialog::duration_update() { // get frame rate if (frame_rate->isEnabled() && c->type() == olive::kTypeVideo) { - double clip_fr = c->MediaFrameRate() * clip_pc; + double clip_fr = c->media_frame_rate() * clip_pc; if (got_fr) { if (!qIsNaN(fr_val) && !qFuzzyCompare(fr_val, clip_fr)) { fr_val = qSNaN(); @@ -278,7 +278,7 @@ void SpeedDialog::frame_rate_update() { if (c->type() == olive::kTypeVideo) { // what would the new speed be based on this frame rate - double new_clip_speed = frame_rate->value() / c->MediaFrameRate(); + double new_clip_speed = frame_rate->value() / c->media_frame_rate(); if (!got_pc_val) { pc_val = new_clip_speed; got_pc_val = true; @@ -420,8 +420,8 @@ void SpeedDialog::accept() { } if (c->type() == olive::kTypeVideo) { if (qIsNaN(cached_fr)) { - cached_fr = c->MediaFrameRate(); - } else if (!qFuzzyCompare(cached_fr, c->MediaFrameRate())) { + cached_fr = c->media_frame_rate(); + } else if (!qFuzzyCompare(cached_fr, c->media_frame_rate())) { can_change_all = false; break; } @@ -432,7 +432,7 @@ void SpeedDialog::accept() { for (int i=0;itype() == olive::kTypeVideo) { - set_speed(ca, c, frame_rate->value() / c->MediaFrameRate(), ripple->isChecked(), earliest_point, longest_ripple); + set_speed(ca, c, frame_rate->value() / c->media_frame_rate(), ripple->isChecked(), earliest_point, longest_ripple); } else if (can_change_all) { set_speed(ca, c, frame_rate->value() / cached_fr, ripple->isChecked(), earliest_point, longest_ripple); } diff --git a/effects/internal/richtexteffect.cpp b/effects/internal/richtexteffect.cpp index 2aa46ed2f..43d7ec399 100644 --- a/effects/internal/richtexteffect.cpp +++ b/effects/internal/richtexteffect.cpp @@ -143,8 +143,8 @@ void RichTextEffect::redraw(double timecode) double scroll_progress = 0; if (auto_scroll_dir != SCROLL_OFF) { - double clip_length_secs = double(parent_clip->length()) / parent_clip->MediaFrameRate(); - scroll_progress = (timecode - double(parent_clip->clip_in()) / parent_clip->MediaFrameRate()) / clip_length_secs; + double clip_length_secs = double(parent_clip->length()) / parent_clip->media_frame_rate(); + scroll_progress = (timecode - double(parent_clip->clip_in()) / parent_clip->media_frame_rate()) / clip_length_secs; } if (auto_scroll_dir == SCROLL_OFF || auto_scroll_dir == SCROLL_LEFT || auto_scroll_dir == SCROLL_RIGHT) { diff --git a/effects/internal/shakeeffect.cpp b/effects/internal/shakeeffect.cpp index d7bdbfbca..7d623dd19 100644 --- a/effects/internal/shakeeffect.cpp +++ b/effects/internal/shakeeffect.cpp @@ -28,6 +28,7 @@ #include "ui/labelslider.h" #include "ui/collapsiblewidget.h" #include "timeline/clip.h" +#include "timeline/sequence.h" #include "panels/timeline.h" #include "global/debug.h" diff --git a/effects/internal/solideffect.cpp b/effects/internal/solideffect.cpp index 73ea6344b..452ea1e93 100644 --- a/effects/internal/solideffect.cpp +++ b/effects/internal/solideffect.cpp @@ -28,6 +28,7 @@ #include #include "timeline/clip.h" +#include "timeline/sequence.h" const int SMPTE_BARS = 7; const int SMPTE_STRIP_COUNT = 3; diff --git a/effects/internal/texteffect.cpp b/effects/internal/texteffect.cpp index 9d3d49c09..14515ad68 100644 --- a/effects/internal/texteffect.cpp +++ b/effects/internal/texteffect.cpp @@ -36,6 +36,7 @@ #include "ui/labelslider.h" #include "ui/collapsiblewidget.h" #include "timeline/clip.h" +#include "timeline/sequence.h" #include "ui/comboboxex.h" #include "ui/colorbutton.h" #include "ui/blur.h" diff --git a/effects/internal/timecodeeffect.cpp b/effects/internal/timecodeeffect.cpp index 40c809846..32a892cdf 100644 --- a/effects/internal/timecodeeffect.cpp +++ b/effects/internal/timecodeeffect.cpp @@ -118,7 +118,7 @@ void TimecodeEffect::redraw(double timecode) { olive::config.timecode_view, sequence->frame_rate); } else { - double media_rate = parent_clip->MediaFrameRate(); + double media_rate = parent_clip->media_frame_rate(); display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(qRound(timecode * media_rate), olive::config.timecode_view, media_rate); diff --git a/effects/internal/toneeffect.cpp b/effects/internal/toneeffect.cpp index 96dbaf4db..b0b66fa46 100644 --- a/effects/internal/toneeffect.cpp +++ b/effects/internal/toneeffect.cpp @@ -25,7 +25,7 @@ #define TONE_TYPE_SINE 0 #include "timeline/clip.h" -#include "rendering/audio.h" +#include "timeline/sequence.h" ToneEffect::ToneEffect(Clip* c) : Node(c), sinX(INT_MIN) { type_val = new ComboInput(this, "type", tr("Type")); @@ -90,7 +90,7 @@ void ToneEffect::process_audio(double timecode_start, double timecode = timecode_start+(interval*i); float tone_sample = qSin((2*M_PI*sinX*freq_val->GetDoubleAt(timecode)) - /current_audio_freq()) + /parent_clip->track()->sequence()->audio_frequency) *log_volume(amount_val->GetDoubleAt(timecode)*0.01); for (int j=0;jSetDisplayType(LabelSlider::FrameNumber); if (parent_clip != nullptr) { - length_field->SetFrameRate(GetParentClip()->track()->sequence() == nullptr ? - GetParentClip()->cached_frame_rate() : GetParentClip()->SequenceFrameRate()); + length_field->SetFrameRate(parent_clip->track()->sequence() == nullptr ? + parent_clip->cached_frame_rate() : parent_clip->track()->sequence()->frame_rate); } connect(length_field, SIGNAL(Changed()), this, SLOT(UpdateMaximumLength())); } -Clip *Transition::GetParentClip() -{ - return static_cast(parent_clip); -} - -NodePtr Transition::copy(TimelineObject *c) { +NodePtr Transition::copy(Clip *c) { NodePtr node = Node::copy(c); static_cast(node.get())->set_length(get_true_length()); @@ -91,8 +86,8 @@ int Transition::get_length() { } Clip* Transition::get_opened_clip() { - if (GetParentClip()->opening_transition.get() == this) { - return GetParentClip(); + if (parent_clip->opening_transition.get() == this) { + return parent_clip; } else if (secondary_clip != nullptr && secondary_clip->opening_transition.get() == this) { return secondary_clip; } @@ -100,8 +95,8 @@ Clip* Transition::get_opened_clip() { } Clip* Transition::get_closed_clip() { - if (GetParentClip()->closing_transition.get() == this) { - return GetParentClip(); + if (parent_clip->closing_transition.get() == this) { + return parent_clip; } else if (secondary_clip != nullptr && secondary_clip->closing_transition.get() == this) { return secondary_clip; } @@ -136,7 +131,7 @@ TransitionPtr Transition::CreateFromMeta(Clip* c, Clip* s) { void Transition::UpdateMaximumLength() { // Get the maximum area this transition can occupy on the clip - long maximum_length = GetMaximumEmptySpaceOnClip(GetParentClip()); + long maximum_length = GetMaximumEmptySpaceOnClip(parent_clip); // If this clip is a shared transition, get the maximum area this can occupy on the other clip too if (secondary_clip != nullptr) { diff --git a/effects/transition.h b/effects/transition.h index 00309c42a..7be393c5c 100644 --- a/effects/transition.h +++ b/effects/transition.h @@ -24,8 +24,6 @@ #include "nodes/node.h" #include "nodes/inputs.h" -class Clip; - enum TransitionType { kTransitionNone, kTransitionOpening, @@ -40,9 +38,7 @@ class Transition : public Node { public: Transition(Clip* c); - virtual NodePtr copy(TimelineObject* c) override; - - Clip* GetParentClip(); + virtual NodePtr copy(Clip* c) override; Clip* secondary_clip; diff --git a/nodes/node.cpp b/nodes/node.cpp index a43f9b5b5..17c11c6c6 100644 --- a/nodes/node.cpp +++ b/nodes/node.cpp @@ -60,7 +60,7 @@ QVector olive::node_library; -Node::Node(TimelineObject* c) : +Node::Node(Clip* c) : parent_clip(c), flags_(0), shader_program_(nullptr), @@ -182,7 +182,6 @@ void Node::delete_self() { } void Node::move_up() { - /* int index_of_effect = parent_clip->IndexOfEffect(this); if (index_of_effect == 0) { return; @@ -195,11 +194,9 @@ void Node::move_up() { olive::undo_stack.push(command); panel_effect_controls->Reload(); panel_sequence_viewer->viewer_widget()->frame_update(); - */ } void Node::move_down() { - /* int index_of_effect = parent_clip->IndexOfEffect(this); if (index_of_effect == parent_clip->effects.size()-1) { return; @@ -212,7 +209,6 @@ void Node::move_down() { olive::undo_stack.push(command); panel_effect_controls->Reload(); panel_sequence_viewer->viewer_widget()->frame_update(); - */ } void Node::save_to_file() { @@ -607,7 +603,7 @@ const QPointF &Node::pos() void Node::process_image(double, uint8_t *, uint8_t *, int){} -NodePtr Node::copy(TimelineObject *c) { +NodePtr Node::copy(Clip *c) { NodePtr copy = Create(c); copy->SetEnabled(IsEnabled()); copy_field_keyframes(copy); @@ -675,8 +671,8 @@ GLuint Node::process_superimpose(QOpenGLContext* ctx, double timecode) { bool dimensions_changed = false; bool redrew_image = false; - int width = parent_clip->MediaWidth(); - int height = parent_clip->MediaHeight(); + int width = parent_clip->media_width(); + int height = parent_clip->media_height(); if (width != img.width() || height != img.height()) { img = QImage(width, height, QImage::Format_RGBA8888_Premultiplied); @@ -810,10 +806,10 @@ void Node::gizmo_world_to_screen(const QMatrix4x4& matrix, const QMatrix4x4& pro projection, QRect(0, 0, - parent_clip->SequenceWidth(), - parent_clip->SequenceHeight())); + parent_clip->track()->sequence()->width, + parent_clip->track()->sequence()->height)); - g->screen_pos[j] = QPoint(screen_pos.x(), parent_clip->SequenceHeight()-screen_pos.y()); + g->screen_pos[j] = QPoint(screen_pos.x(), parent_clip->track()->sequence()->height-screen_pos.y()); } } diff --git a/nodes/node.h b/nodes/node.h index 77db3fb8f..2acf02ef9 100644 --- a/nodes/node.h +++ b/nodes/node.h @@ -48,7 +48,8 @@ class EffectGizmo; class KeyframeDataChange; -class TimelineObject; +class Clip; +using ClipPtr = std::shared_ptr; class Node; using NodePtr = std::shared_ptr; @@ -111,10 +112,10 @@ struct GLTextureCoords { class Node : public QObject { Q_OBJECT public: - Node(TimelineObject *c); + Node(Clip *c); ~Node(); - TimelineObject* parent_clip; + Clip* parent_clip; virtual QString name() = 0; virtual QString id() = 0; @@ -123,7 +124,7 @@ public: virtual EffectType type() = 0; virtual olive::TrackType subtype() = 0; virtual bool IsCreatable(); - virtual NodePtr Create(TimelineObject *c) = 0; + virtual NodePtr Create(Clip *c) = 0; void AddRow(EffectRow* row); int IndexOfRow(EffectRow* row); @@ -141,7 +142,7 @@ public: virtual void refresh(); - virtual NodePtr copy(TimelineObject* c); + virtual NodePtr copy(Clip* c); void copy_field_keyframes(NodePtr e); virtual void load(QXmlStreamReader& stream); diff --git a/olive.pro b/olive.pro index 472fa9430..404cee082 100644 --- a/olive.pro +++ b/olive.pro @@ -208,8 +208,7 @@ SOURCES += \ decoders/decoder.cpp \ nodes/node.cpp \ nodes/nodeedge.cpp \ - ui/nodeedgeui.cpp \ - timeline/timelineobject.cpp + ui/nodeedgeui.cpp HEADERS += \ ui/mainwindow.h \ @@ -375,8 +374,7 @@ HEADERS += \ nodes/node.h \ timeline/tracktypes.h \ nodes/nodeedge.h \ - ui/nodeedgeui.h \ - timeline/timelineobject.h + ui/nodeedgeui.h FORMS += diff --git a/panels/timeline.cpp b/panels/timeline.cpp index c2c51493a..0cb4c0f1b 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -1108,3 +1108,11 @@ void Timeline::visibility_changed_slot(bool visibility) emit SequenceChanged(sequence_); } } + +void olive::timeline::MultiplyTrackSizesByDPI() +{ + kTrackDefaultHeight *= QApplication::desktop()->devicePixelRatio(); + kTrackMinHeight *= QApplication::desktop()->devicePixelRatio(); + kTrackHeightIncrement *= QApplication::desktop()->devicePixelRatio(); + kTimelineLabelFixedWidth *= QApplication::desktop()->devicePixelRatio(); +} diff --git a/rendering/renderfunctions.cpp b/rendering/renderfunctions.cpp index f3767bfcd..ba1e94778 100644 --- a/rendering/renderfunctions.cpp +++ b/rendering/renderfunctions.cpp @@ -375,8 +375,8 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) { GLuint textureID = 0; // store video source dimensions - int video_width = c->MediaWidth(); - int video_height = c->MediaHeight(); + int video_width = c->media_width(); + int video_height = c->media_height(); // prepare framebuffers for backend drawing operations if (c->fbo.isEmpty()) { diff --git a/timeline/clip.cpp b/timeline/clip.cpp index aa17d29d6..57e705fb3 100644 --- a/timeline/clip.cpp +++ b/timeline/clip.cpp @@ -297,7 +297,7 @@ void Clip::Save(QXmlStreamWriter &stream) if (this == transition->secondary_clip) { // if so, just save a reference to the other clip stream.writeAttribute("shared", - QString::number(transition->GetParentClip()->load_id)); + QString::number(transition->parent_clip->load_id)); } else { // otherwise save the whole transition transition->save(stream); @@ -426,89 +426,16 @@ long Clip::length() { return timeline_out_ - timeline_in_; } -int Clip::MediaWidth() { - if (media_ != nullptr) { - switch (media_->get_type()) { - case MEDIA_TYPE_FOOTAGE: - { - const FootageStream* ms = media_stream(); - if (ms != nullptr) return ms->video_width; - break; - } - case MEDIA_TYPE_SEQUENCE: - { - Sequence* s = media_->to_sequence().get(); - return s->width; - } - } - } - - if (track() != nullptr) { - return SequenceWidth(); - } - - return 0; -} - -int Clip::MediaHeight() { - if (media_ != nullptr) { - switch (media_->get_type()) { - case MEDIA_TYPE_FOOTAGE: - { - const FootageStream* ms = media_stream(); - if (ms != nullptr) return ms->video_height; - } - break; - case MEDIA_TYPE_SEQUENCE: - { - Sequence* s = media_->to_sequence().get(); - return s->height; - } - } - } - - if (track() != nullptr) { - return SequenceHeight(); - } - - return 0; -} - -double Clip::MediaFrameRate() { +double Clip::media_frame_rate() { Q_ASSERT(type() == olive::kTypeVideo); - if (media_ != nullptr) { double rate = media_->get_frame_rate(media_stream_index()); if (!qIsNaN(rate)) return rate; } - - if (track() != nullptr) { - return SequenceFrameRate(); - } - + if (track() != nullptr) return track()->sequence()->frame_rate; return qSNaN(); } -int Clip::SequenceWidth() -{ - return track()->sequence()->width; -} - -int Clip::SequenceHeight() -{ - return track()->sequence()->height; -} - -double Clip::SequenceFrameRate() -{ - return track()->sequence()->frame_rate; -} - -long Clip::SequencePlayhead() -{ - return track()->sequence()->playhead; -} - long Clip::media_length() { if (this->track() != nullptr) { double fr = this->track()->sequence()->frame_rate; @@ -540,6 +467,44 @@ long Clip::media_length() { return 0; } +int Clip::media_width() { + if (media_ == nullptr && track() != nullptr) return track()->sequence()->width; + switch (media_->get_type()) { + case MEDIA_TYPE_FOOTAGE: + { + const FootageStream* ms = media_stream(); + if (ms != nullptr) return ms->video_width; + if (track() != nullptr) return track()->sequence()->width; + break; + } + case MEDIA_TYPE_SEQUENCE: + { + Sequence* s = media_->to_sequence().get(); + return s->width; + } + } + return 0; +} + +int Clip::media_height() { + if (media_ == nullptr && track() != nullptr) return track()->sequence()->height; + switch (media_->get_type()) { + case MEDIA_TYPE_FOOTAGE: + { + const FootageStream* ms = media_stream(); + if (ms != nullptr) return ms->video_height; + if (track() != nullptr) return track()->sequence()->height; + } + break; + case MEDIA_TYPE_SEQUENCE: + { + Sequence* s = media_->to_sequence().get(); + return s->height; + } + } + return 0; +} + void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) { if (change_timeline_points) { track()->sequence()->MoveClip(this, diff --git a/timeline/clip.h b/timeline/clip.h index b264b0d0c..30ea217ce 100644 --- a/timeline/clip.h +++ b/timeline/clip.h @@ -39,7 +39,6 @@ #include "marker.h" #include "nodes/nodegraph.h" #include "selection.h" -#include "timelineobject.h" class Track; @@ -49,13 +48,10 @@ struct ClipSpeed { bool maintain_audio_pitch; }; -class Clip; -using ClipPtr = std::shared_ptr; - -class Clip : public TimelineObject { +class Clip { public: Clip(Track *s); - virtual ~Clip() override; + ~Clip(); ClipPtr copy(Track *s); void Save(QXmlStreamWriter& stream); @@ -75,17 +71,9 @@ public: Media* media(); FootageStream* media_stream(); int media_stream_index(); - - virtual int MediaWidth() override; - virtual int MediaHeight() override; - virtual double MediaFrameRate() override; - - virtual int SequenceWidth() override; - virtual int SequenceHeight() override; - virtual double SequenceFrameRate() override; - - virtual long SequencePlayhead() override; - + int media_width(); + int media_height(); + double media_frame_rate(); long media_length(); void set_media(Media* m, int s); @@ -193,6 +181,8 @@ private: Cacher cacher; long cacher_frame; + NodeGraph pipeline_; + QVector markers; QColor color_; bool open_; diff --git a/timeline/sequence.cpp b/timeline/sequence.cpp index 4c8ee1b0b..75340e974 100644 --- a/timeline/sequence.cpp +++ b/timeline/sequence.cpp @@ -100,26 +100,6 @@ void Sequence::Save(QXmlStreamWriter &stream) stream.writeEndElement(); } -int Sequence::SequenceWidth() -{ - return width; -} - -int Sequence::SequenceHeight() -{ - return height; -} - -double Sequence::SequenceFrameRate() -{ - return frame_rate; -} - -long Sequence::SequencePlayhead() -{ - return playhead; -} - long Sequence::GetEndFrame() { long end_frame = 0; @@ -291,7 +271,7 @@ void Sequence::MoveClip(Clip *c, ComboAction *ca, long iin, long iout, long icli if (c->closing_transition != nullptr && c->closing_transition->secondary_clip != nullptr - && c->closing_transition->GetParentClip()->timeline_in() != iout) { + && c->closing_transition->parent_clip->timeline_in() != iout) { // separate transition ca->append(new SetPointer(reinterpret_cast(&c->closing_transition->secondary_clip), nullptr)); ca->append(new AddTransitionCommand(nullptr, diff --git a/timeline/sequence.h b/timeline/sequence.h index 8d9dde9c0..94051ae83 100644 --- a/timeline/sequence.h +++ b/timeline/sequence.h @@ -29,9 +29,8 @@ #include "selection.h" #include "tracklist.h" #include "ghost.h" -#include "timelineobject.h" -class Sequence : public TimelineObject { +class Sequence : public QObject { Q_OBJECT public: Sequence(); @@ -46,12 +45,6 @@ public: int audio_frequency; int audio_layout; - virtual int SequenceWidth() override; - virtual int SequenceHeight() override; - virtual double SequenceFrameRate() override; - - virtual long SequencePlayhead() override; - long GetEndFrame(); QVector GetAllClips(); TrackList* GetTrackList(olive::TrackType type); diff --git a/timeline/timelineobject.cpp b/timeline/timelineobject.cpp deleted file mode 100644 index 5331e8939..000000000 --- a/timeline/timelineobject.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "timelineobject.h" - -TimelineObject::TimelineObject() -{ -} - -TimelineObject::~TimelineObject() -{ -} - -int TimelineObject::MediaWidth() -{ - return SequenceWidth(); -} - -int TimelineObject::MediaHeight() -{ - return SequenceHeight(); -} - -double TimelineObject::MediaFrameRate() -{ - return SequenceFrameRate(); -} - -NodeGraph *TimelineObject::pipeline() -{ - return &pipeline_; -} diff --git a/timeline/timelineobject.h b/timeline/timelineobject.h deleted file mode 100644 index 56e07220c..000000000 --- a/timeline/timelineobject.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef TIMELINEOBJECT_H -#define TIMELINEOBJECT_H - -#include "nodes/nodegraph.h" - -/** - * @brief The TimelineObject class - * - * A base class for Clip, Sequence, and Track to allow compatibility between each of them and any effects nodes. - */ -class TimelineObject : public QObject -{ -public: - TimelineObject(); - virtual ~TimelineObject(); - - virtual int MediaWidth(); - virtual int MediaHeight(); - virtual double MediaFrameRate(); - - virtual int SequenceWidth() = 0; - virtual int SequenceHeight() = 0; - virtual double SequenceFrameRate() = 0; - - virtual long SequencePlayhead() = 0; - - NodeGraph* pipeline(); -private: - NodeGraph pipeline_; -}; - -#endif // TIMELINEOBJECT_H diff --git a/timeline/track.cpp b/timeline/track.cpp index bc0e36f9a..9273b67ed 100644 --- a/timeline/track.cpp +++ b/timeline/track.cpp @@ -1,8 +1,5 @@ #include "track.h" -#include -#include - #include "timeline/clip.h" #include "timeline/tracklist.h" #include "timeline/sequence.h" @@ -12,8 +9,6 @@ int olive::timeline::kTrackDefaultHeight = 40; int olive::timeline::kTrackMinHeight = 30; int olive::timeline::kTrackHeightIncrement = 10; -int olive::timeline::kTimelineLabelFixedWidth = 200; - Track::Track(TrackList* parent, olive::TrackType type) : parent_(parent), type_(type), @@ -211,26 +206,6 @@ bool Track::ContainsClip(Clip *c) return false; } -int Track::SequenceWidth() -{ - return sequence()->width; -} - -int Track::SequenceHeight() -{ - return sequence()->height; -} - -double Track::SequenceFrameRate() -{ - return sequence()->frame_rate; -} - -long Track::SequencePlayhead() -{ - return sequence()->playhead; -} - Track *Track::Previous() { int index = Index(); @@ -458,12 +433,3 @@ void Track::SetLocked(bool locked) { locked_ = locked; } - -void olive::timeline::MultiplyTrackSizesByDPI() -{ - kTrackDefaultHeight *= qApp->fontMetrics().height() * 3; - kTrackMinHeight *= qApp->fontMetrics().height(); - kTrackHeightIncrement *= qApp->fontMetrics().height() / 2; - kTimelineLabelFixedWidth *= QApplication::desktop()->devicePixelRatio(); -} - diff --git a/timeline/track.h b/timeline/track.h index d3d3a4efb..310cd69e9 100644 --- a/timeline/track.h +++ b/timeline/track.h @@ -8,8 +8,6 @@ #include "tracktypes.h" #include "undo/comboaction.h" #include "timeline/selection.h" -#include "timelineobject.h" -#include "clip.h" class Sequence; class Transition; @@ -39,7 +37,7 @@ namespace olive { class TrackList; -class Track : public TimelineObject +class Track : public QObject { Q_OBJECT public: @@ -70,12 +68,6 @@ public: Clip* GetClipFromPoint(long point); bool ContainsClip(Clip* c); - virtual int SequenceWidth() override; - virtual int SequenceHeight() override; - virtual double SequenceFrameRate() override; - - virtual long SequencePlayhead() override; - Track* Previous(); Track* Next(); Track* Sibling(int diff); diff --git a/ui/effectui.cpp b/ui/effectui.cpp index 7d1113d74..62a1cdb35 100644 --- a/ui/effectui.cpp +++ b/ui/effectui.cpp @@ -43,7 +43,7 @@ EffectUI::EffectUI(Node* e) : Transition* t = static_cast(e); // Since effects can have two clip attachments, find out which one is selected - Clip* selected_clip = t->GetParentClip(); + Clip* selected_clip = t->parent_clip; bool both_selected = false; // Check if this is a shared transition @@ -54,12 +54,12 @@ EffectUI::EffectUI(Node* e) : selected_clip = t->secondary_clip; - if (t->GetParentClip()->IsSelected()) { + if (t->parent_clip->IsSelected()) { // Both clips are selected both_selected = true; } - } else if (!t->GetParentClip()->IsSelected()) { + } else if (!t->parent_clip->IsSelected()) { // Neither are selected, but the naming scheme (no "opening" or "closing" modifier) will be the same both_selected = true; @@ -267,7 +267,7 @@ void EffectUI::UpdateFromEffect() } } -bool EffectUI::IsAttachedToClip(TimelineObject *c) +bool EffectUI::IsAttachedToClip(Clip *c) { if (GetEffect()->parent_clip == c) { return true; diff --git a/ui/effectui.h b/ui/effectui.h index 5372540dc..9eb12201c 100644 --- a/ui/effectui.h +++ b/ui/effectui.h @@ -131,7 +131,7 @@ public: * * True is an Effect from this Clip is already attached to this EffectUI. */ - bool IsAttachedToClip(TimelineObject* c); + bool IsAttachedToClip(Clip* c); void SetNodeParent(NodeUI* parent); diff --git a/ui/timelinearea.cpp b/ui/timelinearea.cpp index a9d1c9c9a..e0c795ab8 100644 --- a/ui/timelinearea.cpp +++ b/ui/timelinearea.cpp @@ -5,6 +5,8 @@ #include "panels/timeline.h" #include "global/config.h" +int olive::timeline::kTimelineLabelFixedWidth = 200; + TimelineArea::TimelineArea(Timeline* timeline, olive::timeline::Alignment alignment) : timeline_(timeline), track_list_(nullptr), diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index 6670a028c..5fb7dd057 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -344,7 +344,7 @@ void ViewerWidget::move_gizmos(QMouseEvent *event, bool done) { x_movement, y_movement, get_timecode(gizmos->parent_clip, - gizmos->parent_clip->SequencePlayhead()), + gizmos->parent_clip->track()->sequence()->playhead), done); gizmo_x_mvmt += x_movement;