@@ -81,6 +81,10 @@ public: | |||
track->add( this ); | |||
log_create(); | |||
/* FIXME: temporary */ | |||
labeltype( FL_NO_LABEL ); | |||
} | |||
~Audio_Sequence ( ) | |||
@@ -30,12 +30,12 @@ switched between Bar Beat Tick and Wallclock displays */ | |||
class Clock : public Fl_Widget | |||
{ | |||
enum { BBT, HMS }; | |||
nframes_t _when; | |||
public: | |||
enum { BBT, HMS }; | |||
static void | |||
frame_to_HMS ( char *dst, int n, nframes_t frame ) | |||
{ | |||
@@ -44,7 +44,7 @@ public: | |||
int M = S / 60; S -= M * 60; | |||
int H = M / 60; M -= H * 60; | |||
snprintf( dst, n, "%d:%d:%.1f", H, M, S ); | |||
snprintf( dst, n, "%02d:%02d:%02.1f", H, M, S ); | |||
} | |||
Clock ( int X, int Y, int W, int H, const char *L=0 ) | |||
@@ -69,11 +69,10 @@ public: | |||
void draw ( void ) | |||
{ | |||
// fl_rectf( x(), y(), w(), h(), color() ); | |||
draw_box(); | |||
char buf[15]; | |||
*buf = '\0'; | |||
switch ( type() ) | |||
{ | |||
@@ -98,14 +97,14 @@ public: | |||
const int dw = w() - Fl::box_dw( box() ); | |||
const int dh = h() - Fl::box_dh( box() ); | |||
fl_draw( buf, dx, dy, dw, dh, (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_TOP) ); | |||
fl_draw( buf, dx, dy, dw, dh - 9, FL_ALIGN_CENTER ); | |||
for ( int i = strlen( buf ); i--; ) | |||
if ( isdigit( buf[ i ] ) ) | |||
buf[ i ] = ' '; | |||
fl_color( fl_darker( c ) ); | |||
fl_draw( buf, dx, dy, dw, dh, (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_TOP) ); | |||
fl_draw( buf, dx, dy, dw, dh - 9, FL_ALIGN_CENTER ); | |||
fl_font( FL_HELVETICA, 9 ); | |||
fl_color( FL_RED ); | |||
@@ -3,6 +3,7 @@ SRCS= \ | |||
Waveform.C \ | |||
Region.C \ | |||
main.C \ | |||
TLE.C \ | |||
Sequence.C \ | |||
Audio_Sequence.C \ | |||
Control_Sequence.C \ | |||
@@ -0,0 +1,267 @@ | |||
# data file for the Fltk User Interface Designer (fluid) | |||
version 1.0108 | |||
header_name {.H} | |||
code_name {.C} | |||
decl {\#include "Timeline.H"} {} | |||
decl {\#include "Transport.H"} {} | |||
decl {\#include "Clock.H"} {public | |||
} | |||
decl {\#include <FL/Fl.H>} {} | |||
class TLE {open | |||
} { | |||
Function {TLE()} {open | |||
} { | |||
code {make_window(); | |||
// Fl::visual( RGB8 ); | |||
Fl::visible_focus( 0 ); | |||
Fl::get_system_colors(); | |||
Fl::scheme( "plastic" );} {} | |||
} | |||
Function {make_window()} {open | |||
} { | |||
Fl_Window main_window { | |||
label {Non-DAW - Timeline} open | |||
xywh {549 146 1024 768} type Double resizable xclass {Non-DAW} visible | |||
} { | |||
Fl_Group {} {open | |||
xywh {0 0 1024 25} | |||
} {} | |||
Fl_Menu_Bar {} {open | |||
xywh {0 0 1024 25} | |||
} { | |||
Submenu {} { | |||
label {&Session} open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label {&New} | |||
xywh {0 0 40 25} | |||
} | |||
MenuItem {} { | |||
label {&Open} | |||
xywh {10 10 40 25} | |||
} | |||
MenuItem {} { | |||
label {&Compact} | |||
xywh {20 20 40 25} | |||
} | |||
Submenu {} { | |||
label Export open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label Session | |||
xywh {0 0 40 25} | |||
} | |||
MenuItem {} { | |||
label Range | |||
xywh {10 10 40 25} | |||
} | |||
} | |||
MenuItem {} { | |||
label {&Quit} | |||
xywh {40 40 40 25} shortcut 0x40071 | |||
} | |||
} | |||
Submenu {} { | |||
label {&Edit} open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label Preferences | |||
xywh {0 0 40 25} | |||
} | |||
MenuItem {} { | |||
label Undo | |||
xywh {0 0 40 25} shortcut 0x4007a | |||
} | |||
} | |||
Submenu {} { | |||
label Transport open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label Home | |||
xywh {0 0 40 25} | |||
} | |||
MenuItem {} { | |||
label End | |||
xywh {10 10 40 25} | |||
} | |||
MenuItem {} { | |||
label Stop | |||
xywh {20 20 40 25} | |||
} | |||
MenuItem {} { | |||
label Play | |||
xywh {30 30 40 25} | |||
} | |||
MenuItem {} { | |||
label Record | |||
xywh {40 40 40 25} | |||
} | |||
} | |||
Submenu {} { | |||
label {&View} open | |||
xywh {0 0 74 25} | |||
} { | |||
Submenu {} { | |||
label Zoom open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label Fit | |||
xywh {10 10 40 25} | |||
} | |||
MenuItem {} { | |||
label {1 sec.} | |||
xywh {10 10 40 25} | |||
} | |||
MenuItem {} { | |||
label {1 min.} | |||
xywh {20 20 40 25} | |||
} | |||
MenuItem {} { | |||
label {1 hour.} | |||
xywh {30 30 40 25} | |||
} | |||
} | |||
} | |||
Submenu {} { | |||
label {&Options} open | |||
xywh {0 0 74 25} divider | |||
} { | |||
Submenu {} { | |||
label Display open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label item | |||
xywh {0 0 40 25} | |||
} | |||
Submenu {} { | |||
label Region open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label {Filled waveforms} | |||
xywh {10 10 40 25} type Toggle value 1 | |||
} | |||
MenuItem {} { | |||
label {Colorful waveforms} | |||
xywh {20 20 40 25} type Toggle value 1 | |||
} | |||
MenuItem {} { | |||
label {Filled fades} | |||
xywh {30 30 40 25} type Toggle value 1 | |||
} | |||
} | |||
Submenu {} { | |||
label {Control Sequence} open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label Polygon | |||
xywh {20 20 40 25} type Toggle value 1 | |||
} | |||
MenuItem {} { | |||
label Graded | |||
xywh {30 30 40 25} type Toggle value 1 | |||
} | |||
MenuItem {} { | |||
label Ruled | |||
xywh {40 40 40 25} type Toggle value 1 | |||
} | |||
} | |||
Submenu {} { | |||
label Style open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label Default | |||
xywh {0 0 40 25} type Radio value 1 | |||
} | |||
MenuItem {} { | |||
label Flat | |||
xywh {10 10 40 25} type Radio | |||
} | |||
} | |||
Submenu {} { | |||
label Colors open | |||
xywh {0 0 74 25} | |||
} { | |||
MenuItem {} { | |||
label System | |||
xywh {0 0 40 25} type Radio | |||
} | |||
MenuItem {} { | |||
label Dark | |||
xywh {10 10 40 25} type Radio value 1 | |||
} | |||
MenuItem {} { | |||
label Light | |||
xywh {20 20 40 25} type Radio | |||
} | |||
} | |||
} | |||
} | |||
MenuItem {} { | |||
label {&Help} | |||
xywh {0 0 40 25} | |||
} | |||
} | |||
Fl_Box {} { | |||
label {<Timeline>} | |||
xywh {0 74 1024 695} box FLAT_BOX color 47 labelsize 100 | |||
code0 {timeline = o;} | |||
class Timeline | |||
} | |||
Fl_Box {} { | |||
label {<Transport>} | |||
xywh {0 25 137 46} color 30 | |||
code0 {transport = o;} | |||
code1 {o->labeltype( FL_NO_LABEL );} | |||
class Transport | |||
} | |||
Fl_Pack clocks_pack {open | |||
xywh {139 25 285 46} type HORIZONTAL | |||
} { | |||
Fl_Box playhead_clock { | |||
label PLAYHEAD selected | |||
xywh {139 29 137 40} box BORDER_BOX color 46 | |||
code0 {o->type( Clock::HMS );} | |||
class Clock | |||
} | |||
Fl_Box {} { | |||
label PLAYHEAD selected | |||
xywh {278 29 142 40} box BORDER_BOX color 46 | |||
code0 {o->type( Clock::BBT );} | |||
class Clock | |||
} | |||
} | |||
Fl_Progress capture_buffer_progress { | |||
label {c:} | |||
xywh {925 26 99 14} labelsize 10 align 4 | |||
} | |||
Fl_Progress dsp_usage_progress { | |||
label {DSP:} | |||
xywh {925 55 99 16} labelsize 9 align 4 | |||
} | |||
Fl_Progress playback_buffer_progress { | |||
label {p:} | |||
xywh {925 40 99 14} labelsize 10 align 4 | |||
} | |||
Fl_Box {} { | |||
label {<empty>} | |||
xywh {427 29 469 42} | |||
code0 {o->labeltype( FL_NO_LABEL );} | |||
} | |||
} | |||
} | |||
} |
@@ -85,6 +85,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
_enable_measure_lines = true; | |||
X = Y = 0; | |||
{ | |||
Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 ); | |||
@@ -101,7 +102,6 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
Fl_Scrollbar *o = new Fl_Scrollbar( X + W - 18, Y, 18, H - 18 ); | |||
o->type( FL_VERTICAL ); | |||
// o->step( 10 ); | |||
o->callback( cb_scroll, this ); | |||
vscroll = o; | |||
} | |||
@@ -115,15 +115,10 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
o->color( FL_RED ); | |||
/* o->add( new Tempo_Point( 0, 120 ) ); */ | |||
/* o->add( new Tempo_Point( 56000, 250 ) ); */ | |||
o->label( "Tempo" ); | |||
o->align( FL_ALIGN_LEFT ); | |||
tempo_track = o; | |||
// o->end(); | |||
} | |||
{ | |||
@@ -131,15 +126,10 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
o->color( fl_color_average( FL_RED, FL_WHITE, 0.50f ) ); | |||
/* o->add( new Time_Point( 0, 4, 4 ) ); */ | |||
/* o->add( new Time_Point( 345344, 6, 8 ) ); */ | |||
o->label( "Time" ); | |||
o->align( FL_ALIGN_LEFT ); | |||
time_track = o; | |||
// o->end(); | |||
} | |||
{ | |||
@@ -147,15 +137,10 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
o->color( FL_GREEN ); | |||
/* o->add( new Time_Point( 0, 4, 4 ) ); */ | |||
/* o->add( new Time_Point( 345344, 6, 8 ) ); */ | |||
o->label( "Ruler" ); | |||
o->align( FL_ALIGN_LEFT ); | |||
ruler_track = o; | |||
// o->end(); | |||
} | |||
o->size( o->w(), o->child( 0 )->h() * o->children() ); | |||
@@ -165,10 +150,6 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
{ | |||
/* Fl_Scroll *o = new Fl_Scroll( 0, 24 * 2, 800, 600 - (24 * 3) ); */ | |||
/* o->type( Fl_Scroll::VERTICAL_ALWAYS ); */ | |||
_sample_rate = 44100; | |||
_fpp = 256; | |||
_length = _sample_rate * 60 * 2; | |||
@@ -178,26 +159,10 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
o->type( Fl_Pack::VERTICAL ); | |||
o->spacing( 0 ); | |||
/* for ( int i = 1; i--; ) */ | |||
/* { */ | |||
/* // Track *t = new Track( 0, 0, W, 75 ); */ | |||
/* Track *t = new Track( 0, 0, W, 30 ); */ | |||
/* Sequence *o = new Audio_Sequence( 0, 0, 1, 100 ); */ | |||
/* t->track( o ); */ | |||
/* t->add( new Audio_Sequence( 0, 0, 1, 100 ) ); */ | |||
/* t->add( new Audio_Sequence( 0, 0, 1, 100 ) ); */ | |||
/* t->add_control( new Control_Sequence( 0, 0, 1, 100 ) ); */ | |||
/* t->color( (Fl_Color)rand() ); */ | |||
/* } */ | |||
tracks = o; | |||
o->end(); | |||
resizable( o ); | |||
} | |||
/* scroll = o; */ | |||
/* o->end(); */ | |||
} | |||
@@ -434,9 +399,16 @@ Timeline::draw_clip ( void * v, int X, int Y, int W, int H ) | |||
} | |||
static unsigned char *rect_image; | |||
// static unsigned char *rect_image; | |||
void | |||
Timeline::resize ( int X, int Y, int W, int H ) | |||
{ | |||
Fl_Overlay_Window::resize( X, Y, W, H ); | |||
/* why is this necessary? */ | |||
rulers->resize( Track::width(), 0, W, rulers->h() ); | |||
} | |||
void | |||
Timeline::draw ( void ) | |||
@@ -143,6 +143,8 @@ public: | |||
void yposition ( int Y ); | |||
void draw_playhead ( void ); | |||
void redraw_playhead ( void ); | |||
void resize ( int X, int Y, int W, int H ); | |||
void draw ( void ); | |||
void draw_overlay ( void ); | |||
int handle ( int m ); | |||
@@ -184,7 +184,8 @@ Track::init ( void ) | |||
Fl_Pack *o = pack = new Fl_Pack( width(), 0, 1006, 115 ); | |||
o->labeltype( FL_NO_LABEL ); | |||
o->resize( x() + width(), y(), w() - width(), h() ); | |||
Fl_Group::current()->resizable( o ); | |||
resizable( o ); | |||
{ | |||
Fl_Pack *o = control = new Fl_Pack( width(), 0, pack->w(), 115 ); | |||
@@ -54,40 +54,34 @@ | |||
#include "Engine.H" | |||
// #include "Clock.H" | |||
#include "TLE.H" | |||
#include "Clock.H" | |||
Engine *engine; | |||
Timeline *timeline; | |||
Transport *transport; | |||
void cb_undo ( Fl_Widget *w, void *v ) | |||
{ | |||
Loggable::undo(); | |||
} | |||
/* void cb_undo ( Fl_Widget *w, void *v ) */ | |||
/* { */ | |||
/* Loggable::undo(); */ | |||
/* } */ | |||
const float UPDATE_FREQ = 0.05f; | |||
/* const float UPDATE_FREQ = 0.05f; */ | |||
static void | |||
clock_update_cb ( void *w ) | |||
{ | |||
Fl::repeat_timeout( UPDATE_FREQ, clock_update_cb, w ); | |||
/* static void */ | |||
/* clock_update_cb ( void *w ) */ | |||
/* { */ | |||
/* Fl::repeat_timeout( UPDATE_FREQ, clock_update_cb, w ); */ | |||
((Clock *)w)->set( transport->frame ); | |||
} | |||
/* ((Clock *)w)->set( transport->frame ); */ | |||
/* } */ | |||
int | |||
main ( int argc, char **argv ) | |||
{ | |||
Fl_Window *main_window = new Fl_Window( 0, 0, 1024, 768 ); | |||
Fl::visual( FL_RGB8 ); | |||
Fl::visible_focus( 0 ); | |||
Fl::get_system_colors(); | |||
Fl::scheme( "plastic" ); | |||
// Fl::scheme( "gtk+" ); | |||
/* welcome to C++ */ | |||
LOG_REGISTER_CREATE( Region ); | |||
@@ -100,29 +94,17 @@ main ( int argc, char **argv ) | |||
/* TODO: change to seesion dir */ | |||
transport = new Transport( 0, 0, 120, 40 ); | |||
TLE tle; | |||
/* we don't really need a pointer for this */ | |||
engine = new Engine; | |||
engine->init(); | |||
timeline = new Timeline( 0, 100, main_window->w(), main_window->h() - 24, "Timeline" ); | |||
Loggable::open( "history" ); | |||
Fl_Button *o = new Fl_Button( 0, 0, 50, 24, "undo" ); | |||
o->shortcut( FL_CTRL + 'z' ); | |||
o->callback( cb_undo, 0 ); | |||
{ | |||
Clock *o = new Clock( 400, 0, 170, 40, "PLAYHEAD" ); | |||
o->color( fl_darker( FL_GRAY ) ); | |||
Fl::add_timeout( UPDATE_FREQ, clock_update_cb, o ); | |||
} | |||
// Fl::add_timeout( UPDATE_FREQ, clock_update_cb, o ); | |||
main_window->end(); | |||
main_window->show( argc, argv ); | |||
tle.main_window->show( argc, argv ); | |||
Fl::run(); | |||
} |