@@ -1,10 +1,10 @@ | |||
CXXFLAGS=-ggdb -Wall -O0 | |||
CXXFLAGS=-ggdb -Wall -O0 | |||
#LIBS=-L/usr/lib/sox -I/usr/include/sox -lsox -lsfx | |||
LIBS=-lsndfile `fltk-config --ldflags` | |||
# CXXFLAGS=`fltk-config -cxxflags` | |||
SRCS= Waveform.C Region.C Peaks.C main.C Track.C Audio_Track.C Timeline.C Audio_File.C Audio_File_SF.C Loggable.C | |||
SRCS= Waveform.C Region.C Peaks.C main.C Track.C Audio_Track.C Timeline.C Audio_File.C Audio_File_SF.C Loggable.C Track_Header.C | |||
OBJS=$(SRCS:.C=.o) | |||
@@ -16,6 +16,10 @@ all: test makedepend | |||
@ echo -n "Compiling: "; tput bold; tput setaf 3; echo $<; tput sgr0; true | |||
@ $(CXX) $(CXXFLAGS) -c $< -o $@ | |||
%.C : %.fl | |||
@ fluid -c $< | |||
$(OBJS): Makefile | |||
@@ -193,7 +193,7 @@ Region::handle ( int m ) | |||
static bool copied = false; | |||
static nframes_t os; | |||
int X = Fl::event_x(); | |||
int X = Fl::event_x() - _track->x(); | |||
int Y = Fl::event_y(); | |||
int ret; | |||
@@ -25,6 +25,8 @@ | |||
#include <FL/Fl_Scrollbar.H> | |||
#include "Track_Header.H" | |||
void | |||
cb_hscroll ( Fl_Widget *w, void *v ) | |||
{ | |||
@@ -90,7 +92,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X, | |||
} | |||
{ | |||
Fl_Pack *o = new Fl_Pack( X, Y, W - vscroll->w(), H - hscroll->h(), "rulers" ); | |||
Fl_Pack *o = new Fl_Pack( X + Track_Header::width(), Y, W - Track_Header::width() - vscroll->w(), H - hscroll->h(), "rulers" ); | |||
o->type( Fl_Pack::VERTICAL ); | |||
{ | |||
@@ -144,13 +146,15 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X, | |||
Track *l = NULL; | |||
for ( int i = 16; i--; ) | |||
{ | |||
Track *o = new Audio_Track( 0, 0, 800, 100 ); | |||
Track_Header *t = new Track_Header( 0, 0, 800, 100 ); | |||
Track *o = new Audio_Track( 0, 0, 1, 100 ); | |||
o->prev( l ); | |||
if ( l ) | |||
l->next( o ); | |||
l = o; | |||
o->end(); | |||
// o->end(); | |||
t->track( o ); | |||
} | |||
tracks = o; | |||
@@ -345,12 +349,15 @@ Timeline::draw ( void ) | |||
int dy = _old_yposition - yposition; | |||
if ( ! dy ) | |||
fl_scroll( X, rulers->y(), W, rulers->h(), dx, 0, draw_clip, this ); | |||
fl_scroll( X + Track_Header::width(), rulers->y(), rulers->w(), rulers->h(), dx, 0, draw_clip, this ); | |||
Y = rulers->y() + rulers->h(); | |||
H = h() - rulers->h() - hscroll->h(); | |||
fl_scroll( X, Y, W, H, dx, dy, draw_clip, this ); | |||
if ( dy == 0 ) | |||
fl_scroll( X + Track_Header::width(), Y, W - Track_Header::width(), H, dx, dy, draw_clip, this ); | |||
else | |||
fl_scroll( X, Y, W, H, dx, dy, draw_clip, this ); | |||
_old_xposition = xoffset; | |||
_old_yposition = yposition; | |||
@@ -85,7 +85,7 @@ Track::remove ( Track_Widget *r ) | |||
Track_Widget * | |||
Track::event_widget ( void ) | |||
{ | |||
int ets = timeline->xoffset + timeline->x_to_ts( Fl::event_x() ); | |||
int ets = timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ); | |||
for ( list <Track_Widget *>::const_reverse_iterator r = _widgets.rbegin(); r != _widgets.rend(); r++ ) | |||
if ( ets > (*r)->offset() && ets < (*r)->offset() + (*r)->length() ) | |||
return (*r); | |||
@@ -88,6 +88,8 @@ public: | |||
box( FL_DOWN_BOX ); | |||
color( fl_darker( FL_GRAY ) ); | |||
end(); | |||
log_create(); | |||
} | |||
@@ -0,0 +1,55 @@ | |||
# data file for the Fltk User Interface Designer (fluid) | |||
version 1.0107 | |||
header_name {.H} | |||
code_name {.C} | |||
decl {\#include "Track.H"} {public | |||
} | |||
widget_class Track_Header {open | |||
xywh {30 535 1156 116} type Double resizable visible | |||
} { | |||
Function {width()} {open return_type {static int} | |||
} { | |||
code {return 150;} {} | |||
} | |||
decl {Track *_track;} {} | |||
Fl_Group {} {open selected | |||
xywh {2 2 149 113} box THIN_UP_FRAME | |||
code0 {o->size( Track_Header::width(), o->h() );} | |||
} { | |||
Fl_Group {} {open | |||
xywh {4 4 144 66} | |||
} { | |||
Fl_Input name_field { | |||
xywh {4 9 144 25} color 33 labeltype NO_LABEL labelcolor 32 textcolor 32 | |||
} | |||
Fl_Button record_button { | |||
label {@circle} | |||
xywh {6 38 26 27} type Toggle box THIN_UP_FRAME color 32 labelsize 8 | |||
} | |||
Fl_Button mute_button { | |||
label m | |||
xywh {35 38 26 27} type Toggle box PLASTIC_UP_FRAME color 48 labelsize 11 | |||
} | |||
Fl_Button solo_button { | |||
label s | |||
xywh {66 38 26 27} type Toggle box PLASTIC_UP_FRAME color 48 labelsize 11 | |||
} | |||
Fl_Menu_Button take_menu { | |||
label T open | |||
xywh {97 38 47 27} box THIN_UP_BOX | |||
} {} | |||
} | |||
} | |||
Fl_Pack takes {open | |||
xywh {150 1 1006 114} resizable | |||
code0 {o->resize( x() + width(), y(), w() - width(), h() );} | |||
} {} | |||
Function {track( Track *t )} {open return_type void | |||
} { | |||
code {_track = t; | |||
t->size( 1, takes->h() ); | |||
takes->add( t );} {} | |||
} | |||
} |
@@ -84,7 +84,6 @@ public: | |||
int abs_x ( void ) const { return timeline->ts_to_x( _offset ); } | |||
virtual int abs_w ( void ) const { return timeline->ts_to_x( _end - _start ); } | |||
Fl_Color color ( void ) { return _color; } | |||
Fl_Color box_color ( void ) { return _box_color; } | |||
@@ -130,11 +129,11 @@ public: | |||
} | |||
virtual void | |||
dump ( void ) | |||
{ | |||
printf( "Unknown %p %lu %lu %lu\n", this, _offset, _start, _end ); | |||
} | |||
/* virtual void */ | |||
/* dump ( void ) */ | |||
/* { */ | |||
/* printf( "Unknown %p %lu %lu %lu\n", this, _offset, _start, _end ); */ | |||
/* } */ | |||
virtual void | |||
draw_label ( const char *label, Fl_Align align ) | |||
@@ -253,9 +252,9 @@ public: | |||
redraw(); | |||
if ( timeline->ts_to_x( timeline->xoffset ) + ox + X > 0 ) | |||
if ( timeline->ts_to_x( timeline->xoffset ) + ox + X > _track->x() ) | |||
{ | |||
int nx = ox + X; | |||
int nx = (ox + X) - _track->x(); | |||
_offset = timeline->x_to_ts( nx ) + timeline->xoffset; | |||