Also, assign random color to individual control sequence (which the user may edit).tags/non-daw-v1.2.0
@@ -62,7 +62,7 @@ public: | |||
DEFAULT=500 | |||
}; | |||
Fl_Blink_Button ( int X, int Y, int W, int H, const char *L ) | |||
Fl_Blink_Button ( int X, int Y, int W, int H, const char *L=0 ) | |||
: Fl_Button( X, Y, W, H, L ) | |||
{ | |||
_blinking = true; | |||
@@ -22,6 +22,7 @@ | |||
/* Just like an Fl_Input, except that when not being edited it | |||
* displays just like a label. */ | |||
#include <FL/fl_draw.H> | |||
#include <FL/Fl.H> | |||
#include <FL/Fl_Window.H> | |||
#include <FL/Fl_Input.H> | |||
@@ -21,6 +21,7 @@ | |||
#include "debug.h" | |||
#include <FL/fl_ask.H> | |||
#include <FL/Fl_Color_Chooser.H> | |||
#include "Control_Sequence.H" | |||
#include "Track.H" | |||
@@ -121,6 +122,7 @@ Control_Sequence::get ( Log_Entry &e ) const | |||
{ | |||
e.add( ":track", _track ); | |||
e.add( ":name", name() ); | |||
e.add( ":color", color() ); | |||
} | |||
void | |||
@@ -187,6 +189,10 @@ Control_Sequence::set ( Log_Entry &e ) | |||
{ | |||
_persistent_osc_connections.push_back( strdup( v ) ); | |||
} | |||
else if ( ! strcmp( ":color", s ) ) | |||
{ | |||
color( (Fl_Color)atol( v ) ); | |||
} | |||
} | |||
} | |||
@@ -283,31 +289,19 @@ Control_Sequence::draw_curve ( bool filled ) | |||
} | |||
void | |||
Control_Sequence::draw ( void ) | |||
Control_Sequence::draw_box ( void ) | |||
{ | |||
// draw_box(); | |||
fl_push_clip( x(), y(), w(), h() ); | |||
/* draw the box with the ends cut off. */ | |||
// draw_box( box(), x() - Fl::box_dx( box() ), y(), w() + Fl::box_dw( box() ) + 1, h(), color() ); | |||
const int bx = x(); | |||
const int by = y() + Fl::box_dy( box() ); | |||
const int by = y(); | |||
const int bw = w(); | |||
const int bh = h() - Fl::box_dh( box() ); | |||
const int bh = h(); | |||
int X, Y, W, H; | |||
fl_clip_box( bx, by, bw, bh, X, Y, W, H ); | |||
bool active = active_r(); | |||
const Fl_Color color = active ? this->color() : fl_inactive( this->color() ); | |||
// const Fl_Color selection_color = active ? this->selection_color() : fl_inactive( this->selection_color() ); | |||
fl_rectf( X, Y, W, H, fl_color_average( FL_WHITE, FL_BACKGROUND_COLOR, 0.3 ) ); | |||
// fl_rectf( X, Y, W, H, fl_color_average( FL_BLACK, FL_BACKGROUND_COLOR, 0.3 ) ); | |||
fl_rectf( X,Y,W,H, fl_color_average( FL_BLACK, FL_WHITE, 0.90 ) ); | |||
if ( draw_with_grid ) | |||
{ | |||
@@ -319,12 +313,41 @@ Control_Sequence::draw ( void ) | |||
fl_line( X, by + gy, X + W, by + gy ); | |||
} | |||
timeline->draw_measure_lines( X, Y, W, H ); | |||
fl_color( FL_BLACK ); | |||
fl_line( x(), y(), x() + w(), y() ); | |||
fl_line( x(), y() + h() - 1, w(), y() + h() - 1 ); | |||
} | |||
void | |||
Control_Sequence::draw ( void ) | |||
{ | |||
fl_push_clip( x(), y(), w(), h() ); | |||
const int bx = x(); | |||
const int by = y() + Fl::box_dy( box() ); | |||
const int bw = w(); | |||
const int bh = h() - Fl::box_dh( box() ); | |||
int X, Y, W, H; | |||
fl_clip_box( bx, by, bw, bh, X, Y, W, H ); | |||
bool active = active_r(); | |||
const Fl_Color color = active ? this->color() : fl_inactive( this->color() ); | |||
// const Fl_Color selection_color = active ? this->selection_color() : fl_inactive( this->selection_color() ); | |||
if ( box() != FL_NO_BOX ) | |||
draw_box(); | |||
if ( interpolation() != None ) | |||
{ | |||
if ( draw_with_polygon ) | |||
{ | |||
fl_color( fl_color_add_alpha( color, 100 ) ); | |||
fl_color( fl_color_add_alpha( color, 60 ) ); | |||
fl_begin_complex_polygon(); | |||
draw_curve( true ); | |||
@@ -342,8 +365,6 @@ Control_Sequence::draw ( void ) | |||
fl_line_style( FL_SOLID, 0 ); | |||
} | |||
timeline->draw_measure_lines( X, Y, W, H ); | |||
if ( interpolation() == None || _highlighted || Fl::focus() == this ) | |||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ ) | |||
(*r)->draw_box(); | |||
@@ -433,6 +454,19 @@ Control_Sequence::menu_cb ( const Fl_Menu_ *m ) | |||
{ | |||
Fl::delete_widget( 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(); | |||
} | |||
} | |||
void | |||
@@ -581,6 +615,7 @@ Control_Sequence::handle ( int m ) | |||
menu.add( "Mode/Control Signal (OSC)", 0, 0, 0 , FL_MENU_RADIO | ( mode() == OSC ? FL_MENU_VALUE : 0 ) ); | |||
menu.add( "Rename", 0, 0, 0 ); | |||
menu.add( "Color", 0, 0, 0 ); | |||
menu.add( "Remove", 0, 0, 0 ); | |||
menu.callback( &Control_Sequence::menu_cb, (void*)this); | |||
@@ -87,6 +87,7 @@ protected: | |||
} | |||
void draw_box ( void ); | |||
void draw ( void ); | |||
int handle ( int m ); | |||
@@ -202,8 +202,8 @@ Track::process_output ( nframes_t nframes ) | |||
} | |||
/* FIXME: should we blank the control output here or leave it floating? */ | |||
for ( int i = 0; i < control->children(); i++ ) | |||
((Control_Sequence*)control->child( i ))->process( nframes ); | |||
for ( int i = 0; i < ((Fl_Pack*)control)->children(); i++ ) | |||
((Control_Sequence*)((Fl_Pack*)control)->child( i ))->process( nframes ); | |||
if ( playback_ds ) | |||
return playback_ds->process( nframes ); | |||
@@ -91,6 +91,10 @@ public: | |||
if ( _name ) free( _name ); | |||
_name = s ? strdup( s ) : NULL; | |||
label( _name ); | |||
/* for outside label */ | |||
if ( (Fl_Widget*)track() ) | |||
((Fl_Widget*)track())->redraw(); | |||
} | |||
void sort ( void ); | |||
@@ -249,7 +249,7 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {} | |||
label {Non DAW : Timeline} | |||
callback {if ( Fl::event_key() != FL_Escape ) | |||
timeline->command_quit();} open | |||
xywh {551 117 1025 770} type Double resizable | |||
xywh {559 209 1025 770} type Double resizable | |||
class TLE_Window xclass Non_DAW size_range {900 300 0 0} visible | |||
} { | |||
Fl_Group {} { | |||
@@ -718,29 +718,35 @@ ab.run();} | |||
xywh {740 31 115 40} | |||
} { | |||
Fl_Button solo_blinker { | |||
label SOLO | |||
xywh {800 33 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 74 selection_color 92 labelfont 2 labelcolor 39 deactivate | |||
label SOLO selected | |||
xywh {800 33 50 15} box BORDER_BOX down_box BORDER_BOX color 74 selection_color 92 labelfont 1 labelsize 11 labelcolor 32 deactivate | |||
code0 {\#include "FL/Fl_Blink_Button.H"} | |||
code1 {o->box( FL_ASYM_BOX );} | |||
code2 {o->down_box( FL_ASYM_BOX );} | |||
class Fl_Blink_Button | |||
} | |||
Fl_Button rec_blinker { | |||
label REC | |||
xywh {800 53 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 72 selection_color 88 labelfont 2 labelcolor 39 deactivate | |||
label REC selected | |||
xywh {800 53 50 15} box BORDER_BOX down_box BORDER_BOX color 72 selection_color 88 labelfont 1 labelsize 11 labelcolor 32 deactivate | |||
code0 {\#include "FL/Fl_Blink_Button.H"} | |||
code1 {o->box( FL_ASYM_BOX );} | |||
code2 {o->down_box( FL_ASYM_BOX );} | |||
class Fl_Blink_Button | |||
} | |||
Fl_Button selected_blinker { | |||
label SEL | |||
xywh {745 53 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 13 selection_color 5 labelfont 2 labelcolor 39 deactivate | |||
label SEL selected | |||
xywh {745 53 50 15} box BORDER_BOX down_box BORDER_BOX color 13 selection_color 5 labelfont 1 labelsize 11 labelcolor 32 deactivate | |||
code0 {\#include "FL/Fl_Blink_Button.H"} | |||
code1 {o->blink( false );} | |||
code1 {o->box( FL_ASYM_BOX );} | |||
code2 {o->down_box( FL_ASYM_BOX );} | |||
class Fl_Blink_Button | |||
} | |||
Fl_Button seek_blinker { | |||
label SEEK | |||
xywh {745 33 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 10 selection_color 2 labelfont 2 labelcolor 39 deactivate | |||
label SEEK selected | |||
xywh {745 33 50 15} box BORDER_BOX down_box BORDER_BOX color 10 selection_color 2 labelfont 1 labelsize 11 labelcolor 32 deactivate | |||
code0 {\#include "FL/Fl_Blink_Button.H"} | |||
code1 {o->blink_interval( Fl_Blink_Button::FAST );} | |||
code1 {o->box( FL_ASYM_BOX );} | |||
code2 {o->down_box( FL_ASYM_BOX );} | |||
class Fl_Blink_Button | |||
} | |||
} | |||
@@ -754,7 +760,7 @@ ab.run();} | |||
class Fl_Button | |||
} | |||
} | |||
Fl_Group progress_group {open selected | |||
Fl_Group progress_group {open | |||
xywh {295 352 450 79} hide | |||
} { | |||
Fl_Progress progress { | |||
@@ -983,7 +989,7 @@ if ( logo_box->image() ) | |||
((Fl_Shared_Image*)logo_box->image())->release(); | |||
logo_box->image( NULL ); | |||
}} open | |||
private xywh {1232 180 520 775} type Double modal visible | |||
private xywh {1240 261 520 775} type Double modal visible | |||
} { | |||
Fl_Value_Output {} { | |||
label {Sample Rate} | |||
@@ -1761,9 +1761,12 @@ Timeline::length ( void ) const | |||
nframes_t l = 0; | |||
for ( int i = tracks->children(); i--; ) | |||
l = max( l, ((Track*)tracks->child( i ))->sequence()->length() ); | |||
// adjust_panzoomer(); | |||
{ | |||
Sequence *t = ((Track*)tracks->child( i ))->sequence(); | |||
if ( t ) | |||
l = max( l, ((Track*)tracks->child( i ))->sequence()->length() ); | |||
} | |||
return l; | |||
} | |||
@@ -2125,12 +2128,8 @@ Timeline::connect_osc ( void ) | |||
for ( int i = tracks->children(); i-- ; ) | |||
{ | |||
Track *t = (Track*)tracks->child( i ); | |||
for ( int j = t->control->children(); j--; ) | |||
{ | |||
Control_Sequence *c = (Control_Sequence*)t->control->child( j ); | |||
c->connect_osc(); | |||
} | |||
t->connect_osc(); | |||
} | |||
} | |||
@@ -2166,14 +2165,7 @@ Timeline::process_osc ( void ) | |||
{ | |||
Track *t = (Track*)tracks->child( i ); | |||
if ( t->control ) | |||
{ | |||
for ( int j = t->control->children(); j--; ) | |||
{ | |||
Control_Sequence *c = (Control_Sequence*)t->control->child( j ); | |||
c->process_osc(); | |||
} | |||
} | |||
t->process_osc(); | |||
} | |||
unlock(); | |||
@@ -33,19 +33,93 @@ | |||
#include <FL/Fl_Color_Chooser.H> | |||
#include <FL/Fl.H> | |||
#include "FL/Fl_Scalepack.H" | |||
#include "FL/Fl_Blink_Button.H" | |||
#include "Engine/Engine.H" // for lock() | |||
#include "Control_Sequence.H" | |||
#include "Annotation_Sequence.H" | |||
#include "Track_Header.H" | |||
#include "const.h" | |||
#include "debug.h" | |||
static Fl_Color | |||
random_color ( void ) | |||
{ | |||
return fl_rgb_color( rand() % 255, rand() % 255, rand() % 255 ); | |||
} | |||
static Fl_Menu_Button _menu( 0, 0, 0, 0, "Track" ); | |||
class Fl_Sometimes_Pack : public Fl_Pack | |||
{ | |||
bool _pack; | |||
public: | |||
Fl_Sometimes_Pack ( int X, int Y, int W, int H, const char *L=0 ) : Fl_Pack(X,Y,W,H,L) | |||
{ | |||
_pack = true; | |||
} | |||
virtual ~Fl_Sometimes_Pack ( ) | |||
{ | |||
} | |||
void pack ( bool b ) | |||
{ | |||
if ( b != _pack ) | |||
redraw(); | |||
_pack = b; | |||
} | |||
bool pack ( void ) const | |||
{ | |||
return _pack; | |||
} | |||
virtual void draw ( void ) | |||
{ | |||
/* draw_box(); */ | |||
if ( _pack ) | |||
{ | |||
for ( int i = 0; i < children(); i++ ) | |||
{ | |||
Fl_Widget *o = child( i ); | |||
o->box( FL_FLAT_BOX ); | |||
} | |||
Fl_Pack::draw(); | |||
} | |||
else | |||
{ | |||
if ( children() ) | |||
{ | |||
for ( int i = 0; i < children(); i++ ) | |||
{ | |||
Fl_Widget *o = child( i ); | |||
if ( i != 0 ) | |||
o->box( FL_NO_BOX ); | |||
o->resize( x(),y(),w(), o->h() ); | |||
} | |||
resize( x(), y(), w(), child(0)->h() ); | |||
} | |||
Fl_Group::draw(); | |||
} | |||
} | |||
}; | |||
int Track::_soloing = 0; | |||
const char *Track::capture_format = "Wav 24"; | |||
@@ -61,7 +135,7 @@ Track::Track ( const char *L, int channels ) : | |||
if ( L ) | |||
name( L ); | |||
color( (Fl_Color)rand() ); | |||
color( random_color() ); | |||
configure_inputs( channels ); | |||
configure_outputs( channels ); | |||
@@ -117,7 +191,6 @@ Track::init ( void ) | |||
_sequence = NULL; | |||
_name = NULL; | |||
_selected = false; | |||
_show_all_takes = false; | |||
_size = 1; | |||
record_ds = NULL; | |||
@@ -133,75 +206,41 @@ Track::init ( void ) | |||
o->box( FL_FLAT_BOX ); | |||
{ | |||
Fl_Group *o = new Fl_Group( 0, 0, 149, 70 ); | |||
o->color( ( Fl_Color ) 53 ); | |||
o->box( FL_THIN_UP_BOX ); | |||
{ | |||
Fl_Input *o = name_field = new Fl_Sometimes_Input( 2, 2, 144, 24 ); | |||
o->color( FL_BACKGROUND_COLOR ); | |||
o->labeltype( FL_NO_LABEL ); | |||
o->labelcolor( FL_GRAY0 ); | |||
o->textcolor( FL_FOREGROUND_COLOR ); | |||
o->callback( cb_input_field, (void*)this ); | |||
} | |||
Track_Header *o = new Track_Header( x(), y(), 200, 80 ); | |||
name_field = o->name_input; | |||
record_button = o->rec_button; | |||
mute_button = o->mute_button; | |||
solo_button = o->solo_button; | |||
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 ); | |||
{ | |||
Fl_Scalepack *o = controls = new Fl_Scalepack( 6, 28, 135, 40 ); | |||
o->spacing( 5 ); | |||
o->box( FL_NO_BOX ); | |||
o->type( FL_HORIZONTAL ); | |||
show_all_takes_button->callback( cb_button, this ); | |||
overlay_controls_button->callback( cb_button, this ); | |||
{ | |||
Fl_Button *o = record_button = | |||
new Fl_Button( 6, 28, 26, 24, "rec." ); | |||
o->type( 1 ); | |||
o->box( FL_UP_BOX ); | |||
o->selection_color( FL_RED ); | |||
o->color( FL_BACKGROUND_COLOR ); | |||
o->labelsize( 11 ); | |||
o->callback( cb_button, this ); | |||
} | |||
{ | |||
Fl_Button *o = mute_button = | |||
new Fl_Button( 35, 28, 26, 24, "mute" ); | |||
o->selection_color( fl_color_average( FL_YELLOW, FL_GREEN, 0.50 ) ); | |||
o->color( FL_BACKGROUND_COLOR ); | |||
o->type( 1 ); | |||
o->box( FL_UP_BOX ); | |||
o->labelsize( 11 ); | |||
o->callback( cb_button, this ); | |||
} | |||
{ | |||
Fl_Button *o = solo_button = | |||
new Fl_Button( 66, 28, 26, 24, "solo" ); | |||
o->selection_color( fl_color_average( FL_YELLOW, FL_RED, 0.50 ) ); | |||
o->color( FL_BACKGROUND_COLOR ); | |||
o->type( 1 ); | |||
o->box( FL_UP_BOX ); | |||
o->labelsize( 11 ); | |||
o->callback( cb_button, this ); | |||
} | |||
o->end(); | |||
} | |||
resizable( o ); | |||
o->color( (Fl_Color)53 ); | |||
} | |||
{ | |||
Fl_Box *o = new Fl_Box( 0, 72, 149, 38 ); | |||
o->box( FL_NO_BOX ); | |||
Fl_Group::current()->resizable( o ); | |||
} | |||
/* { */ | |||
/* Fl_Box *o = new Fl_Box( 0, 72, 149, 38 ); */ | |||
/* o->box( FL_NO_BOX ); */ | |||
/* Fl_Group::current()->resizable( o ); */ | |||
/* } */ | |||
o->size( Track::width(), h() ); | |||
o->end(); | |||
} | |||
{ | |||
Fl_Pack *o = pack = new Fl_Pack( width(), 0, 1006, 115 ); | |||
/* this pack holds the active sequence, annotation sequence, control sequences and takes */ | |||
Fl_Pack *o = pack = new Fl_Pack( x() + width(), y(), w() - width(), h() ); | |||
o->type( Fl_Pack::VERTICAL ); | |||
o->labeltype( FL_NO_LABEL ); | |||
o->resize( x() + width(), y(), w() - width(), h() ); | |||
/* o->resize( x() + width(), y(), w() - width(), h() ); */ | |||
resizable( o ); | |||
/* resizable( o ); */ | |||
{ | |||
Fl_Pack *o = annotation = new Fl_Pack( width(), 0, pack->w(), 1 ); | |||
@@ -210,8 +249,11 @@ Track::init ( void ) | |||
} | |||
{ | |||
Fl_Pack *o = control = new Fl_Pack( width(), 0, pack->w(), 1 ); | |||
Fl_Sometimes_Pack *o = control = new Fl_Sometimes_Pack( width(), 0, pack->w(), 1 ); | |||
o->box( FL_NO_BOX ); | |||
o->color( FL_BACKGROUND_COLOR ); | |||
o->type( Fl_Pack::VERTICAL ); | |||
o->pack( true ); | |||
o->end(); | |||
} | |||
@@ -260,6 +302,8 @@ Track::set ( Log_Entry &e ) | |||
} | |||
else if ( ! strcmp( s, ":show-all-takes" ) ) | |||
show_all_takes( atoi( v ) ); | |||
else if ( ! strcmp( s, ":overlay-controls" ) ) | |||
overlay_controls( atoi( v ) ); | |||
else if ( ! strcmp( s, ":solo" ) ) | |||
solo( atoi( v ) ); | |||
else if ( ! strcmp( s, ":mute" ) ) | |||
@@ -308,7 +352,8 @@ Track::get_unjournaled ( Log_Entry &e ) const | |||
e.add( ":height", size() ); | |||
e.add( ":inputs", input.size() ); | |||
e.add( ":outputs", output.size() ); | |||
e.add( ":show-all-takes", _show_all_takes ); | |||
e.add( ":show-all-takes", show_all_takes() ); | |||
e.add( ":overlay-controls", overlay_controls() ); | |||
e.add( ":armed", armed() ); | |||
e.add( ":mute", mute() ); | |||
e.add( ":solo", solo() ); | |||
@@ -332,13 +377,13 @@ Track::log_children ( void ) const | |||
{ | |||
log_create(); | |||
for ( int i = control->children(); i--; ) | |||
for ( int i = 0; i < control->children(); i++ ) | |||
((Sequence*)control->child( i ))->log_children(); | |||
for ( int i = annotation->children(); i--; ) | |||
for ( int i = 0; i < annotation->children(); i++ ) | |||
((Sequence*)annotation->child( i ))->log_children(); | |||
for ( int i = takes->children(); i--; ) | |||
for ( int i = 0; i < takes->children(); i++ ) | |||
((Sequence*)takes->child( i ))->log_children(); | |||
sequence()->log_children(); | |||
@@ -355,11 +400,6 @@ Track::solo ( bool b ) | |||
solo_button->value( b ); | |||
} | |||
void | |||
Track::cb_input_field ( Fl_Widget *, void *v ) | |||
{ | |||
((Track*)v)->cb_input_field(); | |||
} | |||
void | |||
Track::cb_button ( Fl_Widget *w, void *v ) | |||
@@ -367,36 +407,38 @@ Track::cb_button ( Fl_Widget *w, void *v ) | |||
((Track*)v)->cb_button( w ); | |||
} | |||
void | |||
Track::cb_input_field ( void ) | |||
{ | |||
log_start(); | |||
name( name_field->value() ); | |||
log_end(); | |||
} | |||
void | |||
Track::cb_button ( Fl_Widget *w ) | |||
{ | |||
Logger log(this); | |||
if ( w == record_button ) | |||
if ( w == name_field ) | |||
{ | |||
name( name_field->value() ); | |||
} | |||
else if ( w == record_button ) | |||
{ | |||
} | |||
if ( w == mute_button ) | |||
else if ( w == mute_button ) | |||
{ | |||
} | |||
if ( w == solo_button ) | |||
else if ( w == solo_button ) | |||
{ | |||
if ( solo_button->value() ) | |||
++_soloing; | |||
else | |||
--_soloing; | |||
} | |||
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() ); | |||
} | |||
} | |||
static int pack_visible( Fl_Pack *p ) | |||
@@ -422,33 +464,56 @@ Track::adjust_size ( void ) | |||
for ( int i = control->children(); i--; ) | |||
control->child( i )->size( w(), height() ); | |||
/* FIXME: hack! */ | |||
if ( annotation->children() ) | |||
annotation->show(); | |||
else | |||
annotation->hide(); | |||
control->pack( ! overlay_controls() ); | |||
int TH = height(); | |||
if ( _show_all_takes ) | |||
if ( show_all_takes() ) | |||
{ | |||
takes->show(); | |||
Fl_Group::size( w(), height() * ( 1 + takes->children() + pack_visible( control ) ) ); | |||
TH += height() * takes->children(); | |||
} | |||
else | |||
{ | |||
takes->hide(); | |||
Fl_Group::size( w(), height() * ( 1 + pack_visible( control ) ) ); | |||
if ( control->children() ) | |||
{ | |||
control->show(); | |||
if ( overlay_controls() ) | |||
TH += height() * (control->children() ? 1 : 0); | |||
else | |||
TH += height() * pack_visible( control ); | |||
} | |||
else | |||
control->hide(); | |||
if ( annotation->children() ) | |||
{ | |||
annotation->show(); | |||
TH += 24 * pack_visible( annotation ); | |||
} | |||
else | |||
annotation->hide(); | |||
Fl_Group::size( w(), h() + ( ( 24 ) * pack_visible( annotation ) ) ); | |||
if ( ! size() ) | |||
{ | |||
takes->hide(); | |||
control->hide(); | |||
Fl_Group::size( w(), height() ); | |||
} | |||
else | |||
Fl_Group::size( w(), TH ); | |||
if ( sequence() ) | |||
sequence()->size( w(), height() ); | |||
/* if ( controls->y() + controls->h() > y() + h() ) */ | |||
/* controls->hide(); */ | |||
/* else */ | |||
/* controls->show(); */ | |||
if ( controls->y() + controls->h() > y() + h() ) | |||
controls->hide(); | |||
else | |||
controls->show(); | |||
/* FIXME: why is this necessary? */ | |||
if ( parent() ) | |||
@@ -550,6 +615,7 @@ Track::sequence ( Audio_Sequence * t ) | |||
add( sequence() ); | |||
_sequence = t; | |||
/* insert following the annotation pack */ | |||
pack->insert( *t, 1 ); | |||
t->color( FL_GRAY ); | |||
@@ -558,6 +624,7 @@ Track::sequence ( Audio_Sequence * t ) | |||
adjust_size(); | |||
} | |||
void | |||
Track::add ( Control_Sequence *t ) | |||
{ | |||
@@ -567,10 +634,11 @@ Track::add ( Control_Sequence *t ) | |||
t->track( this ); | |||
t->color( random_color() ); | |||
// control->insert( *t, 0 ); | |||
control->add( t ); | |||
t->color( color() ); | |||
engine->unlock(); | |||
adjust_size(); | |||
@@ -669,6 +737,10 @@ Track::menu_cb ( const Fl_Menu_ *m ) | |||
{ | |||
new Control_Sequence( this ); | |||
} | |||
else if ( ! strcmp( picked, "/Overlay controls" ) ) | |||
{ | |||
overlay_controls( ! m->mvalue()->value() ); | |||
} | |||
else if ( ! strcmp( picked, "/Add Annotation" ) ) | |||
{ | |||
add( new Annotation_Sequence( this ) ); | |||
@@ -790,7 +862,7 @@ Track::menu ( void ) const | |||
_menu.clear(); | |||
_menu.add( "Takes/Show all takes", 0, 0, 0, FL_MENU_TOGGLE | ( _show_all_takes ? FL_MENU_VALUE : 0 ) ); | |||
_menu.add( "Takes/Show all takes", 0, 0, 0, FL_MENU_TOGGLE | ( show_all_takes() ? FL_MENU_VALUE : 0 ) ); | |||
_menu.add( "Takes/New", 0, 0, 0 ); | |||
if ( takes->children() ) | |||
@@ -813,6 +885,7 @@ Track::menu ( void ) const | |||
_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 ) ); | |||
_menu.add( "Overlay controls", 0, 0, 0, FL_MENU_TOGGLE | ( overlay_controls() ? FL_MENU_VALUE : 0 ) ); | |||
_menu.add( "Add Control", 0, 0, 0 ); | |||
_menu.add( "Add Annotation", 0, 0, 0 ); | |||
_menu.add( "Color", 0, 0, 0 ); | |||
@@ -836,6 +909,48 @@ Track::menu ( void ) const | |||
#include "FL/event_name.H" | |||
#include "FL/test_press.H" | |||
void | |||
Track::internal_draw ( void ) | |||
{ | |||
draw_box(); | |||
/* we have to do this first because the pack(s) size isn't known until draw() */ | |||
draw_child( *pack ); | |||
{ | |||
Track_Header *o = (Track_Header *)child( 0 ); | |||
o->controls_header_group->resize( x(), control->y(), o->controls_header_group->w(), control->h() ); | |||
o->takes_header_group->resize( x(), takes->y(), o->takes_header_group->w(), takes->h() ); | |||
if ( takes->visible() ) | |||
o->takes_header_group->show(); | |||
else | |||
o->takes_header_group->hide(); | |||
if ( control->visible() ) | |||
o->controls_header_group->show(); | |||
else | |||
o->controls_header_group->hide(); | |||
/* override stupid group resize effect. */ | |||
o->takes_header_group->child(0)->size( 195, 12 ); | |||
o->controls_header_group->child(0)->size( 195, 12 ); | |||
} | |||
draw_child( *child(0)); | |||
if ( takes->visible() ) | |||
for ( int i = 0; i < takes->children(); i++ ) | |||
draw_outside_label( *takes->child( i ) ); | |||
if ( control->visible() ) | |||
for ( int i = 0; i < control->children(); i++ ) | |||
draw_outside_label( *control->child( i ) ); | |||
} | |||
void | |||
Track::draw ( void ) | |||
{ | |||
@@ -856,12 +971,12 @@ Track::draw ( void ) | |||
color( FL_RED ); | |||
Fl_Group::draw(); | |||
internal_draw(); | |||
color( c ); | |||
} | |||
else | |||
Fl_Group::draw(); | |||
internal_draw(); | |||
if ( ! Track::colored_tracks ) | |||
color( saved_color ); | |||
@@ -927,3 +1042,23 @@ Track::handle ( int m ) | |||
return 0; | |||
} | |||
void | |||
Track::connect_osc ( void ) | |||
{ | |||
for ( int j = control->children(); j--; ) | |||
{ | |||
Control_Sequence *c = (Control_Sequence*)control->child( j ); | |||
c->connect_osc(); | |||
} | |||
} | |||
void | |||
Track::process_osc ( void ) | |||
{ | |||
for ( int j = control->children(); j--; ) | |||
{ | |||
Control_Sequence *c = (Control_Sequence*)control->child( j ); | |||
c->process_osc(); | |||
} | |||
} |
@@ -48,6 +48,8 @@ class Record_DS; | |||
class Audio_Region; | |||
class Audio_File; | |||
class Fl_Scalepack; | |||
class Fl_Sometimes_Pack; | |||
class Fl_Blink_Button; | |||
//class Audio_Sequence; | |||
@@ -99,8 +101,6 @@ private: | |||
bool _selected; | |||
bool _show_all_takes; | |||
int _size; | |||
int _row; | |||
@@ -118,6 +118,7 @@ private: | |||
Track ( ); | |||
void init ( void ); | |||
void internal_draw ( void ); | |||
protected: | |||
@@ -126,6 +127,9 @@ protected: | |||
void set ( Log_Entry &e ); | |||
Fl_Scalepack *controls; | |||
Fl_Sometimes_Pack *control; | |||
Fl_Blink_Button *connected_indicator; | |||
public: | |||
@@ -135,10 +139,11 @@ public: | |||
Fl_Button *record_button; | |||
Fl_Button *mute_button; | |||
Fl_Button *solo_button; | |||
Fl_Button *show_all_takes_button; | |||
Fl_Button *overlay_controls_button; | |||
Fl_Pack *pack; | |||
Fl_Pack *annotation; | |||
Fl_Pack *control; | |||
Fl_Pack *takes; | |||
@@ -163,23 +168,38 @@ public: | |||
int size ( void ) const { return _size; } | |||
int ncontrols ( void ) { return control->children(); } | |||
int ncontrols ( void ) { return ((Fl_Group*)control)->children(); } | |||
void adjust_size ( void ); | |||
void size ( int v ); | |||
int height ( void ) const | |||
{ | |||
static int table[] = { 30, 80, 150, 300 }; | |||
static int table[] = { 27, 54, 80, 150, 300 }; | |||
return table[ _size ]; | |||
} | |||
void show_all_takes ( bool b ) | |||
{ | |||
_show_all_takes = b; | |||
show_all_takes_button->value( b ); | |||
adjust_size(); | |||
} | |||
bool show_all_takes ( void ) const | |||
{ | |||
return show_all_takes_button->value(); | |||
} | |||
void overlay_controls ( bool b ) | |||
{ | |||
overlay_controls_button->value( b ); | |||
adjust_size(); | |||
} | |||
bool overlay_controls ( void ) const | |||
{ | |||
return overlay_controls_button->value(); | |||
} | |||
void name ( const char *name ) | |||
{ | |||
@@ -208,13 +228,11 @@ public: | |||
int row ( void ) const; | |||
void row ( int ); | |||
static void cb_input_field ( Fl_Widget *w, void *v ); | |||
void cb_input_field ( void ); | |||
static void cb_button ( Fl_Widget *w, void *v ); | |||
void cb_button ( Fl_Widget *w ); | |||
static int width ( void ) { return 150; } | |||
static int width ( void ) { return 200; } | |||
void sequence ( Audio_Sequence * t ); | |||
Audio_Sequence * sequence ( void ) const { return _sequence; } | |||
@@ -228,6 +246,9 @@ public: | |||
void draw ( void ); | |||
int handle ( int m ); | |||
void process_osc ( void ); | |||
void connect_osc ( void ); | |||
/* Engine */ | |||
const Audio_Region *capture_region ( void ) const; | |||
Capture *capture ( void ); | |||
@@ -0,0 +1,120 @@ | |||
# data file for the Fltk User Interface Designer (fluid) | |||
version 1.0300 | |||
header_name {.h} | |||
code_name {.cxx} | |||
decl {\#include "FL/Fl_Sometimes_Input.H"} {public global | |||
} | |||
widget_class Track_Header {open | |||
xywh {384 728 200 210} type Double box THIN_UP_BOX resizable visible | |||
} { | |||
Fl_Group {} {open | |||
xywh {5 3 192 48} | |||
} { | |||
Fl_Input name_input { | |||
label {input:} | |||
xywh {5 3 192 22} labeltype NO_LABEL align 20 when 8 | |||
class Fl_Sometimes_Input | |||
} | |||
Fl_Button track_inputs_indicator { | |||
label in | |||
tooltip {lit if inputs are connected} xywh {5 27 24 16} box BORDER_BOX color 48 selection_color 90 labelfont 5 labelsize 10 labelcolor 53 hide | |||
} | |||
Fl_Button track_outputs_indicator { | |||
label out | |||
tooltip {lit if outputs are connected} xywh {31 27 24 16} box BORDER_BOX color 48 selection_color 90 labelfont 5 labelsize 10 labelcolor 53 hide | |||
} | |||
Fl_Button overlay_controls_button { | |||
label {c-} selected | |||
tooltip {Expand controls} xywh {5 26 24 24} type Toggle selection_color 3 labelfont 5 labelsize 12 | |||
} | |||
Fl_Button show_all_takes_button { | |||
label {t+} selected | |||
tooltip {Show all takes} xywh {32 26 24 24} type Toggle selection_color 3 labelfont 5 labelsize 12 | |||
} | |||
Fl_Button rec_button { | |||
label r | |||
tooltip {arm for recording} xywh {118 26 24 24} type Toggle selection_color 88 labelfont 5 labelsize 12 | |||
} | |||
Fl_Button mute_button { | |||
label m | |||
tooltip mute xywh {145 26 24 24} type Toggle selection_color 63 labelfont 5 labelsize 12 | |||
} | |||
Fl_Button solo_button { | |||
label s | |||
tooltip solo xywh {172 26 24 24} type Toggle selection_color 91 labelfont 5 labelsize 12 | |||
} | |||
} | |||
Fl_Group controls_header_group {open | |||
xywh {5 53 195 64} labelsize 11 align 25 | |||
} { | |||
Fl_Box {} { | |||
label Controls | |||
xywh {5 53 195 12} box FLAT_BOX color 47 labelsize 9 align 24 | |||
code0 {o->color( fl_color_add_alpha( o->color(), 127 ) );} | |||
} | |||
Fl_Box {} { | |||
label spacer | |||
xywh {5 63 195 53} labeltype NO_LABEL resizable | |||
} | |||
} | |||
Fl_Group takes_header_group {open | |||
xywh {5 115 195 55} labelsize 11 align 25 | |||
} { | |||
Fl_Box {} { | |||
label Takes | |||
xywh {5 115 195 12} box FLAT_BOX color 47 labelsize 9 align 24 | |||
code0 {o->color( fl_color_add_alpha( o->color(), 127 ) );} | |||
} | |||
Fl_Box {} { | |||
label spacer | |||
xywh {5 126 195 40} labeltype NO_LABEL resizable | |||
} | |||
} | |||
Fl_Box {} { | |||
label spacer | |||
xywh {0 165 200 45} labeltype NO_LABEL resizable | |||
} | |||
} | |||
widget_class Control_Sequence_Header {open | |||
xywh {390 981 200 55} type Double visible | |||
} { | |||
Fl_Input take_name_input { | |||
label {input:} | |||
xywh {5 3 192 22} labeltype NO_LABEL align 20 when 8 | |||
class Fl_Sometimes_Input | |||
} | |||
Fl_Button outputs_indicator { | |||
label out | |||
tooltip {lit if outputs are connected} xywh {33 26 24 16} box BORDER_BOX color 48 selection_color 90 labelfont 5 labelsize 10 | |||
} | |||
Fl_Output {} { | |||
xywh {60 26 92 24} color 32 labeltype NO_LABEL align 20 textsize 9 | |||
} | |||
Fl_Menu_Button {} {open | |||
xywh {147 26 24 24} color 52 | |||
} {} | |||
Fl_Button delete_control_button { | |||
label X | |||
tooltip {Expand controls} xywh {172 26 24 24} color 52 labelfont 5 labelsize 12 | |||
} | |||
} | |||
widget_class Take_Header {open | |||
xywh {868 986 200 50} type Double visible | |||
} { | |||
Fl_Input take_name_input { | |||
label {input:} | |||
xywh {5 3 193 22} labeltype NO_LABEL align 20 when 8 | |||
class Fl_Sometimes_Input | |||
} | |||
Fl_Button delete_take_button { | |||
label X | |||
tooltip {Expand controls} xywh {172 26 24 24} color 52 labelfont 5 labelsize 12 | |||
} | |||
Fl_Button set_active_take_button { | |||
label {@2} | |||
tooltip {select this take as active sequence} xywh {147 26 24 24} color 52 labelfont 5 labelsize 12 | |||
} | |||
} |
@@ -78,6 +78,7 @@ src/Sequence_Point.C | |||
src/Sequence_Region.C | |||
src/Sequence_Widget.C | |||
src/TLE.fl | |||
src/Track_Header.fl | |||
src/Tempo_Point.C | |||
src/Tempo_Sequence.C | |||
src/Time_Point.C | |||