Skip to content

Commit

Permalink
Added insert callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Sep 26, 2023
1 parent 6ec1d51 commit af0eccc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/tlTimelineUI/TimelineItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace tl
timeline::PlayerCacheInfo cacheInfo;
bool editable = false;
bool stopOnScrub = true;
std::function<void(const std::vector<timeline::InsertData>&)> insertCallback;

struct Track
{
Expand Down Expand Up @@ -539,6 +540,8 @@ namespace tl
insertData.push_back({ item->p->getComposable(), track, dropTarget.index });
item->p->setVisible(false);
}
if (p.insertCallback)
p.insertCallback(insertData);
auto otioTimeline = insert(
p.player->getTimeline()->getTimeline().value,
insertData);
Expand All @@ -559,7 +562,12 @@ namespace tl
TLRENDER_P();
return p.mouse.mode == Private::MouseMode::Item;
}


void TimelineItem::setInsertCallback(const std::function<void(const std::vector<timeline::InsertData>&)>& value)
{
_p->insertCallback = value;
}

/*void TimelineItem::keyPressEvent(ui::KeyEvent& event)
{
TLRENDER_P();
Expand Down
4 changes: 4 additions & 0 deletions lib/tlTimelineUI/TimelineItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <tlTimelineUI/IItem.h>

#include <tlTimeline/Edit.h>
#include <tlTimeline/Player.h>

namespace tl
Expand Down Expand Up @@ -56,6 +57,9 @@ namespace tl

//! Returns whether a clip is getting dragged.
bool isDragging() const;

//! Sets a callback for inserting items
void setInsertCallback(const std::function<void(const std::vector<timeline::InsertData>&)>&);

void setGeometry(const math::Box2i&) override;
void sizeHintEvent(const ui::SizeHintEvent&) override;
Expand Down

0 comments on commit af0eccc

Please sign in to comment.