2008-04-12 21:50:36 +02:00
|
|
|
|
|
|
|
/*******************************************************************************/
|
|
|
|
/* Copyright (C) 2008 Jonathan Moore Liles */
|
|
|
|
/* */
|
|
|
|
/* This program is free software; you can redistribute it and/or modify it */
|
|
|
|
/* under the terms of the GNU General Public License as published by the */
|
|
|
|
/* Free Software Foundation; either version 2 of the License, or (at your */
|
|
|
|
/* option) any later version. */
|
|
|
|
/* */
|
|
|
|
/* This program is distributed in the hope that it will be useful, but WITHOUT */
|
|
|
|
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
|
|
|
|
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
|
|
|
|
/* more details. */
|
|
|
|
/* */
|
|
|
|
/* You should have received a copy of the GNU General Public License along */
|
|
|
|
/* with This program; see the file COPYING. If not,write to the Free Software */
|
|
|
|
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
/*******************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <jack/transport.h>
|
|
|
|
#include "types.h"
|
|
|
|
|
2008-04-23 00:38:59 +02:00
|
|
|
#include "Timeline.H"
|
|
|
|
|
2008-04-22 04:47:29 +02:00
|
|
|
#include <FL/Fl_Pack.H>
|
|
|
|
#include <FL/Fl_Button.H>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
struct Transport : public jack_position_t, public Fl_Pack
|
2008-04-12 21:50:36 +02:00
|
|
|
{
|
2008-04-22 04:47:29 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
Fl_Button *_home_button;
|
2008-04-23 00:38:59 +02:00
|
|
|
Fl_Button *_end_button;
|
2008-04-22 04:47:29 +02:00
|
|
|
Fl_Button *_play_button;
|
|
|
|
Fl_Button *_record_button;
|
|
|
|
|
|
|
|
static
|
|
|
|
void
|
|
|
|
cb_button ( Fl_Widget *w, void *v )
|
|
|
|
{
|
|
|
|
((Transport*)v)->cb_button( w );
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cb_button ( Fl_Widget *w )
|
|
|
|
{
|
|
|
|
if ( w == _home_button )
|
|
|
|
locate( 0 );
|
2008-04-23 00:38:59 +02:00
|
|
|
if ( w == _end_button )
|
|
|
|
locate( timeline->length() );
|
2008-04-22 04:47:29 +02:00
|
|
|
else if ( w == _play_button )
|
|
|
|
toggle();
|
|
|
|
else if ( w == _record_button )
|
2008-04-25 08:34:08 +02:00
|
|
|
{
|
|
|
|
if ( rolling )
|
|
|
|
if ( _record_button->value() )
|
|
|
|
timeline->record();
|
|
|
|
else
|
|
|
|
timeline->stop();
|
|
|
|
}
|
2008-04-22 04:47:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
Transport ( int X, int Y, int W, int H, const char *L=0 )
|
|
|
|
: Fl_Pack( X, Y, W, H, L )
|
|
|
|
{
|
|
|
|
const int bw = W / 3;
|
|
|
|
|
|
|
|
type( HORIZONTAL );
|
|
|
|
|
|
|
|
Fl_Button *o;
|
|
|
|
|
2008-04-23 00:38:59 +02:00
|
|
|
_home_button = o = new Fl_Button( 0, 0, bw, 0, "@|<" );
|
2008-04-22 04:47:29 +02:00
|
|
|
o->labeltype( FL_EMBOSSED_LABEL );
|
|
|
|
o->callback( cb_button, this );
|
|
|
|
o->shortcut( FL_Home );
|
|
|
|
o->box( FL_UP_BOX );
|
2008-04-23 00:38:59 +02:00
|
|
|
|
|
|
|
_end_button = o = new Fl_Button( 0, 0, bw, 0, "@>|" );
|
|
|
|
o->labeltype( FL_EMBOSSED_LABEL );
|
|
|
|
o->callback( cb_button, this );
|
|
|
|
o->shortcut( FL_End );
|
|
|
|
|
2008-04-22 04:47:29 +02:00
|
|
|
_play_button = o = new Fl_Button( 0, 0, bw, 0, "@>" );
|
|
|
|
o->labeltype( FL_EMBOSSED_LABEL );
|
|
|
|
o->callback( cb_button, this );
|
|
|
|
o->shortcut( ' ' );
|
|
|
|
o->box( FL_UP_BOX );
|
2008-04-23 00:38:59 +02:00
|
|
|
|
2008-04-22 04:47:29 +02:00
|
|
|
_record_button = o = new Fl_Button( 0, 0, bw, 0, "@circle" );
|
2008-04-25 08:34:08 +02:00
|
|
|
o->type( FL_TOGGLE_BUTTON );
|
2008-04-22 04:47:29 +02:00
|
|
|
o->labeltype( FL_EMBOSSED_LABEL );
|
|
|
|
o->labelcolor( FL_RED );
|
|
|
|
o->shortcut( 'R' );
|
|
|
|
o->callback( cb_button, this );
|
|
|
|
o->box( FL_UP_BOX );
|
|
|
|
|
|
|
|
end();
|
|
|
|
}
|
|
|
|
|
2008-04-12 21:50:36 +02:00
|
|
|
bool rolling;
|
|
|
|
|
|
|
|
void poll ( void );
|
2008-04-22 02:52:59 +02:00
|
|
|
void locate ( nframes_t frame );
|
2008-04-22 04:15:32 +02:00
|
|
|
void start ( void );
|
|
|
|
void stop ( void );
|
|
|
|
void toggle ( void );
|
2008-04-12 21:50:36 +02:00
|
|
|
};
|
|
|
|
|
2008-04-22 04:47:29 +02:00
|
|
|
extern Transport* transport;
|