diff --git a/app/panel/project/project.h b/app/panel/project/project.h index 34bcbb669..73df37d30 100644 --- a/app/panel/project/project.h +++ b/app/panel/project/project.h @@ -41,6 +41,8 @@ public: Folder* GetSelectedFolder(); + QList GetSelectedFootage(); + ProjectViewModel* model(); virtual void SelectAll() override; @@ -64,8 +66,6 @@ private slots: void ProjectNameChanged(); - QList GetSelectedFootage(); - }; #endif // PROJECT_PANEL_H diff --git a/app/panel/timeline/timeline.cpp b/app/panel/timeline/timeline.cpp index 2a66b85fb..d60107993 100644 --- a/app/panel/timeline/timeline.cpp +++ b/app/panel/timeline/timeline.cpp @@ -20,6 +20,9 @@ #include "timeline.h" +#include "panel/panelmanager.h" +#include "panel/project/project.h" + TimelinePanel::TimelinePanel(QWidget *parent) : TimeBasedPanel(parent) { @@ -89,6 +92,24 @@ void TimelinePanel::DecreaseTrackHeight() static_cast(GetTimeBasedWidget())->DecreaseTrackHeight(); } +void TimelinePanel::Insert() +{ + ProjectPanel* project_panel = PanelManager::instance()->MostRecentlyFocused(); + + if (project_panel) { + InsertFootageAtPlayhead(project_panel->GetSelectedFootage()); + } +} + +void TimelinePanel::Overwrite() +{ + ProjectPanel* project_panel = PanelManager::instance()->MostRecentlyFocused(); + + if (project_panel) { + OverwriteFootageAtPlayhead(project_panel->GetSelectedFootage()); + } +} + void TimelinePanel::InsertFootageAtPlayhead(const QList &footage) { static_cast(GetTimeBasedWidget())->InsertFootageAtPlayhead(footage); diff --git a/app/panel/timeline/timeline.h b/app/panel/timeline/timeline.h index e04a69593..784043b23 100644 --- a/app/panel/timeline/timeline.h +++ b/app/panel/timeline/timeline.h @@ -55,6 +55,10 @@ public: virtual void DecreaseTrackHeight() override; + virtual void Insert() override; + + virtual void Overwrite() override; + void InsertFootageAtPlayhead(const QList &footage); void OverwriteFootageAtPlayhead(const QList &footage); diff --git a/app/widget/timelinewidget/tool/import.cpp b/app/widget/timelinewidget/tool/import.cpp index 8445c3ebd..366f46277 100644 --- a/app/widget/timelinewidget/tool/import.cpp +++ b/app/widget/timelinewidget/tool/import.cpp @@ -186,6 +186,11 @@ void TimelineWidget::ImportTool::DragDrop(TimelineViewMouseEvent *event) void TimelineWidget::ImportTool::PlaceAt(const QList &footage, const rational &start, bool insert) { dragged_footage_ = footage; + + if (dragged_footage_.isEmpty()) { + return; + } + PrepGhosts(start, 0); DropGhosts(insert); }