@@ -26,6 +26,9 @@ $(OBJS): Makefile | |||
test: $(OBJS) | |||
$(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@ | |||
mixer: Mixer_Strip.o Mixer.o | |||
$(CXX) $(CXXFLAGS) $(LIBS) Mixer_Strip.o Mixer.o -o $@ | |||
clean: | |||
rm -f $(OBJS) test makedepend | |||
@@ -155,7 +155,8 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
Track *l = NULL; | |||
for ( int i = 16; i--; ) | |||
{ | |||
Track_Header *t = new Track_Header( 0, 0, W, 75 ); | |||
// Track_Header *t = new Track_Header( 0, 0, W, 75 ); | |||
Track_Header *t = new Track_Header( 0, 0, W, 30 ); | |||
Track *o = new Audio_Track( 0, 0, 1, 100 ); | |||
o->prev( l ); | |||
if ( l ) | |||
@@ -399,19 +400,34 @@ Timeline::draw_overlay ( void ) | |||
} | |||
int | |||
Timeline::handle ( int m ) | |||
{ | |||
switch ( m ) | |||
{ | |||
case FL_MOUSEWHEEL: | |||
{ | |||
if ( hscroll->handle( m ) ) | |||
return 1; | |||
return vscroll->handle( m ); | |||
} | |||
/* case FL_MOUSEWHEEL: */ | |||
/* { */ | |||
/* // vscroll->deactivate(); */ | |||
/* int r = Fl_Overlay_Window::handle( m ); */ | |||
/* /\* vscroll->activate(); *\/ */ | |||
/* if ( r ) */ | |||
/* return r; */ | |||
/* /\* if ( hscroll->handle( m ) ) *\/ */ | |||
/* /\* return 1; *\/ */ | |||
/* /\* return vscroll->handle( m ); *\/ */ | |||
/* } */ | |||
default: | |||
return Fl_Overlay_Window::handle( m ); | |||
} | |||
} |
@@ -41,25 +41,36 @@ Track_Header::cb_input_field ( void ) | |||
Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) : | |||
Fl_Group ( X, Y, W, H, L ) | |||
{ | |||
_name = NULL; | |||
_track = NULL; | |||
_selected = false; | |||
_size = 3; | |||
Fl_Group::size( w(), height() ); | |||
Track_Header *o = this; | |||
o->box( FL_THIN_UP_BOX ); | |||
{ | |||
Fl_Group *o = new Fl_Group( 2, 2, 149, 113 ); | |||
Fl_Group *o = new Fl_Group( 2, 2, 149, 70 ); | |||
o->color( ( Fl_Color ) 53 ); | |||
{ | |||
Fl_Group *o = new Fl_Group( 4, 4, 144, 66 ); | |||
{ | |||
Fl_Input *o = name_field = new Fl_Input( 4, 9, 144, 25 ); | |||
o->color( ( Fl_Color ) 33 ); | |||
o->labeltype( FL_NO_LABEL ); | |||
o->labelcolor( FL_GRAY0 ); | |||
o->textcolor( 32 ); | |||
Fl_Input *o = name_field = new Fl_Input( 2, 2, 144, 24 ); | |||
o->color( ( Fl_Color ) 33 ); | |||
o->labeltype( FL_NO_LABEL ); | |||
o->labelcolor( FL_GRAY0 ); | |||
o->textcolor( 32 ); | |||
o->callback( cb_input_field, (void*)this ); | |||
} | |||
{ | |||
Fl_Group *o = controls = new Fl_Group( 2, 28, 149, 24 ); | |||
o->callback( cb_input_field, (void*)this ); | |||
} | |||
{ | |||
Fl_Button *o = record_button = | |||
new Fl_Button( 6, 38, 26, 27, "@circle" ); | |||
new Fl_Button( 6, 28, 26, 24, "@circle" ); | |||
o->type( 1 ); | |||
o->box( FL_THIN_UP_BOX ); | |||
o->color( FL_LIGHT1 ); | |||
@@ -68,7 +79,7 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) : | |||
} | |||
{ | |||
Fl_Button *o = mute_button = | |||
new Fl_Button( 35, 38, 26, 27, "m" ); | |||
new Fl_Button( 35, 28, 26, 24, "m" ); | |||
o->type( 1 ); | |||
o->box( FL_THIN_UP_BOX ); | |||
o->color( FL_LIGHT1 ); | |||
@@ -76,7 +87,7 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) : | |||
} | |||
{ | |||
Fl_Button *o = solo_button = | |||
new Fl_Button( 66, 38, 26, 27, "s" ); | |||
new Fl_Button( 66, 28, 26, 24, "s" ); | |||
o->type( 1 ); | |||
o->box( FL_THIN_UP_BOX ); | |||
o->color( FL_LIGHT1 ); | |||
@@ -84,14 +95,21 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) : | |||
} | |||
{ | |||
Fl_Menu_Button *o = take_menu = | |||
new Fl_Menu_Button( 97, 38, 47, 27, "T" ); | |||
new Fl_Menu_Button( 97, 28, 47, 24, "T" ); | |||
o->box( FL_THIN_UP_BOX ); | |||
o->color( FL_LIGHT1 ); | |||
o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); | |||
} | |||
o->end(); | |||
} | |||
o->size( Track_Header::width(), o->h() ); | |||
{ | |||
Fl_Box *o = new Fl_Box( 0, 76, 149, 38 ); | |||
o->box( FL_FLAT_BOX ); | |||
Fl_Group::current()->resizable( o ); | |||
} | |||
o->size( Track_Header::width(), h() ); | |||
o->end(); | |||
} | |||
{ | |||
@@ -104,11 +122,6 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) : | |||
} | |||
end(); | |||
_name = NULL; | |||
_track = NULL; | |||
_selected = false; | |||
log_create(); | |||
} | |||
@@ -26,6 +26,7 @@ | |||
#include <FL/Fl_Button.H> | |||
#include <FL/Fl_Menu_Button.H> | |||
#include <FL/Fl_Pack.H> | |||
#include <FL/Fl_Box.H> | |||
#include "Loggable.H" | |||
@@ -45,6 +46,8 @@ private: | |||
bool _selected; | |||
int _size; | |||
public: | |||
Fl_Input * name_field; | |||
@@ -52,7 +55,7 @@ public: | |||
Fl_Button *mute_button; | |||
Fl_Button *solo_button; | |||
Fl_Menu_Button *take_menu; | |||
Fl_Group *controls; | |||
Fl_Pack *takes; | |||
const char *class_name ( void ) { return "Track_Header"; } | |||
@@ -73,25 +76,32 @@ public: | |||
v[ strlen( v ) - 2 ] = '\0'; | |||
} | |||
if ( ! strcmp( s, ":selected" ) ) | |||
_selected = atoi( v ); | |||
if ( ! strcmp( s, ":h" ) ) | |||
{ | |||
size( atoi( v ) ); | |||
Fl_Widget::size( w(), height() ); | |||
} | |||
else | |||
if ( ! strcmp( s, ":name" ) ) | |||
{ | |||
_name = strdup( v ); | |||
name_field->value( _name ); | |||
} | |||
if ( ! strcmp( s, ":selected" ) ) | |||
_selected = atoi( v ); | |||
else | |||
if ( ! strcmp( s, ":track" ) ) | |||
if ( ! strcmp( s, ":name" ) ) | |||
{ | |||
int i; | |||
sscanf( v, "%X", &i ); | |||
Track *t = (Track*)Loggable::find( i ); | |||
_name = strdup( v ); | |||
name_field->value( _name ); | |||
} | |||
else | |||
if ( ! strcmp( s, ":track" ) ) | |||
{ | |||
int i; | |||
sscanf( v, "%X", &i ); | |||
Track *t = (Track*)Loggable::find( i ); | |||
assert( t ); | |||
assert( t ); | |||
_track = t; | |||
} | |||
_track = t; | |||
} | |||
free( s ); | |||
@@ -103,13 +113,14 @@ public: | |||
char ** get ( void ) | |||
{ | |||
char **sa = (char**)malloc( sizeof( char* ) * (1 + 3) ); | |||
char **sa = (char**)malloc( sizeof( char* ) * (1 + 4) ); | |||
int i = 0; | |||
asprintf( &sa[ i++ ], ":name \"%s\"", _name ? _name : "" ); | |||
asprintf( &sa[ i++ ], ":track 0x%X", _track ? _track->id() : 0 ); | |||
asprintf( &sa[ i++ ], ":selected %d", _selected ); | |||
asprintf( &sa[ i++ ], ":h %d", size() ); | |||
// asprintf( &sa[ i++ ], ":gain %f", _scale ); | |||
sa[ i ] = NULL; | |||
@@ -117,6 +128,20 @@ public: | |||
return sa; | |||
} | |||
/* for loggable */ | |||
static Loggable * | |||
create ( char **sa ) | |||
{ | |||
Track_Header *r = new Track_Header( 0, 0, 1, 1 ); | |||
r->set( sa ); | |||
return (Loggable *)r; | |||
} | |||
void | |||
draw ( void ) | |||
{ | |||
@@ -134,6 +159,33 @@ public: | |||
Fl_Group::draw(); | |||
} | |||
int size ( void ) const { return _size; } | |||
void size ( int v ) | |||
{ | |||
if ( v < 0 || v > 3 ) | |||
return; | |||
_size = v; | |||
Fl_Group::size( w(), height() ); | |||
if ( _track ) | |||
_track->size( _track->w(), height() ); | |||
if ( _size == 0 ) | |||
controls->hide(); | |||
else | |||
controls->show(); | |||
parent()->redraw(); | |||
} | |||
int height ( void ) const | |||
{ | |||
static int table[] = { 30, 80, 150, 300 }; | |||
return table[ _size ]; | |||
} | |||
const char * name ( void ) const { return _name; } | |||
bool mute ( void ) const { return mute_button->value(); } | |||
bool solo ( void ) const { return solo_button->value(); } | |||
@@ -147,5 +199,32 @@ public: | |||
void track( Track * t ); | |||
int handle ( int m ) | |||
{ | |||
switch ( m ) | |||
{ | |||
case FL_MOUSEWHEEL: | |||
{ | |||
if ( ! Fl::event_shift() ) | |||
return 0; | |||
int d = Fl::event_dy(); | |||
printf( "%d\n", d ); | |||
if ( d < 0 ) | |||
size( size() - 1 ); | |||
else | |||
size( size() + 1 ); | |||
return 1; | |||
} | |||
default: | |||
return Fl_Group::handle( m ); | |||
} | |||
} | |||
}; | |||
#endif |
@@ -158,18 +158,9 @@ public: | |||
} | |||
} | |||
/* fl_font( FL_HELVETICA, 14 ); */ | |||
/* fl_color( FL_BLACK ); */ | |||
/* fl_draw( label, X + 2, Y + 2, w(), h(), align ); */ | |||
/* fl_color( FL_WHITE ); */ | |||
/* fl_draw( label, X, Y, w(), h(), align ); */ | |||
/* for some reasone FL_SHADOW_LABLE doesn't always use | |||
* black for the shadow color...so we can't rely on it. */ | |||
Fl_Label lab; | |||
lab.color = FL_WHITE; | |||
lab.color = 0; | |||
lab.type = FL_SHADOW_LABEL; | |||
lab.value = label; | |||
lab.font = FL_HELVETICA; | |||
@@ -53,12 +53,13 @@ draw_waveform ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int chann | |||
int mid = Y + (H / 2); | |||
// FIXME: cache this stuff. | |||
fl_color( fl_color_average( FL_RED, color, fabs( p.max - p.min ) ) ); | |||
p.max *= _scale; | |||
p.min *= _scale; | |||
// FIXME: cache this stuff. | |||
fl_color( fl_color_average( FL_RED, color, fabs( p.max - p.min ) ) ); | |||
if ( p.min < -1.0 || p.max > 1.0 ) | |||
fl_color( FL_RED ); | |||
@@ -47,7 +47,7 @@ | |||
#include "Time_Track.H" | |||
#include "Loggable.H" | |||
#include "Track_Header.H" | |||
#include "const.h" | |||
Timeline *timeline; | |||
@@ -73,20 +73,14 @@ main ( int argc, char **argv ) | |||
Fl::scheme( "plastic" ); | |||
Loggable::open( "history" ); | |||
Loggable::register_create( "Region", &Region::create ); | |||
Loggable::register_create( "Tempo_Point", &Tempo_Point::create ); | |||
Loggable::register_create( "Time_Point", &Time_Point::create ); | |||
/* welcome to C++ */ | |||
Loggable::register_create( "Region", &Region::create ); | |||
Loggable::register_create( "Tempo_Point", &Tempo_Point::create ); | |||
Loggable::register_create( "Time_Point", &Time_Point::create ); | |||
Loggable::register_create( "Track_Header", &Track_Header::create ); | |||
timeline = new Timeline( 0, 24, main_window->w(), main_window->h() - 24, "Timeline" ); | |||
// Region *wave = new Region( Clip::from_file( "streambass8.wav" ) ); | |||
/* track1->next( track2 ); */ | |||
/* track2->prev( track1 ); */ | |||
// timeline->scrollbar = new Scalebar( 0, 600 - 24, 800, 24 ); | |||
Fl_Button *o = new Fl_Button( 0, 0, 50, 24, "undo" ); | |||
o->shortcut( FL_CTRL + 'z' ); | |||
o->callback( cb_undo, 0 ); | |||
@@ -94,7 +88,5 @@ main ( int argc, char **argv ) | |||
main_window->end(); | |||
main_window->show(); | |||
/* wave->redraw(); */ | |||
Fl::run(); | |||
} |