Browse Source

Add "Follow Playhead" option.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
98afd445ed
3 changed files with 11 additions and 1 deletions
  1. +6
    -1
      Timeline/TLE.fl
  2. +4
    -0
      Timeline/Timeline.C
  3. +1
    -0
      Timeline/Timeline.H

+ 6
- 1
Timeline/TLE.fl View File

@@ -176,7 +176,7 @@ exit( 0 );}
} }
MenuItem {} { MenuItem {} {
label {Delete Selected} label {Delete Selected}
callback {timeline->delete_selected();} selected
callback {timeline->delete_selected();}
xywh {20 20 40 25} shortcut 0xffff xywh {20 20 40 25} shortcut 0xffff
} }
} }
@@ -248,6 +248,11 @@ exit( 0 );}
label {&Timeline} open label {&Timeline} open
xywh {0 0 74 25} xywh {0 0 74 25}
} { } {
MenuItem {} {
label {&Follow Playhead}
callback {Timeline::follow_playhead = menu_picked_value( o );} selected
xywh {20 20 40 25} type Toggle value 1
}
Submenu {} { Submenu {} {
label {&Snap to} open label {&Snap to} open
xywh {0 0 74 25} xywh {0 0 74 25}


+ 4
- 0
Timeline/Timeline.C View File

@@ -34,6 +34,7 @@
bool Timeline::draw_with_measure_lines = true; bool Timeline::draw_with_measure_lines = true;
Timeline::snap_e Timeline::snap_to = Bars; Timeline::snap_e Timeline::snap_to = Bars;
bool Timeline::snap_magnetic = true; bool Timeline::snap_magnetic = true;
bool Timeline::follow_playhead = true;


const float UPDATE_FREQ = 0.02f; const float UPDATE_FREQ = 0.02f;


@@ -664,6 +665,9 @@ Timeline::redraw_playhead ( void )
{ {
redraw_overlay(); redraw_overlay();
last_playhead = transport->frame; last_playhead = transport->frame;

if ( follow_playhead )
xposition( max( 0, ts_to_x( transport->frame ) - ( ( tracks->w() - Track::width() ) >> 1 ) ) );
} }
} }




+ 1
- 0
Timeline/Timeline.H View File

@@ -117,6 +117,7 @@ public:
static bool draw_with_measure_lines; static bool draw_with_measure_lines;
static snap_e snap_to; static snap_e snap_to;
static bool snap_magnetic; static bool snap_magnetic;
static bool follow_playhead;


Tempo_Sequence *tempo_track; Tempo_Sequence *tempo_track;
Time_Sequence *time_track; Time_Sequence *time_track;


Loading…
Cancel
Save