Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-edward committed Jan 8, 2025
1 parent 963e915 commit 6384f45
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/core/timeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,49 @@ void Timeline::HandleEvent(const Event &event)
}
}
}
case KEY_B:
{
const te::TempoSequence &tempo = APP->edit_.tempoSequence;
auto pos = tempo.toTime(te::BeatPosition::fromBeats(cursor_.LeftEdge()));

te::TrackItem *item = APP->CurrTrack().base_.getNextTrackItemAt(pos);
int index = APP->CurrTrack().base_.getIndexOfNextTrackItemAt(pos);
if (item == nullptr && index == 0) // do nothing
{
LOG_MSG("KEY_B found nothing behind it");
}
else if (item == nullptr && index > 0) // go to the previous clip
{
te::TrackItem *next_item = APP->CurrTrack().base_.getTrackItem(index - 1);
if (auto clip = dynamic_cast<te::Clip *>(next_item))
{
cursor_.start = clip->getStartBeat().inBeats();
CursorFocus();
CursorAlignGrid();
}
}
else if (item != nullptr) // move to the start of this clip
{
if (auto clip = dynamic_cast<te::Clip *>(item))
{
cursor_.start = clip->getStartBeat().inBeats();
CursorFocus();
CursorAlignGrid();
}
}
if (index == 0)
{
}
else
{
if (auto clip = dynamic_cast<te::Clip *>(item))
{
cursor_.start = clip->getEndBeat().inBeats();
CursorFocus();
CursorAlignGrid();
}
}
}
break;
case KEY_D:
{
Expand Down

0 comments on commit 6384f45

Please sign in to comment.