Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattkc committed Mar 8, 2019
1 parent 456ae63 commit 27cb7c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
23 changes: 15 additions & 8 deletions panels/timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,19 +812,26 @@ void Timeline::SetTrackHeight(int track, int height) {
track_heights.append(t);
}

void Timeline::IncreaseTrackHeight() {
for (int i=0;i<track_heights.size();i++) {
track_heights[i].height += olive::timeline::kTrackHeightIncrement;
void Timeline::ChangeTrackHeightUniformly(int diff) {
// get range of tracks currently active
int min_track, max_track;
olive::ActiveSequence->getTrackLimits(&min_track, &max_track);

// for each active track, set the track to increase/decrease based on `diff`
for (int i=min_track;i<=max_track;i++) {
SetTrackHeight(i, qMax(GetTrackHeight(i) + diff, olive::timeline::kTrackMinHeight));
}

// update the timeline
repaint_timeline();
}

void Timeline::IncreaseTrackHeight() {
ChangeTrackHeightUniformly(olive::timeline::kTrackHeightIncrement);
}

void Timeline::DecreaseTrackHeight() {
for (int i=0;i<track_heights.size();i++) {
track_heights[i].height = qMax(track_heights[i].height - olive::timeline::kTrackHeightIncrement,
olive::timeline::kTrackDefaultHeight);
}
repaint_timeline();
ChangeTrackHeightUniformly(-olive::timeline::kTrackHeightIncrement);
}

void Timeline::snapping_clicked(bool checked) {
Expand Down
1 change: 1 addition & 0 deletions panels/timeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ private slots:
void set_tool();

private:
void ChangeTrackHeightUniformly(int diff);
void set_zoom_value(double v);
QVector<QPushButton*> tool_buttons;
void decheck_tool_buttons(QObject* sender);
Expand Down

0 comments on commit 27cb7c8

Please sign in to comment.