Timeline: Add 'loop' and 'new take' buttons to transport group so that these settings are more obvious to the user.

This commit is contained in:
Jonathan Moore Liles 2013-02-12 16:50:19 -08:00
parent 85e225810f
commit f41cf07188
7 changed files with 101 additions and 55 deletions

View File

@ -36,7 +36,7 @@ Timeline::record ( void )
{
/* FIXME: right place for this? */
if ( Timeline::automatically_create_takes &&
if ( transport->automatically_create_takes() &&
! _created_new_takes )
{
add_take_for_armed_tracks();

View File

@ -249,11 +249,11 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {}
label {Non DAW : Timeline}
callback {if ( Fl::event_key() != FL_Escape )
timeline->command_quit();} open
xywh {262 208 1025 770} type Double resizable
xywh {516 306 1025 770} type Double resizable
class TLE_Window xclass Non_DAW size_range {900 300 0 0} visible
} {
Fl_Group {} {
xywh {0 0 1025 73} box FLAT_BOX
Fl_Group {} {open
xywh {0 -53 1025 126} box FLAT_BOX
} {
Fl_Menu_Bar menubar {open
private xywh {0 0 1025 25}
@ -601,12 +601,12 @@ timeline->redraw();}
}
MenuItem {} {
label {Loop Playback}
callback {timeline->loop_playback = ( ((Fl_Menu_*)o)->mvalue()->flags & FL_MENU_VALUE );}
callback {transport->loop_enabled( ( ((Fl_Menu_*)o)->mvalue()->flags & FL_MENU_VALUE )) ;}
xywh {10 10 40 25} type Toggle
}
MenuItem {} {
label {Automatically Create Takes}
callback {timeline->automatically_create_takes = ( ((Fl_Menu_*)o)->mvalue()->flags & FL_MENU_VALUE );}
callback {transport->automatically_create_takes( ( ((Fl_Menu_*)o)->mvalue()->flags & FL_MENU_VALUE ));}
xywh {10 10 40 25} type Toggle
}
}
@ -641,31 +641,30 @@ ab.run();}
}
}
Fl_Pack {} {open
xywh {3 28 477 44} type HORIZONTAL
xywh {1 27 584 46} type HORIZONTAL
code0 {o->spacing( 10 );}
} {
Fl_Box {} {
label {<Transport>}
xywh {5 30 185 37} color 30
xywh {5 28 290 44} color 30
code0 {transport = o;}
code1 {o->labeltype( FL_NO_LABEL );}
code2 {o->spacing( 1 );}
class Transport
}
Fl_Pack clocks_pack {open
private xywh {195 28 285 44} type HORIZONTAL
private xywh {295 30 290 41} type HORIZONTAL
code0 {o->spacing( 2 );}
} {
Fl_Box {} {
label PLAYHEAD
private xywh {196 28 137 40} box BORDER_BOX color 40
label PLAYHEAD selected
private xywh {301 30 137 41} box FLAT_BOX color 47
code0 {o->type( Clock::HMS );}
code1 {o->run( &transport->frame );}
class Clock
}
Fl_Box {} {
label PLAYHEAD
xywh {335 32 137 37} box BORDER_BOX color 40
label PLAYHEAD selected
xywh {440 30 137 41} box FLAT_BOX color 47
code0 {o->type( Clock::BBT );}
code1 {o->run( &transport->frame );}
class Clock
@ -674,7 +673,7 @@ ab.run();}
}
Fl_Box {} {
label {<empty>}
xywh {475 32 265 40} resizable
xywh {585 32 155 40} resizable
code0 {o->labeltype( FL_NO_LABEL );}
}
Fl_Group {} {open
@ -718,7 +717,7 @@ ab.run();}
xywh {740 31 115 40}
} {
Fl_Button solo_blinker {
label SOLO selected
label SOLO
xywh {800 33 50 15} box BORDER_BOX down_box BORDER_BOX color 74 selection_color 92 labelfont 1 labelsize 11 labelcolor 32
code0 {\#include "FL/Fl_Blink_Button.H"}
code1 {o->box( FL_ASYM_BOX );}
@ -727,7 +726,7 @@ ab.run();}
class Fl_Blink_Button
}
Fl_Button rec_blinker {
label REC selected
label REC
xywh {800 53 50 15} box BORDER_BOX down_box BORDER_BOX color 72 selection_color 88 labelfont 1 labelsize 11 labelcolor 32
code0 {\#include "FL/Fl_Blink_Button.H"}
code1 {o->box( FL_ASYM_BOX );}
@ -736,7 +735,7 @@ ab.run();}
class Fl_Blink_Button
}
Fl_Button selected_blinker {
label SEL selected
label SEL
xywh {745 53 50 15} box BORDER_BOX down_box BORDER_BOX color 13 selection_color 5 labelfont 1 labelsize 11 labelcolor 32
code0 {\#include "FL/Fl_Blink_Button.H"}
code1 {o->box( FL_ASYM_BOX );}
@ -745,7 +744,7 @@ ab.run();}
class Fl_Blink_Button
}
Fl_Button seek_blinker {
label SEEK selected
label SEEK
xywh {745 33 50 15} box BORDER_BOX down_box BORDER_BOX color 10 selection_color 2 labelfont 1 labelsize 11 labelcolor 32
code0 {\#include "FL/Fl_Blink_Button.H"}
code1 {o->box( FL_ASYM_BOX );}
@ -959,8 +958,7 @@ if ( p != oldp )
progress->redraw();
Fl::check();
}
} {}
}} {}
}
Function {show_help_dialog( const char *file )} {open private return_type {static void}
} {
@ -1003,7 +1001,7 @@ if ( logo_box->image() )
((Fl_Shared_Image*)logo_box->image())->release();
logo_box->image( NULL );
}} open
private xywh {1242 261 520 775} type Double modal visible
private xywh {1398 301 520 775} type Double modal visible
} {
Fl_Value_Output {} {
label {Sample Rate}

View File

@ -87,8 +87,6 @@ bool Timeline::snapping_on_hold = false;
bool Timeline::snap_magnetic = true;
bool Timeline::follow_playhead = true;
bool Timeline::center_playhead = true;
bool Timeline::loop_playback = false;
bool Timeline::automatically_create_takes = false;
const float UPDATE_FREQ = 1.0 / 18.0f;
@ -1447,7 +1445,7 @@ Timeline::redraw_playhead ( void )
{
if ( play_cursor_track->active_cursor() )
{
if ( Timeline::loop_playback )
if ( transport->loop_enabled() )
{
if ( transport->frame > playback_end() )
{

View File

@ -167,11 +167,6 @@ public:
static bool snap_magnetic;
static bool follow_playhead;
static bool center_playhead;
static bool loop_playback;
static bool automatically_create_takes;
Tempo_Sequence *tempo_track;
Time_Sequence *time_track;

View File

@ -246,7 +246,6 @@ Track::init ( void )
o->end();
}
end();
}

View File

@ -27,7 +27,7 @@
Transport::Transport ( int X, int Y, int W, int H, const char *L )
: Fl_Pack( X, Y, W, H, L )
: Fl_Flowpack( X, Y, W, H, L )
{
recording = false;
rolling = false;
@ -45,49 +45,71 @@ Transport::Transport ( int X, int Y, int W, int H, const char *L )
frame_rate = 48000;
frame = 0;
const int bw = W / 5;
type( HORIZONTAL );
{ _home_button = new Fl_Button(5, 5, 40, 44, "@|<");
} // Fl_Button* _home_button
{ _end_button = new Fl_Button(45, 5, 40, 44, "@>|");
} // Fl_Button* _end_button
{ _play_button = new Fl_Button(85, 5, 40, 44, "@>");
} // Fl_Button* _play_button
{ _record_button = new Fl_Button(130, 5, 40, 44, "@circle");
} // Fl_Button* _record_button
{ _punch_button = new Fl_Button(175, 5, 38, 21, "Punch");
_punch_button->type(1);
_punch_button->labelsize(10);
} // Fl_Button* _punch_button
{ _loop_button = new Fl_Button(175, 20, 38, 21, "Loop");
_loop_button->type(1);
_loop_button->labelsize(10);
} // Fl_Button* _loop_button
{ _new_take_button = new Fl_Button(225, 5, 60, 21, "New Take");
_new_take_button->type(1);
_new_take_button->labelsize(10);
} // Fl_Button* _new_take_button
end();
Fl_Button *o;
_home_button = o = new Fl_Button( 0, 0, bw, 0, "@|<" );
o->labeltype( FL_EMBOSSED_LABEL );
o = _home_button;
o->callback( cb_button, this );
o->shortcut( FL_Home );
o->box( FL_UP_BOX );
_end_button = o = new Fl_Button( 0, 0, bw, 0, "@>|" );
o->labeltype( FL_EMBOSSED_LABEL );
o = _end_button;
o->callback( cb_button, this );
o->shortcut( FL_End );
_play_button = o = new Fl_Button( 0, 0, bw, 0, "@>" );
o->labeltype( FL_EMBOSSED_LABEL );
o = _play_button;
o->callback( cb_button, this );
o->shortcut( ' ' );
o->box( FL_UP_BOX );
_record_button = o = new Fl_Button( 0, 0, bw, 0, "@circle" );
o = _record_button;
o->type( FL_TOGGLE_BUTTON );
o->labeltype( FL_EMBOSSED_LABEL );
o->labelcolor( fl_color_average( FL_RED, FL_WHITE, 0.25f ) );
o->shortcut( 'R' );
o->callback( cb_button, this );
o->when( FL_WHEN_CHANGED );
o->box( FL_UP_BOX );
_punch_button = o = new Fl_Button( 0, 0, bw, 0, "Punch" );
o = _punch_button;
o->type( FL_TOGGLE_BUTTON );
o->labelsize( 9 );
o->labeltype( FL_NORMAL_LABEL );
o->shortcut( 'P' );
o->callback( cb_button, this );
o->when( FL_WHEN_CHANGED );
o->color2( FL_RED );
o->box( FL_UP_BOX );
o->color2( fl_color_average( FL_GRAY, FL_RED, 0.50 ));
o->tooltip( "Toggle punch in/out recording mode" );
end();
o = _loop_button;
o->type( FL_TOGGLE_BUTTON );
o->shortcut( 'L' );
o->callback( cb_button, this );
o->when( FL_WHEN_CHANGED );
o->color2( fl_color_average( FL_GRAY, FL_GREEN, 0.50 ));
o->tooltip( "Toggle looped playback" );
o = _new_take_button;
o->type( FL_TOGGLE_BUTTON );
o->shortcut( 'T' );
o->callback( cb_button, this );
o->when( FL_WHEN_CHANGED );
o->color2( fl_color_average( FL_GRAY, FL_YELLOW, 0.50 ) );
o->tooltip( "Toggle automatic creation of new takes for armed tracks" );
}
@ -165,6 +187,32 @@ Transport::punch_enabled ( void ) const
return _punch_button->value();
}
bool
Transport::loop_enabled ( void ) const
{
return _loop_button->value();
}
void
Transport::loop_enabled ( bool b )
{
_loop_button->value( b );
}
bool
Transport::automatically_create_takes ( void ) const
{
return _new_take_button->value();
}
void
Transport::automatically_create_takes ( bool b )
{
_new_take_button->value( b );
}
int
Transport::handle ( int m )
{
@ -173,7 +221,7 @@ Transport::handle ( int m )
if ( m == FL_FOCUS )
return 0;
else
return Fl_Pack::handle( m );
return Fl_Flowpack::handle( m );
}
/***********/

View File

@ -27,8 +27,9 @@
#include <FL/Fl_Button.H>
#include <stdio.h>
#include <FL/Fl_Flowpack.H>
class Transport : public jack_position_t, public Fl_Pack
class Transport : public jack_position_t, public Fl_Flowpack
{
private:
@ -47,6 +48,8 @@ private:
Fl_Button *_play_button;
Fl_Button *_record_button;
Fl_Button *_punch_button;
Fl_Button *_loop_button;
Fl_Button *_new_take_button;
void update_record_state ( void );
@ -56,6 +59,11 @@ public:
bool rec_enabled ( void ) const;
bool punch_enabled ( void ) const;
bool loop_enabled ( void ) const;
void loop_enabled ( bool b );
void automatically_create_takes ( bool b );
bool automatically_create_takes ( void ) const;
void stop_disables_record ( bool b ) { _stop_disables_record = b; }
bool stop_disables_record ( void ) const { return _stop_disables_record; }