2008-02-20 06:57:14 +01: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. */
|
|
|
|
|
/*******************************************************************************/
|
|
|
|
|
|
2008-06-21 06:38:29 +02:00
|
|
|
|
/* A Track is a container for various sequences; the sequence, the
|
|
|
|
|
* takes (inactive sequences), annotation sequences, control
|
|
|
|
|
* sequences */
|
|
|
|
|
/* TODO: split into Track and Audio_Track (and maybe later Video_Track
|
|
|
|
|
* and MIDI_Track */
|
|
|
|
|
|
2008-12-02 07:14:25 +01:00
|
|
|
|
#include <sys/time.h>
|
2008-02-20 06:57:14 +01:00
|
|
|
|
#include "Track.H"
|
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
#include "Transport.H"
|
2008-03-09 22:18:22 +01:00
|
|
|
|
|
2008-04-21 16:57:30 +02:00
|
|
|
|
#include "../FL/Fl_Sometimes_Input.H"
|
2012-12-11 06:47:44 +01:00
|
|
|
|
#include "../FL/Fl_Sometimes_Pack.H"
|
2008-04-21 22:24:08 +02:00
|
|
|
|
#include <FL/fl_ask.H>
|
2008-04-26 10:42:44 +02:00
|
|
|
|
#include <FL/Fl_Color_Chooser.H>
|
|
|
|
|
#include <FL/Fl.H>
|
2012-11-30 08:40:28 +01:00
|
|
|
|
#include "FL/Fl_Scalepack.H"
|
2012-12-02 01:14:01 +01:00
|
|
|
|
#include "FL/Fl_Blink_Button.H"
|
2008-04-21 16:57:30 +02:00
|
|
|
|
|
2008-05-05 01:06:36 +02:00
|
|
|
|
#include "Control_Sequence.H"
|
|
|
|
|
#include "Annotation_Sequence.H"
|
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
#include "Track_Header.H"
|
|
|
|
|
|
2008-07-30 04:30:45 +02:00
|
|
|
|
#include "const.h"
|
2010-02-01 07:25:16 +01:00
|
|
|
|
#include "debug.h"
|
2008-07-30 04:30:45 +02:00
|
|
|
|
|
2012-12-12 03:06:08 +01:00
|
|
|
|
#include <FL/Fl_Menu_Button.H>
|
|
|
|
|
#include "FL/menu_popup.H"
|
|
|
|
|
|
2013-04-22 08:14:52 +02:00
|
|
|
|
extern char *instance_name;
|
2012-12-12 03:06:08 +01:00
|
|
|
|
|
|
|
|
|
|
2008-06-18 06:01:22 +02:00
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
static Fl_Color
|
|
|
|
|
random_color ( void )
|
|
|
|
|
{
|
|
|
|
|
return fl_rgb_color( rand() % 255, rand() % 255, rand() % 255 );
|
|
|
|
|
}
|
2008-06-18 06:01:22 +02:00
|
|
|
|
|
2012-11-30 08:40:28 +01:00
|
|
|
|
static Fl_Menu_Button _menu( 0, 0, 0, 0, "Track" );
|
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
|
|
|
|
|
|
2008-04-25 07:15:08 +02:00
|
|
|
|
int Track::_soloing = 0;
|
|
|
|
|
|
2008-04-26 07:33:04 +02:00
|
|
|
|
const char *Track::capture_format = "Wav 24";
|
2012-10-27 23:12:02 +02:00
|
|
|
|
bool Track::colored_tracks = true;
|
2008-04-26 07:33:04 +02:00
|
|
|
|
|
2008-06-18 06:01:22 +02:00
|
|
|
|
|
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
Track::Track ( const char *L, int channels ) :
|
|
|
|
|
Fl_Group ( 0, 0, 0, 0, 0 )
|
2008-02-21 04:40:20 +01:00
|
|
|
|
{
|
2008-06-19 06:14:14 +02:00
|
|
|
|
init();
|
2008-02-21 04:40:20 +01:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
if ( L )
|
|
|
|
|
name( L );
|
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
color( random_color() );
|
2008-06-19 06:14:14 +02:00
|
|
|
|
|
|
|
|
|
configure_inputs( channels );
|
|
|
|
|
configure_outputs( channels );
|
|
|
|
|
|
|
|
|
|
log_create();
|
2008-03-07 03:29:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-09 19:28:48 +01:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
Track::Track ( ) : Fl_Group( 0, 0, 1, 1 )
|
2008-02-20 06:57:14 +01:00
|
|
|
|
{
|
2008-06-19 06:14:14 +02:00
|
|
|
|
init();
|
2008-02-20 08:53:54 +01:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
timeline->add_track( this );
|
2008-04-19 06:16:21 +02:00
|
|
|
|
}
|
2008-02-20 08:53:54 +01:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
Track::~Track ( )
|
2008-04-19 06:16:21 +02:00
|
|
|
|
{
|
2008-06-19 06:14:14 +02:00
|
|
|
|
Loggable::block_start();
|
2008-03-12 17:06:13 +01:00
|
|
|
|
|
2009-01-11 07:35:20 +01:00
|
|
|
|
/* must destroy sequences first to preserve proper log order */
|
|
|
|
|
takes->clear();
|
|
|
|
|
control->clear();
|
|
|
|
|
annotation->clear();
|
|
|
|
|
delete sequence();
|
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
takes = NULL;
|
|
|
|
|
control = NULL;
|
|
|
|
|
annotation = NULL;
|
2008-04-25 07:15:08 +02:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
log_destroy();
|
2008-03-07 03:29:02 +01:00
|
|
|
|
|
2009-01-11 07:35:20 +01:00
|
|
|
|
/* ensure that soloing accounting is performed */
|
|
|
|
|
solo( false );
|
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
timeline->remove_track( this );
|
2008-03-09 19:28:48 +01:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
/* give up our ports */
|
|
|
|
|
configure_inputs( 0 );
|
|
|
|
|
configure_outputs( 0 );
|
2008-03-10 02:07:04 +01:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
_sequence = NULL;
|
|
|
|
|
|
|
|
|
|
if ( _name )
|
|
|
|
|
free( _name );
|
|
|
|
|
|
|
|
|
|
Loggable::block_end();
|
2008-04-19 06:16:21 +02:00
|
|
|
|
}
|
2009-01-11 07:35:20 +01:00
|
|
|
|
|
2008-04-20 23:46:47 +02:00
|
|
|
|
void
|
|
|
|
|
Track::init ( void )
|
2008-04-19 06:16:21 +02:00
|
|
|
|
{
|
2013-08-24 23:21:44 +02:00
|
|
|
|
_capture_offset = 0;
|
2012-06-17 07:08:49 +02:00
|
|
|
|
_row = 0;
|
2008-05-07 18:18:57 +02:00
|
|
|
|
_sequence = NULL;
|
2008-04-19 06:16:21 +02:00
|
|
|
|
_name = NULL;
|
|
|
|
|
_selected = false;
|
|
|
|
|
_size = 1;
|
2008-03-12 17:06:13 +01:00
|
|
|
|
|
2008-04-30 05:50:58 +02:00
|
|
|
|
record_ds = NULL;
|
|
|
|
|
playback_ds = NULL;
|
|
|
|
|
|
2008-04-19 07:09:42 +02:00
|
|
|
|
labeltype( FL_NO_LABEL );
|
|
|
|
|
|
2008-05-27 05:32:35 +02:00
|
|
|
|
// clear_visible_focus();
|
|
|
|
|
|
2008-04-20 23:46:47 +02:00
|
|
|
|
Fl_Group::size( timeline->w(), height() );
|
2008-03-07 03:29:02 +01:00
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
Track *o = this;
|
2012-06-05 02:25:54 +02:00
|
|
|
|
o->box( FL_FLAT_BOX );
|
2012-02-24 06:59:50 +01:00
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
Track_Header *o = new Track_Header( x(), y(), w(), h() );
|
2012-12-02 01:14:01 +01:00
|
|
|
|
|
|
|
|
|
name_field = o->name_input;
|
|
|
|
|
record_button = o->rec_button;
|
|
|
|
|
mute_button = o->mute_button;
|
|
|
|
|
solo_button = o->solo_button;
|
2012-12-12 03:06:08 +01:00
|
|
|
|
menu_button = o->menu_button;
|
2012-12-02 01:14:01 +01:00
|
|
|
|
show_all_takes_button = o->show_all_takes_button;
|
|
|
|
|
overlay_controls_button = o->overlay_controls_button;
|
|
|
|
|
|
|
|
|
|
name_field->callback( cb_button, this );
|
|
|
|
|
record_button->callback( cb_button, this );
|
|
|
|
|
mute_button->callback( cb_button, this );
|
|
|
|
|
solo_button->callback( cb_button, this );
|
2008-03-07 03:29:02 +01:00
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
show_all_takes_button->callback( cb_button, this );
|
|
|
|
|
overlay_controls_button->callback( cb_button, this );
|
2012-12-12 03:06:08 +01:00
|
|
|
|
menu_button->callback( cb_button, this );
|
2008-03-07 03:29:02 +01:00
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
resizable( o );
|
2012-12-11 06:47:44 +01:00
|
|
|
|
// o->color( (Fl_Color)53 );
|
2012-12-02 01:14:01 +01:00
|
|
|
|
}
|
2012-12-11 06:47:44 +01:00
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
{
|
2012-12-02 01:14:01 +01:00
|
|
|
|
/* this pack holds the active sequence, annotation sequence, control sequences and takes */
|
2012-12-11 06:47:44 +01:00
|
|
|
|
Fl_Pack *o = pack = new Fl_Pack( x(), y(), w(), h() );
|
2012-03-06 09:42:51 +01:00
|
|
|
|
o->type( Fl_Pack::VERTICAL );
|
2008-04-19 06:16:21 +02:00
|
|
|
|
o->labeltype( FL_NO_LABEL );
|
2012-12-02 01:14:01 +01:00
|
|
|
|
/* o->resize( x() + width(), y(), w() - width(), h() ); */
|
2008-04-23 04:22:46 +02:00
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
/* resizable( o ); */
|
2008-02-20 07:35:29 +01:00
|
|
|
|
|
2008-05-05 01:06:36 +02:00
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
Fl_Pack *o = annotation = new Fl_Pack( 0, 0, pack->w(), 1 );
|
2012-03-06 09:42:51 +01:00
|
|
|
|
o->type( Fl_Pack::VERTICAL );
|
2008-05-05 01:06:36 +02:00
|
|
|
|
o->end();
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
{
|
|
|
|
|
Fl_Group *o = controls_heading = new Fl_Group( 0, 0, pack->w(), 10 );
|
|
|
|
|
o->box( FL_FLAT_BOX );
|
|
|
|
|
o->color( fl_color_add_alpha( fl_rgb_color( 1,1,1 ), 127 ) );
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Fl_Box *o = new Fl_Box( 0,0, Track::width(), 10 );
|
|
|
|
|
o->label( "Controls" );
|
|
|
|
|
o->align( FL_ALIGN_RIGHT | FL_ALIGN_INSIDE );
|
|
|
|
|
o->labelsize( 10 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o->hide();
|
|
|
|
|
o->end();
|
|
|
|
|
o->resizable( 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Fl_Sometimes_Pack *o = control = new Fl_Sometimes_Pack( 0, 0, pack->w(), 1 );
|
|
|
|
|
o->spacing( 1 );
|
|
|
|
|
o->box( FL_NO_BOX );
|
|
|
|
|
o->color( FL_BACKGROUND_COLOR );
|
|
|
|
|
o->type( Fl_Pack::VERTICAL );
|
|
|
|
|
o->pack( true );
|
|
|
|
|
o->hide();
|
|
|
|
|
o->align( FL_ALIGN_TOP | FL_ALIGN_LEFT );
|
|
|
|
|
o->end();
|
|
|
|
|
}
|
2008-04-19 06:16:21 +02:00
|
|
|
|
}
|
2008-03-03 19:59:05 +01:00
|
|
|
|
|
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
{
|
|
|
|
|
Fl_Group *o = takes_heading = new Fl_Group( 0, 0, pack->w(), 10 );
|
|
|
|
|
o->box( FL_FLAT_BOX );
|
|
|
|
|
o->color( fl_color_add_alpha( fl_rgb_color( 1,1,1 ), 127 ) );
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Fl_Box *o = new Fl_Box( 0,0, Track::width(), 10 );
|
|
|
|
|
o->label( "Takes" );
|
|
|
|
|
o->align( FL_ALIGN_RIGHT | FL_ALIGN_INSIDE );
|
|
|
|
|
o->labelsize( 10 );
|
|
|
|
|
}
|
|
|
|
|
o->hide();
|
|
|
|
|
o->end();
|
|
|
|
|
o->resizable( 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Fl_Pack *o = takes = new Fl_Pack( 0, 0, pack->w(), 1 );
|
2012-03-06 09:42:51 +01:00
|
|
|
|
o->type( Fl_Pack::VERTICAL );
|
2008-04-19 06:16:21 +02:00
|
|
|
|
o->end();
|
|
|
|
|
o->hide();
|
2012-12-11 06:47:44 +01:00
|
|
|
|
o->align( FL_ALIGN_TOP | FL_ALIGN_LEFT );
|
|
|
|
|
}
|
2008-03-03 19:59:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
o->end();
|
|
|
|
|
}
|
|
|
|
|
end();
|
2008-04-20 23:46:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
|
2008-04-20 23:46:47 +02:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
void
|
|
|
|
|
Track::set ( Log_Entry &e )
|
2008-04-20 23:46:47 +02:00
|
|
|
|
{
|
2008-06-19 06:14:14 +02:00
|
|
|
|
for ( int i = 0; i < e.size(); ++i )
|
|
|
|
|
{
|
|
|
|
|
const char *s, *v;
|
2008-04-20 23:46:47 +02:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
e.get( i, &s, &v );
|
2008-04-19 07:26:43 +02:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
if ( ! strcmp( s, ":height" ) )
|
|
|
|
|
{
|
|
|
|
|
size( atoi( v ) );
|
2012-05-31 07:58:35 +02:00
|
|
|
|
adjust_size();
|
2008-06-19 06:14:14 +02:00
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( s, ":selected" ) )
|
|
|
|
|
_selected = atoi( v );
|
|
|
|
|
// else if ( ! strcmp( s, ":armed"
|
|
|
|
|
else if ( ! strcmp( s, ":name" ) )
|
|
|
|
|
name( v );
|
|
|
|
|
else if ( ! strcmp( s, ":inputs" ) )
|
|
|
|
|
configure_inputs( atoi( v ) );
|
|
|
|
|
else if ( ! strcmp( s, ":outputs" ) )
|
|
|
|
|
configure_outputs( atoi( v ) );
|
|
|
|
|
else if ( ! strcmp( s, ":color" ) )
|
|
|
|
|
{
|
|
|
|
|
color( (Fl_Color)atoll( v ) );
|
|
|
|
|
redraw();
|
|
|
|
|
}
|
2008-06-22 05:01:04 +02:00
|
|
|
|
else if ( ! strcmp( s, ":show-all-takes" ) )
|
|
|
|
|
show_all_takes( atoi( v ) );
|
2012-12-02 01:14:01 +01:00
|
|
|
|
else if ( ! strcmp( s, ":overlay-controls" ) )
|
|
|
|
|
overlay_controls( atoi( v ) );
|
2009-01-11 07:35:20 +01:00
|
|
|
|
else if ( ! strcmp( s, ":solo" ) )
|
|
|
|
|
solo( atoi( v ) );
|
|
|
|
|
else if ( ! strcmp( s, ":mute" ) )
|
|
|
|
|
mute( atoi( v ) );
|
|
|
|
|
else if ( ! strcmp( s, ":arm" ) )
|
|
|
|
|
armed( atoi( v ) );
|
2008-06-19 06:14:14 +02:00
|
|
|
|
else if ( ! strcmp( s, ":sequence" ) )
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
sscanf( v, "%X", &i );
|
2008-04-21 20:01:03 +02:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
if ( i )
|
|
|
|
|
{
|
|
|
|
|
Audio_Sequence *t = (Audio_Sequence*)Loggable::find( i );
|
|
|
|
|
|
|
|
|
|
/* FIXME: our track might not have been
|
|
|
|
|
* defined yet... what should we do about this
|
|
|
|
|
* chicken/egg problem? */
|
|
|
|
|
if ( t )
|
|
|
|
|
{
|
|
|
|
|
// assert( t );
|
|
|
|
|
|
|
|
|
|
sequence( t );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2012-06-17 07:08:49 +02:00
|
|
|
|
else if ( ! strcmp( s, ":row" ) )
|
|
|
|
|
row( atoi( v ) );
|
2008-06-19 06:14:14 +02:00
|
|
|
|
}
|
2008-04-19 06:16:21 +02:00
|
|
|
|
}
|
2008-03-03 19:59:05 +01:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
void
|
|
|
|
|
Track::get ( Log_Entry &e ) const
|
2008-02-20 07:35:29 +01:00
|
|
|
|
{
|
2008-06-19 06:14:14 +02:00
|
|
|
|
e.add( ":name", _name );
|
2008-06-22 05:01:04 +02:00
|
|
|
|
e.add( ":sequence", sequence() );
|
2008-06-19 06:14:14 +02:00
|
|
|
|
e.add( ":selected", _selected );
|
2009-01-11 07:35:20 +01:00
|
|
|
|
e.add( ":color", (unsigned long)color());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Track::get_unjournaled ( Log_Entry &e ) const
|
|
|
|
|
{
|
2008-06-19 06:14:14 +02:00
|
|
|
|
e.add( ":height", size() );
|
|
|
|
|
e.add( ":inputs", input.size() );
|
|
|
|
|
e.add( ":outputs", output.size() );
|
2012-12-02 01:14:01 +01:00
|
|
|
|
e.add( ":show-all-takes", show_all_takes() );
|
|
|
|
|
e.add( ":overlay-controls", overlay_controls() );
|
2009-01-11 07:35:20 +01:00
|
|
|
|
e.add( ":armed", armed() );
|
|
|
|
|
e.add( ":mute", mute() );
|
|
|
|
|
e.add( ":solo", solo() );
|
2012-06-17 07:08:49 +02:00
|
|
|
|
e.add( ":row", timeline->find_track( this ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
Track::row ( void ) const
|
|
|
|
|
{
|
|
|
|
|
return _row;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Track::row ( int n )
|
|
|
|
|
{
|
|
|
|
|
_row = n;
|
2008-06-19 06:14:14 +02:00
|
|
|
|
}
|
2008-06-06 06:14:00 +02:00
|
|
|
|
|
2008-08-04 05:54:22 +02:00
|
|
|
|
void
|
|
|
|
|
Track::log_children ( void ) const
|
|
|
|
|
{
|
|
|
|
|
log_create();
|
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
for ( int i = 0; i < control->children(); i++ )
|
2008-08-04 05:54:22 +02:00
|
|
|
|
((Sequence*)control->child( i ))->log_children();
|
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
for ( int i = 0; i < annotation->children(); i++ )
|
2008-08-04 05:54:22 +02:00
|
|
|
|
((Sequence*)annotation->child( i ))->log_children();
|
|
|
|
|
|
2012-12-11 06:31:25 +01:00
|
|
|
|
for ( int i = takes->children(); i--; )
|
2008-08-04 05:54:22 +02:00
|
|
|
|
((Sequence*)takes->child( i ))->log_children();
|
|
|
|
|
|
|
|
|
|
sequence()->log_children();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Track::solo ( bool b )
|
|
|
|
|
{
|
|
|
|
|
if ( b && ! solo_button->value() )
|
|
|
|
|
++_soloing;
|
|
|
|
|
else if ( ! b && solo_button->value() )
|
|
|
|
|
--_soloing;
|
|
|
|
|
|
|
|
|
|
solo_button->value( b );
|
|
|
|
|
}
|
2008-06-06 06:14:00 +02:00
|
|
|
|
|
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
void
|
|
|
|
|
Track::cb_button ( Fl_Widget *w, void *v )
|
|
|
|
|
{
|
|
|
|
|
((Track*)v)->cb_button( w );
|
|
|
|
|
}
|
2008-05-28 02:36:17 +02:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
void
|
|
|
|
|
Track::cb_button ( Fl_Widget *w )
|
|
|
|
|
{
|
2012-12-02 01:14:01 +01:00
|
|
|
|
Logger log(this);
|
2008-06-06 06:14:00 +02:00
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
if ( w == name_field )
|
|
|
|
|
{
|
|
|
|
|
name( name_field->value() );
|
|
|
|
|
}
|
|
|
|
|
else if ( w == record_button )
|
2008-06-19 06:14:14 +02:00
|
|
|
|
{
|
2008-02-20 07:35:29 +01:00
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
}
|
2012-12-02 01:14:01 +01:00
|
|
|
|
else if ( w == mute_button )
|
2008-06-19 06:14:14 +02:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2012-12-02 01:14:01 +01:00
|
|
|
|
else if ( w == solo_button )
|
2008-06-19 06:14:14 +02:00
|
|
|
|
{
|
|
|
|
|
if ( solo_button->value() )
|
|
|
|
|
++_soloing;
|
|
|
|
|
else
|
|
|
|
|
--_soloing;
|
|
|
|
|
}
|
2012-12-02 01:14:01 +01:00
|
|
|
|
else if ( w == show_all_takes_button )
|
|
|
|
|
{
|
|
|
|
|
show_all_takes( show_all_takes_button->value() );
|
|
|
|
|
}
|
|
|
|
|
else if ( w == overlay_controls_button )
|
|
|
|
|
{
|
|
|
|
|
overlay_controls( overlay_controls_button->value() );
|
|
|
|
|
}
|
2012-12-12 03:06:08 +01:00
|
|
|
|
else if ( w == menu_button )
|
|
|
|
|
{
|
|
|
|
|
menu_popup( &menu(), menu_button->x(), menu_button->y() );
|
|
|
|
|
}
|
2008-06-19 06:14:14 +02:00
|
|
|
|
}
|
2008-04-19 06:16:21 +02:00
|
|
|
|
|
|
|
|
|
static int pack_visible( Fl_Pack *p )
|
2008-03-05 20:06:41 +01:00
|
|
|
|
{
|
2008-04-19 06:16:21 +02:00
|
|
|
|
int v = 0;
|
|
|
|
|
for ( int i = p->children(); i--; )
|
|
|
|
|
if ( p->child( i )->visible() )
|
|
|
|
|
v++;
|
2008-03-05 20:06:41 +01:00
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
return v;
|
2008-03-05 20:06:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
/* adjust size of widget and children */
|
2008-02-20 06:57:14 +01:00
|
|
|
|
void
|
2012-05-31 07:58:35 +02:00
|
|
|
|
Track::adjust_size ( void )
|
2008-02-20 06:57:14 +01:00
|
|
|
|
{
|
2008-04-19 06:16:21 +02:00
|
|
|
|
for ( int i = takes->children(); i--; )
|
|
|
|
|
takes->child( i )->size( w(), height() );
|
|
|
|
|
|
2008-05-05 01:06:36 +02:00
|
|
|
|
for ( int i = annotation->children(); i--; )
|
|
|
|
|
annotation->child( i )->size( w(), 24 );
|
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
for ( int i = control->children(); i--; )
|
|
|
|
|
control->child( i )->size( w(), height() );
|
2008-02-24 11:58:16 +01:00
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
if ( overlay_controls() )
|
|
|
|
|
{
|
|
|
|
|
for ( int i = 0; i < control->children(); i++ )
|
|
|
|
|
{
|
|
|
|
|
Control_Sequence *o = (Control_Sequence*)control->child(i);
|
|
|
|
|
|
|
|
|
|
if ( i != 0 )
|
|
|
|
|
o->box( FL_NO_BOX );
|
2012-12-02 01:14:01 +01:00
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
o->header()->hide();
|
|
|
|
|
}
|
2008-05-06 04:56:26 +02:00
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
control->pack( false );
|
|
|
|
|
}
|
|
|
|
|
else
|
2008-04-19 06:16:21 +02:00
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
for ( int i = 0; i < control->children(); i++ )
|
|
|
|
|
{
|
|
|
|
|
Control_Sequence *o = (Control_Sequence*)control->child(i);
|
|
|
|
|
|
|
|
|
|
o->box( FL_FLAT_BOX );
|
|
|
|
|
|
|
|
|
|
o->header()->show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
control->pack( true );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int TY = 0;
|
|
|
|
|
|
|
|
|
|
if ( annotation->children() )
|
|
|
|
|
{
|
|
|
|
|
annotation->show();
|
|
|
|
|
TY += 24 * pack_visible( annotation );
|
2008-04-19 06:16:21 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
2012-12-11 06:47:44 +01:00
|
|
|
|
annotation->hide();
|
|
|
|
|
|
|
|
|
|
/* height of the sequence */
|
|
|
|
|
TY += height();
|
2012-12-02 01:14:01 +01:00
|
|
|
|
|
|
|
|
|
if ( control->children() )
|
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
int TH;
|
|
|
|
|
|
|
|
|
|
/* calculate height of control pack */
|
2012-12-02 01:14:01 +01:00
|
|
|
|
if ( overlay_controls() )
|
2012-12-11 06:47:44 +01:00
|
|
|
|
TH = height() * (control->children() ? 1 : 0);
|
2012-12-02 01:14:01 +01:00
|
|
|
|
else
|
2012-12-11 06:47:44 +01:00
|
|
|
|
TH = height() * pack_visible( control );
|
|
|
|
|
|
|
|
|
|
TY += TH;
|
|
|
|
|
|
|
|
|
|
control->show();
|
|
|
|
|
controls_heading->show();
|
2012-12-02 01:14:01 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2012-12-11 06:47:44 +01:00
|
|
|
|
{
|
2012-12-02 01:14:01 +01:00
|
|
|
|
control->hide();
|
2012-12-11 06:47:44 +01:00
|
|
|
|
controls_heading->hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( show_all_takes() )
|
2012-12-02 01:14:01 +01:00
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
/* calculate height of takes pack */
|
|
|
|
|
const int TH = height() * takes->children();
|
|
|
|
|
|
|
|
|
|
TY += TH;
|
|
|
|
|
|
|
|
|
|
takes->show();
|
|
|
|
|
takes_heading->show();
|
2008-02-20 06:57:14 +01:00
|
|
|
|
}
|
2012-12-02 01:14:01 +01:00
|
|
|
|
else
|
2012-12-11 06:47:44 +01:00
|
|
|
|
{
|
|
|
|
|
takes_heading->hide();
|
|
|
|
|
takes->hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( takes_heading->visible() )
|
|
|
|
|
TY += takes_heading->h();
|
|
|
|
|
if ( controls_heading->visible() )
|
|
|
|
|
TY += controls_heading->h();
|
|
|
|
|
|
|
|
|
|
int TH;
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
if ( ! size() )
|
|
|
|
|
{
|
|
|
|
|
takes->hide();
|
|
|
|
|
control->hide();
|
2012-12-11 06:47:44 +01:00
|
|
|
|
TH = height();
|
2012-12-02 01:14:01 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2012-12-11 06:47:44 +01:00
|
|
|
|
TH = TY;
|
2008-05-05 01:06:36 +02:00
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
Fl_Group::size( w(), TH );
|
|
|
|
|
|
2008-05-07 18:18:57 +02:00
|
|
|
|
if ( sequence() )
|
|
|
|
|
sequence()->size( w(), height() );
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2008-04-28 06:42:05 +02:00
|
|
|
|
/* FIXME: why is this necessary? */
|
2008-04-24 09:08:23 +02:00
|
|
|
|
if ( parent() )
|
2008-04-28 06:42:05 +02:00
|
|
|
|
parent()->parent()->redraw();
|
2008-02-20 06:57:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
void
|
|
|
|
|
Track::name ( const char *name )
|
|
|
|
|
{
|
|
|
|
|
if ( _name )
|
|
|
|
|
free( _name );
|
|
|
|
|
|
|
|
|
|
_name = timeline->get_unique_track_name(name);
|
|
|
|
|
|
|
|
|
|
if ( name_field )
|
|
|
|
|
name_field->value( _name );
|
|
|
|
|
|
|
|
|
|
update_port_names();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *
|
|
|
|
|
Track::name ( void ) const
|
|
|
|
|
{
|
|
|
|
|
return _name;
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-20 08:24:56 +01:00
|
|
|
|
void
|
2008-04-19 06:16:21 +02:00
|
|
|
|
Track::size ( int v )
|
2008-02-20 08:24:56 +01:00
|
|
|
|
{
|
2015-04-04 23:53:18 +02:00
|
|
|
|
if ( v < 0 || v > 4 )
|
2008-04-19 06:16:21 +02:00
|
|
|
|
return;
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
_size = v;
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2012-05-31 07:58:35 +02:00
|
|
|
|
adjust_size();
|
2008-04-19 06:16:21 +02:00
|
|
|
|
}
|
2008-02-28 21:36:46 +01:00
|
|
|
|
|
2008-06-22 05:01:04 +02:00
|
|
|
|
|
2008-04-21 02:28:59 +02:00
|
|
|
|
void
|
2008-05-05 07:29:39 +02:00
|
|
|
|
Track::add ( Audio_Sequence * t )
|
2008-04-21 02:28:59 +02:00
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
t->track( this );
|
|
|
|
|
|
2008-04-21 02:28:59 +02:00
|
|
|
|
takes->insert( *t, 0 );
|
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
/* show the take header */
|
|
|
|
|
t->child(0)->show();
|
|
|
|
|
|
2008-12-06 22:45:37 +01:00
|
|
|
|
t->color( fl_color_average( FL_BLACK, FL_GRAY, 0.25f ) );
|
|
|
|
|
|
2008-04-23 23:00:51 +02:00
|
|
|
|
t->labeltype( FL_ENGRAVED_LABEL );
|
2008-04-21 02:28:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2008-05-05 07:29:39 +02:00
|
|
|
|
Track::remove ( Audio_Sequence *t )
|
2008-04-21 02:28:59 +02:00
|
|
|
|
{
|
2008-05-28 02:36:17 +02:00
|
|
|
|
if ( ! takes )
|
|
|
|
|
return;
|
|
|
|
|
|
2008-08-01 06:18:43 +02:00
|
|
|
|
if ( sequence() == t )
|
|
|
|
|
{
|
|
|
|
|
pack->remove( t );
|
|
|
|
|
|
|
|
|
|
if ( takes->children() )
|
|
|
|
|
sequence( (Audio_Sequence*)takes->child( 0 ) );
|
|
|
|
|
else
|
|
|
|
|
/* FIXME: should this ever happen? */
|
|
|
|
|
_sequence = NULL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
takes->remove( t );
|
2008-04-21 05:05:25 +02:00
|
|
|
|
|
2008-06-22 05:01:04 +02:00
|
|
|
|
/* delete t; */
|
|
|
|
|
|
2012-05-31 07:58:35 +02:00
|
|
|
|
adjust_size();
|
2008-04-21 02:28:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-05-26 08:20:49 +02:00
|
|
|
|
void
|
|
|
|
|
Track::remove ( Annotation_Sequence *t )
|
|
|
|
|
{
|
2008-05-28 02:36:17 +02:00
|
|
|
|
if ( ! annotation )
|
|
|
|
|
return;
|
|
|
|
|
|
2008-05-26 08:20:49 +02:00
|
|
|
|
annotation->remove( t );
|
|
|
|
|
|
2012-05-31 07:58:35 +02:00
|
|
|
|
adjust_size();
|
2008-05-26 08:20:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-21 02:28:59 +02:00
|
|
|
|
void
|
|
|
|
|
Track::remove ( Control_Sequence *t )
|
|
|
|
|
{
|
2008-05-28 02:36:17 +02:00
|
|
|
|
if ( ! control )
|
|
|
|
|
return;
|
|
|
|
|
|
2008-04-21 02:28:59 +02:00
|
|
|
|
control->remove( t );
|
2008-04-21 05:05:25 +02:00
|
|
|
|
|
2012-05-31 07:58:35 +02:00
|
|
|
|
adjust_size();
|
2008-04-21 02:28:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
void
|
2008-05-07 18:18:57 +02:00
|
|
|
|
Track::sequence ( Audio_Sequence * t )
|
2008-04-19 06:16:21 +02:00
|
|
|
|
{
|
2012-11-30 08:40:28 +01:00
|
|
|
|
if ( sequence() == t )
|
|
|
|
|
{
|
|
|
|
|
DMESSAGE( "Attempt to set sequence twice" );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-20 23:46:47 +02:00
|
|
|
|
t->track( this );
|
|
|
|
|
|
2008-05-07 18:18:57 +02:00
|
|
|
|
if ( sequence() )
|
|
|
|
|
add( sequence() );
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2008-05-07 18:18:57 +02:00
|
|
|
|
_sequence = t;
|
2012-12-02 01:14:01 +01:00
|
|
|
|
/* insert following the annotation pack */
|
2008-05-05 01:06:36 +02:00
|
|
|
|
pack->insert( *t, 1 );
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
/* hide the take header */
|
|
|
|
|
t->child(0)->hide();
|
|
|
|
|
|
2008-12-06 22:45:37 +01:00
|
|
|
|
t->color( FL_GRAY );
|
2008-04-23 23:00:51 +02:00
|
|
|
|
t->labeltype( FL_NO_LABEL );
|
|
|
|
|
|
2012-05-31 07:58:35 +02:00
|
|
|
|
adjust_size();
|
2008-04-19 06:16:21 +02:00
|
|
|
|
}
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
|
2008-04-19 06:16:21 +02:00
|
|
|
|
void
|
2008-04-20 23:46:47 +02:00
|
|
|
|
Track::add ( Control_Sequence *t )
|
2008-04-19 06:16:21 +02:00
|
|
|
|
{
|
2008-05-06 06:37:45 +02:00
|
|
|
|
DMESSAGE( "adding control sequence" );
|
2008-04-21 05:05:25 +02:00
|
|
|
|
|
2008-04-20 23:46:47 +02:00
|
|
|
|
t->track( this );
|
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
t->color( random_color() );
|
|
|
|
|
|
|
|
|
|
// control->insert( *t, 0 );
|
2008-04-19 06:16:21 +02:00
|
|
|
|
control->add( t );
|
2012-04-27 19:14:53 +02:00
|
|
|
|
|
2012-05-31 07:58:35 +02:00
|
|
|
|
adjust_size();
|
2008-04-19 06:16:21 +02:00
|
|
|
|
}
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2008-05-05 01:06:36 +02:00
|
|
|
|
void
|
|
|
|
|
Track::add ( Annotation_Sequence *t )
|
|
|
|
|
{
|
2008-05-06 06:37:45 +02:00
|
|
|
|
DMESSAGE( "adding annotation sequence" );
|
2008-05-05 01:06:36 +02:00
|
|
|
|
|
|
|
|
|
t->track( this );
|
|
|
|
|
|
|
|
|
|
annotation->add( t );
|
|
|
|
|
|
2012-05-31 07:58:35 +02:00
|
|
|
|
adjust_size();
|
2008-05-05 01:06:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-29 22:47:03 +02:00
|
|
|
|
/** add all widget on this track falling within the given rectangle to
|
|
|
|
|
the selection. */
|
|
|
|
|
void
|
|
|
|
|
Track::select ( int X, int Y, int W, int H,
|
|
|
|
|
bool include_control, bool merge_control )
|
|
|
|
|
{
|
|
|
|
|
|
2008-05-07 18:18:57 +02:00
|
|
|
|
Sequence *t = sequence();
|
2008-04-29 22:47:03 +02:00
|
|
|
|
|
2012-12-11 07:58:18 +01:00
|
|
|
|
X -= Track::width();
|
|
|
|
|
|
2008-04-29 22:47:03 +02:00
|
|
|
|
if ( ! ( t->y() > Y + H || t->y() + t->h() < Y ) )
|
|
|
|
|
t->select_range( X, W );
|
|
|
|
|
else
|
|
|
|
|
include_control = true;
|
|
|
|
|
|
|
|
|
|
if ( include_control )
|
|
|
|
|
for ( int i = control->children(); i--; )
|
|
|
|
|
{
|
|
|
|
|
Control_Sequence *c = (Control_Sequence*)control->child( i );
|
|
|
|
|
|
|
|
|
|
if ( merge_control ||
|
|
|
|
|
( c->y() >= Y && c->y() + c->h() <= Y + H ) )
|
|
|
|
|
c->select_range( X, W );
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-02-20 06:57:14 +01:00
|
|
|
|
|
2008-04-20 23:46:47 +02:00
|
|
|
|
|
2008-05-30 05:28:56 +02:00
|
|
|
|
void
|
|
|
|
|
Track::menu_cb ( Fl_Widget *w, void *v )
|
|
|
|
|
{
|
|
|
|
|
((Track*)v)->menu_cb( (Fl_Menu_*) w );
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-23 02:18:52 +01:00
|
|
|
|
void
|
|
|
|
|
Track::command_configure_channels ( int n )
|
|
|
|
|
{
|
|
|
|
|
/* due to locking this should only be invoked by direct user action */
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.wrlock();
|
2013-02-23 02:18:52 +01:00
|
|
|
|
configure_inputs( n );
|
|
|
|
|
configure_outputs( n );
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.unlock();
|
2013-02-23 02:18:52 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-05-30 05:28:56 +02:00
|
|
|
|
void
|
|
|
|
|
Track::menu_cb ( const Fl_Menu_ *m )
|
|
|
|
|
{
|
|
|
|
|
char picked[256];
|
|
|
|
|
|
|
|
|
|
m->item_pathname( picked, sizeof( picked ) );
|
|
|
|
|
|
2012-11-30 08:40:28 +01:00
|
|
|
|
DMESSAGE( "Picked: %s", picked );
|
|
|
|
|
|
2010-01-17 19:59:10 +01:00
|
|
|
|
Logger log( this );
|
|
|
|
|
|
|
|
|
|
if ( ! strcmp( picked, "Type/Mono" ) )
|
|
|
|
|
{
|
2013-02-23 02:18:52 +01:00
|
|
|
|
command_configure_channels( 1 );
|
2010-01-17 19:59:10 +01:00
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "Type/Stereo" ) )
|
|
|
|
|
{
|
2013-02-23 02:18:52 +01:00
|
|
|
|
command_configure_channels( 2 );
|
2010-01-17 19:59:10 +01:00
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "Type/Quad" ) )
|
|
|
|
|
{
|
2013-02-23 02:18:52 +01:00
|
|
|
|
command_configure_channels( 4 );
|
2010-01-17 19:59:10 +01:00
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "Type/..." ) )
|
|
|
|
|
{
|
|
|
|
|
const char *s = fl_input( "How many channels?", "3" );
|
|
|
|
|
if ( s )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int c = atoi( s );
|
|
|
|
|
|
|
|
|
|
if ( c <= 0 || c > 10 )
|
|
|
|
|
fl_alert( "Invalid number of channels." );
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-02-23 02:18:52 +01:00
|
|
|
|
command_configure_channels(c);
|
2010-01-17 19:59:10 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "/Add Control" ) )
|
|
|
|
|
{
|
2012-12-11 06:47:44 +01:00
|
|
|
|
/* add audio track */
|
|
|
|
|
char *name = get_unique_control_name( "Control" );
|
|
|
|
|
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.wrlock();
|
2012-12-11 06:47:44 +01:00
|
|
|
|
new Control_Sequence( this, name );
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.unlock();
|
2010-01-17 19:59:10 +01:00
|
|
|
|
}
|
2012-12-02 01:14:01 +01:00
|
|
|
|
else if ( ! strcmp( picked, "/Overlay controls" ) )
|
|
|
|
|
{
|
|
|
|
|
overlay_controls( ! m->mvalue()->value() );
|
|
|
|
|
}
|
2010-01-17 19:59:10 +01:00
|
|
|
|
else if ( ! strcmp( picked, "/Add Annotation" ) )
|
|
|
|
|
{
|
|
|
|
|
add( new Annotation_Sequence( this ) );
|
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "/Color" ) )
|
|
|
|
|
{
|
|
|
|
|
unsigned char r, g, b;
|
|
|
|
|
|
|
|
|
|
Fl::get_color( color(), r, g, b );
|
|
|
|
|
|
|
|
|
|
if ( fl_color_chooser( "Track Color", r, g, b ) )
|
|
|
|
|
{
|
|
|
|
|
color( fl_rgb_color( r, g, b ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
redraw();
|
|
|
|
|
}
|
2010-01-30 07:01:02 +01:00
|
|
|
|
else if ( ! strcmp( picked, "Flags/Record" ) )
|
|
|
|
|
{
|
|
|
|
|
armed( m->mvalue()->flags & FL_MENU_VALUE );
|
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "Flags/Mute" ) )
|
|
|
|
|
{
|
|
|
|
|
mute( m->mvalue()->flags & FL_MENU_VALUE );
|
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "Flags/Solo" ) )
|
|
|
|
|
{
|
|
|
|
|
solo( m->mvalue()->flags & FL_MENU_VALUE );
|
|
|
|
|
}
|
2010-01-30 07:42:26 +01:00
|
|
|
|
else if ( ! strcmp( picked, "Size/Small" ) )
|
|
|
|
|
{
|
|
|
|
|
size( 0 );
|
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "Size/Medium" ) )
|
|
|
|
|
{
|
|
|
|
|
size( 1 );
|
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "Size/Large" ) )
|
|
|
|
|
{
|
|
|
|
|
size( 2 );
|
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "Size/Huge" ) )
|
|
|
|
|
{
|
|
|
|
|
size( 3 );
|
|
|
|
|
}
|
2015-04-04 23:53:18 +02:00
|
|
|
|
else if ( ! strcmp( picked, "Size/Enormous" ) )
|
|
|
|
|
{
|
|
|
|
|
size( 4 );
|
|
|
|
|
}
|
2010-01-17 19:59:10 +01:00
|
|
|
|
else if ( ! strcmp( picked, "/Remove" ) )
|
|
|
|
|
{
|
|
|
|
|
int r = fl_choice( "Are you certain you want to remove track \"%s\"?", "Cancel", NULL, "Remove", name() );
|
|
|
|
|
|
|
|
|
|
if ( r == 2 )
|
|
|
|
|
{
|
2013-02-23 02:18:52 +01:00
|
|
|
|
timeline->command_remove_track( this );
|
|
|
|
|
Fl::delete_widget( this );
|
2010-01-17 19:59:10 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "/Rename" ) )
|
|
|
|
|
{
|
|
|
|
|
((Fl_Sometimes_Input*)name_field)->take_focus();
|
|
|
|
|
}
|
2012-06-17 07:08:49 +02:00
|
|
|
|
else if ( ! strcmp( picked, "/Move Up" ) )
|
|
|
|
|
{
|
2013-02-23 02:18:52 +01:00
|
|
|
|
timeline->command_move_track_up( this );
|
2012-06-17 07:08:49 +02:00
|
|
|
|
}
|
|
|
|
|
else if ( ! strcmp( picked, "/Move Down" ) )
|
|
|
|
|
{
|
2013-02-23 02:18:52 +01:00
|
|
|
|
timeline->command_move_track_down( this );
|
2012-06-17 07:08:49 +02:00
|
|
|
|
}
|
2012-11-30 08:40:28 +01:00
|
|
|
|
else if ( !strcmp( picked, "Takes/Show all takes" ) )
|
|
|
|
|
{
|
|
|
|
|
show_all_takes( ! m->mvalue()->value() );
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp( picked, "Takes/New" ) )
|
|
|
|
|
{
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.wrlock();
|
2012-11-30 08:40:28 +01:00
|
|
|
|
sequence( (Audio_Sequence*)sequence()->clone_empty() );
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.unlock();
|
2012-11-30 08:40:28 +01:00
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp( picked, "Takes/Remove" ) )
|
|
|
|
|
{
|
|
|
|
|
if ( takes->children() )
|
|
|
|
|
{
|
|
|
|
|
Loggable::block_start();
|
|
|
|
|
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.wrlock();
|
2013-02-23 02:18:52 +01:00
|
|
|
|
|
2012-11-30 08:40:28 +01:00
|
|
|
|
Audio_Sequence *s = sequence();
|
|
|
|
|
|
|
|
|
|
sequence( (Audio_Sequence*)takes->child( 0 ) );
|
|
|
|
|
|
|
|
|
|
delete s;
|
|
|
|
|
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.unlock();
|
2013-02-23 02:18:52 +01:00
|
|
|
|
|
2012-11-30 08:40:28 +01:00
|
|
|
|
Loggable::block_end();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp( picked, "Takes/Remove others" ))
|
|
|
|
|
{
|
|
|
|
|
if ( takes->children() )
|
|
|
|
|
{
|
|
|
|
|
Loggable::block_start();
|
|
|
|
|
|
|
|
|
|
takes->clear();
|
|
|
|
|
|
|
|
|
|
Loggable::block_end();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( !strncmp( picked, "Takes/", sizeof( "Takes/" ) - 1 ) )
|
|
|
|
|
{
|
|
|
|
|
Audio_Sequence* s = (Audio_Sequence*)m->mvalue()->user_data();
|
|
|
|
|
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.wrlock();
|
2012-11-30 08:40:28 +01:00
|
|
|
|
sequence( s );
|
2013-10-25 03:21:45 +02:00
|
|
|
|
timeline->track_lock.unlock();
|
2012-11-30 08:40:28 +01:00
|
|
|
|
}
|
2008-05-30 05:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
/** retrun a pointer to the control sequence named /name/, or NULL if no control sequence is named /name/ */
|
|
|
|
|
Control_Sequence *
|
|
|
|
|
Track::control_by_name ( const char *name )
|
|
|
|
|
{
|
|
|
|
|
for ( int i = control->children(); i-- ; )
|
|
|
|
|
{
|
|
|
|
|
Control_Sequence *t = (Control_Sequence*)control->child( i );
|
|
|
|
|
|
|
|
|
|
if ( t->name() && name && ! strcmp( name, t->name() ) )
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** return a malloc'd string representing a unique name for a new control sequence */
|
|
|
|
|
char *
|
|
|
|
|
Track::get_unique_control_name ( const char *name )
|
|
|
|
|
{
|
|
|
|
|
char pat[256];
|
|
|
|
|
|
|
|
|
|
strcpy( pat, name );
|
|
|
|
|
|
|
|
|
|
for ( int i = 1; control_by_name( pat ); ++i )
|
|
|
|
|
snprintf( pat, sizeof( pat ), "%s.%d", name, i );
|
|
|
|
|
|
|
|
|
|
return strdup( pat );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-05-30 05:28:56 +02:00
|
|
|
|
/** build the context menu */
|
|
|
|
|
Fl_Menu_Button &
|
|
|
|
|
Track::menu ( void ) const
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int c = output.size();
|
2010-01-30 07:42:26 +01:00
|
|
|
|
int s = size();
|
2008-05-30 05:28:56 +02:00
|
|
|
|
|
2012-11-30 08:40:28 +01:00
|
|
|
|
_menu.clear();
|
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
_menu.add( "Takes/Show all takes", 0, 0, 0, FL_MENU_TOGGLE | ( show_all_takes() ? FL_MENU_VALUE : 0 ) );
|
2012-11-30 08:40:28 +01:00
|
|
|
|
_menu.add( "Takes/New", 0, 0, 0 );
|
|
|
|
|
|
|
|
|
|
if ( takes->children() )
|
|
|
|
|
{
|
|
|
|
|
_menu.add( "Takes/Remove", 0, 0, 0 );
|
|
|
|
|
_menu.add( "Takes/Remove others", 0, 0, 0, FL_MENU_DIVIDER );
|
|
|
|
|
|
|
|
|
|
for ( int i = 0; i < takes->children(); ++i )
|
2008-05-30 05:28:56 +02:00
|
|
|
|
{
|
2012-11-30 08:40:28 +01:00
|
|
|
|
Sequence *s = (Sequence *)takes->child( i );
|
|
|
|
|
|
|
|
|
|
char n[256];
|
|
|
|
|
snprintf( n, sizeof(n), "Takes/%s", s->name() );
|
|
|
|
|
|
|
|
|
|
_menu.add( n, 0, 0, s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_menu.add( "Type/Mono", 0, 0, 0, FL_MENU_RADIO | ( c == 1 ? FL_MENU_VALUE : 0 ) );
|
|
|
|
|
_menu.add( "Type/Stereo", 0, 0, 0, FL_MENU_RADIO | ( c == 2 ? FL_MENU_VALUE : 0 ));
|
|
|
|
|
_menu.add( "Type/Quad", 0, 0, 0, FL_MENU_RADIO | ( c == 4 ? FL_MENU_VALUE : 0 ) );
|
|
|
|
|
_menu.add( "Type/...", 0, 0, 0, FL_MENU_RADIO | ( c == 3 || c > 4 ? FL_MENU_VALUE : 0 ) );
|
2012-12-02 01:14:01 +01:00
|
|
|
|
_menu.add( "Overlay controls", 0, 0, 0, FL_MENU_TOGGLE | ( overlay_controls() ? FL_MENU_VALUE : 0 ) );
|
2012-11-30 08:40:28 +01:00
|
|
|
|
_menu.add( "Add Control", 0, 0, 0 );
|
|
|
|
|
_menu.add( "Add Annotation", 0, 0, 0 );
|
|
|
|
|
_menu.add( "Color", 0, 0, 0 );
|
|
|
|
|
_menu.add( "Rename", FL_CTRL + 'n', 0, 0 );
|
|
|
|
|
_menu.add( "Size/Small", FL_ALT + '1', 0, 0, FL_MENU_RADIO | ( s == 0 ? FL_MENU_VALUE : 0 ) );
|
|
|
|
|
_menu.add( "Size/Medium", FL_ALT + '2', 0, 0, FL_MENU_RADIO | ( s == 1 ? FL_MENU_VALUE : 0 ) );
|
|
|
|
|
_menu.add( "Size/Large", FL_ALT + '3', 0, 0, FL_MENU_RADIO | ( s == 2 ? FL_MENU_VALUE : 0 ) );
|
|
|
|
|
_menu.add( "Size/Huge", FL_ALT + '4', 0, 0, FL_MENU_RADIO | ( s == 3 ? FL_MENU_VALUE : 0 ) );
|
2015-04-04 23:53:18 +02:00
|
|
|
|
_menu.add( "Size/Enormous", FL_ALT + '5', 0, 0, FL_MENU_RADIO | ( s == 4 ? FL_MENU_VALUE : 0 ) );
|
2012-11-30 08:40:28 +01:00
|
|
|
|
_menu.add( "Flags/Record", FL_CTRL + 'r', 0, 0, FL_MENU_TOGGLE | ( armed() ? FL_MENU_VALUE : 0 ) );
|
|
|
|
|
_menu.add( "Flags/Mute", FL_CTRL + 'm', 0, 0, FL_MENU_TOGGLE | ( mute() ? FL_MENU_VALUE : 0 ) );
|
|
|
|
|
_menu.add( "Flags/Solo", FL_CTRL + 's', 0, 0, FL_MENU_TOGGLE | ( solo() ? FL_MENU_VALUE : 0 ) );
|
|
|
|
|
_menu.add( "Move Up", FL_SHIFT + '1', 0, 0 );
|
|
|
|
|
_menu.add( "Move Down", FL_SHIFT + '2', 0, 0 );
|
|
|
|
|
_menu.add( "Remove", 0, 0, 0 ); // transport->rolling ? FL_MENU_INACTIVE : 0 );
|
|
|
|
|
|
|
|
|
|
_menu.callback( &Track::menu_cb, (void*)this );
|
|
|
|
|
|
|
|
|
|
return _menu;
|
2008-05-30 05:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-05-27 02:03:31 +02:00
|
|
|
|
#include "FL/event_name.H"
|
|
|
|
|
#include "FL/test_press.H"
|
|
|
|
|
|
2013-04-22 08:14:52 +02:00
|
|
|
|
static Fl_Widget *receptive_to_drop = NULL;
|
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
void
|
|
|
|
|
Track::draw ( void )
|
|
|
|
|
{
|
2012-04-27 19:14:53 +02:00
|
|
|
|
fl_push_clip( x(), y(), w(), h() );
|
2012-05-22 06:10:18 +02:00
|
|
|
|
|
2012-11-06 08:50:28 +01:00
|
|
|
|
Fl_Color saved_color = color();
|
2012-10-27 23:12:02 +02:00
|
|
|
|
|
|
|
|
|
if ( ! Track::colored_tracks )
|
|
|
|
|
color( FL_GRAY );
|
|
|
|
|
|
2008-06-19 06:14:14 +02:00
|
|
|
|
if ( _selected )
|
|
|
|
|
{
|
|
|
|
|
Fl_Color c = color();
|
|
|
|
|
|
|
|
|
|
color( FL_RED );
|
|
|
|
|
|
2012-12-11 06:47:44 +01:00
|
|
|
|
Fl_Group::draw();
|
2008-06-19 06:14:14 +02:00
|
|
|
|
|
|
|
|
|
color( c );
|
|
|
|
|
}
|
|
|
|
|
else
|
2012-12-11 06:47:44 +01:00
|
|
|
|
Fl_Group::draw();
|
2012-04-27 19:14:53 +02:00
|
|
|
|
|
2013-04-22 08:14:52 +02:00
|
|
|
|
if ( ((Track_Header*)child(0))->input_connector_handle == receptive_to_drop )
|
|
|
|
|
{
|
|
|
|
|
Fl_Widget *o = ((Track_Header*)child(0))->input_connector_handle;
|
|
|
|
|
fl_draw_box( FL_OVAL_BOX, o->x(), o->y(), o->w(), o->h(), fl_color_add_alpha( FL_GREEN, 127 ) );
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-27 23:12:02 +02:00
|
|
|
|
if ( ! Track::colored_tracks )
|
|
|
|
|
color( saved_color );
|
|
|
|
|
|
2012-04-27 19:14:53 +02:00
|
|
|
|
fl_pop_clip();
|
2008-06-19 06:14:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-20 23:46:47 +02:00
|
|
|
|
int
|
|
|
|
|
Track::handle ( int m )
|
|
|
|
|
{
|
2008-05-27 02:03:31 +02:00
|
|
|
|
|
|
|
|
|
/* if ( m != FL_NO_EVENT ) */
|
|
|
|
|
/* DMESSAGE( "%s", event_name( m ) ); */
|
2013-05-23 08:50:10 +02:00
|
|
|
|
static Fl_Widget *dragging = NULL;
|
|
|
|
|
|
2013-04-22 08:14:52 +02:00
|
|
|
|
switch ( m )
|
|
|
|
|
{
|
|
|
|
|
case FL_DND_ENTER:
|
|
|
|
|
case FL_DND_LEAVE:
|
|
|
|
|
case FL_DND_DRAG:
|
|
|
|
|
case FL_DND_RELEASE:
|
|
|
|
|
case FL_PASTE:
|
|
|
|
|
if ( Fl::event_x() > Track::width() )
|
|
|
|
|
return sequence()->handle(m);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-05-27 02:03:31 +02:00
|
|
|
|
|
2008-04-20 23:46:47 +02:00
|
|
|
|
switch ( m )
|
|
|
|
|
{
|
2008-05-30 05:28:56 +02:00
|
|
|
|
case FL_KEYBOARD:
|
2010-01-30 07:30:10 +01:00
|
|
|
|
{
|
|
|
|
|
Fl_Menu_Button * men = &menu();
|
|
|
|
|
|
|
|
|
|
if ( Fl::event_key() == FL_Menu )
|
|
|
|
|
{
|
|
|
|
|
menu_popup( men );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return men->test_shortcut() || Fl_Group::handle( m );
|
|
|
|
|
}
|
2008-04-20 23:46:47 +02:00
|
|
|
|
case FL_MOUSEWHEEL:
|
|
|
|
|
{
|
2008-05-05 07:29:39 +02:00
|
|
|
|
Logger log( this );
|
|
|
|
|
|
2013-09-06 09:46:48 +02:00
|
|
|
|
if ( ! Fl::event_alt() )
|
2012-06-05 02:25:54 +02:00
|
|
|
|
return Fl_Group::handle( m );
|
2008-04-20 23:46:47 +02:00
|
|
|
|
|
|
|
|
|
int d = Fl::event_dy();
|
|
|
|
|
|
|
|
|
|
if ( d < 0 )
|
|
|
|
|
size( size() - 1 );
|
|
|
|
|
else
|
|
|
|
|
size( size() + 1 );
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2008-04-21 22:24:08 +02:00
|
|
|
|
case FL_PUSH:
|
|
|
|
|
{
|
2013-05-23 08:50:10 +02:00
|
|
|
|
if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->color_box ) )
|
|
|
|
|
{
|
|
|
|
|
dragging = this;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->output_connector_handle ) )
|
2013-04-22 08:14:52 +02:00
|
|
|
|
return 1;
|
|
|
|
|
|
2008-05-05 07:29:39 +02:00
|
|
|
|
Logger log( this );
|
2008-04-28 10:29:59 +02:00
|
|
|
|
|
2008-05-26 04:22:52 +02:00
|
|
|
|
if ( Fl_Group::handle( m ) )
|
|
|
|
|
return 1;
|
|
|
|
|
|
2008-05-31 01:48:44 +02:00
|
|
|
|
if ( test_press( FL_BUTTON3 ) && Fl::event_x() < Track::width() )
|
2008-04-21 22:24:08 +02:00
|
|
|
|
{
|
2008-05-30 05:28:56 +02:00
|
|
|
|
menu_popup( &menu() );
|
2008-04-26 10:42:44 +02:00
|
|
|
|
return 1;
|
2008-04-21 22:24:08 +02:00
|
|
|
|
}
|
2008-05-26 04:22:52 +02:00
|
|
|
|
|
|
|
|
|
return 0;
|
2008-04-21 22:24:08 +02:00
|
|
|
|
}
|
2013-04-22 08:14:52 +02:00
|
|
|
|
/* we have to prevent Fl_Group::handle() from getting these, otherwise it will mess up Fl::belowmouse() */
|
|
|
|
|
case FL_ENTER:
|
|
|
|
|
case FL_LEAVE:
|
|
|
|
|
case FL_MOVE:
|
|
|
|
|
if ( Fl::event_x() >= Track::width() )
|
|
|
|
|
{
|
2013-04-24 05:21:23 +02:00
|
|
|
|
return Fl_Group::handle(m);
|
2013-04-22 08:14:52 +02:00
|
|
|
|
}
|
2013-04-24 05:21:23 +02:00
|
|
|
|
return 1;
|
2013-04-22 08:14:52 +02:00
|
|
|
|
case FL_DND_ENTER:
|
|
|
|
|
return 1;
|
|
|
|
|
case FL_DND_LEAVE:
|
|
|
|
|
|
|
|
|
|
if ( ! Fl::event_inside(this) && this == receptive_to_drop )
|
|
|
|
|
{
|
|
|
|
|
receptive_to_drop = 0;
|
|
|
|
|
redraw();
|
|
|
|
|
Fl::selection_owner(0);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
2013-05-23 08:50:10 +02:00
|
|
|
|
case FL_RELEASE:
|
|
|
|
|
if ( dragging == this )
|
|
|
|
|
{
|
|
|
|
|
dragging = NULL;
|
|
|
|
|
timeline->insert_track( this, timeline->event_inside() );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2014-06-08 01:43:39 +02:00
|
|
|
|
return Fl_Group::handle( m );
|
2013-05-23 08:50:10 +02:00
|
|
|
|
break;
|
2013-04-22 08:14:52 +02:00
|
|
|
|
case FL_DND_RELEASE:
|
|
|
|
|
receptive_to_drop = 0;
|
|
|
|
|
redraw();
|
|
|
|
|
Fl::selection_owner(0);
|
|
|
|
|
return 1;
|
|
|
|
|
case FL_DND_DRAG:
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if ( receptive_to_drop == ((Track_Header*)child(0))->input_connector_handle )
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( Fl::event_inside( ((Track_Header*)child(0))->input_connector_handle )
|
|
|
|
|
&& receptive_to_drop != ((Track_Header*)child(0))->input_connector_handle )
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
receptive_to_drop = ((Track_Header*)child(0))->input_connector_handle;
|
|
|
|
|
redraw();
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
receptive_to_drop = NULL;
|
|
|
|
|
redraw();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
case FL_PASTE:
|
|
|
|
|
{
|
|
|
|
|
receptive_to_drop = 0;
|
|
|
|
|
redraw();
|
|
|
|
|
|
|
|
|
|
if (! Fl::event_inside( ((Track_Header*)child(0))->input_connector_handle ) )
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* NOW we get the text... */
|
|
|
|
|
const char *text = Fl::event_text();
|
|
|
|
|
|
|
|
|
|
DMESSAGE( "Got drop text \"%s\"",text);
|
|
|
|
|
|
|
|
|
|
if ( strncmp( text, "jack.port://", strlen( "jack.port://" ) ) )
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> port_names;
|
|
|
|
|
|
|
|
|
|
char *port_name;
|
|
|
|
|
int end;
|
2017-03-28 08:16:09 +02:00
|
|
|
|
while ( sscanf( text, "jack.port://%m[^\r\n]\r\n%n", &port_name, &end ) > 0 )
|
2013-04-22 08:14:52 +02:00
|
|
|
|
{
|
|
|
|
|
DMESSAGE( "Scanning %s", port_name );
|
|
|
|
|
port_names.push_back( port_name );
|
|
|
|
|
free(port_name );
|
|
|
|
|
|
|
|
|
|
text += end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( unsigned int i = 0; i < input.size() && i < port_names.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
const char *pn = port_names[i].c_str();
|
|
|
|
|
|
|
|
|
|
JACK::Port *ji = &input[i];
|
|
|
|
|
|
|
|
|
|
if ( ji->connected_to( pn ) )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DMESSAGE( "Disconnecting from \"%s\"", pn );
|
|
|
|
|
ji->disconnect( pn );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DMESSAGE( "Connecting to %s", pn );
|
|
|
|
|
ji->connect( pn );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Fl::selection_owner(0);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
case FL_DRAG:
|
|
|
|
|
{
|
|
|
|
|
if ( this != Fl::selection_owner() &&
|
|
|
|
|
Fl::event_inside( ((Track_Header*)child(0))->output_connector_handle ) )
|
|
|
|
|
{
|
|
|
|
|
char *s = (char*)malloc(256);
|
|
|
|
|
s[0] = 0;
|
|
|
|
|
|
|
|
|
|
for ( unsigned int i = 0; i < output.size(); ++i )
|
|
|
|
|
{
|
|
|
|
|
char *s2;
|
|
|
|
|
asprintf(&s2, "jack.port://%s:%s\r\n", instance_name, output[i].name() );
|
|
|
|
|
|
|
|
|
|
s = (char*)realloc( s, strlen( s ) + strlen( s2 ) + 1 );
|
|
|
|
|
strcat( s, s2 );
|
|
|
|
|
|
|
|
|
|
free( s2 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Fl::copy(s, strlen(s) + 1, 0);
|
|
|
|
|
Fl::selection_owner(this);
|
|
|
|
|
|
|
|
|
|
free( s );
|
|
|
|
|
|
|
|
|
|
Fl::dnd();
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
2013-05-23 08:50:10 +02:00
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2013-04-22 08:14:52 +02:00
|
|
|
|
}
|
2008-04-20 23:46:47 +02:00
|
|
|
|
default:
|
|
|
|
|
return Fl_Group::handle( m );
|
|
|
|
|
}
|
2008-04-26 10:42:44 +02:00
|
|
|
|
|
|
|
|
|
return 0;
|
2008-04-20 23:46:47 +02:00
|
|
|
|
}
|
2012-12-02 01:14:01 +01:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Track::connect_osc ( void )
|
|
|
|
|
{
|
|
|
|
|
for ( int j = control->children(); j--; )
|
|
|
|
|
{
|
|
|
|
|
Control_Sequence *c = (Control_Sequence*)control->child( j );
|
|
|
|
|
c->connect_osc();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-09 05:56:33 +02:00
|
|
|
|
void
|
|
|
|
|
Track::update_osc_connection_state ( void )
|
|
|
|
|
{
|
|
|
|
|
for ( int j = control->children(); j--; )
|
|
|
|
|
{
|
|
|
|
|
Control_Sequence *c = (Control_Sequence*)control->child( j );
|
|
|
|
|
c->update_osc_connection_state();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-02 01:14:01 +01:00
|
|
|
|
void
|
|
|
|
|
Track::process_osc ( void )
|
|
|
|
|
{
|
|
|
|
|
for ( int j = control->children(); j--; )
|
|
|
|
|
{
|
|
|
|
|
Control_Sequence *c = (Control_Sequence*)control->child( j );
|
|
|
|
|
c->process_osc();
|
|
|
|
|
}
|
|
|
|
|
}
|